Re: [edk2-devel] [PATCH V2 01/32] AMD/AmdPlatformPkg: Check in AMD S3 logo

2024-01-26 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

> -Original Message-
> From: Zhai, MingXin (Duke) 
> Sent: Friday, January 26, 2024 2:00 PM
> To: devel@edk2.groups.io
> Cc: Zhai, MingXin (Duke) ; Yao, Ken
> ; Fu, Igniculus ; Chang, Abner
> 
> Subject: [PATCH V2 01/32] AMD/AmdPlatformPkg: Check in AMD S3 logo
>
> From: Duke Zhai 
>
> BZ #:4640
> In V2: Improve coding style
>   1.Remove the leading underscore and use double underscore at trailing in C
> header files.
>   2.Remove old tianocore licenses and redundant license description.
>   3.Improve coding style. For example: remove space between @param.
>
> In V1:
>   LogoDxe module displays boot logo.
>   S3LogoDxe module is based on EDK2 LogoDxe module and update AMD S3
> logo.
>
> Signed-off-by: Eric Xing 
> Cc: Duke Zhai 
> Cc: Ken Yao 
> Cc: Igniculus Fu 
> Cc: Abner Chang 
> ---
>  .../AmdPlatformPkg/Universal/LogoDxe/Logo.c   | 198
> ++
>  .../Universal/LogoDxe/S3Logo.bmp  | Bin 0 -> 964114 bytes
>  .../Universal/LogoDxe/S3Logo.idf  |   9 +
>  .../Universal/LogoDxe/S3LogoDxe.inf   |  55 +
>  4 files changed, 262 insertions(+)
>  create mode 100644
> Platform/AMD/AmdPlatformPkg/Universal/LogoDxe/Logo.c
>  create mode 100644
> Platform/AMD/AmdPlatformPkg/Universal/LogoDxe/S3Logo.bmp
>  create mode 100644
> Platform/AMD/AmdPlatformPkg/Universal/LogoDxe/S3Logo.idf
>  create mode 100644
> Platform/AMD/AmdPlatformPkg/Universal/LogoDxe/S3LogoDxe.inf
>
> diff --git a/Platform/AMD/AmdPlatformPkg/Universal/LogoDxe/Logo.c
> b/Platform/AMD/AmdPlatformPkg/Universal/LogoDxe/Logo.c
> new file mode 100644
> index 00..4463ba58eb
> --- /dev/null
> +++ b/Platform/AMD/AmdPlatformPkg/Universal/LogoDxe/Logo.c
> @@ -0,0 +1,198 @@
> +/**
> +  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
> +**/
> +
> +/** @file
> +  Logo DXE Driver, install Edk2 Platform Logo protocol.
> +
> +  Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
Please put AMD copyright under Intel's.
Thanks
Abner



> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "Logo.h"
> +
> +EFI_HII_IMAGE_EX_PROTOCOL  *mHiiImageEx;
> +EFI_HII_HANDLE mHiiHandle;
> +LOGO_ENTRY mLogos[] = {
> +  {
> +IMAGE_TOKEN (IMG_LOGO),
> +EdkiiPlatformLogoDisplayAttributeCenter,
> +0,
> +0
> +  }
> +};
> +
> +/**
> +  Load a platform logo image and return its data and attributes.
> +
> +  @param[in]  This  The pointer to this protocol instance.
> +  @param[in, out] Instance  The visible image instance is found.
> +  @param[out] Image Points to the image.
> +  @param[out] Attribute The display attributes of the image 
> returned.
> +  @param[out] OffsetX   The X offset of the image regarding the
> Attribute.
> +  @param[out] OffsetY   The Y offset of the image regarding the
> Attribute.
> +
> +  @retval EFI_SUCCESSThe image was fetched successfully.
> +  @retval EFI_NOT_FOUND  The specified image could not be found.
> +  @retval EFI_INVALID_PARAMETER  One of the given input parameters are
> incorrect
> +**/
> +EFI_STATUS
> +EFIAPI
> +GetImage (
> +  IN EDKII_PLATFORM_LOGO_PROTOCOL*This,
> +  IN OUT UINT32  *Instance,
> +  OUT EFI_IMAGE_INPUT*Image,
> +  OUT EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE  *Attribute,
> +  OUT INTN   *OffsetX,
> +  OUT INTN   *OffsetY
> +  )
> +{
> +  UINT32  Current;
> +
> +  if ((Instance == NULL) || (Image == NULL) ||
> +  (Attribute == NULL) || (OffsetX == NULL) || (OffsetY == NULL))
> +  {
> +return EFI_INVALID_PARAMETER;
> +  }
> +
> +  Current = *Instance;
> +  if (Current >= ARRAY_SIZE (mLogos)) {
> +return EFI_NOT_FOUND;
> +  }
> +
> +  (*Instance)++; // Advance to next logo.
> +  *Attribute = mLogos[Current].Attribute;
> +  *OffsetX   = mLogos[Current].OffsetX;
> +  *OffsetY   = mLogos[Current].OffsetY;
> +  return mHiiImageEx->GetImageEx (mHiiImageEx, mHiiHandle,
> mLogos[Current].ImageId, Image);
> +}
> +
> +EDKII_PLATFORM_LOGO_PROTOCOL  mPlatformLogo = {
> +  GetImage
> +};
> +
> +// AMD_EDKII_OVERRIDE START
> +
> +/**
> +  After console ready before boot option event callback
> +
> +  @param[in] Event  The Event this notify function registered to.
> +  @param[in] ContextPointer to the context data registered to the Event.
> +**/
> +VOID
> +EFIAPI
> +LogoDxeDisplayEventCallback (
> +  IN EFI_EVENT  Event,
> +  IN VOID   *Context
> +  )
> +{
> +  DEBUG ((DEBUG_INFO, "AMD logo is displaying.\n"));
> +
> +  BootLogoEnableLogo ();
> +  gBS->CloseEvent (Event);
> +}
> +
> +/**
> +  Entrypoint of this module.
> +
> +  This function is the entrypoint of this module. 

[edk2-devel] [PATCH V2 01/32] AMD/AmdPlatformPkg: Check in AMD S3 logo

2024-01-25 Thread Zhai, MingXin (Duke) via groups.io
From: Duke Zhai 

BZ #:4640
In V2: Improve coding style
  1.Remove the leading underscore and use double underscore at trailing in C 
header files.
  2.Remove old tianocore licenses and redundant license description.
  3.Improve coding style. For example: remove space between @param.

In V1:
  LogoDxe module displays boot logo.
  S3LogoDxe module is based on EDK2 LogoDxe module and update AMD S3 logo.

Signed-off-by: Eric Xing 
Cc: Duke Zhai 
Cc: Ken Yao 
Cc: Igniculus Fu 
Cc: Abner Chang 
---
 .../AmdPlatformPkg/Universal/LogoDxe/Logo.c   | 198 ++
 .../Universal/LogoDxe/S3Logo.bmp  | Bin 0 -> 964114 bytes
 .../Universal/LogoDxe/S3Logo.idf  |   9 +
 .../Universal/LogoDxe/S3LogoDxe.inf   |  55 +
 4 files changed, 262 insertions(+)
 create mode 100644 Platform/AMD/AmdPlatformPkg/Universal/LogoDxe/Logo.c
 create mode 100644 Platform/AMD/AmdPlatformPkg/Universal/LogoDxe/S3Logo.bmp
 create mode 100644 Platform/AMD/AmdPlatformPkg/Universal/LogoDxe/S3Logo.idf
 create mode 100644 Platform/AMD/AmdPlatformPkg/Universal/LogoDxe/S3LogoDxe.inf

diff --git a/Platform/AMD/AmdPlatformPkg/Universal/LogoDxe/Logo.c 
b/Platform/AMD/AmdPlatformPkg/Universal/LogoDxe/Logo.c
new file mode 100644
index 00..4463ba58eb
--- /dev/null
+++ b/Platform/AMD/AmdPlatformPkg/Universal/LogoDxe/Logo.c
@@ -0,0 +1,198 @@
+/**
+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+**/
+
+/** @file
+  Logo DXE Driver, install Edk2 Platform Logo protocol.
+
+  Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "Logo.h"
+
+EFI_HII_IMAGE_EX_PROTOCOL  *mHiiImageEx;
+EFI_HII_HANDLE mHiiHandle;
+LOGO_ENTRY mLogos[] = {
+  {
+IMAGE_TOKEN (IMG_LOGO),
+EdkiiPlatformLogoDisplayAttributeCenter,
+0,
+0
+  }
+};
+
+/**
+  Load a platform logo image and return its data and attributes.
+
+  @param[in]  This  The pointer to this protocol instance.
+  @param[in, out] Instance  The visible image instance is found.
+  @param[out] Image Points to the image.
+  @param[out] Attribute The display attributes of the image 
returned.
+  @param[out] OffsetX   The X offset of the image regarding the 
Attribute.
+  @param[out] OffsetY   The Y offset of the image regarding the 
Attribute.
+
+  @retval EFI_SUCCESSThe image was fetched successfully.
+  @retval EFI_NOT_FOUND  The specified image could not be found.
+  @retval EFI_INVALID_PARAMETER  One of the given input parameters are 
incorrect
+**/
+EFI_STATUS
+EFIAPI
+GetImage (
+  IN EDKII_PLATFORM_LOGO_PROTOCOL*This,
+  IN OUT UINT32  *Instance,
+  OUT EFI_IMAGE_INPUT*Image,
+  OUT EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE  *Attribute,
+  OUT INTN   *OffsetX,
+  OUT INTN   *OffsetY
+  )
+{
+  UINT32  Current;
+
+  if ((Instance == NULL) || (Image == NULL) ||
+  (Attribute == NULL) || (OffsetX == NULL) || (OffsetY == NULL))
+  {
+return EFI_INVALID_PARAMETER;
+  }
+
+  Current = *Instance;
+  if (Current >= ARRAY_SIZE (mLogos)) {
+return EFI_NOT_FOUND;
+  }
+
+  (*Instance)++; // Advance to next logo.
+  *Attribute = mLogos[Current].Attribute;
+  *OffsetX   = mLogos[Current].OffsetX;
+  *OffsetY   = mLogos[Current].OffsetY;
+  return mHiiImageEx->GetImageEx (mHiiImageEx, mHiiHandle, 
mLogos[Current].ImageId, Image);
+}
+
+EDKII_PLATFORM_LOGO_PROTOCOL  mPlatformLogo = {
+  GetImage
+};
+
+// AMD_EDKII_OVERRIDE START
+
+/**
+  After console ready before boot option event callback
+
+  @param[in] Event  The Event this notify function registered to.
+  @param[in] ContextPointer to the context data registered to the Event.
+**/
+VOID
+EFIAPI
+LogoDxeDisplayEventCallback (
+  IN EFI_EVENT  Event,
+  IN VOID   *Context
+  )
+{
+  DEBUG ((DEBUG_INFO, "AMD logo is displaying.\n"));
+
+  BootLogoEnableLogo ();
+  gBS->CloseEvent (Event);
+}
+
+/**
+  Entrypoint of this module.
+
+  This function is the entrypoint of this module. It installs the Edkii
+  Platform Logo protocol.
+
+  @param  ImageHandle   The firmware allocated handle for the EFI image.
+  @param  SystemTable   A pointer to the EFI System Table.
+
+  @retval EFI_SUCCESS   The entry point is executed successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+InitializeLogo (
+  IN EFI_HANDLEImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  EFI_STATUS   Status;
+  EFI_HII_PACKAGE_LIST_HEADER  *PackageList;
+  EFI_HII_DATABASE_PROTOCOL*HiiDatabase;
+  EFI_HANDLE   Handle;
+  EFI_EVENTAfterConsoleReadyBeforeBootOptionEvent;
+
+  Status =