Re: [edk2-devel] [PATCH 07/33] AMD/VanGoghBoard: Check in PciPlatform

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

> -Original Message-
> From: duke.z...@amd.com 
> Sent: Thursday, January 18, 2024 2:50 PM
> To: devel@edk2.groups.io
> Cc: Xing, Eric ; Yao, Ken ; Fu,
> Igniculus ; Chang, Abner 
> Subject: [PATCH 07/33] AMD/VanGoghBoard: Check in PciPlatform
>
> From: Duke Zhai 
>
>
> BZ #:4640
>
> BIOS detects current IGPU device ID and install corresponding VBIOS.
>
> Inital PciPlatform module to load VBIOS and to provide interface for
>
> other option ROMs if necessary.
>
>
>
> Signed-off-by: Duke Zhai 
>
> Cc: Eric Xing 
>
> Cc: Ken Yao 
>
> Cc: Igniculus Fu 
>
> Cc: Abner Chang 
>
> ---
>
>  .../Include/Protocol/GlobalNvsArea.h  |  70 ++
>
>  .../PciPlatform/CommonHeader.h|  43 
>
>  .../PciPlatform/PciPlatform.c | 199 ++
>
>  .../PciPlatform/PciPlatform.h | 105 +
>
>  .../PciPlatform/PciPlatform.inf   |  66 ++
>
>  5 files changed, 483 insertions(+)
>
>  create mode 100644
> Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Include/Protocol/GlobalN
> vsArea.h
>
>  create mode 100644
> Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/CommonHea
> der.h
>
>  create mode 100644
> Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/PciPlatform.c
>
>  create mode 100644
> Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/PciPlatform.h
>
>  create mode 100644
> Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/PciPlatform.in
> f
>
>
>
> diff --git
> a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Include/Protocol/Global
> NvsArea.h
> b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Include/Protocol/Global
> NvsArea.h
>
> new file mode 100644
>
> index 00..0c5077f417
>
> --- /dev/null
>
> +++
> b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Include/Protocol/Global
> NvsArea.h
>
> @@ -0,0 +1,70 @@
>
> +/** @file
>
> +  GlobalNvsArea.h
>
> +
>
> +  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
>
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
>
> +**/
>
> +/* This file includes code originally published under the following license. 
> */
>
> +
>
> +/** @file
>
> +Definition of the global NVS area protocol.  This protocol
>
> +publishes the address and format of a global ACPI NVS buffer
>
> +used as a communications buffer between SMM code and ASL code.
>
> +The format is derived from the ACPI reference code, version 0.95.
>
> +Note:  Data structures defined in this protocol are not naturally aligned.
>
> +
>
> +Copyright (c) 2013-2015 Intel Corporation.
>
> +
>
> +SPDX-License-Identifier: BSD-2-Clause-Patent
>
> +
>
> +**/
>
> +
>
> +#ifndef _GLOBAL_NVS_AREA_H_


GLOBAL_NVS_AREA_H__


>
> +#define _GLOBAL_NVS_AREA_H_
>
> +
>
> +//
>
> +// Includes
>
> +//
>
> +#define GLOBAL_NVS_DEVICE_ENABLE   1
>
> +#define GLOBAL_NVS_DEVICE_DISABLE  0
>
> +
>
> +//
>
> +// Global NVS Area Protocol GUID
>
> +//
>
> +#define EFI_GLOBAL_NVS_AREA_PROTOCOL_GUID \
>
> +{ 0x74e1e48, 0x8132, 0x47a1, {0x8c, 0x2c, 0x3f, 0x14, 0xad, 0x9a, 0x66,
> 0xdc} }
>
> +
>
> +//
>
> +// Revision id - Added TPM related fields
>
> +//
>
> +#define GLOBAL_NVS_AREA_RIVISION_1  1
>
> +
>
> +//
>
> +// Extern the GUID for protocol users.
>
> +//
>
> +extern EFI_GUID  gEfiGlobalNvsAreaProtocolGuid;
>
> +
>
> +//
>
> +// Global NVS Area definition
>
> +//
>
> +#pragma pack (1)
>
> +typedef struct {
>
> +  //
>
> +  // Miscellaneous Dynamic Values, the definitions below need to be matched
>
> +  // GNVS definitions in Platform.ASL
>
> +  //
>
> +  UINT32TopOfMem;   // TOPM
>
> +  UINT8 NbIoApic;   // NAPC
>
> +  UINT32PcieBaseAddress;// PCBA
>
> +  UINT32PcieBaseLimit;  // PCBL
>
> +} EFI_GLOBAL_NVS_AREA;
>
> +#pragma pack ()
>
> +
>
> +//
>
> +// Global NVS Area Protocol
>
> +//
>
> +typedef struct _EFI_GLOBAL_NVS_AREA_PROTOCOL {
>
> +  EFI_GLOBAL_NVS_AREA*Area;
>
> +} EFI_GLOBAL_NVS_AREA_PROTOCOL;
>
> +
>
> +#endif
>
> diff --git
> a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/CommonHe
> ader.h
> b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/CommonH
> eader.h
>
> new file mode 100644
>
> index 00..430d9f51dc
>
> --- /dev/null
>
> +++
> b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/CommonH
> eader.h
>
> @@ -0,0 +1,43 @@
>
> +/** @file
>
> +  Implements CommonHeader.h
>
> +
>
> +  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
>
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
>
> +
>
> +**/
>
> +
>
> +/* This file includes code originally published under the following license. 
> */
>
> +
>
> +/** @file
>
> +Common header file shared by all source files.
>
> +
>
> +This file includes package header files, library classes and protocol, PPI &
> GUID definitions.

Remove below copyright, put Intel's above or under AMD copyright.



>
> +
>
> +Copyright (c) 2013-2015 Intel Corporation.
>
> +
>
> +This  program and the accompanying materials
>
> +are licensed and made 

[edk2-devel] [PATCH 07/33] AMD/VanGoghBoard: Check in PciPlatform

2024-01-19 Thread duke.zhai via groups.io
From: Duke Zhai 


BZ #:4640

BIOS detects current IGPU device ID and install corresponding VBIOS.

Inital PciPlatform module to load VBIOS and to provide interface for

other option ROMs if necessary.



Signed-off-by: Duke Zhai 

Cc: Eric Xing 

Cc: Ken Yao 

Cc: Igniculus Fu 

Cc: Abner Chang 

---

 .../Include/Protocol/GlobalNvsArea.h  |  70 ++

 .../PciPlatform/CommonHeader.h|  43 

 .../PciPlatform/PciPlatform.c | 199 ++

 .../PciPlatform/PciPlatform.h | 105 +

 .../PciPlatform/PciPlatform.inf   |  66 ++

 5 files changed, 483 insertions(+)

 create mode 100644 
Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Include/Protocol/GlobalNvsArea.h

 create mode 100644 
Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/CommonHeader.h

 create mode 100644 
Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/PciPlatform.c

 create mode 100644 
Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/PciPlatform.h

 create mode 100644 
Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/PciPlatform.inf



diff --git 
a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Include/Protocol/GlobalNvsArea.h 
b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Include/Protocol/GlobalNvsArea.h

new file mode 100644

index 00..0c5077f417

--- /dev/null

+++ 
b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Include/Protocol/GlobalNvsArea.h

@@ -0,0 +1,70 @@

+/** @file

+  GlobalNvsArea.h

+

+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.

+  SPDX-License-Identifier: BSD-2-Clause-Patent

+**/

