Re: [edk2-devel] [PATCH 3/3] PlatformHookLib: Set PcdSerialClockRate using HOB data

2024-04-03 Thread Sean Rhodes
PR created - https://github.com/tianocore/edk2/pull/5513

LGTM but I can't check it against UPL.

@Dong, Guo  Would you be able to take a look please'?

On Wed, 4 Oct 2023 at 21:02, MrChromebox  wrote:

> Fixes serial output on platforms using coreboot and a non-default
> clock rate such as AMD Picasso and newer Zen-based platforms.
>
> Signed-off-by: Matt DeVillier 
> Change-Id: I91290397852176754e9a34ec6e5829044f41d15a
> ---
>  UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c   | 5 +
>  UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf | 1 +
>  2 files changed, 6 insertions(+)
>
> diff --git a/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c
> b/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c
> index 60a17b8fc2..e3d47ac2fa 100644
> --- a/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c
> +++ b/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c
> @@ -90,6 +90,11 @@ PlatformHookSerialPortInitialize (
>return Status;
>  }
>
> +Status = PcdSet32S (PcdSerialClockRate, SerialPortInfo->ClockRate);
> +if (RETURN_ERROR (Status)) {
> +  return Status;
> +}
> +
>  return RETURN_SUCCESS;
>}
>
> diff --git a/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf
> b/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf
> index 7ac6bfa1b1..e2908cfbca 100644
> --- a/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf
> +++ b/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf
> @@ -38,3 +38,4 @@
>gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase## PRODUCES
>gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate## PRODUCES
>gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride  ## PRODUCES
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate   ## PRODUCES
> --
> 2.34.1
>
>
>
> 
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#109337): https://edk2.groups.io/g/devel/message/109337
> Mute This Topic: https://groups.io/mt/101763377/6718866
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [sean@starlabs.systems]
> 
>
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117355): https://edk2.groups.io/g/devel/message/117355
Mute This Topic: https://groups.io/mt/101763377/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] UefiPayloadPkg: CbParseLib: Fix integer overflow

2024-01-15 Thread Sean Rhodes
Reviewed-by: Sean Rhodes 

On Fri, 12 Jan 2024 at 11:43, Guo, Gua  wrote:

> Reviewed-by: Gua Guo 
> --
> *From:* Lean Sheng Tan 
> *Sent:* Friday, January 12, 2024 7:33:00 PM
> *To:* Rudolph, Patrick 
> *Cc:* devel@edk2.groups.io ; Rhodes, Sean
> ; Guo, Gua ; Lu, James <
> james...@intel.com>; Ni, Ray ; Dong, Guo <
> guo.d...@intel.com>
> *Subject:* Re: [PATCH] UefiPayloadPkg: CbParseLib: Fix integer overflow
>
> Hi Gua or Sean,
> Would you mind to help review this?
> Thanks!
>
> Best Regards,
> *Lean Sheng Tan*
>
>
>
> 9elements GmbH, Kortumstraße 19-21, 44787 Bochum, Germany
> Email: sheng@9elements.com
> Phone: *+49 234 68 94 188 <+492346894188>*
> Mobile: *+49 176 76 113842 <+4917676113842>*
>
> Registered office: Bochum
> Commercial register: Amtsgericht Bochum, HRB 17519
> Management: Sebastian German, Eray Bazaar
>
> Data protection information according to Art. 13 GDPR
> <https://9elements.com/privacy>
>
>
> On Mon, 8 Jan 2024 at 08:00, Patrick Rudolph <
> patrick.rudo...@9elements.com> wrote:
>
> The IMD entry uses the 32bit start field as relative offset
> to root. On Ia32X64 this works fine as UINTN is also 32 bit and
> negative relative offsets are properly calculated due to an
> integer overflow.
>
> On X64 this doesn't work as UINTN is 64 bit and the offset
> is no longer subtracted, but it's added to the root. Fix that
> by sign extending the start field to 64 bit.
>
> Test: Booting UefiPayloadPkg still works on Ia32X64 and now also
>   works on X64.
>
> Signed-off-by: Patrick Rudolph 
> ---
>  UefiPayloadPkg/Library/CbParseLib/CbParseLib.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
> b/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
> index 8a353f77f6..9e149532a7 100644
> --- a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
> +++ b/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
> @@ -282,7 +282,7 @@ FindCbMemTable (
>for (Idx = 0; Idx < Root->num_entries; Idx++) {
>  if (Entries[Idx].id == TableId) {
>if (IsImdEntry) {
> -*MemTable = (VOID *)((UINTN)Entries[Idx].start + (UINTN)Root);
> +*MemTable = (VOID *)((INTN)(INT32)Entries[Idx].start +
> (UINTN)Root);
>} else {
>  *MemTable = (VOID *)(UINTN)Entries[Idx].start;
>}
> --
> 2.43.0
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113812): https://edk2.groups.io/g/devel/message/113812
Mute This Topic: https://groups.io/mt/103593206/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel][PATCH v1 2/2] UefiPayloadPkg: Enable RNG support

2023-04-26 Thread Sean Rhodes
Reviewed-by: Sean Rhodes 

On Tue, 25 Apr 2023 at 18:09, Benjamin Doron 
wrote:

> From: Benjamin Doron 
>
> Uses CPU RDRAND support and installs the EfiRngProtocol.
> The protocol may be used by iPXE or the Linux kernel to gather entropy.
>
> Cc: Guo Dong 
> Cc: Ray Ni 
> Cc: Sean Rhodes 
> Cc: James Lu 
> Cc: Gua Guo 
> Signed-off-by: Benjamin Doron 
> ---
>  UefiPayloadPkg/UefiPayloadPkg.dsc | 3 +++
>  UefiPayloadPkg/UefiPayloadPkg.fdf | 3 +++
>  2 files changed, 6 insertions(+)
>
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc
> b/UefiPayloadPkg/UefiPayloadPkg.dsc
> index 1e803ba01567..486af2396731 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.dsc
> +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
> @@ -634,6 +634,9 @@
>MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
>  !endif
>UefiCpuPkg/CpuDxe/CpuDxe.inf
> +!if $(CPU_RNG_ENABLE) == TRUE
> +  SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf
> +!endif
>MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
>  !if $(BOOTSPLASH_IMAGE)
>MdeModulePkg/Logo/LogoDxe.inf
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf
> b/UefiPayloadPkg/UefiPayloadPkg.fdf
> index f8c2aa8c4a02..53add65a6a40 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.fdf
> +++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
> @@ -157,6 +157,9 @@ INF CryptoPkg/Driver/CryptoDxe.inf
>  INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
>  !endif
>  INF UefiCpuPkg/CpuDxe/CpuDxe.inf
> +!if $(CPU_RNG_ENABLE) == TRUE
> +INF SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf
> +!endif
>
>  INF RuleOverride = UI MdeModulePkg/Application/UiApp/UiApp.inf
>  INF MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf
> --
> 2.39.2
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103646): https://edk2.groups.io/g/devel/message/103646
Mute This Topic: https://groups.io/mt/98497422/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel][PATCH v1 1/2] UefiPayloadPkg: Define RngLibTimerLib for systems without RDRAND

2023-04-26 Thread Sean Rhodes
Reviewed-by: Sean Rhodes 

On Tue, 25 Apr 2023 at 18:09, Benjamin Doron 
wrote:

> From: Benjamin Doron 
>
> Presently, `ArchIsRngSupported()` always returns TRUE, per
>
> https://github.com/tianocore/edk2/blob/1eeca0750af5af2f0e78437bf791ac2de74bde74/MdePkg/Library/BaseRngLib/Rand/RdRand.c#L124-L125
> .
> Therefore, `BaseRngLibConstructor()` should continue to assert RDRAND
> support.
>
> However, older platforms do not support RDRAND, such as QEMU in some
> configurations. Therefore, define an RngLib library class for such
> systems, using a new flag. Maintain current behaviour by default.
>
> Note that this is less secure behaviour, and should be avoided in
> production.
>
> Cc: Guo Dong 
> Cc: Ray Ni 
> Cc: Sean Rhodes 
> Cc: James Lu 
> Cc: Gua Guo 
> Signed-off-by: Benjamin Doron 
> ---
>  UefiPayloadPkg/UefiPayloadPkg.dsc | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc
> b/UefiPayloadPkg/UefiPayloadPkg.dsc
> index 9847f189fff5..1e803ba01567 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.dsc
> +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
> @@ -130,6 +130,7 @@
># This is how BaseCpuTimerLib works, and a recommended way to get
> Frequence, so set the default value as TRUE.
># Note: for emulation platform such as QEMU, this may not work and
> should set it as FALSE
>DEFINE CPU_TIMER_LIB_ENABLE  = TRUE
> +  DEFINE CPU_RNG_ENABLE= TRUE
>
>DEFINE MULTIPLE_DEBUG_PORT_SUPPORT = FALSE
>
> @@ -204,7 +205,11 @@
>  !endif
>IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
>OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
> +!if $(CPU_RNG_ENABLE) == TRUE
>RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf
> +!else
> +  RngLib|MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
> +!endif
>HobLib|UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.inf
>
>#
> --
> 2.39.2
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103645): https://edk2.groups.io/g/devel/message/103645
Mute This Topic: https://groups.io/mt/98497421/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel][PATCH v1 2/2] UefiPayloadPkg: Update default memory type information for S4

2023-04-03 Thread Sean Rhodes
PR created at https://github.com/tianocore/edk2/pull/4231

On Mon, 3 Apr 2023 at 08:32, Sean Rhodes  wrote:

> Reviewed-by: Sean Rhodes 
>
> On Sat, 1 Apr 2023 at 00:58, Benjamin Doron 
> wrote:
>
>> Copied values from OVMF, these are sufficient for a debug build.
>>
>> Now that those are improved, remove
>> PcdResetOnMemoryTypeInformationChange override. If the memory map must
>> change, reset system so that an S4 resume will succeed.
>>
>> Requires testing a hibernate resume to OS.
>>
>> Cc: Guo Dong 
>> Cc: Ray Ni 
>> Cc: Sean Rhodes 
>> Cc: James Lu 
>> Cc: Gua Guo 
>> Signed-off-by: Benjamin Doron 
>> ---
>>  UefiPayloadPkg/UefiPayloadPkg.dec | 6 +++---
>>  UefiPayloadPkg/UefiPayloadPkg.dsc | 1 -
>>  2 files changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/UefiPayloadPkg/UefiPayloadPkg.dec
>> b/UefiPayloadPkg/UefiPayloadPkg.dec
>> index 2ed73513700d..a5004a2b616e 100644
>> --- a/UefiPayloadPkg/UefiPayloadPkg.dec
>> +++ b/UefiPayloadPkg/UefiPayloadPkg.dec
>> @@ -71,11 +71,11 @@
>> gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter|0|UINT64|0x1004
>>  gUefiPayloadPkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C,
>> 0x3E, 0x9E, 0x1c, 0x4f, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1
>> }|VOID*|0x1005
>>
>>  ## Used to help reduce fragmentation in the EFI memory map
>>
>> -gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0x08|UINT32|0x1012
>>
>> +gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0x12|UINT32|0x1012
>>
>>  
>> gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0x04|UINT32|0x1013
>>
>>  
>> gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0x04|UINT32|0x0014
>>
>> -gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|0xC0|UINT32|0x0015
>>
>> -gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|0x80|UINT32|0x0016
>>
>> +gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|0x100|UINT32|0x0015
>>
>> +gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|0x100|UINT32|0x0016
>>
>>  # Size of the region used by UEFI in permanent memory
>>
>>  
>> gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x0400|UINT32|0x0017
>> diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc
>> b/UefiPayloadPkg/UefiPayloadPkg.dsc
>> index 9847f189fff5..ba6cc7e1a4d8 100644
>> --- a/UefiPayloadPkg/UefiPayloadPkg.dsc
>> +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
>> @@ -539,7 +539,6 @@
>>  !else
>>gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|FALSE
>>  !endif
>> -
>> gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
>>gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
>>gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
>>gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
>> --
>> 2.39.1
>>
>>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102375): https://edk2.groups.io/g/devel/message/102375
Mute This Topic: https://groups.io/mt/97985492/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel][PATCH v1 2/2] UefiPayloadPkg: Update default memory type information for S4

2023-04-03 Thread Sean Rhodes
Reviewed-by: Sean Rhodes 

On Sat, 1 Apr 2023 at 00:58, Benjamin Doron 
wrote:

> Copied values from OVMF, these are sufficient for a debug build.
>
> Now that those are improved, remove
> PcdResetOnMemoryTypeInformationChange override. If the memory map must
> change, reset system so that an S4 resume will succeed.
>
> Requires testing a hibernate resume to OS.
>
> Cc: Guo Dong 
> Cc: Ray Ni 
> Cc: Sean Rhodes 
> Cc: James Lu 
> Cc: Gua Guo 
> Signed-off-by: Benjamin Doron 
> ---
>  UefiPayloadPkg/UefiPayloadPkg.dec | 6 +++---
>  UefiPayloadPkg/UefiPayloadPkg.dsc | 1 -
>  2 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.dec
> b/UefiPayloadPkg/UefiPayloadPkg.dec
> index 2ed73513700d..a5004a2b616e 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.dec
> +++ b/UefiPayloadPkg/UefiPayloadPkg.dec
> @@ -71,11 +71,11 @@
> gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter|0|UINT64|0x1004
>  gUefiPayloadPkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C,
> 0x3E, 0x9E, 0x1c, 0x4f, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1
> }|VOID*|0x1005
>
>  ## Used to help reduce fragmentation in the EFI memory map
>
> -gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0x08|UINT32|0x1012
>
> +gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0x12|UINT32|0x1012
>
>  
> gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0x04|UINT32|0x1013
>
>  
> gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0x04|UINT32|0x0014
>
> -gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|0xC0|UINT32|0x0015
>
> -gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|0x80|UINT32|0x0016
>
> +gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|0x100|UINT32|0x0015
>
> +gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|0x100|UINT32|0x0016
>
>  # Size of the region used by UEFI in permanent memory
>
>  
> gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x0400|UINT32|0x0017
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc
> b/UefiPayloadPkg/UefiPayloadPkg.dsc
> index 9847f189fff5..ba6cc7e1a4d8 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.dsc
> +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
> @@ -539,7 +539,6 @@
>  !else
>gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|FALSE
>  !endif
> -
> gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
>gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
>gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
>gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
> --
> 2.39.1
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102374): https://edk2.groups.io/g/devel/message/102374
Mute This Topic: https://groups.io/mt/97985492/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel][PATCH v1 1/2] UefiPayloadPkg: Always build MemoryTypeInformation HOB for DXE GCD

2023-04-03 Thread Sean Rhodes
Reviewed-by: Sean Rhodes 

On Sat, 1 Apr 2023 at 00:58, Benjamin Doron 
wrote:

