apic.c 687 B

12345678910111213141516171819202122232425262728293031323334
  1. #include <linux/init.h>
  2. #include <asm/x86_init.h>
  3. #include <asm/apic.h>
  4. #include <asm/xen/hypercall.h>
  5. #include <xen/xen.h>
  6. #include <xen/interface/physdev.h>
  7. #include "xen-ops.h"
  8. static unsigned int xen_io_apic_read(unsigned apic, unsigned reg)
  9. {
  10. struct physdev_apic apic_op;
  11. int ret;
  12. apic_op.apic_physbase = mpc_ioapic_addr(apic);
  13. apic_op.reg = reg;
  14. ret = HYPERVISOR_physdev_op(PHYSDEVOP_apic_read, &apic_op);
  15. if (!ret)
  16. return apic_op.value;
  17. /* fallback to return an emulated IO_APIC values */
  18. if (reg == 0x1)
  19. return 0x00170020;
  20. else if (reg == 0x0)
  21. return apic << 24;
  22. return 0xfd;
  23. }
  24. void __init xen_init_apic(void)
  25. {
  26. x86_io_apic_ops.read = xen_io_apic_read;
  27. }