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