> MemoryType information assists GCD with defragmenting the memory map.
> When the DXE core starts, GCD adds memory descriptors for the resource
> descriptors HOBs. This allocates heap space which can be reused later
> as the bins by memory type. It seems memory allocation prefers low
> ranges.
>
> It seems "below 4G" is an artifact of this heap reuse. However, the
> memory type information determines the DXE core's
> `MinimalMemorySizeNeeded`, determining which system memory descriptor
> HOB may be used by DXE. Furthermore, it's important that the memory
> type information be correct, for an S4 memory map.
>
> Therefore, follow other bootloaders, such as [MinPlatform][1], and do
> this unconditionally. As of [edk2-stable202011][2], it was.
>
> [1]:
> https://github.com/tianocore/edk2-platforms/blob/b6f96743891be51541184bf61dd2970c008e2c43/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c#L164-L201
> [2]:
> https://github.com/tianocore/edk2/blob/edk2-stable202011/UefiPayloadPkg/BlSupportPei/BlSupportPei.c#L462-L466
>
> Cc: Guo Dong 
> Cc: Ray Ni 
> Cc: Sean Rhodes 
> Cc: James Lu 
> Cc: Gua Guo 
> Signed-off-by: Benjamin Doron 
> ---
>  .../UefiPayloadEntry/UefiPayloadEntry.c   | 36 +--
>  .../UefiPayloadEntry/UefiPayloadEntry.inf |  2 --
>  UefiPayloadPkg/UefiPayloadPkg.dec |  3 --
>  UefiPayloadPkg/UefiPayloadPkg.dsc |  2 --
>  4 files changed, 8 insertions(+), 35 deletions(-)
>
> diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
> b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
> index 780348eadfa8..030a5baed914 100644
> --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
> +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
> @@ -19,30 +19,6 @@ EFI_MEMORY_TYPE_INFORMATION
> mDefaultMemoryTypeInformation[] = {
>{ EfiMaxMemoryType,   0
>}
>  };
>
> -/**
> -   Function to reserve memory below 4GB for EDKII Modules.
> -
> -   This causes the DXE to dispatch everything under 4GB and allows
> Operating
> -   System's that require EFI_LOADED_IMAGE to be under 4GB to start.
> -   e.g. Xen hypervisor used in Qubes.
> -**/
> -VOID
> -ForceModulesBelow4G (
> -  VOID
> -  )
> -{
> -  DEBUG ((DEBUG_INFO, "Building hob to restrict memory resorces to below
> 4G.\n"));
> -
> -  //
> -  // Create Memory Type Information HOB
> -  //
> -  BuildGuidDataHob (
> -,
> -mDefaultMemoryTypeInformation,
> -sizeof (mDefaultMemoryTypeInformation)
> -);
> -}
> -
>  /**
> Callback function to build resource descriptor HOB
>
> @@ -472,10 +448,14 @@ _ModuleEntryPoint (
>// Build other HOBs required by DXE
>BuildGenericHob ();
>
> -  // Create a HOB to make resources for EDKII modules below 4G
> -  if (!FixedPcdGetBool (PcdDispatchModuleAbove4GMemory)) {
> -ForceModulesBelow4G ();
> -  }
> +  //
> +  // Create Memory Type Information HOB
> +  //
> +  BuildGuidDataHob (
> +,
> +mDefaultMemoryTypeInformation,
> +sizeof (mDefaultMemoryTypeInformation)
> +);
>
>// Load the DXE Core
>Status = LoadDxeCore ();
> diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
> b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
> index d47e8e76cf4c..e2af8a4b7c1b 100644
> --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
> +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
> @@ -96,5 +96,3 @@
>gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy ##
> SOMETIMES_CONSUMES
>gEfiMdeModulePkgTokenSpaceGuid.PcdImageProtectionPolicy   ##
> SOMETIMES_CONSUMES
>
> -  gUefiPayloadPkgTokenSpaceGuid.PcdDispatchModuleAbove4GMemory
> -
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.dec
> b/UefiPayloadPkg/UefiPayloadPkg.dec
> index 7d61d6eeae6c..2ed73513700d 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.dec
> +++ b/UefiPayloadPkg/UefiPayloadPkg.dec
> @@ -82,9 +82,6 @@
> gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x0400|UINT32|0x
>
>  gUefiPayloadPkgTokenSpaceGuid.PcdPcdDriverFile|{ 0x57, 0x72, 0xcf, 0x80,
> 0xab, 0x87, 0xf9, 0x47, 0xa3, 0xfe, 0xD5, 0x0B, 0x76, 0xd8, 0x95, 0x41
> }|VOID*|0x0018
>
> -# Above 4G Memory
>
> -gUefiPayloadPkgTokenSpaceGuid.PcdDispatchModuleAbove4GMemory|TRUE|BOOLEAN|0x0019
> -
>  # Boot Manager Key
>
>  gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|FALSE|BOOLEAN|0x0020
>
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc
> b/UefiPayloadPkg/UefiPayloadPkg.dsc
> index bca5d3f335bc..9847f189fff5 10064

Re: [edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the position of the Logo

2023-03-20 Thread Sean Rhodes
Hi Ray

Some members of the coreboot community want to centre the logo (as it is
currently) and some want to use the Microsoft recommended position. All we
want to do is have the option to build edk2 with one or the other.

Thanks

Sean

On Mon, 20 Mar 2023 at 09:56, Ni, Ray  wrote:

> Sheng Lean Tan,
>
>
>
> In short, I am looking forward to be convinced by you and Sean, but so far
> I haven’t been.
>
>
>
>1. In the beginning, I left comments to suggest you use the logic
>below to meet your requirement.
>Status = gBS->HandleProtocol (gST->ConsoleOutHandle,
>, (VOID **) );
>
> if (!EFI_ERROR (Status)) {
>   //
>   // Center of LOGO is in the vertical position 38.2% when
> PcdBootLogoOnlyEnable is TRUE
>   // Y = (VerticalResolution - LogoHeight) / 2
>   // Y' = VerticalResolution * 0.382 - LogoHeight * 0.5
>   // OffsetY + Y = Y'
>   // OffsetY = Y' - Y = -0.118 * VerticalResolution
>   //
>   *Attribute = EdkiiPlatformLogoDisplayAttributeCenter;
>   *OffsetX   = 0;
>   *OffsetY   = -118 * (INTN)
> GraphicsOutput->Mode->Info->VerticalResolution / 1000;
> }
>
>
>
>1. Then, Sean replied following: “Thank you, it does, and I think it
>will work for most splash images. However, the way it's written in my patch
>accounts for the Image size. This will handle splash images that are equal
>to, or larger than the resolution of the display. “
>
>
>
>1. Then, I replied “The logic I shared below is from the LogoDxe
>driver which produces EDKII_PLATFORM_LOGO_PROTOCOL. This driver should know
>the image size and it can account for the image size.”
>
> Then, I don’t think we are talking in the same page. Maybe I didn’t
> understand your problem, maybe you didn’t understand my above sample code.
>
> Thanks,
>
> Ray
>
>
>
>
>
>
>
> *From:* Sheng Lean Tan 
> *Sent:* Monday, March 20, 2023 4:12 PM
> *To:* devel@edk2.groups.io; Ni, Ray ; Kinney, Michael D
> 
> *Cc:* Rhodes, Sean ; Gao, Zhichao <
> zhichao@intel.com>; Wang, Jian J ; Gao, Liming
> 
> *Subject:* Re: [edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to
> control the position of the Logo
>
>
>
> Hi Ray,
>
> Any feedback per Mic feedback?
>
> Sent from my iPhone
>
>
> On 15. Mar 2023, at 16:35, Michael D Kinney 
> wrote:
>
> 
>
> HI Ray,
>
>
>
> I think it is a reasonable request to have the EDK II logo driver support
> multiple standards for the logo location.  Especially if they are
> documented in public specifications.
>
>
>
> The additional conditions of supporting a logo larger than the display
> resolution also looks like a good corner case to cover no matter what logo
> location standard is used.
>
>
>
> Perhaps a single PCD that is a enum of logo locations.  Default 0x00 can
> be EDK II default that is centered in the display.  0x01 can be BGRT.
> Leaves from for more if there are additional public standard logo locations.
>
>
>
> Mike
>
>
>
>
>
> *From:* Ni, Ray 
> *Sent:* Wednesday, March 15, 2023 2:24 AM
> *To:* devel@edk2.groups.io; Rhodes, Sean 
> *Cc:* Kinney, Michael D ; Gao, Zhichao <
> zhichao@intel.com>; Wang, Jian J ; Gao, Liming
> 
> *Subject:* RE: [edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to
> control the position of the Logo
>
>
>
> What’s the meaning of “have both options”?
>
> If you want to support two cases, put the logic in your platform specific
> Logo driver.
>
> This Logo driver is just for reference.
>
>
>
> *From:* devel@edk2.groups.io  *On Behalf Of *Sean
> Rhodes
> *Sent:* Friday, March 10, 2023 9:43 PM
> *To:* Ni, Ray 
> *Cc:* devel@edk2.groups.io; Kinney, Michael D ;
> Gao, Zhichao ; Wang, Jian J ;
> Gao, Liming 
> *Subject:* Re: [edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to
> control the position of the Logo
>
>
>
> Hi Ray
>
>
>
> > You can return a carefully-calculated X/Y value to make
> the logo at MS preferred position.
>
> As we discussed before, we need to have both options.
>
>
>
> Thanks
>
>
>
> Sean
>
>
>
> On Wed, 8 Mar 2023 at 09:01, Ni, Ray  wrote:
>
> Maybe I didn’t explain my idea clearly.
>
> That is:
>
> You can get the screen resolution in the code that
> produces Logo protocol.
>
> You can return a carefully-calculated X/Y value to make
> the logo at MS preferred position.
>
>
>
> *From:* devel@edk2.groups.io  *On Behalf Of *Ni, Ray
> *Sent:* Wednesday, October 26, 2022 10:32 AM
> *To:* Kinne

Re: [edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the position of the Logo

2023-03-10 Thread Sean Rhodes
Hi Ray

> You can return a carefully-calculated X/Y value to make
the logo at MS preferred position.

As we discussed before, we need to have both options.

Thanks

Sean

On Wed, 8 Mar 2023 at 09:01, Ni, Ray  wrote:

> Maybe I didn’t explain my idea clearly.
>
> That is:
>
> You can get the screen resolution in the code that
> produces Logo protocol.
>
> You can return a carefully-calculated X/Y value to make
> the logo at MS preferred position.
>
>
>
> *From:* devel@edk2.groups.io  * On Behalf Of *Ni,
> Ray
> *Sent:* Wednesday, October 26, 2022 10:32 AM
> *To:* Kinney, Michael D ; devel@edk2.groups.io;
> Rhodes, Sean 
> *Cc:* Gao, Zhichao ; Wang, Jian J <
> jian.j.w...@intel.com>; Gao, Liming 
> *Subject:* Re: [edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to
> control the position of the Logo
>
>
>
> Are you suggesting that the exiting logic be updated for this use case
> without adding a new enum?
>
>- yes.
>
>
>
> *From:* Kinney, Michael D 
> *Sent:* Wednesday, October 26, 2022 12:21 AM
> *To:* devel@edk2.groups.io; Ni, Ray ; Rhodes, Sean <
> sean@starlabs.systems>; Kinney, Michael D 
> *Cc:* Gao, Zhichao ; Wang, Jian J <
> jian.j.w...@intel.com>; Gao, Liming 
> *Subject:* RE: [edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to
> control the position of the Logo
>
>
>
> Ray,
>
>
>
> Are you suggesting that the exiting logic be updated for this use case
> without adding a new enum?
>
>
>
> Sean, can you provide a revised patch that does this?
>
>
>
> Thanks,
>
>
>
> Mike
>
>
>
> *From:* devel@edk2.groups.io  *On Behalf Of *Ni, Ray
> *Sent:* Tuesday, October 25, 2022 12:58 AM
> *To:* devel@edk2.groups.io; Rhodes, Sean 
> *Cc:* Gao, Zhichao ; Wang, Jian J <
> jian.j.w...@intel.com>; Gao, Liming 
> *Subject:* Re: [edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to
> control the position of the Logo
>
>
>
> I need a reason of adding
> EdkiiPlatformLogoDisplayAttributeMicrosoftRecommended.
>
> In my opinion, without adding this new enum value, it’s still possible to
> support MS recommendation.
>
>
>
> *From:* devel@edk2.groups.io  *On Behalf Of *Sean
> Rhodes
> *Sent:* Tuesday, October 25, 2022 3:27 PM
> *To:* Ni, Ray 
> *Cc:* devel@edk2.groups.io; Gao, Zhichao ; Wang,
> Jian J ; Gao, Liming 
> *Subject:* Re: [edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to
> control the position of the Logo
>
>
>
> Hi Ray
>
>
>
> Where would you suggest this code goes? edk2 should support both Microsoft
> recommended and "normal". The original patch handled this well.
>
>
>
> Thanks
>
>
>
> Sean
>
>
>
> On Mon, 10 Oct 2022 at 10:25, Ni, Ray  wrote:
>
> The logic I shared below is from the LogoDxe driver which produces
> EDKII_PLATFORM_LOGO_PROTOCOL.
>
> This driver should know the image size and it can account for the image
> size.
>
>
>
> Thanks,
>
> Ray
>
>
>
> *From:* Sean Rhodes 
> *Sent:* Monday, October 10, 2022 4:51 PM
> *To:* Ni, Ray 
> *Cc:* devel@edk2.groups.io; Gao, Zhichao ; Wang,
> Jian J ; Gao, Liming 
> *Subject:* Re: [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the
> position of the Logo
>
>
>
> Hi Ray
>
>
>
> Thank you, it does, and I think it will work for most splash images.
> However, the way it's written in my patch accounts for the Image size. This
> will handle splash images that are equal to, or larger than the resolution
> of the display.
>
>
>
> Thanks
>
>
>
> Sean
>
>
>
> On Sat, 8 Oct 2022 at 03:02, Ni, Ray  wrote:
>
> Sean,
> I remember that I evaluated the BGRT requirement when designing the
> PlatformLogo protocol.
>
> So, I went back to got the code I wrote long time ago as below.
> I didn't try to understand them now. Does it make sense to you?
>
> Status = gBS->HandleProtocol (gST->ConsoleOutHandle,
> , (VOID **) );
> if (!EFI_ERROR (Status)) {
>   //
>   // Center of LOGO is in the vertical position 38.2% when
> PcdBootLogoOnlyEnable is TRUE
>   // Y = (VerticalResolution - LogoHeight) / 2
>   // Y' = VerticalResolution * 0.382 - LogoHeight * 0.5
>   // OffsetY + Y = Y'
>   // OffsetY = Y' - Y = -0.118 * VerticalResolution
>   //
>   *Attribute = EdkiiPlatformLogoDisplayAttributeCenter;
>   *OffsetX   = 0;
>   *OffsetY   = -118 * (INTN)
> GraphicsOutput->Mode->Info->VerticalResolution / 1000;
> }
>
> Thanks,
> Ray
>
> > -Original Me

Re: [edk2-devel] [PATCH 3/3] ShellPkg/TftpDynamicCommand.inf: Add missing DEPEX

2023-03-06 Thread Sean Rhodes
Reviewed-by: Sean Rhodes 

On Mon, 6 Mar 2023 at 08:38, Patrick Rudolph 
wrote:

> Add protocol gEfiHiiPackageListProtocolGuid to DEPEX
> to make sure it's present before using it.
>
> Fixes ASSERTION seen on DEBUG build.
>
> Signed-off-by: Patrick Rudolph 
> ---
>  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git
> a/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
> b/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
> index b0c8e8f84b..d0d849a1eb 100644
> --- a/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
> +++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
> @@ -57,4 +57,4 @@
>gEfiShellDynamicCommandProtocolGuid## PRODUCES
>
>  [DEPEX]
> -  TRUE
> +  gEfiHiiPackageListProtocolGuid
> --
> 2.39.1
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100721): https://edk2.groups.io/g/devel/message/100721
Mute This Topic: https://groups.io/mt/97421038/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64

2023-03-06 Thread Sean Rhodes
Reviewed-by: Sean Rhodes 

On Mon, 6 Mar 2023 at 08:38, Patrick Rudolph 
wrote:

> Drop the "-z max-page-size=0x40" option as it causes the ELF
> header to overflow into the .text section, causing undefined
> behaviour.
>
> With high optimization level it corrupts essential code and
> the binary would crash. It might work with low optimization
> level though. As the default is to use Oz and LTO, it always
> crashes.
>
> Test:
> The ELF generated by
> 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' boots.
>
> Signed-off-by: Patrick Rudolph 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4357
> ---
>  BaseTools/Conf/tools_def.template | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/BaseTools/Conf/tools_def.template
> b/BaseTools/Conf/tools_def.template
> index 9b59bd75c3..0c584ab390 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -2866,7 +2866,7 @@ DEFINE CLANGDWARF_X64_PREFIX= ENV(CLANG_BIN)
>
>  # LLVM/CLANG doesn't support -n link option. So, it can't share the same
> IA32_X64_DLINK_COMMON flag.
>  # LLVM/CLANG doesn't support common page size. So, it can't share the
> same GccBase.lds script.
> -DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON   = -nostdlib
> -Wl,-q,--gc-sections -z max-page-size=0x40
> +DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON   = -nostdlib -Wl,-q,--gc-sections
>  DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON =
> -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/ClangBase.lds
>  DEFINE CLANGDWARF_IA32_X64_ASLDLINK_FLAGS =
> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0
> DEF(CLANGDWARF_DLINK2_FLAGS_COMMON) -Wl,--entry,ReferenceAcpiTable -u
> ReferenceAcpiTable
>  DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS=
> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u
> $(IMAGE_ENTRY_POINT)
> -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
> --
> 2.39.1
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100720): https://edk2.groups.io/g/devel/message/100720
Mute This Topic: https://groups.io/mt/97421037/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] regarding uefipayload build warning for pcd

2023-02-07 Thread Sean Rhodes
L36 is help text that says what you are trying to do, wont work

On Tue, 7 Feb 2023 at 20:51, ritul guru  wrote:

> fatal: repository 'payloads/external/edk2/workspace/tianocore' does not
> exist
> make[1]: *** [Makefile:123:
> /home/amd/src/phx2/coreboot_phx2/coreboot/payloads/external/edk2/workspace/edk2]
> Error 128
> make: *** [payloads/external/Makefile.inc:158: build/UEFIPAYLOAD.fd] Error
> 2
>
>
>
>
>
> *Thanks & RegardsRitul Guru+91-9916513186*
>
>
> On Wed, Feb 8, 2023 at 2:19 AM ritul guru  wrote:
>
>> I do not get debug logs from edk2 payload even though debug payload is
>> selected in menuconfig of coreboot.
>> and also updated FD_BASE, if not then getting GCD assert while adding
>> regions in phit table.
>>
>> below path should be give at L36 for custom edk2 repo?
>> payloads/external/edk2/workspace/tianocore/
>>
>>
>>
>> *Thanks & RegardsRitul Guru+91-9916513186*
>>
>>
>> On Wed, Feb 8, 2023 at 2:06 AM Sean Rhodes  wrote:
>>
>>> Why the edk2 changes? Just to fix this issue?
>>>
>>> Have you seen L36 of payloads/external/edk2/Kconfig
>>>
>>> On Tue, 7 Feb 2023 at 20:30, ritul guru  wrote:
>>>
>>>>
>>>>
>>>> Loading driver 378D7B65-8DA9-4773-B6E4-A47826A833E1
>>>> InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B 51A3E1C0
>>>> Loading driver at 0x00051DD1000 EntryPoint=0x00051DD5670 PcRtc.efi
>>>> InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF 51A3ED98
>>>> ProtectUefiImageCommon - 0x51A3E1C0
>>>>   - 0x51DD1000 - 0x8000
>>>> SetUefiImageMemoryAttributes - 0x51DD1000 - 0x1000
>>>> (0x4008)
>>>> SetUefiImageMemoryAttributes - 0x51DD2000 - 0x6000
>>>> (0x00020008)
>>>> SetUefiImageMemoryAttributes - 0x51DD8000 - 0x1000
>>>> (0x4008)
>>>> PROGRESS CODE: V03040002 I0
>>>>
>>>> ASSERT_EFI_ERROR (Status = Device Error)
>>>>
>>>> *ASSERT [PcRtc]
>>>> /home//src/p/coreboot/payloads/external/edk2/workspace/tianocore/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c(1)*
>>>> getting above assert after changed to FD_BASE to below value,
>>>> This error is coming while booting to coreboot with edk2 payload:
>>>>
>>>> UefiPayloadPkg/UefiPayloadPkg.fdf
>>>> DEFINE FD_BASE   = 0x02182000
>>>>
>>>> need to change FD_BASE, as it was going outside Available memory.
>>>> any hint would be appreciated.
>>>>
>>>>
>>>>
>>>>
>>>> *Thanks & RegardsRitul Guru+91-9916513186*
>>>>
>>>>
>>>> On Tue, Feb 7, 2023 at 10:09 PM ritul guru 
>>>> wrote:
>>>>
>>>>> UefiPayloadPkg/UefiPayloadPkg.fdf
>>>>> DEFINE FD_BASE   = 0x0080
>>>>>
>>>>> Is the above address correct in uefipaylaod?
>>>>> As observing some regions are getting out of limit of FD limit,
>>>>>
>>>>> and when setting DEFINE FD_BASE   = 0x0220, then seeing assert
>>>>> in
>>>>> [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister].
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> *Thanks & RegardsRitul Guru+91-9916513186*
>>>>>
>>>>>
>>>>> On Tue, Feb 7, 2023 at 8:29 PM ritul guru 
>>>>> wrote:
>>>>>
>>>>>> Hi,
>>>>>> I am building edk2 payload and getting below warning for
>>>>>> PcdRtcIndexRegister,
>>>>>> and if try to boot to then observing that there is assert at:
>>>>>>
>>>>>> ASSERT_EFI_ERROR (Status = Device Error)
>>>>>>
>>>>>> DXE_ASSERT!:
>>>>>> /home/amd/src///coreboot/payloads/external/tianocore/tianocore/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
>>>>>> (141): !EFI_ERROR (Status)
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> build time warning:
>>>>>> Active Platform  =
>>>>>> /home//src///coreboot/payloads/external/edk2/workspace/tianocore/UefiPayloadPkg/UefiPayloadPkg.dsc
>>>>>> .build: : warning: The PCD was not specified by any INF module in the
>>>>>> platform for the given architecture.
>>>>>> PCD: [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister]
>>>>>> Platform: [UefiPayloadPkg.dsc]
>>>>>> Arch: ['IA32']
>>>>>> build: : warning: The PCD was not specified by any INF module in the
>>>>>> platform for the given architecture.
>>>>>> PCD: [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister]
>>>>>> Platform: [UefiPayloadPkg.dsc]
>>>>>> Arch: ['IA32']
>>>>>> . done!
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> *Thanks & RegardsRitul Guru+91-9916513186*
>>>>>>
>>>>> 
>>>>
>>>>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99775): https://edk2.groups.io/g/devel/message/99775
Mute This Topic: https://groups.io/mt/96810837/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] regarding uefipayload build warning for pcd

2023-02-07 Thread Sean Rhodes
Why the edk2 changes? Just to fix this issue?

Have you seen L36 of payloads/external/edk2/Kconfig

On Tue, 7 Feb 2023 at 20:30, ritul guru  wrote:

>
>
> Loading driver 378D7B65-8DA9-4773-B6E4-A47826A833E1
> InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B 51A3E1C0
> Loading driver at 0x00051DD1000 EntryPoint=0x00051DD5670 PcRtc.efi
> InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF 51A3ED98
> ProtectUefiImageCommon - 0x51A3E1C0
>   - 0x51DD1000 - 0x8000
> SetUefiImageMemoryAttributes - 0x51DD1000 - 0x1000
> (0x4008)
> SetUefiImageMemoryAttributes - 0x51DD2000 - 0x6000
> (0x00020008)
> SetUefiImageMemoryAttributes - 0x51DD8000 - 0x1000
> (0x4008)
> PROGRESS CODE: V03040002 I0
>
> ASSERT_EFI_ERROR (Status = Device Error)
>
> *ASSERT [PcRtc]
> /home//src/p/coreboot/payloads/external/edk2/workspace/tianocore/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c(1)*
> getting above assert after changed to FD_BASE to below value,
> This error is coming while booting to coreboot with edk2 payload:
>
> UefiPayloadPkg/UefiPayloadPkg.fdf
> DEFINE FD_BASE   = 0x02182000
>
> need to change FD_BASE, as it was going outside Available memory.
> any hint would be appreciated.
>
>
>
>
> *Thanks & RegardsRitul Guru+91-9916513186*
>
>
> On Tue, Feb 7, 2023 at 10:09 PM ritul guru  wrote:
>
>> UefiPayloadPkg/UefiPayloadPkg.fdf
>> DEFINE FD_BASE   = 0x0080
>>
>> Is the above address correct in uefipaylaod?
>> As observing some regions are getting out of limit of FD limit,
>>
>> and when setting DEFINE FD_BASE   = 0x0220, then seeing assert in
>> [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister].
>>
>>
>>
>>
>>
>>
>> *Thanks & RegardsRitul Guru+91-9916513186*
>>
>>
>> On Tue, Feb 7, 2023 at 8:29 PM ritul guru  wrote:
>>
>>> Hi,
>>> I am building edk2 payload and getting below warning for
>>> PcdRtcIndexRegister,
>>> and if try to boot to then observing that there is assert at:
>>>
>>> ASSERT_EFI_ERROR (Status = Device Error)
>>>
>>> DXE_ASSERT!:
>>> /home/amd/src///coreboot/payloads/external/tianocore/tianocore/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
>>> (141): !EFI_ERROR (Status)
>>>
>>>
>>>
>>>
>>> build time warning:
>>> Active Platform  =
>>> /home//src///coreboot/payloads/external/edk2/workspace/tianocore/UefiPayloadPkg/UefiPayloadPkg.dsc
>>> .build: : warning: The PCD was not specified by any INF module in the
>>> platform for the given architecture.
>>> PCD: [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister]
>>> Platform: [UefiPayloadPkg.dsc]
>>> Arch: ['IA32']
>>> build: : warning: The PCD was not specified by any INF module in the
>>> platform for the given architecture.
>>> PCD: [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister]
>>> Platform: [UefiPayloadPkg.dsc]
>>> Arch: ['IA32']
>>> . done!
>>>
>>>
>>>
>>>
>>> *Thanks & RegardsRitul Guru+91-9916513186*
>>>
>> 
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99772): https://edk2.groups.io/g/devel/message/99772
Mute This Topic: https://groups.io/mt/96810837/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] regarding uefipayload build warning for pcd

2023-02-07 Thread Sean Rhodes
For anyone to be able to help, you'd need to post a build log, .config, tag
and what custom patches you are using.

On Tue, 7 Feb 2023 at 19:02, ritul guru  wrote:

> CONFIG_PAYLOAD_EDK2=y
> # CONFIG_PAYLOAD_LINUX is not set
> CONFIG_PAYLOAD_FILE="build/UEFIPAYLOAD.fd"
> CONFIG_PAYLOAD_OPTIONS=""
> CONFIG_EDK2_UEFIPAYLOAD=y
> # CONFIG_EDK2_REPO_MRCHROMEBOX is not set
> CONFIG_EDK2_REPO_OFFICIAL=y
> # CONFIG_EDK2_REPO_CUSTOM is not set
> CONFIG_EDK2_REPOSITORY="https://github.com/tianocore/edk2;
> CONFIG_EDK2_TAG_OR_REV="origin/master"
> CONFIG_EDK2_DEBUG=y
> # CONFIG_EDK2_RELEASE is not set
> CONFIG_EDK2_VERBOSE_BUILD=y
> # CONFIG_EDK2_ABOVE_4G_MEMORY is not set
> CONFIG_EDK2_BOOT_MANAGER_ESCAPE=y
>
>
>
>
> *Thanks & RegardsRitul Guru+91-9916513186*
>
>
> On Wed, Feb 8, 2023 at 12:31 AM ritul guru  wrote:
>
>> building it inside coreboot only.
>>
>>
>>
>> *Thanks & RegardsRitul Guru+91-9916513186*
>>
>>
>> On Wed, Feb 8, 2023 at 12:00 AM Sean Rhodes 
>> wrote:
>>
>>> Hi Ritul
>>>
>>> It might be easier to build it inside coreboot; that'll use coreboots
>>> tool chain and Kconfig so everything will just work.
>>>
>>> I.e. CONFIG_PAYLOAD_EDK2=y
>>>
>>> Sean
>>>
>>> On Tue, 7 Feb 2023, 18:24 ritul guru,  wrote:
>>>
>>>> UefiPayloadPkg/UefiPayloadPkg.fdf
>>>> DEFINE FD_BASE   = 0x0080
>>>>
>>>> Is the above address correct in uefipaylaod?
>>>> As observing some regions are getting out of limit of FD limit,
>>>>
>>>> and when setting DEFINE FD_BASE   = 0x0220, then seeing assert
>>>> in
>>>> [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister].
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> *Thanks & RegardsRitul Guru+91-9916513186*
>>>>
>>>>
>>>> On Tue, Feb 7, 2023 at 8:29 PM ritul guru  wrote:
>>>>
>>>>> Hi,
>>>>> I am building edk2 payload and getting below warning for
>>>>> PcdRtcIndexRegister,
>>>>> and if try to boot to then observing that there is assert at:
>>>>>
>>>>> ASSERT_EFI_ERROR (Status = Device Error)
>>>>>
>>>>> DXE_ASSERT!:
>>>>> /home/amd/src///coreboot/payloads/external/tianocore/tianocore/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
>>>>> (141): !EFI_ERROR (Status)
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> build time warning:
>>>>> Active Platform  =
>>>>> /home//src///coreboot/payloads/external/edk2/workspace/tianocore/UefiPayloadPkg/UefiPayloadPkg.dsc
>>>>> .build: : warning: The PCD was not specified by any INF module in the
>>>>> platform for the given architecture.
>>>>> PCD: [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister]
>>>>> Platform: [UefiPayloadPkg.dsc]
>>>>> Arch: ['IA32']
>>>>> build: : warning: The PCD was not specified by any INF module in the
>>>>> platform for the given architecture.
>>>>> PCD: [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister]
>>>>> Platform: [UefiPayloadPkg.dsc]
>>>>> Arch: ['IA32']
>>>>> . done!
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> *Thanks & RegardsRitul Guru+91-9916513186*
>>>>>
>>>> 
>>>>
>>>>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99765): https://edk2.groups.io/g/devel/message/99765
Mute This Topic: https://groups.io/mt/96810837/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] regarding uefipayload build warning for pcd

2023-02-07 Thread Sean Rhodes
Hi Ritul

It might be easier to build it inside coreboot; that'll use coreboots tool
chain and Kconfig so everything will just work.

I.e. CONFIG_PAYLOAD_EDK2=y

Sean

On Tue, 7 Feb 2023, 18:24 ritul guru,  wrote:

> UefiPayloadPkg/UefiPayloadPkg.fdf
> DEFINE FD_BASE   = 0x0080
>
> Is the above address correct in uefipaylaod?
> As observing some regions are getting out of limit of FD limit,
>
> and when setting DEFINE FD_BASE   = 0x0220, then seeing assert in
> [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister].
>
>
>
>
>
>
> *Thanks & RegardsRitul Guru+91-9916513186*
>
>
> On Tue, Feb 7, 2023 at 8:29 PM ritul guru  wrote:
>
>> Hi,
>> I am building edk2 payload and getting below warning for
>> PcdRtcIndexRegister,
>> and if try to boot to then observing that there is assert at:
>>
>> ASSERT_EFI_ERROR (Status = Device Error)
>>
>> DXE_ASSERT!:
>> /home/amd/src///coreboot/payloads/external/tianocore/tianocore/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
>> (141): !EFI_ERROR (Status)
>>
>>
>>
>>
>> build time warning:
>> Active Platform  =
>> /home//src///coreboot/payloads/external/edk2/workspace/tianocore/UefiPayloadPkg/UefiPayloadPkg.dsc
>> .build: : warning: The PCD was not specified by any INF module in the
>> platform for the given architecture.
>> PCD: [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister]
>> Platform: [UefiPayloadPkg.dsc]
>> Arch: ['IA32']
>> build: : warning: The PCD was not specified by any INF module in the
>> platform for the given architecture.
>> PCD: [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister]
>> Platform: [UefiPayloadPkg.dsc]
>> Arch: ['IA32']
>> . done!
>>
>>
>>
>>
>> *Thanks & RegardsRitul Guru+91-9916513186*
>>
> 
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99761): https://edk2.groups.io/g/devel/message/99761
Mute This Topic: https://groups.io/mt/96810837/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present

2023-01-28 Thread Sean Rhodes
Hi Ray

Would it be possible to merge this?

Thanks

Sean

On Fri, 16 Dec 2022, 09:03 Ni, Ray,  wrote:

> Reviewed-by: Ray Ni 
>
>
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Sean
> Rhodes
> > Sent: Friday, December 16, 2022 4:58 PM
> > To: devel@edk2.groups.io
> > Cc: Matt DeVillier ; Wu, Hao A <
> hao.a...@intel.com>; Wang, Jian J ;
> > Gao, Liming ; Gao, Zhichao <
> zhichao@intel.com>; Ni, Ray ; Rhodes,
> > Sean 
> > Subject: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable
> media if it is not present
> >
> > From: Matt DeVillier 
> >
> > Only enumerate devices that have media present.
> >
> > Cc: Hao A Wu 
> > Cc: Jian J Wang 
> > Cc: Liming Gao 
> > Cc: Zhichao Gao 
> > Cc: Ray Ni 
> > Reviewed-by: Sean Rhodes 
> > Signed-off-by: Matt DeVillier 
> > Change-Id: I78a0b8be3e2f33edce2d43bbdd7670e6174d0ff8
> > ---
> >  MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 9 +
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> > b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> > index 962892d38f..bde22fa659 100644
> > --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> > +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> > @@ -2218,6 +2218,15 @@ BmEnumerateBootOptions (
> >  continue;
> >
> >}
> >
> >
> >
> > +  //
> >
> > +  // Skip removable media if not present
> >
> > +  //
> >
> > +  if ((BlkIo->Media->RemovableMedia == TRUE) &&
> >
> > +  (BlkIo->Media->MediaPresent == FALSE))
> >
> > +  {
> >
> > +continue;
> >
> > +  }
> >
> > +
> >
> >Description = BmGetBootDescription (Handles[Index]);
> >
> >BootOptions = ReallocatePool (
> >
> >sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) *
> (*BootOptionCount),
> >
> > --
> > 2.37.2
> >
> >
> >
> > -=-=-=-=-=-=
> > Groups.io Links: You receive all messages sent to this group.
> > View/Reply Online (#97498): https://edk2.groups.io/g/devel/message/97498
> > Mute This Topic: https://groups.io/mt/95706437/1712937
> > Group Owner: devel+ow...@edk2.groups.io
> > Unsubscribe: https://edk2.groups.io/g/devel/unsub [ray...@intel.com]
> > -=-=-=-=-=-=
> >
>
>
>
> 
>
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99224): https://edk2.groups.io/g/devel/message/99224
Mute This Topic: https://groups.io/mt/95706437/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Reset the port if status change returns an error

2022-12-23 Thread Sean Rhodes
Hi Hao

This PR has passed CI - https://github.com/tianocore/edk2/pull/3353

Thanks

Sean

On Fri, 23 Dec 2022 at 08:56, Wu, Hao A  wrote:

> Sorry,
>
> The CI tests failed for the proposed patch:
> https://github.com/tianocore/edk2/pull/3824
>
> Could you help to check and resolve? Thanks.
>
> Best Regards,
> Hao Wu
>
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Sean
> > Rhodes
> > Sent: Wednesday, December 21, 2022 4:15 PM
> > To: devel@edk2.groups.io
> > Cc: Rhodes, Sean 
> > Subject: [edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Reset the
> > port if status change returns an error
> >
> > Force resetting the port by clearing the USB_PORT_STAT_C_RESET bit in
> > PortChangeStatus
> > when XhcPollPortStatusChange fails
> >
> > Signed-off-by: Sean Rhodes 
> > ---
> >  MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 11 ++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> > b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> > index 461b2cd9b5..d8fa41f68f 100644
> > --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> > @@ -471,7 +471,16 @@ XhcGetRootHubPortStatus (
> >// For those devices behind hub, we get its attach/detach event by
> hooking
> > Get_Port_Status request at control transfer for those hub.
> >
> >//
> >
> >ParentRouteChart.Dword = 0;
> >
> > -  XhcPollPortStatusChange (Xhc, ParentRouteChart, PortNumber,
> PortStatus);
> >
> > +  Status = XhcPollPortStatusChange (Xhc,
> ParentRouteChart,
> > PortNumber, PortStatus);
> >
> > +
> >
> > +  //
> >
> > +  // Force resetting the port by clearing the USB_PORT_STAT_C_RESET bit
> in
> > PortChangeStatus
> >
> > +  // when XhcPollPortStatusChange fails
> >
> > +  //
> >
> > +  if (EFI_ERROR (Status)) {
> >
> > +PortStatus->PortChangeStatus &= ~(USB_PORT_STAT_C_RESET);
> >
> > +Status= EFI_SUCCESS;
> >
> > +  }
> >
> >
> >
> >  ON_EXIT:
> >
> >gBS->RestoreTPL (OldTpl);
> >
> > --
> > 2.37.2
> >
> >
> >
> > -=-=-=-=-=-=
> > Groups.io Links: You receive all messages sent to this group.
> > View/Reply Online (#97683): https://edk2.groups.io/g/devel/message/97683
> > Mute This Topic: https://groups.io/mt/95802798/1768737
> > Group Owner: devel+ow...@edk2.groups.io
> > Unsubscribe: https://edk2.groups.io/g/devel/unsub [hao.a...@intel.com]
> > -=-=-=-=-=-=
> >
>
>
>
> 
>
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97729): https://edk2.groups.io/g/devel/message/97729
Mute This Topic: https://groups.io/mt/95802798/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel][PATCH] UefiPayloadPkg: Fix boot issue for non-universal payload

2022-12-22 Thread Sean Rhodes
Okay, a bit more testing - it seems all debug builds hang at that point. I
tested back to edk2-stable202111 so I think that's a coreboot problem.

Your patch does resolve release builds not booting.

> Could you help to use latest Edk2 repo UPL to reproduce the issue that @Sean
Rhodes  encounter from Coreboot + ShimLayer + UPL ?


I'm only testing non-universal payload - the shimlayer doesn't work as
no-one could figure out how to make `ElfCt->FileSize` the right size.

On Thu, 22 Dec 2022 at 02:49, Lu, James  wrote:

> Reviewed-by: James Lu 
>
> -Original Message-
> From: Dong, Guo 
> Sent: Thursday, December 22, 2022 5:25 AM
> To: devel@edk2.groups.io
> Cc: Dong, Guo ; Ni, Ray ; Rhodes,
> Sean ; Lu, James ; Guo, Gua <
> gua@intel.com>
> Subject: [edk2-devel][PATCH] UefiPayloadPkg: Fix boot issue for
> non-universal payload
>
> From: Guo Dong 
>
> BDS module was moved from DXEFV to newly created BDSFV recently.
> Non-universal UEFI payload doesn't support multiple FV, so it failed to
> boot since BDS module could not be found.
> This patch add BDS back to DXEFV when UNIVERSAL_PAYLOAD is not set.
>
> Cc: Ray Ni 
> Cc: Sean Rhodes 
> Cc: James Lu 
> Cc: Gua Guo 
> Signed-off-by: Guo Dong 
> ---
>  UefiPayloadPkg/UefiPayloadPkg.fdf | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf
> b/UefiPayloadPkg/UefiPayloadPkg.fdf
> index 94ba922244..ee7d718b3f 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.fdf
> +++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
> @@ -59,9 +59,6 @@ INF UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
>  FILE FV_IMAGE = 4E35FD93-9C72-4c15-8C4B-E77F1DB2D793 { SECTION
> FV_IMAGE = DXEFV }-FILE FV_IMAGE = FBE6C1E3-2F80-4770-88B0-494186E3346F {-
>   SECTION FV_IMAGE = BDSFV-}
> 
> [FV.BDSFV]@@ -277,6 +274,10 @@ INF
> MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
>  INF
> MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
> !endif +!if $(UNIVERSAL_PAYLOAD) == FALSE+INF
> MdeModulePkg/Universal/BdsDxe/BdsDxe.inf+!endif+ # # UEFI network modules
> #--
> 2.35.1.windows.2
>
>
>
> 
>
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97717): https://edk2.groups.io/g/devel/message/97717
Mute This Topic: https://groups.io/mt/95815569/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel][PATCH] UefiPayloadPkg: Fix boot issue for non-universal payload

2022-12-21 Thread Sean Rhodes
LGTM but it still hangs on Qemu and real hardware.

Debug build shows:
Building ResourceDescriptorHobs for reserved memory:
0.  - 0FFF [10]
buildhob: base = 0x0, size = 0x1000, type = 0x5
1. 1000 - 0009 [01]
2. 000A - 000F [02]
buildhob: base = 0xA, size = 0x6, type = 0x5
3. 0010 - 00F4CFFF [01]
4. 00F4D000 - 00FF [10]
buildhob: base = 0xF4D000, size = 0xB3000, type = 0x5
5. 0100 - 07FF [01]
6. B000 - BFFF [02]
buildhob: base = 0xB000, size = 0x1000, type = 0x1
Building hob to restrict memory resorces to below 4G.
DxeCoreEntryPoint = 0x4DE7DA1
PayloadEntry: AddressBits=40 5LevelPaging=0 1GPage=0
Pml5=1 Pml4=2 Pdp=512 TotalPage=1027
HandOffToDxeCore() Stack Base: 0x4DAE000, Stack Size: 0x2

On Wed, 21 Dec 2022 at 21:24,  wrote:

> From: Guo Dong 
>
> BDS module was moved from DXEFV to newly created BDSFV recently.
> Non-universal UEFI payload doesn't support multiple FV, so it failed
> to boot since BDS module could not be found.
> This patch add BDS back to DXEFV when UNIVERSAL_PAYLOAD is not set.
>
> Cc: Ray Ni 
> Cc: Sean Rhodes 
> Cc: James Lu 
> Cc: Gua Guo 
> Signed-off-by: Guo Dong 
> ---
>  UefiPayloadPkg/UefiPayloadPkg.fdf | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf
> b/UefiPayloadPkg/UefiPayloadPkg.fdf
> index 94ba922244..ee7d718b3f 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.fdf
> +++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
> @@ -59,9 +59,6 @@ INF UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
>  FILE FV_IMAGE = 4E35FD93-9C72-4c15-8C4B-E77F1DB2D793 {
>  SECTION FV_IMAGE = DXEFV
>  }
> -FILE FV_IMAGE = FBE6C1E3-2F80-4770-88B0-494186E3346F {
> -SECTION FV_IMAGE = BDSFV
> -}
>
>
>  
> 
>  [FV.BDSFV]
> @@ -277,6 +274,10 @@ INF
> MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
>  INF
> MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
>  !endif
>
> +!if $(UNIVERSAL_PAYLOAD) == FALSE
> +INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> +!endif
> +
>  #
>  # UEFI network modules
>  #
> --
> 2.35.1.windows.2
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97712): https://edk2.groups.io/g/devel/message/97712
Mute This Topic: https://groups.io/mt/95815569/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] MdeModulePkg/Logo: Add a PCD to control the position of the Logo

2022-12-21 Thread Sean Rhodes
When set to true, the Logo is positioned according to the BGRT
specification, 38.2% from the top of the screen. When set to false,
no behaviour is changed and the logo is positioned centrally.

Cc: Zhichao Gao 
Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: Sean Rhodes 
---
 MdeModulePkg/MdeModulePkg.dec |  6 ++
 MdeModulePkg/Logo/LogoDxe.inf |  4 
 MdeModulePkg/Logo/Logo.c  | 28 +++-
 MdeModulePkg/MdeModulePkg.uni |  6 ++
 4 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index be5e829ca9..c8bb51df3b 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -2102,6 +2102,12 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, 
PcdsDynamicEx]
   # @Prompt The shared bit mask when Intel Tdx is enabled.
   gEfiMdeModulePkgTokenSpaceGuid.PcdTdxSharedBitMask|0x0|UINT64|0x1025
 
+  ## This PCD sets the position of the Boot Logo.
+  #   TRUE  - The Logo is positioned following the recommendations from 
Microsoft.
+  #   FALSE - The logo is positioned in the center of the screen.
+  # @ Prompt This position of the boot logo
+  
gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended|FALSE|BOOLEAN|0x1026
+
 [PcdsPatchableInModule]
   ## Specify memory size with page number for PEI code when
   #  Loading Module at Fixed Address feature is enabled.
diff --git a/MdeModulePkg/Logo/LogoDxe.inf b/MdeModulePkg/Logo/LogoDxe.inf
index 41215d25d8..ce29950089 100644
--- a/MdeModulePkg/Logo/LogoDxe.inf
+++ b/MdeModulePkg/Logo/LogoDxe.inf
@@ -41,6 +41,7 @@ [LibraryClasses]
   UefiBootServicesTableLib
   UefiDriverEntryPoint
   DebugLib
+  PcdLib
 
 [Protocols]
   gEfiHiiDatabaseProtocolGuid## CONSUMES
@@ -48,6 +49,9 @@ [Protocols]
   gEfiHiiPackageListProtocolGuid ## PRODUCES CONSUMES
   gEdkiiPlatformLogoProtocolGuid ## PRODUCES
 
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended ## CONSUMES
+
 [Depex]
   gEfiHiiDatabaseProtocolGuid AND
   gEfiHiiImageExProtocolGuid
diff --git a/MdeModulePkg/Logo/Logo.c b/MdeModulePkg/Logo/Logo.c
index 8ab874d2da..96e34b2011 100644
--- a/MdeModulePkg/Logo/Logo.c
+++ b/MdeModulePkg/Logo/Logo.c
@@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 
 typedef struct {
   EFI_IMAGE_ID ImageId;
@@ -51,12 +52,14 @@ GetImage (
   IN EDKII_PLATFORM_LOGO_PROTOCOL*This,
   IN OUT UINT32  *Instance,
   OUT EFI_IMAGE_INPUT*Image,
+  EFI_GRAPHICS_OUTPUT_PROTOCOL   *GraphicsOutput,
   OUT EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE  *Attribute,
   OUT INTN   *OffsetX,
   OUT INTN   *OffsetY
   )
 {
-  UINT32  Current;
+  UINT32  Current;
+  EFI_STATUS  Status;
 
   if ((Instance == NULL) || (Image == NULL) ||
   (Attribute == NULL) || (OffsetX == NULL) || (OffsetY == NULL))
@@ -69,6 +72,29 @@ GetImage (
 return EFI_NOT_FOUND;
   }
 
+  if (PcdGetBool (PcdFollowMicrosoftRecommended)) {
+//
+// Get current video resolution and text mode
+//
+Status = gBS->HandleProtocol (
+gST->ConsoleOutHandle,
+,
+(VOID **)
+);
+if (!EFI_ERROR (Status)) {
+  //
+  // Center of LOGO is in the vertical position 38.2% when 
PcdBootLogoOnlyEnable is TRUE
+  // Y = (VerticalResolution - LogoHeight) / 2
+  // Y' = VerticalResolution * 0.382 - LogoHeight * 0.5
+  // OffsetY + Y = Y'
+  // OffsetY = Y' - Y = -0.118 * VerticalResolution
+  //
+  *Attribute = EdkiiPlatformLogoDisplayAttributeCenter;
+  *OffsetX   = 0;
+  *OffsetY   = -118 * (INTN)GraphicsOutput->Mode->Info->VerticalResolution 
/ 1000;
+}
+  }
+
   (*Instance)++;
   *Attribute = mLogos[Current].Attribute;
   *OffsetX   = mLogos[Current].OffsetX;
diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni
index 33ce9f6198..09c1ac1cc1 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
@@ -1338,3 +1338,9 @@
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPcieResizableBarSupport_HELP 
#language en-US "Indicates if the PCIe Resizable BAR Capability 
Supported.\n"

 "TRUE  - PCIe Resizable BAR Capability is supported.\n"

 "FALSE - PCIe Resizable BAR Capability is not supported."
+
+#string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowMicrosoftRecommended_PROMPT 
#language en-US "The position of the Boot Logo"
+
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowMicrosoftRecommend_HELP   
#language en-US "Sets the pos

[edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Reset the port if status change returns an error

2022-12-21 Thread Sean Rhodes
Force resetting the port by clearing the USB_PORT_STAT_C_RESET bit in 
PortChangeStatus
when XhcPollPortStatusChange fails

Signed-off-by: Sean Rhodes 
---
 MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c 
b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
index 461b2cd9b5..d8fa41f68f 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
@@ -471,7 +471,16 @@ XhcGetRootHubPortStatus (
   // For those devices behind hub, we get its attach/detach event by hooking 
Get_Port_Status request at control transfer for those hub.
   //
   ParentRouteChart.Dword = 0;
-  XhcPollPortStatusChange (Xhc, ParentRouteChart, PortNumber, PortStatus);
+  Status = XhcPollPortStatusChange (Xhc, ParentRouteChart, 
PortNumber, PortStatus);
+
+  //
+  // Force resetting the port by clearing the USB_PORT_STAT_C_RESET bit in 
PortChangeStatus
+  // when XhcPollPortStatusChange fails
+  //
+  if (EFI_ERROR (Status)) {
+PortStatus->PortChangeStatus &= ~(USB_PORT_STAT_C_RESET);
+Status= EFI_SUCCESS;
+  }
 
 ON_EXIT:
   gBS->RestoreTPL (OldTpl);
-- 
2.37.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97683): https://edk2.groups.io/g/devel/message/97683
Mute This Topic: https://groups.io/mt/95802798/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present

2022-12-16 Thread Sean Rhodes
From: Matt DeVillier 

Only enumerate devices that have media present.

Cc: Hao A Wu 
Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Zhichao Gao 
Cc: Ray Ni 
Reviewed-by: Sean Rhodes 
Signed-off-by: Matt DeVillier 
Change-Id: I78a0b8be3e2f33edce2d43bbdd7670e6174d0ff8
---
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 962892d38f..bde22fa659 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -2218,6 +2218,15 @@ BmEnumerateBootOptions (
 continue;
   }
 
+  //
+  // Skip removable media if not present
+  //
+  if ((BlkIo->Media->RemovableMedia == TRUE) &&
+  (BlkIo->Media->MediaPresent == FALSE))
+  {
+continue;
+  }
+
   Description = BmGetBootDescription (Handles[Index]);
   BootOptions = ReallocatePool (
   sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * 
(*BootOptionCount),
-- 
2.37.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97498): https://edk2.groups.io/g/devel/message/97498
Mute This Topic: https://groups.io/mt/95706437/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 2/3] MdeModulePkg/XhciDxe/Xhci: Don't check for invalid PSIV

2022-12-16 Thread Sean Rhodes
From: Matt DeVillier 

PSID matching relies on comparing the PSIV against the PortSpeed
value. This patch stops edk2 from checking for a PSIV of 0, as it
is not valid; this reduces the number of register access by
approximately 6 per second.

Cc: Hao A Wu 
Cc: Ray Ni 
Reviewed-by: Sean Rhodes 
Signed-off-by: Matt DeVillier 
Change-Id: If15c55ab66d2e7faa832ce8576d2e5b47157cc9a
---
 MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 44 -
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c 
b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
index 15fb49f28f..8dd7a8fbb7 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
@@ -371,6 +371,7 @@ XhcGetRootHubPortStatus (
   UINT32 TotalPort;
   UINTN  Index;
   UINTN  MapSize;
+  UINT8  PortSpeed;
   EFI_STATUS Status;
   USB_DEV_ROUTE  ParentRouteChart;
   EFI_TPLOldTpl;
@@ -397,32 +398,37 @@ XhcGetRootHubPortStatus (
 
   State = XhcReadOpReg (Xhc, Offset);
 
+  PortSpeed = (State & XHC_PORTSC_PS) >> 10;
+
   //
   // According to XHCI 1.1 spec November 2017,
   // Section 7.2 xHCI Support Protocol Capability
   //
-  PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, ((State & 
XHC_PORTSC_PS) >> 10));
-  if (PortStatus->PortStatus == 0) {
-//
-// According to XHCI 1.1 spec November 2017,
-// bit 10~13 of the root port status register identifies the speed of the 
attached device.
-//
-switch ((State & XHC_PORTSC_PS) >> 10) {
-  case 2:
-PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED;
-break;
+  if (PortSpeed > 0) {
+PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, PortSpeed);
+// If no match found in ext cap reg, fall back to PORTSC
+if (PortStatus->PortStatus == 0) {
+  //
+  // According to XHCI 1.1 spec November 2017,
+  // bit 10~13 of the root port status register identifies the speed of 
the attached device.
+  //
+  switch (PortSpeed) {
+case 2:
+  PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED;
+  break;
 
-  case 3:
-PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED;
-break;
+case 3:
+  PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED;
+  break;
 
-  case 4:
-  case 5:
-PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED;
-break;
+case 4:
+case 5:
+  PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED;
+  break;
 
-  default:
-break;
+default:
+  break;
+  }
 }
   }
 
-- 
2.37.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97496): https://edk2.groups.io/g/devel/message/97496
Mute This Topic: https://groups.io/mt/95569298/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 3/3] MdeModulePkg/Bus/Pci/XhciDxe: Check port is compatible before getting PSIV

2022-12-16 Thread Sean Rhodes
On some platforms, including Sky Lake and Kaby Lake, the PSIV (Protocol
Speed ID Value) indices are shared between Protocol Speed ID DWORD' in
the extended capabilities registers for both USB2 (Full Speed) and USB3
(Super Speed).

An example can be found below:

XhcCheckUsbPortSpeedUsedPsic: checking for USB2 ext caps
XhciPsivGetPsid: found 3 PSID entries
XhciPsivGetPsid: looking for port speed 1
XhciPsivGetPsid: PSIV 1 PSIE 2 PLT 0 PSIM 12
XhciPsivGetPsid: PSIV 2 PSIE 1 PLT 0 PSIM 1500
XhciPsivGetPsid: PSIV 3 PSIE 2 PLT 0 PSIM 480
XhcCheckUsbPortSpeedUsedPsic: checking for USB3 ext caps
XhciPsivGetPsid: found 3 PSID entries
XhciPsivGetPsid: looking for port speed 1
XhciPsivGetPsid: PSIV 1 PSIE 3 PLT 0 PSIM 5
XhciPsivGetPsid: PSIV 2 PSIE 3 PLT 0 PSIM 10
XhciPsivGetPsid: PSIV 34 PSIE 2 PLT 0 PSIM 1248

The result is edk2 detecting USB2 devices as USB3 devices, which
consequently causes enumeration to fail.

To avoid incorrect detection, check the Compatible Port Offset to find
the starting Port of Root Hubs that support the protocol.

Signed-off-by: Sean Rhodes 
---
 MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c|  2 +-
 MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c | 35 +-
 MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h |  8 +++---
 3 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c 
b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
index 8dd7a8fbb7..461b2cd9b5 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
@@ -405,7 +405,7 @@ XhcGetRootHubPortStatus (
   // Section 7.2 xHCI Support Protocol Capability
   //
   if (PortSpeed > 0) {
-PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, PortSpeed);
+PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, PortSpeed, 
PortNumber);
 // If no match found in ext cap reg, fall back to PORTSC
 if (PortStatus->PortStatus == 0) {
   //
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c 
b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
index 2b4a4b2444..5700fc5fb8 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
@@ -636,6 +636,7 @@ XhcGetSupportedProtocolCapabilityAddr (
   @param  XhcThe XHCI Instance.
   @param  ExtCapOffset   The USB Major Version in xHCI Support Protocol 
Capability Field
   @param  PortSpeed  The Port Speed Field in USB PortSc register
+  @param  PortNumber The Port Number (0-indexed)
 
   @return The Protocol Speed ID (PSI) from xHCI Supported Protocol capability 
register.
 
@@ -644,12 +645,15 @@ UINT32
 XhciPsivGetPsid (
   IN USB_XHCI_INSTANCE  *Xhc,
   IN UINT32 ExtCapOffset,
-  IN UINT8  PortSpeed
+  IN UINT8  PortSpeed,
+  IN UINT8  PortNumber
   )
 {
   XHC_SUPPORTED_PROTOCOL_DW2PortId;
   XHC_SUPPORTED_PROTOCOL_PROTOCOL_SPEED_ID  Reg;
   UINT32Count;
+  UINT32MinPortIndex;
+  UINT32MaxPortIndex;
 
   if ((Xhc == NULL) || (ExtCapOffset == 0x)) {
 return 0;
@@ -663,6 +667,23 @@ XhciPsivGetPsid (
   //
   PortId.Dword = XhcReadExtCapReg (Xhc, ExtCapOffset + 
XHC_SUPPORTED_PROTOCOL_DW2_OFFSET);
 
+  //
+  // According to XHCI 1.1 spec November 2017, valid values
+  // for CompPortOffset are 1 to CompPortCount - 1.
+  //
+  // PortNumber is zero-indexed, so subtract 1.
+  //
+  if ((PortId.Data.CompPortOffset == 0) || (PortId.Data.CompPortCount == 0)) {
+return 0;
+  }
+
+  MinPortIndex = PortId.Data.CompPortOffset - 1;
+  MaxPortIndex = MinPortIndex + PortId.Data.CompPortCount - 1;
+
+  if ((PortNumber < MinPortIndex) || (PortNumber > MaxPortIndex)) {
+return 0;
+  }
+
   for (Count = 0; Count < PortId.Data.Psic; Count++) {
 Reg.Dword = XhcReadExtCapReg (Xhc, ExtCapOffset + 
XHC_SUPPORTED_PROTOCOL_PSI_OFFSET + (Count << 2));
 if (Reg.Data.Psiv == PortSpeed) {
@@ -676,8 +697,9 @@ XhciPsivGetPsid (
 /**
   Find PortSpeed value match case in XHCI Supported Protocol Capability
 
-  @param  XhcThe XHCI Instance.
-  @param  PortSpeed  The Port Speed Field in USB PortSc register
+  @param  Xhc The XHCI Instance.
+  @param  PortSpeed   The Port Speed Field in USB PortSc register
+  @param  PortNumber  The Port Number (0-indexed)
 
   @return The USB Port Speed.
 
@@ -685,7 +707,8 @@ XhciPsivGetPsid (
 UINT16
 XhcCheckUsbPortSpeedUsedPsic (
   IN USB_XHCI_INSTANCE  *Xhc,
-  IN UINT8  PortSpeed
+  IN UINT8  PortSpeed,
+  IN UINT8  PortNumber
   )
 {
   XHC_SUPPORTED_PROTOCOL_PROTOCOL_SPEED_ID  SpField;
@@ -703,7 +726,7 @@ XhcCheckUsbPortSpeedUsedPsic (
   // PortSpeed definition when the Major Revision is 03h.
   //
   if (Xhc->Usb3SupOffset != 0x) {
-SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb3SupOffset, PortSpeed);
+SpField.

Re: [edk2-devel] [PATCH] MdeModulePkg/Logo: Add a PCD to control the position of the Logo

2022-12-16 Thread Sean Rhodes
Hi Mike

Thanks; didn't work but I'll have a play wth it!

Sean

On Thu, 15 Dec 2022 at 22:55, Michael D Kinney 
wrote:

> Hi Sean,
>
>
>
> Yes, that is the correct section.  Hard to tell from patch email alone.
>
>
>
> There is a git config that can always include the name of the section of
> the INF/DEC/DSC/FDF file where a change is made.
>
> Can make it a bit easier to review.
>
>
>
>
> https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-guide-for-edk2-contributors-and-maintainers#contrib-05
>
>
>
> Specifically this one I think:
>
>
>
> git config diff.ini.xfuncname '^\[[A-Za-z0-9_., ]+]'
>
>
>
> Mike
>
>
>
> *From:* Sean Rhodes 
> *Sent:* Thursday, December 15, 2022 2:17 PM
> *To:* Kinney, Michael D 
> *Cc:* devel@edk2.groups.io; Gao, Zhichao ; Ni, Ray
> ; Wang, Jian J ; Gao, Liming <
> gaolim...@byosoft.com.cn>
> *Subject:* Re: [edk2-devel] [PATCH] MdeModulePkg/Logo: Add a PCD to
> control the position of the Logo
>
>
>
> Hi Mike
>
>
>
> Thank you; changed to PcdGetBool.
>
>
>
> It's in `[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic,
> PcdsDynamicEx]` - is that not right?
>
>
>
> Thanks
>
>
>
> Sean
>
>
>
> On Thu, 15 Dec 2022 at 22:09, Kinney, Michael D <
> michael.d.kin...@intel.com> wrote:
>
> Hi Sean,
>
> A couple comments related to the PCD type below.
>
> Mike
>
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Sean
> Rhodes
> > Sent: Thursday, December 15, 2022 1:12 PM
> > To: devel@edk2.groups.io
> > Cc: Rhodes, Sean ; Gao, Zhichao <
> zhichao@intel.com>; Ni, Ray ; Wang, Jian J
> > ; Gao, Liming 
> > Subject: [edk2-devel] [PATCH] MdeModulePkg/Logo: Add a PCD to control
> the position of the Logo
> >
> > When set to true, the Logo is positioned according to the BGRT
> > specification, 38.2% from the top of the screen. When set to false,
> > no behaviour is changed and the logo is positioned centrally.
> >
> > Cc: Zhichao Gao 
> > Cc: Ray Ni 
> > Cc: Jian J Wang 
> > Cc: Liming Gao 
> > Signed-off-by: Sean Rhodes 
> > ---
> >  MdeModulePkg/Logo/Logo.c  | 28 +++-
> >  MdeModulePkg/Logo/LogoDxe.inf |  4 
> >  MdeModulePkg/MdeModulePkg.dec |  6 ++
> >  MdeModulePkg/MdeModulePkg.uni |  6 ++
> >  4 files changed, 43 insertions(+), 1 deletion(-)
> >
> > diff --git a/MdeModulePkg/Logo/Logo.c b/MdeModulePkg/Logo/Logo.c
> > index 8ab874d2da..48862d3207 100644
> > --- a/MdeModulePkg/Logo/Logo.c
> > +++ b/MdeModulePkg/Logo/Logo.c
> > @@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> >  #include 
> >
> >  #include 
> >
> >  #include 
> >
> > +#include 
> >
> >
> >
> >  typedef struct {
> >
> >EFI_IMAGE_ID ImageId;
> >
> > @@ -51,12 +52,14 @@ GetImage (
> >IN EDKII_PLATFORM_LOGO_PROTOCOL*This,
> >
> >IN OUT UINT32  *Instance,
> >
> >OUT EFI_IMAGE_INPUT*Image,
> >
> > +  EFI_GRAPHICS_OUTPUT_PROTOCOL   *GraphicsOutput,
> >
> >OUT EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE  *Attribute,
> >
> >OUT INTN   *OffsetX,
> >
> >OUT INTN   *OffsetY
> >
> >)
> >
> >  {
> >
> > -  UINT32  Current;
> >
> > +  UINT32  Current;
> >
> > +  EFI_STATUS  Status;
> >
> >
> >
> >if ((Instance == NULL) || (Image == NULL) ||
> >
> >(Attribute == NULL) || (OffsetX == NULL) || (OffsetY == NULL))
> >
> > @@ -69,6 +72,29 @@ GetImage (
> >  return EFI_NOT_FOUND;
> >
> >}
> >
> >
> >
> > +  if (FixedPcdGetBool (PcdFollowMicrosoftRecommended)) {
>
> Should be PcdGetBool().  The only time FixedPcdGetxxx() is required is
> if the PCD value is being used to initialize a struct where the value
> is needed at build time.  This allows the PCD type to be flexible and
> can be set in platform scope in the DSC file.
>
> >
> > +//
> >
> > +// Get current video resolution and text mode
> >
> > +//
> >
> > +Status = gBS->HandleProtocol (
> >
> > +gST->ConsoleOutHandle,
> >
> > +,
> >
> > +(VOID **)
> >
&

[edk2-devel] [PATCH] MdeModulePkg/Logo: Add a PCD to control the position of the Logo

2022-12-16 Thread Sean Rhodes
When set to true, the Logo is positioned according to the BGRT
specification, 38.2% from the top of the screen. When set to false,
no behaviour is changed and the logo is positioned centrally.

Cc: Zhichao Gao 
Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: Sean Rhodes 
---
 MdeModulePkg/Logo/Logo.c  | 28 +++-
 MdeModulePkg/Logo/LogoDxe.inf |  4 
 MdeModulePkg/MdeModulePkg.dec |  6 ++
 MdeModulePkg/MdeModulePkg.uni |  6 ++
 4 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Logo/Logo.c b/MdeModulePkg/Logo/Logo.c
index 8ab874d2da..96e34b2011 100644
--- a/MdeModulePkg/Logo/Logo.c
+++ b/MdeModulePkg/Logo/Logo.c
@@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 
 typedef struct {
   EFI_IMAGE_ID ImageId;
@@ -51,12 +52,14 @@ GetImage (
   IN EDKII_PLATFORM_LOGO_PROTOCOL*This,
   IN OUT UINT32  *Instance,
   OUT EFI_IMAGE_INPUT*Image,
+  EFI_GRAPHICS_OUTPUT_PROTOCOL   *GraphicsOutput,
   OUT EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE  *Attribute,
   OUT INTN   *OffsetX,
   OUT INTN   *OffsetY
   )
 {
-  UINT32  Current;
+  UINT32  Current;
+  EFI_STATUS  Status;
 
   if ((Instance == NULL) || (Image == NULL) ||
   (Attribute == NULL) || (OffsetX == NULL) || (OffsetY == NULL))
@@ -69,6 +72,29 @@ GetImage (
 return EFI_NOT_FOUND;
   }
 
+  if (PcdGetBool (PcdFollowMicrosoftRecommended)) {
+//
+// Get current video resolution and text mode
+//
+Status = gBS->HandleProtocol (
+gST->ConsoleOutHandle,
+,
+(VOID **)
+);
+if (!EFI_ERROR (Status)) {
+  //
+  // Center of LOGO is in the vertical position 38.2% when 
PcdBootLogoOnlyEnable is TRUE
+  // Y = (VerticalResolution - LogoHeight) / 2
+  // Y' = VerticalResolution * 0.382 - LogoHeight * 0.5
+  // OffsetY + Y = Y'
+  // OffsetY = Y' - Y = -0.118 * VerticalResolution
+  //
+  *Attribute = EdkiiPlatformLogoDisplayAttributeCenter;
+  *OffsetX   = 0;
+  *OffsetY   = -118 * (INTN)GraphicsOutput->Mode->Info->VerticalResolution 
/ 1000;
+}
+  }
+
   (*Instance)++;
   *Attribute = mLogos[Current].Attribute;
   *OffsetX   = mLogos[Current].OffsetX;
diff --git a/MdeModulePkg/Logo/LogoDxe.inf b/MdeModulePkg/Logo/LogoDxe.inf
index 41215d25d8..ce29950089 100644
--- a/MdeModulePkg/Logo/LogoDxe.inf
+++ b/MdeModulePkg/Logo/LogoDxe.inf
@@ -41,6 +41,7 @@
   UefiBootServicesTableLib
   UefiDriverEntryPoint
   DebugLib
+  PcdLib
 
 [Protocols]
   gEfiHiiDatabaseProtocolGuid## CONSUMES
@@ -48,6 +49,9 @@
   gEfiHiiPackageListProtocolGuid ## PRODUCES CONSUMES
   gEdkiiPlatformLogoProtocolGuid ## PRODUCES
 
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended ## CONSUMES
+
 [Depex]
   gEfiHiiDatabaseProtocolGuid AND
   gEfiHiiImageExProtocolGuid
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index be5e829ca9..c8bb51df3b 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -2102,6 +2102,12 @@
   # @Prompt The shared bit mask when Intel Tdx is enabled.
   gEfiMdeModulePkgTokenSpaceGuid.PcdTdxSharedBitMask|0x0|UINT64|0x1025
 
+  ## This PCD sets the position of the Boot Logo.
+  #   TRUE  - The Logo is positioned following the recommendations from 
Microsoft.
+  #   FALSE - The logo is positioned in the center of the screen.
+  # @ Prompt This position of the boot logo
+  
gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended|FALSE|BOOLEAN|0x1026
+
 [PcdsPatchableInModule]
   ## Specify memory size with page number for PEI code when
   #  Loading Module at Fixed Address feature is enabled.
diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni
index 33ce9f6198..09c1ac1cc1 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
@@ -1338,3 +1338,9 @@
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPcieResizableBarSupport_HELP 
#language en-US "Indicates if the PCIe Resizable BAR Capability 
Supported.\n"

 "TRUE  - PCIe Resizable BAR Capability is supported.\n"

 "FALSE - PCIe Resizable BAR Capability is not supported."
+
+#string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowMicrosoftRecommended_PROMPT 
#language en-US "The position of the Boot Logo"
+
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowMicrosoftRecommend_HELP   
#language en-US "Sets the position of the Logo. When set to

Re: [edk2-devel] [PATCH] MdeModulePkg/Logo: Add a PCD to control the position of the Logo

2022-12-15 Thread Sean Rhodes
Hi Mike

Thank you; changed to PcdGetBool.

It's in `[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic,
PcdsDynamicEx]` - is that not right?

Thanks

Sean

On Thu, 15 Dec 2022 at 22:09, Kinney, Michael D 
wrote:

> Hi Sean,
>
> A couple comments related to the PCD type below.
>
> Mike
>
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Sean
> Rhodes
> > Sent: Thursday, December 15, 2022 1:12 PM
> > To: devel@edk2.groups.io
> > Cc: Rhodes, Sean ; Gao, Zhichao <
> zhichao@intel.com>; Ni, Ray ; Wang, Jian J
> > ; Gao, Liming 
> > Subject: [edk2-devel] [PATCH] MdeModulePkg/Logo: Add a PCD to control
> the position of the Logo
> >
> > When set to true, the Logo is positioned according to the BGRT
> > specification, 38.2% from the top of the screen. When set to false,
> > no behaviour is changed and the logo is positioned centrally.
> >
> > Cc: Zhichao Gao 
> > Cc: Ray Ni 
> > Cc: Jian J Wang 
> > Cc: Liming Gao 
> > Signed-off-by: Sean Rhodes 
> > ---
> >  MdeModulePkg/Logo/Logo.c  | 28 +++-
> >  MdeModulePkg/Logo/LogoDxe.inf |  4 
> >  MdeModulePkg/MdeModulePkg.dec |  6 ++
> >  MdeModulePkg/MdeModulePkg.uni |  6 ++
> >  4 files changed, 43 insertions(+), 1 deletion(-)
> >
> > diff --git a/MdeModulePkg/Logo/Logo.c b/MdeModulePkg/Logo/Logo.c
> > index 8ab874d2da..48862d3207 100644
> > --- a/MdeModulePkg/Logo/Logo.c
> > +++ b/MdeModulePkg/Logo/Logo.c
> > @@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> >  #include 
> >
> >  #include 
> >
> >  #include 
> >
> > +#include 
> >
> >
> >
> >  typedef struct {
> >
> >EFI_IMAGE_ID ImageId;
> >
> > @@ -51,12 +52,14 @@ GetImage (
> >IN EDKII_PLATFORM_LOGO_PROTOCOL*This,
> >
> >IN OUT UINT32  *Instance,
> >
> >OUT EFI_IMAGE_INPUT*Image,
> >
> > +  EFI_GRAPHICS_OUTPUT_PROTOCOL   *GraphicsOutput,
> >
> >OUT EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE  *Attribute,
> >
> >OUT INTN   *OffsetX,
> >
> >OUT INTN   *OffsetY
> >
> >)
> >
> >  {
> >
> > -  UINT32  Current;
> >
> > +  UINT32  Current;
> >
> > +  EFI_STATUS  Status;
> >
> >
> >
> >if ((Instance == NULL) || (Image == NULL) ||
> >
> >(Attribute == NULL) || (OffsetX == NULL) || (OffsetY == NULL))
> >
> > @@ -69,6 +72,29 @@ GetImage (
> >  return EFI_NOT_FOUND;
> >
> >}
> >
> >
> >
> > +  if (FixedPcdGetBool (PcdFollowMicrosoftRecommended)) {
>
> Should be PcdGetBool().  The only time FixedPcdGetxxx() is required is
> if the PCD value is being used to initialize a struct where the value
> is needed at build time.  This allows the PCD type to be flexible and
> can be set in platform scope in the DSC file.
>
> >
> > +//
> >
> > +// Get current video resolution and text mode
> >
> > +//
> >
> > +Status = gBS->HandleProtocol (
> >
> > +gST->ConsoleOutHandle,
> >
> > +,
> >
> > +(VOID **)
> >
> > +);
> >
> > +if (!EFI_ERROR (Status)) {
> >
> > +  //
> >
> > +  // Center of LOGO is in the vertical position 38.2% when
> PcdBootLogoOnlyEnable is TRUE
> >
> > +  // Y = (VerticalResolution - LogoHeight) / 2
> >
> > +  // Y' = VerticalResolution * 0.382 - LogoHeight * 0.5
> >
> > +  // OffsetY + Y = Y'
> >
> > +  // OffsetY = Y' - Y = -0.118 * VerticalResolution
> >
> > +  //
> >
> > +  *Attribute = EdkiiPlatformLogoDisplayAttributeCenter;
> >
> > +  *OffsetX   = 0;
> >
> > +  *OffsetY   = -118 *
> (INTN)GraphicsOutput->Mode->Info->VerticalResolution / 1000;
> >
> > +}
> >
> > +  }
> >
> > +
> >
> >(*Instance)++;
> >
> >*Attribute = mLogos[Current].Attribute;
> >
> >*OffsetX   = mLogos[Current].OffsetX;
> >
> > diff --git a/MdeModulePkg/Logo/LogoDxe.inf
> b/MdeModulePkg/Logo/LogoDxe.inf
> > index 41215d25d8..ce29950089 100644
> > --- a/MdeModulePkg/Logo/LogoDxe.inf
> > +++ b/Md

[edk2-devel] [PATCH] MdeModulePkg/Logo: Add a PCD to control the position of the Logo

2022-12-15 Thread Sean Rhodes
When set to true, the Logo is positioned according to the BGRT
specification, 38.2% from the top of the screen. When set to false,
no behaviour is changed and the logo is positioned centrally.

Cc: Zhichao Gao 
Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: Sean Rhodes 
---
 MdeModulePkg/Logo/Logo.c  | 28 +++-
 MdeModulePkg/Logo/LogoDxe.inf |  4 
 MdeModulePkg/MdeModulePkg.dec |  6 ++
 MdeModulePkg/MdeModulePkg.uni |  6 ++
 4 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Logo/Logo.c b/MdeModulePkg/Logo/Logo.c
index 8ab874d2da..48862d3207 100644
--- a/MdeModulePkg/Logo/Logo.c
+++ b/MdeModulePkg/Logo/Logo.c
@@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 
 typedef struct {
   EFI_IMAGE_ID ImageId;
@@ -51,12 +52,14 @@ GetImage (
   IN EDKII_PLATFORM_LOGO_PROTOCOL*This,
   IN OUT UINT32  *Instance,
   OUT EFI_IMAGE_INPUT*Image,
+  EFI_GRAPHICS_OUTPUT_PROTOCOL   *GraphicsOutput,
   OUT EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE  *Attribute,
   OUT INTN   *OffsetX,
   OUT INTN   *OffsetY
   )
 {
-  UINT32  Current;
+  UINT32  Current;
+  EFI_STATUS  Status;
 
   if ((Instance == NULL) || (Image == NULL) ||
   (Attribute == NULL) || (OffsetX == NULL) || (OffsetY == NULL))
@@ -69,6 +72,29 @@ GetImage (
 return EFI_NOT_FOUND;
   }
 
+  if (FixedPcdGetBool (PcdFollowMicrosoftRecommended)) {
+//
+// Get current video resolution and text mode
+//
+Status = gBS->HandleProtocol (
+gST->ConsoleOutHandle,
+,
+(VOID **)
+);
+if (!EFI_ERROR (Status)) {
+  //
+  // Center of LOGO is in the vertical position 38.2% when 
PcdBootLogoOnlyEnable is TRUE
+  // Y = (VerticalResolution - LogoHeight) / 2
+  // Y' = VerticalResolution * 0.382 - LogoHeight * 0.5
+  // OffsetY + Y = Y'
+  // OffsetY = Y' - Y = -0.118 * VerticalResolution
+  //
+  *Attribute = EdkiiPlatformLogoDisplayAttributeCenter;
+  *OffsetX   = 0;
+  *OffsetY   = -118 * (INTN)GraphicsOutput->Mode->Info->VerticalResolution 
/ 1000;
+}
+  }
+
   (*Instance)++;
   *Attribute = mLogos[Current].Attribute;
   *OffsetX   = mLogos[Current].OffsetX;
diff --git a/MdeModulePkg/Logo/LogoDxe.inf b/MdeModulePkg/Logo/LogoDxe.inf
index 41215d25d8..ce29950089 100644
--- a/MdeModulePkg/Logo/LogoDxe.inf
+++ b/MdeModulePkg/Logo/LogoDxe.inf
@@ -41,6 +41,7 @@
   UefiBootServicesTableLib
   UefiDriverEntryPoint
   DebugLib
+  PcdLib
 
 [Protocols]
   gEfiHiiDatabaseProtocolGuid## CONSUMES
@@ -48,6 +49,9 @@
   gEfiHiiPackageListProtocolGuid ## PRODUCES CONSUMES
   gEdkiiPlatformLogoProtocolGuid ## PRODUCES
 
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended ## CONSUMES
+
 [Depex]
   gEfiHiiDatabaseProtocolGuid AND
   gEfiHiiImageExProtocolGuid
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index be5e829ca9..c8bb51df3b 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -2102,6 +2102,12 @@
   # @Prompt The shared bit mask when Intel Tdx is enabled.
   gEfiMdeModulePkgTokenSpaceGuid.PcdTdxSharedBitMask|0x0|UINT64|0x1025
 
+  ## This PCD sets the position of the Boot Logo.
+  #   TRUE  - The Logo is positioned following the recommendations from 
Microsoft.
+  #   FALSE - The logo is positioned in the center of the screen.
+  # @ Prompt This position of the boot logo
+  
gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended|FALSE|BOOLEAN|0x1026
+
 [PcdsPatchableInModule]
   ## Specify memory size with page number for PEI code when
   #  Loading Module at Fixed Address feature is enabled.
diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni
index 33ce9f6198..09c1ac1cc1 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
@@ -1338,3 +1338,9 @@
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPcieResizableBarSupport_HELP 
#language en-US "Indicates if the PCIe Resizable BAR Capability 
Supported.\n"

 "TRUE  - PCIe Resizable BAR Capability is supported.\n"

 "FALSE - PCIe Resizable BAR Capability is not supported."
+
+#string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowMicrosoftRecommended_PROMPT 
#language en-US "The position of the Boot Logo"
+
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowMicrosoftRecommend_HELP   
#language en-US "Sets the position of the Logo. When set to

Re: [edk2-devel] [PATCH 1/4] MdeModulePkg/XhciDxe/XhciReg: Handle incorrect PSIV indices

2022-12-09 Thread Sean Rhodes
Thank you :)

On Thu, 8 Dec 2022 at 07:06, Chiu, Ian  wrote:

> Hi Sean, Matt DeVillier,
>
> I checked the patch 0001-0004, we are find and agree with 0002-0004.
> For the patch
> 0001-MdeModulePkg-XhciDxe-XhciReg-Handle-incorrect-PSIV-indices.
> The case you mention below with same PSIV in USB3/USB2.
>
> We consider if there exist a case that actually want to go with USB3
> speed,
> then will fail when data transmit. Since USB3 protocol is different than
> USB2.
> Otherwise we may need to fix it again, once issue coming out.
>
> We think about a solution to using the "Compatible Port Count" &
> "Compatible Port Offset" to ensure the port is supported this protocol or
> not.
> Would you able to dump the xHCI Supported Protocol Capability raw data and
> check if this solution works with you case.
>
> Attach sample code snippet and data dump from my side.
>
> Thanks,
> Ian Chiu
>
>
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Sean Rhodes
> Sent: Monday, December 5, 2022 5:18 PM
> To: devel@edk2.groups.io
> Cc: Matt DeVillier ; Wu, Hao A <
> hao.a...@intel.com>; Ni, Ray ; Rhodes, Sean
> 
> Subject: [edk2-devel] [PATCH 1/4] MdeModulePkg/XhciDxe/XhciReg: Handle
> incorrect PSIV indices
>
> From: Matt DeVillier 
>
> On some platforms, including Sky Lake and Kaby Lake, the PSIV (Protocol
> Speed ID Value) indices are shared between Protocol Speed ID DWORD' in the
> extended capabilities registers for both USB2 (Full Speed) and USB3 (Super
> Speed).
>
> An example can be found below:
>
> XhcCheckUsbPortSpeedUsedPsic: checking for USB2 ext caps
> XhciPsivGetPsid: found 3 PSID entries
> XhciPsivGetPsid: looking for port speed 1
> XhciPsivGetPsid: PSIV 1 PSIE 2 PLT 0 PSIM 12
> XhciPsivGetPsid: PSIV 2 PSIE 1 PLT 0 PSIM 1500
> XhciPsivGetPsid: PSIV 3 PSIE 2 PLT 0 PSIM 480
> XhcCheckUsbPortSpeedUsedPsic: checking for USB3 ext caps
> XhciPsivGetPsid: found 3 PSID entries
> XhciPsivGetPsid: looking for port speed 1
> XhciPsivGetPsid: PSIV 1 PSIE 3 PLT 0 PSIM 5
> XhciPsivGetPsid: PSIV 2 PSIE 3 PLT 0 PSIM 10
> XhciPsivGetPsid: PSIV 34 PSIE 2 PLT 0 PSIM 1248
>
> The result is edk2 detecting USB2 devices as USB3 devices, which
> consequently causes enumeration to fail.
>
> To avoid incorrect detection, check the extended capability registers for
> USB2 before USB3. If edk2 finds a match for a USB 2 device, don't check for
> USB 3.
>
> Cc: Hao A Wu 
> Cc: Ray Ni 
> Reviewed-by: Sean Rhodes 
> Signed-off-by: Matt DeVillier 
> Change-Id: I5bcf32105ce85fda95b4ba98a5e420e8f522374c
> ---
>  MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c | 36 +++---
> MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h |  1 +
>  2 files changed, 22 insertions(+), 15 deletions(-)
>
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> index 2b4a4b2444..c992323443 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> @@ -698,25 +698,11 @@ XhcCheckUsbPortSpeedUsedPsic (
>SpField.Dword = 0;   UsbSpeedIdMap = 0; -  //-  // Check xHCI Supported
> Protocol Capability, find the PSIV field to match-  // PortSpeed definition
> when the Major Revision is 03h.-  //-  if (Xhc->Usb3SupOffset !=
> 0x) {-SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb3SupOffset,
> PortSpeed);-if (SpField.Dword != 0) {-  //-  // Found the
> corresponding PORTSC value in PSIV field of USB3 offset.-  //-
> UsbSpeedIdMap = USB_PORT_STAT_SUPER_SPEED;-}-  }-   //   // Check xHCI
> Supported Protocol Capability, find the PSIV field to match   // PortSpeed
> definition when the Major Revision is 02h.   //-  if ((UsbSpeedIdMap == 0)
> && (Xhc->Usb2SupOffset != 0x)) {+  if (Xhc->Usb2SupOffset !=
> 0x) { SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb2SupOffset,
> PortSpeed); if (SpField.Dword != 0) {   //@@ -733,6 +719,12 @@
> XhcCheckUsbPortSpeedUsedPsic (
>// PSIM shows as default High-speed protocol, apply to
> High-speed mapping   //   UsbSpeedIdMap =
> USB_PORT_STAT_HIGH_SPEED;+} else if (SpField.Data.Psim ==
> XHC_SUPPORTED_PROTOCOL_USB2_FULL_SPEED_PSIM) {+  //+  //
> PSIM shows as default Full-speed protocol, return 0+  // to ensure
> no port status set+  //+  return 0; }   } else
> if (SpField.Data.Psie == 1) { //@@ -750,6 +742,20 @@
> XhcCheckUsbPortSpeedUsedPsic (
>  }   } +  //+  // Check xHCI Supported Protocol Capability, find the
> PSIV field to match+  // PortSpeed definition when the Major

[edk2-devel] [PATCH 2/3] MdeModulePkg/XhciDxe/Xhci: Don't check for invalid PSIV

2022-12-09 Thread Sean Rhodes
From: Matt DeVillier 

PSID matching relies on comparing the PSIV against the PortSpeed
value. This patch stops edk2 from checking for a PSIV of 0, as it
is not valid; this reduces the number of register access by
approximately 6 per second.

Cc: Hao A Wu 
Cc: Ray Ni 
Reviewed-by: Sean Rhodes 
Signed-off-by: Matt DeVillier 
Change-Id: If15c55ab66d2e7faa832ce8576d2e5b47157cc9a
---
 MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 44 -
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c 
b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
index 15fb49f28f..8dd7a8fbb7 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
@@ -371,6 +371,7 @@ XhcGetRootHubPortStatus (
   UINT32 TotalPort;
   UINTN  Index;
   UINTN  MapSize;
+  UINT8  PortSpeed;
   EFI_STATUS Status;
   USB_DEV_ROUTE  ParentRouteChart;
   EFI_TPLOldTpl;
@@ -397,32 +398,37 @@ XhcGetRootHubPortStatus (
 
   State = XhcReadOpReg (Xhc, Offset);
 
+  PortSpeed = (State & XHC_PORTSC_PS) >> 10;
+
   //
   // According to XHCI 1.1 spec November 2017,
   // Section 7.2 xHCI Support Protocol Capability
   //
-  PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, ((State & 
XHC_PORTSC_PS) >> 10));
-  if (PortStatus->PortStatus == 0) {
-//
-// According to XHCI 1.1 spec November 2017,
-// bit 10~13 of the root port status register identifies the speed of the 
attached device.
-//
-switch ((State & XHC_PORTSC_PS) >> 10) {
-  case 2:
-PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED;
-break;
+  if (PortSpeed > 0) {
+PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, PortSpeed);
+// If no match found in ext cap reg, fall back to PORTSC
+if (PortStatus->PortStatus == 0) {
+  //
+  // According to XHCI 1.1 spec November 2017,
+  // bit 10~13 of the root port status register identifies the speed of 
the attached device.
+  //
+  switch (PortSpeed) {
+case 2:
+  PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED;
+  break;
 
-  case 3:
-PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED;
-break;
+case 3:
+  PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED;
+  break;
 
-  case 4:
-  case 5:
-PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED;
-break;
+case 4:
+case 5:
+  PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED;
+  break;
 
-  default:
-break;
+default:
+  break;
+  }
 }
   }
 
-- 
2.37.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97209): https://edk2.groups.io/g/devel/message/97209
Mute This Topic: https://groups.io/mt/95569298/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 3/3] MdeModulePkg/Bus/Pci/XhciDxe: Handle incorrect PSIV indices

2022-12-09 Thread Sean Rhodes
On some platforms, including Sky Lake and Kaby Lake, the PSIV (Protocol
Speed ID Value) indices are shared between Protocol Speed ID DWORD' in
the extended capabilities registers for both USB2 (Full Speed) and USB3
(Super Speed).

An example can be found below:

XhcCheckUsbPortSpeedUsedPsic: checking for USB2 ext caps
XhciPsivGetPsid: found 3 PSID entries
XhciPsivGetPsid: looking for port speed 1
XhciPsivGetPsid: PSIV 1 PSIE 2 PLT 0 PSIM 12
XhciPsivGetPsid: PSIV 2 PSIE 1 PLT 0 PSIM 1500
XhciPsivGetPsid: PSIV 3 PSIE 2 PLT 0 PSIM 480
XhcCheckUsbPortSpeedUsedPsic: checking for USB3 ext caps
XhciPsivGetPsid: found 3 PSID entries
XhciPsivGetPsid: looking for port speed 1
XhciPsivGetPsid: PSIV 1 PSIE 3 PLT 0 PSIM 5
XhciPsivGetPsid: PSIV 2 PSIE 3 PLT 0 PSIM 10
XhciPsivGetPsid: PSIV 34 PSIE 2 PLT 0 PSIM 1248

The result is edk2 detecting USB2 devices as USB3 devices, which
consequently causes enumeration to fail.

To avoid incorrect detection, check the Compatible Port Offset to find
the starting Port of Root Hubs that support the protocol.

Signed-off-by: Sean Rhodes 
---
 MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c|  2 +-
 MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c | 26 ++
 MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h |  3 ++-
 3 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c 
b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
index 8dd7a8fbb7..461b2cd9b5 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
@@ -405,7 +405,7 @@ XhcGetRootHubPortStatus (
   // Section 7.2 xHCI Support Protocol Capability
   //
   if (PortSpeed > 0) {
-PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, PortSpeed);
+PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, PortSpeed, 
PortNumber);
 // If no match found in ext cap reg, fall back to PORTSC
 if (PortStatus->PortStatus == 0) {
   //
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c 
b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
index 2b4a4b2444..bca53e9ac0 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
@@ -636,6 +636,7 @@ XhcGetSupportedProtocolCapabilityAddr (
   @param  XhcThe XHCI Instance.
   @param  ExtCapOffset   The USB Major Version in xHCI Support Protocol 
Capability Field
   @param  PortSpeed  The Port Speed Field in USB PortSc register
+  @param  PortNumber The Port Number (0-indexed)
 
   @return The Protocol Speed ID (PSI) from xHCI Supported Protocol capability 
register.
 
@@ -644,12 +645,15 @@ UINT32
 XhciPsivGetPsid (
   IN USB_XHCI_INSTANCE  *Xhc,
   IN UINT32 ExtCapOffset,
-  IN UINT8  PortSpeed
+  IN UINT8  PortSpeed,
+  IN UINT8  PortNumber
   )
 {
   XHC_SUPPORTED_PROTOCOL_DW2PortId;
   XHC_SUPPORTED_PROTOCOL_PROTOCOL_SPEED_ID  Reg;
   UINT32Count;
+  UINT32MinPortIndex;
+  UINT32MaxPortIndex;
 
   if ((Xhc == NULL) || (ExtCapOffset == 0x)) {
 return 0;
@@ -663,6 +667,19 @@ XhciPsivGetPsid (
   //
   PortId.Dword = XhcReadExtCapReg (Xhc, ExtCapOffset + 
XHC_SUPPORTED_PROTOCOL_DW2_OFFSET);
 
+  //
+  // According to XHCI 1.1 spec November 2017, valid values
+  // for CompPortOffset are 1 to CompPortCount - 1.
+  //
+  // PortNumber is zero-indexed, so subtract 1.
+  //
+  MinPortIndex = PortId.Data.CompPortOffset - 1;
+  MaxPortIndex = MinPortIndex + PortId.Data.CompPortCount - 1;
+
+  if ((PortNumber < MinPortIndex) || (PortNumber > MaxPortIndex)) {
+return 0;
+  }
+
   for (Count = 0; Count < PortId.Data.Psic; Count++) {
 Reg.Dword = XhcReadExtCapReg (Xhc, ExtCapOffset + 
XHC_SUPPORTED_PROTOCOL_PSI_OFFSET + (Count << 2));
 if (Reg.Data.Psiv == PortSpeed) {
@@ -685,7 +702,8 @@ XhciPsivGetPsid (
 UINT16
 XhcCheckUsbPortSpeedUsedPsic (
   IN USB_XHCI_INSTANCE  *Xhc,
-  IN UINT8  PortSpeed
+  IN UINT8  PortSpeed,
+  IN UINT8  PortNumber
   )
 {
   XHC_SUPPORTED_PROTOCOL_PROTOCOL_SPEED_ID  SpField;
@@ -703,7 +721,7 @@ XhcCheckUsbPortSpeedUsedPsic (
   // PortSpeed definition when the Major Revision is 03h.
   //
   if (Xhc->Usb3SupOffset != 0x) {
-SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb3SupOffset, PortSpeed);
+SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb3SupOffset, PortSpeed, 
PortNumber);
 if (SpField.Dword != 0) {
   //
   // Found the corresponding PORTSC value in PSIV field of USB3 offset.
@@ -717,7 +735,7 @@ XhcCheckUsbPortSpeedUsedPsic (
   // PortSpeed definition when the Major Revision is 02h.
   //
   if ((UsbSpeedIdMap == 0) && (Xhc->Usb2SupOffset != 0x)) {
-SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb2SupOffset, PortSpeed);
+SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb2SupOf

[edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present

2022-12-09 Thread Sean Rhodes
From: Matt DeVillier 

Only enumerate devices that have media present.

Cc: Hao A Wu 
Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Zhichao Gao 
Cc: Ray Ni 
Reviewed-by: Sean Rhodes 
Signed-off-by: Matt DeVillier 
Change-Id: I78a0b8be3e2f33edce2d43bbdd7670e6174d0ff8
---
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 962892d38f..bde22fa659 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -2218,6 +2218,15 @@ BmEnumerateBootOptions (
 continue;
   }
 
+  //
+  // Skip removable media if not present
+  //
+  if ((BlkIo->Media->RemovableMedia == TRUE) &&
+  (BlkIo->Media->MediaPresent == FALSE))
+  {
+continue;
+  }
+
   Description = BmGetBootDescription (Handles[Index]);
   BootOptions = ReallocatePool (
   sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * 
(*BootOptionCount),
-- 
2.37.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97211): https://edk2.groups.io/g/devel/message/97211
Mute This Topic: https://groups.io/mt/95569301/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 4/4] MdeModulePkg/UsbBusDxe: Adjust the MaxPacketLength to real world values

2022-12-05 Thread Sean Rhodes
Link to PR passing CI - https://github.com/tianocore/edk2/pull/3353

On Mon, 5 Dec 2022 at 09:18, Sean Rhodes via groups.io  wrote:

> Adjusts the requirements for the MaxPacketLength to match what is seen on
> real world devices that do not follow the USB specification.
>
> This fixes enumeration on the multiple USB 3 devices made by SanDisk,
> Integral, Kingston and other generic brands.
>
> Cc: Hao A Wu 
> Cc: Ray Ni 
> Signed-off-by: Sean Rhodes 
> ---
>  MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 11 ---
>  1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> index 62535cad54..043b7d4cea 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> @@ -906,19 +906,16 @@ XhcControlTransfer (
>  return EFI_INVALID_PARAMETER;
>}
>
> -  if ((MaximumPacketLength != 8)  && (MaximumPacketLength != 16) &&
> -  (MaximumPacketLength != 32) && (MaximumPacketLength != 64) &&
> -  (MaximumPacketLength != 512)
> -  )
> -  {
> +  // Check for valid maximum packet size
> +  if ((DeviceSpeed == EFI_USB_SPEED_SUPER) && (MaximumPacketLength >
> 1024)) {
>  return EFI_INVALID_PARAMETER;
>}
>
> -  if ((DeviceSpeed == EFI_USB_SPEED_LOW) && (MaximumPacketLength != 8)) {
> +  if ((DeviceSpeed == EFI_USB_SPEED_HIGH) && (MaximumPacketLength > 512))
> {
>  return EFI_INVALID_PARAMETER;
>}
>
> -  if ((DeviceSpeed == EFI_USB_SPEED_SUPER) && (MaximumPacketLength !=
> 512)) {
> +  if ((DeviceSpeed == EFI_USB_SPEED_FULL) && (MaximumPacketLength > 64)) {
>  return EFI_INVALID_PARAMETER;
>}
>
> --
> 2.37.2
>
>
>
> 
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#96951): https://edk2.groups.io/g/devel/message/96951
> Mute This Topic: https://groups.io/mt/95465401/6718866
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [sean@starlabs.systems]
> 
>
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96954): https://edk2.groups.io/g/devel/message/96954
Mute This Topic: https://groups.io/mt/95465411/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 2/4] MdeModulePkg/XhciDxe/Xhci: Don't check for invalid PSIV

2022-12-05 Thread Sean Rhodes
From: Matt DeVillier 

PSID matching relies on comparing the PSIV against the PortSpeed
value. This patch stops edk2 from checking for a PSIV of 0, as it
is not valid; this reduces the number of register access by
approximately 6 per second.

Cc: Hao A Wu 
Cc: Ray Ni 
Reviewed-by: Sean Rhodes 
Signed-off-by: Matt DeVillier 
Change-Id: If15c55ab66d2e7faa832ce8576d2e5b47157cc9a
---
 MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 44 -
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c 
b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
index c05431ff30..62535cad54 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
@@ -371,6 +371,7 @@ XhcGetRootHubPortStatus (
   UINT32 TotalPort;
   UINTN  Index;
   UINTN  MapSize;
+  UINT8  PortSpeed;
   EFI_STATUS Status;
   USB_DEV_ROUTE  ParentRouteChart;
   EFI_TPLOldTpl;
@@ -397,32 +398,37 @@ XhcGetRootHubPortStatus (
 
   State = XhcReadOpReg (Xhc, Offset);
 
+  PortSpeed = (State & XHC_PORTSC_PS) >> 10;
+
   //
   // According to XHCI 1.1 spec November 2017,
   // Section 7.2 xHCI Support Protocol Capability
   //
-  PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, ((State & 
XHC_PORTSC_PS) >> 10));
-  if (PortStatus->PortStatus == 0) {
-//
-// According to XHCI 1.1 spec November 2017,
-// bit 10~13 of the root port status register identifies the speed of the 
attached device.
-//
-switch ((State & XHC_PORTSC_PS) >> 10) {
-  case 2:
-PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED;
-break;
+  if (PortSpeed > 0) {
+PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, PortSpeed);
+// If no match found in ext cap reg, fall back to PORTSC
+if (PortStatus->PortStatus == 0) {
+  //
+  // According to XHCI 1.1 spec November 2017,
+  // bit 10~13 of the root port status register identifies the speed of 
the attached device.
+  //
+  switch (PortSpeed) {
+case 2:
+  PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED;
+  break;
 
-  case 3:
-PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED;
-break;
+case 3:
+  PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED;
+  break;
 
-  case 4:
-  case 5:
-PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED;
-break;
+case 4:
+case 5:
+  PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED;
+  break;
 
-  default:
-break;
+default:
+  break;
+  }
 }
   }
 
-- 
2.37.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96953): https://edk2.groups.io/g/devel/message/96953
Mute This Topic: https://groups.io/mt/95465403/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 4/4] MdeModulePkg/UsbBusDxe: Adjust the MaxPacketLength to real world values

2022-12-05 Thread Sean Rhodes
Adjusts the requirements for the MaxPacketLength to match what is seen on
real world devices that do not follow the USB specification.

This fixes enumeration on the multiple USB 3 devices made by SanDisk,
Integral, Kingston and other generic brands.

Cc: Hao A Wu 
Cc: Ray Ni 
Signed-off-by: Sean Rhodes 
---
 MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c 
b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
index 62535cad54..043b7d4cea 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
@@ -906,19 +906,16 @@ XhcControlTransfer (
 return EFI_INVALID_PARAMETER;
   }
 
-  if ((MaximumPacketLength != 8)  && (MaximumPacketLength != 16) &&
-  (MaximumPacketLength != 32) && (MaximumPacketLength != 64) &&
-  (MaximumPacketLength != 512)
-  )
-  {
+  // Check for valid maximum packet size
+  if ((DeviceSpeed == EFI_USB_SPEED_SUPER) && (MaximumPacketLength > 1024)) {
 return EFI_INVALID_PARAMETER;
   }
 
-  if ((DeviceSpeed == EFI_USB_SPEED_LOW) && (MaximumPacketLength != 8)) {
+  if ((DeviceSpeed == EFI_USB_SPEED_HIGH) && (MaximumPacketLength > 512)) {
 return EFI_INVALID_PARAMETER;
   }
 
-  if ((DeviceSpeed == EFI_USB_SPEED_SUPER) && (MaximumPacketLength != 512)) {
+  if ((DeviceSpeed == EFI_USB_SPEED_FULL) && (MaximumPacketLength > 64)) {
 return EFI_INVALID_PARAMETER;
   }
 
-- 
2.37.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96951): https://edk2.groups.io/g/devel/message/96951
Mute This Topic: https://groups.io/mt/95465401/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/4] MdeModulePkg/XhciDxe/XhciReg: Handle incorrect PSIV indices

2022-12-05 Thread Sean Rhodes
From: Matt DeVillier 

On some platforms, including Sky Lake and Kaby Lake, the PSIV (Protocol
Speed ID Value) indices are shared between Protocol Speed ID DWORD' in
the extended capabilities registers for both USB2 (Full Speed) and USB3
(Super Speed).

An example can be found below:

XhcCheckUsbPortSpeedUsedPsic: checking for USB2 ext caps
XhciPsivGetPsid: found 3 PSID entries
XhciPsivGetPsid: looking for port speed 1
XhciPsivGetPsid: PSIV 1 PSIE 2 PLT 0 PSIM 12
XhciPsivGetPsid: PSIV 2 PSIE 1 PLT 0 PSIM 1500
XhciPsivGetPsid: PSIV 3 PSIE 2 PLT 0 PSIM 480
XhcCheckUsbPortSpeedUsedPsic: checking for USB3 ext caps
XhciPsivGetPsid: found 3 PSID entries
XhciPsivGetPsid: looking for port speed 1
XhciPsivGetPsid: PSIV 1 PSIE 3 PLT 0 PSIM 5
XhciPsivGetPsid: PSIV 2 PSIE 3 PLT 0 PSIM 10
XhciPsivGetPsid: PSIV 34 PSIE 2 PLT 0 PSIM 1248

The result is edk2 detecting USB2 devices as USB3 devices, which
consequently causes enumeration to fail.

To avoid incorrect detection, check the extended capability registers
for USB2 before USB3. If edk2 finds a match for a USB 2 device, don't
check for USB 3.

Cc: Hao A Wu 
Cc: Ray Ni 
Reviewed-by: Sean Rhodes 
Signed-off-by: Matt DeVillier 
Change-Id: I5bcf32105ce85fda95b4ba98a5e420e8f522374c
---
 MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c | 36 +++---
 MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h |  1 +
 2 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c 
b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
index 2b4a4b2444..c992323443 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
@@ -698,25 +698,11 @@ XhcCheckUsbPortSpeedUsedPsic (
   SpField.Dword = 0;
   UsbSpeedIdMap = 0;
 
-  //
-  // Check xHCI Supported Protocol Capability, find the PSIV field to match
-  // PortSpeed definition when the Major Revision is 03h.
-  //
-  if (Xhc->Usb3SupOffset != 0x) {
-SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb3SupOffset, PortSpeed);
-if (SpField.Dword != 0) {
-  //
-  // Found the corresponding PORTSC value in PSIV field of USB3 offset.
-  //
-  UsbSpeedIdMap = USB_PORT_STAT_SUPER_SPEED;
-}
-  }
-
   //
   // Check xHCI Supported Protocol Capability, find the PSIV field to match
   // PortSpeed definition when the Major Revision is 02h.
   //
-  if ((UsbSpeedIdMap == 0) && (Xhc->Usb2SupOffset != 0x)) {
+  if (Xhc->Usb2SupOffset != 0x) {
 SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb2SupOffset, PortSpeed);
 if (SpField.Dword != 0) {
   //
@@ -733,6 +719,12 @@ XhcCheckUsbPortSpeedUsedPsic (
   // PSIM shows as default High-speed protocol, apply to High-speed 
mapping
   //
   UsbSpeedIdMap = USB_PORT_STAT_HIGH_SPEED;
+} else if (SpField.Data.Psim == 
XHC_SUPPORTED_PROTOCOL_USB2_FULL_SPEED_PSIM) {
+  //
+  // PSIM shows as default Full-speed protocol, return 0
+  // to ensure no port status set
+  //
+  return 0;
 }
   } else if (SpField.Data.Psie == 1) {
 //
@@ -750,6 +742,20 @@ XhcCheckUsbPortSpeedUsedPsic (
 }
   }
 
+  //
+  // Check xHCI Supported Protocol Capability, find the PSIV field to match
+  // PortSpeed definition when the Major Revision is 03h.
+  //
+  if ((UsbSpeedIdMap == 0) && (Xhc->Usb3SupOffset != 0x)) {
+SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb3SupOffset, PortSpeed);
+if (SpField.Dword != 0) {
+  //
+  // Found the corresponding PORTSC value in PSIV field of USB3 offset.
+  //
+  UsbSpeedIdMap = USB_PORT_STAT_SUPER_SPEED;
+}
+  }
+
   return UsbSpeedIdMap;
 }
 
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h 
b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h
index 5fe2ba4f0e..74ac6297ba 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h
@@ -85,6 +85,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #define XHC_SUPPORTED_PROTOCOL_DW2_OFFSET   0x08
 #define XHC_SUPPORTED_PROTOCOL_PSI_OFFSET   0x10
 #define XHC_SUPPORTED_PROTOCOL_USB2_HIGH_SPEED_PSIM 480
+#define XHC_SUPPORTED_PROTOCOL_USB2_FULL_SPEED_PSIM 12
 #define XHC_SUPPORTED_PROTOCOL_USB2_LOW_SPEED_PSIM  1500
 
 #pragma pack (1)
-- 
2.37.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96950): https://edk2.groups.io/g/devel/message/96950
Mute This Topic: https://groups.io/mt/95391831/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 3/4] MdeModulePkg/BmBoot: Skip removable media if it is not present

2022-12-05 Thread Sean Rhodes
From: Matt DeVillier 

Only enumerate devices that have media present.

Cc: Hao A Wu 
Cc: Ray Ni 
Reviewed-by: Sean Rhodes 
Signed-off-by: Matt DeVillier 
Change-Id: I78a0b8be3e2f33edce2d43bbdd7670e6174d0ff8
---
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 962892d38f..bde22fa659 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -2218,6 +2218,15 @@ BmEnumerateBootOptions (
 continue;
   }
 
+  //
+  // Skip removable media if not present
+  //
+  if ((BlkIo->Media->RemovableMedia == TRUE) &&
+  (BlkIo->Media->MediaPresent == FALSE))
+  {
+continue;
+  }
+
   Description = BmGetBootDescription (Handles[Index]);
   BootOptions = ReallocatePool (
   sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * 
(*BootOptionCount),
-- 
2.37.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96952): https://edk2.groups.io/g/devel/message/96952
Mute This Topic: https://groups.io/mt/95465402/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 1/4] MdeModulePkg/XhciDxe/XhciReg: Handle incorrect PSIV indices

2022-12-02 Thread Sean Rhodes
Hi Hao

They are now resolved

Thanks

Sean

On Fri, 2 Dec 2022 at 06:25, Wu, Hao A  wrote:

> Hello,
>
> I saw there are several CI check failures for this 4 patches:
> https://github.com/tianocore/edk2/pull/3702
>
> Could you help to resolve them? Thanks.
>
> Best Regards,
> Hao Wu
>
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Sean
> > Rhodes
> > Sent: Friday, December 2, 2022 4:25 AM
> > To: devel@edk2.groups.io
> > Cc: Matt DeVillier ; Wu, Hao A
> > ; Ni, Ray ; Rhodes, Sean
> > 
> > Subject: [edk2-devel] [PATCH 1/4] MdeModulePkg/XhciDxe/XhciReg: Handle
> > incorrect PSIV indices
> >
> > From: Matt DeVillier 
> >
> > On some platforms, including Sky Lake and Kaby Lake, the PSIV (Protocol
> Speed
> > ID Value) indicesare shared between Protocol Speed ID DWORD' in the
> > extended capabilities registers for both USB2 (Full Speed) and USB3
> (Super
> > Speed).
> >
> > An example can be found below:
> >
> > XhcCheckUsbPortSpeedUsedPsic: checking for USB2 ext caps
> > XhciPsivGetPsid: found 3 PSID entries
> > XhciPsivGetPsid: looking for port speed 1
> > XhciPsivGetPsid: PSIV 1 PSIE 2 PLT 0 PSIM 12
> > XhciPsivGetPsid: PSIV 2 PSIE 1 PLT 0 PSIM 1500
> > XhciPsivGetPsid: PSIV 3 PSIE 2 PLT 0 PSIM 480
> > XhcCheckUsbPortSpeedUsedPsic: checking for USB3 ext caps
> > XhciPsivGetPsid: found 3 PSID entries
> > XhciPsivGetPsid: looking for port speed 1
> > XhciPsivGetPsid: PSIV 1 PSIE 3 PLT 0 PSIM 5
> > XhciPsivGetPsid: PSIV 2 PSIE 3 PLT 0 PSIM 10
> > XhciPsivGetPsid: PSIV 34 PSIE 2 PLT 0 PSIM 1248
> >
> > The result is edk2 detecting USB2 devices as USB3 devices, which
> consequently
> > causes enumeration to fail.
> >
> > To avoid incorrect detection, check the extended capability registers
> for USB2
> > before USB3. If edk2 finds a match for a USB 2 device, don't check for
> USB 3.
> >
> > Cc: Hao A Wu 
> > Cc: Ray Ni 
> > Reviewed-by: Sean Rhodes 
> > Signed-off-by: Matt DeVillier 
> > Change-Id: I5bcf32105ce85fda95b4ba98a5e420e8f522374c
> > ---
> >  MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c | 36 +++---
> > MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h |  1 +
> >  2 files changed, 22 insertions(+), 15 deletions(-)
> >
> > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> > b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> > index 2b4a4b2444..c992323443 100644
> > --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> > @@ -698,25 +698,11 @@ XhcCheckUsbPortSpeedUsedPsic (
> >SpField.Dword = 0;   UsbSpeedIdMap = 0; -  //-  // Check xHCI
> Supported
> > Protocol Capability, find the PSIV field to match-  // PortSpeed
> definition when
> > the Major Revision is 03h.-  //-  if (Xhc->Usb3SupOffset != 0x)
> {-
> > SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb3SupOffset, PortSpeed);-
>   if
> > (SpField.Dword != 0) {-  //-  // Found the corresponding PORTSC
> value in
> > PSIV field of USB3 offset.-  //-  UsbSpeedIdMap =
> > USB_PORT_STAT_SUPER_SPEED;-}-  }-   //   // Check xHCI Supported
> Protocol
> > Capability, find the PSIV field to match   // PortSpeed definition when
> the Major
> > Revision is 02h.   //-  if ((UsbSpeedIdMap == 0) && (Xhc->Usb2SupOffset
> !=
> > 0x)) {+  if (Xhc->Usb2SupOffset != 0x) {
>  SpField.Dword =
> > XhciPsivGetPsid (Xhc, Xhc->Usb2SupOffset, PortSpeed); if
> (SpField.Dword != 0)
> > {   //@@ -733,6 +719,12 @@ XhcCheckUsbPortSpeedUsedPsic (
> >// PSIM shows as default High-speed protocol, apply to
> High-speed
> > mapping   //   UsbSpeedIdMap =
> > USB_PORT_STAT_HIGH_SPEED;+} else if (SpField.Data.Psim ==
> > XHC_SUPPORTED_PROTOCOL_USB2_FULL_SPEED_PSIM) {+  //+  //
> > PSIM shows as default Full-speed protocol, return 0+  // to
> ensure no port
> > status set+  //+  return 0; }   } else if
> (SpField.Data.Psie == 1)
> > { //@@ -750,6 +742,20 @@ XhcCheckUsbPortSpeedUsedPsic (
> >  }   } +  //+  // Check xHCI Supported Protocol Capability, find the
> PSIV field to
> > match+  // PortSpeed definition when the Major Revision is 03h.+  //+  if
> > ((UsbSpeedIdMap == 0) && (Xhc->Usb3SupOffset != 0x)) {+
> > SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb3SupOffset, PortSpeed);+
>   if
>

[edk2-devel] [PATCH 4/4] MdeModulePkg/UsbBusDxe: Adjust the MaxPacketLength to real world values

2022-12-01 Thread Sean Rhodes
Adjusts the requirements for the MaxPacketLength to match what is seen on
real world devices that do not follow the USB specification.

This fixes enumeration on the multiple USB 3 devices made by SanDisk,
Integral, Kingston and other generic brands.

Cc: Hao A Wu 
Cc: Ray Ni 
Signed-off-by: Sean Rhodes 
---
 MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c 
b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
index 51ae57db21..73bfc62512 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
@@ -906,19 +906,16 @@ XhcControlTransfer (
 return EFI_INVALID_PARAMETER;
   }
 
-  if ((MaximumPacketLength != 8)  && (MaximumPacketLength != 16) &&
-  (MaximumPacketLength != 32) && (MaximumPacketLength != 64) &&
-  (MaximumPacketLength != 512)
-  )
-  {
+  // Check for valid maximum packet size
+  if ((DeviceSpeed == EFI_USB_SPEED_SUPER) && (MaximumPacketLength > 1024)) {
 return EFI_INVALID_PARAMETER;
   }
 
-  if ((DeviceSpeed == EFI_USB_SPEED_LOW) && (MaximumPacketLength != 8)) {
+  if ((DeviceSpeed == EFI_USB_SPEED_HIGH) && (MaximumPacketLength > 512)) {
 return EFI_INVALID_PARAMETER;
   }
 
-  if ((DeviceSpeed == EFI_USB_SPEED_SUPER) && (MaximumPacketLength != 512)) {
+  if ((DeviceSpeed == EFI_USB_SPEED_FULL) && (MaximumPacketLength > 64)) {
 return EFI_INVALID_PARAMETER;
   }
 
-- 
2.37.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96841): https://edk2.groups.io/g/devel/message/96841
Mute This Topic: https://groups.io/mt/95391829/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 2/4] MdeModulePkg/XhciDxe/Xhci: Don't check for invalid PSIV

2022-12-01 Thread Sean Rhodes
From: Matt DeVillier 

PSID matching relies on comparing the PSIV against the PortSpeed
value. This patch stops edk2 from checking for a PSIV of 0, as it
is not valid; this reduces the number of register access by
approximately 6 per second.

Cc: Hao A Wu 
Cc: Ray Ni 
Reviewed-by: Sean Rhodes 
Signed-off-by: Matt DeVillier 
Change-Id: If15c55ab66d2e7faa832ce8576d2e5b47157cc9a
---
 MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 44 -
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c 
b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
index c05431ff30..51ae57db21 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
@@ -371,6 +371,7 @@ XhcGetRootHubPortStatus (
   UINT32 TotalPort;
   UINTN  Index;
   UINTN  MapSize;
+  UINTN  PortSpeed;
   EFI_STATUS Status;
   USB_DEV_ROUTE  ParentRouteChart;
   EFI_TPLOldTpl;
@@ -397,32 +398,37 @@ XhcGetRootHubPortStatus (
 
   State = XhcReadOpReg (Xhc, Offset);
 
+  PortSpeed = (State & XHC_PORTSC_PS) >> 10;
+
   //
   // According to XHCI 1.1 spec November 2017,
   // Section 7.2 xHCI Support Protocol Capability
   //
-  PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, ((State & 
XHC_PORTSC_PS) >> 10));
-  if (PortStatus->PortStatus == 0) {
-//
-// According to XHCI 1.1 spec November 2017,
-// bit 10~13 of the root port status register identifies the speed of the 
attached device.
-//
-switch ((State & XHC_PORTSC_PS) >> 10) {
-  case 2:
-PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED;
-break;
+  if (PortSpeed > 0) {
+PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, PortSpeed);
+// If no match found in ext cap reg, fall back to PORTSC
+if (PortStatus->PortStatus == 0) {
+  //
+  // According to XHCI 1.1 spec November 2017,
+  // bit 10~13 of the root port status register identifies the speed of 
the attached device.
+  //
+  switch (PortSpeed) {
+case 2:
+  PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED;
+  break;
 
-  case 3:
-PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED;
-break;
+case 3:
+  PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED;
+  break;
 
-  case 4:
-  case 5:
-PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED;
-break;
+case 4:
+case 5:
+  PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED;
+  break;
 
-  default:
-break;
+default:
+  break;
+  }
 }
   }
 
-- 
2.37.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96844): https://edk2.groups.io/g/devel/message/96844
Mute This Topic: https://groups.io/mt/95391832/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 3/4] MdeModulePkg/BmBoot: Skip removable media if it is not present

2022-12-01 Thread Sean Rhodes
From: Matt DeVillier 

Only enumerate devices that have media present.

Cc: Hao A Wu 
Cc: Ray Ni 
Reviewed-by: Sean Rhodes 
Signed-off-by: Matt DeVillier 
Change-Id: I78a0b8be3e2f33edce2d43bbdd7670e6174d0ff8
---
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 962892d38f..bde22fa659 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -2218,6 +2218,15 @@ BmEnumerateBootOptions (
 continue;
   }
 
+  //
+  // Skip removable media if not present
+  //
+  if ((BlkIo->Media->RemovableMedia == TRUE) &&
+  (BlkIo->Media->MediaPresent == FALSE))
+  {
+continue;
+  }
+
   Description = BmGetBootDescription (Handles[Index]);
   BootOptions = ReallocatePool (
   sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * 
(*BootOptionCount),
-- 
2.37.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96842): https://edk2.groups.io/g/devel/message/96842
Mute This Topic: https://groups.io/mt/95391830/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/4] MdeModulePkg/XhciDxe/XhciReg: Handle incorrect PSIV indices

2022-12-01 Thread Sean Rhodes
From: Matt DeVillier 

On some platforms, including Sky Lake and Kaby Lake, the PSIV (Protocol
Speed ID Value) indicesare shared between Protocol Speed ID DWORD' in
the extended capabilities registers for both USB2 (Full Speed) and USB3
(Super Speed).

An example can be found below:

XhcCheckUsbPortSpeedUsedPsic: checking for USB2 ext caps
XhciPsivGetPsid: found 3 PSID entries
XhciPsivGetPsid: looking for port speed 1
XhciPsivGetPsid: PSIV 1 PSIE 2 PLT 0 PSIM 12
XhciPsivGetPsid: PSIV 2 PSIE 1 PLT 0 PSIM 1500
XhciPsivGetPsid: PSIV 3 PSIE 2 PLT 0 PSIM 480
XhcCheckUsbPortSpeedUsedPsic: checking for USB3 ext caps
XhciPsivGetPsid: found 3 PSID entries
XhciPsivGetPsid: looking for port speed 1
XhciPsivGetPsid: PSIV 1 PSIE 3 PLT 0 PSIM 5
XhciPsivGetPsid: PSIV 2 PSIE 3 PLT 0 PSIM 10
XhciPsivGetPsid: PSIV 34 PSIE 2 PLT 0 PSIM 1248

The result is edk2 detecting USB2 devices as USB3 devices, which
consequently causes enumeration to fail.

To avoid incorrect detection, check the extended capability registers
for USB2 before USB3. If edk2 finds a match for a USB 2 device, don't
check for USB 3.

Cc: Hao A Wu 
Cc: Ray Ni 
Reviewed-by: Sean Rhodes 
Signed-off-by: Matt DeVillier 
Change-Id: I5bcf32105ce85fda95b4ba98a5e420e8f522374c
---
 MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c | 36 +++---
 MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h |  1 +
 2 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c 
b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
index 2b4a4b2444..c992323443 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
@@ -698,25 +698,11 @@ XhcCheckUsbPortSpeedUsedPsic (
   SpField.Dword = 0;
   UsbSpeedIdMap = 0;
 
-  //
-  // Check xHCI Supported Protocol Capability, find the PSIV field to match
-  // PortSpeed definition when the Major Revision is 03h.
-  //
-  if (Xhc->Usb3SupOffset != 0x) {
-SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb3SupOffset, PortSpeed);
-if (SpField.Dword != 0) {
-  //
-  // Found the corresponding PORTSC value in PSIV field of USB3 offset.
-  //
-  UsbSpeedIdMap = USB_PORT_STAT_SUPER_SPEED;
-}
-  }
-
   //
   // Check xHCI Supported Protocol Capability, find the PSIV field to match
   // PortSpeed definition when the Major Revision is 02h.
   //
-  if ((UsbSpeedIdMap == 0) && (Xhc->Usb2SupOffset != 0x)) {
+  if (Xhc->Usb2SupOffset != 0x) {
 SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb2SupOffset, PortSpeed);
 if (SpField.Dword != 0) {
   //
@@ -733,6 +719,12 @@ XhcCheckUsbPortSpeedUsedPsic (
   // PSIM shows as default High-speed protocol, apply to High-speed 
mapping
   //
   UsbSpeedIdMap = USB_PORT_STAT_HIGH_SPEED;
+} else if (SpField.Data.Psim == 
XHC_SUPPORTED_PROTOCOL_USB2_FULL_SPEED_PSIM) {
+  //
+  // PSIM shows as default Full-speed protocol, return 0
+  // to ensure no port status set
+  //
+  return 0;
 }
   } else if (SpField.Data.Psie == 1) {
 //
@@ -750,6 +742,20 @@ XhcCheckUsbPortSpeedUsedPsic (
 }
   }
 
+  //
+  // Check xHCI Supported Protocol Capability, find the PSIV field to match
+  // PortSpeed definition when the Major Revision is 03h.
+  //
+  if ((UsbSpeedIdMap == 0) && (Xhc->Usb3SupOffset != 0x)) {
+SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb3SupOffset, PortSpeed);
+if (SpField.Dword != 0) {
+  //
+  // Found the corresponding PORTSC value in PSIV field of USB3 offset.
+  //
+  UsbSpeedIdMap = USB_PORT_STAT_SUPER_SPEED;
+}
+  }
+
   return UsbSpeedIdMap;
 }
 
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h 
b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h
index 5fe2ba4f0e..74ac6297ba 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h
@@ -85,6 +85,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #define XHC_SUPPORTED_PROTOCOL_DW2_OFFSET   0x08
 #define XHC_SUPPORTED_PROTOCOL_PSI_OFFSET   0x10
 #define XHC_SUPPORTED_PROTOCOL_USB2_HIGH_SPEED_PSIM 480
+#define XHC_SUPPORTED_PROTOCOL_USB2_FULL_SPEED_PSIM 12
 #define XHC_SUPPORTED_PROTOCOL_USB2_LOW_SPEED_PSIM  1500
 
 #pragma pack (1)
-- 
2.37.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96843): https://edk2.groups.io/g/devel/message/96843
Mute This Topic: https://groups.io/mt/95391831/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the position of the Logo

2022-10-26 Thread Sean Rhodes
Hi Mike

This patch is being upstreamed from the coreboot fork; about 70% of the
coreboot community wants the logo centred (as the target OS is not
Windows), and the rest want to use the 38.2% rule!

Thanks

Sean

On Wed, 26 Oct 2022 at 05:55, Kinney, Michael D 
wrote:

> Sean provided a sample PR that adds a PCD.
>
>
>
> I think we agree that a PCD is not required.  The existing logic that
> centers the logo should be updated to use the 38.2% rule.
>
>
>
> Mike
>
>
>
> *From:* Ni, Ray 
> *Sent:* Tuesday, October 25, 2022 7:32 PM
> *To:* Kinney, Michael D ; devel@edk2.groups.io;
> Rhodes, Sean 
> *Cc:* Gao, Zhichao ; Wang, Jian J <
> jian.j.w...@intel.com>; Gao, Liming 
> *Subject:* RE: [edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to
> control the position of the Logo
>
>
>
> Are you suggesting that the exiting logic be updated for this use case
> without adding a new enum?
>
>- yes.
>
>
>
> *From:* Kinney, Michael D 
> *Sent:* Wednesday, October 26, 2022 12:21 AM
> *To:* devel@edk2.groups.io; Ni, Ray ; Rhodes, Sean <
> sean@starlabs.systems>; Kinney, Michael D 
> *Cc:* Gao, Zhichao ; Wang, Jian J <
> jian.j.w...@intel.com>; Gao, Liming 
> *Subject:* RE: [edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to
> control the position of the Logo
>
>
>
> Ray,
>
>
>
> Are you suggesting that the exiting logic be updated for this use case
> without adding a new enum?
>
>
>
> Sean, can you provide a revised patch that does this?
>
>
>
> Thanks,
>
>
>
> Mike
>
>
>
> *From:* devel@edk2.groups.io  *On Behalf Of *Ni, Ray
> *Sent:* Tuesday, October 25, 2022 12:58 AM
> *To:* devel@edk2.groups.io; Rhodes, Sean 
> *Cc:* Gao, Zhichao ; Wang, Jian J <
> jian.j.w...@intel.com>; Gao, Liming 
> *Subject:* Re: [edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to
> control the position of the Logo
>
>
>
> I need a reason of adding
> EdkiiPlatformLogoDisplayAttributeMicrosoftRecommended.
>
> In my opinion, without adding this new enum value, it’s still possible to
> support MS recommendation.
>
>
>
> *From:* devel@edk2.groups.io  *On Behalf Of *Sean
> Rhodes
> *Sent:* Tuesday, October 25, 2022 3:27 PM
> *To:* Ni, Ray 
> *Cc:* devel@edk2.groups.io; Gao, Zhichao ; Wang,
> Jian J ; Gao, Liming 
> *Subject:* Re: [edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to
> control the position of the Logo
>
>
>
> Hi Ray
>
>
>
> Where would you suggest this code goes? edk2 should support both Microsoft
> recommended and "normal". The original patch handled this well.
>
>
>
> Thanks
>
>
>
> Sean
>
>
>
> On Mon, 10 Oct 2022 at 10:25, Ni, Ray  wrote:
>
> The logic I shared below is from the LogoDxe driver which produces
> EDKII_PLATFORM_LOGO_PROTOCOL.
>
> This driver should know the image size and it can account for the image
> size.
>
>
>
> Thanks,
>
> Ray
>
>
>
> *From:* Sean Rhodes 
> *Sent:* Monday, October 10, 2022 4:51 PM
> *To:* Ni, Ray 
> *Cc:* devel@edk2.groups.io; Gao, Zhichao ; Wang,
> Jian J ; Gao, Liming 
> *Subject:* Re: [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the
> position of the Logo
>
>
>
> Hi Ray
>
>
>
> Thank you, it does, and I think it will work for most splash images.
> However, the way it's written in my patch accounts for the Image size. This
> will handle splash images that are equal to, or larger than the resolution
> of the display.
>
>
>
> Thanks
>
>
>
> Sean
>
>
>
> On Sat, 8 Oct 2022 at 03:02, Ni, Ray  wrote:
>
> Sean,
> I remember that I evaluated the BGRT requirement when designing the
> PlatformLogo protocol.
>
> So, I went back to got the code I wrote long time ago as below.
> I didn't try to understand them now. Does it make sense to you?
>
> Status = gBS->HandleProtocol (gST->ConsoleOutHandle,
> , (VOID **) );
> if (!EFI_ERROR (Status)) {
>   //
>   // Center of LOGO is in the vertical position 38.2% when
> PcdBootLogoOnlyEnable is TRUE
>   // Y = (VerticalResolution - LogoHeight) / 2
>   // Y' = VerticalResolution * 0.382 - LogoHeight * 0.5
>   // OffsetY + Y = Y'
>   // OffsetY = Y' - Y = -0.118 * VerticalResolution
>   //
>   *Attribute = EdkiiPlatformLogoDisplayAttributeCenter;
>   *OffsetX   = 0;
>   *OffsetY   = -118 * (INTN)
> GraphicsOutput->Mode->Info->VerticalResolution / 1000;
> }
>
> Thanks,
> Ray
>
> > -Original Message-
> > From: Sean Rhodes 
> > Sent: Monday, September 26, 2022 4:10 PM
> 

Re: [edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the position of the Logo

2022-10-25 Thread Sean Rhodes
Hi Mike/Ray

Thanks - so you mean something like 
https://github.com/tianocore/edk2/pull/3528? ( 
https://github.com/tianocore/edk2/pull/3528 ) (Just for example)

If not, I'm not sure how to control it without the PCD?

Sean


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95565): https://edk2.groups.io/g/devel/message/95565
Mute This Topic: https://groups.io/mt/93922544/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the position of the Logo

2022-10-25 Thread Sean Rhodes
Hi Ray

Where would you suggest this code goes? edk2 should support both Microsoft
recommended and "normal". The original patch handled this well.

Thanks

Sean

On Mon, 10 Oct 2022 at 10:25, Ni, Ray  wrote:

> The logic I shared below is from the LogoDxe driver which produces
> EDKII_PLATFORM_LOGO_PROTOCOL.
>
> This driver should know the image size and it can account for the image
> size.
>
>
>
> Thanks,
>
> Ray
>
>
>
> *From:* Sean Rhodes 
> *Sent:* Monday, October 10, 2022 4:51 PM
> *To:* Ni, Ray 
> *Cc:* devel@edk2.groups.io; Gao, Zhichao ; Wang,
> Jian J ; Gao, Liming 
> *Subject:* Re: [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the
> position of the Logo
>
>
>
> Hi Ray
>
>
>
> Thank you, it does, and I think it will work for most splash images.
> However, the way it's written in my patch accounts for the Image size. This
> will handle splash images that are equal to, or larger than the resolution
> of the display.
>
>
>
> Thanks
>
>
>
> Sean
>
>
>
> On Sat, 8 Oct 2022 at 03:02, Ni, Ray  wrote:
>
> Sean,
> I remember that I evaluated the BGRT requirement when designing the
> PlatformLogo protocol.
>
> So, I went back to got the code I wrote long time ago as below.
> I didn't try to understand them now. Does it make sense to you?
>
> Status = gBS->HandleProtocol (gST->ConsoleOutHandle,
> , (VOID **) );
> if (!EFI_ERROR (Status)) {
>   //
>   // Center of LOGO is in the vertical position 38.2% when
> PcdBootLogoOnlyEnable is TRUE
>   // Y = (VerticalResolution - LogoHeight) / 2
>   // Y' = VerticalResolution * 0.382 - LogoHeight * 0.5
>   // OffsetY + Y = Y'
>   // OffsetY = Y' - Y = -0.118 * VerticalResolution
>   //
>   *Attribute = EdkiiPlatformLogoDisplayAttributeCenter;
>   *OffsetX   = 0;
>   *OffsetY   = -118 * (INTN)
> GraphicsOutput->Mode->Info->VerticalResolution / 1000;
> }
>
> Thanks,
> Ray
>
> > -Original Message-
> > From: Sean Rhodes 
> > Sent: Monday, September 26, 2022 4:10 PM
> > To: devel@edk2.groups.io
> > Cc: Rhodes, Sean ; Gao, Zhichao
> > ; Ni, Ray ; Wang, Jian J
> > ; Gao, Liming 
> > Subject: [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the
> > position of the Logo
> >
> > When set to true, the Logo is positioned according to the BGRT
> > specification, 38.2% from the top of the screen. When set to false,
> > no behaviour is changed and the logo is positioned centrally.
> >
> > Cc: Zhichao Gao 
> > Cc: Ray Ni 
> > Cc: Jian J Wang 
> > Cc: Liming Gao 
> > Signed-off-by: Sean Rhodes 
> > ---
> >  MdeModulePkg/Logo/Logo.c  | 5 +
> >  MdeModulePkg/Logo/LogoDxe.inf | 4 
> >  MdeModulePkg/MdeModulePkg.dec | 6 ++
> >  MdeModulePkg/MdeModulePkg.uni | 6 ++
> >  4 files changed, 21 insertions(+)
> >
> > diff --git a/MdeModulePkg/Logo/Logo.c b/MdeModulePkg/Logo/Logo.c
> > index 8ab874d2da..1638d0f984 100644
> > --- a/MdeModulePkg/Logo/Logo.c
> > +++ b/MdeModulePkg/Logo/Logo.c
> > @@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> >  #include 
> >
> >  #include 
> >
> >  #include 
> >
> > +#include 
> >
> >
> >
> >  typedef struct {
> >
> >EFI_IMAGE_ID ImageId;
> >
> > @@ -69,6 +70,10 @@ GetImage (
> >  return EFI_NOT_FOUND;
> >
> >}
> >
> >
> >
> > +  if (FixedPcdGetBool (PcdFollowMicrosoftRecommended)) {
> >
> > +mLogos[Current].Attribute =
> > EdkiiPlatformLogoDisplayAttributeMicrosoftRecommended;
> >
> > +  }
> >
> > +
> >
> >(*Instance)++;
> >
> >*Attribute = mLogos[Current].Attribute;
> >
> >*OffsetX   = mLogos[Current].OffsetX;
> >
> > diff --git a/MdeModulePkg/Logo/LogoDxe.inf
> > b/MdeModulePkg/Logo/LogoDxe.inf
> > index 41215d25d8..ce29950089 100644
> > --- a/MdeModulePkg/Logo/LogoDxe.inf
> > +++ b/MdeModulePkg/Logo/LogoDxe.inf
> > @@ -41,6 +41,7 @@
> >UefiBootServicesTableLib
> >
> >UefiDriverEntryPoint
> >
> >DebugLib
> >
> > +  PcdLib
> >
> >
> >
> >  [Protocols]
> >
> >gEfiHiiDatabaseProtocolGuid## CONSUMES
> >
> > @@ -48,6 +49,9 @@
> >gEfiHiiPackageListProtocolGuid ## PRODUCES CONSUMES
> >
> >gEdkiiPlatformLogoProtocolGuid ## PRODUCES
> >
> >
> >
> > +[Pcd]
> >

Re: [edk2-devel] [PATCH] Ps2KbdCtrller: Make wait for SUCCESS after BAT non-fatal

2022-10-25 Thread Sean Rhodes
Hi Ray

Done

Thank you

On Tue, 25 Oct 2022 at 07:04, Ni, Ray  wrote:

> Can you update the PR to rebase to latest trunk?
>
> Also please modify commit message to capture Reviewed-by tags.
>
>
>
> *From:* devel@edk2.groups.io  * On Behalf Of *Sheng
> Lean Tan
> *Sent:* Tuesday, October 25, 2022 10:49 AM
> *To:* devel@edk2.groups.io; Tan, Lean Sheng 
> *Subject:* Re: [edk2-devel] [PATCH] Ps2KbdCtrller: Make wait for SUCCESS
> after BAT non-fatal
>
>
>
> Hi Ray please help to merge this if no concerns, thanks.
>
>
>
> On Tue 11. Oct 2022 at 01:50, Sheng Lean Tan via groups.io  9elements@groups.io> wrote:
>
> Thanks Ray for the review.
> FYI Sean has also push the github PR here:
>
> https://github.com/tianocore/edk2/pull/3389
>
> --
>
> Best Regards,
>
> *Lean Sheng Tan*
>
>
> 9elements GmbH, Kortumstraße 19-21, 44787 Bochum, Germany
>
> Email: sheng@9elements.com
>
> Phone: *+49 234 68 94 188 <+492346894188>*
>
> Mobile: *+49 176 76 113842 <+4917676113842>*
>
>
>
> Registered office: Bochum
>
> Commercial register: Amtsgericht Bochum, HRB 17519
>
> Management: Sebastian German, Eray Bazaar
>
>
> Data protection information according to Art. 13 GDPR
> 
>
> 
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95549): https://edk2.groups.io/g/devel/message/95549
Mute This Topic: https://groups.io/mt/89066601/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the position of the Logo

2022-10-10 Thread Sean Rhodes
+ Matt

@Matt DeVillier  Does Ray's code work for you?


On Mon, 10 Oct 2022 at 10:25, Ni, Ray  wrote:

> The logic I shared below is from the LogoDxe driver which produces
> EDKII_PLATFORM_LOGO_PROTOCOL.
>
> This driver should know the image size and it can account for the image
> size.
>
>
>
> Thanks,
>
> Ray
>
>
>
> *From:* Sean Rhodes 
> *Sent:* Monday, October 10, 2022 4:51 PM
> *To:* Ni, Ray 
> *Cc:* devel@edk2.groups.io; Gao, Zhichao ; Wang,
> Jian J ; Gao, Liming 
> *Subject:* Re: [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the
> position of the Logo
>
>
>
> Hi Ray
>
>
>
> Thank you, it does, and I think it will work for most splash images.
> However, the way it's written in my patch accounts for the Image size. This
> will handle splash images that are equal to, or larger than the resolution
> of the display.
>
>
>
> Thanks
>
>
>
> Sean
>
>
>
> On Sat, 8 Oct 2022 at 03:02, Ni, Ray  wrote:
>
> Sean,
> I remember that I evaluated the BGRT requirement when designing the
> PlatformLogo protocol.
>
> So, I went back to got the code I wrote long time ago as below.
> I didn't try to understand them now. Does it make sense to you?
>
> Status = gBS->HandleProtocol (gST->ConsoleOutHandle,
> , (VOID **) );
> if (!EFI_ERROR (Status)) {
>   //
>   // Center of LOGO is in the vertical position 38.2% when
> PcdBootLogoOnlyEnable is TRUE
>   // Y = (VerticalResolution - LogoHeight) / 2
>   // Y' = VerticalResolution * 0.382 - LogoHeight * 0.5
>   // OffsetY + Y = Y'
>   // OffsetY = Y' - Y = -0.118 * VerticalResolution
>   //
>   *Attribute = EdkiiPlatformLogoDisplayAttributeCenter;
>   *OffsetX   = 0;
>   *OffsetY   = -118 * (INTN)
> GraphicsOutput->Mode->Info->VerticalResolution / 1000;
> }
>
> Thanks,
> Ray
>
> > -Original Message-
> > From: Sean Rhodes 
> > Sent: Monday, September 26, 2022 4:10 PM
> > To: devel@edk2.groups.io
> > Cc: Rhodes, Sean ; Gao, Zhichao
> > ; Ni, Ray ; Wang, Jian J
> > ; Gao, Liming 
> > Subject: [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the
> > position of the Logo
> >
> > When set to true, the Logo is positioned according to the BGRT
> > specification, 38.2% from the top of the screen. When set to false,
> > no behaviour is changed and the logo is positioned centrally.
> >
> > Cc: Zhichao Gao 
> > Cc: Ray Ni 
> > Cc: Jian J Wang 
> > Cc: Liming Gao 
> > Signed-off-by: Sean Rhodes 
> > ---
> >  MdeModulePkg/Logo/Logo.c  | 5 +
> >  MdeModulePkg/Logo/LogoDxe.inf | 4 
> >  MdeModulePkg/MdeModulePkg.dec | 6 ++
> >  MdeModulePkg/MdeModulePkg.uni | 6 ++
> >  4 files changed, 21 insertions(+)
> >
> > diff --git a/MdeModulePkg/Logo/Logo.c b/MdeModulePkg/Logo/Logo.c
> > index 8ab874d2da..1638d0f984 100644
> > --- a/MdeModulePkg/Logo/Logo.c
> > +++ b/MdeModulePkg/Logo/Logo.c
> > @@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> >  #include 
> >
> >  #include 
> >
> >  #include 
> >
> > +#include 
> >
> >
> >
> >  typedef struct {
> >
> >EFI_IMAGE_ID ImageId;
> >
> > @@ -69,6 +70,10 @@ GetImage (
> >  return EFI_NOT_FOUND;
> >
> >}
> >
> >
> >
> > +  if (FixedPcdGetBool (PcdFollowMicrosoftRecommended)) {
> >
> > +mLogos[Current].Attribute =
> > EdkiiPlatformLogoDisplayAttributeMicrosoftRecommended;
> >
> > +  }
> >
> > +
> >
> >(*Instance)++;
> >
> >*Attribute = mLogos[Current].Attribute;
> >
> >*OffsetX   = mLogos[Current].OffsetX;
> >
> > diff --git a/MdeModulePkg/Logo/LogoDxe.inf
> > b/MdeModulePkg/Logo/LogoDxe.inf
> > index 41215d25d8..ce29950089 100644
> > --- a/MdeModulePkg/Logo/LogoDxe.inf
> > +++ b/MdeModulePkg/Logo/LogoDxe.inf
> > @@ -41,6 +41,7 @@
> >UefiBootServicesTableLib
> >
> >UefiDriverEntryPoint
> >
> >DebugLib
> >
> > +  PcdLib
> >
> >
> >
> >  [Protocols]
> >
> >gEfiHiiDatabaseProtocolGuid## CONSUMES
> >
> > @@ -48,6 +49,9 @@
> >gEfiHiiPackageListProtocolGuid ## PRODUCES CONSUMES
> >
> >gEdkiiPlatformLogoProtocolGuid ## PRODUCES
> >
> >
> >
> > +[Pcd]
> >
> > +  gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftR

Re: [edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the position of the Logo

2022-10-10 Thread Sean Rhodes
Hi Ray

Thank you, it does, and I think it will work for most splash images.
However, the way it's written in my patch accounts for the Image size. This
will handle splash images that are equal to, or larger than the resolution
of the display.

Thanks

Sean

On Sat, 8 Oct 2022 at 03:02, Ni, Ray  wrote:

> Sean,
> I remember that I evaluated the BGRT requirement when designing the
> PlatformLogo protocol.
>
> So, I went back to got the code I wrote long time ago as below.
> I didn't try to understand them now. Does it make sense to you?
>
> Status = gBS->HandleProtocol (gST->ConsoleOutHandle,
> , (VOID **) );
> if (!EFI_ERROR (Status)) {
>   //
>   // Center of LOGO is in the vertical position 38.2% when
> PcdBootLogoOnlyEnable is TRUE
>   // Y = (VerticalResolution - LogoHeight) / 2
>   // Y' = VerticalResolution * 0.382 - LogoHeight * 0.5
>   // OffsetY + Y = Y'
>   // OffsetY = Y' - Y = -0.118 * VerticalResolution
>   //
>   *Attribute = EdkiiPlatformLogoDisplayAttributeCenter;
>   *OffsetX   = 0;
>   *OffsetY   = -118 * (INTN)
> GraphicsOutput->Mode->Info->VerticalResolution / 1000;
> }
>
> Thanks,
> Ray
>
> > -Original Message-
> > From: Sean Rhodes 
> > Sent: Monday, September 26, 2022 4:10 PM
> > To: devel@edk2.groups.io
> > Cc: Rhodes, Sean ; Gao, Zhichao
> > ; Ni, Ray ; Wang, Jian J
> > ; Gao, Liming 
> > Subject: [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the
> > position of the Logo
> >
> > When set to true, the Logo is positioned according to the BGRT
> > specification, 38.2% from the top of the screen. When set to false,
> > no behaviour is changed and the logo is positioned centrally.
> >
> > Cc: Zhichao Gao 
> > Cc: Ray Ni 
> > Cc: Jian J Wang 
> > Cc: Liming Gao 
> > Signed-off-by: Sean Rhodes 
> > ---
> >  MdeModulePkg/Logo/Logo.c  | 5 +
> >  MdeModulePkg/Logo/LogoDxe.inf | 4 
> >  MdeModulePkg/MdeModulePkg.dec | 6 ++
> >  MdeModulePkg/MdeModulePkg.uni | 6 ++
> >  4 files changed, 21 insertions(+)
> >
> > diff --git a/MdeModulePkg/Logo/Logo.c b/MdeModulePkg/Logo/Logo.c
> > index 8ab874d2da..1638d0f984 100644
> > --- a/MdeModulePkg/Logo/Logo.c
> > +++ b/MdeModulePkg/Logo/Logo.c
> > @@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> >  #include 
> >
> >  #include 
> >
> >  #include 
> >
> > +#include 
> >
> >
> >
> >  typedef struct {
> >
> >EFI_IMAGE_ID ImageId;
> >
> > @@ -69,6 +70,10 @@ GetImage (
> >  return EFI_NOT_FOUND;
> >
> >}
> >
> >
> >
> > +  if (FixedPcdGetBool (PcdFollowMicrosoftRecommended)) {
> >
> > +mLogos[Current].Attribute =
> > EdkiiPlatformLogoDisplayAttributeMicrosoftRecommended;
> >
> > +  }
> >
> > +
> >
> >(*Instance)++;
> >
> >*Attribute = mLogos[Current].Attribute;
> >
> >*OffsetX   = mLogos[Current].OffsetX;
> >
> > diff --git a/MdeModulePkg/Logo/LogoDxe.inf
> > b/MdeModulePkg/Logo/LogoDxe.inf
> > index 41215d25d8..ce29950089 100644
> > --- a/MdeModulePkg/Logo/LogoDxe.inf
> > +++ b/MdeModulePkg/Logo/LogoDxe.inf
> > @@ -41,6 +41,7 @@
> >UefiBootServicesTableLib
> >
> >UefiDriverEntryPoint
> >
> >DebugLib
> >
> > +  PcdLib
> >
> >
> >
> >  [Protocols]
> >
> >gEfiHiiDatabaseProtocolGuid## CONSUMES
> >
> > @@ -48,6 +49,9 @@
> >gEfiHiiPackageListProtocolGuid ## PRODUCES CONSUMES
> >
> >gEdkiiPlatformLogoProtocolGuid ## PRODUCES
> >
> >
> >
> > +[Pcd]
> >
> > +  gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended
> > ## CONSUMES
> >
> > +
> >
> >  [Depex]
> >
> >gEfiHiiDatabaseProtocolGuid AND
> >
> >gEfiHiiImageExProtocolGuid
> >
> > diff --git a/MdeModulePkg/MdeModulePkg.dec
> > b/MdeModulePkg/MdeModulePkg.dec
> > index 58e6ab0048..ac437990f1 100644
> > --- a/MdeModulePkg/MdeModulePkg.dec
> > +++ b/MdeModulePkg/MdeModulePkg.dec
> > @@ -2102,6 +2102,12 @@
> ># @Prompt The shared bit mask when Intel Tdx is enabled.
> >
> >
> > gEfiMdeModulePkgTokenSpaceGuid.PcdTdxSharedBitMask|0x0|UINT64|0x
> > 1025
> >
> >
> >
> > +  ## This PCD sets the position of the Boot Logo.
> >
> > +  #   TRUE  - The Logo is positioned follow

[edk2-devel] [PATCH] UefiPayloadPkg: Make UniversalPayloadBuild.sh executable

2022-10-06 Thread Sean Rhodes
Make the wrapper executable so that it can be built without modification
on Linux.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Sean Rhodes 
---
 UefiPayloadPkg/UniversalPayloadBuild.sh | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 UefiPayloadPkg/UniversalPayloadBuild.sh

diff --git a/UefiPayloadPkg/UniversalPayloadBuild.sh 
b/UefiPayloadPkg/UniversalPayloadBuild.sh
old mode 100644
new mode 100755
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94800): https://edk2.groups.io/g/devel/message/94800
Mute This Topic: https://groups.io/mt/94166357/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 3/3] UefiPayloadPkg: Hook up MICROSOFT_RECOMMENDED macro to PcdFollowMicrosoftRecommended.

2022-09-26 Thread Sean Rhodes
Cc: Guo Dong 
Cc: Ray Ni 
Signed-off-by: Sean Rhodes 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 8f23802199..48b2a650f2 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -43,6 +43,7 @@
   DEFINE SD_MMC_TIMEOUT   = 100
   DEFINE USE_CBMEM_FOR_CONSOLE= FALSE
   DEFINE BOOTSPLASH_IMAGE = FALSE
+  DEFINE MICROSOFT_RECOMMENDED= FALSE
   DEFINE NVME_ENABLE  = TRUE
 
   #
@@ -444,6 +445,7 @@
 
   
gUefiPayloadPkgTokenSpaceGuid.PcdDispatchModuleAbove4GMemory|$(ABOVE_4G_MEMORY)
   gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|$(BOOT_MANAGER_ESCAPE)
+  
gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended|$(MICROSOFT_RECOMMENDED)
 
   gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|180
 
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94319): https://edk2.groups.io/g/devel/message/94319
Mute This Topic: https://groups.io/mt/93922543/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the position of the Logo

2022-09-26 Thread Sean Rhodes
When set to true, the Logo is positioned according to the BGRT
specification, 38.2% from the top of the screen. When set to false,
no behaviour is changed and the logo is positioned centrally.

Cc: Zhichao Gao 
Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: Sean Rhodes 
---
 MdeModulePkg/Logo/Logo.c  | 5 +
 MdeModulePkg/Logo/LogoDxe.inf | 4 
 MdeModulePkg/MdeModulePkg.dec | 6 ++
 MdeModulePkg/MdeModulePkg.uni | 6 ++
 4 files changed, 21 insertions(+)

diff --git a/MdeModulePkg/Logo/Logo.c b/MdeModulePkg/Logo/Logo.c
index 8ab874d2da..1638d0f984 100644
--- a/MdeModulePkg/Logo/Logo.c
+++ b/MdeModulePkg/Logo/Logo.c
@@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 
 typedef struct {
   EFI_IMAGE_ID ImageId;
@@ -69,6 +70,10 @@ GetImage (
 return EFI_NOT_FOUND;
   }
 
+  if (FixedPcdGetBool (PcdFollowMicrosoftRecommended)) {
+mLogos[Current].Attribute = 
EdkiiPlatformLogoDisplayAttributeMicrosoftRecommended;
+  }
+
   (*Instance)++;
   *Attribute = mLogos[Current].Attribute;
   *OffsetX   = mLogos[Current].OffsetX;
diff --git a/MdeModulePkg/Logo/LogoDxe.inf b/MdeModulePkg/Logo/LogoDxe.inf
index 41215d25d8..ce29950089 100644
--- a/MdeModulePkg/Logo/LogoDxe.inf
+++ b/MdeModulePkg/Logo/LogoDxe.inf
@@ -41,6 +41,7 @@
   UefiBootServicesTableLib
   UefiDriverEntryPoint
   DebugLib
+  PcdLib
 
 [Protocols]
   gEfiHiiDatabaseProtocolGuid## CONSUMES
@@ -48,6 +49,9 @@
   gEfiHiiPackageListProtocolGuid ## PRODUCES CONSUMES
   gEdkiiPlatformLogoProtocolGuid ## PRODUCES
 
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended ## CONSUMES
+
 [Depex]
   gEfiHiiDatabaseProtocolGuid AND
   gEfiHiiImageExProtocolGuid
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 58e6ab0048..ac437990f1 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -2102,6 +2102,12 @@
   # @Prompt The shared bit mask when Intel Tdx is enabled.
   gEfiMdeModulePkgTokenSpaceGuid.PcdTdxSharedBitMask|0x0|UINT64|0x1025
 
+  ## This PCD sets the position of the Boot Logo.
+  #   TRUE  - The Logo is positioned following the recommendations from 
Microsoft.
+  #   FALSE - The logo is positioned in the center of the screen.
+  # @ Prompt This position of the boot logo
+  
gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended|FALSE|BOOLEAN|0x1026
+
 [PcdsPatchableInModule]
   ## Specify memory size with page number for PEI code when
   #  Loading Module at Fixed Address feature is enabled.
diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni
index 33ce9f6198..09c1ac1cc1 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
@@ -1338,3 +1338,9 @@
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPcieResizableBarSupport_HELP 
#language en-US "Indicates if the PCIe Resizable BAR Capability 
Supported.\n"

 "TRUE  - PCIe Resizable BAR Capability is supported.\n"

 "FALSE - PCIe Resizable BAR Capability is not supported."
+
+#string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowMicrosoftRecommended_PROMPT 
#language en-US "The position of the Boot Logo"
+
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowMicrosoftRecommend_HELP   
#language en-US "Sets the position of the Logo. When set to true, the Logo is 
positioned following the recommendations"
+   
  " from Microsoft, 38.2% from the top of the screen."
+
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94320): https://edk2.groups.io/g/devel/message/94320
Mute This Topic: https://groups.io/mt/93922544/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/3] MdeModulePkg/BootLogoLib: Add option to follow Microsoft Recommendations

2022-09-26 Thread Sean Rhodes
Add an option to position the logo 38.2% from the top of the screen,
which follows the recommendations from Microsoft. These can be found
here:
https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/boot-screen-components

Cc: Zhichao Gao 
Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: Sean Rhodes 
---
 MdeModulePkg/Include/Protocol/PlatformLogo.h   | 3 ++-
 MdeModulePkg/Library/BootLogoLib/BootLogoLib.c | 7 ---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Include/Protocol/PlatformLogo.h 
b/MdeModulePkg/Include/Protocol/PlatformLogo.h
index 08e1dc35a4..b24d7d5b79 100644
--- a/MdeModulePkg/Include/Protocol/PlatformLogo.h
+++ b/MdeModulePkg/Include/Protocol/PlatformLogo.h
@@ -29,7 +29,8 @@ typedef enum {
   EdkiiPlatformLogoDisplayAttributeCenterBottom,
   EdkiiPlatformLogoDisplayAttributeLeftBottom,
   EdkiiPlatformLogoDisplayAttributeCenterLeft,
-  EdkiiPlatformLogoDisplayAttributeCenter
+  EdkiiPlatformLogoDisplayAttributeCenter,
+  EdkiiPlatformLogoDisplayAttributeMicrosoftRecommended
 } EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE;
 
 /**
diff --git a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c 
b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
index 478ec2d40e..9065e5281b 100644
--- a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
+++ b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
@@ -169,7 +169,6 @@ BootLogoEnableLogo (
 DestX = SizeOfX - Image.Width;
 DestY = 0;
 break;
-
   case EdkiiPlatformLogoDisplayAttributeCenterLeft:
 DestX = 0;
 DestY = (SizeOfY - Image.Height) / 2;
@@ -182,7 +181,6 @@ BootLogoEnableLogo (
 DestX = SizeOfX - Image.Width;
 DestY = (SizeOfY - Image.Height) / 2;
 break;
-
   case EdkiiPlatformLogoDisplayAttributeLeftBottom:
 DestX = 0;
 DestY = SizeOfY - Image.Height;
@@ -195,7 +193,10 @@ BootLogoEnableLogo (
 DestX = SizeOfX - Image.Width;
 DestY = SizeOfY - Image.Height;
 break;
-
+  case EdkiiPlatformLogoDisplayAttributeMicrosoftRecommended:
+DestX = (SizeOfX - Image.Width) / 2;
+DestY = (SizeOfY * 382) / 1000 - Image.Height / 2;
+break;
   default:
 ASSERT (FALSE);
 continue;
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94318): https://edk2.groups.io/g/devel/message/94318
Mute This Topic: https://groups.io/mt/93922542/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/UsbBusDxe: Avoid continuing on error path

2022-09-23 Thread Sean Rhodes
Hi Hao

I retested, and it seems you are correct; the second patch has no effect.
Still, the first is required to resolve the issue -
https://github.com/tianocore/edk2/pull/3353

Maybe it is because enumeration happens with the port status not zero'd?

Thanks

Sean

On Thu, 22 Sept 2022 at 08:30, Wu, Hao A  wrote:

> Hello,
>
>
>
> 1. For “"Avoid continuing on error path" - The reset can happen before
> PortState is zero'd, so running this at the start of the function ensures
> it will”:
>
> My take is that the execution flow is like:
>
> UsbEnumeratePort
>
> Status = HubApi->GetPortStatus (HubIf, Port, );
>
> UsbRootHubGetPortStatus
>
> UsbHcGetRootHubPortStatus
>
> XhcGetRootHubPortStatus
>
> If this is the case, within XhcGetRootHubPortStatus
> (MdeModulePkg\Bus\Pci\XhciDxe\Xhci.c), it does have logic to:
>
>   Offset   = (UINT32)(XHC_PORTSC_OFFSET + (0x10 *
> PortNumber));
>
>   PortStatus->PortStatus   = 0;
>
>   PortStatus->PortChangeStatus = 0;
>
> I am not sure why the below proposed change in UsbEnumeratePort can
> resolve the issue:
>
>   // Zero out PortState in case GetPortStatus does not set it and we
>
>   // continue on the EFI_DEVICE_ERROR path
>
>   PortState.PortStatus   = 0;
>
>   PortState.PortChangeStatus = 0;
>
>
>
> Or the test you are performing includes connecting USB devices on a USB
> Hub?
>
>
>
> 2. For “" Reset the device on error" - this will only attempt enumeration
> if there isn't an error.”:
>
> As I mentioned in reply of that patch, by the code execution reaches the
> change you made:
> if (USB_BIT_IS_SET (PortState.PortChangeStatus, USB_PORT_STAT_C_RESET)
> &&
>
> (Status != EFI_DEVICE_ERROR))
>
> ‘Status’ will always be EFI_SUCCESS, I do not understand what is the point
> of adding “&& (Status != EFI_DEVICE_ERROR)”.
>
> Could you help to double check if the change is really what you want to do?
>
>
>
> Best Regards,
>
> Hao Wu
>
>
>
> *From:* devel@edk2.groups.io  * On Behalf Of *Sean
> Rhodes
> *Sent:* Wednesday, September 21, 2022 4:37 PM
> *To:* Wu, Hao A 
> *Cc:* devel@edk2.groups.io; Ni, Ray 
> *Subject:* Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/UsbBusDxe: Avoid
> continuing on error path
>
>
>
> Hi Hao
>
>
>
> If I just boot a device to the EFI shell and then connect a USB, edk2 will
> constantly try to access the device, fail and reset the port. It won't stop
> doing this, and the USB drive can't be accessed.
>
>
>
> I tested 13 USB drives; 8 saw this problem, and 5 worked correctly. It
> doesn't matter which SOC, or if the port is USB 2.0 or 3.0.
>
>
>
> " Reset the device on error" - this will only attempt enumeration if there
> isn't an error.
>
> "Avoid continuing on error path" - The reset can happen before PortState
> is zero'd, so running this at the start of the function ensures it will
>
>
>
> Hopefully, that makes sense!
>
>
>
> Thanks
>
>
> Sean
>
>
>
>
>
> On Wed, 21 Sept 2022 at 09:24, Wu, Hao A  wrote:
>
> Sorry, could you help to explain more on the endless loop? Like what
> causes the loop and why the proposed change can resolve the issue.
>
> I am not experienced enough in the USB domain to quickly figure out the
> whole picture with only log being provided.
>
>
>
> Best Regards,
>
> Hao Wu
>
>
>
> *From:* Sean Rhodes 
> *Sent:* Wednesday, September 21, 2022 4:01 PM
> *To:* Wu, Hao A 
> *Cc:* devel@edk2.groups.io; Ni, Ray 
> *Subject:* Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/UsbBusDxe: Avoid
> continuing on error path
>
>
>
> Hi Hao
>
>
>
> I've attached a debug log for the problem I'm trying to solve (these two
> patches solve it).
>
>
>
> The reset happens before PortState changes, so it's an endless loop.
>
>
>
> Thanks
>
>
>
> Sean
>
>
>
> On Wed, 21 Sept 2022 at 06:31, Wu, Hao A  wrote:
>
> Sorry, could you help to share more information on what issue is met for
> this proposed patch?
>
> It seems to me that the change made below is to handle the case where:
>
>   Status = HubApi->GetPortStatus (HubIf, Port, );
>
>   if (EFI_ERROR (Status)) {
> DEBUG ((DEBUG_ERROR, "UsbEnumeratePort: failed to get state of port
> %d\n", Port));
> return Status;
>   }
>
> GetPortStatus() returns EFI_ SUCCESS, but does not update the output
> parameter 'PortState'.
> Could you help to check what causes 'PortState' not being updated after a
> success retu

Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/UsbBusDxe: Avoid continuing on error path

2022-09-21 Thread Sean Rhodes
Hi Hao

If I just boot a device to the EFI shell and then connect a USB, edk2 will
constantly try to access the device, fail and reset the port. It won't stop
doing this, and the USB drive can't be accessed.

I tested 13 USB drives; 8 saw this problem, and 5 worked correctly. It
doesn't matter which SOC, or if the port is USB 2.0 or 3.0.

" Reset the device on error" - this will only attempt enumeration if there
isn't an error.
"Avoid continuing on error path" - The reset can happen before PortState is
zero'd, so running this at the start of the function ensures it will

Hopefully, that makes sense!

Thanks

Sean


On Wed, 21 Sept 2022 at 09:24, Wu, Hao A  wrote:

> Sorry, could you help to explain more on the endless loop? Like what
> causes the loop and why the proposed change can resolve the issue.
>
> I am not experienced enough in the USB domain to quickly figure out the
> whole picture with only log being provided.
>
>
>
> Best Regards,
>
> Hao Wu
>
>
>
> *From:* Sean Rhodes 
> *Sent:* Wednesday, September 21, 2022 4:01 PM
> *To:* Wu, Hao A 
> *Cc:* devel@edk2.groups.io; Ni, Ray 
> *Subject:* Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/UsbBusDxe: Avoid
> continuing on error path
>
>
>
> Hi Hao
>
>
>
> I've attached a debug log for the problem I'm trying to solve (these two
> patches solve it).
>
>
>
> The reset happens before PortState changes, so it's an endless loop.
>
>
>
> Thanks
>
>
>
> Sean
>
>
>
> On Wed, 21 Sept 2022 at 06:31, Wu, Hao A  wrote:
>
> Sorry, could you help to share more information on what issue is met for
> this proposed patch?
>
> It seems to me that the change made below is to handle the case where:
>
>   Status = HubApi->GetPortStatus (HubIf, Port, );
>
>   if (EFI_ERROR (Status)) {
> DEBUG ((DEBUG_ERROR, "UsbEnumeratePort: failed to get state of port
> %d\n", Port));
> return Status;
>   }
>
> GetPortStatus() returns EFI_ SUCCESS, but does not update the output
> parameter 'PortState'.
> Could you help to check what causes 'PortState' not being updated after a
> success return from GetPortStatus()? Thanks in advance.
>
> Also, one inline comment below:
>
>
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Sean
> > Rhodes
> > Sent: Tuesday, September 20, 2022 9:14 PM
> > To: devel@edk2.groups.io
> > Cc: Rhodes, Sean ; Wu, Hao A
> > ; Ni, Ray 
> > Subject: [edk2-devel] [PATCH 1/2] MdeModulePkg/UsbBusDxe: Avoid
> > continuing on error path
> >
> > Zero out the PortState in case GetPortStatus didn't set it, to avoid
> > continuing with EFI_DEVICE_ERROR.
> >
> > Cc: Hao A Wu 
> > Cc: Ray Ni 
> > Signed-off-by: Sean Rhodes 
> > ---
> >  MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c | 5 +
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
> > b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
> > index aed34596f4..7fc567898a 100644
> > --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
> > +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
> > @@ -900,6 +900,11 @@ UsbEnumeratePort (
> >Child  = NULL;
> >
> >HubApi = HubIf->HubApi;
> >
> >
> >
> > +  // Zero out PortState in case GetPortStatus does not set it and we
> >
> > +  // continue on the EFI_DEVICE_ERROR path
> >
> > +  PortState.PortStatus   = 0;
> >
> > +  PortState.PortChangeStatus = 0;
>
>
> Could you help to use:
>
>   ZeroMem (, sizeof (EFI_USB_PORT_STATUS));
>
> here to align with other places in this driver?
>
>
> Best Regards,
> Hao Wu
>
>
> >
> > +
> >
> >//
> >
> >// Host learns of the new device by polling the hub for port changes.
> >
> >//
> >
> > --
> > 2.34.1
> >
> >
> >
> > -=-=-=-=-=-=
> > Groups.io Links: You receive all messages sent to this group.
> > View/Reply Online (#93989): https://edk2.groups.io/g/devel/message/93989
> > Mute This Topic: https://groups.io/mt/93802896/1768737
> > Group Owner: devel+ow...@edk2.groups.io
> > Unsubscribe: https://edk2.groups.io/g/devel/unsub [hao.a...@intel.com]
> > -=-=-=-=-=-=
> >
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94060): https://edk2.groups.io/g/devel/message/94060
Mute This Topic: https://groups.io/mt/93802896/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/UsbBusDxe: Avoid continuing on error path

2022-09-21 Thread Sean Rhodes
Hi Hao

I've attached a debug log for the problem I'm trying to solve (these two
patches solve it).

The reset happens before PortState changes, so it's an endless loop.

Thanks

Sean

On Wed, 21 Sept 2022 at 06:31, Wu, Hao A  wrote:

> Sorry, could you help to share more information on what issue is met for
> this proposed patch?
>
> It seems to me that the change made below is to handle the case where:
>
>   Status = HubApi->GetPortStatus (HubIf, Port, );
>
>   if (EFI_ERROR (Status)) {
> DEBUG ((DEBUG_ERROR, "UsbEnumeratePort: failed to get state of port
> %d\n", Port));
> return Status;
>   }
>
> GetPortStatus() returns EFI_ SUCCESS, but does not update the output
> parameter 'PortState'.
> Could you help to check what causes 'PortState' not being updated after a
> success return from GetPortStatus()? Thanks in advance.
>
> Also, one inline comment below:
>
>
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Sean
> > Rhodes
> > Sent: Tuesday, September 20, 2022 9:14 PM
> > To: devel@edk2.groups.io
> > Cc: Rhodes, Sean ; Wu, Hao A
> > ; Ni, Ray 
> > Subject: [edk2-devel] [PATCH 1/2] MdeModulePkg/UsbBusDxe: Avoid
> > continuing on error path
> >
> > Zero out the PortState in case GetPortStatus didn't set it, to avoid
> > continuing with EFI_DEVICE_ERROR.
> >
> > Cc: Hao A Wu 
> > Cc: Ray Ni 
> > Signed-off-by: Sean Rhodes 
> > ---
> >  MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c | 5 +
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
> > b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
> > index aed34596f4..7fc567898a 100644
> > --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
> > +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
> > @@ -900,6 +900,11 @@ UsbEnumeratePort (
> >Child  = NULL;
> >
> >HubApi = HubIf->HubApi;
> >
> >
> >
> > +  // Zero out PortState in case GetPortStatus does not set it and we
> >
> > +  // continue on the EFI_DEVICE_ERROR path
> >
> > +  PortState.PortStatus   = 0;
> >
> > +  PortState.PortChangeStatus = 0;
>
>
> Could you help to use:
>
>   ZeroMem (, sizeof (EFI_USB_PORT_STATUS));
>
> here to align with other places in this driver?
>
>
> Best Regards,
> Hao Wu
>
>
> >
> > +
> >
> >//
> >
> >// Host learns of the new device by polling the hub for port changes.
> >
> >//
> >
> > --
> > 2.34.1
> >
> >
> >
> > -=-=-=-=-=-=
> > Groups.io Links: You receive all messages sent to this group.
> > View/Reply Online (#93989): https://edk2.groups.io/g/devel/message/93989
> > Mute This Topic: https://groups.io/mt/93802896/1768737
> > Group Owner: devel+ow...@edk2.groups.io
> > Unsubscribe: https://edk2.groups.io/g/devel/unsub [hao.a...@intel.com]
> > -=-=-=-=-=-=
> >
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94053): https://edk2.groups.io/g/devel/message/94053
Mute This Topic: https://groups.io/mt/93802896/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


map: No mapping found.
Press ESC in 1 seconds to skip startup.nsh or any other key to continue.
Shell> XhcClearRootHubPortFeature: status Success
UsbEnumeratePort: port 5 state - 801, change - 01 on EB08C98
UsbEnumeratePort: Device Connect/Disconnect Normally (port 5)
UsbEnumeratePort: new device connected at port 5
XhcUsbPortReset!
XhcSetRootHubPortFeature: status Success
XhcClearRootHubPortFeature: status Success
XhcClearRootHubPortFeature: status Success
XhcClearRootHubPortFeature: status Success
XhcSetRootHubPortFeature: status Success
UsbEnumerateNewDev: hub port 5 is reset
UsbEnumerateNewDev: No device present at port 5
XhcClearRootHubPortFeature: status Success
UsbEnumeratePort: port 13 state - 00, change - 01 on EB08C98
UsbEnumeratePort: Device Connect/Disconnect Normally (port 13)
UsbEnumeratePort: device disconnected event on port 13
XhcClearRootHubPortFeature: status Success
UsbEnumeratePort: port 13 state - 00, change - 01 on EB08C98
UsbEnumeratePort: Device Connect/Disconnect Normally (port 13)
UsbEnumeratePort: device disconnected event on port 13
XhcClearRootHubPortFeature: status Success
UsbEnumeratePort: port 13 state - 803, change - 01 on EB08C98
UsbEnumeratePort: Device Connect/Disconnect Normally (port 13)
UsbEnumeratePort: new device connected at port 13
XhcUsbPortReset!
XhcSetRootHubPortFeature: status Success
XhcClearRootHubPortFeature: status Success
XhcC

[edk2-devel] [PATCH 2/2] MdeModulePkg/UsbBusDxe: Reset the device on error

2022-09-20 Thread Sean Rhodes
Try a port reset if GetPortStatus returns and error.

Cc: Hao A Wu 
Cc: Ray Ni 
Signed-off-by: Sean Rhodes 
---
 MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c 
b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
index 7fc567898a..13112be2a5 100644
--- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
+++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
@@ -992,7 +992,9 @@ UsbEnumeratePort (
 // Now, new device connected, enumerate and configure the device
 //
 DEBUG ((DEBUG_INFO, "UsbEnumeratePort: new device connected at port %d\n", 
Port));
-if (USB_BIT_IS_SET (PortState.PortChangeStatus, USB_PORT_STAT_C_RESET)) {
+if (USB_BIT_IS_SET (PortState.PortChangeStatus, USB_PORT_STAT_C_RESET) &&
+(Status != EFI_DEVICE_ERROR))
+{
   Status = UsbEnumerateNewDev (HubIf, Port, FALSE);
 } else {
   Status = UsbEnumerateNewDev (HubIf, Port, TRUE);
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#93990): https://edk2.groups.io/g/devel/message/93990
Mute This Topic: https://groups.io/mt/93802899/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/2] MdeModulePkg/UsbBusDxe: Avoid continuing on error path

2022-09-20 Thread Sean Rhodes
Zero out the PortState in case GetPortStatus didn't set it, to avoid
continuing with EFI_DEVICE_ERROR.

Cc: Hao A Wu 
Cc: Ray Ni 
Signed-off-by: Sean Rhodes 
---
 MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c 
b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
index aed34596f4..7fc567898a 100644
--- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
+++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
@@ -900,6 +900,11 @@ UsbEnumeratePort (
   Child  = NULL;
   HubApi = HubIf->HubApi;
 
+  // Zero out PortState in case GetPortStatus does not set it and we
+  // continue on the EFI_DEVICE_ERROR path
+  PortState.PortStatus   = 0;
+  PortState.PortChangeStatus = 0;
+
   //
   // Host learns of the new device by polling the hub for port changes.
   //
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#93989): https://edk2.groups.io/g/devel/message/93989
Mute This Topic: https://groups.io/mt/93802896/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 3/3] UefiPayloadPkg: Hook up MICROSOFT_RECOMMENDED macro

2022-08-09 Thread Sean Rhodes
Hi Guo

Yes, that's fine with me.

This single patch can be disregarded then.

Thank you

Sean

On Tue, 9 Aug 2022, 06:29 Dong, Guo,  wrote:

>
> Hi Sean,
> How about directly setting the PCD in the build command line instead of
> adding a MACRO?
> Prefer not adding new MACRO if we could avoid it.
>
> Thanks,
> Guo
> -Original Message-
> From: Sean Rhodes 
> Sent: Friday, August 5, 2022 12:53 AM
> To: devel@edk2.groups.io
> Cc: Rhodes, Sean ; Dong, Guo ;
> Ni, Ray 
> Subject: [PATCH 3/3] UefiPayloadPkg: Hook up MICROSOFT_RECOMMENDED macro
>
> Hook up MICROSOFT_RECOMMENDED macro to PcdFollowMicrosoftRecommended.
>
> Cc: Guo Dong 
> Cc: Ray Ni 
> Signed-off-by: Sean Rhodes 
> ---
>  UefiPayloadPkg/UefiPayloadPkg.dsc | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc
> b/UefiPayloadPkg/UefiPayloadPkg.dsc
> index 91cd78dbf1..b3ed0f6a2e 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.dsc
> +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
> @@ -43,6 +43,7 @@
>DEFINE SD_MMC_TIMEOUT   = 100
>
>DEFINE USE_CBMEM_FOR_CONSOLE= FALSE
>
>DEFINE BOOTSPLASH_IMAGE = FALSE
>
> +  DEFINE MICROSOFT_RECOMMENDED= FALSE
>
>
>
>#
>
># NULL:NullMemoryTestDxe
>
> @@ -440,6 +441,7 @@
>
>
>
>  
> gUefiPayloadPkgTokenSpaceGuid.PcdDispatchModuleAbove4GMemory|$(ABOVE_4G_MEMORY)
>
>
>  gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|$(BOOT_MANAGER_ESCAPE)
>
> +
> gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended|$(MICROSOFT_RECOMMENDED)
>
>
>
>gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|180
>
>
>
> --
> 2.34.1
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92240): https://edk2.groups.io/g/devel/message/92240
Mute This Topic: https://groups.io/mt/92830996/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the position of the Logo

2022-08-05 Thread Sean Rhodes
When set to true, the Logo is positioned according to the BGRT
specification, 38.2% from the top of the screen. When set to false,
no behaviour is changed and the logo is positioned centrally.

Cc: Zhichao Gao 
Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: Sean Rhodes 
---
 MdeModulePkg/Logo/Logo.c  | 5 +
 MdeModulePkg/Logo/LogoDxe.inf | 4 
 MdeModulePkg/MdeModulePkg.dec | 6 ++
 MdeModulePkg/MdeModulePkg.uni | 6 ++
 4 files changed, 21 insertions(+)

diff --git a/MdeModulePkg/Logo/Logo.c b/MdeModulePkg/Logo/Logo.c
index 8ab874d2da..1638d0f984 100644
--- a/MdeModulePkg/Logo/Logo.c
+++ b/MdeModulePkg/Logo/Logo.c
@@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 
 typedef struct {
   EFI_IMAGE_ID ImageId;
@@ -69,6 +70,10 @@ GetImage (
 return EFI_NOT_FOUND;
   }
 
+  if (FixedPcdGetBool (PcdFollowMicrosoftRecommended)) {
+mLogos[Current].Attribute = 
EdkiiPlatformLogoDisplayAttributeMicrosoftRecommended;
+  }
+
   (*Instance)++;
   *Attribute = mLogos[Current].Attribute;
   *OffsetX   = mLogos[Current].OffsetX;
diff --git a/MdeModulePkg/Logo/LogoDxe.inf b/MdeModulePkg/Logo/LogoDxe.inf
index 41215d25d8..ce29950089 100644
--- a/MdeModulePkg/Logo/LogoDxe.inf
+++ b/MdeModulePkg/Logo/LogoDxe.inf
@@ -41,6 +41,7 @@
   UefiBootServicesTableLib
   UefiDriverEntryPoint
   DebugLib
+  PcdLib
 
 [Protocols]
   gEfiHiiDatabaseProtocolGuid## CONSUMES
@@ -48,6 +49,9 @@
   gEfiHiiPackageListProtocolGuid ## PRODUCES CONSUMES
   gEdkiiPlatformLogoProtocolGuid ## PRODUCES
 
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended ## CONSUMES
+
 [Depex]
   gEfiHiiDatabaseProtocolGuid AND
   gEfiHiiImageExProtocolGuid
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 7d98910832..a503aaf58d 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -2098,6 +2098,12 @@
   # @Prompt The shared bit mask when Intel Tdx is enabled.
   gEfiMdeModulePkgTokenSpaceGuid.PcdTdxSharedBitMask|0x0|UINT64|0x1025
 
+  ## This PCD sets the position of the Boot Logo.
+  #   TRUE  - The Logo is positioned following the recommendations from 
Microsoft.
+  #   FALSE - The logo is positioned in the center of the screen.
+  # @ Prompt This position of the boot logo
+  
gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended|FALSE|BOOLEAN|0x1026
+
 [PcdsPatchableInModule]
   ## Specify memory size with page number for PEI code when
   #  Loading Module at Fixed Address feature is enabled.
diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni
index b070f15ff2..e7050df7b7 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
@@ -1334,3 +1334,9 @@
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPcieResizableBarSupport_HELP 
#language en-US "Indicates if the PCIe Resizable BAR Capability 
Supported.\n"

 "TRUE  - PCIe Resizable BAR Capability is supported.\n"

 "FALSE - PCIe Resizable BAR Capability is not supported."
+
+#string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowMicrosoftRecommended_PROMPT 
#language en-US "The position of the Boot Logo"
+
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowMicrosoftRecommend_HELP   
#language en-US "Sets the position of the Logo. When set to true, the Logo is 
positioned following the recommendations"
+   
  " from Microsoft, 38.2% from the top of the screen."
+
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92158): https://edk2.groups.io/g/devel/message/92158
Mute This Topic: https://groups.io/mt/92830994/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 3/3] UefiPayloadPkg: Hook up MICROSOFT_RECOMMENDED macro

2022-08-05 Thread Sean Rhodes
Hook up MICROSOFT_RECOMMENDED macro to PcdFollowMicrosoftRecommended.

Cc: Guo Dong 
Cc: Ray Ni 
Signed-off-by: Sean Rhodes 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 91cd78dbf1..b3ed0f6a2e 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -43,6 +43,7 @@
   DEFINE SD_MMC_TIMEOUT   = 100
   DEFINE USE_CBMEM_FOR_CONSOLE= FALSE
   DEFINE BOOTSPLASH_IMAGE = FALSE
+  DEFINE MICROSOFT_RECOMMENDED= FALSE
 
   #
   # NULL:NullMemoryTestDxe
@@ -440,6 +441,7 @@
 
   
gUefiPayloadPkgTokenSpaceGuid.PcdDispatchModuleAbove4GMemory|$(ABOVE_4G_MEMORY)
   gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|$(BOOT_MANAGER_ESCAPE)
+  
gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended|$(MICROSOFT_RECOMMENDED)
 
   gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|180
 
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92160): https://edk2.groups.io/g/devel/message/92160
Mute This Topic: https://groups.io/mt/92830996/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/3] MdeModulePkg/BootLogoLib: Add option to follow Microsoft Recommendations

2022-08-05 Thread Sean Rhodes
Add an option to position the logo 38.2% from the top of the screen,
which follows the recommendations from Microsoft. These can be found
here:
https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/boot-screen-components

Cc: Zhichao Gao 
Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: Sean Rhodes 
---
 MdeModulePkg/Include/Protocol/PlatformLogo.h   | 3 ++-
 MdeModulePkg/Library/BootLogoLib/BootLogoLib.c | 7 ---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Include/Protocol/PlatformLogo.h 
b/MdeModulePkg/Include/Protocol/PlatformLogo.h
index 08e1dc35a4..b24d7d5b79 100644
--- a/MdeModulePkg/Include/Protocol/PlatformLogo.h
+++ b/MdeModulePkg/Include/Protocol/PlatformLogo.h
@@ -29,7 +29,8 @@ typedef enum {
   EdkiiPlatformLogoDisplayAttributeCenterBottom,
   EdkiiPlatformLogoDisplayAttributeLeftBottom,
   EdkiiPlatformLogoDisplayAttributeCenterLeft,
-  EdkiiPlatformLogoDisplayAttributeCenter
+  EdkiiPlatformLogoDisplayAttributeCenter,
+  EdkiiPlatformLogoDisplayAttributeMicrosoftRecommended
 } EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE;
 
 /**
diff --git a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c 
b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
index 478ec2d40e..9065e5281b 100644
--- a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
+++ b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
@@ -169,7 +169,6 @@ BootLogoEnableLogo (
 DestX = SizeOfX - Image.Width;
 DestY = 0;
 break;
-
   case EdkiiPlatformLogoDisplayAttributeCenterLeft:
 DestX = 0;
 DestY = (SizeOfY - Image.Height) / 2;
@@ -182,7 +181,6 @@ BootLogoEnableLogo (
 DestX = SizeOfX - Image.Width;
 DestY = (SizeOfY - Image.Height) / 2;
 break;
-
   case EdkiiPlatformLogoDisplayAttributeLeftBottom:
 DestX = 0;
 DestY = SizeOfY - Image.Height;
@@ -195,7 +193,10 @@ BootLogoEnableLogo (
 DestX = SizeOfX - Image.Width;
 DestY = SizeOfY - Image.Height;
 break;
-
+  case EdkiiPlatformLogoDisplayAttributeMicrosoftRecommended:
+DestX = (SizeOfX - Image.Width) / 2;
+DestY = (SizeOfY * 382) / 1000 - Image.Height / 2;
+break;
   default:
 ASSERT (FALSE);
 continue;
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92159): https://edk2.groups.io/g/devel/message/92159
Mute This Topic: https://groups.io/mt/92830995/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 1/3] MdeModulePkg/BootLogoLib: Add option to follow BGRT specification

2022-08-05 Thread Sean Rhodes
Hi Liming

Microsoft details about positioning can be found here:
https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/boot-screen-components

Thanks

Sean

On Fri, 5 Aug 2022 at 07:00, gaoliming via groups.io  wrote:

> Sean:
>   Can you give BGRT spec link? I want to check the spec description.
>
> Thanks
> Liming
> > -邮件原件-
> > 发件人: devel@edk2.groups.io  代表 Sean Rhodes
> > 发送时间: 2022年7月26日 16:15
> > 收件人: devel@edk2.groups.io
> > 抄送: Sean Rhodes ; Zhichao Gao
> > ; Ray Ni ; Jian J Wang
> > ; Liming Gao 
> > 主题: [edk2-devel] [PATCH 1/3] MdeModulePkg/BootLogoLib: Add option to
> > follow BGRT specification
> >
> > Add an option to position the logo 38.2% from the top of the screen,
> > which follows the BGRT specification.
> >
> > Cc: Zhichao Gao 
> > Cc: Ray Ni 
> > Cc: Jian J Wang 
> > Cc: Liming Gao 
> > Signed-off-by: Sean Rhodes 
> > ---
> >  MdeModulePkg/Include/Protocol/PlatformLogo.h   | 3 ++-
> >  MdeModulePkg/Library/BootLogoLib/BootLogoLib.c | 7 ---
> >  2 files changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/MdeModulePkg/Include/Protocol/PlatformLogo.h
> > b/MdeModulePkg/Include/Protocol/PlatformLogo.h
> > index 08e1dc35a4..7c9ef63c66 100644
> > --- a/MdeModulePkg/Include/Protocol/PlatformLogo.h
> > +++ b/MdeModulePkg/Include/Protocol/PlatformLogo.h
> > @@ -29,7 +29,8 @@ typedef enum {
> >EdkiiPlatformLogoDisplayAttributeCenterBottom,
> >
> >EdkiiPlatformLogoDisplayAttributeLeftBottom,
> >
> >EdkiiPlatformLogoDisplayAttributeCenterLeft,
> >
> > -  EdkiiPlatformLogoDisplayAttributeCenter
> >
> > +  EdkiiPlatformLogoDisplayAttributeCenter,
> >
> > +  EdkiiPlatformLogoDisplayAttributeBGRTSpecification
> >
> >  } EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE;
> >
> >
> >
> >  /**
> >
> > diff --git a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
> > b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
> > index 478ec2d40e..ac086f9c79 100644
> > --- a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
> > +++ b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
> > @@ -169,7 +169,6 @@ BootLogoEnableLogo (
> >  DestX = SizeOfX - Image.Width;
> >
> >  DestY = 0;
> >
> >  break;
> >
> > -
> >
> >case EdkiiPlatformLogoDisplayAttributeCenterLeft:
> >
> >  DestX = 0;
> >
> >  DestY = (SizeOfY - Image.Height) / 2;
> >
> > @@ -182,7 +181,6 @@ BootLogoEnableLogo (
> >  DestX = SizeOfX - Image.Width;
> >
> >  DestY = (SizeOfY - Image.Height) / 2;
> >
> >  break;
> >
> > -
> >
> >case EdkiiPlatformLogoDisplayAttributeLeftBottom:
> >
> >  DestX = 0;
> >
> >  DestY = SizeOfY - Image.Height;
> >
> > @@ -195,7 +193,10 @@ BootLogoEnableLogo (
> >  DestX = SizeOfX - Image.Width;
> >
> >  DestY = SizeOfY - Image.Height;
> >
> >  break;
> >
> > -
> >
> > +  case EdkiiPlatformLogoDisplayAttributeBGRTSpecification:
> >
> > +DestX = (SizeOfX - Image.Width) / 2;
> >
> > +DestY = (SizeOfY * 382) / 1000 - Image.Height / 2;
> >
> > +break;
> >
> >default:
> >
> >  ASSERT (FALSE);
> >
> >  continue;
> >
> > --
> > 2.34.1
> >
> >
> >
> > -=-=-=-=-=-=
> > Groups.io Links: You receive all messages sent to this group.
> > View/Reply Online (#91842): https://edk2.groups.io/g/devel/message/91842
> > Mute This Topic: https://groups.io/mt/92623125/4905953
> > Group Owner: devel+ow...@edk2.groups.io
> > Unsubscribe: https://edk2.groups.io/g/devel/unsub
> > [gaolim...@byosoft.com.cn]
> > -=-=-=-=-=-=
> >
>
>
>
>
>
> 
>
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92154): https://edk2.groups.io/g/devel/message/92154
Mute This Topic: https://groups.io/mt/92830609/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 1/3] MdeModulePkg/BootLogoLib: Add option to follow BGRT specification

2022-08-04 Thread Sean Rhodes
Hi Ray/ Jian/ Liming

Would you be able to review this patch please?

Many thanks

Sean


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92109): https://edk2.groups.io/g/devel/message/92109
Mute This Topic: https://groups.io/mt/92623125/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 2/2] UefiPayloadPkg: Load Boot Logo into ACPI table

2022-08-04 Thread Sean Rhodes
Merged as 444260d45ec2a84e8f8c192b3539a3cd5591d009

On Thu, 4 Aug 2022 at 07:02, Sean Rhodes  wrote:

> Reviewed-by: Sean Rhodes 
>
> On Wed, 3 Aug 2022 at 22:14, Dong, Guo  wrote:
>
>> Reviewed-by: Guo Dong 
>>
>> -Original Message-
>> From: devel@edk2.groups.io  On Behalf Of Sean
>> Rhodes
>> Sent: Tuesday, August 2, 2022 1:00 PM
>> To: devel@edk2.groups.io
>> Cc: Rhodes, Sean ; Dong, Guo ;
>> Ni, Ray 
>> Subject: [edk2-devel] [PATCH 2/2] UefiPayloadPkg: Load Boot Logo into
>> ACPI table
>>
>> If the boot logo is enabled, this will allow edk2 to pass the logo to the
>> OS via ACPI.
>>
>> Cc: Guo Dong 
>> Cc: Ray Ni 
>> Signed-off-by: Sean Rhodes 
>> ---
>>  UefiPayloadPkg/UefiPayloadPkg.dsc | 10 ++
>> UefiPayloadPkg/UefiPayloadPkg.fdf |  4 
>>  2 files changed, 14 insertions(+)
>>
>> diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc
>> b/UefiPayloadPkg/UefiPayloadPkg.dsc
>> index abe1a42709..91cd78dbf1 100644
>> --- a/UefiPayloadPkg/UefiPayloadPkg.dsc
>> +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
>> @@ -300,6 +300,12 @@
>>VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
>>  
>> ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
>> +[LibraryClasses.common]+!if $(BOOTSPLASH_IMAGE)+
>> SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf+
>> BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf+!endif+
>> [LibraryClasses.common.SEC]
>>  HobLib|UefiPayloadPkg/Library/PayloadEntryHobLib/HobLib.inf
>>  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf@@ -679,6
>> +685,10 @@
>># ACPI Support   #
>>  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf+!if
>> $(BOOTSPLASH_IMAGE)+
>> MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf+
>> MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf+!endif
>>   #   # PCI Supportdiff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf
>> b/UefiPayloadPkg/UefiPayloadPkg.fdf
>> index d7c9db191c..27534f445d 100644
>> --- a/UefiPayloadPkg/UefiPayloadPkg.fdf
>> +++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
>> @@ -245,6 +245,10 @@ INF MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
>>  # ACPI Support # INF
>> MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf+!if
>> $(BOOTSPLASH_IMAGE)+INF
>> MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf+INF
>> MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf+!endif
>> # # UEFI network modules--
>> 2.34.1
>>
>>
>>
>> -=-=-=-=-=-=
>> Groups.io Links: You receive all messages sent to this group.
>> View/Reply Online (#92060): https://edk2.groups.io/g/devel/message/92060
>> Mute This Topic: https://groups.io/mt/92779007/1781375
>> Group Owner: devel+ow...@edk2.groups.io
>> Unsubscribe: https://edk2.groups.io/g/devel/unsub [guo.d...@intel.com]
>> -=-=-=-=-=-=
>>
>>
>>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92106): https://edk2.groups.io/g/devel/message/92106
Mute This Topic: https://groups.io/mt/92779007/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 2/2] UefiPayloadPkg: Load Boot Logo into ACPI table

2022-08-04 Thread Sean Rhodes
Reviewed-by: Sean Rhodes 

On Wed, 3 Aug 2022 at 22:14, Dong, Guo  wrote:

> Reviewed-by: Guo Dong 
>
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Sean Rhodes
> Sent: Tuesday, August 2, 2022 1:00 PM
> To: devel@edk2.groups.io
> Cc: Rhodes, Sean ; Dong, Guo ;
> Ni, Ray 
> Subject: [edk2-devel] [PATCH 2/2] UefiPayloadPkg: Load Boot Logo into ACPI
> table
>
> If the boot logo is enabled, this will allow edk2 to pass the logo to the
> OS via ACPI.
>
> Cc: Guo Dong 
> Cc: Ray Ni 
> Signed-off-by: Sean Rhodes 
> ---
>  UefiPayloadPkg/UefiPayloadPkg.dsc | 10 ++
> UefiPayloadPkg/UefiPayloadPkg.fdf |  4 
>  2 files changed, 14 insertions(+)
>
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc
> b/UefiPayloadPkg/UefiPayloadPkg.dsc
> index abe1a42709..91cd78dbf1 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.dsc
> +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
> @@ -300,6 +300,12 @@
>VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
>  
> ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
> +[LibraryClasses.common]+!if $(BOOTSPLASH_IMAGE)+
> SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf+
> BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf+!endif+
> [LibraryClasses.common.SEC]
>  HobLib|UefiPayloadPkg/Library/PayloadEntryHobLib/HobLib.inf
>  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf@@ -679,6 +685,10
> @@
># ACPI Support   #
>  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf+!if
> $(BOOTSPLASH_IMAGE)+
> MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf+
> MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf+!endif
>   #   # PCI Supportdiff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf
> b/UefiPayloadPkg/UefiPayloadPkg.fdf
> index d7c9db191c..27534f445d 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.fdf
> +++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
> @@ -245,6 +245,10 @@ INF MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
>  # ACPI Support # INF
> MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf+!if
> $(BOOTSPLASH_IMAGE)+INF
> MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf+INF
> MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf+!endif
> # # UEFI network modules--
> 2.34.1
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#92060): https://edk2.groups.io/g/devel/message/92060
> Mute This Topic: https://groups.io/mt/92779007/1781375
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [guo.d...@intel.com]
> -=-=-=-=-=-=
>
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92105): https://edk2.groups.io/g/devel/message/92105
Mute This Topic: https://groups.io/mt/92779007/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 1/2] UefiPayloadPkg: Add a Macro to enable Boot Logo

2022-08-04 Thread Sean Rhodes
Merged as 79aab22fcaecf0bd70099e97c92fe3e816e450ce

On Thu, 4 Aug 2022 at 07:01, Sean Rhodes  wrote:

> Reviewed-by: Sean Rhodes 
>
> On Wed, 3 Aug 2022 at 22:14, Guo Dong  wrote:
>
>>
>> Reviewed-by: Guo Dong 
>>
>> -Original Message-
>> From: devel@edk2.groups.io  On Behalf Of Sean
>> Rhodes
>> Sent: Tuesday, August 2, 2022 1:00 PM
>> To: devel@edk2.groups.io
>> Cc: Rhodes, Sean ; Dong, Guo ;
>> Ni, Ray 
>> Subject: [edk2-devel] [PATCH 1/2] UefiPayloadPkg: Add a Macro to enable
>> Boot Logo
>>
>> Add a macro called BOOTSPLASH_IMAGE, which when enabled, will display a
>> logo at boot time.
>>
>> Cc: Guo Dong 
>> Cc: Ray Ni 
>> Signed-off-by: Sean Rhodes 
>> ---
>>  .../Library/PlatformBootManagerLib/PlatformBootManager.c | 9 +
>>  .../PlatformBootManagerLib/PlatformBootManagerLib.inf| 1 +
>>  UefiPayloadPkg/UefiPayloadPkg.dsc| 6 ++
>>  UefiPayloadPkg/UefiPayloadPkg.fdf| 4 
>>  4 files changed, 20 insertions(+)
>>
>> diff --git
>> a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
>> b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
>> index b360e29dfe..a3b98f713d 100644
>> --- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
>> +++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.
>> +++ c
>> @@ -243,6 +243,8 @@ PlatformBootManagerAfterConsole (
>>  {   EFI_GRAPHICS_OUTPUT_BLT_PIXEL  Black;
>>  EFI_GRAPHICS_OUTPUT_BLT_PIXEL  White;+  EDKII_PLATFORM_LOGO_PROTOCOL
>>  *PlatformLogo;+  EFI_STATUS Status;if
>> (mUniversalPayloadPlatformBootManagerOverrideInstance != NULL) {
>>  mUniversalPayloadPlatformBootManagerOverrideInstance->AfterConsole ();@@
>> -252,6 +254,13 @@ PlatformBootManagerAfterConsole (
>>Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;
>>  White.Blue = White.Green = White.Red = White.Reserved = 0xFF; +  Status =
>> gBS->LocateProtocol (, NULL, (VOID
>> **));++  if (!EFI_ERROR (Status)) {+
>> gST->ConOut->ClearScreen (gST->ConOut);+BootLogoEnableLogo ();+  }+
>>  EfiBootManagerConnectAll ();   EfiBootManagerRefreshAllBootOption (); diff
>> --git
>> a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
>> b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
>> index 9f58c460cd..7ec93420f2 100644
>> ---
>> a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
>> +++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerL
>> +++ ib.inf
>> @@ -39,6 +39,7 @@
>>UefiRuntimeServicesTableLib   UefiLib   UefiBootManagerLib+
>> BootLogoLib   PcdLib   DxeServicesLib   MemoryAllocationLibdiff --git
>> a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc
>> index e78e959ce4..abe1a42709 100644
>> --- a/UefiPayloadPkg/UefiPayloadPkg.dsc
>> +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
>> @@ -42,6 +42,7 @@
>>DEFINE CRYPTO_PROTOCOL_SUPPORT  = FALSE   DEFINE SD_MMC_TIMEOUT
>>= 100   DEFINE USE_CBMEM_FOR_CONSOLE= FALSE+  DEFINE
>> BOOTSPLASH_IMAGE = FALSE#   # NULL:NullMemoryTestDxe@@
>> -229,6 +230,7 @@
>>
>>  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
>>  
>> SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
>>  
>> UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf+
>> BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
>>  
>> CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
>>  
>> FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
>> @@ -432,6 +434,7 @@
>>
>> gUefiPayloadPkgTokenSpaceGuid.PcdDispatchModuleAbove4GMemory|$(ABOVE_4G_MEMORY)
>>  gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|$(BOOT_MANAGER_ESCAPE)+
>>  gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|180  !if
>> $(CRYPTO_PROTOCOL_SUPPORT) == TRUE@@ -616,6 +619,9 @@
>>  !endif   UefiCpuPkg/CpuDxe/CpuDxe.inf
>>  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf+!if $(BOOTSPLASH_IMAGE)+
>> MdeModulePkg/Logo/LogoDxe.inf+!endif
>>  MdeModulePkg/Application/UiApp/UiApp.inf { 
>>  NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.infdiff
>> --git a/UefiPayloadPkg/UefiPayloadPkg.fdf
>> b/UefiPayloadPkg/UefiPayloadPkg.fdf
>> index afdd6447a7

Re: [edk2-devel] [PATCH 1/2] UefiPayloadPkg: Add a Macro to enable Boot Logo

2022-08-04 Thread Sean Rhodes
Reviewed-by: Sean Rhodes 

On Wed, 3 Aug 2022 at 22:14, Guo Dong  wrote:

>
> Reviewed-by: Guo Dong 
>
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Sean Rhodes
> Sent: Tuesday, August 2, 2022 1:00 PM
> To: devel@edk2.groups.io
> Cc: Rhodes, Sean ; Dong, Guo ;
> Ni, Ray 
> Subject: [edk2-devel] [PATCH 1/2] UefiPayloadPkg: Add a Macro to enable
> Boot Logo
>
> Add a macro called BOOTSPLASH_IMAGE, which when enabled, will display a
> logo at boot time.
>
> Cc: Guo Dong 
> Cc: Ray Ni 
> Signed-off-by: Sean Rhodes 
> ---
>  .../Library/PlatformBootManagerLib/PlatformBootManager.c | 9 +
>  .../PlatformBootManagerLib/PlatformBootManagerLib.inf| 1 +
>  UefiPayloadPkg/UefiPayloadPkg.dsc| 6 ++
>  UefiPayloadPkg/UefiPayloadPkg.fdf| 4 
>  4 files changed, 20 insertions(+)
>
> diff --git
> a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
> b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
> index b360e29dfe..a3b98f713d 100644
> --- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
> +++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.
> +++ c
> @@ -243,6 +243,8 @@ PlatformBootManagerAfterConsole (
>  {   EFI_GRAPHICS_OUTPUT_BLT_PIXEL  Black;
>  EFI_GRAPHICS_OUTPUT_BLT_PIXEL  White;+  EDKII_PLATFORM_LOGO_PROTOCOL
>  *PlatformLogo;+  EFI_STATUS Status;if
> (mUniversalPayloadPlatformBootManagerOverrideInstance != NULL) {
>  mUniversalPayloadPlatformBootManagerOverrideInstance->AfterConsole ();@@
> -252,6 +254,13 @@ PlatformBootManagerAfterConsole (
>Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;   White.Blue
> = White.Green = White.Red = White.Reserved = 0xFF; +  Status =
> gBS->LocateProtocol (, NULL, (VOID
> **));++  if (!EFI_ERROR (Status)) {+
> gST->ConOut->ClearScreen (gST->ConOut);+BootLogoEnableLogo ();+  }+
>  EfiBootManagerConnectAll ();   EfiBootManagerRefreshAllBootOption (); diff
> --git
> a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
> b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
> index 9f58c460cd..7ec93420f2 100644
> ---
> a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
> +++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerL
> +++ ib.inf
> @@ -39,6 +39,7 @@
>UefiRuntimeServicesTableLib   UefiLib   UefiBootManagerLib+
> BootLogoLib   PcdLib   DxeServicesLib   MemoryAllocationLibdiff --git
> a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc
> index e78e959ce4..abe1a42709 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.dsc
> +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
> @@ -42,6 +42,7 @@
>DEFINE CRYPTO_PROTOCOL_SUPPORT  = FALSE   DEFINE SD_MMC_TIMEOUT
>= 100   DEFINE USE_CBMEM_FOR_CONSOLE= FALSE+  DEFINE
> BOOTSPLASH_IMAGE = FALSE#   # NULL:NullMemoryTestDxe@@
> -229,6 +230,7 @@
>
>  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
>  
> SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
>  
> UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf+
> BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
>  
> CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
>  
> FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
> @@ -432,6 +434,7 @@
>
> gUefiPayloadPkgTokenSpaceGuid.PcdDispatchModuleAbove4GMemory|$(ABOVE_4G_MEMORY)
>  gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|$(BOOT_MANAGER_ESCAPE)+
>  gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|180  !if
> $(CRYPTO_PROTOCOL_SUPPORT) == TRUE@@ -616,6 +619,9 @@
>  !endif   UefiCpuPkg/CpuDxe/CpuDxe.inf
>  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf+!if $(BOOTSPLASH_IMAGE)+
> MdeModulePkg/Logo/LogoDxe.inf+!endif
>  MdeModulePkg/Application/UiApp/UiApp.inf { 
>  NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.infdiff
> --git a/UefiPayloadPkg/UefiPayloadPkg.fdf
> b/UefiPayloadPkg/UefiPayloadPkg.fdf
> index afdd6447a7..d7c9db191c 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.fdf
> +++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
> @@ -165,6 +165,10 @@ INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
>  INF UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf  INF
> MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf+!if $(BOOTSPLASH_IMAGE)+INF
> MdeModulePkg/Logo/LogoDxe.inf+!endif+ # # PCI Support #--
> 2.34.1
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.

[edk2-devel] [PATCH 1/2] UefiPayloadPkg: Add a Macro to enable Boot Logo

2022-08-02 Thread Sean Rhodes
Add a macro called BOOTSPLASH_IMAGE, which when enabled, will
display a logo at boot time.

Cc: Guo Dong 
Cc: Ray Ni 
Signed-off-by: Sean Rhodes 
---
 .../Library/PlatformBootManagerLib/PlatformBootManager.c | 9 +
 .../PlatformBootManagerLib/PlatformBootManagerLib.inf| 1 +
 UefiPayloadPkg/UefiPayloadPkg.dsc| 6 ++
 UefiPayloadPkg/UefiPayloadPkg.fdf| 4 
 4 files changed, 20 insertions(+)

diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index b360e29dfe..a3b98f713d 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
@@ -243,6 +243,8 @@ PlatformBootManagerAfterConsole (
 {
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL  Black;
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL  White;
+  EDKII_PLATFORM_LOGO_PROTOCOL   *PlatformLogo;
+  EFI_STATUS Status;
 
   if (mUniversalPayloadPlatformBootManagerOverrideInstance != NULL) {
 mUniversalPayloadPlatformBootManagerOverrideInstance->AfterConsole ();
@@ -252,6 +254,13 @@ PlatformBootManagerAfterConsole (
   Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;
   White.Blue = White.Green = White.Red = White.Reserved = 0xFF;
 
+  Status = gBS->LocateProtocol (, NULL, (VOID 
**));
+
+  if (!EFI_ERROR (Status)) {
+gST->ConOut->ClearScreen (gST->ConOut);
+BootLogoEnableLogo ();
+  }
+
   EfiBootManagerConnectAll ();
   EfiBootManagerRefreshAllBootOption ();
 
diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 9f58c460cd..7ec93420f2 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -39,6 +39,7 @@
   UefiRuntimeServicesTableLib
   UefiLib
   UefiBootManagerLib
+  BootLogoLib
   PcdLib
   DxeServicesLib
   MemoryAllocationLib
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index e78e959ce4..abe1a42709 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -42,6 +42,7 @@
   DEFINE CRYPTO_PROTOCOL_SUPPORT  = FALSE
   DEFINE SD_MMC_TIMEOUT   = 100
   DEFINE USE_CBMEM_FOR_CONSOLE= FALSE
+  DEFINE BOOTSPLASH_IMAGE = FALSE
 
   #
   # NULL:NullMemoryTestDxe
@@ -229,6 +230,7 @@
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
   
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
   
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
   
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
   
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
 
@@ -432,6 +434,7 @@
 
   
gUefiPayloadPkgTokenSpaceGuid.PcdDispatchModuleAbove4GMemory|$(ABOVE_4G_MEMORY)
   gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|$(BOOT_MANAGER_ESCAPE)
+
   gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|180
 
 !if $(CRYPTO_PROTOCOL_SUPPORT) == TRUE
@@ -616,6 +619,9 @@
 !endif
   UefiCpuPkg/CpuDxe/CpuDxe.inf
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+!if $(BOOTSPLASH_IMAGE)
+  MdeModulePkg/Logo/LogoDxe.inf
+!endif
   MdeModulePkg/Application/UiApp/UiApp.inf {
 
   NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
b/UefiPayloadPkg/UefiPayloadPkg.fdf
index afdd6447a7..d7c9db191c 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -165,6 +165,10 @@ INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
 INF UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf
 
 INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+!if $(BOOTSPLASH_IMAGE)
+INF MdeModulePkg/Logo/LogoDxe.inf
+!endif
+
 #
 # PCI Support
 #
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92059): https://edk2.groups.io/g/devel/message/92059
Mute This Topic: https://groups.io/mt/92779006/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 2/2] UefiPayloadPkg: Load Boot Logo into ACPI table

2022-08-02 Thread Sean Rhodes
If the boot logo is enabled, this will allow edk2 to pass the logo
to the OS via ACPI.

Cc: Guo Dong 
Cc: Ray Ni 
Signed-off-by: Sean Rhodes 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 10 ++
 UefiPayloadPkg/UefiPayloadPkg.fdf |  4 
 2 files changed, 14 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index abe1a42709..91cd78dbf1 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -300,6 +300,12 @@
   VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
   
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
 
+[LibraryClasses.common]
+!if $(BOOTSPLASH_IMAGE)
+  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
+  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
+!endif
+
 [LibraryClasses.common.SEC]
   HobLib|UefiPayloadPkg/Library/PayloadEntryHobLib/HobLib.inf
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
@@ -679,6 +685,10 @@
   # ACPI Support
   #
   MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+!if $(BOOTSPLASH_IMAGE)
+  MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
+  
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
+!endif
 
   #
   # PCI Support
diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
b/UefiPayloadPkg/UefiPayloadPkg.fdf
index d7c9db191c..27534f445d 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -245,6 +245,10 @@ INF MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
 # ACPI Support
 #
 INF  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+!if $(BOOTSPLASH_IMAGE)
+INF  MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
+INF  
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
+!endif
 
 #
 # UEFI network modules
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92060): https://edk2.groups.io/g/devel/message/92060
Mute This Topic: https://groups.io/mt/92779007/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] Recent change in edk2 causing problems with USB, SD and MMC devices

2022-07-26 Thread Sean Rhodes
Hi All

For a large number of boards running coreboot (reported on CML, TGL, ADL,
SKL and APL), a change in the last few months has caused an indefinite hang.

For the last three years, coreboot has used a default value of 1000
for gEfiMdeModulePkgTokenSpaceGuid.PcdSdMmcGenericTimeoutValue, but to
workaround the hang, this value had to be changed to 1.

The new value will get the device booting, but on a smaller selection of
boards, USB devices are not visible to edk2 (either in the EFI Shell, Debug
output or Boot Manager). They function normally in the OS, and the debug
output is below.

I don't suppose anyone would have a hunch as to the cause of this problem?

Many thanks

Sean


XhcGetCapability: 16 ports, 64 bit 1
UsbRootHubInit: root hub E9E3F18 - max speed 3, 16 ports
XhcClearRootHubPortFeature: status Success
UsbEnumeratePort: port 4 state - 801, change - 01 on E9E3F18
UsbEnumeratePort: Device Connect/Disconnect Normally
UsbEnumeratePort: new device connected at port 4
XhcUsbPortReset!
XhcSetRootHubPortFeature: status Success
XhcClearRootHubPortFeature: status Success
XhcClearRootHubPortFeature: status Success
Enable Slot Successfully, The Slot ID = 0x1
Address 1 assigned successfully
UsbEnumerateNewDev: hub port 4 is reset
UsbEnumerateNewDev: device is of 3 speed
UsbEnumerateNewDev: device uses translator (0, 0)
UsbEnumerateNewDev: device is now ADDRESSED at 1
UsbEnumerateNewDev: max packet size for EP 0 is 64
UsbBuildDescTable: failed to get device descriptor - Invalid Parameter
UsbEnumerateNewDev: failed to build descriptor table - Invalid Parameter
XhcClearRootHubPortFeature: status Success
UsbEnumeratePort: port 5 state - 801, change - 01 on E9E3F18
UsbEnumeratePort: Device Connect/Disconnect Normally
UsbEnumeratePort: new device connected at port 5
XhcUsbPortReset!
XhcSetRootHubPortFeature: status Success
XhcClearRootHubPortFeature: status Success
XhcClearRootHubPortFeature: status Success
Enable Slot Successfully, The Slot ID = 0x2
Address 2 assigned successfully
UsbEnumerateNewDev: hub port 5 is reset
UsbEnumerateNewDev: device is of 3 speed
UsbEnumerateNewDev: device uses translator (0, 0)
UsbEnumerateNewDev: device is now ADDRESSED at 2
UsbEnumerateNewDev: max packet size for EP 0 is 64
UsbBuildDescTable: failed to get device descriptor - Invalid Parameter
UsbEnumerateNewDev: failed to build descriptor table - Invalid Parameter
XhcClearRootHubPortFeature: status Success
UsbEnumeratePort: port 6 state - 801, change - 01 on E9E3F18
UsbEnumeratePort: Device Connect/Disconnect Normally
UsbEnumeratePort: new device connected at port 6
XhcUsbPortReset!
XhcSetRootHubPortFeature: status Success
XhcClearRootHubPortFeature: status Success
XhcClearRootHubPortFeature: status Success
Enable Slot Successfully, The Slot ID = 0x3
Address 3 assigned successfully
UsbEnumerateNewDev: hub port 6 is reset
UsbEnumerateNewDev: device is of 3 speed
UsbEnumerateNewDev: device uses translator (0, 0)
UsbEnumerateNewDev: device is now ADDRESSED at 3
UsbEnumerateNewDev: max packet size for EP 0 is 64
UsbBuildDescTable: failed to get device descriptor - Invalid Parameter
UsbEnumerateNewDev: failed to build descriptor table - Invalid Parameter
XhcClearRootHubPortFeature: status Success
UsbEnumeratePort: port 8 state - 801, change - 01 on E9E3F18
UsbEnumeratePort: Device Connect/Disconnect Normally
UsbEnumeratePort: new device connected at port 8
XhcUsbPortReset!
XhcSetRootHubPortFeature: status Success
XhcClearRootHubPortFeature: status Success
XhcClearRootHubPortFeature: status Success
Enable Slot Successfully, The Slot ID = 0x4
Address 4 assigned successfully
UsbEnumerateNewDev: hub port 8 is reset
UsbEnumerateNewDev: device is of 3 speed
UsbEnumerateNewDev: device uses translator (0, 0)
UsbEnumerateNewDev: device is now ADDRESSED at 4
UsbEnumerateNewDev: max packet size for EP 0 is 64
UsbBuildDescTable: failed to get device descriptor - Invalid Parameter
UsbEnumerateNewDev: failed to build descriptor table - Invalid Parameter
UsbBusStart: usb bus started on EAEB818, root hub E9E3F18


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91865): https://edk2.groups.io/g/devel/message/91865
Mute This Topic: https://groups.io/mt/92638373/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the position of the Logo

2022-07-26 Thread Sean Rhodes
When set to true, the Logo is positioned according to the BGRT
specification, 38.2% from the top of the screen. When set to false,
no behaviour is changed and the logo is positioned centrally.

Cc: Zhichao Gao 
Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: Sean Rhodes 
---
 MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf | 5 -
 MdeModulePkg/Logo/Logo.c | 5 +
 MdeModulePkg/Logo/LogoDxe.inf| 4 
 MdeModulePkg/MdeModulePkg.dec| 6 ++
 MdeModulePkg/MdeModulePkg.uni| 6 ++
 5 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf 
b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
index 7d50f2dfa3..14ba8a5906 100644
--- a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
+++ b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
@@ -48,5 +48,8 @@
   gEfiUserManagerProtocolGuid   ## CONSUMES
   gEdkiiPlatformLogoProtocolGuid## CONSUMES
 
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFollowBGRTSpecification ## CONSUMES
+
 [FeaturePcd]
-  gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport ## CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport ## CONSUMES
diff --git a/MdeModulePkg/Logo/Logo.c b/MdeModulePkg/Logo/Logo.c
index 8ab874d2da..73546b32f4 100644
--- a/MdeModulePkg/Logo/Logo.c
+++ b/MdeModulePkg/Logo/Logo.c
@@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 
 typedef struct {
   EFI_IMAGE_ID ImageId;
@@ -69,6 +70,10 @@ GetImage (
 return EFI_NOT_FOUND;
   }
 
+  if (FixedPcdGetBool (PcdFollowBGRTSpecification)) {
+mLogos[Current].Attribute = 
EdkiiPlatformLogoDisplayAttributeBGRTSpecification;
+  }
+
   (*Instance)++;
   *Attribute = mLogos[Current].Attribute;
   *OffsetX   = mLogos[Current].OffsetX;
diff --git a/MdeModulePkg/Logo/LogoDxe.inf b/MdeModulePkg/Logo/LogoDxe.inf
index 41215d25d8..c5c8ad0bcf 100644
--- a/MdeModulePkg/Logo/LogoDxe.inf
+++ b/MdeModulePkg/Logo/LogoDxe.inf
@@ -41,6 +41,7 @@
   UefiBootServicesTableLib
   UefiDriverEntryPoint
   DebugLib
+  PcdLib
 
 [Protocols]
   gEfiHiiDatabaseProtocolGuid## CONSUMES
@@ -48,6 +49,9 @@
   gEfiHiiPackageListProtocolGuid ## PRODUCES CONSUMES
   gEdkiiPlatformLogoProtocolGuid ## PRODUCES
 
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFollowBGRTSpecification ## CONSUMES
+
 [Depex]
   gEfiHiiDatabaseProtocolGuid AND
   gEfiHiiImageExProtocolGuid
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 2bcb9f9453..e09918387c 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -2095,6 +2095,12 @@
   # @Prompt The shared bit mask when Intel Tdx is enabled.
   gEfiMdeModulePkgTokenSpaceGuid.PcdTdxSharedBitMask|0x0|UINT64|0x1025
 
+  ## This PCD sets the position of the Boot Logo.
+  #   TRUE  - The Logo is positioned according to the BGRT specification.
+  #   FALSE - The logo is positioned in the center of the screen.
+  # @ Prompt This position of the boot logo
+  
gEfiMdeModulePkgTokenSpaceGuid.PcdFollowBGRTSpecification|FALSE|BOOLEAN|0x1026
+
 [PcdsPatchableInModule]
   ## Specify memory size with page number for PEI code when
   #  Loading Module at Fixed Address feature is enabled.
diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni
index b070f15ff2..c6ff7bc1bd 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
@@ -1334,3 +1334,9 @@
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPcieResizableBarSupport_HELP 
#language en-US "Indicates if the PCIe Resizable BAR Capability 
Supported.\n"

 "TRUE  - PCIe Resizable BAR Capability is supported.\n"

 "FALSE - PCIe Resizable BAR Capability is not supported."
+
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowBGRTSpecification_PROMPT 
#language en-US "The position of the Boot Logo"
+
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowBGRTSpecification_HELP   
#language en-US "Sets the position of the Logo. When set to true, the Logo is 
positioned according to the"
+   
  " BGRT specification, 38.2% from the top of the screen."
+
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91841): https://edk2.groups.io/g/devel/message/91841
Mute This Topic: https://groups.io/mt/92623124/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/3] MdeModulePkg/BootLogoLib: Add option to follow BGRT specification

2022-07-26 Thread Sean Rhodes
Add an option to position the logo 38.2% from the top of the screen,
which follows the BGRT specification.

Cc: Zhichao Gao 
Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: Sean Rhodes 
---
 MdeModulePkg/Include/Protocol/PlatformLogo.h   | 3 ++-
 MdeModulePkg/Library/BootLogoLib/BootLogoLib.c | 7 ---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Include/Protocol/PlatformLogo.h 
b/MdeModulePkg/Include/Protocol/PlatformLogo.h
index 08e1dc35a4..7c9ef63c66 100644
--- a/MdeModulePkg/Include/Protocol/PlatformLogo.h
+++ b/MdeModulePkg/Include/Protocol/PlatformLogo.h
@@ -29,7 +29,8 @@ typedef enum {
   EdkiiPlatformLogoDisplayAttributeCenterBottom,
   EdkiiPlatformLogoDisplayAttributeLeftBottom,
   EdkiiPlatformLogoDisplayAttributeCenterLeft,
-  EdkiiPlatformLogoDisplayAttributeCenter
+  EdkiiPlatformLogoDisplayAttributeCenter,
+  EdkiiPlatformLogoDisplayAttributeBGRTSpecification
 } EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE;
 
 /**
diff --git a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c 
b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
index 478ec2d40e..ac086f9c79 100644
--- a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
+++ b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
@@ -169,7 +169,6 @@ BootLogoEnableLogo (
 DestX = SizeOfX - Image.Width;
 DestY = 0;
 break;
-
   case EdkiiPlatformLogoDisplayAttributeCenterLeft:
 DestX = 0;
 DestY = (SizeOfY - Image.Height) / 2;
@@ -182,7 +181,6 @@ BootLogoEnableLogo (
 DestX = SizeOfX - Image.Width;
 DestY = (SizeOfY - Image.Height) / 2;
 break;
-
   case EdkiiPlatformLogoDisplayAttributeLeftBottom:
 DestX = 0;
 DestY = SizeOfY - Image.Height;
@@ -195,7 +193,10 @@ BootLogoEnableLogo (
 DestX = SizeOfX - Image.Width;
 DestY = SizeOfY - Image.Height;
 break;
-
+  case EdkiiPlatformLogoDisplayAttributeBGRTSpecification:
+DestX = (SizeOfX - Image.Width) / 2;
+DestY = (SizeOfY * 382) / 1000 - Image.Height / 2;
+break;
   default:
 ASSERT (FALSE);
 continue;
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91842): https://edk2.groups.io/g/devel/message/91842
Mute This Topic: https://groups.io/mt/92623125/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 3/3] UefiPayloadPkg: Hook up FOLLOW_BGRT_SPEC macro

2022-07-26 Thread Sean Rhodes
Hook up FOLLOW_BGRT_SPEC macro to PcdFollowBGRTSpecification.

Cc: Guo Dong 
Cc: Ray Ni 
Signed-off-by: Sean Rhodes 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 862d440b16..dbfa750c3b 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -41,6 +41,7 @@
   DEFINE PS2_MOUSE_ENABLE = TRUE
   DEFINE CRYPTO_PROTOCOL_SUPPORT  = FALSE
   DEFINE SD_MMC_TIMEOUT   = 100
+  DEFINE FOLLOW_BGRT_SPEC = FALSE
 
   #
   # NULL:NullMemoryTestDxe
@@ -425,6 +426,7 @@
 
   
gUefiPayloadPkgTokenSpaceGuid.PcdDispatchModuleAbove4GMemory|$(ABOVE_4G_MEMORY)
   gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|$(BOOT_MANAGER_ESCAPE)
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFollowBGRTSpecification|$(FOLLOW_BGRT_SPEC)
   gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|180
 
 !if $(CRYPTO_PROTOCOL_SUPPORT) == TRUE
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91840): https://edk2.groups.io/g/devel/message/91840
Mute This Topic: https://groups.io/mt/92623123/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [Patch 2/3] Maintainers.txt: Add missing github ids

2022-07-21 Thread Sean Rhodes
Reviewed-by: Sean Rhodes 

On Wed, 20 Jul 2022 at 22:58, Michael D Kinney 
wrote:

> Cc: Andrew Fish 
> Cc: Leif Lindholm 
> Cc: Daniel Schaefer 
> Cc: Sean Rhodes 
> Cc: Debkumar De 
> Cc: Erdem Aktas 
> Signed-off-by: Michael D Kinney 
> ---
>  Maintainers.txt | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/Maintainers.txt b/Maintainers.txt
> index 3ddb6805dbce..5a87bc116647 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -100,7 +100,7 @@ M: Ard Biesheuvel 
> [ardbiesheuvel]
>  RISCV64
>  F: */RiscV64/
>  M: Abner Chang  [changab]
> -R: Daniel Schaefer 
> +R: Daniel Schaefer  [JohnAZoidberg]
>
>  EDK II Continuous Integration:
>  --
> @@ -371,7 +371,7 @@ MdeModulePkg: Pei Core
>  F: MdeModulePkg/Core/Pei/
>  R: Dandan Bi  [dandanbi]
>  R: Liming Gao  [lgao4]
> -R: Debkumar De 
> +R: Debkumar De  [dde01]
>  R: Harry Han 
>  R: Catharine West  [catharine-intl]
>
> @@ -474,7 +474,7 @@ F: OvmfPkg/PlatformPei/AmdSev.c
>  F: OvmfPkg/ResetVector/
>  F: OvmfPkg/Sec/
>  R: Brijesh Singh  [codomania]
> -R: Erdem Aktas 
> +R: Erdem Aktas  [ruleof2]
>  R: James Bottomley  [jejb]
>  R: Jiewen Yao  [jyao1]
>  R: Min Xu  [mxu9]
> @@ -602,7 +602,7 @@ R: Rahul Kumar  [rahul1-kumar]
>  UefiCpuPkg: Sec related modules
>  F: UefiCpuPkg/SecCore/
>  F: UefiCpuPkg/ResetVector/
> -R: Debkumar De 
> +R: Debkumar De  [dde01]
>  R: Harry Han 
>  R: Catharine West  [catharine-intl]
>
> @@ -611,7 +611,7 @@ F: UefiPayloadPkg/
>  W: https://github.com/tianocore/tianocore.github.io/wiki/UefiPayloadPkg
>  M: Guo Dong  [gdong1]
>  M: Ray Ni  [niruiyu]
> -M: Sean Rhodes 
> +M: Sean Rhodes  [Sean-StarLabs]
>  S: Maintained
>
>  UnitTestFrameworkPkg
> --
> 2.32.0.windows.1
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91677): https://edk2.groups.io/g/devel/message/91677
Mute This Topic: https://groups.io/mt/92515277/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/2] UefiPayloadPkg: Enable Boot Logo

2022-07-20 Thread Sean Rhodes
Cc: Guo Dong 
Cc: Ray Ni 
Signed-off-by: Sean Rhodes 
---
 .../Library/PlatformBootManagerLib/PlatformBootManager.c| 5 +
 .../PlatformBootManagerLib/PlatformBootManagerLib.inf   | 1 +
 UefiPayloadPkg/UefiPayloadPkg.dsc   | 6 ++
 UefiPayloadPkg/UefiPayloadPkg.fdf   | 4 
 4 files changed, 16 insertions(+)

diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index b360e29dfe..2fadd3f130 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
@@ -252,6 +252,11 @@ PlatformBootManagerAfterConsole (
   Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;
   White.Blue = White.Green = White.Red = White.Reserved = 0xFF;
 
+  if () {
+gST->ConOut->ClearScreen (gST->ConOut);
+BootLogoEnableLogo ();
+  }
+
   EfiBootManagerConnectAll ();
   EfiBootManagerRefreshAllBootOption ();
 
diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 9f58c460cd..7ec93420f2 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -39,6 +39,7 @@
   UefiRuntimeServicesTableLib
   UefiLib
   UefiBootManagerLib
+  BootLogoLib
   PcdLib
   DxeServicesLib
   MemoryAllocationLib
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 5e947526b7..bdafe8ae99 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -40,6 +40,7 @@
   DEFINE SD_ENABLE= TRUE
   DEFINE PS2_MOUSE_ENABLE = TRUE
   DEFINE SD_MMC_TIMEOUT   = 100
+  DEFINE BOOTSPLASH_IMAGE = FALSE
 
   #
   # NULL:NullMemoryTestDxe
@@ -221,6 +222,7 @@
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
   
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
   
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
   
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
   
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
 
@@ -419,6 +421,7 @@
 
   
gUefiPayloadPkgTokenSpaceGuid.PcdDispatchModuleAbove4GMemory|$(ABOVE_4G_MEMORY)
   gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|$(BOOT_MANAGER_ESCAPE)
+
   gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|180
 
   gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.HmacSha256.Family   
 | PCD_CRYPTO_SERVICE_ENABLE_FAMILY
@@ -593,6 +596,9 @@
 !endif
   UefiCpuPkg/CpuDxe/CpuDxe.inf
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+!if $(BOOTSPLASH_IMAGE)
+  MdeModulePkg/Logo/LogoDxe.inf
+!endif
   MdeModulePkg/Application/UiApp/UiApp.inf {
 
   NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
b/UefiPayloadPkg/UefiPayloadPkg.fdf
index 5c055e61b3..6d54bb0e13 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -163,6 +163,10 @@ INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
 INF UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf
 
 INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+!if $(BOOTSPLASH_IMAGE)
+INF MdeModulePkg/Logo/LogoDxe.inf
+!endif
+
 #
 # PCI Support
 #
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91571): https://edk2.groups.io/g/devel/message/91571
Mute This Topic: https://groups.io/mt/92500759/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 2/2] UefiPayloadPkg: Load Boot Logo into ACPI table

2022-07-20 Thread Sean Rhodes
This will allow the OS to display the logo whilst booting.

Cc: Guo Dong 
Cc: Ray Ni 
Signed-off-by: Sean Rhodes 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 6 ++
 UefiPayloadPkg/UefiPayloadPkg.fdf | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index bdafe8ae99..f9459f24f8 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -287,6 +287,10 @@
   VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
   
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
 
+[LibraryClasses.common]
+  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
+  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
+
 [LibraryClasses.common.SEC]
   HobLib|UefiPayloadPkg/Library/PayloadEntryHobLib/HobLib.inf
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
@@ -656,6 +660,8 @@
   # ACPI Support
   #
   MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+  MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
+  
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
 
   #
   # PCI Support
diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
b/UefiPayloadPkg/UefiPayloadPkg.fdf
index 6d54bb0e13..e6970fceae 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -243,6 +243,8 @@ INF MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
 # ACPI Support
 #
 INF  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+INF  MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
+INF  
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
 
 #
 # UEFI network modules
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91572): https://edk2.groups.io/g/devel/message/91572
Mute This Topic: https://groups.io/mt/92500760/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel][PATCH] Maintainers.txt: Add new reviewer for UefiPayloadPkg

2022-07-15 Thread Sean Rhodes
Reviewed-by: Sean Rhodes 

On Sat, 16 Jul 2022, 03:37 Benjamin You,  wrote:

> Reviewed-by: Benjamin You 
>
> > -Original Message-
> > From: Dong, Guo 
> > Sent: Saturday, July 16, 2022 9:02 AM
> > To: devel@edk2.groups.io
> > Cc: Dong, Guo ; Ni, Ray ; You,
> > Benjamin ; Maurice Ma ;
> > Kinney, Michael D ; Rhodes, Sean
> > 
> > Subject: [edk2-devel][PATCH] Maintainers.txt: Add new reviewer for
> > UefiPayloadPkg
> >
> > From: Guo Dong 
> >
> > Promote Sean Rhodes as UefiPayloadPkg maintainer.
> > Remove Maurice and Benjamin since their role was changed.
> >
> > Signed-off-by: Guo Dong 
> > Cc: Ray Ni 
> > Cc: Benjamin You 
> > Cc: Maurice Ma 
> > Cc: Michael D Kinney 
> > Cc: Sean Rhodes 
> > ---
> >  Maintainers.txt | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/Maintainers.txt b/Maintainers.txt
> > index bc08ce1f15..a3b62abeee 100644
> > --- a/Maintainers.txt
> > +++ b/Maintainers.txt
> > @@ -612,9 +612,7 @@ F: UefiPayloadPkg/
> >  W: https://github.com/tianocore/tianocore.github.io/wiki/UefiPayloadPkg
> >
> >  M: Guo Dong  [gdong1]
> >
> >  M: Ray Ni  [niruiyu]
> >
> > -R: Maurice Ma  [mauricema]
> >
> > -R: Benjamin You  [BenjaminYou]
> >
> > -R: Sean Rhodes 
> >
> > +M: Sean Rhodes 
> >
> >  S: Maintained
> >
> >
> >
> >  UnitTestFrameworkPkg
> >
> > --
> > 2.35.1.windows.2
>
>
>
> 
>
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91427): https://edk2.groups.io/g/devel/message/91427
Mute This Topic: https://groups.io/mt/92413853/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] UefiPayloadPkg: Set console rows and columns to 100

