UefiCpuPkg/MpInitLib: Add support for multiple HOBs to GetBspNumber()

Rename the MpHandOff parameter to FirstMpHandOff.  Add a loop so the
function inspects all HOBs present in the system.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20240222160106.686484-3-kraxel@redhat.com>
This commit is contained in:
Gerd Hoffmann 2024-02-22 17:01:02 +01:00 committed by mergify[bot]
parent a3ee1eea96
commit b485230462

View File

@ -1894,26 +1894,33 @@ CheckAllAPs (
/** /**
This function Get BspNumber. This function Get BspNumber.
@param[in] MpHandOff Pointer to MpHandOff @param[in] FirstMpHandOff Pointer to first MpHandOff HOB body.
@return BspNumber @return BspNumber
**/ **/
UINT32 UINT32
GetBspNumber ( GetBspNumber (
IN CONST MP_HAND_OFF *MpHandOff IN CONST MP_HAND_OFF *FirstMpHandOff
) )
{ {
UINT32 ApicId; UINT32 ApicId;
UINT32 BspNumber; UINT32 BspNumber;
UINT32 Index; UINT32 Index;
CONST MP_HAND_OFF *MpHandOff;
// //
// Get the processor number for the BSP // Get the processor number for the BSP
// //
BspNumber = MAX_UINT32; BspNumber = MAX_UINT32;
ApicId = GetInitialApicId (); ApicId = GetInitialApicId ();
for (MpHandOff = FirstMpHandOff;
MpHandOff != NULL;
MpHandOff = GetNextMpHandOffHob (MpHandOff))
{
for (Index = 0; Index < MpHandOff->CpuCount; Index++) { for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
if (MpHandOff->Info[Index].ApicId == ApicId) { if (MpHandOff->Info[Index].ApicId == ApicId) {
BspNumber = Index; BspNumber = MpHandOff->ProcessorIndex + Index;
}
} }
} }