summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2024-02-22 17:01:01 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-02-26 21:56:21 +0000
commita3ee1eea96752cf2d4e0f70310facc109b7c4352 (patch)
tree5cf1fda6f3d3bc4b6732138eb0ef7d5c20e36b4f
parent1f161a7915e1c2c65bfaf7091712e9628107b707 (diff)
downloadedk2-a3ee1eea96752cf2d4e0f70310facc109b7c4352.tar.gz
edk2-a3ee1eea96752cf2d4e0f70310facc109b7c4352.tar.bz2
edk2-a3ee1eea96752cf2d4e0f70310facc109b7c4352.zip
UefiCpuPkg/MpInitLib: Add support for multiple HOBs to GetMpHandOffHob
Rename the function to GetNextMpHandOffHob(), add MP_HAND_OFF parameter. When called with NULL pointer return the body of the first HOB, otherwise return the next in the chain. Also add the function prototype to the MpLib.h header file. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-Id: <20240222160106.686484-2-kraxel@redhat.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
-rw-r--r--UefiCpuPkg/Library/MpInitLib/MpLib.c26
-rw-r--r--UefiCpuPkg/Library/MpInitLib/MpLib.h12
2 files changed, 28 insertions, 10 deletions
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index cdfb570e61..16fc7dc066 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -1961,25 +1961,31 @@ SwitchApContext (
}
/**
- Get pointer to MP_HAND_OFF GUIDed HOB.
+ Get pointer to next MP_HAND_OFF GUIDed HOB body.
+
+ @param[in] MpHandOff Previous HOB body. Pass NULL to get the first HOB.
@return The pointer to MP_HAND_OFF structure.
**/
MP_HAND_OFF *
-GetMpHandOffHob (
- VOID
+GetNextMpHandOffHob (
+ IN CONST MP_HAND_OFF *MpHandOff
)
{
EFI_HOB_GUID_TYPE *GuidHob;
- MP_HAND_OFF *MpHandOff;
- MpHandOff = NULL;
- GuidHob = GetFirstGuidHob (&mMpHandOffGuid);
- if (GuidHob != NULL) {
- MpHandOff = (MP_HAND_OFF *)GET_GUID_HOB_DATA (GuidHob);
+ if (MpHandOff == NULL) {
+ GuidHob = GetFirstGuidHob (&mMpHandOffGuid);
+ } else {
+ GuidHob = (VOID *)(((UINT8 *)MpHandOff) - sizeof (EFI_HOB_GUID_TYPE));
+ GuidHob = GetNextGuidHob (&mMpHandOffGuid, GET_NEXT_HOB (GuidHob));
+ }
+
+ if (GuidHob == NULL) {
+ return NULL;
}
- return MpHandOff;
+ return (MP_HAND_OFF *)GET_GUID_HOB_DATA (GuidHob);
}
/**
@@ -2020,7 +2026,7 @@ MpInitLibInitialize (
UINTN BackupBufferAddr;
UINTN ApIdtBase;
- MpHandOff = GetMpHandOffHob ();
+ MpHandOff = GetNextMpHandOffHob (NULL);
if (MpHandOff == NULL) {
MaxLogicalProcessorNumber = PcdGet32 (PcdCpuMaxLogicalProcessorNumber);
} else {
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index a96a6389c1..fab2b2d493 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -486,6 +486,18 @@ SwitchApContext (
);
/**
+ Get pointer to next MP_HAND_OFF GUIDed HOB body.
+
+ @param[in] MpHandOff Previous HOB body. Pass NULL to get the first HOB.
+
+ @return The pointer to MP_HAND_OFF structure.
+**/
+MP_HAND_OFF *
+GetNextMpHandOffHob (
+ IN CONST MP_HAND_OFF *MpHandOff
+ );
+
+/**
Get available EfiBootServicesCode memory below 4GB by specified size.
This buffer is required to safely transfer AP from real address mode to