2022-07-12 Thread Sean Rhodes
This patch can be disregarded as the --pcd build option will be integrated into 
the coreboot build process.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91229): https://edk2.groups.io/g/devel/message/91229
Mute This Topic: https://groups.io/mt/92120219/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] UefiPayloadPkg: Hook up PCIE_BASE build option

2022-07-12 Thread Sean Rhodes
This patch can be disregarded as the --pcd build option will be integrated into 
the coreboot build process.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91228): https://edk2.groups.io/g/devel/message/91228
Mute This Topic: https://groups.io/mt/92160855/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 0/2] Boot Logo Support

2022-07-10 Thread Sean Rhodes
These two patches add support to show a Boot Logo, and load the logo
into the BGRT table.

This should ideally be handled by the bootloader, but in the case of
coreboot, the current framebuffer implementation to display images is;
11-years old, considered broken and can only handle jpg images.

Therefore, leverage edk2 existing support for this until coreboot can
handle this on it's own.

Sean Rhodes (2):
  UefiPayloadPkg: Enable Boot Logo
  UefiPayloadPkg: Load Boot Logo into ACPI table

 .../Library/PlatformBootManagerLib/PlatformBootManager.c | 3 +++
 .../PlatformBootManagerLib/PlatformBootManagerLib.inf| 1 +
 UefiPayloadPkg/UefiPayloadPkg.dsc| 5 +
 UefiPayloadPkg/UefiPayloadPkg.fdf| 3 +++
 4 files changed, 12 insertions(+)

