Page 2 of 2

Re: Booting AP core with UEFI

Posted: Thu Nov 03, 2016 6:14 am
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.

Re: Booting AP core with UEFI

Posted: Thu Nov 03, 2016 8:11 am
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.

Re: Booting AP core with UEFI

Posted: Thu Nov 03, 2016 8:26 am
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.