[PATCH v2 3/5] OvmfPkg/QemuVideoDxe: drop QEMU_VIDEO_BOCHS_MODES->ColorDepth
Gerd Hoffmann
All video modes in the list are 32-bit,
so drop the useless ColorDepth field. Signed-off-by: Gerd Hoffmann <kraxel@...> --- OvmfPkg/QemuVideoDxe/Qemu.h | 1 - OvmfPkg/QemuVideoDxe/Initialize.c | 80 +++++++++++++++---------------- 2 files changed, 39 insertions(+), 42 deletions(-) diff --git a/OvmfPkg/QemuVideoDxe/Qemu.h b/OvmfPkg/QemuVideoDxe/Qemu.h index fef648c967b2..1e6507f44caa 100644 --- a/OvmfPkg/QemuVideoDxe/Qemu.h +++ b/OvmfPkg/QemuVideoDxe/Qemu.h @@ -132,7 +132,6 @@ typedef struct { typedef struct { UINT32 Width; UINT32 Height; - UINT32 ColorDepth; } QEMU_VIDEO_BOCHS_MODES; #define QEMU_VIDEO_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS(a) \ diff --git a/OvmfPkg/QemuVideoDxe/Initialize.c b/OvmfPkg/QemuVideoDxe/Initialize.c index 8a70cf848483..2b174d13faf2 100644 --- a/OvmfPkg/QemuVideoDxe/Initialize.c +++ b/OvmfPkg/QemuVideoDxe/Initialize.c @@ -203,43 +203,43 @@ QemuVideoCirrusModeSetup ( /// Table of supported video modes /// STATIC QEMU_VIDEO_BOCHS_MODES QemuVideoBochsModes[] = { - { 640, 480, 32 }, - { 800, 480, 32 }, - { 800, 600, 32 }, - { 832, 624, 32 }, - { 960, 640, 32 }, - { 1024, 600, 32 }, - { 1024, 768, 32 }, - { 1152, 864, 32 }, - { 1152, 870, 32 }, - { 1280, 720, 32 }, - { 1280, 760, 32 }, - { 1280, 768, 32 }, - { 1280, 800, 32 }, - { 1280, 960, 32 }, - { 1280, 1024, 32 }, - { 1360, 768, 32 }, - { 1366, 768, 32 }, - { 1400, 1050, 32 }, - { 1440, 900, 32 }, - { 1600, 900, 32 }, - { 1600, 1200, 32 }, - { 1680, 1050, 32 }, - { 1920, 1080, 32 }, - { 1920, 1200, 32 }, - { 1920, 1440, 32 }, - { 2000, 2000, 32 }, - { 2048, 1536, 32 }, - { 2048, 2048, 32 }, - { 2560, 1440, 32 }, - { 2560, 1600, 32 }, - { 2560, 2048, 32 }, - { 2800, 2100, 32 }, - { 3200, 2400, 32 }, - { 3840, 2160, 32 }, - { 4096, 2160, 32 }, - { 7680, 4320, 32 }, - { 8192, 4320, 32 } + { 640, 480 }, + { 800, 480 }, + { 800, 600 }, + { 832, 624 }, + { 960, 640 }, + { 1024, 600 }, + { 1024, 768 }, + { 1152, 864 }, + { 1152, 870 }, + { 1280, 720 }, + { 1280, 760 }, + { 1280, 768 }, + { 1280, 800 }, + { 1280, 960 }, + { 1280, 1024 }, + { 1360, 768 }, + { 1366, 768 }, + { 1400, 1050 }, + { 1440, 900 }, + { 1600, 900 }, + { 1600, 1200 }, + { 1680, 1050 }, + { 1920, 1080 }, + { 1920, 1200 }, + { 1920, 1440 }, + { 2000, 2000 }, + { 2048, 1536 }, + { 2048, 2048 }, + { 2560, 1440 }, + { 2560, 1600 }, + { 2560, 2048 }, + { 2800, 2100 }, + { 3200, 2400 }, + { 3840, 2160 }, + { 4096, 2160 }, + { 7680, 4320 }, + { 8192, 4320 } }; #define QEMU_VIDEO_BOCHS_MODE_COUNT \ @@ -348,14 +348,12 @@ QemuVideoBochsModeSetup ( for (Index = 0; Index < QEMU_VIDEO_BOCHS_MODE_COUNT; Index++) { UINTN RequiredFbSize; - ASSERT (VideoMode->ColorDepth % 8 == 0); - RequiredFbSize = (UINTN)VideoMode->Width * VideoMode->Height * - (VideoMode->ColorDepth / 8); + RequiredFbSize = (UINTN)VideoMode->Width * VideoMode->Height * 4; if (RequiredFbSize <= AvailableFbSize) { ModeData->InternalModeIndex = Index; ModeData->HorizontalResolution = VideoMode->Width; ModeData->VerticalResolution = VideoMode->Height; - ModeData->ColorDepth = VideoMode->ColorDepth; + ModeData->ColorDepth = 32; DEBUG (( DEBUG_INFO, "Adding Mode %d as Bochs Internal Mode %d: %dx%d, %d-bit\n", -- 2.34.1
|
|
[PATCH v2 5/5] OvmfPkg/QemuVideoDxe: parse edid blob, detect display resolution
Gerd Hoffmann
Check whenever an EDID blob is present. In case it is get the display
resolution from it. Unless PcdVideoResolutionSource indicates the display resolution has been set already update PcdVideoHorizontalResolution and PcdVideoVerticalResolution accordingly. Also add the resolution to the mode list. This will make OVMF boot up with the display resolution configured by QEMU, which is 1024x768 by default. The resolution can be set using the xres and yres properties. Here is an example for FullHD: qemu-system-x86_64 -device VGA,xres=1920,yres=1080 Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3778 Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1749250 Signed-off-by: Gerd Hoffmann <kraxel@...> --- OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf | 3 + OvmfPkg/QemuVideoDxe/Qemu.h | 2 + OvmfPkg/QemuVideoDxe/Initialize.c | 102 +++++++++++++++++++++++++- 3 files changed, 105 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf b/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf index fe8befd51d3c..43a6e07faa88 100644 --- a/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf +++ b/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf @@ -63,4 +63,7 @@ [Protocols] [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId + gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution diff --git a/OvmfPkg/QemuVideoDxe/Qemu.h b/OvmfPkg/QemuVideoDxe/Qemu.h index 1e6507f44caa..57341a0bbfc4 100644 --- a/OvmfPkg/QemuVideoDxe/Qemu.h +++ b/OvmfPkg/QemuVideoDxe/Qemu.h @@ -115,6 +115,8 @@ typedef struct { FRAME_BUFFER_CONFIGURE *FrameBufferBltConfigure; UINTN FrameBufferBltConfigureSize; UINT8 FrameBufferVramBarIndex; + + UINT8 Edid[128]; } QEMU_VIDEO_PRIVATE_DATA; /// diff --git a/OvmfPkg/QemuVideoDxe/Initialize.c b/OvmfPkg/QemuVideoDxe/Initialize.c index 8c5c9176ad21..2a3cbc65c32a 100644 --- a/OvmfPkg/QemuVideoDxe/Initialize.c +++ b/OvmfPkg/QemuVideoDxe/Initialize.c @@ -284,6 +284,88 @@ QemuVideoBochsAddMode ( Private->MaxMode++; } +STATIC +VOID +QemuVideoBochsEdid ( + QEMU_VIDEO_PRIVATE_DATA *Private, + UINT32 *XRes, + UINT32 *YRes + ) +{ + EFI_STATUS Status; + + if (Private->Variant != QEMU_VIDEO_BOCHS_MMIO) { + return; + } + + Status = Private->PciIo->Mem.Read ( + Private->PciIo, + EfiPciIoWidthUint8, + PCI_BAR_IDX2, + 0, + sizeof (Private->Edid), + Private->Edid + ); + if (Status != EFI_SUCCESS) { + DEBUG (( + DEBUG_INFO, + "%a: mmio read failed\n", + __FUNCTION__ + )); + return; + } + + if ((Private->Edid[0] != 0x00) || + (Private->Edid[1] != 0xff)) + { + DEBUG (( + DEBUG_INFO, + "%a: magic check failed\n", + __FUNCTION__ + )); + return; + } + + DEBUG (( + DEBUG_INFO, + "%a: blob found (extensions: %d)\n", + __FUNCTION__, + Private->Edid[126] + )); + + if ((Private->Edid[54] == 0x00) && + (Private->Edid[55] == 0x00)) + { + DEBUG (( + DEBUG_INFO, + "%a: no detailed timing descriptor\n", + __FUNCTION__ + )); + return; + } + + *XRes = Private->Edid[56] | ((Private->Edid[58] & 0xf0) << 4); + *YRes = Private->Edid[59] | ((Private->Edid[61] & 0xf0) << 4); + DEBUG (( + DEBUG_INFO, + "%a: default resolution: %dx%d\n", + __FUNCTION__, + *XRes, + *YRes + )); + + if (PcdGet8 (PcdVideoResolutionSource) == 0) { + Status = PcdSet32S (PcdVideoHorizontalResolution, *XRes); + ASSERT_RETURN_ERROR (Status); + Status = PcdSet32S (PcdVideoVerticalResolution, *YRes); + ASSERT_RETURN_ERROR (Status); + Status = PcdSet8S (PcdVideoResolutionSource, 2); + ASSERT_RETURN_ERROR (Status); + } + + // TODO: register edid as gEfiEdidDiscoveredProtocolGuid ? +} + EFI_STATUS QemuVideoBochsModeSetup ( QEMU_VIDEO_PRIVATE_DATA *Private, @@ -291,7 +373,7 @@ QemuVideoBochsModeSetup ( ) { UINT32 AvailableFbSize; - UINT32 Index; + UINT32 Index, XRes = 0, YRes = 0; // // Fetch the available framebuffer size. @@ -374,13 +456,29 @@ QemuVideoBochsModeSetup ( // Setup Video Modes // Private->ModeData = AllocatePool ( - sizeof (Private->ModeData[0]) * QEMU_VIDEO_BOCHS_MODE_COUNT + sizeof (Private->ModeData[0]) * (QEMU_VIDEO_BOCHS_MODE_COUNT+1) ); if (Private->ModeData == NULL) { return EFI_OUT_OF_RESOURCES; } + QemuVideoBochsEdid (Private, &XRes, &YRes); + if (XRes && YRes) { + QemuVideoBochsAddMode ( + Private, + AvailableFbSize, + XRes, + YRes + ); + } + for (Index = 0; Index < QEMU_VIDEO_BOCHS_MODE_COUNT; Index++) { + if ((QemuVideoBochsModes[Index].Width == XRes) && + (QemuVideoBochsModes[Index].Height == YRes)) + { + continue; // duplicate with edid resolution + } + QemuVideoBochsAddMode ( Private, AvailableFbSize, -- 2.34.1
|
|
[PATCH v2 2/5] OvmfPkg/QemuVideoDxe: simplify InitializeBochsGraphicsMode
Gerd Hoffmann
struct QEMU_VIDEO_MODE_DATA has all the data needed to set the video
mode, there is no need to take the extra indirection and use struct QEMU_VIDEO_BOCHS_MODES. Signed-off-by: Gerd Hoffmann <kraxel@...> --- OvmfPkg/QemuVideoDxe/Qemu.h | 3 +-- OvmfPkg/QemuVideoDxe/Driver.c | 14 +++++++------- OvmfPkg/QemuVideoDxe/Gop.c | 2 +- OvmfPkg/QemuVideoDxe/Initialize.c | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/OvmfPkg/QemuVideoDxe/Qemu.h b/OvmfPkg/QemuVideoDxe/Qemu.h index 8f05898f862c..fef648c967b2 100644 --- a/OvmfPkg/QemuVideoDxe/Qemu.h +++ b/OvmfPkg/QemuVideoDxe/Qemu.h @@ -150,7 +150,6 @@ extern UINT16 Seq_800_600_256_60[]; extern UINT8 Crtc_1024_768_256_60[]; extern UINT16 Seq_1024_768_256_60[]; extern QEMU_VIDEO_CIRRUS_MODES QemuVideoCirrusModes[]; -extern QEMU_VIDEO_BOCHS_MODES QemuVideoBochsModes[]; extern EFI_DRIVER_BINDING_PROTOCOL gQemuVideoDriverBinding; extern EFI_COMPONENT_NAME_PROTOCOL gQemuVideoComponentName; extern EFI_COMPONENT_NAME2_PROTOCOL gQemuVideoComponentName2; @@ -414,7 +413,7 @@ InitializeCirrusGraphicsMode ( VOID InitializeBochsGraphicsMode ( QEMU_VIDEO_PRIVATE_DATA *Private, - QEMU_VIDEO_BOCHS_MODES *ModeData + QEMU_VIDEO_MODE_DATA *ModeData ); VOID diff --git a/OvmfPkg/QemuVideoDxe/Driver.c b/OvmfPkg/QemuVideoDxe/Driver.c index d9f0a2464aa3..b91909a14e59 100644 --- a/OvmfPkg/QemuVideoDxe/Driver.c +++ b/OvmfPkg/QemuVideoDxe/Driver.c @@ -987,14 +987,14 @@ VgaOutb ( VOID InitializeBochsGraphicsMode ( QEMU_VIDEO_PRIVATE_DATA *Private, - QEMU_VIDEO_BOCHS_MODES *ModeData + QEMU_VIDEO_MODE_DATA *ModeData ) { DEBUG (( DEBUG_INFO, "InitializeBochsGraphicsMode: %dx%d @ %d\n", - ModeData->Width, - ModeData->Height, + ModeData->HorizontalResolution, + ModeData->VerticalResolution, ModeData->ColorDepth )); @@ -1007,10 +1007,10 @@ InitializeBochsGraphicsMode ( BochsWrite (Private, VBE_DISPI_INDEX_Y_OFFSET, 0); BochsWrite (Private, VBE_DISPI_INDEX_BPP, (UINT16)ModeData->ColorDepth); - BochsWrite (Private, VBE_DISPI_INDEX_XRES, (UINT16)ModeData->Width); - BochsWrite (Private, VBE_DISPI_INDEX_VIRT_WIDTH, (UINT16)ModeData->Width); - BochsWrite (Private, VBE_DISPI_INDEX_YRES, (UINT16)ModeData->Height); - BochsWrite (Private, VBE_DISPI_INDEX_VIRT_HEIGHT, (UINT16)ModeData->Height); + BochsWrite (Private, VBE_DISPI_INDEX_XRES, (UINT16)ModeData->HorizontalResolution); + BochsWrite (Private, VBE_DISPI_INDEX_VIRT_WIDTH, (UINT16)ModeData->HorizontalResolution); + BochsWrite (Private, VBE_DISPI_INDEX_YRES, (UINT16)ModeData->VerticalResolution); + BochsWrite (Private, VBE_DISPI_INDEX_VIRT_HEIGHT, (UINT16)ModeData->VerticalResolution); BochsWrite ( Private, diff --git a/OvmfPkg/QemuVideoDxe/Gop.c b/OvmfPkg/QemuVideoDxe/Gop.c index 5ad0afe88378..0c4dea7fb6f2 100644 --- a/OvmfPkg/QemuVideoDxe/Gop.c +++ b/OvmfPkg/QemuVideoDxe/Gop.c @@ -177,7 +177,7 @@ Routine Description: break; case QEMU_VIDEO_BOCHS_MMIO: case QEMU_VIDEO_BOCHS: - InitializeBochsGraphicsMode (Private, &QemuVideoBochsModes[ModeData->InternalModeIndex]); + InitializeBochsGraphicsMode (Private, ModeData); break; default: ASSERT (FALSE); diff --git a/OvmfPkg/QemuVideoDxe/Initialize.c b/OvmfPkg/QemuVideoDxe/Initialize.c index 533ec661d64f..8a70cf848483 100644 --- a/OvmfPkg/QemuVideoDxe/Initialize.c +++ b/OvmfPkg/QemuVideoDxe/Initialize.c @@ -202,7 +202,7 @@ QemuVideoCirrusModeSetup ( /// /// Table of supported video modes /// -QEMU_VIDEO_BOCHS_MODES QemuVideoBochsModes[] = { +STATIC QEMU_VIDEO_BOCHS_MODES QemuVideoBochsModes[] = { { 640, 480, 32 }, { 800, 480, 32 }, { 800, 600, 32 }, -- 2.34.1
|
|
[PATCH v2 0/5] OvmfPkg/QemuVideoDxe: pick up display resolution settings from the host
Gerd Hoffmann
See last patch in the series for details.
v2: - rebase to latest master - more verbose commit message explaining the motivation for the new PCD (see patch #1). Gerd Hoffmann (5): OvmfPkg: add PcdVideoResolutionSource OvmfPkg/QemuVideoDxe: simplify InitializeBochsGraphicsMode OvmfPkg/QemuVideoDxe: drop QEMU_VIDEO_BOCHS_MODES->ColorDepth OvmfPkg/QemuVideoDxe: factor out QemuVideoBochsAddMode OvmfPkg/QemuVideoDxe: parse edid blob, detect display resolution OvmfPkg/OvmfPkg.dec | 7 + OvmfPkg/AmdSev/AmdSevX64.dsc | 1 + OvmfPkg/Microvm/MicrovmX64.dsc | 1 + OvmfPkg/OvmfPkgIa32.dsc | 1 + OvmfPkg/OvmfPkgIa32X64.dsc | 1 + OvmfPkg/OvmfPkgX64.dsc | 1 + OvmfPkg/OvmfXen.dsc | 1 + OvmfPkg/PlatformDxe/Platform.inf | 1 + OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf | 3 + OvmfPkg/QemuVideoDxe/Qemu.h | 6 +- OvmfPkg/PlatformDxe/Platform.c | 3 + OvmfPkg/QemuVideoDxe/Driver.c | 14 +- OvmfPkg/QemuVideoDxe/Gop.c | 2 +- OvmfPkg/QemuVideoDxe/Initialize.c | 251 +++++++++++++++++++------- 14 files changed, 213 insertions(+), 80 deletions(-) -- 2.34.1
|
|
[PATCH v2 1/5] OvmfPkg: add PcdVideoResolutionSource
Gerd Hoffmann
It's a UINT8 (enum) PCD telling where the PcdVideoHorizontalResolution
and PcdVideoVerticalResolution values are coming from. It can be: 0 (unset aka default from dsc file), or 1 (from PlatformConfig), or 2 (set by Video Driver). It will be used by video drivers to avoid overriding PlatformConfig values, or override each others values in case multiple display devices are present. The underlying problem this tries to solve is that the GOP protocol has no way to indicate the preferred video mode. On physical hardware this isn't much of a problem because using the highest resolution available works just fine as that is typically the native display resolution But in a virtual machine you don't want come up with a huge 4k window by default just because the virtual vga is able to handle that. Cutting down the video mode list isn't a great solution either as that would also remove the modes from the platform configuration so the user wouldn't be able to pick a resolution higher than the default any more. So with patch drivers can use use PcdVideoHorizontalResolution and PcdVideoVerticalResolution to indicate what the preferred display resolution is, without overwriting the user preferences from PlatformConfig if present. A possible alternative approach would be to extend the GOP protocol, but I'm not sure this is a good plan given this is mostly a problem for virtual machines and using PCDs allows to keep this local to OvmfPkg. Signed-off-by: Gerd Hoffmann <kraxel@...> --- OvmfPkg/OvmfPkg.dec | 7 +++++++ OvmfPkg/AmdSev/AmdSevX64.dsc | 1 + OvmfPkg/Microvm/MicrovmX64.dsc | 1 + OvmfPkg/OvmfPkgIa32.dsc | 1 + OvmfPkg/OvmfPkgIa32X64.dsc | 1 + OvmfPkg/OvmfPkgX64.dsc | 1 + OvmfPkg/OvmfXen.dsc | 1 + OvmfPkg/PlatformDxe/Platform.inf | 1 + OvmfPkg/PlatformDxe/Platform.c | 3 +++ 9 files changed, 17 insertions(+) diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec index 769bef0ffa12..7aa94ca02863 100644 --- a/OvmfPkg/OvmfPkg.dec +++ b/OvmfPkg/OvmfPkg.dec @@ -408,6 +408,13 @@ [PcdsDynamic, PcdsDynamicEx] # instance in PiSmmCpuDxeSmm, and CpuHotplugSmm. gUefiOvmfPkgTokenSpaceGuid.PcdCpuHotEjectDataAddress|0|UINT64|0x46 + ## This PCD tracks where PcdVideo{Horizontal,Vertical}Resolution + # values are coming from. + # 0 - unset (defaults from platform dsc) + # 1 - set from PlatformConfig + # 2 - set by GOP Driver. + gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource|0|UINT8|0x64 + [PcdsFeatureFlag] gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderPciTranslation|TRUE|BOOLEAN|0x1c gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderMmioTranslation|FALSE|BOOLEAN|0x1d diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc index 04ae61cf69d8..343ac643f021 100644 --- a/OvmfPkg/AmdSev/AmdSevX64.dsc +++ b/OvmfPkg/AmdSev/AmdSevX64.dsc @@ -527,6 +527,7 @@ [PcdsDynamicDefault] gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800 gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600 gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE + gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource|0 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0 diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc index 1c2e600febee..cb28bd8bba2c 100644 --- a/OvmfPkg/Microvm/MicrovmX64.dsc +++ b/OvmfPkg/Microvm/MicrovmX64.dsc @@ -560,6 +560,7 @@ [PcdsDynamicDefault] gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800 gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600 gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE + gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource|0 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0 diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index 085cc7ece15d..2f05d93ed4af 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -590,6 +590,7 @@ [PcdsDynamicDefault] gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800 gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600 gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE + gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource|0 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0 diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 0ce122ddb50c..bcab54aaa02a 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -596,6 +596,7 @@ [PcdsDynamicDefault] gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800 gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600 gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE + gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource|0 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0 diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index 4589adff388d..ee0fdf492fd4 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -595,6 +595,7 @@ [PcdsDynamicDefault] gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800 gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600 gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE + gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource|0 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0 diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index de0d30bfb807..1f6352195b75 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -468,6 +468,7 @@ [PcdsDynamicDefault] gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800 gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600 gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE + gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource|0 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0 diff --git a/OvmfPkg/PlatformDxe/Platform.inf b/OvmfPkg/PlatformDxe/Platform.inf index 14727c1220e8..d2f75d78b601 100644 --- a/OvmfPkg/PlatformDxe/Platform.inf +++ b/OvmfPkg/PlatformDxe/Platform.inf @@ -47,6 +47,7 @@ [LibraryClasses] [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution + gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource [Protocols] gEfiDevicePathProtocolGuid ## PRODUCES diff --git a/OvmfPkg/PlatformDxe/Platform.c b/OvmfPkg/PlatformDxe/Platform.c index 69a7ecb83d03..4bf22712c78f 100644 --- a/OvmfPkg/PlatformDxe/Platform.c +++ b/OvmfPkg/PlatformDxe/Platform.c @@ -742,6 +742,9 @@ ExecutePlatformConfig ( PlatformConfig.VerticalResolution ); ASSERT_RETURN_ERROR (PcdStatus); + + PcdStatus = PcdSet8S (PcdVideoResolutionSource, 1); + ASSERT_RETURN_ERROR (PcdStatus); } return EFI_SUCCESS; -- 2.34.1
|
|
[Patch V2] UefiPayloadPkg: Change the user interface name of the Uiapp
Yuanhao Xie
Chanage the name "Uiapp" to "Enter Setup".
Cc: Guo Dong <guo.dong@...> Cc: Ray Ni <ray.ni@...> Cc: Maurice Ma <maurice.ma@...> Cc: Benjamin You <benjamin.you@...> Signed-off-by: Yuanhao Xie <yuanhao.xie@...> --- UefiPayloadPkg/UefiPayloadPkg.fdf | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf b/UefiPayloadPkg/UefiPayloadPkg.fdf index f619a23139..c7b04978ad 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.fdf +++ b/UefiPayloadPkg/UefiPayloadPkg.fdf @@ -104,7 +104,7 @@ INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf !endif INF UefiCpuPkg/CpuDxe/CpuDxe.inf INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf -INF MdeModulePkg/Application/UiApp/UiApp.inf +INF RuleOverride = UI MdeModulePkg/Application/UiApp/UiApp.inf INF MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf INF PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf INF MdeModulePkg/Universal/Metronome/Metronome.inf @@ -357,3 +357,10 @@ INF ShellPkg/Application/Shell/Shell.inf FILE RAW = $(NAMED_GUID) { RAW RAW |.raw } + +[Rule.Common.UEFI_APPLICATION.UI] + FILE APPLICATION = $(NAMED_GUID) { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING="Enter Setup" + VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER) + } -- 2.30.0.windows.1
|
|
[Wiki V2] Wiki: Add optional steps for developer to run CI test before sending
Zhiguang Liu
V2: Add the step to join in https://edk2.groups.io/g/devel and wait for
approval when first sending patch. Cc: Liming Gao <gaoliming@...> Signed-off-by: Zhiguang Liu <zhiguang.liu@...> --- EDK-II-Development-Process.md | 69 +++++++++++++++++++++++++++++++++++++++= +++++++++++++----------------- 1 file changed, 52 insertions(+), 17 deletions(-) diff --git a/EDK-II-Development-Process.md b/EDK-II-Development-Process.md index 469a979..d02baa7 100644 --- a/EDK-II-Development-Process.md +++ b/EDK-II-Development-Process.md @@ -59,20 +59,50 @@ The developer process for the EDK II project =20 `$ git rebase origin/master` =20 -9. Run the automated code formatting tool (Uncrustify) against your change= s=0D -=0D - - [EDK-II-Code-Formatting](EDK-II-Code-Formatting "wikilink")=0D -=0D - - The changes must pass local CI which includes a code formatting check= =0D - in order to be merged into the code base.=0D -=0D - - It is strongly recommended that you format the code after each commit= .=0D - The code can then be easily amended with the formatted output. Some=0D - developers might also prefer to format frequently while writing the=0D - code using the plugin instructions described in the code formatting=0D - wiki page.=0D -=0D -10. Create patch (serial) to the [[edk2-devel]] mailing list=0D +9. Run the automated code formatting tool (Uncrustify) against your changes + + - [EDK-II-Code-Formatting](EDK-II-Code-Formatting "wikilink") + + - The changes must pass local CI which includes a code formatting check + in order to be merged into the code base. + + - It is strongly recommended that you format the code after each commit. + The code can then be easily amended with the formatted output. Some + developers might also prefer to format frequently while writing the + code using the plugin instructions described in the code formatting + wiki page. + +10. (Optional) Push changes to the developer's fork of the EDK II project + repository. + + - How to create a [GitHub fork](https://help.github.com/en/github/gett= ing-started-with-github/fork-a-repo) + - **NOTE:** A GitHub fork can also be created using the command line + utility called [`hub`](https://github.com/github/hub/releases). T= he + `hub` usage information can be found [here](https://hub.github.com= /hub.1.html). + + - Add remote to the developer's fork of the EDK II project + + `$ git remote add <developer-id> https://github.com/<developer-id>/edk= 2.git` + + - Push the integration branch. + + `$ git push <developer-id> <new-integration-branch>` + +11. (Optional) Create a GitHub pull request from the developer's + <new-integration-branch> to edk2/master to run CI check. + + - How to create a [GitHub pull request](https://help.github.com/en/git= hub/collaborating-with-issues-and-pull-requests/creating-a-pull-request) + - **NOTE:** A GitHub pull request can also be created using the comm= and + line utility called [`hub`](https://github.com/github/hub/releases= ). + The `hub` usage information can be found [here](https://hub.github= .com/hub.1.html). + + - Declare that it is for CI check test in the pull request title and + description. + + - Resolve GitHub pull request issues if it fails. Please refrence step= 8 + in the below **The maintainer process for the EDK II project** + +12. Create patch (serial) to the [[edk2-devel]] mailing list =20 - Clean out any old patches: `$ rm *.patch` =20 @@ -84,10 +114,15 @@ The developer process for the EDK II project - Add the `--subject-prefix=3D"PATCH v2"` if you are sending out a second version of the patch series. =20 - - `$ git send-email *.patch` + - `$ git send-email *.patch --to devel@edk2.groups.io` + + - If it is the first time to send mail to edk2 mail list, please join + https://edk2.groups.io/g/devel and expect there will be delay because + the mail needs manual approval from the admin (gaoliming@...= .cn + or michael.d.kinney@...) of https://edk2.groups.io/g/devel =20 -11. Modify local commits based on the review feedbacks and repeat steps=0D - 3 to 9 +13. Modify local commits based on the review feedbacks and repeat steps + 3 to 11 =20 - For the latest commit, you can use `$ git commit --amend` =20 --=20 2.32.0.windows.2
|
|
Re: [PATCH] MdeModulePkg/HiiDatabaseDxe: Add Support for authenticated variable
Dandan Bi
Sure. Thanks Liming.
toggle quoted messageShow quoted text
Thanks, Dandan
-----Original Message-----
|
|
Re: [PATCH] BaseTools/GenFw: Enhance to add export table in PE-COFF
Huang, Li-Xia <lisa.huang@...>
Hi Bob,
Thanks for your comments.
1. I will add the help information for "--PRM"; 2. @@ -750,7 +818,7 @@ ScanSections64 ( if (shdr->sh_addralign <= mCoffAlignment) { continue; } - if (IsTextShdr(shdr) || IsDataShdr(shdr) || IsHiiRsrcShdr(shdr)) { + if (IsTextShdr(shdr) || IsDataShdr(shdr) || IsHiiRsrcShdr(shdr) || IsSymbolShdr(shdr)) { mCoffAlignment = (UINT32)shdr->sh_addralign; } }
1) Above change is to Set mCoffAlignment to the maximum alignment of the input sections including symbol section. The symbol section will only exist with below change, so it should have no effect to other drivers.
build_rule.template: <Command.GCC> $(CP) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).debug #$(OBJCOPY) --strip-unneeded -R .eh_frame ${src} $(OBJCOPY) $(OBJCOPY_STRIPFLAG) ${src}
tools_def.template: *_*_*_OBJCOPY_STRIPFLAG = --strip-unneeded -R .eh_frame
PrmAddrTransDsm.inf: [BuildOptions.common] ... GCC: *_*_*_OBJCOPY_STRIPFLAG == -R .eh_frame
2) For PRM driver, sh_addralign of symbol section is 8, and less than other sections such as Text and Data (sh_addralign is 4096).
Regards, Lisa
-----Original Message-----
From: Feng, Bob C <bob.c.feng@...> Sent: 2022年1月14日 14:12 To: Huang, Li-Xia <lisa.huang@...>; devel@edk2.groups.io Cc: Gao, Liming <gaoliming@...>; Chen, Christine <yuwei.chen@...> Subject: RE: [edk2-devel][PATCH] BaseTools/GenFw: Enhance to add export table in PE-COFF
Hi Lixia,
This patch introduce a new command line option --PRM. Could you add the help information about --PRM?
Could you provide more information about the below change? Would there be side-effect?
@@ -750,7 +818,7 @@ ScanSections64 ( if (shdr->sh_addralign <= mCoffAlignment) { continue; } - if (IsTextShdr(shdr) || IsDataShdr(shdr) || IsHiiRsrcShdr(shdr)) { + if (IsTextShdr(shdr) || IsDataShdr(shdr) || IsHiiRsrcShdr(shdr) || IsSymbolShdr(shdr)) { mCoffAlignment = (UINT32)shdr->sh_addralign; } }
Thanks, Bob
-----Original Message----- From: Huang, Li-Xia <lisa.huang@...> Sent: Wednesday, January 12, 2022 3:44 PM Cc: Huang, Li-Xia <lisa.huang@...>; Gao, Liming <gaoliming@...>; Feng, Bob C <bob.c.feng@...>; Chen, Christine <yuwei.chen@...> Subject: [edk2-devel][PATCH] BaseTools/GenFw: Enhance to add export table in PE-COFF
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3802 Since PRM module needs to support export table in PE-COFF, we'll enhance GenFw tool to support this.
Add one export flag in GenFw tool. If export flag is set: Step1: Scan ELF symbol table based on PRM module descriptor to get descriptor offset address; Step2: Find PRM handlers number and name in COFF file based on the address from step1; Step3: Write PRM info such as handler name and export RVA into COFF export table.
Cc: Liming Gao <gaoliming@...> Cc: Bob Feng <bob.c.feng@...> Cc: Yuwei Chen <yuwei.chen@...> Signed-off-by: Lixia Huang <lisa.huang@...> --- BaseTools/Source/C/GenFw/Elf64Convert.c | 254 +++++++++++++++++- BaseTools/Source/C/GenFw/ElfConvert.c | 10 + BaseTools/Source/C/GenFw/ElfConvert.h | 42 ++- BaseTools/Source/C/GenFw/GenFw.c | 11 +- .../C/Include/IndustryStandard/PeImage.h | 7 + 5 files changed, 318 insertions(+), 6 deletions(-)
diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c index 0bb3ead228..0079507356 100644 --- a/BaseTools/Source/C/GenFw/Elf64Convert.c +++ b/BaseTools/Source/C/GenFw/Elf64Convert.c @@ -56,6 +56,18 @@ WriteDebug64 ( VOID ); +STATIC+VOID+ScanSymbol64 (+ VOID+ );++STATIC+VOID+WriteExport64 (+ VOID+ );+ STATIC VOID SetImageSize64 (@@ -122,7 +134,7 @@ STATIC UINT32 mDataOffset; STATIC UINT32 mHiiRsrcOffset; STATIC UINT32 mRelocOffset; STATIC UINT32 mDebugOffset;-+STATIC UINT32 mExportOffset; // // Used for RISC-V relocations. //@@ -132,6 +144,14 @@ STATIC Elf64_Half mRiscVPass1SymSecIndex = 0; STATIC INT32 mRiscVPass1Offset; STATIC INT32 mRiscVPass1GotFixup; +//+// Used for Export section.+//+STATIC UINT32 mExportSize;+STATIC UINT32 mExportRVA[PRM_MODULE_EXPORT_SYMBOL_NUM];+STATIC UINT32 mExportSymNum;+STATIC CHAR8 mExportSymName[PRM_MODULE_EXPORT_SYMBOL_NUM][PRM_HANDLER_NAME_MAXIMUM_LENGTH];+ // // Initialization Function //@@ -200,6 +220,10 @@ InitializeElf64 ( ElfFunctions->SetImageSize = SetImageSize64; ElfFunctions->CleanUp = CleanUp64; + if (mExportFlag) {+ ElfFunctions->ScanSymbol = ScanSymbol64;+ ElfFunctions->WriteExport = WriteExport64;+ } return TRUE; } @@ -263,6 +287,17 @@ IsHiiRsrcShdr ( return (BOOLEAN) (strcmp((CHAR8*)mEhdr + Namedr->sh_offset + Shdr->sh_name, ELF_HII_SECTION_NAME) == 0); } +STATIC+BOOLEAN+IsSymbolShdr (+ Elf_Shdr *Shdr+ )+{+ Elf_Shdr *Namehdr = GetShdrByIndex(mEhdr->e_shstrndx);++ return (BOOLEAN) (strcmp((CHAR8*)mEhdr + Namehdr->sh_offset + Shdr->sh_name, ELF_SYMBOL_SECTION_NAME) == 0);+}+ STATIC BOOLEAN IsDataShdr (@@ -335,6 +370,38 @@ GetSymName ( return StrtabContents + Sym->st_name; } +//+// Get Prm Handler number and name+//+STATIC+VOID+FindPrmHandler (+ UINT64 Offset+ )+{+ PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER *PrmExport;+ UINT32 NameOffset;+ UINT32 HandlerNum;+ UINT32 Index;+ UINT8 SymName[PRM_HANDLER_NAME_MAXIMUM_LENGTH];++ PrmExport = (PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER*)(mCoffFile + Offset);+ NameOffset = sizeof(PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER) + sizeof(EFI_GUID);++ for (HandlerNum = 0; HandlerNum < PrmExport->NumberPrmHandlers; HandlerNum++) {+ for (Index = 0; Index < PRM_HANDLER_NAME_MAXIMUM_LENGTH; Index++) {+ SymName[Index] = *((UINT8 *)PrmExport + NameOffset + Index);+ if (SymName[Index] == 0) {+ break;+ }+ }++ strcpy(mExportSymName[mExportSymNum], (CHAR8*)SymName);+ NameOffset += PRM_HANDLER_NAME_MAXIMUM_LENGTH + sizeof(EFI_GUID);+ mExportSymNum ++;+ }+}+ // // Find the ELF section hosting the GOT from an ELF Rva // of a single GOT entry. Normally, GOT is placed in@@ -717,6 +784,7 @@ ScanSections64 ( UINT32 CoffEntry; UINT32 SectionCount; BOOLEAN FoundSection;+ UINT32 Offset; CoffEntry = 0; mCoffOffset = 0;@@ -750,7 +818,7 @@ ScanSections64 ( if (shdr->sh_addralign <= mCoffAlignment) { continue; }- if (IsTextShdr(shdr) || IsDataShdr(shdr) || IsHiiRsrcShdr(shdr)) {+ if (IsTextShdr(shdr) || IsDataShdr(shdr) || IsHiiRsrcShdr(shdr) || IsSymbolShdr(shdr)) { mCoffAlignment = (UINT32)shdr->sh_addralign; } }@@ -880,6 +948,16 @@ ScanSections64 ( Warning (NULL, 0, 0, NULL, "Multiple sections in %s are merged into 1 data section. Source level debug might not work correctly.", mInImageName); } + //+ // The Symbol sections.+ //+ if (mExportFlag) {+ mExportOffset = mCoffOffset;+ mExportSize = sizeof(EFI_IMAGE_EXPORT_DIRECTORY) + strlen(mInImageName) + 1;+ mCoffOffset += mExportSize;+ mCoffOffset = CoffAlign(mCoffOffset);+ }+ // // The HII resource sections. //@@ -962,7 +1040,11 @@ ScanSections64 ( | EFI_IMAGE_FILE_LARGE_ADDRESS_AWARE; NtHdr->Pe32Plus.OptionalHeader.SizeOfCode = mDataOffset - mTextOffset;- NtHdr->Pe32Plus.OptionalHeader.SizeOfInitializedData = mRelocOffset - mDataOffset;+ if(mExportFlag) {+ NtHdr->Pe32Plus.OptionalHeader.SizeOfInitializedData = mRelocOffset - mExportOffset;+ } else {+ NtHdr->Pe32Plus.OptionalHeader.SizeOfInitializedData = mRelocOffset - mDataOffset;+ } NtHdr->Pe32Plus.OptionalHeader.SizeOfUninitializedData = 0; NtHdr->Pe32Plus.OptionalHeader.AddressOfEntryPoint = CoffEntry; @@ -989,8 +1071,17 @@ ScanSections64 ( NtHdr->Pe32Plus.FileHeader.NumberOfSections--; } + //+ // If found symbol, add edata section between data and rsrc section+ //+ if(mExportFlag) {+ Offset = mExportOffset;+ } else {+ Offset = mHiiRsrcOffset;+ }+ if ((mHiiRsrcOffset - mDataOffset) > 0) {- CreateSectionHeader (".data", mDataOffset, mHiiRsrcOffset - mDataOffset,+ CreateSectionHeader (".data", mDataOffset, Offset - mDataOffset, EFI_IMAGE_SCN_CNT_INITIALIZED_DATA | EFI_IMAGE_SCN_MEM_WRITE | EFI_IMAGE_SCN_MEM_READ);@@ -999,6 +1090,20 @@ ScanSections64 ( NtHdr->Pe32Plus.FileHeader.NumberOfSections--; } + if(mExportFlag) {+ if ((mHiiRsrcOffset - mExportOffset) > 0) {+ CreateSectionHeader (".edata", mExportOffset, mHiiRsrcOffset - mExportOffset,+ EFI_IMAGE_SCN_CNT_INITIALIZED_DATA+ | EFI_IMAGE_SCN_MEM_READ);+ NtHdr->Pe32Plus.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT].Size = mHiiRsrcOffset - mExportOffset;+ NtHdr->Pe32Plus.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress = mExportOffset;+ NtHdr->Pe32Plus.FileHeader.NumberOfSections++;+ } else {+ // Don't make a section of size 0.+ NtHdr->Pe32Plus.FileHeader.NumberOfSections--;+ }+ }+ if ((mRelocOffset - mHiiRsrcOffset) > 0) { CreateSectionHeader (".rsrc", mHiiRsrcOffset, mRelocOffset - mHiiRsrcOffset, EFI_IMAGE_SCN_CNT_INITIALIZED_DATA@@ -1757,4 +1862,145 @@ CleanUp64 ( } } +STATIC+VOID+ScanSymbol64 (+ VOID+ )+{+ UINT32 shIndex;+ UINT32 SymIndex;+ Elf_Sym *Sym;+ UINT64 SymNum;+ const UINT8 *SymName;++ for (shIndex = 0; shIndex < mEhdr->e_shnum; shIndex++) {+ //+ // Determine if this is a symbol section.+ //+ Elf_Shdr *shdr = GetShdrByIndex(shIndex);+ if (!IsSymbolShdr(shdr)) {+ continue;+ }++ UINT8 *Symtab = (UINT8*)mEhdr + shdr->sh_offset;+ SymNum = (shdr->sh_size) / (shdr->sh_entsize);++ //+ // First Get PrmModuleExportDescriptor+ //+ for (SymIndex = 0; SymIndex < SymNum; SymIndex++) {+ Sym = (Elf_Sym *)(Symtab + SymIndex * shdr->sh_entsize);+ SymName = GetSymName(Sym);+ if (SymName == NULL) {+ continue;+ }++ if (strcmp((CHAR8*)SymName, PRM_MODULE_EXPORT_DESCRIPTOR_NAME) == 0) {+ //+ // Find PrmHandler Number and Name+ //+ FindPrmHandler(Sym->st_value);++ strcpy(mExportSymName[mExportSymNum], (CHAR8*)SymName);+ mExportRVA[mExportSymNum] = (UINT32)(Sym->st_value);+ mExportSize += 2 * EFI_IMAGE_EXPORT_ADDR_SIZE + EFI_IMAGE_EXPORT_ORDINAL_SIZE + strlen((CHAR8 *)SymName) + 1;+ mExportSymNum ++;+ break;+ }+ }++ //+ // Second Get PrmHandler+ //+ for (SymIndex = 0; SymIndex < SymNum; SymIndex++) {+ UINT32 ExpIndex;+ Sym = (Elf_Sym *)(Symtab + SymIndex * shdr->sh_entsize);+ SymName = GetSymName(Sym);+ if (SymName == NULL) {+ continue;+ }++ for (ExpIndex = 0; ExpIndex < (mExportSymNum -1); ExpIndex++) {+ if (strcmp((CHAR8*)SymName, mExportSymName[ExpIndex]) != 0) {+ continue;+ }+ mExportRVA[ExpIndex] = (UINT32)(Sym->st_value);+ mExportSize += 2 * EFI_IMAGE_EXPORT_ADDR_SIZE + EFI_IMAGE_EXPORT_ORDINAL_SIZE + strlen((CHAR8 *)SymName) + 1;+ }+ }++ break;+ }+}++STATIC+VOID+WriteExport64 (+ VOID+ )+{+ EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr;+ EFI_IMAGE_EXPORT_DIRECTORY *ExportDir;+ EFI_IMAGE_DATA_DIRECTORY *DataDir;+ UINT32 FileNameOffset;+ UINT32 FuncOffset;+ UINT16 Index;+ UINT8 *Tdata = NULL;++ ExportDir = (EFI_IMAGE_EXPORT_DIRECTORY*)(mCoffFile + mExportOffset);+ ExportDir->Characteristics = 0;+ ExportDir->TimeDateStamp = 0;+ ExportDir->MajorVersion = 0;+ ExportDir->MinorVersion =0;+ ExportDir->Name = 0;+ ExportDir->NumberOfFunctions = mExportSymNum;+ ExportDir->NumberOfNames = mExportSymNum;+ ExportDir->Base = EFI_IMAGE_EXPORT_ORDINAL_BASE;+ ExportDir->AddressOfFunctions = mExportOffset + sizeof(EFI_IMAGE_EXPORT_DIRECTORY);+ ExportDir->AddressOfNames = ExportDir->AddressOfFunctions + EFI_IMAGE_EXPORT_ADDR_SIZE * mExportSymNum;+ ExportDir->AddressOfNameOrdinals = ExportDir->AddressOfNames + EFI_IMAGE_EXPORT_ADDR_SIZE * mExportSymNum;++ FileNameOffset = ExportDir->AddressOfNameOrdinals + EFI_IMAGE_EXPORT_ORDINAL_SIZE * mExportSymNum;+ FuncOffset = FileNameOffset + strlen(mInImageName) + 1;++ // Write Input image Name RVA+ Tdata = mCoffFile + 12;+ *(UINT32 *)Tdata = FileNameOffset;++ // Write Input image Name+ strcpy((char *)(mCoffFile + FileNameOffset), mInImageName);++ for (Index = 0; Index < mExportSymNum; Index++) {+ //+ // Write Export Address Table+ //+ Tdata = mCoffFile + ExportDir->AddressOfFunctions + Index * EFI_IMAGE_EXPORT_ADDR_SIZE;+ *(UINT32 *)Tdata = mExportRVA[Index];++ //+ // Write Export Name Pointer Table+ //+ Tdata = mCoffFile + ExportDir->AddressOfNames + Index * EFI_IMAGE_EXPORT_ADDR_SIZE;+ *(UINT32 *)Tdata = FuncOffset;++ //+ // Write Export Ordinal table+ //+ Tdata = mCoffFile + ExportDir->AddressOfNameOrdinals + Index * EFI_IMAGE_EXPORT_ORDINAL_SIZE;+ *(UINT16 *)Tdata = Index;++ //+ // Write Export Name Table+ //+ strcpy((char *)(mCoffFile + FuncOffset), mExportSymName[Index]);+ FuncOffset += strlen(mExportSymName[Index]) + 1;+ }++ NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset);+ DataDir = &NtHdr->Pe32Plus.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT];+ DataDir->VirtualAddress = mExportOffset;+ DataDir->Size = mExportSize;++} diff --git a/BaseTools/Source/C/GenFw/ElfConvert.c b/BaseTools/Source/C/GenFw/ElfConvert.c index 7db8721167..795cdbd743 100644 --- a/BaseTools/Source/C/GenFw/ElfConvert.c +++ b/BaseTools/Source/C/GenFw/ElfConvert.c @@ -223,6 +223,16 @@ ConvertElf ( VerboseMsg ("Write debug info."); ElfFunctions.WriteDebug (); + //+ // For PRM Driver to Write export info.+ //+ if (mExportFlag) {+ VerboseMsg ("Scan symbol info.");+ ElfFunctions.ScanSymbol ();+ VerboseMsg ("Write export info.");+ ElfFunctions.WriteExport ();+ }+ // // Make sure image size is correct before returning the new image. //diff --git a/BaseTools/Source/C/GenFw/ElfConvert.h b/BaseTools/Source/C/GenFw/ElfConvert.h index 801e8de4a2..7920765fbb 100644 --- a/BaseTools/Source/C/GenFw/ElfConvert.h +++ b/BaseTools/Source/C/GenFw/ElfConvert.h @@ -24,6 +24,7 @@ extern UINT8 *mCoffFile; extern UINT32 mTableOffset; extern UINT32 mOutImageType; extern UINT32 mFileBufferSize;+extern BOOLEAN mExportFlag; // // Common EFI specific data.@@ -31,6 +32,42 @@ extern UINT32 mFileBufferSize; #define ELF_HII_SECTION_NAME ".hii" #define ELF_STRTAB_SECTION_NAME ".strtab" #define MAX_COFF_ALIGNMENT 0x10000+#define ELF_SYMBOL_SECTION_NAME ".symtab"++//+// Platform Runtime Mechanism (PRM) specific data.+//+#define PRM_MODULE_EXPORT_SYMBOL_NUM 10+#define PRM_HANDLER_NAME_MAXIMUM_LENGTH 128++#define PRM_MODULE_EXPORT_DESCRIPTOR_NAME "PrmModuleExportDescriptor"+#define PRM_MODULE_EXPORT_DESCRIPTOR_SIGNATURE SIGNATURE_64 ('P', 'R', 'M', '_', 'M', 'E', 'D', 'T')+#define PRM_MODULE_EXPORT_REVISION 0x0++//+// Platform Runtime Mechanism (PRM) Export Descriptor Structures+//+#pragma pack(push, 1)++typedef struct {+ EFI_GUID PrmHandlerGuid;+ CHAR8 PrmHandlerName[PRM_HANDLER_NAME_MAXIMUM_LENGTH];+} PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT;++typedef struct {+ UINT64 Signature;+ UINT16 Revision;+ UINT16 NumberPrmHandlers;+ EFI_GUID PlatformGuid;+ EFI_GUID ModuleGuid;+} PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER;++typedef struct {+ PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER Header;+ PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT PrmHandlerExportDescriptors[1];+} PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT;++#pragma pack(pop) // // Filter Types@@ -38,7 +75,8 @@ extern UINT32 mFileBufferSize; typedef enum { SECTION_TEXT, SECTION_HII,- SECTION_DATA+ SECTION_DATA,+ SECTION_SYMBOL } SECTION_FILTER_TYPES; @@ -50,6 +88,8 @@ typedef struct { BOOLEAN (*WriteSections) (SECTION_FILTER_TYPES FilterType); VOID (*WriteRelocations) (); VOID (*WriteDebug) ();+ VOID (*ScanSymbol) ();+ VOID (*WriteExport) (); VOID (*SetImageSize) (); VOID (*CleanUp) (); diff --git a/BaseTools/Source/C/GenFw/GenFw.c b/BaseTools/Source/C/GenFw/GenFw.c index 8cab70ba4d..c7de5b89d8 100644 --- a/BaseTools/Source/C/GenFw/GenFw.c +++ b/BaseTools/Source/C/GenFw/GenFw.c @@ -87,7 +87,7 @@ UINT32 mImageTimeStamp = 0; UINT32 mImageSize = 0; UINT32 mOutImageType = FW_DUMMY_IMAGE; BOOLEAN mIsConvertXip = FALSE;-+BOOLEAN mExportFlag = FALSE; STATIC EFI_STATUS@@ -1436,6 +1436,15 @@ Returns: continue; } + if (stricmp (argv[0], "--PRM") == 0) {+ if (!mExportFlag) {+ mExportFlag = TRUE;+ }+ argc --;+ argv ++;+ continue;+ }+ if (argv[0][0] == '-') { Error (NULL, 0, 1000, "Unknown option", argv[0]); goto Finish;diff --git a/BaseTools/Source/C/Include/IndustryStandard/PeImage.h b/BaseTools/Source/C/Include/IndustryStandard/PeImage.h index f17b8ee19b..21c968e650 100644 --- a/BaseTools/Source/C/Include/IndustryStandard/PeImage.h +++ b/BaseTools/Source/C/Include/IndustryStandard/PeImage.h @@ -571,6 +571,13 @@ typedef struct { UINT32 AddressOfNameOrdinals; } EFI_IMAGE_EXPORT_DIRECTORY; +//+// Based export types.+//+#define EFI_IMAGE_EXPORT_ORDINAL_BASE 1+#define EFI_IMAGE_EXPORT_ADDR_SIZE 4+#define EFI_IMAGE_EXPORT_ORDINAL_SIZE 2+ /// /// DLL support. /// Import Format-- 2.26.2.windows.1
|
|
回复: [edk2-devel] [PATCH] MdeModulePkg/HiiDatabaseDxe: Add Support for authenticated variable
gaoliming
Dandan:
I will review this patch today. Please wait one day for me. Thanks Liming -----邮件原件-----found. *)((UINT8
|
|
[PATCH] MdeModulePkg: Enabling OS boot from SD card through UEFI payload
Aiman Rosli
This changes is by adding 50ms delay during voltage swithcing from 3.3V to 1.8V,
plus adding a while loop for 3.3V checking and retrying. Signed-off-by: Aiman Rosli <muhammad.aiman.rosli@...> --- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c | 273 ++++++++++-------- 1 file changed, 146 insertions(+), 127 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c index 662f9f483c..e91251d457 100644 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c @@ -1213,167 +1213,186 @@ SdCardIdentification ( UINT32 PresentState; UINT8 HostCtrl2; UINTN Retry; + BOOLEAN Force3p3v; + + Force3p3v = FALSE; PciIo = Private->PciIo; PassThru = &Private->PassThru; - // - // 1. Send Cmd0 to the device - // - Status = SdCardReset (PassThru, Slot); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_INFO, "SdCardIdentification: Executing Cmd0 fails with %r\n", Status)); - return Status; - } - - // - // 2. Send Cmd8 to the device - // - Status = SdCardVoltageCheck (PassThru, Slot, 0x1, 0xFF); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_INFO, "SdCardIdentification: Executing Cmd8 fails with %r\n", Status)); - return Status; - } - - // - // 3. Send SDIO Cmd5 to the device to the SDIO device OCR register. - // - Status = SdioSendOpCond (PassThru, Slot, 0, FALSE); - if (!EFI_ERROR (Status)) { - DEBUG ((DEBUG_INFO, "SdCardIdentification: Found SDIO device, ignore it as we don't support\n")); - return EFI_DEVICE_ERROR; - } - // - // 4. Send Acmd41 with voltage window 0 to the device - // - Status = SdCardSendOpCond (PassThru, Slot, 0, 0, FALSE, FALSE, FALSE, &Ocr); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_INFO, "SdCardIdentification: Executing SdCardSendOpCond fails with %r\n", Status)); - return EFI_DEVICE_ERROR; - } - - if (Private->Capability[Slot].Voltage33 != 0) { + do { // - // Support 3.3V + // 1. Send Cmd0 to the device // - MaxCurrent = ((UINT32)Private->MaxCurrent[Slot] & 0xFF) * 4; - } else if (Private->Capability[Slot].Voltage30 != 0) { + Status = SdCardReset (PassThru, Slot); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "SdCardIdentification: Executing Cmd0 fails with %r\n", Status)); + return Status; + } + // - // Support 3.0V + // 2. Send Cmd8 to the device // - MaxCurrent = (((UINT32)Private->MaxCurrent[Slot] >> 8) & 0xFF) * 4; - } else if (Private->Capability[Slot].Voltage18 != 0) { + Status = SdCardVoltageCheck (PassThru, Slot, 0x1, 0xFF); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "SdCardIdentification: Executing Cmd8 fails with %r\n", Status)); + return Status; + } + // - // Support 1.8V + // 3. Send SDIO Cmd5 to the device to the SDIO device OCR register. // - MaxCurrent = (((UINT32)Private->MaxCurrent[Slot] >> 16) & 0xFF) * 4; - } else { - ASSERT (FALSE); - return EFI_DEVICE_ERROR; - } - - if (MaxCurrent >= 150) { - Xpc = TRUE; - } else { - Xpc = FALSE; - } - - Status = SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_CTRL_VER, TRUE, sizeof (ControllerVer), &ControllerVer); - if (EFI_ERROR (Status)) { - return Status; - } - - if (((ControllerVer & 0xFF) >= SD_MMC_HC_CTRL_VER_300) && - ((ControllerVer & 0xFF) <= SD_MMC_HC_CTRL_VER_420)) - { - S18r = TRUE; - } else if (((ControllerVer & 0xFF) == SD_MMC_HC_CTRL_VER_100) || ((ControllerVer & 0xFF) == SD_MMC_HC_CTRL_VER_200)) { - S18r = FALSE; - } else { - ASSERT (FALSE); - return EFI_UNSUPPORTED; - } + Status = SdioSendOpCond (PassThru, Slot, 0, FALSE); + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "SdCardIdentification: Found SDIO device, ignore it as we don't support\n")); + return EFI_DEVICE_ERROR; + } - // - // 5. Repeatly send Acmd41 with supply voltage window to the device. - // Note here we only support the cards complied with SD physical - // layer simplified spec version 2.0 and version 3.0 and above. - // - Ocr = 0; - Retry = 0; - do { - Status = SdCardSendOpCond (PassThru, Slot, 0, Ocr, S18r, Xpc, TRUE, &Ocr); + // + // 4. Send Acmd41 with voltage window 0 to the device + // + Status = SdCardSendOpCond (PassThru, Slot, 0, 0, FALSE, FALSE, FALSE, &Ocr); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "SdCardIdentification: SdCardSendOpCond fails with %r Ocr %x, S18r %x, Xpc %x\n", Status, Ocr, S18r, Xpc)); + DEBUG ((DEBUG_INFO, "SdCardIdentification: Executing SdCardSendOpCond fails with %r\n", Status)); return EFI_DEVICE_ERROR; } - if (Retry++ == 100) { - DEBUG ((DEBUG_ERROR, "SdCardIdentification: SdCardSendOpCond fails too many times\n")); + if (Private->Capability[Slot].Voltage33 != 0) { + // + // Support 3.3V + // + MaxCurrent = ((UINT32)Private->MaxCurrent[Slot] & 0xFF) * 4; + } else if (Private->Capability[Slot].Voltage30 != 0) { + // + // Support 3.0V + // + MaxCurrent = (((UINT32)Private->MaxCurrent[Slot] >> 8) & 0xFF) * 4; + } else if (Private->Capability[Slot].Voltage18 != 0) { + // + // Support 1.8V + // + MaxCurrent = (((UINT32)Private->MaxCurrent[Slot] >> 16) & 0xFF) * 4; + } else { + ASSERT (FALSE); return EFI_DEVICE_ERROR; } - gBS->Stall (10 * 1000); - } while ((Ocr & BIT31) == 0); + if (MaxCurrent >= 150) { + Xpc = TRUE; + } else { + Xpc = FALSE; + } - // - // 6. If the S18A bit is set and the Host Controller supports 1.8V signaling - // (One of support bits is set to 1: SDR50, SDR104 or DDR50 in the - // Capabilities register), switch its voltage to 1.8V. - // - if (((Private->Capability[Slot].Sdr50 != 0) || - (Private->Capability[Slot].Sdr104 != 0) || - (Private->Capability[Slot].Ddr50 != 0)) && - ((Ocr & BIT24) != 0)) - { - Status = SdCardVoltageSwitch (PassThru, Slot); + Status = SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_CTRL_VER, TRUE, sizeof (ControllerVer), &ControllerVer); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "SdCardIdentification: Executing SdCardVoltageSwitch fails with %r\n", Status)); - Status = EFI_DEVICE_ERROR; - goto Error; + return Status; + } + + if (((ControllerVer & 0xFF) >= SD_MMC_HC_CTRL_VER_300) && + ((ControllerVer & 0xFF) <= SD_MMC_HC_CTRL_VER_420)) + { + S18r = TRUE; + } else if (((ControllerVer & 0xFF) == SD_MMC_HC_CTRL_VER_100) || ((ControllerVer & 0xFF) == SD_MMC_HC_CTRL_VER_200)) { + S18r = FALSE; } else { - Status = SdMmcHcStopClock (PciIo, Slot); + ASSERT (FALSE); + return EFI_UNSUPPORTED; + } + + // + // 1.8V had failed in the previous run, forcing a retry with 3.3V instead + // + if (Force3p3v == TRUE) { + S18r = FALSE; + Force3p3v = FALSE; + } + + // + // 5. Repeatly send Acmd41 with supply voltage window to the device. + // Note here we only support the cards complied with SD physical + // layer simplified spec version 2.0 and version 3.0 and above. + // + Ocr = 0; + Retry = 0; + do { + Status = SdCardSendOpCond (PassThru, Slot, 0, Ocr, S18r, Xpc, TRUE, &Ocr); if (EFI_ERROR (Status)) { - Status = EFI_DEVICE_ERROR; - goto Error; + DEBUG ((DEBUG_ERROR, "SdCardIdentification: SdCardSendOpCond fails with %r Ocr %x, S18r %x, Xpc %x\n", Status, Ocr, S18r, Xpc)); + return EFI_DEVICE_ERROR; } - SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_PRESENT_STATE, TRUE, sizeof (PresentState), &PresentState); - if (((PresentState >> 20) & 0xF) != 0) { - DEBUG ((DEBUG_ERROR, "SdCardIdentification: SwitchVoltage fails with PresentState = 0x%x\n", PresentState)); - Status = EFI_DEVICE_ERROR; - goto Error; + if (Retry++ == 100) { + DEBUG ((DEBUG_ERROR, "SdCardIdentification: SdCardSendOpCond fails too many times\n")); + return EFI_DEVICE_ERROR; } - HostCtrl2 = BIT3; - SdMmcHcOrMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, sizeof (HostCtrl2), &HostCtrl2); - - gBS->Stall (5000); + gBS->Stall (10 * 1000); + } while ((Ocr & BIT31) == 0); - SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, TRUE, sizeof (HostCtrl2), &HostCtrl2); - if ((HostCtrl2 & BIT3) == 0) { - DEBUG ((DEBUG_ERROR, "SdCardIdentification: SwitchVoltage fails with HostCtrl2 = 0x%x\n", HostCtrl2)); + // + // 6. If the S18A bit is set and the Host Controller supports 1.8V signaling + // (One of support bits is set to 1: SDR50, SDR104 or DDR50 in the + // Capabilities register), switch its voltage to 1.8V. + // + if (((Private->Capability[Slot].Sdr50 != 0) || + (Private->Capability[Slot].Sdr104 != 0) || + (Private->Capability[Slot].Ddr50 != 0)) && + ((Ocr & BIT24) != 0)) + { + Status = SdCardVoltageSwitch (PassThru, Slot); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "SdCardIdentification: Executing SdCardVoltageSwitch fails with %r\n", Status)); Status = EFI_DEVICE_ERROR; goto Error; - } + } else { + Status = SdMmcHcStopClock (PciIo, Slot); + if (EFI_ERROR (Status)) { + Status = EFI_DEVICE_ERROR; + goto Error; + } - Status = SdMmcHcStartSdClock (PciIo, Slot); - if (EFI_ERROR (Status)) { - goto Error; - } + SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_PRESENT_STATE, TRUE, sizeof (PresentState), &PresentState); + if (((PresentState >> 20) & 0xF) != 0) { + DEBUG ((DEBUG_ERROR, "SdCardIdentification: SwitchVoltage fails with PresentState = 0x%x\n", PresentState)); + Status = EFI_DEVICE_ERROR; + goto Error; + } - gBS->Stall (1000); + HostCtrl2 = BIT3; + SdMmcHcOrMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, sizeof (HostCtrl2), &HostCtrl2); - SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_PRESENT_STATE, TRUE, sizeof (PresentState), &PresentState); - if (((PresentState >> 20) & 0xF) != 0xF) { - DEBUG ((DEBUG_ERROR, "SdCardIdentification: SwitchVoltage fails with PresentState = 0x%x, It should be 0xF\n", PresentState)); - Status = EFI_DEVICE_ERROR; - goto Error; + gBS->Stall (5000); + + SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, TRUE, sizeof (HostCtrl2), &HostCtrl2); + if ((HostCtrl2 & BIT3) == 0) { + DEBUG ((DEBUG_ERROR, "SdCardIdentification: SwitchVoltage fails with HostCtrl2 = 0x%x\n", HostCtrl2)); + Status = EFI_DEVICE_ERROR; + goto Error; + } + + Status = SdMmcHcStartSdClock (PciIo, Slot); + if (EFI_ERROR (Status)) { + goto Error; + } + + // Workaround to add a delay of 100ms in order for clock to stabilize before turning on the SD card again. + gBS->Stall (50000); + + gBS->Stall (1000); + + SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_PRESENT_STATE, TRUE, sizeof (PresentState), &PresentState); + if (((PresentState >> 20) & 0xF) != 0xF) { + DEBUG ((DEBUG_ERROR, "SdCardIdentification: SwitchVoltage fails with PresentState = 0x%x, It should be 0xF\n", PresentState)); + Status = SdMmcHcReset (Private, Slot); + Status = SdMmcHcInitHost (Private, Slot); + Force3p3v = TRUE; + DEBUG ((DEBUG_ERROR, "SdCardIdentification: Switching to 1.8V had failed in the previous run, forcing a retry with 3.3V instead\n")); + } } - } - DEBUG ((DEBUG_INFO, "SdCardIdentification: Switch to 1.8v signal voltage success\n")); - } + DEBUG ((DEBUG_INFO, "SdCardIdentification: Switch to 1.8v signal voltage success\n")); + } + } while (Force3p3v); Status = SdCardAllSendCid (PassThru, Slot); if (EFI_ERROR (Status)) { -- 2.34.1.windows.1
|
|
Re: [PATCH] MdeModulePkg/HiiDatabaseDxe: Add Support for authenticated variable
Dandan Bi
I will push this patch today if no other comment.
toggle quoted messageShow quoted text
Thanks, Dandan
-----Original Message-----
|
|
Re: [PATCH v2 6/6] BaseTools: Upgrade the version of NASM tool
Yuwei Chen
This patch looks good to me.
toggle quoted messageShow quoted text
Reviewed-by: Yuwei Chen<yuwei.chen@...>
-----Original Message-----
|
|
CdePkgBlog 2022-01-16 -- Introduction of the ACPICA port to UEFI
Kilian Kegel
Hi Andrew, hi Jordan, hi Maciej, hi all,
this task was suggested by @ajfish and @jljusten at tianocore / tianocore.github.io: https://github.com/tianocore/tianocore.github.io/wiki/Tasks#port-acpi-ca-to-a-shell-application.
All in all it could be solved within a really small amount of time, with a small amount of changes and extensions some months ago
My concept here was to choose the existing Microsoft VisualStudio package and adjust it to run in the UEFI environment, by reimplementing missing Win32-API functions (amount of 8). This could be done using the Microsoft-C-Library compatible toro-C-Library
Maybe that concept is also useable for porting “openSSH” to UEFI Shell: https://github.com/tianocore/tianocore.github.io/wiki/Tasks#port-openssh-as-a-shell-application
The toro-C-Library source code is included in the project. You can check what is inside, how it works internally and how I do believe a C-Library for UEFI Shell/SMM/DXE/PEI should be constructed that guarantees compatibility/portability+testability for POST drivers and UEFI/Windows Shell applications by design.
The “toro-C-Library” build engine is VisualStudio/msbuild.exe only. It takes 20 Seconds to get it done. The older “torito-C-Library” build engine is EDK2Build. It takes 120 seconds to get it done, for the same result, on the same build machine.
If you want to build the samples, please get the entire CdePkg from edk2-staging that also includes the blog, https://github.com/tianocore/edk2-staging/tree/CdePkg
If you just want to read the new blog:
Enjoy the breathtaking speed and elegance of VisualStudio
Have fun, Kilian
|
|
Event: TianoCore Design Meeting - APAC/NAMO - 01/21/2022
#cal-reminder
devel@edk2.groups.io Calendar <noreply@...>
Reminder: TianoCore Design Meeting - APAC/NAMO When: Where: Organizer: Ray Ni ray.ni@... Description: TOPIC
For more info, see here: https://www.tianocore.org/design-meeting/ Microsoft Teams meetingJoin on your computer or mobile appClick here to join the meeting Join with a video conferencing deviceteams@... Video Conference ID: 119 715 416 0
|
|
Re: [PATCH 08/10] OvmfPkg: Update Sec to support Tdvf Config-B
Min Xu
On January 14, 2022 4:32 PM, Gerd Hoffmann wrote:
Hi, Gerd, I think Jiewen has discussed this (PEI-less boot in Config-B) in another mail thread. We can continue the discussion there. Let's first focus on the PlatformInitLib here. Thanks for your understanding.I don't see that PEI-less boot is required for that. Sure, when Yes, Cloudhw support TDX too. Actually we have some PoC and plan to upstream it later.copy.4. But a basic version of PlatformInitLib is a good start.Yes. Having initially only the functions needed by config-b in BTW, cmos is needed in GetSystemMemorySizeBelow4gb which call CmosRead for 0x34/0x35. ThanksAnd PlatformInitLib willAt least not initially. Maybe later when we move more code to the lib to Min
|
|
Re: 回复: [edk2-devel] [PATCH] MdeModulePkg\CoreDxe: Allow DXE Drivers to use untested memory
Howell, Stacy <stacy.howell@...>
Hi Sean,
toggle quoted messageShow quoted text
Setting all memory as tested in PEI is a workaround for the issue that this patch addresses. However, promoting all memory in PEI is not a workable solution for BIOSes that incorporate full memory testing functionality, as this relies on the tested flag to determine which memory regions to test. This patch addresses a discrepancy in EDK2 core regarding how untested memory is treated for allocation by DXE drivers. In the case where a DXE driver does not request a specific memory region DXE Core will promote untested memory if necessary to provide memory to the driver. In the case where a DXE driver requests a specific memory range of untested memory, DXE Core will currently return an error instead of promoting untested memory to make the region available for the driver. Thanks, Stacy
-----Original Message-----
From: Kinney, Michael D <michael.d.kinney@...> Sent: Tuesday, January 11, 2022 10:57 AM To: devel@edk2.groups.io; spbrogan@...; Gao, Liming <gaoliming@...>; Howell, Stacy <stacy.howell@...>; Kinney, Michael D <michael.d.kinney@...> Cc: Bi, Dandan <dandan.bi@...> Subject: RE: 回复: [edk2-devel] [PATCH] MdeModulePkg\CoreDxe: Allow DXE Drivers to use untested memory Hi Sean, The auto promotion of memory was only intended as a dev/debug feature to maximize platform boot without having to tune what memory is tested in PEI phase. In my opinion, a production platform should never trigger any auto promotions of untested to tested memory, and part of production validation should make sure this event never occurs in any production boot scenarios. The specific bug being fix here is that auto promotion was not symmetric across all memory allocation types. It simply aligns this dev/debug feature. Mike -----Original Message-----
|
|
Re: [PATCH 01/79] ProcessorPkg/Include: Add header files of RISC-V processor package
Michael D Kinney
Hi Abner,
toggle quoted messageShow quoted text
We already have a package for common platform content in the edk2 repo. This is the MdeModulePkg. However, the number of common platform features added to the MdeModulePkg over time has made this a very large package, and this can be measured by how complex the Maintainer.txt rules are for this package. The revised approach is to create feature packages that platforms can add if their platform requires that specific feature category. Examples are NetworkPkg, SecurityPkg, FmpDevicePkg, FatPkg, RedfishPkg, SourceLevelDebugPkg. Instead of adding another generic package such as CommonPlatformPkg, I would prefer to see the libs/modules either added to existing packages that match the feature category, or create new feature packages if there is a new feature category. We also try to limit the edk2 repo to components that are directly related the UEFI/PI specifications and are not Si/Platform specific. Si/Platform specific features go into the edk2-platforms repo. An example of a generic feature in the edk2-platforms repo is Features/Ext4. The UEFI spec only specifies FAT for UEFI boot from file system. There are a number of other feature packages in edk2-platforms in the Features directory, so you should review those as well to see if there is natural landing zone for any of your components. Mike
-----Original Message-----
|
|
Re: [PATCH] UefiPayloadPkg: Not use BaseCpuTimerLib by default.
Ma, Maurice <maurice.ma@...>
Reviewed-by: Maurice Ma <maurice.ma@...>
toggle quoted messageShow quoted text
-----Original Message-----
|
|
Re: [PATCH 01/79] ProcessorPkg/Include: Add header files of RISC-V processor package
toggle quoted messageShow quoted text
-----Original Message-----How about Leif's suggestion? The CommonPlatformPkg on edk2? Abner
|
|