minor bug fix
=> search the MP Config Table below 1MB
This commit is contained in:
parent
75cf088989
commit
d91b0d49c2
1 changed files with 24 additions and 12 deletions
|
@ -327,18 +327,20 @@ void smp_start(uint32_t id)
|
|||
}
|
||||
#endif
|
||||
|
||||
static unsigned int* search_apic(unsigned int base, unsigned int limit) {
|
||||
uint32_t* ptr;
|
||||
#ifndef CONFIG_MULTIBOOT
|
||||
static apic_mp_t* search_apic(size_t base, size_t limit) {
|
||||
size_t ptr;
|
||||
|
||||
for (ptr = (uint32_t*) base; (uint32_t) ptr < limit; ptr++) {
|
||||
if (*ptr == MP_FLT_SIGNATURE) {
|
||||
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 ptr;
|
||||
}
|
||||
return (apic_mp_t*) ptr;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MAX_CORES > 1
|
||||
int smp_init(void)
|
||||
|
@ -362,7 +364,7 @@ int smp_init(void)
|
|||
*/
|
||||
bootaddr = (char*) SMP_SETUP_ADDR;
|
||||
memcpy(bootaddr, boot_code, sizeof(boot_code));
|
||||
for(j=0; j<sizeof(boot_code)-sizeof(uint32_t); j++)
|
||||
for(j=0; j<=sizeof(boot_code)-sizeof(uint32_t); j++)
|
||||
{
|
||||
// replace 0xDEADC0DE with the address of the smp entry code
|
||||
if (*((uint32_t*) (bootaddr+j)) == 0xDEADC0DE) {
|
||||
|
@ -559,15 +561,15 @@ static int apic_probe(void)
|
|||
uint32_t i, count;
|
||||
int isa_bus = -1;
|
||||
|
||||
apic_mp = (apic_mp_t*) search_apic(0xF0000, 0x100000);
|
||||
#ifndef CONFIG_MULTIBOOT
|
||||
apic_mp = search_apic(0xF0000, 0x100000);
|
||||
if (apic_mp)
|
||||
goto found_mp;
|
||||
apic_mp = (apic_mp_t*) search_apic(0x9F000, 0xA0000);
|
||||
apic_mp = search_apic(0x9F000, 0xA0000);
|
||||
if (apic_mp)
|
||||
goto found_mp;
|
||||
|
||||
#else
|
||||
// searching MP signature in the reserved memory areas
|
||||
#ifdef CONFIG_MULTIBOOT
|
||||
if (mb_info && (mb_info->flags & MULTIBOOT_INFO_MEM_MAP)) {
|
||||
multiboot_memory_map_t* mmap = (multiboot_memory_map_t*) mb_info->mmap_addr;
|
||||
multiboot_memory_map_t* mmap_end = (void*) ((size_t) mb_info->mmap_addr + mb_info->mmap_length);
|
||||
|
@ -576,7 +578,16 @@ static int apic_probe(void)
|
|||
if (mmap->type == MULTIBOOT_MEMORY_RESERVED) {
|
||||
addr = mmap->addr;
|
||||
|
||||
for(i=0; i<mmap->len-sizeof(uint32_t); i++, addr++) {
|
||||
/*
|
||||
* MultiProcessor Specification 1.4:
|
||||
* =================================
|
||||
* The following is a list of the suggested memory spaces for the MP configuration table:
|
||||
* a. In the first kilobyte of Extended BIOS Data Area (EBDA), or
|
||||
* b. Within the last kilobyte of system base memory if the EBDA segment is undefined, or
|
||||
* c. At the top of system physical memory, or
|
||||
* d. In the BIOS read-only memory space between 0E0000h and 0FFFFFh.
|
||||
*/
|
||||
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])
|
||||
|
@ -593,6 +604,7 @@ found_mp:
|
|||
if (!apic_mp)
|
||||
goto no_mp;
|
||||
|
||||
kprintf("Found MP config table at 0x%x\n", apic_mp);
|
||||
kprintf("System uses Multiprocessing Specification 1.%u\n", apic_mp->version);
|
||||
kprintf("MP features 1: %u\n", apic_mp->features[0]);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue