Booting AP core with UEFI

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.
feryno
Member
Member
Posts: 73
Joined: Thu Feb 09, 2012 6:53 am
Location: Czechoslovakia
Contact:

Re: Booting AP core with UEFI

Post by feryno »

There are 2 MP protocols, one newer and one older with these GUIDs

Code: Select all

EFI_MP_SERVICES_PROTOCOL_GUID	dd	 3FDDA605h
				dw	0A76Eh
				dw	 4F46h
				db	0ADh, 29h, 12h,0F4h, 53h, 1Bh, 3Dh, 08h

EFI_FRAMEWORK_MP_SERVICES_PROTOCOL_GUID	dd	0F33261E7h
						dw	 23CBh
						dw	 11D5h
						db	0BDh, 5Ch, 00h, 80h,0C7h, 3Ch, 88h, 81h
In one of my project I needed to execute 64-bit code at all CPUs so I did it this way:
[0] newer MP protocol
[1] older MP protocol in case [0] failed
[2] manual way if [1] failed (INIT-SIPI from BSP, APs Realmode->Switch to long mode->execute code, CLI\HLT\JMP $)

at my ASUS P9D WS MoBo there is [0]
at my older ASUS MoBo there is no [0] but there is [1]
[2] stayed in my project since BIOS version of the project so for UEFI port I just added [1] and later [0]

I suppose UEFI puts APs into hlt state (CLI\HLT\JMP $) at ExitBootServices() and then OS wakes up APs when BSP sends INIT-SIPI to all APs.
hypervisor-based solutions developer (Intel, AMD)
rdos
Member
Member
Posts: 3303
Joined: Wed Oct 01, 2008 1:55 pm

Re: Booting AP core with UEFI

Post by rdos »

feryno wrote:There are 2 MP protocols, one newer and one older with these GUIDs

Code: Select all

EFI_MP_SERVICES_PROTOCOL_GUID	dd	 3FDDA605h
				dw	0A76Eh
				dw	 4F46h
				db	0ADh, 29h, 12h,0F4h, 53h, 1Bh, 3Dh, 08h

EFI_FRAMEWORK_MP_SERVICES_PROTOCOL_GUID	dd	0F33261E7h
						dw	 23CBh
						dw	 11D5h
						db	0BDh, 5Ch, 00h, 80h,0C7h, 3Ch, 88h, 81h
In one of my project I needed to execute 64-bit code at all CPUs so I did it this way:
[0] newer MP protocol
[1] older MP protocol in case [0] failed
[2] manual way if [1] failed (INIT-SIPI from BSP, APs Realmode->Switch to long mode->execute code, CLI\HLT\JMP $)

at my ASUS P9D WS MoBo there is [0]
at my older ASUS MoBo there is no [0] but there is [1]
[2] stayed in my project since BIOS version of the project so for UEFI port I just added [1] and later [0]

I suppose UEFI puts APs into hlt state (CLI\HLT\JMP $) at ExitBootServices() and then OS wakes up APs when BSP sends INIT-SIPI to all APs.
Nice. Even if some people object to the idea of BIOS / UEFI initializing APs, I have no desire to do initializations that are better done by firmware than by the OS. I think my issue is related to missing initializations by EFI, which might work if I use one of these protocols.

Is there some document (or code) about how to handle these two protocols?

BTW, my problem computer is a portable HP Pavillion that is a couple of years old.
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: Booting AP core with UEFI

Post by SpyderTL »

http://www.drdobbs.com/parallel/booting ... /232300699
It doesn't matter if legacy or UEFI BIOS is used. From a hardware point of view, the early initialization sequence is the same.
This is a good article that describes the hardware and software startup procedures in fine detail.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Post Reply