Konrad Rzeszutek Wilk | 31b3c9d | 2012-03-20 18:53:10 -0400 | [diff] [blame] | 1 | #include <linux/init.h> |
Ingo Molnar | 87e4baa | 2012-05-18 09:34:45 +0200 | [diff] [blame] | 2 | |
Konrad Rzeszutek Wilk | 31b3c9d | 2012-03-20 18:53:10 -0400 | [diff] [blame] | 3 | #include <asm/x86_init.h> |
Lin Ming | ab6ec39 | 2012-05-01 00:16:27 +0800 | [diff] [blame] | 4 | #include <asm/apic.h> |
Lin Ming | ab6ec39 | 2012-05-01 00:16:27 +0800 | [diff] [blame] | 5 | #include <asm/xen/hypercall.h> |
Konrad Rzeszutek Wilk | 31b3c9d | 2012-03-20 18:53:10 -0400 | [diff] [blame] | 6 | |
Ingo Molnar | 87e4baa | 2012-05-18 09:34:45 +0200 | [diff] [blame] | 7 | #include <xen/xen.h> |
| 8 | #include <xen/interface/physdev.h> |
Konrad Rzeszutek Wilk | b8b0f55 | 2012-08-21 14:49:34 -0400 | [diff] [blame] | 9 | #include "xen-ops.h" |
Ingo Molnar | 87e4baa | 2012-05-18 09:34:45 +0200 | [diff] [blame] | 10 | |
Konrad Rzeszutek Wilk | b8b0f55 | 2012-08-21 14:49:34 -0400 | [diff] [blame] | 11 | static unsigned int xen_io_apic_read(unsigned apic, unsigned reg) |
Konrad Rzeszutek Wilk | 31b3c9d | 2012-03-20 18:53:10 -0400 | [diff] [blame] | 12 | { |
Lin Ming | ab6ec39 | 2012-05-01 00:16:27 +0800 | [diff] [blame] | 13 | struct physdev_apic apic_op; |
| 14 | int ret; |
| 15 | |
| 16 | apic_op.apic_physbase = mpc_ioapic_addr(apic); |
| 17 | apic_op.reg = reg; |
| 18 | ret = HYPERVISOR_physdev_op(PHYSDEVOP_apic_read, &apic_op); |
| 19 | if (!ret) |
| 20 | return apic_op.value; |
| 21 | |
| 22 | /* fallback to return an emulated IO_APIC values */ |
Konrad Rzeszutek Wilk | 31b3c9d | 2012-03-20 18:53:10 -0400 | [diff] [blame] | 23 | if (reg == 0x1) |
| 24 | return 0x00170020; |
| 25 | else if (reg == 0x0) |
| 26 | return apic << 24; |
| 27 | |
| 28 | return 0xfd; |
| 29 | } |
| 30 | |
| 31 | void __init xen_init_apic(void) |
| 32 | { |
| 33 | x86_io_apic_ops.read = xen_io_apic_read; |
| 34 | } |