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