+/* This file includes code originally published under the following license. */

+

+/** @file

+Definition of the global NVS area protocol.  This protocol

+publishes the address and format of a global ACPI NVS buffer

+used as a communications buffer between SMM code and ASL code.

+The format is derived from the ACPI reference code, version 0.95.

+Note:  Data structures defined in this protocol are not naturally aligned.

+

+Copyright (c) 2013-2015 Intel Corporation.

+

+SPDX-License-Identifier: BSD-2-Clause-Patent

+

+**/

+

+#ifndef _GLOBAL_NVS_AREA_H_

+#define _GLOBAL_NVS_AREA_H_

+

+//

+// Includes

+//

+#define GLOBAL_NVS_DEVICE_ENABLE   1

+#define GLOBAL_NVS_DEVICE_DISABLE  0

+

+//

+// Global NVS Area Protocol GUID

+//

+#define EFI_GLOBAL_NVS_AREA_PROTOCOL_GUID \

+{ 0x74e1e48, 0x8132, 0x47a1, {0x8c, 0x2c, 0x3f, 0x14, 0xad, 0x9a, 0x66, 0xdc} }

+

+//

+// Revision id - Added TPM related fields

+//

+#define GLOBAL_NVS_AREA_RIVISION_1  1

+

+//

+// Extern the GUID for protocol users.

+//

+extern EFI_GUID  gEfiGlobalNvsAreaProtocolGuid;

+

+//

+// Global NVS Area definition

+//

+#pragma pack (1)

+typedef struct {

+  //

+  // Miscellaneous Dynamic Values, the definitions below need to be matched

+  // GNVS definitions in Platform.ASL

+  //

+  UINT32TopOfMem;   // TOPM

+  UINT8 NbIoApic;   // NAPC

+  UINT32PcieBaseAddress;// PCBA

+  UINT32PcieBaseLimit;  // PCBL

+} EFI_GLOBAL_NVS_AREA;

+#pragma pack ()

+

+//

+// Global NVS Area Protocol

+//

+typedef struct _EFI_GLOBAL_NVS_AREA_PROTOCOL {

+  EFI_GLOBAL_NVS_AREA*Area;

+} EFI_GLOBAL_NVS_AREA_PROTOCOL;

+

+#endif

diff --git 
a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/CommonHeader.h 
b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/CommonHeader.h

new file mode 100644

index 00..430d9f51dc

--- /dev/null

+++ b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/CommonHeader.h

@@ -0,0 +1,43 @@

+/** @file

+  Implements CommonHeader.h

+

+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.

+  SPDX-License-Identifier: BSD-2-Clause-Patent

+

+**/

+

+/* This file includes code originally published under the following license. */

+

+/** @file

+Common header file shared by all source files.

+

+This file includes package header files, library classes and protocol, PPI & 
GUID definitions.

+

+Copyright (c) 2013-2015 Intel Corporation.

+

+This  program and the accompanying materials

+are licensed and made available under the terms and conditions of the BSD 
License

+which accompanies this distribution.  The full text of the license may be 
found at

+http://opensource.org/licenses/bsd-license.php

+

+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+**/

+

+#ifndef __COMMON_HEADER_H_

+#define __COMMON_HEADER_H_

+

+#include 

+

+#include 

+#include 

+

+#include 

+#include 

+#include 

+#include 

+#include 

+#include 

+#include 

+

+#endif

diff --git 
a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/PciPlatform.c 
b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/PciPlatform.c

new file mode 100644

index 00..733d334075

--- /dev/null

+++