Page 1 of 3
ACPI or MP?
Posted: Sat Mar 08, 2008 10:51 pm
by samueldotj
I am thinking of implementing a multiprocessing kernel. I want to know which specification I should read - ACPI or MP?
I started reading MP but confused by some threads, that ACPI superseds MP. Although I can go through the ACPI spec and clear that out, I just want a quick clarification.
Thanks
Sam
Posted: Sun Mar 09, 2008 1:26 am
by pcmattman
MP Tables are a good way to start and are extremely simple to parse and get useful information from. I was able to do everything except start APs in under a hundred lines of C code, which isn't bad (I still have to get around to starting the things
).
ACPI can be implemented once MP Tables are done and you know that your multiprocessor code works. Having both means you have maximum compatibility.
Posted: Sun Mar 09, 2008 10:25 am
by lukem95
Im thinking of doing the same thing.
i think MP tables seem easier, and are whats advised in the intel spec.
Posted: Sun Mar 09, 2008 6:23 pm
by quok
lukem_95 wrote:Im thinking of doing the same thing.
i think MP tables seem easier, and are whats advised in the intel spec.
They're really not that much easier than parsing the ACPI tables. Not to mention that the MP spec is seriously out of date and doesn't always report things like multiple cores correctly. I've seen more than one machine where the MP tables did not match the ACPI tables. For example, a dual core dual proc machine, where the MP tables reported two single core CPUs, but the MADT showed all 4 cores.
In short, implement both, but rely on ACPI over the MP tables.
Posted: Mon Mar 10, 2008 8:00 am
by Jeko
quok wrote:lukem_95 wrote:Im thinking of doing the same thing.
i think MP tables seem easier, and are whats advised in the intel spec.
They're really not that much easier than parsing the ACPI tables. Not to mention that the MP spec is seriously out of date and doesn't always report things like multiple cores correctly. I've seen more than one machine where the MP tables did not match the ACPI tables. For example, a dual core dual proc machine, where the MP tables reported two single core CPUs, but the MADT showed all 4 cores.
In short, implement both, but rely on ACPI over the MP tables.
When I read ACPI tables and I know there are (for example) two CPUs. What must I do?
Are there any differences between multitasking for single core and multitasking for multiple core?
However, have you any source code about ACPI parsing? I read RSDP table, and after?
Posted: Mon Mar 10, 2008 12:20 pm
by quok
MarkOS wrote:
When I read ACPI tables and I know there are (for example) two CPUs. What must I do?
Are there any differences between multitasking for single core and multitasking for multiple core?
However, have you any source code about ACPI parsing? I read RSDP table, and after?
I've got some code that'll look at the ACPI tables and the MP tables and decide which to use. I can PM it to you once I get home from work.
Posted: Tue Mar 11, 2008 5:49 am
by zaleschiemilgabriel
So you have to use data from the MADT ACPI table and apply it to the MP spec to use multiprocessing? Or does ACPI have it's own initialization methods?
Posted: Tue Mar 11, 2008 7:08 am
by Brendan
Hi,
zaleschiemilgabriel wrote:So you have to use data from the MADT ACPI table and apply it to the MP spec to use multiprocessing? Or does ACPI have it's own initialization methods?
The MADT ACPI table has the same information as the MP specification for detecting and starting CPUs (except for differences involving hyper-threading, where MP specification only reports the first logical CPU in the core and ACPI reports all logical CPUs).
In general you'd use ACPI *or* MP specification (but not both at the same time). For example, your OS might check if ACPI tables are present and use them if they are, but also try to use MP specification tables if ACPI tables aren't present.
Cheers,
Brendan
Posted: Wed Mar 12, 2008 7:53 am
by zaleschiemilgabriel
Thanks Brendan. That makes a little bit more sense now, but what I meant to ask about was the part of the Intel MP spec where it describes how the operating system initializes each processor, not the enumeration of the processors. The MP spec says that to initialize a processor other than the BSP, you have to send it an "INIT IPI". Does that apply to the ACPI spec? I mean - does ACPI provide a different way of initializing processors?
Posted: Wed Mar 12, 2008 7:58 am
by AJ
Hi,
I am implementing this at the moment in my OS and AFAIK the MP and ACPI tables are just different ways of detecting processors (and importantly, Local APIC ID's). You still have to initialise the processors in the same way (Init IPI, SIPI...).
Cheers,
Adam
Posted: Wed Mar 12, 2008 9:46 am
by Jeko
quok wrote:MarkOS wrote:
When I read ACPI tables and I know there are (for example) two CPUs. What must I do?
Are there any differences between multitasking for single core and multitasking for multiple core?
However, have you any source code about ACPI parsing? I read RSDP table, and after?
I've got some code that'll look at the ACPI tables and the MP tables and decide which to use. I can PM it to you once I get home from work.
Ok thank you!
Posted: Wed Mar 12, 2008 9:51 am
by lukem95
is it your own code?
if its GPL couldnt you just post it instead?
Posted: Wed Mar 12, 2008 10:58 am
by Brynet-Inc
lukem_95 wrote:if its GPL couldnt you just post it instead?
It's his code, and it isn't under the GPL.
Posted: Wed Mar 12, 2008 11:26 am
by lukem95
ah, thats fair enough then
Posted: Sun Mar 16, 2008 11:35 am
by Jeko
Quok when do you send me your code?
However I'm writing something to handle MPS:
Code: Select all
unsigned int *address = (unsigned int*)0x0000040E;
while(address < (address+1024))
{
if(*address == '_MP_')
{
mp.signature = *address;
mp.config = *(address+4);
mp.length = *(unsigned char*)(address+8);
mp.version = *(unsigned char*)(address+9);
mp.checksum = *(unsigned char*)(address+10);
mp.features1 = *(unsigned char*)(address+11);
mp.features2 = *(unsigned char*)(address+12);
mp.features3[0] = *(unsigned char*)(address+13);
mp.features3[1] = *(unsigned char*)(address+14);
mp.features3[2] = *(unsigned char*)(address+15);
if(mp.length != 0)
if((mp.signature+mp.mpconfig+mp.length+mp.version+mp.checksum+mp.features1+mp.features2+mp.features3[0]+mp.features[1]+mp.features[2]) == 0)
break;
}
}
//Se non l'ha ancora trovato cerca nella memoria ROM del BIOS tra 0xF0000 e 0xFFFFF
if(address == address+1024)
{
address = (unsigned int*)0xF0000
while(address < 0xFFFFF)
{
if(*address = '_MP_')
{
mp.signature = *address;
mp.config = *(address+4);
mp.length = *(unsigned char*)(address+8);
mp.version = *(unsigned char*)(address+9);
mp.checksum = *(unsigned char*)(address+10);
mp.features1 = *(unsigned char*)(address+11);
mp.features2 = *(unsigned char*)(address+12);
mp.features3[0] = *(unsigned char*)(address+13);
mp.features3[1] = *(unsigned char*)(address+14);
mp.features3[2] = *(unsigned char*)(address+15);
if(mp.length != 0)
if((mp.signature+mp.mpconfig+mp.length+mp.version+mp.checksum+mp.features1+mp.features2+mp.features3[0]+mp.features[1]+mp.features[2]) == 0)
break;
}
}
}
Is this good?