Skip to content

Commit

Permalink
Add Advanced logger for Non DXE phases (microsoft#801)
Browse files Browse the repository at this point in the history
## Description

This change introduces non DXE advanced logger, which should enable us
to verify the advanced logger related changes better. Resolves microsoft#522.

- [x] 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

This change was tested on both QEMU Q35 and SBSA packages and verified
bootable to UEFI shell.

## Integration Instructions

N/A

---------

Signed-off-by: kuqin12 <[email protected]>
  • Loading branch information
kuqin12 authored Dec 20, 2023
1 parent f0f844a commit c2982a8
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 31 deletions.
32 changes: 16 additions & 16 deletions Platforms/QemuQ35Pkg/QemuQ35Pkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@
MemoryTypeInfoSecVarCheckLib |MdeModulePkg/Library/MemoryTypeInfoSecVarCheckLib/MemoryTypeInfoSecVarCheckLib.inf # MU_CHANGE TCBZ1086
MemoryTypeInformationChangeLib |MdeModulePkg/Library/MemoryTypeInformationChangeLibNull/MemoryTypeInformationChangeLibNull.inf
MtrrLib |UefiCpuPkg/Library/MtrrLib/MtrrLib.inf # Memory Type Range Register (https://en.wikipedia.org/wiki/Memory_type_range_register)
MmUnblockMemoryLib |MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf
DxeMemoryProtectionHobLib |MdeModulePkg/Library/MemoryProtectionHobLibNull/DxeMemoryProtectionHobLibNull.inf
ExceptionPersistenceLib |MsCorePkg/Library/ExceptionPersistenceLibCmos/ExceptionPersistenceLibCmos.inf
CpuPageTableLib |UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf
Expand Down Expand Up @@ -409,6 +408,7 @@
RngLib |MdePkg/Library/BaseRngLib/BaseRngLib.inf
MemEncryptSevLib |QemuQ35Pkg/Library/BaseMemEncryptSevLib/PeiMemEncryptSevLib.inf
FrameBufferMemDrawLib |MsGraphicsPkg/Library/FrameBufferMemDrawLib/FrameBufferMemDrawLibPei.inf
MmUnblockMemoryLib |MmSupervisorPkg/Library/MmSupervisorUnblockMemoryLib/MmSupervisorUnblockMemoryLibPei.inf

[LibraryClasses.common.PEI_CORE]
PeiCoreEntryPoint |MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
Expand Down Expand Up @@ -580,7 +580,7 @@
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
AdvLoggerAccessLib|MdeModulePkg/Library/AdvLoggerAccessLibNull/AdvLoggerAccessLib.inf
AdvLoggerAccessLib|AdvLoggerPkg/Library/AdvLoggerMmAccessLib/AdvLoggerMmAccessLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf
RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf
PciLib|QemuQ35Pkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
Expand All @@ -603,38 +603,36 @@
AssertLib|AdvLoggerPkg/Library/AssertLib/AssertLib.inf
AdvancedLoggerAccessLib|AdvLoggerPkg/Library/AdvancedLoggerAccessLib/AdvancedLoggerAccessLib.inf

[LibraryClasses.common.MM_CORE_STANDALONE, LibraryClasses.common.MM_STANDALONE, LibraryClasses.common.PEIM, LibraryClasses.common.PEI_CORE]
[LibraryClasses.IA32.PEI_CORE]
AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/PeiCore/AdvancedLoggerLib.inf

[LibraryClasses.IA32.PEIM]
AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Pei/AdvancedLoggerLib.inf
!ifndef $(DEBUG_ON_SERIAL_PORT)
DebugLib|QemuQ35Pkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
DebugLib|AdvLoggerPkg/Library/PeiDebugLibAdvancedLogger/PeiDebugLibAdvancedLogger.inf
!endif

[LibraryClasses.X64.PEIM]
AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Pei64/AdvancedLoggerLib.inf

[LibraryClasses.X64]
AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Dxe/AdvancedLoggerLib.inf
AdvancedLoggerAccessLib|AdvLoggerPkg/Library/AdvancedLoggerAccessLib/AdvancedLoggerAccessLib.inf

[LibraryClasses.X64.DXE_CORE]
AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/DxeCore/AdvancedLoggerLib.inf
!ifndef $(DEBUG_ON_SERIAL_PORT)
DebugLib|AdvLoggerPkg/Library/BaseDebugLibAdvancedLogger/BaseDebugLibAdvancedLogger.inf
!endif

[LibraryClasses.X64.DXE_SMM_DRIVER]
AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Smm/AdvancedLoggerLib.inf
!ifndef $(DEBUG_ON_SERIAL_PORT)
DebugLib|AdvLoggerPkg/Library/BaseDebugLibAdvancedLogger/BaseDebugLibAdvancedLogger.inf
!endif

[LibraryClasses.X64.SMM_CORE]
AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Smm/AdvancedLoggerLib.inf
!ifndef $(DEBUG_ON_SERIAL_PORT)
DebugLib|AdvLoggerPkg/Library/BaseDebugLibAdvancedLogger/BaseDebugLibAdvancedLogger.inf
!endif

[LibraryClasses.X64.DXE_RUNTIME_DRIVER]
AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Runtime/AdvancedLoggerLib.inf
!ifndef $(DEBUG_ON_SERIAL_PORT)
DebugLib|AdvLoggerPkg/Library/BaseDebugLibAdvancedLogger/BaseDebugLibAdvancedLogger.inf
!endif

[LibraryClasses.X64.MM_CORE_STANDALONE, LibraryClasses.X64.MM_STANDALONE]
AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/MmCore/AdvancedLoggerLib.inf

################################################################################
#
Expand Down Expand Up @@ -680,6 +678,7 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdHwErrStorageSize|0x1000
gPcBdsPkgTokenSpaceGuid.PcdEnableMemMapOutput|0x1
gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedFileLoggerFlush|3
gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerPreMemPages|3
gEfiSecurityPkgTokenSpaceGuid.PcdUserPhysicalPresence|FALSE

!if $(NETWORK_TLS_ENABLE) == FALSE
Expand Down Expand Up @@ -1187,6 +1186,7 @@ QemuQ35Pkg/Library/ResetSystemLib/StandaloneMmResetSystemLib.inf
MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
AdvLoggerPkg/Application/AdvancedLogDumper/AdvancedLogDumper.inf

QemuQ35Pkg/QemuVideoDxe/QemuVideoDxe.inf

Expand Down
1 change: 1 addition & 0 deletions Platforms/QemuQ35Pkg/QemuQ35Pkg.fdf
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ FILE FREEFORM = PCD(gZeroTouchPkgTokenSpaceGuid.PcdZeroTouchCertificateFile) {
INF MfciPkg/MfciDxe/MfciDxe.inf
INF MsGraphicsPkg/OnScreenKeyboardDxe/OnScreenKeyboardDxe.inf
INF MsGraphicsPkg/SimpleWindowManagerDxe/SimpleWindowManagerDxe.inf
INF AdvLoggerPkg/Application/AdvancedLogDumper/AdvancedLogDumper.inf
!if $(SMM_ENABLED) == TRUE
INF MmSupervisorPkg/Drivers/MmSupervisorErrorReport/MmSupervisorErrorReport.inf
!endif
Expand Down
10 changes: 0 additions & 10 deletions Platforms/QemuSbsaPkg/Library/SbsaQemuLib/SbsaQemuLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,6 @@ ARM_CORE_INFO mArmPlatformNullMpCoreInfoTable[] = {
}
};

// This function should be better located into TimerLib implementation
RETURN_STATUS
EFIAPI
TimerConstructor (
VOID
)
{
return EFI_SUCCESS;
}

/**
Return the current Boot Mode
Expand Down
23 changes: 18 additions & 5 deletions Platforms/QemuSbsaPkg/QemuSbsaPkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -525,22 +525,33 @@
# Advanced Logger Libraries
#########################################
[LibraryClasses]
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
DebugLib|AdvLoggerPkg/Library/BaseDebugLibAdvancedLogger/BaseDebugLibAdvancedLogger.inf
AssertLib|AdvLoggerPkg/Library/AssertLib/AssertLib.inf
AdvancedLoggerHdwPortLib|AdvLoggerPkg/Library/AdvancedLoggerHdwPortLib/AdvancedLoggerHdwPortLib.inf
AdvancedLoggerAccessLib|AdvLoggerPkg/Library/AdvancedLoggerAccessLib/AdvancedLoggerAccessLib.inf

[LibraryClasses.common.SEC]
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf

[LibraryClasses.common.PEI_CORE]
AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/PeiCore/AdvancedLoggerLib.inf

[LibraryClasses.common.PEIM]
AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Pei/AdvancedLoggerLib.inf

[LibraryClasses.common.DXE_DRIVER, LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION]
AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Dxe/AdvancedLoggerLib.inf
DebugLib|AdvLoggerPkg/Library/BaseDebugLibAdvancedLogger/BaseDebugLibAdvancedLogger.inf

[LibraryClasses.common.DXE_CORE]
AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/DxeCore/AdvancedLoggerLib.inf
DebugLib|AdvLoggerPkg/Library/BaseDebugLibAdvancedLogger/BaseDebugLibAdvancedLogger.inf

[LibraryClasses.common.DXE_RUNTIME_DRIVER]
AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Runtime/AdvancedLoggerLib.inf
DebugLib|AdvLoggerPkg/Library/BaseDebugLibAdvancedLogger/BaseDebugLibAdvancedLogger.inf

[LibraryClasses.common.MM_CORE_STANDALONE, LibraryClasses.common.MM_STANDALONE]
# Current support of advanced logger in Standalone MM is limited to the platforms
# that supports it from TFA.
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf

[BuildOptions]
!include NetworkPkg/NetworkBuildOptions.dsc.inc
Expand Down Expand Up @@ -599,6 +610,7 @@
gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|0
gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000
gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320
gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerPreMemPages|3

!if $(TARGET) != RELEASE
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|$(DEBUG_PRINT_ERROR_LEVEL)
Expand Down Expand Up @@ -649,7 +661,7 @@
!endif

gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x1000007c000
gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000
gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x10000
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
gEfiSecurityPkgTokenSpaceGuid.PcdUserPhysicalPresence|FALSE
Expand Down Expand Up @@ -1063,6 +1075,7 @@

MsGraphicsPkg/PrintScreenLogger/PrintScreenLogger.inf
SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.inf
AdvLoggerPkg/Application/AdvancedLogDumper/AdvancedLogDumper.inf

#
# DFCI support
Expand Down
1 change: 1 addition & 0 deletions Platforms/QemuSbsaPkg/QemuSbsaPkg.fdf
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ READ_LOCK_STATUS = TRUE
INF MsCorePkg/AcpiRGRT/AcpiRgrt.inf
INF SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.inf
INF MsCorePkg/HelloWorldRustDxe/HelloWorldRustDxe.inf
INF AdvLoggerPkg/Application/AdvancedLogDumper/AdvancedLogDumper.inf

#
# DFCI support
Expand Down

0 comments on commit c2982a8

Please sign in to comment.