| 1 | /* $NetBSD: i82093var.h,v 1.4 2010/03/22 16:43:08 cegger Exp $ */ |
|---|---|
| 2 | |
| 3 | #include "opt_xen.h" |
| 4 | #define _IOAPIC_CUSTOM_RW |
| 5 | #include <x86/i82093var.h> |
| 6 | #include <hypervisor.h> |
| 7 | |
| 8 | static inline uint32_t |
| 9 | ioapic_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 | |
| 25 | static inline void |
| 26 | ioapic_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 |