Home | History | Annotate | Line # | Download | only in include
i82093var.h revision 1.7
      1  1.7    bouyer /*	 $NetBSD: i82093var.h,v 1.7 2020/04/25 15:26:17 bouyer 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.6  jdolecek 	struct physdev_apic apic_op;
     15  1.1    bouyer 	int ret;
     16  1.1    bouyer 
     17  1.6  jdolecek 	apic_op.apic_physbase = sc->sc_pa;
     18  1.6  jdolecek 	apic_op.reg = regid;
     19  1.6  jdolecek 	ret = HYPERVISOR_physdev_op(PHYSDEVOP_apic_read, &apic_op);
     20  1.1    bouyer 	if (ret) {
     21  1.1    bouyer 		printf("PHYSDEVOP_APIC_READ ret %d\n", ret);
     22  1.1    bouyer 		panic("PHYSDEVOP_APIC_READ");
     23  1.1    bouyer 	}
     24  1.6  jdolecek 	return apic_op.value;
     25  1.1    bouyer }
     26  1.1    bouyer 
     27  1.1    bouyer static inline void
     28  1.2    cegger ioapic_write_ul(struct ioapic_softc *sc, int regid, uint32_t val)
     29  1.1    bouyer {
     30  1.6  jdolecek 	struct physdev_apic apic_op;
     31  1.1    bouyer 	int ret;
     32  1.1    bouyer 
     33  1.6  jdolecek 	apic_op.apic_physbase = sc->sc_pa;
     34  1.6  jdolecek 	apic_op.reg = regid;
     35  1.6  jdolecek 	apic_op.value = val;
     36  1.6  jdolecek 	ret = HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op);
     37  1.4    cegger 	if (ret)
     38  1.1    bouyer 		printf("PHYSDEVOP_APIC_WRITE ret %d\n", ret);
     39  1.1    bouyer }
     40  1.5    cherry 
     41  1.5    cherry #endif /* !_XEN_I82093VAR_H_ */
     42