mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-23 13:44:33 +02:00
UefiCpuPkg/MpInitLib: return early in GetBspNumber()
After finding the BSP Number return the result instead of continuing to loop over the remaining processors. Suggested-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-Id: <20240222160106.686484-7-kraxel@redhat.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> [lersek@redhat.com: s/ASSERT (FALSE)/ASSERT_EFI_ERROR (EFI_NOT_FOUND)/ [Ray]]
This commit is contained in:
parent
5e09b5d6d7
commit
d25421d0d8
@ -1903,15 +1903,13 @@ GetBspNumber (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 ApicId;
|
UINT32 ApicId;
|
||||||
UINT32 BspNumber;
|
|
||||||
UINT32 Index;
|
UINT32 Index;
|
||||||
CONST MP_HAND_OFF *MpHandOff;
|
CONST MP_HAND_OFF *MpHandOff;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the processor number for the BSP
|
// Get the processor number for the BSP
|
||||||
//
|
//
|
||||||
BspNumber = MAX_UINT32;
|
ApicId = GetInitialApicId ();
|
||||||
ApicId = GetInitialApicId ();
|
|
||||||
|
|
||||||
for (MpHandOff = FirstMpHandOff;
|
for (MpHandOff = FirstMpHandOff;
|
||||||
MpHandOff != NULL;
|
MpHandOff != NULL;
|
||||||
@ -1919,14 +1917,13 @@ GetBspNumber (
|
|||||||
{
|
{
|
||||||
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 = MpHandOff->ProcessorIndex + Index;
|
return MpHandOff->ProcessorIndex + Index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (BspNumber != MAX_UINT32);
|
ASSERT_EFI_ERROR (EFI_NOT_FOUND);
|
||||||
|
return 0;
|
||||||
return BspNumber;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user