-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91206): https://edk2.groups.io/g/devel/message/91206
Mute This Topic: https://groups.io/mt/92295567/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 2/2] UefiPayloadPkg: Load Boot Logo into ACPI table

2022-07-10 Thread Sean Rhodes
This will allow the OS to display the logo whilst booting.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Maurice Ma 
Cc: Benjamin You 
Signed-off-by: Sean Rhodes 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 3 +++
 UefiPayloadPkg/UefiPayloadPkg.fdf | 1 +
 2 files changed, 4 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 7d390ac8eb..42d170772d 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -276,6 +276,8 @@
   
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
   VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
   
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
+  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
+  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
 
 [LibraryClasses.common.SEC]
   HobLib|UefiPayloadPkg/Library/PayloadEntryHobLib/HobLib.inf
@@ -616,6 +618,7 @@
   # ACPI Support
   #
   MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+  
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
 
   #
   # PCI Support
diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
b/UefiPayloadPkg/UefiPayloadPkg.fdf
index 2beef7ba10..e07aca774e 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -230,6 +230,7 @@ INF MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
 # ACPI Support
 #
 INF  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+INF  
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
 
 #
 # UEFI network modules
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91208): https://edk2.groups.io/g/devel/message/91208
Mute This Topic: https://groups.io/mt/92295569/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/2] UefiPayloadPkg: Enable Boot Logo

