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