blob: 1913bf2d2a9cd48a17e813be2fe876f50ea88d94 [file] [log] [blame]
Konrad Rzeszutek Wilk31b3c9d2012-03-20 18:53:10 -04001#include <linux/init.h>
2#include <asm/x86_init.h>
Lin Mingab6ec392012-05-01 00:16:27 +08003#include <asm/apic.h>
4#include <xen/interface/physdev.h>
5#include <asm/xen/hypercall.h>
Konrad Rzeszutek Wilk31b3c9d2012-03-20 18:53:10 -04006
7unsigned int xen_io_apic_read(unsigned apic, unsigned reg)
8{
Lin Mingab6ec392012-05-01 00:16:27 +08009 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 Wilk31b3c9d2012-03-20 18:53:10 -040019 if (reg == 0x1)
20 return 0x00170020;
21 else if (reg == 0x0)
22 return apic << 24;
23
24 return 0xfd;
25}
26
27void __init xen_init_apic(void)
28{
29 x86_io_apic_ops.read = xen_io_apic_read;
30}