edk2/edk2-UefiCpuPkg-MpInitLib-A...

74 lines
2.3 KiB
Diff

From 4c9151fa8f06c42f04459f79ae45bf9c01bba08a Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Thu, 22 Feb 2024 17:01:02 +0100
Subject: [PATCH 06/10] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to
GetBspNumber()
RH-Author: Gerd Hoffmann <None>
RH-MergeRequest: 59: backport 4096 vcpu patches for c9s
RH-Jira: RHEL-22202
RH-Acked-by: Oliver Steffen <osteffen@redhat.com>
RH-Commit: [6/10] 41754f3533416e10c3057b3b31ac2829002d115c (kraxel.rh/centos-src-edk2)
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>
(cherry picked from commit b48523046283e8ef670b5d2b9f53de6855f7d3bf)
---
UefiCpuPkg/Library/MpInitLib/MpLib.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 00b36b0e18..770874b09d 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -1900,26 +1900,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;
+ }
}
}
--
2.39.3