NetBSD/sys/arch/xen/include/i82093var.h
bouyer f23d3bb7be Add Xen3 support for ACPI and/or MPBIOS + IOAPIC. To help with this, physical
CPUs are now configured on mainbus only in dom0, and only to know about
their APIC id. virtual CPUs are attached to hypervisor as:
vcpu* at hypervisor?
and this is what's used as curcpu(). The kernel config files needs to be
updated for this, see XEN3_DOM0 or XEN3_DOMU for examples.
XEN3_DOM0 now has acpi, MPBIOS and ioapic by default.
Note that a Xen dom0 kernel doens't have access to the lapic.
2006-09-28 18:53:15 +00:00

45 lines
951 B
C

/* $NetBSD: i82093var.h,v 1.1 2006/09/28 18:53:15 bouyer Exp $ */
#include "opt_xen.h"
#define _IOAPIC_CUSTOM_RW
#include <x86/i82093var.h>
#include <hypervisor.h>
#ifdef XEN3
static inline u_int32_t
ioapic_read_ul(struct ioapic_softc *sc, int regid)
{
physdev_op_t op;
int ret;
op.cmd = PHYSDEVOP_APIC_READ;
op.u.apic_op.apic_physbase = sc->sc_pa;
op.u.apic_op.reg = regid;
ret = HYPERVISOR_physdev_op(&op);
if (ret) {
printf("PHYSDEVOP_APIC_READ ret %d\n", ret);
panic("PHYSDEVOP_APIC_READ");
}
return op.u.apic_op.value;
}
static inline void
ioapic_write_ul(struct ioapic_softc *sc, int regid, u_int32_t val)
{
physdev_op_t op;
int ret;
op.cmd = PHYSDEVOP_APIC_WRITE;
op.u.apic_op.apic_physbase = sc->sc_pa;
op.u.apic_op.reg = regid;
op.u.apic_op.value = val;
ret = HYPERVISOR_physdev_op(&op);
if (ret) {
printf("PHYSDEVOP_APIC_WRITE ret %d\n", ret);
panic("PHYSDEVOP_APIC_WRITE");
}
}
#endif