2022-07-10 Thread Sean Rhodes
Cc: Guo Dong 
Cc: Ray Ni 
Cc: Maurice Ma 
Cc: Benjamin You 
Signed-off-by: Sean Rhodes 
---
 .../Library/PlatformBootManagerLib/PlatformBootManager.c   | 3 +++
 .../Library/PlatformBootManagerLib/PlatformBootManagerLib.inf  | 1 +
 UefiPayloadPkg/UefiPayloadPkg.dsc  | 2 ++
 UefiPayloadPkg/UefiPayloadPkg.fdf  | 2 ++
 4 files changed, 8 insertions(+)

diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index 0eb577313a..93f7776fbc 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
@@ -252,6 +252,9 @@ PlatformBootManagerAfterConsole (
   Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;
   White.Blue = White.Green = White.Red = White.Reserved = 0xFF;
 
+  gST->ConOut->ClearScreen (gST->ConOut);
+  BootLogoEnableLogo ();
+
   EfiBootManagerConnectAll ();
   EfiBootManagerRefreshAllBootOption ();
 
diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 9f58c460cd..7ec93420f2 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -39,6 +39,7 @@
   UefiRuntimeServicesTableLib
   UefiLib
   UefiBootManagerLib
+  BootLogoLib
   PcdLib
   DxeServicesLib
   MemoryAllocationLib
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index cfcf38578d..7d390ac8eb 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -212,6 +212,7 @@
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
   
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
   
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
   
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
   
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
 
@@ -561,6 +562,7 @@
 !endif
   UefiCpuPkg/CpuDxe/CpuDxe.inf
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+  MdeModulePkg/Logo/LogoDxe.inf
   MdeModulePkg/Application/UiApp/UiApp.inf {
 
   NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
b/UefiPayloadPkg/UefiPayloadPkg.fdf
index c7b04978ad..2beef7ba10 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -158,6 +158,8 @@ INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
 INF UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf
 
 INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+INF MdeModulePkg/Logo/LogoDxe.inf
+
 #
 # PCI Support
 #
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91207): https://edk2.groups.io/g/devel/message/91207
Mute This Topic: https://groups.io/mt/92295568/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] How to get FrontPage to fill screen

2022-07-05 Thread Sean Rhodes
Hi Liming

Thanks - I managed to get it working with two patches:
https://edk2.groups.io/g/devel/message/91046
https://review.coreboot.org/c/coreboot/+/65643

Sean


On Tue, 5 Jul 2022 at 01:56, gaoliming via groups.io  wrote:

> Please try below setting.
>
>
>
>   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn | 128
>
>   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow | 40
>
>   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution | 1024
>
>   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution | 768
>
>
>
> Thanks
>
> Liming
>
> *发件人:* devel@edk2.groups.io  *代表 *Sean Rhodes
> *发送时间:* 2022年7月5日 2:44
> *收件人:* Gerd Hoffmann 
> *抄送:* devel@edk2.groups.io
> *主题:* Re: [edk2-devel] How to get FrontPage to fill screen
>
>
>
> Hi Gerd
>
>
>
> Thank you very much :)
>
>
>
>
>
> On Mon, 4 Jul 2022 at 10:40, Gerd Hoffmann  wrote:
>
> On Mon, Jul 04, 2022 at 10:03:40AM +0100, Sean Rhodes wrote:
> > Hi
> >
> > Would anyone have any suggestions on getting the Front Page to fill the
> > screen? As far as I can see, configuring the below PCDs should allow it
> to
> > fill the screen - which is being correctly detected as 1920x1080.
>
> Depends on whenever the system has a serial console or not ...
>
> ConSplitterDxe uses the intersection of all outputs as final list of
> supported text modes.
>
> > However, it ends up in a rather strange shape:
> > [image: UiApp.jpg]
>
> 80x50?
>
> take care,
>   Gerd
>
> 
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91061): https://edk2.groups.io/g/devel/message/91061
Mute This Topic: https://groups.io/mt/92181096/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] UefiPayloadPkg: Hook up PCIE_BASE build option

