aboutsummaryrefslogtreecommitdiffstats
path: root/src/mptable.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2009-10-09 09:42:11 -0400
committerKevin O'Connor <kevin@koconnor.net>2009-10-09 09:42:11 -0400
commita26df9bd7c8dc3a901994be17ec067abb87c2f1a (patch)
tree20d950811e16b6a14e649169d1375cad32cbccbb /src/mptable.c
parenteb4735dd4ac7722de413b8b5cbed68e113325395 (diff)
downloadseabios-a26df9bd7c8dc3a901994be17ec067abb87c2f1a.tar.gz
Use MaxCountCPUs during building of per cpu tables.
Preparation for hot pluggable CPUs. Signed-off-by: Gleb Natapov <gleb@redhat.com>
Diffstat (limited to 'src/mptable.c')
-rw-r--r--src/mptable.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/mptable.c b/src/mptable.c
index 4aaff1e8..793968c6 100644
--- a/src/mptable.c
+++ b/src/mptable.c
@@ -18,13 +18,12 @@ mptable_init(void)
dprintf(3, "init MPTable\n");
- int smp_cpus = CountCPUs;
- if (smp_cpus <= 1)
+ if (MaxCountCPUs <= 1)
// Building an mptable on uniprocessor machines confuses some OSes.
return;
int length = (sizeof(struct mptable_config_s)
- + sizeof(struct mpt_cpu) * smp_cpus
+ + sizeof(struct mpt_cpu) * MaxCountCPUs
+ sizeof(struct mpt_bus)
+ sizeof(struct mpt_ioapic)
+ sizeof(struct mpt_intsrc) * 16);
@@ -49,7 +48,7 @@ mptable_init(void)
config->spec = 4;
memcpy(config->oemid, CONFIG_CPUNAME8, sizeof(config->oemid));
memcpy(config->productid, "0.1 ", sizeof(config->productid));
- config->entrycount = smp_cpus + 2 + 16;
+ config->entrycount = MaxCountCPUs + 2 + 16;
config->lapic = BUILD_APIC_ADDR;
// CPU definitions.
@@ -57,14 +56,17 @@ mptable_init(void)
cpuid(1, &cpuid_signature, &ebx, &ecx, &cpuid_features);
struct mpt_cpu *cpus = (void*)&config[1];
int i;
- for (i = 0; i < smp_cpus; i++) {
+ for (i = 0; i < MaxCountCPUs; i++) {
struct mpt_cpu *cpu = &cpus[i];
memset(cpu, 0, sizeof(*cpu));
cpu->type = MPT_TYPE_CPU;
cpu->apicid = i;
cpu->apicver = 0x11;
/* cpu flags: enabled, bootstrap cpu */
- cpu->cpuflag = (i == 0 ? 3 : 1);
+ if (i < CountCPUs)
+ cpu->cpuflag = 1 | (i == 0) ? 2 : 0;
+ else
+ cpu->cpuflag = 0;
if (cpuid_signature) {
cpu->cpusignature = cpuid_signature;
cpu->featureflag = cpuid_features;
@@ -75,13 +77,13 @@ mptable_init(void)
}
/* isa bus */
- struct mpt_bus *bus = (void*)&cpus[smp_cpus];
+ struct mpt_bus *bus = (void*)&cpus[MaxCountCPUs];
memset(bus, 0, sizeof(*bus));
bus->type = MPT_TYPE_BUS;
memcpy(bus->bustype, "ISA ", sizeof(bus->bustype));
/* ioapic */
- u8 ioapic_id = smp_cpus;
+ u8 ioapic_id = CountCPUs;
struct mpt_ioapic *ioapic = (void*)&bus[1];
memset(ioapic, 0, sizeof(*ioapic));
ioapic->type = MPT_TYPE_IOAPIC;