Revision 53a89e26 target-i386/cpu.c
b/target-i386/cpu.c | ||
---|---|---|
41 | 41 |
#endif |
42 | 42 |
|
43 | 43 |
#include "sysemu/sysemu.h" |
44 |
#include "hw/qdev-properties.h" |
|
44 | 45 |
#include "hw/cpu/icc_bus.h" |
45 | 46 |
#ifndef CONFIG_USER_ONLY |
46 | 47 |
#include "hw/xen/xen.h" |
47 |
#include "hw/sysbus.h" |
|
48 | 48 |
#include "hw/i386/apic_internal.h" |
49 | 49 |
#endif |
50 | 50 |
|
... | ... | |
2131 | 2131 |
static void x86_cpu_apic_create(X86CPU *cpu, Error **errp) |
2132 | 2132 |
{ |
2133 | 2133 |
CPUX86State *env = &cpu->env; |
2134 |
DeviceState *dev = DEVICE(cpu); |
|
2134 | 2135 |
APICCommonState *apic; |
2135 | 2136 |
const char *apic_type = "apic"; |
2136 | 2137 |
|
... | ... | |
2140 | 2141 |
apic_type = "xen-apic"; |
2141 | 2142 |
} |
2142 | 2143 |
|
2143 |
env->apic_state = qdev_try_create(NULL, apic_type);
|
|
2144 |
env->apic_state = qdev_try_create(qdev_get_parent_bus(dev), apic_type);
|
|
2144 | 2145 |
if (env->apic_state == NULL) { |
2145 | 2146 |
error_setg(errp, "APIC device '%s' could not be created", apic_type); |
2146 | 2147 |
return; |
... | ... | |
2157 | 2158 |
static void x86_cpu_apic_realize(X86CPU *cpu, Error **errp) |
2158 | 2159 |
{ |
2159 | 2160 |
CPUX86State *env = &cpu->env; |
2160 |
static int apic_mapped; |
|
2161 | 2161 |
|
2162 | 2162 |
if (env->apic_state == NULL) { |
2163 | 2163 |
return; |
... | ... | |
2168 | 2168 |
object_get_typename(OBJECT(env->apic_state))); |
2169 | 2169 |
return; |
2170 | 2170 |
} |
2171 |
|
|
2172 |
/* XXX: mapping more APICs at the same memory location */ |
|
2173 |
if (apic_mapped == 0) { |
|
2174 |
/* NOTE: the APIC is directly connected to the CPU - it is not |
|
2175 |
on the global memory bus. */ |
|
2176 |
/* XXX: what if the base changes? */ |
|
2177 |
sysbus_mmio_map_overlap(SYS_BUS_DEVICE(env->apic_state), 0, |
|
2178 |
APIC_DEFAULT_ADDRESS, 0x1000); |
|
2179 |
apic_mapped = 1; |
|
2180 |
} |
|
2181 | 2171 |
} |
2182 | 2172 |
#else |
2183 | 2173 |
static void x86_cpu_apic_realize(X86CPU *cpu, Error **errp) |
Also available in: Unified diff