2022-07-04 Thread Sean Rhodes
Hook up PCIE_BASE to PcdPciExpressBaseAddress

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Maurice Ma 
Cc: Benjamin You 
Signed-off-by: Sean Rhodes 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index cfcf38578d..d8afb28d13 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -33,6 +33,8 @@
   DEFINE UNIVERSAL_PAYLOAD= FALSE
   DEFINE SECURITY_STUB_ENABLE = TRUE
   DEFINE SMM_SUPPORT  = FALSE
+  DEFINE PCIE_BASE_ADDRESS= 0
+  DEFINE PCIE_BASE_LENGTH = 0
   DEFINE PLATFORM_BOOT_TIMEOUT= 3
   DEFINE ABOVE_4G_MEMORY  = TRUE
   DEFINE BOOT_MANAGER_ESCAPE  = FALSE
@@ -506,8 +508,8 @@
 
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|31
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|100
-  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0
-  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseSize|0
+  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|$(PCIE_BASE_ADDRESS)
+  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseSize|$(PCIE_BASE_LENGTH)
   gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbBase|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed|FALSE
   gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled|0
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91047): https://edk2.groups.io/g/devel/message/91047
Mute This Topic: https://groups.io/mt/92160855/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 3/3] UefiPayloadPkg/PlatformBootManagerLib: Correct spacing in boot prompt

