fix bug in search_apic and uses function to find the MP Config Table

This commit is contained in:
Stefan Lankes 2011-08-03 07:37:57 +02:00
parent f4dd038ee5
commit 577300919c

View file

@ -327,14 +327,17 @@ void smp_start(uint32_t id)
}
#endif
#ifndef CONFIG_MULTIBOOT
#if 1
static apic_mp_t* search_apic(size_t base, size_t limit) {
size_t ptr;
apic_mp_t* tmp;
for (ptr=base; ptr<=limit-sizeof(uint32_t); ptr++) {
if (*((uint32_t*) ptr) == MP_FLT_SIGNATURE) {
if (!(((apic_mp_t*)ptr)->version > 4) && ((apic_mp_t*)ptr)->features[0])
return (apic_mp_t*) ptr;
tmp = (apic_mp_t*) ptr;
if (tmp->signature == MP_FLT_SIGNATURE) {
if (!((tmp->version > 4) || tmp->features[0]))
return tmp;
}
}
@ -561,7 +564,7 @@ static int apic_probe(void)
uint32_t i, count;
int isa_bus = -1;
#ifndef CONFIG_MULTIBOOT
#if 1
apic_mp = search_apic(0xF0000, 0x100000);
if (apic_mp)
goto found_mp;
@ -590,7 +593,7 @@ static int apic_probe(void)
for(i=0; (i<mmap->len-sizeof(uint32_t)) && (addr < 0x0FFFFF); i++, addr++) {
if (*((uint32_t*) addr) == MP_FLT_SIGNATURE) {
apic_mp = (apic_mp_t*) addr;
if (!(apic_mp->version > 4) && apic_mp->features[0])
if (!((apic_mp->version > 4) || apic_mp->features[0]))
goto found_mp;
}
}