1/*	 $NetBSD: i82093var.h,v 1.3 2009/07/29 12:02:06 cegger Exp $ */
2
3#include "opt_xen.h"
4#define _IOAPIC_CUSTOM_RW
5#include <x86/i82093var.h>
6#include <hypervisor.h>
7
8static inline  uint32_t
9ioapic_read_ul(struct ioapic_softc *sc, int regid)
10{
11	physdev_op_t op;
12	int ret;
13
14        op.cmd = PHYSDEVOP_APIC_READ;
15	op.u.apic_op.apic_physbase = sc->sc_pa;
16	op.u.apic_op.reg = regid;
17	ret = HYPERVISOR_physdev_op(&op);
18	if (ret) {
19		printf("PHYSDEVOP_APIC_READ ret %d\n", ret);
20		panic("PHYSDEVOP_APIC_READ");
21	}
22	return op.u.apic_op.value;
23}
24
25static inline void
26ioapic_write_ul(struct ioapic_softc *sc, int regid, uint32_t val)
27{
28	physdev_op_t op;
29	int ret;
30
31        op.cmd = PHYSDEVOP_APIC_WRITE;
32	op.u.apic_op.apic_physbase = sc->sc_pa;
33	op.u.apic_op.reg = regid;
34	op.u.apic_op.value = val;
35	ret = HYPERVISOR_physdev_op(&op);
36	if (ret)
37		printf("PHYSDEVOP_APIC_WRITE ret %d\n", ret);
38}
39