2022-07-04 Thread Sean Rhodes
Cc: Guo Dong 
Cc: Ray Ni 
Cc: Maurice Ma 
Cc: Benjamin You 
Signed-off-by: Sean Rhodes 
---
 .../Library/PlatformBootManagerLib/PlatformBootManager.c| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index b360e29dfe..9364a5683d 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
@@ -264,7 +264,7 @@ PlatformBootManagerAfterConsole (
 Print (
   L"\n"
   L"Esc or Down  to enter Boot Manager Menu.\n"
-  L"ENTER   to boot directly.\n"
+  L"ENTERto boot directly.\n"
   L"\n"
   );
   } else {
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91045): https://edk2.groups.io/g/devel/message/91045
Mute This Topic: https://groups.io/mt/92172170/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 2/3] UefiPayloadPkg/PlatformBootManagerLib: Evenly space boot prompt

2022-07-04 Thread Sean Rhodes
Add 4 spaces before the boot prompt "F2 or Down..." so that the
spacing is equadistant from the top, which is spaced with a `\n`,
and the left.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Maurice Ma 
Cc: Benjamin You 
Signed-off-by: Sean Rhodes 
---
 .../Library/PlatformBootManagerLib/PlatformBootManager.c  | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index 0eb577313a..b360e29dfe 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
@@ -263,15 +263,15 @@ PlatformBootManagerAfterConsole (
   if (FixedPcdGetBool (PcdBootManagerEscape)) {
 Print (
   L"\n"
-  L"Esc or Down  to enter Boot Manager Menu.\n"
-  L"ENTER   to boot directly.\n"
+  L"Esc or Down  to enter Boot Manager Menu.\n"
+  L"ENTER   to boot directly.\n"
   L"\n"
   );
   } else {
 Print (
   L"\n"
-  L"F2 or Down  to enter Boot Manager Menu.\n"
-  L"ENTER   to boot directly.\n"
+  L"F2 or Down  to enter Boot Manager Menu.\n"
+  L"ENTER   to boot directly.\n"
   L"\n"
   );
   }
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91044): https://edk2.groups.io/g/devel/message/91044
Mute This Topic: https://groups.io/mt/92172169/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/3] UefiPayloadPkg: Allow full screen setup mode

