vatpic.h revision 268891
1117395Skan/*-
2117395Skan * Copyright (c) 2014 Tycho Nightingale <tycho.nightingale@pluribusnetworks.com>
3117395Skan * All rights reserved.
4117395Skan *
5169689Skan * Redistribution and use in source and binary forms, with or without
6117395Skan * modification, are permitted provided that the following conditions
7117395Skan * are met:
8117395Skan * 1. Redistributions of source code must retain the above copyright
9117395Skan *    notice, this list of conditions and the following disclaimer.
10117395Skan * 2. Redistributions in binary form must reproduce the above copyright
11117395Skan *    notice, this list of conditions and the following disclaimer in the
12117395Skan *    documentation and/or other materials provided with the distribution.
13117395Skan *
14117395Skan * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
15117395Skan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16117395Skan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17117395Skan * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18117395Skan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19117395Skan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20117395Skan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21117395Skan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22117395Skan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23117395Skan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24117395Skan * SUCH DAMAGE.
25117395Skan *
26117395Skan * $FreeBSD: stable/10/sys/amd64/vmm/io/vatpic.h 268891 2014-07-19 22:06:46Z jhb $
27117395Skan */
28117395Skan
29117395Skan#ifndef _VATPIC_H_
30169689Skan#define	_VATPIC_H_
31169689Skan
32117395Skan#include <isa/isareg.h>
33169689Skan
34169689Skan#define	ICU_IMR_OFFSET	1
35132718Skan
36117395Skan#define	IO_ELCR1	0x4d0
37132718Skan#define	IO_ELCR2	0x4d1
38117395Skan
39117395Skanstruct vatpic *vatpic_init(struct vm *vm);
40117395Skanvoid vatpic_cleanup(struct vatpic *vatpic);
41117395Skan
42132718Skanint vatpic_master_handler(void *vm, int vcpuid, bool in, int port, int bytes,
43169689Skan    uint32_t *eax);
44117395Skanint vatpic_slave_handler(void *vm, int vcpuid, bool in, int port, int bytes,
45169689Skan    uint32_t *eax);
46117395Skanint vatpic_elc_handler(void *vm, int vcpuid, bool in, int port, int bytes,
47169689Skan    uint32_t *eax);
48132718Skan
49117395Skanint vatpic_assert_irq(struct vm *vm, int irq);
50117395Skanint vatpic_deassert_irq(struct vm *vm, int irq);
51117395Skanint vatpic_pulse_irq(struct vm *vm, int irq);
52117395Skan
53117395Skanvoid vatpic_pending_intr(struct vm *vm, int *vecptr);
54132718Skanvoid vatpic_intr_accepted(struct vm *vm, int vector);
55132718Skan
56132718Skan#endif	/* _VATPIC_H_ */
57132718Skan