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