Konrad Rzeszutek Wilk | 31b3c9d | 2012-03-20 18:53:10 -0400 | [diff] [blame] | 1 | #include <linux/init.h> |
| 2 | #include <asm/x86_init.h> |
Lin Ming | ab6ec39 | 2012-05-01 00:16:27 +0800 | [diff] [blame^] | 3 | #include <asm/apic.h> |
| 4 | #include <xen/interface/physdev.h> |
| 5 | #include <asm/xen/hypercall.h> |
Konrad Rzeszutek Wilk | 31b3c9d | 2012-03-20 18:53:10 -0400 | [diff] [blame] | 6 | |
| 7 | unsigned int xen_io_apic_read(unsigned apic, unsigned reg) |
| 8 | { |
Lin Ming | ab6ec39 | 2012-05-01 00:16:27 +0800 | [diff] [blame^] | 9 | struct physdev_apic apic_op; |
| 10 | int ret; |
| 11 | |
| 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 | |
| 18 | /* fallback to return an emulated IO_APIC values */ |
Konrad Rzeszutek Wilk | 31b3c9d | 2012-03-20 18:53:10 -0400 | [diff] [blame] | 19 | if (reg == 0x1) |
| 20 | return 0x00170020; |
| 21 | else if (reg == 0x0) |
| 22 | return apic << 24; |
| 23 | |
| 24 | return 0xfd; |
| 25 | } |
| 26 | |
| 27 | void __init xen_init_apic(void) |
| 28 | { |
| 29 | x86_io_apic_ops.read = xen_io_apic_read; |
| 30 | } |