From: "Gerd Hoffmann" <kraxel@redhat.com>
To: devel@edk2.groups.io
Cc: Oliver Steffen <osteffen@redhat.com>, Ray Ni <ray.ni@intel.com>,
Laszlo Ersek <lersek@redhat.com>,
Rahul Kumar <rahul1.kumar@intel.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: [edk2-devel] [PATCH 1/5] UefiCpuPkg/MpInitLib: Add ProcessorIndex argument to GetMpHandOffHob()
Date: Thu, 15 Feb 2024 10:31:45 +0100 [thread overview]
Message-ID: <20240215093149.251319-2-kraxel@redhat.com> (raw)
In-Reply-To: <20240215093149.251319-1-kraxel@redhat.com>
This allows to specify which HOB should be returned in case multiple
MP_HAND_OFF HOBs are present in the system.
Also add the function prototype to the MpLib.h header file.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
UefiCpuPkg/Library/MpInitLib/MpLib.h | 12 ++++++++++++
UefiCpuPkg/Library/MpInitLib/MpLib.c | 20 +++++++++++++-------
2 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index a96a6389c17d..7e409cceaddf 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -485,6 +485,18 @@ SwitchApContext (
IN MP_HAND_OFF *MpHandOff
);
+/**
+ Get pointer to MP_HAND_OFF GUIDed HOB, starting with ProcessorIndex
+
+ @param[in] ProcessorIndex.
+
+ @return The pointer to MP_HAND_OFF structure.
+**/
+MP_HAND_OFF *
+GetMpHandOffHob (
+ IN UINT32 ProcessorIndex
+ );
+
/**
Get available EfiBootServicesCode memory below 4GB by specified size.
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index cdfb570e61a0..e0a2366073a7 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 MP_HAND_OFF GUIDed HOB, starting with ProcessorIndex
+
+ @param[in] ProcessorIndex.
@return The pointer to MP_HAND_OFF structure.
**/
MP_HAND_OFF *
GetMpHandOffHob (
- VOID
+ IN UINT32 ProcessorIndex
)
{
EFI_HOB_GUID_TYPE *GuidHob;
MP_HAND_OFF *MpHandOff;
- MpHandOff = NULL;
- GuidHob = GetFirstGuidHob (&mMpHandOffGuid);
- if (GuidHob != NULL) {
+ for (GuidHob = GetFirstGuidHob (&mMpHandOffGuid);
+ GuidHob != NULL;
+ GuidHob = GetNextGuidHob (&mMpHandOffGuid, GET_NEXT_HOB (GuidHob)))
+ {
MpHandOff = (MP_HAND_OFF *)GET_GUID_HOB_DATA (GuidHob);
+ if (MpHandOff->ProcessorIndex == ProcessorIndex) {
+ return MpHandOff;
+ }
}
- return MpHandOff;
+ return NULL;
}
/**
@@ -2020,7 +2026,7 @@ MpInitLibInitialize (
UINTN BackupBufferAddr;
UINTN ApIdtBase;
- MpHandOff = GetMpHandOffHob ();
+ MpHandOff = GetMpHandOffHob (0);
if (MpHandOff == NULL) {
MaxLogicalProcessorNumber = PcdGet32 (PcdCpuMaxLogicalProcessorNumber);
} else {
--
2.43.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115496): https://edk2.groups.io/g/devel/message/115496
Mute This Topic: https://groups.io/mt/104369841/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2024-02-15 9:31 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-15 9:31 [edk2-devel] [PATCH 0/5] UefiCpuPkg/MpInitLib: Add support for multiple MP_HAND_OFF HOBs Gerd Hoffmann
2024-02-15 9:31 ` Gerd Hoffmann [this message]
2024-02-19 2:34 ` [edk2-devel] [PATCH 1/5] UefiCpuPkg/MpInitLib: Add ProcessorIndex argument to GetMpHandOffHob() Ni, Ray
2024-02-19 9:51 ` Gerd Hoffmann
2024-02-20 3:42 ` Ni, Ray
2024-02-19 11:18 ` Laszlo Ersek
2024-02-15 9:31 ` [edk2-devel] [PATCH 2/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to GetBspNumber() Gerd Hoffmann
2024-02-19 2:41 ` Ni, Ray
2024-02-19 11:18 ` Laszlo Ersek
2024-02-19 11:37 ` Gerd Hoffmann
2024-02-19 20:02 ` Laszlo Ersek
2024-02-15 9:31 ` [edk2-devel] [PATCH 3/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to SwitchApContext() Gerd Hoffmann
2024-02-19 2:43 ` Ni, Ray
2024-02-19 11:25 ` Laszlo Ersek
2024-02-15 9:31 ` [edk2-devel] [PATCH 4/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to MpInitLibInitialize Gerd Hoffmann
2024-02-19 2:57 ` Ni, Ray
2024-02-19 11:56 ` Laszlo Ersek
2024-02-15 9:31 ` [edk2-devel] [PATCH 5/5] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to SaveCpuMpData() Gerd Hoffmann
2024-02-19 3:02 ` Ni, Ray
2024-02-19 12:50 ` Laszlo Ersek
2024-02-20 7:35 ` Ni, Ray
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240215093149.251319-2-kraxel@redhat.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox