ACPI or MP?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
samueldotj
Member
Member
Posts: 32
Joined: Mon Nov 13, 2006 12:24 am

ACPI or MP?

Post 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
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post 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 :P).

ACPI can be implemented once MP Tables are done and you know that your multiprocessor code works. Having both means you have maximum compatibility.
User avatar
lukem95
Member
Member
Posts: 536
Joined: Fri Aug 03, 2007 6:03 am
Location: Cambridge, UK

Post by lukem95 »

Im thinking of doing the same thing.

i think MP tables seem easier, and are whats advised in the intel spec.
~ Lukem95 [ Cake ]
Release: 0.08b
Image
quok
Member
Member
Posts: 490
Joined: Wed Oct 18, 2006 10:43 pm
Location: Kansas City, KS, USA

Post 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.
User avatar
Jeko
Member
Member
Posts: 500
Joined: Fri Mar 17, 2006 12:00 am
Location: Napoli, Italy

Post 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?
quok
Member
Member
Posts: 490
Joined: Wed Oct 18, 2006 10:43 pm
Location: Kansas City, KS, USA

Post 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.
User avatar
zaleschiemilgabriel
Member
Member
Posts: 232
Joined: Mon Feb 04, 2008 3:58 am

Post 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?
DeviOuS - what a stupid name
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
zaleschiemilgabriel
Member
Member
Posts: 232
Joined: Mon Feb 04, 2008 3:58 am

Post 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?
DeviOuS - what a stupid name
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post 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
User avatar
Jeko
Member
Member
Posts: 500
Joined: Fri Mar 17, 2006 12:00 am
Location: Napoli, Italy

Post 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!
User avatar
lukem95
Member
Member
Posts: 536
Joined: Fri Aug 03, 2007 6:03 am
Location: Cambridge, UK

Post by lukem95 »

is it your own code?

if its GPL couldnt you just post it instead?
~ Lukem95 [ Cake ]
Release: 0.08b
Image
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post 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.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
lukem95
Member
Member
Posts: 536
Joined: Fri Aug 03, 2007 6:03 am
Location: Cambridge, UK

Post by lukem95 »

ah, thats fair enough then :)
~ Lukem95 [ Cake ]
Release: 0.08b
Image
User avatar
Jeko
Member
Member
Posts: 500
Joined: Fri Mar 17, 2006 12:00 am
Location: Napoli, Italy

Post 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?
Post Reply