2022-07-04 Thread Sean Rhodes
Set PCDs ConOutRow, ConOutColumn, SetupConOutRow and SetupConOutColumn
to 0 to allow front page to full the screen.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Maurice Ma 
Cc: Benjamin You 
Signed-off-by: Sean Rhodes 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index cfcf38578d..0923f9f1fa 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -504,8 +504,10 @@
   ## The PCD is used to specify the video vertical resolution of text setup.
   gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|0
 
-  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|31
-  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|100
+  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|0
+  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|0
+  gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow|0
+  gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutColumn|0
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseSize|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbBase|0
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91046): https://edk2.groups.io/g/devel/message/91046
Mute This Topic: https://groups.io/mt/92172172/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] How to get FrontPage to fill screen

2022-07-04 Thread Sean Rhodes
Hi Gerd

Thank you very much :)


On Mon, 4 Jul 2022 at 10:40, Gerd Hoffmann  wrote:

> On Mon, Jul 04, 2022 at 10:03:40AM +0100, Sean Rhodes wrote:
> > Hi
> >
> > Would anyone have any suggestions on getting the Front Page to fill the
> > screen? As far as I can see, configuring the below PCDs should allow it
> to
> > fill the screen - which is being correctly detected as 1920x1080.
>
> Depends on whenever the system has a serial console or not ...
>
> ConSplitterDxe uses the intersection of all outputs as final list of
> supported text modes.
>
> > However, it ends up in a rather strange shape:
> > [image: UiApp.jpg]
>
> 80x50?
>
> take care,
>   Gerd
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91043): https://edk2.groups.io/g/devel/message/91043
Mute This Topic: https://groups.io/mt/92161443/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] UefiPayloadPkg: Hook up PCIE_BASE build option

2022-07-04 Thread Sean Rhodes
Hook up PCIE_BASE to PcdPciExpressBaseAddress

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Maurice Ma 
Cc: Benjamin You 
Signed-off-by: Sean Rhodes 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index cfcf38578d..0de87bd6bd 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -33,6 +33,7 @@
   DEFINE UNIVERSAL_PAYLOAD= FALSE
   DEFINE SECURITY_STUB_ENABLE = TRUE
   DEFINE SMM_SUPPORT  = FALSE
+  DEFINE PCIE_BASE= 0
   DEFINE PLATFORM_BOOT_TIMEOUT= 3
   DEFINE ABOVE_4G_MEMORY  = TRUE
   DEFINE BOOT_MANAGER_ESCAPE  = FALSE
@@ -506,7 +507,7 @@
 
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|31
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|100
-  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0
+  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|$(PCIE_BASE)
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseSize|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbBase|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed|FALSE
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91024): https://edk2.groups.io/g/devel/message/91024
Mute This Topic: https://groups.io/mt/92160855/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] UefiPayloadPkg: Set console rows and columns to 100

2022-07-01 Thread Sean Rhodes
Set the Pcd's relating to console to 100 to make UiApp fill the
display

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Maurice Ma 
Cc: Benjamin You 
Signed-off-by: Sean Rhodes 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index cfcf38578d..3896d64397 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -504,7 +504,9 @@
   ## The PCD is used to specify the video vertical resolution of text setup.
   gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|0
 
-  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|31
+  gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutColumn|100
+  gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow|100
+  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|100
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|100
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseSize|0
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91007): https://edk2.groups.io/g/devel/message/91007
Mute This Topic: https://groups.io/mt/92120219/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v3] UefiPayloadPkg: Add support for logging to CBMEM console

2022-06-09 Thread Sean Rhodes
Reviewed-by: Sean Rhodes 

On Wed, 8 Jun 2022 at 16:05, Lean Sheng Tan  wrote:

> Reviewed-by: Lean Sheng Tan 
>
>
>
> On Mon, 6 Jun 2022 at 02:56, Benjamin Doron 
> wrote:
>
>> Writes TianoCore debug logs into the CBMEM console ringbuffer, from
>> where the user can retrieve them with the `cbmem` userspace utility.
>>
>> The intention is to aid in debugging non-fatal issues even in release
>> builds, or simply make TianoCore's logs available to those interested.
>> Consequently, MDEPKG_NDEBUG must be masked. As an in-memory debug
>> logging library, ASSERTs must be non-fatal to be seen, so they neither
>> dead-loop nor create a breakpoint. It is assumed that ASSERT() neither
>> enforces fatal conditions nor security integrity, as release builds do
>> not call DebugAssert() from the ASSERT macro.
>>
>> More detailed debug logs are produced with the DEBUG_CODE macro, but
>> this guards other debug-related code throughout the codebase. To avoid
>> changing behaviour on release builds, this is only set for debug builds.
>>
>> Tested on QEMU, dumping the appropriate memory region in the UEFI shell
>> shows the TianoCore log. An improved revision of the debug library used
>> in several coreboot-related EDK2 forks, including MrChromebox's.
>> Previous revisions also tested on an Acer Aspire VN7-572G laptop.
>>
>> Cc: Guo Dong 
>> Cc: Ray Ni 
>> Cc: Maurice Ma 
>> Cc: Benjamin You 
>> Cc: Sean Rhodes 
>> Signed-off-by: Benjamin Doron 
>> ---
>>  UefiPayloadPkg/Include/Coreboot.h  |  13 +
>>  UefiPayloadPkg/Library/CbSerialPortLib/CbSerialPortLib.c   | 264
>> 
>>  UefiPayloadPkg/Library/CbSerialPortLib/CbSerialPortLib.inf |  30 +++
>>  UefiPayloadPkg/UefiPayloadPkg.dsc  |  25 +-
>>  4 files changed, 327 insertions(+), 5 deletions(-)
>>
>> diff --git a/UefiPayloadPkg/Include/Coreboot.h
>> b/UefiPayloadPkg/Include/Coreboot.h
>> index a3e1109fe84e..5892fae7682b 100644
>> --- a/UefiPayloadPkg/Include/Coreboot.h
>> +++ b/UefiPayloadPkg/Include/Coreboot.h
>> @@ -199,6 +199,13 @@ struct cb_forward {
>>UINT64forward;
>>  };
>>
>> +struct cb_cbmem_ref {
>> +  UINT32tag;
>> +  // Field contains size of this struct = 0x0010
>> +  UINT32size;
>> +  UINT64cbmem_addr;
>> +};
>> +
>>  #define CB_TAG_FRAMEBUFFER  0x0012
>>  struct cb_framebuffer {
>>UINT32tag;
>> @@ -229,6 +236,12 @@ struct cb_vdat {
>>
>>  #define CB_TAG_TIMESTAMPS 0x0016
>>  #define CB_TAG_CBMEM_CONSOLE  0x0017
>> +struct cbmem_console {
>> +  UINT32 size;
>> +  UINT32 cursor;
>> +  UINT8  body[0];
>> +} __attribute__((packed));
>> +
>>  #define CB_TAG_MRC_CACHE  0x0018
>>  struct cb_cbmem_tab {
>>UINT32tag;
>> diff --git a/UefiPayloadPkg/Library/CbSerialPortLib/CbSerialPortLib.c
>> b/UefiPayloadPkg/Library/CbSerialPortLib/CbSerialPortLib.c
>> new file mode 100644
>> index ..863fbcfef2f0
>> --- /dev/null
>> +++ b/UefiPayloadPkg/Library/CbSerialPortLib/CbSerialPortLib.c
>> @@ -0,0 +1,264 @@
>> +/** @file
>> +  CBMEM console SerialPortLib instance
>> +
>> +  Copyright (c) 2022, Baruch Binyamin Doron
>> +  SPDX-License-Identifier: BSD-2-Clause-Patent
>> +
>> +**/
>> +
>> +#include 
>> +#include 
>> +
>> +#include 
>> +#include 
>> +#include 
>> +
>> +// Upper nibble contains flags
>> +#define CBMC_CURSOR_MASK ((1 << 28) - 1)
>> +#define CBMC_OVERFLOW (1 << 31)
>> +
>> +STATIC struct cbmem_console  *mCbConsole = NULL;
>> +
>> +/**
>> +  Find coreboot record with given Tag.
>> +  NOTE: This coreboot-specific function definition is absent
>> + from the common BlParseLib header.
>> +
>> +  @param  TagThe tag id to be found
>> +
>> +  @retval NULL  The Tag is not found.
>> +  @retval OthersThe pointer to the record found.
>> +
>> +**/
>> +VOID *
>> +FindCbTag (
>> +  IN  UINT32 Tag
>> +  );
>> +
>> +/**
>> +  Initialize the serial device hardware.
>> +
>> +  If no initialization is required, then return RETURN_SUCCESS.
>> +  If the serial device was successfully initialized, then return
>> RETURN_SUCCESS.
>> +  If the serial device could not be initialized, then return
>> RETURN_DEVICE_ERROR.
>> +
>> +  @retval RETURN_SUCCESSThe serial device w

Re: [edk2-devel] [PATCH v2] UefiPayloadPkg: Add support for logging to CBMEM console

2022-05-26 Thread Sean Rhodes
Reviewed-by: Sean Rhodes 


On Sun, 22 May 2022 at 19:47, Benjamin Doron 
wrote:

> Writes TianoCore debug logs into the CBMEM console ringbuffer, from
> where the user can retrieve them with the `cbmem` userspace utility.
>
> The intention is to aid in debugging non-fatal issues even in release
> builds, or simply make TianoCore's logs available to those interested.
> Consequently, MDEPKG_NDEBUG must be masked. As an in-memory debug
> logging library, ASSERTs must be non-fatal to be seen, so they neither
> dead-loop nor create a breakpoint. It is assumed that ASSERT() neither
> enforces fatal conditions nor security integrity, as release builds do
> not call DebugAssert() from the ASSERT macro.
>
> More detailed debug logs are produced with the DEBUG_CODE macro, but
> this guards other debug-related code throughout the codebase. To avoid
> changing behaviour on release builds, this is only set for debug builds.
>
> Tested on QEMU, dumping the appropriate memory region in the UEFI shell
> shows the TianoCore log. An improved revision of the debug library used
> in several coreboot-related EDK2 forks, including MrChromebox's.
> Previous revisions also tested on an Acer Aspire VN7-572G laptop.
>
> Cc: Guo Dong 
> Cc: Ray Ni 
> Cc: Maurice Ma 
> Cc: Benjamin You 
> Cc: Sean Rhodes 
> Signed-off-by: Benjamin Doron 
> ---
>  UefiPayloadPkg/Include/Coreboot.h  |  12 +
>  UefiPayloadPkg/Library/CbSerialPortLib/CbSerialPortLib.c   | 258
> 
>  UefiPayloadPkg/Library/CbSerialPortLib/CbSerialPortLib.inf |  30 +++
>  UefiPayloadPkg/UefiPayloadPkg.dsc  |  25 +-
>  4 files changed, 320 insertions(+), 5 deletions(-)
>
> diff --git a/UefiPayloadPkg/Include/Coreboot.h
> b/UefiPayloadPkg/Include/Coreboot.h
> index a3e1109fe84e..4c9cf965519b 100644
> --- a/UefiPayloadPkg/Include/Coreboot.h
> +++ b/UefiPayloadPkg/Include/Coreboot.h
> @@ -199,6 +199,12 @@ struct cb_forward {
>UINT64forward;
>  };
>
> +struct cb_cbmem_ref {
> +  UINT32 tag;
> +  UINT32 size;
> +  UINT64 cbmem_addr;
> +};
> +
>  #define CB_TAG_FRAMEBUFFER  0x0012
>  struct cb_framebuffer {
>UINT32tag;
> @@ -229,6 +235,12 @@ struct cb_vdat {
>
>  #define CB_TAG_TIMESTAMPS 0x0016
>  #define CB_TAG_CBMEM_CONSOLE  0x0017
> +struct cbmem_console {
> +  UINT32 size;
> +  UINT32 cursor;
> +  UINT8  body[0];
> +} __attribute__((packed));
> +
>  #define CB_TAG_MRC_CACHE  0x0018
>  struct cb_cbmem_tab {
>UINT32tag;
> diff --git a/UefiPayloadPkg/Library/CbSerialPortLib/CbSerialPortLib.c
> b/UefiPayloadPkg/Library/CbSerialPortLib/CbSerialPortLib.c
> new file mode 100644
> index ..f7c06b0f41e9
> --- /dev/null
> +++ b/UefiPayloadPkg/Library/CbSerialPortLib/CbSerialPortLib.c
> @@ -0,0 +1,258 @@
> +/** @file
> +  CBMEM console SerialPortLib instance
> +
> +  Copyright (c) 2022, Baruch Binyamin Doron
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +
> +// Upper nibble contains flags
> +#define CBMC_CURSOR_MASK ((1 << 28) - 1)
> +#define CBMC_OVERFLOW (1 << 31)
> +
> +STATIC struct cbmem_console  *gCbConsole = NULL;
> +
> +/**
> +  Find coreboot record with given Tag.
> +  NOTE: This coreboot-specific function definition is absent
> + from the common BlParseLib header.
> +
> +  @param  TagThe tag id to be found
> +
> +  @retval NULL  The Tag is not found.
> +  @retval OthersThe pointer to the record found.
> +
> +**/
> +VOID *
> +FindCbTag (
> +  IN  UINT32 Tag
> +  );
> +
> +/**
> +  Initialize the serial device hardware.
> +
> +  If no initialization is required, then return RETURN_SUCCESS.
> +  If the serial device was successfully initialized, then return
> RETURN_SUCCESS.
> +  If the serial device could not be initialized, then return
> RETURN_DEVICE_ERROR.
> +
> +  @retval RETURN_SUCCESSThe serial device was initialized.
> +  @retval RETURN_DEVICE_ERROR   The serial device could not be
> initialized.
> +
> +**/
> +RETURN_STATUS
> +EFIAPI
> +SerialPortInitialize (
> +  VOID
> +  )
> +{
> +  struct cb_cbmem_ref *cbref = FindCbTag(CB_TAG_CBMEM_CONSOLE);
> +  if (!cbref) {
> +return RETURN_DEVICE_ERROR;
> +  }
> +
> +  gCbConsole = (VOID *)(UINTN)cbref->cbmem_addr;  // Support PEI and DXE
> +  if (gCbConsole == NULL) {
> +return RETURN_DEVICE_ERROR;
> +  }
> +
> +  return RETURN_SUCCESS;
> +}
> +
> +/**
> +  Write data from buffer to serial device.
> +
> +  Writes N

Re: [edk2-devel] [PATCH] MdeModulePkg/FaultTolerantWriteDxe: Don't check for address alignment

2022-05-17 Thread Sean Rhodes
Hi Star

I think the point is shown in a comment from coreboot:

"As mentioned above, only the offsets need to be
aligned, not the absolute bases. Please, have a look for instance at
`MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c:`:

  (FtwDevice->WorkSpaceAddress >= (FvbBaseAddress + BlockSize * (LbaIndex -
1)))
Things become more obvious if we remove the unnecessary parentheses:

  FtwDevice->WorkSpaceAddress >= FvbBaseAddress + BlockSize * (LbaIndex - 1)
It's the same as:

  FtwDevice->WorkSpaceAddress - FvbBaseAddress >= BlockSize * (LbaIndex - 1)
And _if_ aligned, the same as:

  (FtwDevice->WorkSpaceAddress - FvbBaseAddress) / BlockSize >= LbaIndex - 1
Now it's easy to see: neither `FtwDevice->WorkSpaceAddress` nor
`FvbBaseAddress`
have to be aligned, but their relative distance has to be."

So if this solution isn't acceptable, could you suggest one that would be?

Many thanks

On Tue, 17 May 2022 at 16:05, Zeng, Star  wrote:

> When length is larger than block size and block size aligned, if the
> address is not block size aligned, that means the range will mix with other
> range, but erase operation will be done per block, that will be risky and
> may break the fault tolerant mechanism.
>
> I could not remember all the details. Personally, I do not think it is
> right way to remove the check.
>
>
>
>
>
> Thanks,
>
> Star
>
> *From:* Lean Sheng Tan 
> *Sent:* Tuesday, May 17, 2022 7:58 PM
> *To:* devel@edk2.groups.io; Wu, Hao A 
> *Cc:* Zeng, Star ; Gao, Liming <
> gaolim...@byosoft.com.cn>; Rhodes, Sean 
> *Subject:* Re: [edk2-devel] [PATCH] MdeModulePkg/FaultTolerantWriteDxe:
> Don't check for address alignment
>
>
>
> Hi Star & Liming,
>
> Any update on this?
>
> Much appreciated.
>
>
> Best Regards,
>
> *Lean Sheng Tan*
>
>
> 9elements GmbH, Kortumstraße 19-21, 44787 Bochum, Germany
>
> Email: sheng@9elements.com
>
> Phone: *+49 234 68 94 188 <+492346894188>*
>
> Mobile: *+49 176 76 113842 <+4917676113842>*
>
>
>
> Registered office: Bochum
>
> Commercial register: Amtsgericht Bochum, HRB 17519
>
> Management: Sebastian German, Eray Bazaar
>
>
> Data protection information according to Art. 13 GDPR
> <https://9elements.com/privacy>
>
>
>
>
>
> On Mon, 16 May 2022 at 11:03, Wu, Hao A  wrote:
>
> Sorry Star and Liming,
>
>
>
> For the below patch (removing the alignment check for WorkSpace &
> SpareArea):
>
> https://edk2.groups.io/g/devel/message/89742
>
>
>
> Do you think it will impact the FTW service on flash device? Thanks in
> advance.
>
>
>
> Best Regards,
>
> Hao Wu
>
>
>
> *From:* devel@edk2.groups.io  *On Behalf Of *Sean
> Rhodes
> *Sent:* Monday, May 16, 2022 3:54 PM
> *To:* Wu, Hao A 
> *Cc:* devel@edk2.groups.io
> *Subject:* Re: [edk2-devel] [PATCH] MdeModulePkg/FaultTolerantWriteDxe:
> Don't check for address alignment
>
>
>
> The bug discovered was with coreboot, and the PCD values are derived from
> the block size of its SMMStore (NvStorage) region. The discussion on the
> patch can be found here: https://review.coreboot.org/c/coreboot/+/62990
>
>
>
> Hacking the PCDs could work,, but why would we want to keep an incorrect
> check?
>
>
>
> Thanks!
>
>
>
>
>
> On Mon, 16 May 2022 at 08:36, Wu, Hao A  wrote:
>
> Sorry for not being clear on what I mean.
>
> Is it possible to change the platform PCD values and keep these block size
> alignment requirements.
>
>
>
> Best Regards,
>
> Hao Wu
>
>
>
> *From:* devel@edk2.groups.io  *On Behalf Of *Sean
> Rhodes
> *Sent:* Monday, May 16, 2022 3:00 PM
> *To:* Wu; Wu, Hao A ; devel@edk2.groups.io
> *Subject:* Re: [edk2-devel] [PATCH] MdeModulePkg/FaultTolerantWriteDxe:
> Don't check for address alignment
>
>
>
> Hi Hao
>
> Yes, it does conflict - I will update the patch to fix these comments :)
>
> Thank you
>
> 
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89828): https://edk2.groups.io/g/devel/message/89828
Mute This Topic: https://groups.io/mt/91134149/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] MdeModulePkg/FaultTolerantWriteDxe: Don't check for address alignment

2022-05-16 Thread Sean Rhodes
The bug discovered was with coreboot, and the PCD values are derived from
the block size of its SMMStore (NvStorage) region. The discussion on the
patch can be found here: https://review.coreboot.org/c/coreboot/+/62990

Hacking the PCDs could work,, but why would we want to keep an incorrect
check?

Thanks!


On Mon, 16 May 2022 at 08:36, Wu, Hao A  wrote:

> Sorry for not being clear on what I mean.
>
> Is it possible to change the platform PCD values and keep these block size
> alignment requirements.
>
>
>
> Best Regards,
>
> Hao Wu
>
>
>
> *From:* devel@edk2.groups.io  * On Behalf Of *Sean
> Rhodes
> *Sent:* Monday, May 16, 2022 3:00 PM
> *To:* Wu; Wu, Hao A ; devel@edk2.groups.io
> *Subject:* Re: [edk2-devel] [PATCH] MdeModulePkg/FaultTolerantWriteDxe:
> Don't check for address alignment
>
>
>
> Hi Hao
>
> Yes, it does conflict - I will update the patch to fix these comments :)
>
> Thank you
>
> 
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89760): https://edk2.groups.io/g/devel/message/89760
Mute This Topic: https://groups.io/mt/91134149/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] MdeModulePkg/FaultTolerantWriteDxe: Don't check for address alignment

2022-05-16 Thread Sean Rhodes
WorkSpaceAddress and SpareAreaAddress point into MMIO, which isn't
always aligned. Remove the check for block alignment to avoid
false assertions.

Signed-off-by: Sean Rhodes 
Change-Id: Ia1c1f44b6a0e7f32cac0d7806e74d729e5d83a6d
---
 MdeModulePkg/MdeModulePkg.dec |  2 --
 MdeModulePkg/MdeModulePkg.uni |  4 ++--
 .../Universal/FaultTolerantWriteDxe/FtwMisc.c | 20 ---
 3 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index cf79292ec8..b7e2f48028 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -1649,7 +1649,6 @@
   
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x0|UINT32|0x3014
 
   ## Base address of the FTW working block range in flash device.
-  # If PcdFlashNvStorageFtwWorkingSize is larger than one block size, this 
value should be block size aligned.
   # @Prompt Base address of flash FTW working block range.
   
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x0|UINT32|0x3010
 
@@ -1668,7 +1667,6 @@
   
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64|0x0|UINT64|0x8013
 
   ## 64-bit Base address of the FTW working block range in flash device.
-  # If PcdFlashNvStorageFtwWorkingSize is larger than one block size, this 
value should be block size aligned.
   # @Prompt 64-bit Base address of flash FTW working block range.
   
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0x0|UINT64|0x8010
 
diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni
index b070f15ff2..9f916506f7 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
@@ -374,7 +374,7 @@
 
 #string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFlashNvStorageFtwWorkingBase_PROMPT  
#language en-US "Base address of flash FTW working block range"
 
-#string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFlashNvStorageFtwWorkingBase_HELP  
#language en-US "Base address of the FTW working block range in flash device. 
If PcdFlashNvStorageFtwWorkingSize is larger than one block size, this value 
should be block size aligned."
+#string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFlashNvStorageFtwWorkingBase_HELP  
#language en-US "Base address of the FTW working block range in flash device."
 
 #string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFlashNvStorageFtwWorkingSize_PROMPT  
#language en-US "Size of flash FTW working block range"
 
@@ -390,7 +390,7 @@
 
 #string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFlashNvStorageFtwWorkingBase64_PROMPT  
#language en-US "64-bit Base address of flash FTW working block range"
 
-#string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFlashNvStorageFtwWorkingBase64_HELP  
#language en-US "64-bit Base address of the FTW working block range in flash 
device. If PcdFlashNvStorageFtwWorkingSize is larger than one block size, this 
value should be block size aligned."
+#string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFlashNvStorageFtwWorkingBase64_HELP  
#language en-US "64-bit Base address of the FTW working block range in flash 
device."
 
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdEmuVariableNvModeEnable_PROMPT  
#language en-US "EMU variable NV mode enable"
 
diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c 
b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c
index 661e148767..2fce694f22 100644
--- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c
+++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c
@@ -1108,8 +1108,8 @@ FindFvbForFtw (
   // To get the LBA of work space
   //
   for (LbaIndex = 1; LbaIndex <= NumberOfBlocks; LbaIndex += 1) {
-if (  (FtwDevice->WorkSpaceAddress >= (FvbBaseAddress + BlockSize * 
(LbaIndex - 1)))
-   && (FtwDevice->WorkSpaceAddress < (FvbBaseAddress + BlockSize * 
LbaIndex)))
+if ((FtwDevice->WorkSpaceAddress - FvbBaseAddress >= BlockSize * 
(LbaIndex - 1)) &&
+((FtwDevice->WorkSpaceAddress - FvbBaseAddress) / BlockSize >= 
LbaIndex - 1))
 {
   FtwDevice->FtwWorkSpaceLba = LbaIndex - 1;
   //
@@ -1121,12 +1121,10 @@ FindFvbForFtw (
   FtwDevice->NumberOfWorkSpaceBlock = FTW_BLOCKS 
(FtwDevice->FtwWorkSpaceBase + FtwDevice->FtwWorkSpaceSize, 
FtwDevice->WorkBlockSize);
   if (FtwDevice->FtwWorkSpaceSize >= FtwDevice->WorkBlockSize) {
 //
-// Check the alignment of work space address and length, they 
should be block size aligned when work space size is larger than one block size.
+// Check the alignment of work space length, it should be block 
size aligned when work space size is larger than one block size.
 //
-if (((FtwDevice->WorkSpaceAddress & (FtwDevice->WorkBlockSize - 
1)) != 0) ||
- 

Re: [edk2-devel] [PATCH] MdeModulePkg/FaultTolerantWriteDxe: Don't check for address alignment

2022-05-16 Thread Sean Rhodes
Hi Hao

Yes, it does conflict - I will update the patch to fix these comments :)

Thank you


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89741): https://edk2.groups.io/g/devel/message/89741
Mute This Topic: https://groups.io/mt/91134149/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] MdeModulePkg/FaultTolerantWriteDxe: Don't check for address alignment

2022-05-15 Thread Sean Rhodes
Hi

Would any one be able to review please?

Thank you

On Fri, 1 Apr 2022, 09:03 Sean Rhodes via groups.io,  wrote:

> WorkSpaceAddress and SpareAreaAddress point into MMIO, which isn't
> always aligned. Remove the check for block alignment to avoid
> false assertions.
>
> Cc: Jian J Wang 
> Cc: Hao A Wu 
> Cc: Liming Gao 
> Signed-off-by: Sean Rhodes 
> Change-Id: Ia1c1f44b6a0e7f32cac0d7806e74d729e5d83a6d
> ---
>  .../Universal/FaultTolerantWriteDxe/FtwMisc.c| 16 ++--
>  1 file changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c
> b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c
> index 661e148767..3b9ff1c828 100644
> --- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c
> +++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c
> @@ -1121,12 +1121,10 @@ FindFvbForFtw (
>FtwDevice->NumberOfWorkSpaceBlock = FTW_BLOCKS
> (FtwDevice->FtwWorkSpaceBase + FtwDevice->FtwWorkSpaceSize,
> FtwDevice->WorkBlockSize);
>if (FtwDevice->FtwWorkSpaceSize >= FtwDevice->WorkBlockSize) {
>  //
> -// Check the alignment of work space address and length, they
> should be block size aligned when work space size is larger than one block
> size.
> +// Check the alignment of work space length, it should be
> block size aligned when work space size is larger than one block size.
>  //
> -if (((FtwDevice->WorkSpaceAddress & (FtwDevice->WorkBlockSize
> - 1)) != 0) ||
> -((FtwDevice->WorkSpaceLength & (FtwDevice->WorkBlockSize
> - 1)) != 0))
> -{
> -  DEBUG ((DEBUG_ERROR, "Ftw: Work space address or length is
> not block size aligned when work space size is larger than one block
> size\n"));
> +if ((FtwDevice->WorkSpaceLength & (FtwDevice->WorkBlockSize -
> 1)) != 0) {
> +  DEBUG ((EFI_D_ERROR, "Ftw: Work space length is not block
> size aligned when work space size is larger than one block size\n"));
>FreePool (HandleBuffer);
>ASSERT (FALSE);
>return EFI_ABORTED;
> @@ -1171,12 +1169,10 @@ FindFvbForFtw (
>}
>
>//
> -  // Check the alignment of spare area address and length, they
> should be block size aligned
> +  // Check the alignment of spare area length, it should be block
> size aligned
>//
> -  if (((FtwDevice->SpareAreaAddress & (FtwDevice->SpareBlockSize
> - 1)) != 0) ||
> -  ((FtwDevice->SpareAreaLength & (FtwDevice->SpareBlockSize -
> 1)) != 0))
> -  {
> -DEBUG ((DEBUG_ERROR, "Ftw: Spare area address or length is
> not block size aligned\n"));
> +  if ((FtwDevice->SpareAreaLength & (FtwDevice->SpareBlockSize -
> 1)) != 0) {
> +DEBUG ((EFI_D_ERROR, "Ftw: Spare area address or length is
> not block size aligned\n"));
>  FreePool (HandleBuffer);
>  //
>  // Report Status Code EFI_SW_EC_ABORTED.
> --
> 2.32.0
>
>
>
> 
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#88320): https://edk2.groups.io/g/devel/message/88320
> Mute This Topic: https://groups.io/mt/90173290/6718866
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [sean@starlabs.systems]
> 
>
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89739): https://edk2.groups.io/g/devel/message/89739
Mute This Topic: https://groups.io/mt/91134149/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] MdeModulePkg/FaultTolerantWriteDxe: Don't check for address alignment

2022-04-01 Thread Sean Rhodes
WorkSpaceAddress and SpareAreaAddress point into MMIO, which isn't
always aligned. Remove the check for block alignment to avoid
false assertions.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Liming Gao 
Signed-off-by: Sean Rhodes 
Change-Id: Ia1c1f44b6a0e7f32cac0d7806e74d729e5d83a6d
---
 .../Universal/FaultTolerantWriteDxe/FtwMisc.c| 16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c 
b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c
index 661e148767..3b9ff1c828 100644
--- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c
+++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c
@@ -1121,12 +1121,10 @@ FindFvbForFtw (
   FtwDevice->NumberOfWorkSpaceBlock = FTW_BLOCKS 
(FtwDevice->FtwWorkSpaceBase + FtwDevice->FtwWorkSpaceSize, 
FtwDevice->WorkBlockSize);
   if (FtwDevice->FtwWorkSpaceSize >= FtwDevice->WorkBlockSize) {
 //
-// Check the alignment of work space address and length, they 
should be block size aligned when work space size is larger than one block size.
+// Check the alignment of work space length, it should be block 
size aligned when work space size is larger than one block size.
 //
-if (((FtwDevice->WorkSpaceAddress & (FtwDevice->WorkBlockSize - 
1)) != 0) ||
-((FtwDevice->WorkSpaceLength & (FtwDevice->WorkBlockSize - 1)) 
!= 0))
-{
-  DEBUG ((DEBUG_ERROR, "Ftw: Work space address or length is not 
block size aligned when work space size is larger than one block size\n"));
+if ((FtwDevice->WorkSpaceLength & (FtwDevice->WorkBlockSize - 1)) 
!= 0) {
+  DEBUG ((EFI_D_ERROR, "Ftw: Work space length is not block size 
aligned when work space size is larger than one block size\n"));
   FreePool (HandleBuffer);
   ASSERT (FALSE);
   return EFI_ABORTED;
@@ -1171,12 +1169,10 @@ FindFvbForFtw (
   }
 
   //
-  // Check the alignment of spare area address and length, they should 
be block size aligned
+  // Check the alignment of spare area length, it should be block size 
aligned
   //
-  if (((FtwDevice->SpareAreaAddress & (FtwDevice->SpareBlockSize - 1)) 
!= 0) ||
-  ((FtwDevice->SpareAreaLength & (FtwDevice->SpareBlockSize - 1)) 
!= 0))
-  {
-DEBUG ((DEBUG_ERROR, "Ftw: Spare area address or length is not 
block size aligned\n"));
+  if ((FtwDevice->SpareAreaLength & (FtwDevice->SpareBlockSize - 1)) 
!= 0) {
+DEBUG ((EFI_D_ERROR, "Ftw: Spare area address or length is not 
block size aligned\n"));
 FreePool (HandleBuffer);
 //
 // Report Status Code EFI_SW_EC_ABORTED.
-- 
2.32.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88320): https://edk2.groups.io/g/devel/message/88320
Mute This Topic: https://groups.io/mt/90173290/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 1/2] UefiPayloadPkg: Fix PciHostBridgeLib

2022-03-30 Thread Sean Rhodes
Reviewed-by Sean Rhodes 

On Wed, 30 Mar 2022 at 19:29, Sean Rhodes  wrote:

> From: Lean Sheng Tan 
>
> Don't assume a 64bit register always holds an address greater than 4GB.
> Check the value in the register and decide which Aperature it should be
> assigned to.
>
> Fixes assertion
> "ASSERT [PciHostBridgeDxe] Bridge->MemAbove4G.Base >=
> 0x0001ULL".
>
> Tested with coreboot as bootloader on platforms that have PCI resource
> above 4GiB and on platforms that don't have resource above 4GiB.
>
> Cc: Guo Dong 
> Cc: Ray Ni 
> Cc: Maurice Ma 
> Cc: Benjamin You 
> Cc: Sean Rhodes 
> Signed-off-by: Patrick Rudolph 
> ---
>  .../Library/PciHostBridgeLib/PciHostBridgeSupport.c | 13 +
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git
> a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c
> b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c
> index 8a890b6b53..e1faa24ae7 100644
> --- a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c
> +++ b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c
> @@ -354,14 +354,19 @@ ScanForRootBridges (
>Base  = ((UINT32)Pci.Bridge.PrefetchableMemoryBase & 0xfff0) <<
> 16;
>Limit = (((UINT32)Pci.Bridge.PrefetchableMemoryLimit & 0xfff0)
> << 16) | 0xf;
> -  MemAperture = 
> +
>if (Value == BIT0) {
> -Base   |= LShiftU64 (Pci.Bridge.PrefetchableBaseUpper32,
> 32);
> -Limit  |= LShiftU64 (Pci.Bridge.PrefetchableLimitUpper32,
> 32);
> -MemAperture = 
> +Base  |= LShiftU64 (Pci.Bridge.PrefetchableBaseUpper32, 32);
> +Limit |= LShiftU64 (Pci.Bridge.PrefetchableLimitUpper32, 32);
>}
>
>if ((Base > 0) && (Base < Limit)) {
> +if (Base < BASE_4GB) {
> +  MemAperture = 
> +} else {
> +  MemAperture = 
> +}
> +
>  if (MemAperture->Base > Base) {
>MemAperture->Base = Base;
>  }
> --
> 2.32.0
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88267): https://edk2.groups.io/g/devel/message/88267
Mute This Topic: https://groups.io/mt/90138164/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 2/2] OvmfPkg: Fix PciHostBridgeLibScan

2022-03-30 Thread Sean Rhodes
From: Patrick Rudolph 

Don't assume a 64bit register always holds an address greater than 4GB.
Check the value in the register and decide which Aperature it should be
assigned to.

The same code caused an issue on real hardware. It's unclear if this is an
issue here as well, as it's intended to run on emulated hardware only.

Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Jordan Justen 
Cc: Gerd Hoffmann 
Signed-off-by: Patrick Rudolph 
---
 .../PciHostBridgeLibScan/ScanForRootBridges.c| 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/OvmfPkg/Library/PciHostBridgeLibScan/ScanForRootBridges.c 
b/OvmfPkg/Library/PciHostBridgeLibScan/ScanForRootBridges.c
index 5fb02a89b9..1ff96be57f 100644
--- a/OvmfPkg/Library/PciHostBridgeLibScan/ScanForRootBridges.c
+++ b/OvmfPkg/Library/PciHostBridgeLibScan/ScanForRootBridges.c
@@ -331,14 +331,18 @@ ScanForRootBridges (
   Base  = ((UINT32)Pci.Bridge.PrefetchableMemoryBase & 0xfff0) << 16;
   Limit = (((UINT32)Pci.Bridge.PrefetchableMemoryLimit & 0xfff0)
<< 16) | 0xf;
-  MemAperture = 
   if (Value == BIT0) {
-Base   |= LShiftU64 (Pci.Bridge.PrefetchableBaseUpper32, 32);
-Limit  |= LShiftU64 (Pci.Bridge.PrefetchableLimitUpper32, 32);
-MemAperture = 
+Base  |= LShiftU64 (Pci.Bridge.PrefetchableBaseUpper32, 32);
+Limit |= LShiftU64 (Pci.Bridge.PrefetchableLimitUpper32, 32);
   }
 
   if (Base < Limit) {
+if (Base < BASE_4GB) {
+  MemAperture = 
+} else {
+  MemAperture = 
+}
+
 if (MemAperture->Base > Base) {
   MemAperture->Base = Base;
 }
-- 
2.32.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88266): https://edk2.groups.io/g/devel/message/88266
Mute This Topic: https://groups.io/mt/90138165/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




  1   2   3   >