summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2024-02-22 17:01:02 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-02-26 21:56:21 +0000
commitb48523046283e8ef670b5d2b9f53de6855f7d3bf (patch)
treeb14e56f1092b6765c0ec888a6c17fd525ff45ed4
parenta3ee1eea96752cf2d4e0f70310facc109b7c4352 (diff)
downloadedk2-b48523046283e8ef670b5d2b9f53de6855f7d3bf.tar.gz
edk2-b48523046283e8ef670b5d2b9f53de6855f7d3bf.tar.bz2
edk2-b48523046283e8ef670b5d2b9f53de6855f7d3bf.zip
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>
-rw-r--r--UefiCpuPkg/Library/MpInitLib/MpLib.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 16fc7dc066..76449f73f4 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -1894,26 +1894,33 @@ CheckAllAPs (
/**
This function Get BspNumber.
- @param[in] MpHandOff Pointer to MpHandOff
+ @param[in] FirstMpHandOff Pointer to first MpHandOff HOB body.
@return BspNumber
**/
UINT32
GetBspNumber (
- IN CONST MP_HAND_OFF *MpHandOff
+ IN CONST MP_HAND_OFF *FirstMpHandOff
)
{
- UINT32 ApicId;
- UINT32 BspNumber;
- UINT32 Index;
+ UINT32 ApicId;
+ UINT32 BspNumber;
+ UINT32 Index;
+ CONST MP_HAND_OFF *MpHandOff;
//
// Get the processor number for the BSP
//
BspNumber = MAX_UINT32;
ApicId = GetInitialApicId ();
- for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
- if (MpHandOff->Info[Index].ApicId == ApicId) {
- BspNumber = Index;
+
+ for (MpHandOff = FirstMpHandOff;
+ MpHandOff != NULL;
+ MpHandOff = GetNextMpHandOffHob (MpHandOff))
+ {
+ for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
+ if (MpHandOff->Info[Index].ApicId == ApicId) {
+ BspNumber = MpHandOff->ProcessorIndex + Index;
+ }
}
}