1276428Sneel/*-
2336190Saraujo * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3336190Saraujo *
4276428Sneel * Copyright (c) 2014 Neel Natu (neel@freebsd.org)
5276428Sneel * All rights reserved.
6276428Sneel *
7276428Sneel * Redistribution and use in source and binary forms, with or without
8276428Sneel * modification, are permitted provided that the following conditions
9276428Sneel * are met:
10276428Sneel * 1. Redistributions of source code must retain the above copyright
11276428Sneel *    notice unmodified, this list of conditions, and the following
12276428Sneel *    disclaimer.
13276428Sneel * 2. Redistributions in binary form must reproduce the above copyright
14276428Sneel *    notice, this list of conditions and the following disclaimer in the
15276428Sneel *    documentation and/or other materials provided with the distribution.
16276428Sneel *
17276428Sneel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18276428Sneel * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19276428Sneel * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20276428Sneel * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21276428Sneel * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22276428Sneel * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23276428Sneel * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24276428Sneel * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25276428Sneel * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26276428Sneel * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27276428Sneel *
28276428Sneel * $FreeBSD: stable/11/sys/amd64/vmm/io/vrtc.h 336190 2018-07-11 07:19:42Z araujo $
29276428Sneel */
30276428Sneel
31276428Sneel#ifndef _VRTC_H_
32276428Sneel#define	_VRTC_H_
33276428Sneel
34276428Sneel#include <isa/isareg.h>
35276428Sneel
36276428Sneelstruct vrtc;
37276428Sneel
38276428Sneelstruct vrtc *vrtc_init(struct vm *vm);
39276428Sneelvoid vrtc_cleanup(struct vrtc *vrtc);
40276428Sneelvoid vrtc_reset(struct vrtc *vrtc);
41276428Sneel
42276428Sneeltime_t vrtc_get_time(struct vm *vm);
43276428Sneelint vrtc_set_time(struct vm *vm, time_t secs);
44276428Sneelint vrtc_nvram_write(struct vm *vm, int offset, uint8_t value);
45276428Sneelint vrtc_nvram_read(struct vm *vm, int offset, uint8_t *retval);
46276428Sneel
47276428Sneelint vrtc_addr_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
48276428Sneel    uint32_t *val);
49276428Sneelint vrtc_data_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
50276428Sneel    uint32_t *val);
51276428Sneel
52276428Sneel#endif
53