Skip to content

Commit

Permalink
Change CpuDeadLoops to panic calls in PiSmmCpuDxeSmm.c (#892)
Browse files Browse the repository at this point in the history
## Description

Changes the newly added CpuDeadLoops in PiSmmCpuDxeSmm.c into PANIC
calls to give more information on issues that are hit instead of hanging
the system.

- [ ] Impacts functionality?
- **Functionality** - Does the change ultimately impact how firmware
functions?
- Examples: Add a new library, publish a new PPI, update an algorithm,
...
- [ ] Impacts security?
- **Security** - Does the change have a direct security impact on an
application,
    flow, or firmware?
  - Examples: Crypto algorithm change, buffer overflow fix, parameter
    validation improvement, ...
- [ ] Breaking change?
- **Breaking change** - Will anyone consuming this change experience a
break
    in build or boot behavior?
- Examples: Add a new library class, move a module to a different repo,
call
    a function in a new library class in a pre-existing module, ...
- [ ] Includes tests?
  - **Tests** - Does the change include any explicit test code?
  - Examples: Unit tests, integration tests, robot tests, ...
- [ ] Includes documentation?
- **Documentation** - Does the change contain explicit documentation
additions
    outside direct code modifications (and comments)?
- Examples: Update readme file, add feature readme file, link to
documentation
    on an a separate Web page, ...

## How This Was Tested

N/A

## Integration Instructions

N/A
  • Loading branch information
kenlautner committed Jun 18, 2024
1 parent f598b78 commit bbbff00
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
10 changes: 5 additions & 5 deletions UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ GetSmBase (

ASSERT (NumberOfProcessors == MaxNumberOfCpus);
if (NumberOfProcessors != MaxNumberOfCpus) {
CpuDeadLoop ();
PANIC ("Incorrect number of processors!"); // MU_CHANGE
}

SmBaseHobs = AllocatePool (sizeof (SMM_BASE_HOB_DATA *) * HobCount);
Expand Down Expand Up @@ -1153,7 +1153,7 @@ PiCpuSmmEntry (
Status = GetSmBase (mMaxNumberOfCpus, &mCpuHotPlugData.SmBase);
if (Status == EFI_OUT_OF_RESOURCES) {
ASSERT (Status != EFI_OUT_OF_RESOURCES);
CpuDeadLoop ();
PANIC ("Not enough space for mCpuHotPlugData.SmBase"); // MU_CHANGE
}

if (!EFI_ERROR (Status)) {
Expand All @@ -1165,7 +1165,7 @@ PiCpuSmmEntry (
DEBUG ((DEBUG_ERROR, "The Range of Smbase in SMRAM is not enough -- Required TileSize = 0x%08x, Actual TileSize = 0x%08x\n", TileSize, SIZE_8KB));
FreePool (mCpuHotPlugData.SmBase);
FreePool (gSmmCpuPrivate->ProcessorInfo);
CpuDeadLoop ();
PANIC ("TileSize larger than 8KB"); // MU_CHANGE
return RETURN_BUFFER_TOO_SMALL;
}

Expand All @@ -1181,7 +1181,7 @@ PiCpuSmmEntry (
mCpuHotPlugData.SmBase = (UINTN *)AllocatePool (sizeof (UINTN) * mMaxNumberOfCpus);
if (mCpuHotPlugData.SmBase == NULL) {
ASSERT (mCpuHotPlugData.SmBase != NULL);
CpuDeadLoop ();
PANIC ("mCpuHotPlugData.SmBase is NULL"); // MU_CHANGE
}

//
Expand All @@ -1195,7 +1195,7 @@ PiCpuSmmEntry (
Buffer = AllocateAlignedCodePages (BufferPages, SIZE_4KB);
if (Buffer == NULL) {
DEBUG ((DEBUG_ERROR, "Failed to allocate %Lu pages.\n", (UINT64)BufferPages));
CpuDeadLoop ();
PANIC ("Failed to allocate buffer for all the tiles"); // MU_CHANGE
return EFI_OUT_OF_RESOURCES;
}

Expand Down
1 change: 1 addition & 0 deletions UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/CpuPageTableLib.h>
#include <Library/MmSaveStateLib.h>
#include <Library/SmmCpuSyncLib.h>
#include <Library/PanicLib.h> // MU_CHANGE

#include <AcpiCpuData.h>
#include <CpuHotPlugData.h>
Expand Down
1 change: 1 addition & 0 deletions UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
MmSaveStateLib
MmMemoryProtectionHobLib ## MU_CHANGE
SmmCpuSyncLib
PanicLib ## MU_CHANGE

[Protocols]
gEfiSmmAccess2ProtocolGuid ## CONSUMES
Expand Down

0 comments on commit bbbff00

Please sign in to comment.