Re: [edk2-devel] [PATCH] Silicon/Synopsys/DesignWare: DwEmacSnpDxe: Fix bug in EmacGetDmaStatus

2023-07-25 Thread wangy
Hi Pedro Falcato,


At 2023-07-25 16:45:01, "Pedro Falcato"  wrote:
>On Tue, Jul 25, 2023 at 2:10 AM  wrote:
>>
>> From: Yang Wang 
>>
>> Check EmacGetDmaStatus input parameters
>> IrqStat may be a null pointer.
>>
>> Signed-off-by: Yang Wang 
>> ---
>>  .../Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c  |  7 +--
>>  .../Drivers/DwEmacSnpDxe/EmacDxeUtil.c   | 16 
>>  .../Drivers/DwEmacSnpDxe/EmacDxeUtil.h   |  2 +-
>>  3 files changed, 18 insertions(+), 7 deletions(-)
>>
>> diff --git a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c 
>> b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c
>> index 4cb3371d79..6805511a1d 100755
>> --- a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c
>> +++ b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c
>> @@ -847,9 +847,12 @@ SnpGetStatus (
>>}
>>
>>// Check DMA Irq status
>> -  EmacGetDmaStatus (IrqStat, Snp->MacBase);
>> +  Status = EmacGetDmaStatus (IrqStat, Snp->MacBase);
>> +  if (EFI_ERROR(Status)) {
>> +DEBUG ((DEBUG_ERROR, "%a: error  Status: %r\n", __func__, Status));
>> +  }
>>
>> -  return EFI_SUCCESS;
>> +  return Status;
>>  }
>>
>>
>> diff --git a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.c 
>> b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.c
>> index 3b982ce984..45b5a05f51 100755
>> --- a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.c
>> +++ b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.c
>> @@ -489,16 +489,22 @@ EmacDmaStart (
>>  }
>>
>>
>> -VOID
>> +EFI_STATUS
>>  EFIAPI
>>  EmacGetDmaStatus (
>>OUT  UINT32   *IrqStat  OPTIONAL,
>>IN   UINTNMacBaseAddress
>>)
>>  {
>> -  UINT32  DmaStatus;
>> -  UINT32  ErrorBit;
>> -  UINT32  Mask = 0;
>> +  UINT32DmaStatus;
>> +  UINT32ErrorBit;
>> +  UINT32Mask = 0;
>> +  EFI_STATUSStatus = EFI_SUCCESS;
>> +
>> +  if (IrqStat == NULL) {
>> +Status = EFI_INVALID_PARAMETER;
>> +goto EXIT;
>> +  }
>
>This patch looks bogus to me. IrqStat is marked OPTIONAL, how can you

>error out if it isn't provided?


I foud in the MnpRecycleTxBuf(), it will pass NULL in 2nd parameter at code of 
'Status=Snp ->GetStatus (Snp, NULL, (VOID * *));'.
then in EmacGetDmaStatus(), it will not check this pointer and use directly, 
causig this problem (system hang). That's why I add above check.


>Also, please CC maintainers next time.


Thanks for remding.


However, I found the maintainer mailbox info in file platforms/Maintainers.txt, 
is not complete match to what you listed, I am a little bit confused

R: Ard Biesheuvel  
M: Leif Lindholm 
May I ask if the maintainer information is obtained here?


Regards,


Yang


>
>>
>>DmaStatus = MmioRead32 (MacBaseAddress +
>> DW_EMAC_DMAGRP_STATUS_OFST);
>> @@ -602,6 +608,8 @@ EmacGetDmaStatus (
>>MmioOr32 (MacBaseAddress +
>>  DW_EMAC_DMAGRP_STATUS_OFST,
>>  Mask);
>> +EXIT:
>> +  return Status;
>>  }
>>
>>
>> diff --git a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.h 
>> b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.h
>> index c4c3653dc7..60f30ecd16 100755
>> --- a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.h
>> +++ b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.h
>> @@ -339,7 +339,7 @@ EmacDmaStart (
>>);
>>
>>
>> -VOID
>> +EFI_STATUS
>>  EFIAPI
>>  EmacGetDmaStatus (
>>OUT UINT32  *IrqStat  OPTIONAL,
>> --
>> 2.25.1
>>
>>
>>
>> 
>> Groups.io Links: You receive all messages sent to this group.
>> View/Reply Online (#107195): https://edk2.groups.io/g/devel/message/107195
>> Mute This Topic: https://groups.io/mt/100342205/5946980
>> Group Owner: devel+ow...@edk2.groups.io
>> Unsubscribe: https://edk2.groups.io/g/devel/unsub [pedro.falc...@gmail.com]
>> 
>>
>>
>
>
>-- 
>Pedro
>
>
>
>


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




[edk2-devel] [PATCH v3 5/5] DynamicTablesPkg: Smbios Physical Memory Array (Type 16)

2023-07-25 Thread Girish Mahadevan via groups.io
Add the Generator library for SMBIOS Table Type 16 - Physical
Memory Array.

Signed-off-by: Girish Mahadevan 
Reviewed-by: Jeff Brasen 
Reviewed-by: Nick Ramirez 
---
 .../SmbiosTableBuilder.c  |   3 -
 .../Include/SmbiosNameSpaceObjects.h  |  19 +
 .../SmbiosType16Lib/SmbiosType16Generator.c   | 361 ++
 .../SmbiosType16Lib/SmbiosType16Lib.inf   |  35 ++
 4 files changed, 415 insertions(+), 3 deletions(-)
 create mode 100644 
DynamicTablesPkg/Library/Smbios/SmbiosType16Lib/SmbiosType16Generator.c
 create mode 100644 
DynamicTablesPkg/Library/Smbios/SmbiosType16Lib/SmbiosType16Lib.inf

diff --git 
a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableBuilder.c 
b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableBuilder.c
index bfddaac3aa..5feafcac66 100644
--- a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableBuilder.c
+++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableBuilder.c
@@ -312,7 +312,6 @@ exit_handler:
 }
   }
 
-  DEBUG ((DEBUG_ERROR, "%a: Returning %r\n", __FUNCTION__, Status));
   return Status;
 }
 
@@ -432,7 +431,6 @@ BuildAndInstallSmbiosTable (
   ));
   }
 
-  DEBUG ((DEBUG_ERROR, "%a: Returning %r\n", __FUNCTION__, Status));
   return Status;
 }
 
@@ -516,7 +514,6 @@ ProcessSmbiosTables (
   ));
   }
 
-  DEBUG ((DEBUG_ERROR, "%a: Returning %r\n", __FUNCTION__, Status));
   return Status;
 }
 
diff --git a/DynamicTablesPkg/Include/SmbiosNameSpaceObjects.h 
b/DynamicTablesPkg/Include/SmbiosNameSpaceObjects.h
index e44d703fac..760b082021 100644
--- a/DynamicTablesPkg/Include/SmbiosNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/SmbiosNameSpaceObjects.h
@@ -107,6 +107,25 @@ typedef struct {
   SMBIOS_TABLE_GENERATOR_IDGeneratorId;
 } CONTAINED_CM_OBJECTS;
 
+/** A structure that describes the Physical Memory Array.
+
+  SMBIOS Specification v3.6.0 Type 16
+
+  ID: ESmbiosObjPhysicalMemoryArray
+**/
+typedef struct CmSmbiosPhysicalMemoryArray {
+  UINT8  Use;
+  UINT8  Location;
+  UINT16 MemoryErrorCorrection;
+  UINT16 MemoryErrorInformationHandle;
+  UINT16 NumberOfMemoryDevices;
+  UINT8  MemoryErrorCorrectionType;
+  UINT64 Size;
+  UINT8  NumMemDevices;
+  CM_OBJECT_TOKENMemoryErrInfoToken;
+  CM_OBJECT_TOKENPhysMemArrayToken;
+} CM_SMBIOS_PHYSICAL_MEMORY_ARRAY;
+
 #pragma pack()
 
 #endif // SMBIOS_NAMESPACE_OBJECTS_H_
diff --git 
a/DynamicTablesPkg/Library/Smbios/SmbiosType16Lib/SmbiosType16Generator.c 
b/DynamicTablesPkg/Library/Smbios/SmbiosType16Lib/SmbiosType16Generator.c
new file mode 100644
index 00..dad7588ed5
--- /dev/null
+++ b/DynamicTablesPkg/Library/Smbios/SmbiosType16Lib/SmbiosType16Generator.c
@@ -0,0 +1,361 @@
+/** @file
+  SMBIOS Type16 Table Generator.
+
+  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+  Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+// Module specific include files.
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/** This macro expands to a function that retrieves the Memory Device
+information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+  EObjNameSpaceSmbios,
+  ESmbiosObjPhysicalMemoryArray,
+  CM_SMBIOS_PHYSICAL_MEMORY_ARRAY
+  )
+
+#define EXTENDED_SIZE_THRESHOLD  (SIZE_2TB)
+
+/**
+ * Free any resources allocated when installing SMBIOS Type16 table.
+ *
+ * @param [in]  This Pointer to the SMBIOS table generator.
+ * @param [in]  TableFactoryProtocol Pointer to the SMBIOS Table Factory
+  Protocol interface.
+
+ * @param [in]  SmbiosTableInfo  Pointer to the SMBIOS table information.
+ * @param [in]  CfgMgrProtocol   Pointer to the Configuration Manager
+ Protocol interface.
+ * @param [in] Table Pointer to the SMBIOS table.
+ * @param [in] CmObjectToken Pointer to the CM ObjectToken Array.
+ * @param [in] TableCountNumber of SMBIOS tables.
+
+ * @retval EFI_SUCCESSTable generated successfully.
+ * @retval EFI_BAD_BUFFER_SIZEThe size returned by the Configuration
+  Manager is less than the Object size for
+  the requested object.
+ * @retval EFI_INVALID_PARAMETER  A parameter is invalid.
+ * @retval EFI_NOT_FOUND  Could not find information.
+ * @retval EFI_OUT_OF_RESOURCES   Could not allocate memory.
+ * @retval EFI_UNSUPPORTEDUnsupported configuration.
+**/
+STATIC
+EFI_STATUS
+FreeSmbiosType16TableEx (
+  IN  CONST SMBIOS_TABLE_GENERATOR*CONST   This,
+  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  *CONST   
TableFactoryProtocol,
+  IN  CONST 

[edk2-devel] [PATCH v3 3/5] DynamicTablesPkg: Introduce new namespace for SMBIOS Objects

2023-07-25 Thread Girish Mahadevan via groups.io
Introduce a new namespace for SMBIOS related CM Objects.

Signed-off-by: Girish Mahadevan 
Reviewed-by: Nick Ramirez 
Reviewed-by: Jeff Brasen 
---
 .../Include/ConfigurationManagerObject.h  | 14 ++-
 .../Include/SmbiosNameSpaceObjects.h  | 42 +++
 2 files changed, 55 insertions(+), 1 deletion(-)
 create mode 100644 DynamicTablesPkg/Include/SmbiosNameSpaceObjects.h

diff --git a/DynamicTablesPkg/Include/ConfigurationManagerObject.h 
b/DynamicTablesPkg/Include/ConfigurationManagerObject.h
index 74ad25d5d9..445c560545 100644
--- a/DynamicTablesPkg/Include/ConfigurationManagerObject.h
+++ b/DynamicTablesPkg/Include/ConfigurationManagerObject.h
@@ -14,6 +14,7 @@
 
 #include 
 #include 
+#include 
 
 #pragma pack(1)
 
@@ -107,7 +108,8 @@ typedef UINT32 CM_OBJECT_ID;
 typedef enum ObjectNameSpaceID {
   EObjNameSpaceStandard,  ///< Standard Objects Namespace
   EObjNameSpaceArm,   ///< ARM Objects Namespace
-  EObjNameSpaceOem = 0x8, ///< OEM Objects Namespace
+  EObjNameSpaceOem= 0x8,  ///< OEM Objects Namespace
+  EObjNameSpaceSmbios = 0xA,  ///< SMBIOS Objects Namespace
   EObjNameSpaceMax
 } EOBJECT_NAMESPACE_ID;
 
@@ -192,4 +194,14 @@ typedef struct CmObjDescriptor {
 #define CREATE_CM_OEM_OBJECT_ID(ObjectId) \
   (CREATE_CM_OBJECT_ID (EObjNameSpaceOem, ObjectId))
 
+/** This macro returns a Configuration Manager Object ID
+in the SMBIOS Object Namespace.
+
+  @param [in] ObjectIdThe Object ID.
+
+  @retval Returns an SMBIOS Configuration Manager Object ID.
+**/
+#define CREATE_CM_SMBIOS_OBJECT_ID(ObjectId) \
+  (CREATE_CM_OBJECT_ID (EObjNameSpaceSmbios, ObjectId))
+
 #endif // CONFIGURATION_MANAGER_OBJECT_H_
diff --git a/DynamicTablesPkg/Include/SmbiosNameSpaceObjects.h 
b/DynamicTablesPkg/Include/SmbiosNameSpaceObjects.h
new file mode 100644
index 00..836c902e40
--- /dev/null
+++ b/DynamicTablesPkg/Include/SmbiosNameSpaceObjects.h
@@ -0,0 +1,42 @@
+/** @file
+
+  Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Glossary:
+- Cm or CM   - Configuration Manager
+- Obj or OBJ - Object
+- Std or STD - Standard
+**/
+
+#ifndef SMBIOS_NAMESPACE_OBJECTS_H_
+#define SMBIOS_NAMESPACE_OBJECTS_H_
+
+#pragma pack(1)
+
+typedef enum SmbiosObjectID {
+  ESmbiosObjReserved,  ///< 0  - Reserved
+  ESmbiosObjBaseboardInfo, ///< 1  - Baseboard Information
+  ESmbiosObjSystemSlotInfo,///< 2  - System Slot Information
+  ESmbiosObjSystemInfo,///< 3  - System Information
+  ESmbiosObjTpmDeviceInfo, ///< 4  - TPM Device Info
+  ESmbiosObjOemStrings,///< 5  - OEM Strings
+  ESmbiosObjPortConnectorInfo, ///< 6  - Port connector Information
+  ESmbiosObjBiosInfo,  ///< 7 - Bios Information
+  ESmbiosObjOnboardDeviceExInfo,   ///< 8 - Onboard Device Ex Information
+  ESmbiosObjGroupAssociations, ///< 9 - Group Associations
+  ESmbiosObjBiosLanguageInfo,  ///< 10 - BIOS Language Information
+  ESmbiosObjEnclosureInfo, ///< 11 - Enclosure Information
+  ESmbiosObjMemoryDeviceInfo,  ///< 12 - Memory Device Information
+  ESmbiosObjSystemBootInfo,///< 13 - System Boot Info
+  ESmbiosObjPhysicalMemoryArray,   ///< 14 - Physical Memory Array
+  ESmbiosObjMemoryArrayMappedAddress,  ///< 15 - Memory Mapped Address
+  ESmbiosObjPowerSupplyInfo,   ///< 16 - Power Supply Info
+  ESmbiosObjFirmwareInventoryInfo, ///< 17 - Firmware Inventory Info
+  ESmbiosObjMax
+} ESMBIOS_OBJECT_ID;
+
+#pragma pack()
+
+#endif // SMBIOS_NAMESPACE_OBJECTS_H_
-- 
2.17.1



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




[edk2-devel] [PATCH v3 2/5] DynamicTablesPkg: Split the ACPI and SMBIOS table generators

2023-07-25 Thread Girish Mahadevan via groups.io
Split the SMBIOS and ACPI table generators into their own files.

Signed-off-by: Girish Mahadevan 
Reviewed-by: Jeff Brasen 
---
 .../DynamicTableManagerDxe/AcpiTableBuilder.c |  798 ++
 .../DynamicTableManagerDxe.c  | 1356 +
 .../DynamicTableManagerDxe.inf|2 +
 .../SmbiosTableBuilder.c  |  606 
 4 files changed, 1419 insertions(+), 1343 deletions(-)
 create mode 100644 
DynamicTablesPkg/Drivers/DynamicTableManagerDxe/AcpiTableBuilder.c
 create mode 100644 
DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableBuilder.c

diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/AcpiTableBuilder.c 
b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/AcpiTableBuilder.c
new file mode 100644
index 00..2adfb0378e
--- /dev/null
+++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/AcpiTableBuilder.c
@@ -0,0 +1,798 @@
+/** @file
+  Acpi Table Manager Dxe
+
+  Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
+  Copyright (c) 2022 - 2023, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+// Module specific include files.
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+///
+/// Bit definitions for acceptable ACPI table presence formats.
+/// Currently only ACPI tables present in the ACPI info list and
+/// already installed will count towards "Table Present" during
+/// verification routine.
+///
+#define ACPI_TABLE_PRESENT_INFO_LIST  BIT0
+#define ACPI_TABLE_PRESENT_INSTALLED  BIT1
+
+///
+/// Order of ACPI table being verified during presence inspection.
+///
+#define ACPI_TABLE_VERIFY_FADT   0
+#define ACPI_TABLE_VERIFY_MADT   1
+#define ACPI_TABLE_VERIFY_GTDT   2
+#define ACPI_TABLE_VERIFY_DSDT   3
+#define ACPI_TABLE_VERIFY_DBG2   4
+#define ACPI_TABLE_VERIFY_SPCR   5
+#define ACPI_TABLE_VERIFY_COUNT  6
+
+///
+/// Private data structure to verify the presence of mandatory
+/// or optional ACPI tables.
+///
+typedef struct {
+  /// ESTD ID for the ACPI table of interest.
+  ESTD_ACPI_TABLE_IDEstdTableId;
+  /// Standard UINT32 ACPI signature.
+  UINT32AcpiTableSignature;
+  /// 4 character ACPI table name (the 5th char8 is for null terminator).
+  CHAR8 AcpiTableName[sizeof (UINT32) + 1];
+  /// Indicator on whether the ACPI table is required.
+  BOOLEAN   IsMandatory;
+  /// Formats of verified presences, as defined by ACPI_TABLE_PRESENT_*
+  /// This field should be initialized to 0 and will be populated during
+  /// verification routine.
+  UINT16Presence;
+} ACPI_TABLE_PRESENCE_INFO;
+
+///
+/// We require the FADT, MADT, GTDT and the DSDT tables to boot.
+/// This list also include optional ACPI tables: DBG2, SPCR.
+///
+ACPI_TABLE_PRESENCE_INFO  mAcpiVerifyTables[ACPI_TABLE_VERIFY_COUNT] = {
+  { EStdAcpiTableIdFadt, EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,  
  "FADT", TRUE,  0 },
+  { EStdAcpiTableIdMadt, 
EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, "MADT", TRUE,  
0 },
+  { EStdAcpiTableIdGtdt, 
EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, "GTDT", TRUE,  
0 },
+  { EStdAcpiTableIdDsdt, 
EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, "DSDT", TRUE,  
0 },
+  { EStdAcpiTableIdDbg2, EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE,
  "DBG2", FALSE, 0 },
+  { EStdAcpiTableIdSpcr, 
EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE,   "SPCR", FALSE, 
0 },
+};
+
+/** This macro expands to a function that retrieves the ACPI Table
+List from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+  EObjNameSpaceStandard,
+  EStdObjAcpiTableList,
+  CM_STD_OBJ_ACPI_TABLE_INFO
+  )
+
+/** A helper function to build and install a single ACPI table.
+
+  This is a helper function that invokes the Table generator interface
+  for building an ACPI table. It uses the AcpiTableProtocol to install the
+  table, then frees the resources allocated for generating it.
+
+  @param [in]  TableFactoryProtocol Pointer to the Table Factory Protocol
+interface.
+  @param [in]  CfgMgrProtocol   Pointer to the Configuration Manager
+Protocol Interface.
+  @param [in]  GeneratorPointer to the AcpiTable generator.
+  @param [in]  AcpiTableProtocolPointer to the AcpiTable protocol.
+  @param [in]  AcpiTableInfoPointer to the ACPI table Info.
+
+  @retval EFI_SUCCESS   Success.
+  @retval EFI_INVALID_PARAMETER A parameter is invalid.
+  @retval EFI_NOT_FOUND Required object is not found.
+  @retval EFI_BAD_BUFFER_SIZE   Size returned by the Configuration Manager
+is less than the Object size for the
+requested 

[edk2-devel] [PATCH v3 4/5] DynamicTablesPkg: Smbios Memory Device (Type 17)

2023-07-25 Thread Girish Mahadevan via groups.io
Add the Generator library for SMBIOS Table Type 17 - Memory
Device.

Signed-off-by: Girish Mahadevan 
Reviewed-by: Jeff Brasen 
---
 .../Include/SmbiosNameSpaceObjects.h  |  70 +++
 .../SmbiosType17Lib/SmbiosType17Generator.c   | 445 ++
 .../SmbiosType17Lib/SmbiosType17Lib.inf   |  36 ++
 3 files changed, 551 insertions(+)
 create mode 100644 
DynamicTablesPkg/Library/Smbios/SmbiosType17Lib/SmbiosType17Generator.c
 create mode 100644 
DynamicTablesPkg/Library/Smbios/SmbiosType17Lib/SmbiosType17Lib.inf

diff --git a/DynamicTablesPkg/Include/SmbiosNameSpaceObjects.h 
b/DynamicTablesPkg/Include/SmbiosNameSpaceObjects.h
index 836c902e40..e44d703fac 100644
--- a/DynamicTablesPkg/Include/SmbiosNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/SmbiosNameSpaceObjects.h
@@ -13,6 +13,8 @@
 #ifndef SMBIOS_NAMESPACE_OBJECTS_H_
 #define SMBIOS_NAMESPACE_OBJECTS_H_
 
+#include 
+
 #pragma pack(1)
 
 typedef enum SmbiosObjectID {
@@ -37,6 +39,74 @@ typedef enum SmbiosObjectID {
   ESmbiosObjMax
 } ESMBIOS_OBJECT_ID;
 
+/** A structure that describes the physical memory device.
+
+  The physical memory devices on the system are described by this object.
+
+  SMBIOS Specification v3.5.0 Type17
+
+  ID: ESmbiosObjMemoryDeviceInfo,
+*/
+typedef struct CmSmbiosMemoryDeviceInfo {
+  /** Size of the device.
+Size of the device in bytes.
+  */
+  UINT64   Size;
+
+  /** Device Set */
+  UINT8DeviceSet;
+
+  /** Speed of the device
+Speed of the device in MegaTransfers/second.
+  */
+  UINT32   Speed;
+
+  /** Serial Number of device  */
+  CHAR8*SerialNum;
+
+  /** AssetTag identifying the device */
+  CHAR8*AssetTag;
+
+  /** Device Locator String for the device.
+   String that describes the slot or position of the device on the board.
+   */
+  CHAR8*DeviceLocator;
+
+  /** Bank locator string for the device.
+   String that describes the bank where the device is located.
+   */
+  CHAR8*BankLocator;
+
+  /** Firmware version of the memory device */
+  CHAR8*FirmwareVersion;
+
+  /** Manufacturer Id.
+   2 byte Manufacturer Id as per JEDEC Standard JEP106AV
+  */
+  UINT16   ModuleManufacturerId;
+
+  /** Manufacturer Product Id
+   2 byte Manufacturer Id as designated by Manufacturer.
+  */
+  UINT16   ModuleProductId;
+
+  CM_OBJECT_TOKEN  MemoryDeviceInfoToken;
+  CM_OBJECT_TOKEN  PhysicalArrayToken;
+  UINT16   DataWidth;
+  UINT16   TotalWidth;
+  UINT8Rank;
+
+  MEMORY_DEVICE_TYPE   DeviceType;
+  MEMORY_DEVICE_TYPE_DETAILTypeDetail;
+  MEMORY_DEVICE_TECHNOLOGY DeviceTechnology;
+  MEMORY_FORM_FACTOR   FormFactor;
+} CM_SMBIOS_MEMORY_DEVICE_INFO;
+
+typedef struct {
+  CM_OBJECT_TOKEN  CmObjToken;
+  SMBIOS_TABLE_GENERATOR_IDGeneratorId;
+} CONTAINED_CM_OBJECTS;
+
 #pragma pack()
 
 #endif // SMBIOS_NAMESPACE_OBJECTS_H_
diff --git 
a/DynamicTablesPkg/Library/Smbios/SmbiosType17Lib/SmbiosType17Generator.c 
b/DynamicTablesPkg/Library/Smbios/SmbiosType17Lib/SmbiosType17Generator.c
new file mode 100644
index 00..27f2dfc235
--- /dev/null
+++ b/DynamicTablesPkg/Library/Smbios/SmbiosType17Lib/SmbiosType17Generator.c
@@ -0,0 +1,445 @@
+/** @file
+  SMBIOS Type17 Table Generator.
+
+  Copyright (c) 2022 - 2023, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+  Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+// Module specific include files.
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/** This macro expands to a function that retrieves the Memory Device
+information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+  EObjNameSpaceSmbios,
+  ESmbiosObjMemoryDeviceInfo,
+  CM_SMBIOS_MEMORY_DEVICE_INFO
+  )
+
+#define EXTENDED_SIZE_THRESHOLD (0x7FFF0LL)
+#define SIZE_GRANULARITY_THRESHOLD  (0x10L)
+#define SIZE_GRANULARITY_BITMASK(0x8000)
+#define EXTENDED_SPEED_THRESHOLD(0x)
+#define SMBIOS_TYPE17_MAX_STRINGS   (7)
+#define RANK_MASK   (0x7)
+
+STATIC
+EFI_STATUS
+FreeSmbiosType17TableEx (
+  IN  CONST SMBIOS_TABLE_GENERATOR   *CONST  This,
+  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST  
TableFactoryProtocol,
+  IN  CONST CM_STD_OBJ_SMBIOS_TABLE_INFO *CONST  
SmbiosTableInfo,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST  
CfgMgrProtocol,
+  IN  SMBIOS_STRUCTURE ***CONST  Table,
+  IN  CM_OBJECT_TOKEN
**CmObjectToken,
+  IN  CONST UINTN

[edk2-devel] [PATCH v3 1/5] DynamicTablesPkg: Add SMBIOS table generation

2023-07-25 Thread Girish Mahadevan via groups.io
Add the SMBIOS Table generator code to the DynamicTablesPkg.

This change includes adding new logic to the DynamicTableManager
to process and add SMBIOS tables and augmenting the existing SMBIOS
Factory generator to include installing multiple SMBIOS tables .
Also included is running the SMBIOS and ACPI table generation as part
of the SMBIOS and ACPI protocol GUID callback notifications respectively.

Change-Id: Icc090108c16e87657260af6daf856f3d69b602e3
Signed-off-by: Girish Mahadevan 
Reviewed-by: Jeff Brasen 
---
 .../DynamicTableFactory.h |   5 +
 .../DynamicTableFactoryDxe.c  |  10 +
 .../SmbiosTableFactory/SmbiosTableFactory.c   | 108 +++
 .../DynamicTableManagerDxe.c  | 677 +-
 .../DynamicTableManagerDxe.inf|   3 +-
 .../Protocol/DynamicTableFactoryProtocol.h|  10 +
 .../Include/SmbiosTableGenerator.h| 204 +-
 MdePkg/Include/IndustryStandard/SmBios.h  |   8 +
 8 files changed, 994 insertions(+), 31 deletions(-)

diff --git 
a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactory.h 
b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactory.h
index b160dcf8ad..20e438ea70 100644
--- a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactory.h
+++ b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactory.h
@@ -49,6 +49,11 @@ typedef struct DynamicTableFactoryInfo {
 CustomDtTableGeneratorList[FixedPcdGet16 (
  PcdMaxCustomDTGenerators
  )];
+
+  /// An array for holding a map of SMBIOS handles and the CM Object
+  /// token used to build the SMBIOS record.
+  SMBIOS_HANDLE_MAP
+SmbiosHandleMap[MAX_SMBIOS_HANDLES];
 } EDKII_DYNAMIC_TABLE_FACTORY_INFO;
 
 /** Return a pointer to the ACPI table generator.
diff --git 
a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c 
b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c
index 6d6d3fa746..577cdb576e 100644
--- a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c
+++ b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c
@@ -1,6 +1,7 @@
 /** @file
   Dynamic Table Factory Dxe
 
+  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
   Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -44,6 +45,9 @@ EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL  
DynamicTableFactoryProtocol = {
   GetDtTableGenerator,
   RegisterDtTableGenerator,
   DeregisterDtTableGenerator,
+  AddSmbiosHandle,
+  FindSmbiosHandle,
+  FindSmbiosHandleEx,
   
 };
 
@@ -65,6 +69,12 @@ DynamicTableFactoryDxeInitialize (
   )
 {
   EFI_STATUS  Status;
+  UINTN   Idx;
+
+  for (Idx = 0; Idx < MAX_SMBIOS_HANDLES; Idx++) {
+TableFactoryInfo.SmbiosHandleMap[Idx].SmbiosTblHandle = 
SMBIOS_HANDLE_PI_RESERVED;
+TableFactoryInfo.SmbiosHandleMap[Idx].SmbiosCmToken   = 0;
+  }
 
   Status = gBS->InstallProtocolInterface (
   ,
diff --git 
a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/SmbiosTableFactory/SmbiosTableFactory.c
 
b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/SmbiosTableFactory/SmbiosTableFactory.c
index 87795919f8..b928c28a14 100644
--- 
a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/SmbiosTableFactory/SmbiosTableFactory.c
+++ 
b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/SmbiosTableFactory/SmbiosTableFactory.c
@@ -1,6 +1,7 @@
 /** @file
   SMBIOS Table Factory
 
+  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
   Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -12,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 // Module specific include files.
@@ -24,6 +26,71 @@
 
 extern EDKII_DYNAMIC_TABLE_FACTORY_INFO  TableFactoryInfo;
 
+/** Add a new entry to the SMBIOS table Map.
+
+  @param [in]  Smbios SMBIOS Protocol pointer.
+  @param [in]  SmbiosHandle   SMBIOS Handle to be added, if the value 
SMBIOS_HANDLE_PI_RESERVED
+  is passed then a new SmbiosHandle is assigned.
+  @param [in]  CmObjectToken  CmObjectToken of the CM_OBJECT used to build the 
SMBIOS Table
+  @param [in]  GeneratorIdSmbios Table Generator Id.
+
+  @retval EFI_SUCCESS   Successfully added/generated the handle.
+  @retval EFI_OUT_OF_RESOURCESNULL  Failure to add/generate the handle.
+**/
+EFI_STATUS
+EFIAPI
+AddSmbiosHandle (
+  IN EFI_SMBIOS_PROTOCOL *Smbios,
+  IN SMBIOS_HANDLE   *SmbiosHandle,
+  IN CM_OBJECT_TOKEN CmObjectToken,
+  IN  SMBIOS_TABLE_GENERATOR_ID  GeneratorId
+  )
+{
+  EFI_STATUS  Status;
+  UINTN   Index;
+
+  Status = EFI_OUT_OF_RESOURCES;
+
+  for (Index = 0; Index < MAX_SMBIOS_HANDLES; Index++) {
+if (TableFactoryInfo.SmbiosHandleMap[Index].SmbiosTblHandle == 

[edk2-devel] [PATCH v3 0/5] DynamicTablesPkg: Add SMBIOS Table Generation

2023-07-25 Thread Girish Mahadevan via groups.io
Patch series to add SMBIOS Table generation using DynamicTablesPkg

This patch series builds on top of the SMBIOS table dispatcher work that
dispatches and installs SMBIOS tables in the correct order.

This patches series does the following:
- Modify the existing DynamicTableManagerDxe driver to remove the Depex on
  AcpiTableProtocolGuid , instead setup notify callbacks for the ACPI and
  SMBIOS protocols. This is because not all systems mandate ACPI tables be
  present in which case SMBIOS tables won't get installed.
- Add functions to build and install single and multiple SMBIOS tables similar
  to ACPI tables.
- Modify the Smbios Table Factory code to add a Handle map to go between the 
  SMBIOS handles and the CMObject Token that is used to generate the SMBIOS
  tables.
- After installing each SMBIOS table update the Handle map with the generated
  SMBIOS handle and the CMObject Token (usually the CM Object used to generate
  the table) or a generated Token.
- Split the ACPI and SMBIOS table manager code into their own files.
- Introduce a new namepsace for SMBIOS CM objects.
- Add new generator libraries for SMBIOS table type17 (Memory Device) and 
type16 
  (Physical Memory Array)

This patch series can be seen at
https://github.com/tianocore/edk2/compare/master...gmahadevan:RFC/smbios-dyntables-v2-genonly

The complete patch series which includes 18 Table Generators is available here:
https://github.com/tianocore/edk2/compare/master...gmahadevan:edk2-upstream:RFC/smbios-dyntables-v2

Girish Mahadevan (5):
  DynamicTablesPkg: Add SMBIOS table generation
  DynamicTablesPkg: Split the ACPI and SMBIOS table generators
  DynamicTablesPkg: Introduce new namespace for SMBIOS Objects
  DynamicTablesPkg: Smbios Memory Device (Type 17)
  DynamicTablesPkg: Smbios Physical Memory Array (Type 16)

 .../DynamicTableFactory.h |   5 +
 .../DynamicTableFactoryDxe.c  |  10 +
 .../SmbiosTableFactory/SmbiosTableFactory.c   | 108 +++
 .../DynamicTableManagerDxe/AcpiTableBuilder.c | 798 ++
 .../DynamicTableManagerDxe.c  | 781 +
 .../DynamicTableManagerDxe.inf|   5 +-
 .../SmbiosTableBuilder.c  | 603 +
 .../Include/ConfigurationManagerObject.h  |  14 +-
 .../Protocol/DynamicTableFactoryProtocol.h|  10 +
 .../Include/SmbiosNameSpaceObjects.h  | 131 +++
 .../Include/SmbiosTableGenerator.h| 204 -
 .../SmbiosType16Lib/SmbiosType16Generator.c   | 361 
 .../SmbiosType16Lib/SmbiosType16Lib.inf   |  35 +
 .../SmbiosType17Lib/SmbiosType17Generator.c   | 445 ++
 .../SmbiosType17Lib/SmbiosType17Lib.inf   |  36 +
 MdePkg/Include/IndustryStandard/SmBios.h  |   8 +
 16 files changed, 2805 insertions(+), 749 deletions(-)
 create mode 100644 
DynamicTablesPkg/Drivers/DynamicTableManagerDxe/AcpiTableBuilder.c
 create mode 100644 
DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableBuilder.c
 create mode 100644 DynamicTablesPkg/Include/SmbiosNameSpaceObjects.h
 create mode 100644 
DynamicTablesPkg/Library/Smbios/SmbiosType16Lib/SmbiosType16Generator.c
 create mode 100644 
DynamicTablesPkg/Library/Smbios/SmbiosType16Lib/SmbiosType16Lib.inf
 create mode 100644 
DynamicTablesPkg/Library/Smbios/SmbiosType17Lib/SmbiosType17Generator.c
 create mode 100644 
DynamicTablesPkg/Library/Smbios/SmbiosType17Lib/SmbiosType17Lib.inf

-- 
2.17.1



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




Re: [edk2-devel] [PATCH v2 2/4] DynamicTablesPkg: Add SMBIOS table dispatcher

2023-07-25 Thread Girish Mahadevan via groups.io

Hi Sami

My responses inline [GM]

Best Regards
Girish

On 7/24/2023 11:48 AM, Sami Mujawar wrote:

External email: Use caution opening links or attachments


Hi Girish,

Thank you for taking this effort forward

Please find my response inline marked [SAMI].

Regards,

Sami Mujawar

On 22/07/2023 12:14 am, Girish Mahadevan wrote:

Hi Sami

Your patches worked. There was just one thing I had to add to get
compile to work. (inline with [GM]), other than that I think you can
get this in.

[SAMI] Thanks for testing these patches.


We've implemented about 18 table generators. (Types  0, 1, 2, 3, 8, 9,
11, 13, 14, 16, 17, 19, 32, 38, 39, 41, 43, 45)
Two more are under way (Type 4.7).

[SAMI] I would be keen to understand how the Type 4 and 7 generators
would work as I would prefer to avoid duplication of data.




[GM]
As a first pass we're setting up the generators to just blindly use 
SMBIOS specific CM objects to setup these tables.


Second pass could be to have the generators try to rely on ACPI objects 
(PPTT) or fallback to Architecture specific libraries to figure out how 
to populate these tables. Honestly we need to think about this a little 
more, we'd love to swap notes.

(We are in the prelim stages of these so haven't gotten very far)



I've setup a github repo here
https://github.com/tianocore/edk2/compare/master...gmahadevan:edk2-upstream:RFC/smbios-dyntables-v2?expand=1


[SAMI] Thanks for sharing the github branch. Please also share a github
branch when you send out your patches for review.




[GM]
Will do.


I could send you one massive patch train (22 patches or so) or split
it up into smaller chunks perhaps just the table generation stuff
first and then each generator library.


[SAMI] I think it may be good to split the patch series to include table
generation and then 1 or 2 generators to understand the code flow. The
remaining generators can follow later. I think Type 4 and 7 would be
really interesting, but you can send what you already have.


[GM]
ok, I will send out a patch train for the core generator code and 2 of 
the Generators.


Best Regards
Girish


Let me know.

Best Regards
Girish


On 3/10/2023 9:28 AM, Sami Mujawar wrote:

External email: Use caution opening links or attachments


Hi Girish,

On 10/03/2023 04:23 pm, Girish Mahadevan wrote:

Hi Sami

Response inline.[GM]

Best Regards
Girish

On 3/9/2023 3:41 AM, Sami Mujawar wrote:

External email: Use caution opening links or attachments


Hi Girish,

Thank you for your feedback.

Please find my response inline marked [SAMI].

Regards,

Sami Mujawar

On 08/03/2023, 17:41, "Girish Mahadevan" mailto:gmahade...@nvidia.com>> wrote:


Hi Sami


Thanks for v2, I will apply these to my tree and test it out.
One small comment before I review/test the patch train inline
(prefixed
by [GM])


Best Regards
Girish


On 3/8/2023 1:16 AM, Sami Mujawar wrote:

External email: Use caution opening links or attachments


Some SMBIOS structure/table fields have dependency on other SMBIOS
structures/tables. These dependencies are established using handles
pointing to the dependent tables.

A SMBIOS table handle can be obtained by either installing a SMBIOS
table or by allocating a handle, which requires complex management
to avoid any clashes.

Obtaining a SMBIOS handle by installation requires that the dependent
table is installed before the parent SMBIOS table can be installed.
Therefore, introduce a SMBIOS table dispatcher that walks the SMBIOS
dependency list and schedules the dependent tables to be installed
before the parent table is installed.

Signed-off-by: Sami Mujawar mailto:sami.muja...@arm.com>>
Cc: Alexei Fedorov mailto:alexei.fedo...@arm.com>>
Cc: Pierre Gondois mailto:pierre.gond...@arm.com>>
Cc: Girish Mahadevan mailto:gmahade...@nvidia.com>>
Cc: Jeff Brasen mailto:jbra...@nvidia.com>>
Cc: Ashish Singhal mailto:ashishsin...@nvidia.com>>
Cc: Nick Ramirez mailto:nrami...@nvidia.com>>
Cc: William Watson mailto:wwat...@nvidia.com>>
Cc: Abner Chang mailto:abner.ch...@amd.com>>
Cc: Samer El-Haj-Mahmoud mailto:samer.el-haj-mahm...@arm.com>>
Cc: Jose Marinho mailto:jose.mari...@arm.com>>
---

Notes:
v2:
- Update dispatcher state machine to remove StUnknown. [SAMI]
- Move extern function to header file and move debug [ABNER]
code together.
- Updated code based on review feedback to move extern [SAMI]
function to header file and also moved the debug code
together.
Ref:
https://edk2.groups.io/g/devel/message/95341



DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf

| 4 +-
DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispatcher.c

| 282 
DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableDispatcher.h

| 159 +++
3 files changed, 444 insertions(+), 1 deletion(-)

diff --git
a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf


[edk2-devel] [edk2-libc Patch 1/1] edk2-libc/StdLib: Fix uninitialized global variable

2023-07-25 Thread Jayaprakash, N
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4506

res_init() is called from different places in sockets library. It depends
on global _res variable containing a state.

The problem is that if __BIND_RES_TEXT macro is not defined, _res is not
initialized. Depending on compiler and build optimization this can fill the
variable with garbage that is later used by res_init().

Fix is trivial - explicitly initialize _res.

Cc: Rebecca Cran 
Cc: Michael D Kinney 
Cc: Jayaprakash N 
Signed-off-by: Kloper Dimitry 
---
 StdLib/BsdSocketLib/res_init.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/StdLib/BsdSocketLib/res_init.c b/StdLib/BsdSocketLib/res_init.c
index 613a76a..faf2b5e 100644
--- a/StdLib/BsdSocketLib/res_init.c
+++ b/StdLib/BsdSocketLib/res_init.c
@@ -121,9 +121,11 @@ static u_int32_t net_mask __P((struct in_addr));
  */
 
 struct __res_state _res
-# if defined(__BIND_RES_TEXT)
+#if defined(__BIND_RES_TEXT)
 = { RES_TIMEOUT, }  /* Motorola, et al. */
-# endif
+#endif
+= {0}
+#endif
 ;
 
 
-- 
2.40.0.windows.1



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




[edk2-devel] [edk2-libc Patch 0/1] edk2-libc/StdLib: Fix uninitialized global variable

2023-07-25 Thread Jayaprakash, N
This patch contains the fix for uninitialized global variable
in edk2-libc/StdLib/BsdSocketLib/res_init.c file.

Jayaprakash N (1):
  edk2-libc/StdLib: Fix uninitialized global variable

 StdLib/BsdSocketLib/res_init.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

-- 
2.40.0.windows.1



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




Re: [edk2-devel] 回复: [PATCH v2 0/4] OvmfPkg/RiscVVirt: Add CLANGDWARF toolchain support

2023-07-25 Thread Ard Biesheuvel
On Fri, 21 Jul 2023 at 06:52, Sunil V L  wrote:
>
> On Mon, Jul 17, 2023 at 11:38:31AM +0200, Ard Biesheuvel wrote:
> > On Mon, 17 Jul 2023 at 03:51, gaoliming via groups.io
> >  wrote:
> > >
> > > Sunil:
> > >   Do you use which CLANG version is used to verify this change?
> > >
> >
> > For the series,
> >
> > Tested-by: Ard Biesheuvel  # Debian clang version 14.0.6
> >
> Thanks!, Ard.
>
> Hi Liming, do you have any further feedback?
>

Could we make some progress here? I'm happy to go and merge this if i
can get an ack on the basetools change


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




[edk2-devel][edk2-platforms][PATCH V5-2] IpmiFeaturePkg:Provided multiple IPMI interface support in DXE and SMM

2023-07-25 Thread Arun K via groups.io
Created IpmiTransport2 PPI/Protocol to support multiple
IPMI BMC Interface support such as KCS/BT/SSIF/IPMB with 2 API's
IpmiSubmitCommand2 & IpmiSubmitCommand2Ex.
IpmiSubmitCommand2 - This API use the default interface
(PcdDefaultSystemInterface) to send IPMI command.
IpmiSubmitCommand2Ex - This API use the specific interface type
to send IPMI command which is passed as an argument.

Cc: Isaac Oram 
Cc: Nate DeSimone 
Cc: Liming Gao 

Signed-off-by: Arun K 
---
 .../GenericIpmi/Common/IpmiBmc.h  |  13 +-
 .../GenericIpmi/Common/IpmiBmcCommon.h|  82 +--
 .../GenericIpmi/Common/IpmiHooks.c| 298 ++-
 .../GenericIpmi/Common/IpmiHooks.h| 119 -
 .../GenericIpmi/Dxe/GenericIpmi.inf   |  14 +-
 .../IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c | 505 +-
 .../GenericIpmi/Smm/SmmGenericIpmi.c  | 351 +---
 .../GenericIpmi/Smm/SmmGenericIpmi.inf|  12 +
 8 files changed, 1117 insertions(+), 277 deletions(-)

diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/IpmiBmc.h
 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/IpmiBmc.h
index d306a085e5..76ee988623 100644
--- 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/IpmiBmc.h
+++ 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/IpmiBmc.h
@@ -3,6 +3,7 @@


   @copyright

   Copyright 1999 - 2021 Intel Corporation. 

+  Copyright (c) 1985 - 2023, American Megatrends International LLC. 

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

 **/



@@ -21,17 +22,17 @@
 #include 

 #include 

 #include 

+#include 



 #include "IpmiBmcCommon.h"

 #include "KcsBmc.h"



-

 #define BMC_KCS_TIMEOUT  5   // [s] Single KSC request timeout



 //

 // IPMI Instance signature

 //

-#define SM_IPMI_BMC_SIGNATURE SIGNATURE_32 ('i', 'p', 'm', 'i')

+#define SM_IPMI_BMC_SIGNATURESIGNATURE_32 ('i', 'p', 'm', 'i')

 #define IPMI_SEND_COMMAND_MAX_RETRY  3   // Number of retries

 #define INSTANCE_FROM_SM_IPMI_BMC_THIS(a) \

   CR ( \

@@ -41,4 +42,12 @@
   SM_IPMI_BMC_SIGNATURE \

   )



+#define INSTANCE_FROM_IPMI_TRANSPORT2_THIS(a) \

+  CR ( \

+  a, \

+  IPMI_BMC_INSTANCE_DATA, \

+  IpmiTransport2, \

+  SM_IPMI_BMC_SIGNATURE \

+  )

+

 #endif // _IPMI_BMC_H_

diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/IpmiBmcCommon.h
 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/IpmiBmcCommon.h
index 06eab62aae..faf6cc6685 100644
--- 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/IpmiBmcCommon.h
+++ 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Common/IpmiBmcCommon.h
@@ -3,16 +3,17 @@


   @copyright

   Copyright 1999 - 2021 Intel Corporation. 

+  Copyright (c) 1985 - 2023, American Megatrends International LLC. 

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

 **/



 #ifndef _IPMI_COMMON_BMC_H_

 #define _IPMI_COMMON_BMC_H_



-#define MAX_TEMP_DATA 255 // 160 Modified to increase number of bytes 
transfered per command

-#define BMC_SLAVE_ADDRESS 0x20

-#define MAX_SOFT_COUNT10

-#define COMP_CODE_NORMAL  0x00

+#define MAX_TEMP_DATA  255// 160 Modified to increase number of bytes 
transfered per command

+#define BMC_SLAVE_ADDRESS  0x20

+#define MAX_SOFT_COUNT 10

+#define COMP_CODE_NORMAL   0x00



 //

 // IPMI command completion codes to check for in the UpdateErrorStatus routine.

@@ -33,8 +34,8 @@
 // D4h C Insufficient privilege, in KCS channel this indicates KCS Policy 
Control Mode is Deny All.

 // In authenticated channels this indicates invalid authentication/privilege.

 //

-#define COMP_INSUFFICIENT_PRIVILEGE   0xD4

-#define COMP_CODE_UNSPECIFIED 0xFF

+#define COMP_INSUFFICIENT_PRIVILEGE  0xD4

+#define COMP_CODE_UNSPECIFIED0xFF



 #define COMPLETION_CODES \

   { \

@@ -47,15 +48,16 @@
 // Dxe Ipmi instance data

 //

 typedef struct {

-  UINTN   Signature;

-  UINT64  KcsTimeoutPeriod;

-  UINT8   SlaveAddress;

-  BMC_STATUS  BmcStatus;

-  UINT64  ErrorStatus;

-  UINT8   SoftErrorCount;

-  UINT16  IpmiIoBase;

-  IPMI_TRANSPORT  IpmiTransport;

-  EFI_HANDLE  IpmiSmmHandle;

+  UINTN  Signature;

+  UINT64 KcsTimeoutPeriod;

+  UINT8  SlaveAddress;

+  BMC_STATUS BmcStatus;

+  UINT64 ErrorStatus;

+  UINT8  SoftErrorCount;

+  UINT16 IpmiIoBase;

+  IPMI_TRANSPORT IpmiTransport;

+  IPMI_TRANSPORT2IpmiTransport2;

+  EFI_HANDLE IpmiSmmHandle;

 } IPMI_BMC_INSTANCE_DATA;



 //

@@ -64,38 +66,39 @@ typedef struct {
 #define IPMI_COMMAND_HEADER_SIZE  2



 typedef struct {

-  UINT8 Lun : 2;

-  UINT8 NetFunction : 6;

-  UINT8 Command;

-  UINT8 CommandData[MAX_TEMP_DATA - IPMI_COMMAND_HEADER_SIZE];

+  UINT8Lun : 

[edk2-devel][edk2-platforms][PATCH V5-1] IpmiFeaturePkg:Provided multiple IPMI interface support in PEI

2023-07-25 Thread Arun K via groups.io
Created IpmiTransport2 PPI/Protocol to support multiple
IPMI BMC Interface support such as KCS/BT/SSIF/IPMB with 2 API's
IpmiSubmitCommand2 & IpmiSubmitCommand2Ex.
IpmiSubmitCommand2 - This API use the default interface
(PcdDefaultSystemInterface) to send IPMI command.
IpmiSubmitCommand2Ex - This API use the specific interface type
to send IPMI command which is passed as an argument.

Cc: Isaac Oram 
Cc: Nate DeSimone 
Cc: Liming Gao 

Signed-off-by: Arun K 
---
 .../GenericIpmi/Pei/PeiGenericIpmi.c  | 550 +-
 .../GenericIpmi/Pei/PeiGenericIpmi.h  |  75 ++-
 .../GenericIpmi/Pei/PeiGenericIpmi.inf|  17 +
 .../GenericIpmi/Pei/PeiIpmiBmc.c  | 117 ++--
 .../GenericIpmi/Pei/PeiIpmiBmc.h  |  11 +-
 .../GenericIpmi/Pei/PeiIpmiBmcDef.h   |  86 +--
 .../GenericIpmi/Pei/PeiIpmiHooks.c| 346 +++
 .../GenericIpmi/Pei/PeiIpmiHooks.h| 218 +++
 8 files changed, 1159 insertions(+), 261 deletions(-)
 create mode 100644 
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiIpmiHooks.c
 create mode 100644 
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiIpmiHooks.h

diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c
 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c
index e8b99b6900..61e7ce4ecd 100644
--- 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c
+++ 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Pei/PeiGenericIpmi.c
@@ -3,6 +3,7 @@


   @copyright

   Copyright 2017 - 2021 Intel Corporation. 

+  Copyright (c) 1985 - 2023, American Megatrends International LLC. 

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

 **/



@@ -10,10 +11,208 @@
 #include "PeiGenericIpmi.h"

 #include 

 #include 

+#include 



 ///

-// Function Implementations

-//

+

+static EFI_PEI_NOTIFY_DESCRIPTOR  mNotifyList = {

+  EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH | 
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,

+  ,

+  UpdateIpmiInstancePtr

+};

+

+/**

+Initialize the API and parameters for IPMI Transport2 Instance

+

+@param[in] IpmiInstance Pointer to IPMI Instance

+

+@return VOID

+

+**/

+VOID

+InitIpmiTransport2 (

+  IN  PEI_IPMI_BMC_INSTANCE_DATA  *IpmiInstance

+  )

+{

+  IpmiInstance->IpmiTransport2Ppi.InterfaceType   = FixedPcdGet8 
(PcdDefaultSystemInterface);

+  IpmiInstance->IpmiTransport2Ppi.IpmiTransport2BmcStatus = BmcStatusOk;

+  IpmiInstance->IpmiTransport2Ppi.IpmiSubmitCommand2  = 
PeiIpmiSendCommand2;

+  IpmiInstance->IpmiTransport2Ppi.IpmiSubmitCommand2Ex= 
PeiIpmiSendCommand2Ex;

+

+  if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {

+if (!EFI_ERROR (PlatformIpmiIoRangeSet (FixedPcdGet16 
(PcdBtControlPort {

+  InitBtInterfaceData (>IpmiTransport2Ppi);

+}

+  }

+

+  if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {

+InitSsifInterfaceData (>IpmiTransport2Ppi);

+  }

+

+  if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {

+InitIpmbInterfaceData (>IpmiTransport2Ppi);

+  }

+}

+

+/*++

+

+Routine Description:

+  Notify callback function for interfaces.

+

+Arguments:

+  PeiServices  - Describes the list of possible PEI Services.

+  NotifyDescriptor - Pointer to notify descriptor.

+  Ppi  - Pointer to Ppi.

+

+Returns:

+  Status

+

+--*/

+EFI_STATUS

+EFIAPI

+NotifyCallback (

+  IN EFI_PEI_SERVICES   **PeiServices,

+  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,

+  IN VOID   *Ppi

+  )

+{

+  EFI_STATUS  Status;

+  PEI_IPMI_BMC_INSTANCE_DATA  *IpmiInstance;

+  PEI_IPMI_DATA_HOB   *IpmiInstancePtrHob;

+  EFI_HOB_GUID_TYPE   *GuidHob;

+  IPMI_INTERFACE_STATEInterfaceState;

+

+  InterfaceState = IpmiInterfaceNotReady;

+

+  GuidHob = GetFirstGuidHob ();

+  ASSERT (GuidHob != NULL);

+  if (GuidHob == NULL) {

+return EFI_NOT_FOUND;

+  }

+

+  IpmiInstancePtrHob = (PEI_IPMI_DATA_HOB *)GET_GUID_HOB_DATA (GuidHob);

+  IpmiInstance   = (PEI_IPMI_BMC_INSTANCE_DATA 
*)IpmiInstancePtrHob->IpmiInstance;

+

+  if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {

+InitSsifInterfaceData (>IpmiTransport2Ppi);

+

+if (IpmiInstance->IpmiTransport2Ppi.Interface.Ssif.InterfaceState == 
IpmiInterfaceInitialized) {

+  InterfaceState = IpmiInterfaceInitialized;

+}

+  }

+

+  if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {

+InitIpmbInterfaceData (>IpmiTransport2Ppi);

+

+if (IpmiInstance->IpmiTransport2Ppi.Interface.Ipmb.InterfaceState == 
IpmiInterfaceInitialized) {

+  InterfaceState = IpmiInterfaceInitialized;

+}

+  }

+

+  // Default Interface data should be initialized to install Ipmi Transport2 
Protocol.

+  if (InterfaceState != 

Re: [edk2-devel] [PATCH] RedfishPkg/RedfishDiscoverDxe: fix netmask check issue

2023-07-25 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Tuesday, July 25, 2023 8:15 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> ; Nick Ramirez 
> Subject: [PATCH] RedfishPkg/RedfishDiscoverDxe: fix netmask check issue
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> - Add NTOHL() for coverting IP address from EFI_IPv4_ADDRESS to
> IP4_ADDR so that IP4_IS_VALID_NETMASK() return correct value.
> - Add DumpIpv4Address() in RedfishDebugLib and print IP address
> when invalid IP or subnet mask address is detected.
>
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  .../RedfishDiscoverDxe/RedfishDiscoverDxe.inf |  2 ++
>  RedfishPkg/Include/Library/RedfishDebugLib.h  | 17 
>  .../RedfishDiscoverInternal.h |  1 +
>  .../Library/RedfishDebugLib/RedfishDebugLib.c | 26 +++
>  .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 11 +---
>  5 files changed, 53 insertions(+), 4 deletions(-)
>
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.inf
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.inf
> index 345bacf44d20..950098bf6a0d 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.inf
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.inf
> @@ -2,6 +2,7 @@
>  #  Implementation of EFI_REDFISH_DISCOVER_PROTOCOL interfaces.
>  #
>  #  (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> +#  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -34,6 +35,7 @@
>DebugLib
>MemoryAllocationLib
>PrintLib
> +  RedfishDebugLib
>RestExLib
>UefiLib
>UefiBootServicesTableLib
> diff --git a/RedfishPkg/Include/Library/RedfishDebugLib.h
> b/RedfishPkg/Include/Library/RedfishDebugLib.h
> index da7e0d0bc9fc..5f75bad12a7f 100644
> --- a/RedfishPkg/Include/Library/RedfishDebugLib.h
> +++ b/RedfishPkg/Include/Library/RedfishDebugLib.h
> @@ -121,4 +121,21 @@ DumpHttpStatusCode (
>IN EFI_HTTP_STATUS_CODE  HttpStatusCode
>);
>
> +/**
> +
> +  This function dump the IPv4 address in given error level.
> +
> +  @param[in]  ErrorLevel  DEBUG macro error level
> +  @param[in]  Ipv4Address IPv4 address to dump
> +
> +  @retval EFI_SUCCESS IPv4 address string is printed.
> +  @retval Others  Errors occur.
> +
> +**/
> +EFI_STATUS
> +DumpIpv4Address (
> +  IN UINTN ErrorLevel,
> +  IN EFI_IPv4_ADDRESS  *Ipv4Address
> +  );
> +
>  #endif
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> index d24c4081d9c0..01454acc1d9d 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> @@ -28,6 +28,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> diff --git a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
> b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
> index 0b2a9a5c4ec8..efa9a5ca1319 100644
> --- a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
> +++ b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
> @@ -340,3 +340,29 @@ DumpRedfishResponse (
>
>return EFI_SUCCESS;
>  }
> +
> +/**
> +
> +  This function dump the IPv4 address in given error level.
> +
> +  @param[in]  ErrorLevel  DEBUG macro error level
> +  @param[in]  Ipv4Address IPv4 address to dump
> +
> +  @retval EFI_SUCCESS IPv4 address string is printed.
> +  @retval Others  Errors occur.
> +
> +**/
> +EFI_STATUS
> +DumpIpv4Address (
> +  IN UINTN ErrorLevel,
> +  IN EFI_IPv4_ADDRESS  *Ipv4Address
> +  )
> +{
> +  if (Ipv4Address == NULL) {
> +return EFI_INVALID_PARAMETER;
> +  }
> +
> +  DEBUG ((ErrorLevel, "%d.%d.%d.%d\n", Ipv4Address->Addr[0],
> Ipv4Address->Addr[1], Ipv4Address->Addr[2], Ipv4Address->Addr[3]));
> +
> +  return EFI_SUCCESS;
> +}
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index 470b4c9e0060..17c88ad82db4 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> @@ -531,15 +531,17 @@ DiscoverRedfishHostInterface (
>IP4_COPY_ADDRESS ((VOID *)>HostSubnetMask.v4, (VOID
> *)Data->HostIpMask);
>
>if (EFI_IP4_EQUAL (>HostIpAddress.v4, )) {
> -DEBUG ((DEBUG_ERROR, "%a: invalid host IP address: zero address\n",
> __func__));
> +DEBUG ((DEBUG_ERROR, "%a: invalid host IP address: ", __func__));
> +DumpIpv4Address (DEBUG_ERROR, >HostIpAddress.v4);
>  //
>  // Invalid IP address detected. Change address format to Unknown and
> use 

Re: [edk2-devel] [PATCH V3 3/3] ShellPkg/AcpiView: Add MPAM Parser

2023-07-25 Thread PierreGondois

Hello Rohit,
I should have answered your comments,

On 7/24/23 18:07, Rohit Mathew wrote:

Hi Pierre,

Thank you for the response. Few comments inline -


-Original Message-
From: Pierre Gondois 
Sent: Monday, July 24, 2023 3:40 PM
To: Rohit Mathew ; devel@edk2.groups.io
Cc: Thomas Abraham ; Sami Mujawar
; James Morse ; Ray Ni
; Zhichao Gao ; nd

Subject: Re: [edk2-devel] [PATCH V3 3/3] ShellPkg/AcpiView: Add MPAM
Parser

Hello Rohit,
Thanks for the answers, I should have also answered your questions,

Regards,
Pierre

On 7/24/23 11:50, Rohit Mathew wrote:

Hi Pierre,

Thank you for the detailed review. Please find my response inline.


On 5/22/23 16:45, Rohit Mathew via groups.io wrote:

Add a parser for the MPAM (Memory system resource partitioning and
monitoring) ACPI table. This parser would parse all MPAM related
structures embedded as part of the ACPI table. Necessary validations are
also performed where and when required.

Signed-off-by: Rohit Mathew 
---
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h

|

21 +





ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mpam/MpamParse
r

.c   | 1331 





ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mpam/MpamParse
r

.h   |   25 +





ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComman

dLib.c   |3 +-





ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComman

dLib.inf |4 +-





ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComman

dLib.uni |3 +-

6 files changed, 1384 insertions(+), 3 deletions(-)

diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h

b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h

index c9f41650d9..fef08e714d 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
@@ -825,6 +825,27 @@ ParseAcpiMcfg (
  IN UINT8AcpiTableRevision
  );

+/**
+  This function parses the ACPI MPAM table.
+  When trace is enabled this function parses the MCFG table and
+  traces the ACPI table fields.
+
+  This function also performs validation of the ACPI table fields.
+
+  @param [in] Trace  If TRUE, trace the ACPI fields.
+  @param [in] PtrPointer to the start of the buffer.
+  @param [in] AcpiTableLengthLength of the ACPI table.
+  @param [in] AcpiTableRevision  Revision of the ACPI table.
+**/
+VOID
+EFIAPI
+ParseAcpiMpam (
+  IN BOOLEAN  Trace,
+  IN UINT8*Ptr,
+  IN UINT32   AcpiTableLength,
+  IN UINT8AcpiTableRevision
+  );
+
/**
  This function parses the ACPI PCCT table including its sub-structures
  of type 0 through 4.
diff --git



a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mpam/MpamPar

ser.c


b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mpam/MpamPar

ser.c

new file mode 100644
index 00..9352357318
--- /dev/null
+++



b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mpam/MpamPar

ser.c

@@ -0,0 +1,1331 @@
+/** @file
+  MPAM table parser
+
+  Copyright (c) 2023, ARM Limited. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Specification Reference:
+   - [1] ACPI for Memory System Resource Partitioning and Monitoring 2.0
+ (https://developer.arm.com/documentation/den0065/latest)
+
+  @par Glossary:
+- MPAM - Memory System Resource Partitioning And Monitoring
+- MSC  - Memory System Component
+- PCC  - Platform Communication Channel
+- RIS  - Resource Instance Selection
+- SMMU - Arm System Memory Management Unit
+ **/
+
+#include 
+#include 
+#include 
+#include "AcpiParser.h"
+#include "AcpiView.h"
+#include "AcpiViewConfig.h"
+#include "MpamParser.h"
+
+// Local variables
+STATIC UINT8 *Locator;
+STATIC CONST UINT8   *LocatorType;
+STATIC CONST UINT16  *MpamMscNodeLength;
+STATIC UINT32MpamMscNodeLengthCumulative;
+STATIC UINT32HeaderSize;
+STATIC CONST UINT32  *ErrorInterrupt;
+STATIC CONST UINT32  *InterfaceType;
+STATIC CONST UINT32  *NumberOfMscResources;
+STATIC CONST UINT32  *NumberOfFunctionalDependencies;
+STATIC CONST UINT32  *NumberOfInterconnectDescriptors;
+STATIC CONST UINT32  *OverflowInterrupt;
+STATIC ACPI_DESCRIPTION_HEADER_INFO  AcpiHdrInfo;
+
+/**
+  When the length of the table is insufficient to be parsed, this function

could

+  be used to display an appropriate error message.
+
+  @param [in] ErrorMsg  Error message string that has to be appended

to

the

(alignment)


[Rohit] Ack.




+  main error log. This string could explain the reason
+  why a insufficient length error was encountered in
+  the first place.
+**/
+STATIC
+VOID
+EFIAPI


It seems this function is not used for length related issues. 

Re: [edk2-devel] [PATCH] SecurityPkg: DxeTcg2PhysicalPresenceLib for Clear Graphics Screen To unblock and Display TPM messages

2023-07-25 Thread Yao, Jiewen
Hello
I agree with you on the problem statement.

But I don't think this is a desired solution.
We expect Platform BDS to call the PhysicalPresenceLib. As such, why not clear 
the  screen in the platform BDS?

Thank you
Yao, Jiewen

From: Poosapalli, Karunakar 
Sent: Monday, July 24, 2023 11:26 PM
To: Yao, Jiewen ; Gao, Liming ; 
devel@edk2.groups.io
Subject: RE: [edk2-devel] [PATCH] SecurityPkg: DxeTcg2PhysicalPresenceLib for 
Clear Graphics Screen To unblock and Display TPM messages

Can you please review and share your feedback?


Thanks & Regards
Karunakar Poosapalli
Firmware Principal Engineer, Client BIOS
Customer BIOS | Dell Core BIOS
CPG Software Engineering | Dell Technologies
Mobile +91 9951902957
karunakar_poosapa...@dell.com



Internal Use - Confidential
From: Poosapalli, Karunakar
Sent: Saturday, July 22, 2023 1:21 AM
To: jiewen@intel.com; gaoliming; 
devel@edk2.groups.io
Subject: [edk2-devel] [PATCH] SecurityPkg: DxeTcg2PhysicalPresenceLib for Clear 
Graphics Screen To unblock and Display TPM messages

Patch review for Bugzilla -  https://bugzilla.tianocore.org/show_bug.cgi?id=4462

>From c537f9c5c9e02c54e27466b96fe33555afccd358 Mon Sep 17 00:00:00 2001
From: Karunakar Poosapalli 
karunakar_poosapa...@dell.com
Date: Sat, 22 Jul 2023 01:13:44 +0530
Subject: [PATCH] Patch - Enhance Tcg2 to clear graphics before printing the
messages on screen

[Background]
Tcg2UserConfirm() Function is used to display any user conformation messages on 
the console
Function Definition Full path - 
SecurityPkg\Library\DxeTcg2PhysicalPresenceLib\DxeTcg2PhysicalPresenceLib.c

[Issue]
In the current Tcg2UserConfirm() implementation, This function forms a 
destination string to be displayed on the console and directly Print the 
message on Console.

But there is no logic added to clear the graphics before printing the messages 
on the screen.

There are some scenarios where Tcg messages might have been blocked by some 
other GUI or messages on Console.
  1. When there are some messages or logos already displayed in the content on 
the console,
 TCG message will NOT be displayed or corrupted to the End user.
  2. There could be a Custom logo displaying on the screen which actually 
blocks the screen.

[Solution]
  1. As TCG user confirmation is the highest priority and it blocks the POST 
until the user
 presses the input key. Before TCG messages Print on the console, there 
should be logic
 added to clear the graphics screen

Cc: gaoliming gaolim...@byosoft.com.cn
Cc: Jiewen  jiewen@intel.com
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4462
Signed-off-by: Karunakar Poosapalli 
karunakar_poosapa...@dell.com
---
.../DxeTcg2PhysicalPresenceLib.c  | 74 +++
.../DxeTcg2PhysicalPresenceLib.inf|  1 +
2 files changed, 75 insertions(+)

diff --git 
a/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.c 
b/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.c
index de4f5e583d..bd486f3b5b 100644
--- 
a/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.c
+++ 
b/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.c
@@ -251,6 +251,74 @@ Tcg2ExecutePhysicalPresence (
   }
}

+/**
+  Clear Graphics Screen To unblock and Display TPM messages
+
+  @param[in]  VOID
+  @retval EFI_STATUS
+**/
+EFI_STATUS
+ClearGraphicsScreenToDisplayTpmMessages()
+{
+  EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;
+  EFI_STATUS Status;
+  EFI_HANDLE  *HandleBuffer;
+  UINTN   NumberOfHandles;
+  UINTN   Index;
+  EFI_DEVICE_PATH_PROTOCOL*GopDevicePath;
+
+  DEBUG((DEBUG_INFO, "ClearGraphicsScreenToDisplayTpmMessages Entry...\n"));
+
+  Status = gBS->LocateHandleBuffer (
+ByProtocol,
+,
+NULL,
+,
+
+);
+  DEBUG((DEBUG_INFO, "LocateHandleBuffer Status = %r, NumberOfHandles = %x\n", 
Status, NumberOfHandles));
+
+  if (EFI_ERROR (Status))
+  {
+return Status;
+  }
+
+  for (Index = 0; Index < NumberOfHandles; Index++)
+{
+  Status = gBS->HandleProtocol (
+HandleBuffer[Index],
+,
+(VOID *)
+);
+  DEBUG((DEBUG_INFO, "HandleProtocol GopDevicePath Status = %r, Index = 
%x\n", Status, Index));
+  if (EFI_ERROR (Status))
+{
+  continue;
+}
+
+  Status = gBS->HandleProtocol (
+HandleBuffer[Index],
+,
+(VOID **) 
+);
+  DEBUG((DEBUG_INFO, "HandleProtocol Gop Status = %r, Index = %x\n", 
Status, Index));
+  if 

[edk2-devel] [PATCH edk2-platforms v1 3/3] Platform/ARM: FVP: Add ETE device if supported by FVP

2023-07-25 Thread Sami Mujawar
When ETE is enabled in the FVP model the firmware can check
the debug feature register ID_AA64DFR0_EL1.TraceVer field
to identify the presence of FEAT_ETE and add an ETE device
to the CPU node in the AML CPU hierarchy. This enables the
Operating System driver to probe and enable ETE support.

 Note: To enable ETE support in the FVP REvC model
1. Build TF-A with the CTX_INCLUDE_AARCH32_REGS=0
   build flag set, otherwise this results in an
   exception when booting TF-A
2. Set the model parameters to enable TRBE as this
   is required for ETE
-C cluster0.has_trbe=1 -C cluster1.has_trbe=1
3. Set the ETE plugin for the model
   --plugin \libete-plugin.[so|dll]

Signed-off-by: Sami Mujawar 
---
 
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
 | 25 
 
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
 |  2 ++
 2 files changed, 27 insertions(+)

diff --git 
a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
 
b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
index 
03393905be1c627b7cdbaa0efed33e920072c8cb..86d5bbdb6219294d41b4ac314cc01139f975dc48
 100644
--- 
a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
+++ 
b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
@@ -366,6 +366,11 @@ EDKII_PLATFORM_REPOSITORY_INFO VExpressPlatRepositoryInfo 
= {
 FixedPcdGet32 (PcdPciBusMin),
 FixedPcdGet32 (PcdPciBusMax)
   },
+
+  // Embedded Trace device info
+  {
+ArmEtTypeEte
+  }
 };
 
 /** A helper function for returning the Configuration Manager Objects.
@@ -478,6 +483,7 @@ InitializePlatformRepository (
   UINT64 DbgFeatures;
   UINTN  Index;
   UINT16 TrbeInterrupt;
+  CM_OBJECT_TOKEN EtToken;
 
   PlatformRepo = This->PlatRepoInfo;
 
@@ -497,6 +503,7 @@ InitializePlatformRepository (
   }
 
   TrbeInterrupt = 0;
+  EtToken = CM_NULL_TOKEN;
   DbgFeatures = ArmReadIdAA64Dfr0 ();
   DEBUG ((
 DEBUG_INFO,
@@ -510,8 +517,14 @@ InitializePlatformRepository (
 TrbeInterrupt = 31;
   }
 
+  // The ID_AA64DFR0_EL1.TraceVer field identifies the presence of FEAT_ETE.
+  if (((DbgFeatures >> 4) & 0xF) != 0) {
+EtToken = (CM_OBJECT_TOKEN)>EtInfo;
+  }
+
   for (Index = 0; Index < PLAT_CPU_COUNT; Index++) {
 PlatformRepo->GicCInfo[Index].TrbeInterrupt = TrbeInterrupt;
+PlatformRepo->GicCInfo[Index].EtToken = EtToken;
   }
 
   return EFI_SUCCESS;
@@ -983,6 +996,18 @@ GetArmNameSpaceObject (
  );
   break;
 
+case EArmObjEtInfo:
+  if (Token == (CM_OBJECT_TOKEN)>EtInfo) {
+Status = HandleCmObject (
+  CmObjectId,
+  >EtInfo,
+  sizeof (PlatformRepo->EtInfo),
+  1,
+  CmObject
+  );
+  }
+  break;
+
 default: {
   Status = EFI_NOT_FOUND;
   DEBUG ((
diff --git 
a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
 
b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
index 
1b52c2ebc7efb633c748f7316606e3dbe4e0b21c..be2b512911f897dc57328673ae4f4a2014ec20fb
 100644
--- 
a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
+++ 
b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
@@ -171,6 +171,8 @@ typedef struct PlatformRepositoryInfo {
   /// PCI configuration space information
   CM_ARM_PCI_CONFIG_SPACE_INFO  PciConfigInfo;
 
+  CM_ARM_ET_INFOEtInfo;
+
   /// System ID
   UINT32SysId;
 } EDKII_PLATFORM_REPOSITORY_INFO;
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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




[edk2-devel] [PATCH edk2-platforms v1 2/3] Platform/ARM: FVP: Specify TRBE interrupt in MADT GICC

2023-07-25 Thread Sami Mujawar
When TRBE is enabled the FVP model uses the PPI 15
(i.e. INT ID 31) as the TRBE interrupt.
Ref: https://www.kernel.org/doc/Documentation/
devicetree/bindings/arm/arm,trace-buffer-extension.yaml

Therefore, check the debug feature register
ID_AA64DFR0_EL1.TraceBuffer field to see if TRBE is
enabled and configure the TRBE interrupt in the GICC
structure in the MADT ACPI table.

Note: To enable TRBE support in the FVP REvC model
1. Build TF-A with the CTX_INCLUDE_AARCH32_REGS=0
   build flag set, otherwise this results in an
   exception when booting TF-A.
2. Set the model parameters to enable TRBE
-C cluster0.has_trbe=1 -C cluster1.has_trbe=1

Signed-off-by: Sami Mujawar 
---
 
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
  | 39 
 
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
 |  3 +-
 2 files changed, 33 insertions(+), 9 deletions(-)

diff --git 
a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
 
b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
index 
4df2d6cdae58df344804a8b41208a3adb8ee0110..03393905be1c627b7cdbaa0efed33e920072c8cb
 100644
--- 
a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
+++ 
b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
@@ -1,7 +1,7 @@
 /** @file
   Configuration Manager Dxe
 
-  Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.
+  Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -37,8 +38,8 @@ EDKII_PLATFORM_REPOSITORY_INFO VExpressPlatRepositoryInfo = {
   {
 // FADT Table
 {
-  EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
-  EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
+  EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
+  EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
   CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt),
   NULL
 },
@@ -51,8 +52,8 @@ EDKII_PLATFORM_REPOSITORY_INFO VExpressPlatRepositoryInfo = {
 },
 // MADT Table
 {
-  EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
-  EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,
+  EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
+  EFI_ACPI_6_5_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,
   CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMadt),
   NULL
 },
@@ -109,15 +110,15 @@ EDKII_PLATFORM_REPOSITORY_INFO VExpressPlatRepositoryInfo 
= {
   },
 
   // Boot architecture information
-  { EFI_ACPI_6_3_ARM_PSCI_COMPLIANT },  // BootArchFlags
+  { EFI_ACPI_6_5_ARM_PSCI_COMPLIANT },  // BootArchFlags
 
 #ifdef HEADLESS_PLATFORM
   // Fixed feature flag information
-  { EFI_ACPI_6_3_HEADLESS },// Fixed feature flags
+  { EFI_ACPI_6_5_HEADLESS },// Fixed feature flags
 #endif
 
   // Power management profile information
-  { EFI_ACPI_6_3_PM_PROFILE_ENTERPRISE_SERVER },// PowerManagement Profile
+  { EFI_ACPI_6_5_PM_PROFILE_ENTERPRISE_SERVER },// PowerManagement Profile
 
   /* GIC CPU Interface information
  GIC_ENTRY (CPUInterfaceNumber, Mpidr, PmuIrq, VGicIrq, EnergyEfficiency)
@@ -474,6 +475,9 @@ InitializePlatformRepository (
   )
 {
   EDKII_PLATFORM_REPOSITORY_INFO  * PlatformRepo;
+  UINT64 DbgFeatures;
+  UINTN  Index;
+  UINT16 TrbeInterrupt;
 
   PlatformRepo = This->PlatRepoInfo;
 
@@ -491,6 +495,25 @@ InitializePlatformRepository (
 PlatformRepo->GicCInfo[6].MPIDR = GET_MPID_MT (1, 2, 0);
 PlatformRepo->GicCInfo[7].MPIDR = GET_MPID_MT (1, 3, 0);
   }
+
+  TrbeInterrupt = 0;
+  DbgFeatures = ArmReadIdAA64Dfr0 ();
+  DEBUG ((
+DEBUG_INFO,
+"Debug Feature Register 0 - ID_AA64DFR0_EL1 = 0x%lx\n",
+DbgFeatures
+));
+
+  // The ID_AA64DFR0_EL1.TraceBuffer field identifies support for FEAT_TRBE.
+  if (((DbgFeatures >> 44) & 0xF) != 0) {
+// TRBE Interrupt is PPI 13 on FVP model.
+TrbeInterrupt = 31;
+  }
+
+  for (Index = 0; Index < PLAT_CPU_COUNT; Index++) {
+PlatformRepo->GicCInfo[Index].TrbeInterrupt = TrbeInterrupt;
+  }
+
   return EFI_SUCCESS;
 }
 
diff --git 
a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
 
b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
index 
b53daf51d4b1afd45e41d0debb0b9f084f135f6a..dd08f8597768d4de62941c5fd74e329c431582b0
 100644
--- 
a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
+++ 
b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
@@ -1,7 +1,7 @@
 ## @file
 #  Configuration 

[edk2-devel] [PATCH edk2-platforms v1 0/3] Platform/ARM: Add dynamic CPU node, TRBE & ETE support to FVP

2023-07-25 Thread Sami Mujawar
This patch series updates the FVP platform firmware
to add support for dynamically generating CPU nodes
in AML and also reports the TRBE interrupt in the
MADT GICC structure. The last patch in the series
enables support for adding an ETE device to the CPU
device nodes in AML.

This patch series depends on the edk2 patch series
at: https://edk2.groups.io/g/devel/message/107239

The changes can be seen at:
https://github.com/samimujawar/edk2-platforms/tree/2620_ete_dev_fvp_v1

Sami Mujawar (3):
  Platform/ARM: Add dynamic CPU node generation for FVP
  Platform/ARM: FVP: Specify TRBE interrupt in MADT GICC
  Platform/ARM: FVP: Add ETE device if supported by FVP

 
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
  | 38 +--
 
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
  | 72 +---
 
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
  |  4 +-
 
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
 |  3 +-
 4 files changed, 69 insertions(+), 48 deletions(-)

-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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




[edk2-devel] [PATCH edk2-platforms v1 1/3] Platform/ARM: Add dynamic CPU node generation for FVP

2023-07-25 Thread Sami Mujawar
Add support to dynamically generate the CPU nodes in SSDT.

Signed-off-by: Sami Mujawar 
---
 
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
 | 38 +---
 
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
 |  8 -
 
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
 |  2 +-
 3 files changed, 9 insertions(+), 39 deletions(-)

diff --git 
a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
 
b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
index 
3acc0c6bc1b48b747e011022f2300b2fe3fa994b..f60430b94c867ee9744a3355b0ea377aff42b1c4
 100644
--- 
a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
+++ 
b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
@@ -1,7 +1,7 @@
 /** @file
   Differentiated System Description Table Fields (DSDT)
 
-  Copyright (c) 2014-2021, ARM Ltd. All rights reserved.
+  Copyright (c) 2014-2023, ARM Ltd. All rights reserved.
   Copyright (c) 2013, Al Stone 
   All rights reserved.
 
@@ -11,42 +11,6 @@
 
 DefinitionBlock("DsdtTable.aml", "DSDT", 2, "ARMLTD", "ARM-VEXP", 1) {
   Scope(_SB) {
-//
-// Processor
-//
-Device(CPU0) {
-  Name(_HID, "ACPI0007")
-  Name(_UID, Zero)
-}
-Device(CPU1) {
-  Name(_HID, "ACPI0007")
-  Name(_UID, One)
-}
-Device(CPU2) {
-  Name(_HID, "ACPI0007")
-  Name(_UID, 2)
-}
-Device(CPU3) {
-  Name(_HID, "ACPI0007")
-  Name(_UID, 3)
-}
-Device(CPU4) {
-  Name(_HID, "ACPI0007")
-  Name(_UID, 4)
-}
-Device(CPU5) {
-  Name(_HID, "ACPI0007")
-  Name(_UID, 5)
-}
-Device(CPU6) {
-  Name(_HID, "ACPI0007")
-  Name(_UID, 6)
-}
-Device(CPU7) {
-  Name(_HID, "ACPI0007")
-  Name(_UID, 7)
-}
-
 // SMC91X
 Device (NET0) {
   Name (_HID, "LNRO0003")
diff --git 
a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
 
b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
index 
58a4bf9890bc2a701dab558a1987f9a51662481a..4df2d6cdae58df344804a8b41208a3adb8ee0110
 100644
--- 
a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
+++ 
b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
@@ -77,7 +77,13 @@ EDKII_PLATFORM_REPOSITORY_INFO VExpressPlatRepositoryInfo = {
   CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdDbg2),
   NULL
 },
-
+// SSDT Cpu Hierarchy Table
+{
+  EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
+  0, // Unused
+  CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdtCpuTopology),
+  NULL
+},
 // Note: The last 3 tables in this list are for FVP RevC only.
 // IORT Table - FVP RevC
 {
diff --git 
a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
 
b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
index 
aebf0a355291df5df5f588e8b7076e21eda9a152..1b52c2ebc7efb633c748f7316606e3dbe4e0b21c
 100644
--- 
a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
+++ 
b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
@@ -89,7 +89,7 @@ typedef EFI_STATUS (*CM_OBJECT_HANDLER_PROC) (
 
 /** The number of ACPI tables to install
 */
-#define PLAT_ACPI_TABLE_COUNT   9
+#define PLAT_ACPI_TABLE_COUNT   10
 
 /** The number of platform generic timer blocks
 */
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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




[edk2-devel] [PATCH v1 00/11] Update MADT for ACPI 6.5, and add TRBE & ETE support

2023-07-25 Thread Sami Mujawar
This patch series provides the following updates:
- The patches 1 & 2 add the new fields introduced
  in MADT (APIC table) by ACPI 6.5 and the patch
  7/11 updates the Acpiview MADT parser accordingly.
- The patches 3, 4 & 5 adds TRBE support to the MADT
  table generator in DynamicTablesPkg.
- Patch 6/11 updates the FADT ACPI revision to 6.5.
- The patches 8, 9 & 10 add support to generate ETE
  device nodes.
- The last patch series fixes a bug wherein the CPC
  token was incorrectly referenced.

The changes can be seen at:
https://github.com/samimujawar/edk2/tree/2620_ete_dev_fvp_v1

Sami Mujawar (11):
  MdePkg: MADT: Add Online capable flag in GICC
  MdePkg: MADT: Add TRBE interrupt to GICC
  DynamicTablesPkg: Add TRBE interrupt to GICC object
  DynamicTablesPkg: Add TRBE interrupt to GICC object parser
  DynamicTablesPkg: Update MADT generator for ACPI 6.5
  DynamicTablesPkg: Update FADT generator to ACPI 6.5
  ShellPkg: Acpiview: Update MADT parser for TRBE interrupt
  DynamicTablesPkg: Add an ET info object to Arm namespace
  DynamicTablesPkg: Add an ET info object parser
  DynamicTablesPkg: Add ETE device to CPU node in AML
  DynamicTablesPkg: Fix referencing of CPC token

 DynamicTablesPkg/Include/ArmNameSpaceObjects.h 
|  32 +++-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c   
| 108 +--
 DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c   
|  83 +
 
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c
 | 188 +++-
 
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.h
 |  11 +-
 
DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
  |  11 +-
 MdePkg/Include/IndustryStandard/Acpi65.h   
|   4 +-
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c 
|  48 -
 8 files changed, 386 insertions(+), 99 deletions(-)

-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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




[edk2-devel] [PATCH v1 11/11] DynamicTablesPkg: Fix referencing of CPC token

2023-07-25 Thread Sami Mujawar
The CpcToken has been incorrectly referenced in the
CreateTopologyFromGicC() and always points to the
CPC token in the first GICC Info object.

Therefore, fix this by correctly indexing into the
GicCInfo object array.

Signed-off-by: Sami Mujawar 
---
 
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c
 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c
 
b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c
index 
6fbba12a010bf987797f0901a032735e8e0be598..8228c7845ac0c26ca0f319fd86abf89bb3bfaf50
 100644
--- 
a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c
+++ 
b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c
@@ -1298,7 +1298,7 @@ CreateTopologyFromGicC (
 
 // If a CPC info is associated with the
 // GicCinfo, create an _CPC method returning them.
-if (GicCInfo->CpcToken != CM_NULL_TOKEN) {
+if (GicCInfo[Index].CpcToken != CM_NULL_TOKEN) {
   Status = CreateAmlCpcNode (Generator, CfgMgrProtocol, [Index], 
CpuNode);
   if (EFI_ERROR (Status)) {
 ASSERT_EFI_ERROR (Status);
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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




[edk2-devel] [PATCH v1 05/11] DynamicTablesPkg: Update MADT generator for ACPI 6.5

2023-07-25 Thread Sami Mujawar
The ACPI 6.5 specification updates the MADT table to add
a new field to GICC for specifying the TRBE interrupt and
also adds support for Online Capable flag to the GICC flags.

The Online Capable flags should be passed transparently
through as specified in the CM_ARM_GICC_INFO.Flags field
and only require the MADT table revision to be setup to
6 to reflect the ACPI 6.5 specification.

The TRBE field needs to be appropriately setup in the
GICC structure.

Therefore, update the MADT generator to reflect the
above updates required for supporting ACPI 6.5

Signed-off-by: Sami Mujawar 
---
 DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c | 83 
+++-
 1 file changed, 46 insertions(+), 37 deletions(-)

diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c 
b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
index 
2102a59faf498eaabc509443461ada999610..c90548bc97aa1b086f21c8378f242b2b073307f3
 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
@@ -1,11 +1,11 @@
 /** @file
   MADT Table Generator
 
-  Copyright (c) 2017 - 2020, ARM Limited. All rights reserved.
+  Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
   @par Reference(s):
-  - ACPI 6.3 Specification - January 2019
+  - ACPI 6.5 Specification - Aug 29, 2022
 
 **/
 
@@ -82,7 +82,7 @@ GET_OBJECT_LIST (
   );
 
 /** This function updates the GIC CPU Interface Information in the
-EFI_ACPI_6_3_GIC_STRUCTURE structure.
+EFI_ACPI_6_5_GIC_STRUCTURE structure.
 
   @param [in]  Gicc   Pointer to GIC CPU Interface structure.
   @param [in]  GicCInfo   Pointer to the GIC CPU Interface Information.
@@ -91,7 +91,7 @@ GET_OBJECT_LIST (
 STATIC
 VOID
 AddGICC (
-  INEFI_ACPI_6_3_GIC_STRUCTURE  *CONST  Gicc,
+  INEFI_ACPI_6_5_GIC_STRUCTURE  *CONST  Gicc,
   IN  CONST CM_ARM_GICC_INFO*CONST  GicCInfo,
   IN  CONST UINT8   MadtRev
   )
@@ -100,9 +100,9 @@ AddGICC (
   ASSERT (GicCInfo != NULL);
 
   // UINT8 Type
-  Gicc->Type = EFI_ACPI_6_3_GIC;
+  Gicc->Type = EFI_ACPI_6_5_GIC;
   // UINT8 Length
-  Gicc->Length = sizeof (EFI_ACPI_6_3_GIC_STRUCTURE);
+  Gicc->Length = sizeof (EFI_ACPI_6_5_GIC_STRUCTURE);
   // UINT16 Reserved
   Gicc->Reserved = EFI_ACPI_RESERVED_WORD;
 
@@ -148,6 +148,15 @@ AddGICC (
 // in EFI_ACPI_6_2_GIC_STRUCTURE.
 Gicc->SpeOverflowInterrupt = 0;
   }
+
+  // UINT16  TrbeInterrupt
+  if (MadtRev > EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION) {
+Gicc->TrbeInterrupt = GicCInfo->TrbeInterrupt;
+  } else {
+// Setting TrbeInterrupt to 0 ensures backward compatibility with
+// ACPI 6.4
+Gicc->SpeOverflowInterrupt = 0;
+  }
 }
 
 /**
@@ -214,7 +223,7 @@ IsAcpiUidEqual (
 STATIC
 EFI_STATUS
 AddGICCList (
-  IN  EFI_ACPI_6_3_GIC_STRUCTURE  *Gicc,
+  IN  EFI_ACPI_6_5_GIC_STRUCTURE  *Gicc,
   IN  CONST CM_ARM_GICC_INFO  *GicCInfo,
   INUINT32GicCCount,
   IN  CONST UINT8 MadtRev
@@ -252,7 +261,7 @@ AddGICCList (
 STATIC
 VOID
 AddGICD (
-  EFI_ACPI_6_3_GIC_DISTRIBUTOR_STRUCTURE  *CONST  Gicd,
+  EFI_ACPI_6_5_GIC_DISTRIBUTOR_STRUCTURE  *CONST  Gicd,
   CONST CM_ARM_GICD_INFO  *CONST  GicDInfo
   )
 {
@@ -260,9 +269,9 @@ AddGICD (
   ASSERT (GicDInfo != NULL);
 
   // UINT8 Type
-  Gicd->Type = EFI_ACPI_6_3_GICD;
+  Gicd->Type = EFI_ACPI_6_5_GICD;
   // UINT8 Length
-  Gicd->Length = sizeof (EFI_ACPI_6_3_GIC_DISTRIBUTOR_STRUCTURE);
+  Gicd->Length = sizeof (EFI_ACPI_6_5_GIC_DISTRIBUTOR_STRUCTURE);
   // UINT16 Reserved
   Gicd->Reserved1 = EFI_ACPI_RESERVED_WORD;
   // UINT32 Identifier
@@ -289,15 +298,15 @@ AddGICD (
 STATIC
 VOID
 AddGICMsiFrame (
-  IN  EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE  *CONST  GicMsiFrame,
+  IN  EFI_ACPI_6_5_GIC_MSI_FRAME_STRUCTURE  *CONST  GicMsiFrame,
   IN  CONST CM_ARM_GIC_MSI_FRAME_INFO   *CONST  GicMsiFrameInfo
   )
 {
   ASSERT (GicMsiFrame != NULL);
   ASSERT (GicMsiFrameInfo != NULL);
 
-  GicMsiFrame->Type= EFI_ACPI_6_3_GIC_MSI_FRAME;
-  GicMsiFrame->Length  = sizeof 
(EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE);
+  GicMsiFrame->Type= EFI_ACPI_6_5_GIC_MSI_FRAME;
+  GicMsiFrame->Length  = sizeof 
(EFI_ACPI_6_5_GIC_MSI_FRAME_STRUCTURE);
   GicMsiFrame->Reserved1   = EFI_ACPI_RESERVED_WORD;
   GicMsiFrame->GicMsiFrameId   = GicMsiFrameInfo->GicMsiFrameId;
   GicMsiFrame->PhysicalBaseAddress = GicMsiFrameInfo->PhysicalBaseAddress;
@@ -316,7 +325,7 @@ AddGICMsiFrame (
 STATIC
 VOID
 AddGICMsiFrameInfoList (
-  IN  EFI_ACPI_6_3_GIC_MSI_FRAME_STRUCTURE  *GicMsiFrame,
+  IN  EFI_ACPI_6_5_GIC_MSI_FRAME_STRUCTURE  *GicMsiFrame,
   IN  CONST CM_ARM_GIC_MSI_FRAME_INFO   *GicMsiFrameInfo,
   INUINT32  GicMsiFrameCount
   )
@@ -337,15 +346,15 @@ 

[edk2-devel] [PATCH v1 06/11] DynamicTablesPkg: Update FADT generator to ACPI 6.5

2023-07-25 Thread Sami Mujawar
The ACPI 6.5 specification updates the minor revision
of the FADT table to 5. Therefore, update the FADT
generator to setup the minor revision for ACPI 6.5.

Signed-off-by: Sami Mujawar 
---
 DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c | 108 
++--
 1 file changed, 54 insertions(+), 54 deletions(-)

diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c 
b/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
index 
1d10ea55e2395c55291faa3c247e5c59e345650c..57aaaf85e64a5a9f1df8d004f9c4a819fc7ee5a8
 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
@@ -1,11 +1,11 @@
 /** @file
   FADT Table Generator
 
-  Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.
+  Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
   @par Reference(s):
-  - ACPI 6.4 Specification, January 2021
+  - ACPI 6.5 Specification, Aug 29, 2022
 
 **/
 
@@ -32,8 +32,8 @@ Requirements:
 
 /** This macro defines the FADT flag options for ARM Platforms.
 */
-#define FADT_FLAGS  (EFI_ACPI_6_4_HW_REDUCED_ACPI |  \
- EFI_ACPI_6_4_LOW_POWER_S0_IDLE_CAPABLE)
+#define FADT_FLAGS  (EFI_ACPI_6_5_HW_REDUCED_ACPI |  \
+ EFI_ACPI_6_5_LOW_POWER_S0_IDLE_CAPABLE)
 
 /** This macro defines the valid mask for the FADT flag option
 if HW_REDUCED_ACPI flag in the table is set.
@@ -42,47 +42,47 @@ Requirements:
 22-31 (reserved).
 
   Valid bits are:
-EFI_ACPI_6_4_WBINVD   BIT0
-EFI_ACPI_6_4_PWR_BUTTON   BIT4
-EFI_ACPI_6_4_SLP_BUTTON   BIT5
-EFI_ACPI_6_4_FIX_RTC  BIT6
-EFI_ACPI_6_4_DCK_CAP  BIT9
-EFI_ACPI_6_4_RESET_REG_SUPBIT10
-EFI_ACPI_6_4_SEALED_CASE  BIT11
-EFI_ACPI_6_4_HEADLESS BIT12
-EFI_ACPI_6_4_USE_PLATFORM_CLOCK   BIT15
-EFI_ACPI_6_4_FORCE_APIC_CLUSTER_MODEL BIT18
-EFI_ACPI_6_4_FORCE_APIC_PHYSICAL_DESTINATION_MODE BIT19
-EFI_ACPI_6_4_HW_REDUCED_ACPI  BIT20
-EFI_ACPI_6_4_LOW_POWER_S0_IDLE_CAPABLEBIT21
+EFI_ACPI_6_5_WBINVD   BIT0
+EFI_ACPI_6_5_PWR_BUTTON   BIT4
+EFI_ACPI_6_5_SLP_BUTTON   BIT5
+EFI_ACPI_6_5_FIX_RTC  BIT6
+EFI_ACPI_6_5_DCK_CAP  BIT9
+EFI_ACPI_6_5_RESET_REG_SUPBIT10
+EFI_ACPI_6_5_SEALED_CASE  BIT11
+EFI_ACPI_6_5_HEADLESS BIT12
+EFI_ACPI_6_5_USE_PLATFORM_CLOCK   BIT15
+EFI_ACPI_6_5_FORCE_APIC_CLUSTER_MODEL BIT18
+EFI_ACPI_6_5_FORCE_APIC_PHYSICAL_DESTINATION_MODE BIT19
+EFI_ACPI_6_5_HW_REDUCED_ACPI  BIT20
+EFI_ACPI_6_5_LOW_POWER_S0_IDLE_CAPABLEBIT21
 */
 #define VALID_HARDWARE_REDUCED_FLAG_MASK  (   \
-  EFI_ACPI_6_4_WBINVD   | \
-  EFI_ACPI_6_4_PWR_BUTTON   | \
-  EFI_ACPI_6_4_SLP_BUTTON   | \
-  EFI_ACPI_6_4_FIX_RTC  | \
-  EFI_ACPI_6_4_DCK_CAP  | \
-  EFI_ACPI_6_4_RESET_REG_SUP| \
-  EFI_ACPI_6_4_SEALED_CASE  | \
-  EFI_ACPI_6_4_HEADLESS | \
-  EFI_ACPI_6_4_USE_PLATFORM_CLOCK   | \
-  EFI_ACPI_6_4_FORCE_APIC_CLUSTER_MODEL | \
-  EFI_ACPI_6_4_FORCE_APIC_PHYSICAL_DESTINATION_MODE | \
-  EFI_ACPI_6_4_HW_REDUCED_ACPI  | \
-  EFI_ACPI_6_4_LOW_POWER_S0_IDLE_CAPABLE)
+  EFI_ACPI_6_5_WBINVD   | \
+  EFI_ACPI_6_5_PWR_BUTTON   | \
+  EFI_ACPI_6_5_SLP_BUTTON   | \
+  EFI_ACPI_6_5_FIX_RTC  | \
+  EFI_ACPI_6_5_DCK_CAP  | \
+  EFI_ACPI_6_5_RESET_REG_SUP| \
+  EFI_ACPI_6_5_SEALED_CASE  | \
+  EFI_ACPI_6_5_HEADLESS | \
+  EFI_ACPI_6_5_USE_PLATFORM_CLOCK   | \
+  EFI_ACPI_6_5_FORCE_APIC_CLUSTER_MODEL | \
+  EFI_ACPI_6_5_FORCE_APIC_PHYSICAL_DESTINATION_MODE | \
+  EFI_ACPI_6_5_HW_REDUCED_ACPI  | \
+  EFI_ACPI_6_5_LOW_POWER_S0_IDLE_CAPABLE)
 
 #pragma pack(1)
 
-/** The AcpiFadt is a template 

[edk2-devel] [PATCH v1 03/11] DynamicTablesPkg: Add TRBE interrupt to GICC object

2023-07-25 Thread Sami Mujawar
ACPI 6.5 introduces a new filed to the MADT GICC structure
to specify the Trace Buffer Extension (TRBE) interrupt. The
TRBE interrupt is a Processor Private interrupt (PPI) and is
used to specify a platform-specific interrupt to signal TRBE
events.

Therefore, update the CM_ARM_GICC_INFO to reflect the addition
of the TRBE interrupt field.

Signed-off-by: Sami Mujawar 
---
 DynamicTablesPkg/Include/ArmNameSpaceObjects.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h 
b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
index 
19098609de4bd0016e761122d9b30aac03ed2078..ca02970d7a177968c77ba7ae1a859b81d0904ff8
 100644
--- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
@@ -203,6 +203,13 @@ typedef struct CmArmGicCInfo {
   i.e. a token referencing a CM_ARM_CPC_INFO object.
   */
   CM_OBJECT_TOKENCpcToken;
+
+  /** Trace Buffer Extension interrupt GSIV. Zero if
+  unsupported by this processor. This field was introduced in
+  ACPI 6.5 (MADT revision 6) and is therefore ignored when
+  generating MADT revision 5 or lower.
+  */
+  UINT16 TrbeInterrupt;
 } CM_ARM_GICC_INFO;
 
 /** A structure that describes the
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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




[edk2-devel] [PATCH v1 10/11] DynamicTablesPkg: Add ETE device to CPU node in AML

2023-07-25 Thread Sami Mujawar
The Coresight Embedded Trace Extension (ETE) feature
can be detected by the platform firmware by examining
the debug feature register ID_AA64DFR0_EL1.TraceVer
field.
The platform configuration manager can then describe
the ETE by creating CM_ARM_ET_INFO object(s) and
referencing these in CM_ARM_GICC_INFO.EtToken.

The 'Table 3: Compatible IDs for architected
CoreSight components' in the 'ACPI for CoreSight
1.2 Platform Design Document' specifies the HID
value for Coresight ETE and CoreSight Embedded
Trace Macrocell (ETM) v4.x as ARMH C500.

Therefore, update the SsdtCpuTopologyGenerator
to add an ETE device to the CPU node in the AML
CPU hierarchy so that an OS can utilise this
information.

Note: Although ETE and ETM share the same HID,
ETE has a system register interfaces, unlike
ETM which requires memory mapped registers.
Since this patch aims to support ETE, the AML
description does not describe any memory mapped
registers. However, support for ETM can be
added in the future.

Signed-off-by: Sami Mujawar 
---
 
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c
 | 186 +++-
 
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.h
 |  11 +-
 2 files changed, 195 insertions(+), 2 deletions(-)

diff --git 
a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c
 
b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c
index 
6fb131b664820adca63c9efa6d8b0e17fc64284e..6fbba12a010bf987797f0901a032735e8e0be598
 100644
--- 
a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c
+++ 
b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c
@@ -1,11 +1,17 @@
 /** @file
   SSDT Cpu Topology Table Generator.
 
-  Copyright (c) 2021, Arm Limited. All rights reserved.
+  Copyright (c) 2021 - 2023, Arm Limited. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
   @par Reference(s):
 - ACPI 6.3 Specification - January 2019 - s8.4 Declaring Processors
+- ACPI for CoreSight version 1.2 Platform Design Document
+  (https://developer.arm.com/documentation/den0067/a/?lang=en)
+
+  @par Glossary:
+- ETE - Embedded Trace Extension.
+- ETM - Embedded Trace Macrocell.
 **/
 
 #include 
@@ -35,6 +41,7 @@ Requirements:
   - EArmObjProcHierarchyInfo (OPTIONAL) along with
   - EArmObjCmRef (OPTIONAL)
   - EArmObjLpiInfo (OPTIONAL)
+  - GetEArmObjEtInfo (OPTIONAL)
 */
 
 /** This macro expands to a function that retrieves the GIC
@@ -86,6 +93,16 @@ GET_OBJECT_LIST (
   CM_ARM_CPC_INFO
   );
 
+/**
+  This macro expands to a function that retrieves the ET device
+  information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+  EObjNameSpaceArm,
+  EArmObjEtInfo,
+  CM_ARM_ET_INFO
+  );
+
 /** Initialize the TokenTable.
 
   One entry should be allocated for each CM_ARM_PROC_HIERARCHY_INFO
@@ -326,6 +343,144 @@ CreateAmlCpcNode (
   return Status;
 }
 
+/** Create an embedded trace device and add it to the Cpu Node in the
+AML namespace.
+
+  This generates the following ASL code:
+  Device (E002)
+  {
+  Name (_UID, 2)
+  Name (_HID, "ARMHC500")
+  }
+
+  Note: Currently we only support generating ETE nodes. Unlike ETM,
+  ETE has a system register interface and therefore does not need
+  the MMIO range to be described.
+
+  @param [in]  GeneratorThe SSDT Cpu Topology generator.
+  @param [in]  ParentNode   Parent node to attach the Cpu node to.
+  @param [in]  CpuName  Value used to generate the node name.
+  @param [out] EtNodePtr   If not NULL, return the created Cpu node.
+
+  @retval EFI_SUCCESS Success.
+  @retval EFI_INVALID_PARAMETER   Invalid parameter.
+  @retval EFI_OUT_OF_RESOURCESFailed to allocate memory.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+CreateAmlEtd (
+  IN   ACPI_CPU_TOPOLOGY_GENERATOR  *Generator,
+  IN   AML_NODE_HANDLE  ParentNode,
+  IN   UINT32   CpuName,
+  OUT  AML_OBJECT_NODE_HANDLE   *EtNodePtr OPTIONAL
+  )
+{
+  EFI_STATUS  Status;
+  AML_OBJECT_NODE_HANDLE  EtNode;
+  CHAR8   AslName[AML_NAME_SEG_SIZE + 1];
+
+  ASSERT (Generator != NULL);
+  ASSERT (ParentNode != NULL);
+
+  Status = WriteAslName ('E', CpuName, AslName);
+  if (EFI_ERROR (Status)) {
+ASSERT (0);
+return Status;
+  }
+
+  Status = AmlCodeGenDevice (AslName, ParentNode, );
+  if (EFI_ERROR (Status)) {
+ASSERT (0);
+return Status;
+  }
+
+  Status = AmlCodeGenNameInteger (
+ "_UID",
+ CpuName,
+ EtNode,
+ NULL
+ );
+  if (EFI_ERROR (Status)) {
+ASSERT (0);
+return Status;
+  }
+
+  Status = AmlCodeGenNameString (
+ "_HID",
+ ACPI_HID_ET_DEVICE,
+ EtNode,
+ NULL
+ );
+  if (EFI_ERROR (Status)) {
+ASSERT (0);
+return Status;
+  }
+
+  

[edk2-devel] [PATCH v1 07/11] ShellPkg: Acpiview: Update MADT parser for TRBE interrupt

2023-07-25 Thread Sami Mujawar
ACPI 6.5 introduces a new filed to the MADT GICC
structure to specify the TRBE interrupt. The TRBE
interrupt is a Processor Private interrupt (PPI)
and is used to specify a platform-specific
interrupt to signal TRBE events.

Therefore, update the MADT GICC structure parser
to parse the new TRBE interrupt field. Also, add
validations to check that the TRBE interrupt is
within the PPI interrupt range.

Signed-off-by: Sami Mujawar 
---
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c | 48 
+++-
 1 file changed, 46 insertions(+), 2 deletions(-)

diff --git 
a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c 
b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
index 
41edcb9ffd1da90893c04e8284ea3317a9e3b45a..3a4f246347f8ad3489fda083e3268e73baa9bc92
 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
@@ -1,7 +1,7 @@
 /** @file
   MADT table parser
 
-  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
+  Copyright (c) 2016 - 2023, ARM Limited. All rights reserved.
   Copyright (c) 2022, AMD Incorporated. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -97,6 +97,48 @@ ValidateSpeOverflowInterrupt (
   }
 }
 
+/**
+  This function validates the TRBE Interrupt in the GICC.
+
+  @param [in] Ptr Pointer to the start of the field data.
+  @param [in] Context Pointer to context specific information e.g. this
+  could be a pointer to the ACPI table header.
+**/
+STATIC
+VOID
+EFIAPI
+ValidateTrbeInterrupt (
+  IN UINT8  *Ptr,
+  IN VOID   *Context
+  )
+{
+  UINT16  TrbeInterrupt;
+
+  TrbeInterrupt = *(UINT16 *)Ptr;
+
+  // SPE not supported by this processor
+  if (TrbeInterrupt == 0) {
+return;
+  }
+
+  if ((TrbeInterrupt < ARM_PPI_ID_MIN) ||
+  ((TrbeInterrupt > ARM_PPI_ID_MAX) &&
+   (TrbeInterrupt < ARM_PPI_ID_EXTENDED_MIN)) ||
+  (TrbeInterrupt > ARM_PPI_ID_EXTENDED_MAX))
+  {
+IncrementErrorCount ();
+Print (
+  L"\nERROR: TRBE Interrupt ID of %d is not in the allowed PPI ID "
+  L"ranges of %d-%d or %d-%d (for GICv3.1 or later).",
+  TrbeInterrupt,
+  ARM_PPI_ID_MIN,
+  ARM_PPI_ID_MAX,
+  ARM_PPI_ID_EXTENDED_MIN,
+  ARM_PPI_ID_EXTENDED_MAX
+  );
+  }
+}
+
 /**
   An ACPI_PARSER array describing the GICC Interrupt Controller Structure.
 **/
@@ -122,7 +164,9 @@ STATIC CONST ACPI_PARSER  GicCParser[] = {
 NULL },
   { L"Reserved", 1, 77, L"0x%x",  NULL, NULL, NULL, 
NULL },
   { L"SPE overflow Interrupt",   2, 78, L"0x%x",  NULL, NULL,
-ValidateSpeOverflowInterrupt, NULL }
+ValidateSpeOverflowInterrupt, NULL },
+  { L"TRBE Interrupt",   2, 80, L"0x%x",  NULL, NULL,
+ValidateTrbeInterrupt, NULL }
 };
 
 /**
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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




[edk2-devel] [PATCH v1 04/11] DynamicTablesPkg: Add TRBE interrupt to GICC object parser

2023-07-25 Thread Sami Mujawar
ACPI 6.5 introduces a new filed to the MADT GICC structure
to specify the Trace Buffer Extension (TRBE) interrupt. The
TRBE interrupt is a Processor Private interrupt (PPI) and is
used to specify a platform-specific interrupt to signal TRBE
events.

This field has already been added to the CM_ARM_GICC_INFO
structure in a previous patch.

Therefore, update the Configuration Manager Object Parser to
reflect the addition of the TRBE interrupt field.

Signed-off-by: Sami Mujawar 
---
 
DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
 
b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
index 
99d6032510a5e912c9189df82c4d2b4398458d2d..c88586a74945878636955fc8a166a94f7323fcde
 100644
--- 
a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
+++ 
b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
@@ -59,7 +59,8 @@ STATIC CONST CM_OBJ_PARSER  CmArmGicCInfoParser[] = {
   { "ProximityDomain",   4,"0x%x",   NULL 
},
   { "ClockDomain",   4,"0x%x",   NULL 
},
   { "AffinityFlags", 4,"0x%x",   NULL 
},
-  { "CpcToken",  sizeof (CM_OBJECT_TOKEN), "0x%p",   NULL }
+  { "CpcToken",  sizeof (CM_OBJECT_TOKEN), "0x%p",   NULL 
},
+  { "TRBEInterrupt", 2,"0x%x",   NULL }
 };
 
 /** A parser for EArmObjGicDInfo.
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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




[edk2-devel] [PATCH v1 01/11] MdePkg: MADT: Add Online capable flag in GICC

2023-07-25 Thread Sami Mujawar
Bugzilla: 3706 'Code First - MADT GICC new flags'

On ARM systems physical CPU hotplug is not supported.
All CPUs are considered present and this is true
throughout the system uptime.

The ECR 2285 introduces a new 'online-capable' flag
in the GICC structure flags in ACPI 6.5, to signal
firmware policy (CPU is not enabled but it can be
enabled and onlined). This enables OSPM to support
virtual CPU hotplug (on virtual platforms for
instance).

This ECR also updates the MADT table revision to 6
to reflect the ACPI 6.5 changes. Therefore, update
the MADT table revision to match the value as
specified in ACPI 6.5.

Signed-off-by: Sami Mujawar 
---
 MdePkg/Include/IndustryStandard/Acpi65.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Include/IndustryStandard/Acpi65.h 
b/MdePkg/Include/IndustryStandard/Acpi65.h
index 
6caadf2404984aa472f748293b8e80dd120f280c..9e2828bc048bcd9b2bf0529d00bdaf8bf04bf543
 100644
--- a/MdePkg/Include/IndustryStandard/Acpi65.h
+++ b/MdePkg/Include/IndustryStandard/Acpi65.h
@@ -2,7 +2,7 @@
   ACPI 6.5 definitions from the ACPI Specification Revision 6.5 Aug, 2022.
 
   Copyright (c) 2017 - 2022, Intel Corporation. All rights reserved.
-  Copyright (c) 2019 - 2021, ARM Ltd. All rights reserved.
+  Copyright (c) 2019 - 2023, ARM Ltd. All rights reserved.
   Copyright (c) 2023, Loongson Technology Corporation Limited. All rights 
reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -533,6 +533,7 @@ typedef struct {
 #define EFI_ACPI_6_5_GIC_ENABLEDBIT0
 #define EFI_ACPI_6_5_PERFORMANCE_INTERRUPT_MODELBIT1
 #define EFI_ACPI_6_5_VGIC_MAINTENANCE_INTERRUPT_MODE_FLAGS  BIT2
+#define EFI_ACPI_6_5_GIC_ONLINE_CAPABLE BIT3
 
 ///
 /// GIC Distributor Structure
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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




[edk2-devel] [PATCH v1 02/11] MdePkg: MADT: Add TRBE interrupt to GICC

2023-07-25 Thread Sami Mujawar
The ASWG ECR 2303 introduces a new field 'TRBE
interrupt' to GICC structure in ACPI 6.5.

The Trace Buffer Extension (TRBE) interrupt is a
Processor Private interrupt (PPI) and is used to
specify a platform-specific interrupt to signal
TRBE events.

Signed-off-by: Sami Mujawar 
---
 MdePkg/Include/IndustryStandard/Acpi65.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MdePkg/Include/IndustryStandard/Acpi65.h 
b/MdePkg/Include/IndustryStandard/Acpi65.h
index 
9e2828bc048bcd9b2bf0529d00bdaf8bf04bf543..fab613d3a71de7eb2d128f930c6d8109e3301dac
 100644
--- a/MdePkg/Include/IndustryStandard/Acpi65.h
+++ b/MdePkg/Include/IndustryStandard/Acpi65.h
@@ -525,6 +525,7 @@ typedef struct {
   UINT8 ProcessorPowerEfficiencyClass;
   UINT8 Reserved2;
   UINT16SpeOverflowInterrupt;
+  UINT16TrbeInterrupt;
 } EFI_ACPI_6_5_GIC_STRUCTURE;
 
 ///
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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




[edk2-devel] [PATCH v1 09/11] DynamicTablesPkg: Add an ET info object parser

2023-07-25 Thread Sami Mujawar


An Embedded Trace (ET) info object is used to provide
information about an Embedded Trace Extension (ETE) or
an Embedded Trace Module (ETM) available on a platform.

The CM_ARM_ET_INFO object has already been added to the
Arm namespace objects list by a previous patch.

Therefore, update the CM Object parser to add support
for parsing the CM_ARM_ET_INFO object.

Signed-off-by: Sami Mujawar 
---
 
DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
 | 8 
 1 file changed, 8 insertions(+)

diff --git 
a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
 
b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
index 
c88586a74945878636955fc8a166a94f7323fcde..145732a21b0704729714168aa420d9988471f512
 100644
--- 
a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
+++ 
b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
@@ -638,6 +638,12 @@ STATIC CONST CM_OBJ_PARSER  
CmArmPccSubspaceType5InfoParser[] = {
 ARRAY_SIZE (CmArmMailboxRegisterInfoParser) },
 };
 
+/** A parser for EArmObjEtInfo.
+*/
+STATIC CONST CM_OBJ_PARSER  CmArmEtInfo[] = {
+  { "EtType", sizeof (ARM_ET_TYPE), "0x%x", NULL }
+};
+
 /** A parser for Arm namespace objects.
 */
 STATIC CONST CM_OBJ_PARSER_ARRAY  ArmNamespaceObjectParser[] = {
@@ -734,6 +740,8 @@ STATIC CONST CM_OBJ_PARSER_ARRAY  
ArmNamespaceObjectParser[] = {
 ARRAY_SIZE (CmArmPccSubspaceType34InfoParser) },
   { "EArmObjPccSubspaceType5Info", CmArmPccSubspaceType5InfoParser,
 ARRAY_SIZE (CmArmPccSubspaceType5InfoParser) },
+  { "EArmObjEtInfo",   CmArmEtInfo,
+ARRAY_SIZE (CmArmEtInfo) },
   { "EArmObjMax",  NULL,   
   0},
 };
 
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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




[edk2-devel] [PATCH v1 08/11] DynamicTablesPkg: Add an ET info object to Arm namespace

2023-07-25 Thread Sami Mujawar
Add an Embedded Trace (ET) info object that can be
used to provide information about Embedded Trace
Extension (ETE) or Embedded Trace Module (ETM)
available on a platform.

Although ETE and ETM share the same HID,
ETE has a system register interfaces, unlike
ETM which requires memory mapped registers.

Since this patch aims to support ETE it does
not describe any memory mapped registers.
However, required support for ETM can be added
in the future.

Signed-off-by: Sami Mujawar 
---
 DynamicTablesPkg/Include/ArmNameSpaceObjects.h | 25 +++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h 
b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
index 
ca02970d7a177968c77ba7ae1a859b81d0904ff8..8c00bdac20bb1323d8dbd17f671e0e61886ad269
 100644
--- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.
+  Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -71,6 +71,7 @@ typedef enum ArmObjectID {
   EArmObjPccSubspaceType3Info, ///< 46 - Pcc 
Subspace Type 3 Info
   EArmObjPccSubspaceType4Info, ///< 47 - Pcc 
Subspace Type 4 Info
   EArmObjPccSubspaceType5Info, ///< 48 - Pcc 
Subspace Type 5 Info
+  EArmObjEtInfo,   ///< 49 - 
Embedded Trace Extension/Module Info
   EArmObjMax
 } EARM_OBJECT_ID;
 
@@ -210,6 +211,12 @@ typedef struct CmArmGicCInfo {
   generating MADT revision 5 or lower.
   */
   UINT16 TrbeInterrupt;
+
+  /** Optional field: Reference Token for the Embedded Trace device info for
+  this processing element.
+  i.e. a token referencing a CM_ARM_ET_INFO object.
+  */
+  CM_OBJECT_TOKENEtToken;
 } CM_ARM_GICC_INFO;
 
 /** A structure that describes the
@@ -1304,6 +1311,22 @@ typedef struct CmArmPccSubspaceType5Info {
   PCC_MAILBOX_REGISTER_INFOErrorStatusReg;
 } CM_ARM_PCC_SUBSPACE_TYPE5_INFO;
 
+/** An enum describing the Arm Embedded Trace device type.
+*/
+typedef enum ArmEtType {
+  ArmEtTypeEtm,   ///< Embedded Trace module.
+  ArmEtTypeEte,   ///< Embedded Trace Extension.
+  ArmEtTypeMax
+} ARM_ET_TYPE;
+
+/** A structure that describes the Embedded Trace Extension/Module.
+
+ID: EArmObjEtInfo
+*/
+typedef struct CmArmEtInfo {
+  ARM_ET_TYPEEtType;
+} CM_ARM_ET_INFO;
+
 #pragma pack()
 
 #endif // ARM_NAMESPACE_OBJECTS_H_
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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




Re: [edk2-devel] Detecting Linux boot failure from UEFI shell (BootServices)

2023-07-25 Thread Ard Biesheuvel
On Mon, 24 Jul 2023 at 19:28, Pedro Falcato  wrote:
>
> On Mon, Jul 24, 2023 at 6:07 PM  wrote:
> >
> > I am developing a UEFI application which functions as a bootloader. It is 
> > required to handle loading between two Linux kernels dependending on which 
> > one failed last (A/B system).
> > Is there a way to detect if the kernel failed to load/start successfully 
> > from the UEFI shell or application?
>
> Sure, you can try and hope that it failed early enough to call
> EFI_BOOT_SERVICES.Exit(). But the amount of failure points after
> ExitBootServices() is staggeringly huge compared to before
> ExitBootServices (i.e in the efistub, when booting).
>
> >I read that there is a hand-over of control to the OS at some point and the 
> >OS calls ExitBootService but I am not sure about how to retrieve this 
> >information from the Shell? Does the return code get persisted in LastError 
> >variable?
> Seems like it, yes.
>
> > Also, do you know where in the Linux boot process the ExitBootService is 
> > called? I'm trying to figure out what actual Linux boot failures I can 
> > detect with the ExitBootService return code.
>
> 1) ExitBootServices != Exit. EFI_BOOT_SERVICES.Exit() serves as your
> exit "system call", EFI_BOOT_SERVICES.ExitBootServices() serves as the
> "remove EFI from being in my way" "system call". Please see the spec.
> 2) Probably anything that happens really early and hence is deeply
> uninteresting. But not much else AFAIK. (hopefully Ard can chime in
> here)
>
> > For instance, could I detect kernel panic?
> No.
>

ExitBootServices() shuts down the boot services, as its name suggests.
A UEFI application by definition is an application that is hosted
under the UEFI boot services, so once ExitBootServices() is called,
your app is gone.

Even if ExitBootServices() fails, it is unlikely that the UEFI
execution context is still functional, given that async event dispatch
will have been shutdown, and this affects many drivers that you may be
relying on for the console or for file storage.

The EFI stub code that runs first in the Linux kernel does very little
beyond allocating some memory and moving the kernel image and initial
ramdisk in place, and the code is almost completely arch and platform
agnostic. So it seems unlikely that any of the issues that are trying
to diagnose would occur here.

After ExitBootServices(), the OS is completetly in control of the
hardware, and along with it, any of the diagnostic facilities that the
machine might have. I don't know what LastError is, but unless it is a
non-volatile EFI variable, I don't think you will be able to rely on
it either.


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




Re: [edk2-devel] [PATCH] Silicon/Synopsys/DesignWare: DwEmacSnpDxe: Fix bug in EmacGetDmaStatus

2023-07-25 Thread Pedro Falcato
On Tue, Jul 25, 2023 at 2:10 AM  wrote:
>
> From: Yang Wang 
>
> Check EmacGetDmaStatus input parameters
> IrqStat may be a null pointer.
>
> Signed-off-by: Yang Wang 
> ---
>  .../Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c  |  7 +--
>  .../Drivers/DwEmacSnpDxe/EmacDxeUtil.c   | 16 
>  .../Drivers/DwEmacSnpDxe/EmacDxeUtil.h   |  2 +-
>  3 files changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c 
> b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c
> index 4cb3371d79..6805511a1d 100755
> --- a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c
> +++ b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c
> @@ -847,9 +847,12 @@ SnpGetStatus (
>}
>
>// Check DMA Irq status
> -  EmacGetDmaStatus (IrqStat, Snp->MacBase);
> +  Status = EmacGetDmaStatus (IrqStat, Snp->MacBase);
> +  if (EFI_ERROR(Status)) {
> +DEBUG ((DEBUG_ERROR, "%a: error  Status: %r\n", __func__, Status));
> +  }
>
> -  return EFI_SUCCESS;
> +  return Status;
>  }
>
>
> diff --git a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.c 
> b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.c
> index 3b982ce984..45b5a05f51 100755
> --- a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.c
> +++ b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.c
> @@ -489,16 +489,22 @@ EmacDmaStart (
>  }
>
>
> -VOID
> +EFI_STATUS
>  EFIAPI
>  EmacGetDmaStatus (
>OUT  UINT32   *IrqStat  OPTIONAL,
>IN   UINTNMacBaseAddress
>)
>  {
> -  UINT32  DmaStatus;
> -  UINT32  ErrorBit;
> -  UINT32  Mask = 0;
> +  UINT32DmaStatus;
> +  UINT32ErrorBit;
> +  UINT32Mask = 0;
> +  EFI_STATUSStatus = EFI_SUCCESS;
> +
> +  if (IrqStat == NULL) {
> +Status = EFI_INVALID_PARAMETER;
> +goto EXIT;
> +  }

This patch looks bogus to me. IrqStat is marked OPTIONAL, how can you
error out if it isn't provided?
Also, please CC maintainers next time.

>
>DmaStatus = MmioRead32 (MacBaseAddress +
> DW_EMAC_DMAGRP_STATUS_OFST);
> @@ -602,6 +608,8 @@ EmacGetDmaStatus (
>MmioOr32 (MacBaseAddress +
>  DW_EMAC_DMAGRP_STATUS_OFST,
>  Mask);
> +EXIT:
> +  return Status;
>  }
>
>
> diff --git a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.h 
> b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.h
> index c4c3653dc7..60f30ecd16 100755
> --- a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.h
> +++ b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/EmacDxeUtil.h
> @@ -339,7 +339,7 @@ EmacDmaStart (
>);
>
>
> -VOID
> +EFI_STATUS
>  EFIAPI
>  EmacGetDmaStatus (
>OUT UINT32  *IrqStat  OPTIONAL,
> --
> 2.25.1
>
>
>
> 
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#107195): https://edk2.groups.io/g/devel/message/107195
> Mute This Topic: https://groups.io/mt/100342205/5946980
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [pedro.falc...@gmail.com]
> 
>
>


-- 
Pedro


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




[edk2-devel] [PATCH 5/5] MdeModulePkg: Add SPI NOR FLash SFDP drivers to DSC

2023-07-25 Thread Chang, Abner via groups.io
From: abnchang 

BZ#: 4473
SPI NOR Flash JEDEC Serial Flash Discoverable Driver
implementation.

Signed-off-by: Abner Chang 
Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Abdul Lateef Attar 
---
 MdeModulePkg/MdeModulePkg.dsc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index db3b5af5379..137e88aa7ed 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -285,6 +285,8 @@
   MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KeyboardDxe.inf
   MdeModulePkg/Bus/Isa/Ps2MouseDxe/Ps2MouseDxe.inf
   
MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceDxe.inf
+  MdeModulePkg/Bus/Spi/SpiNorFlashJedecSfdp/SpiNorFlashJedecSfdpDxe.inf
+  MdeModulePkg/Bus/Spi/SpiNorFlashJedecSfdp/SpiNorFlashJedecSfdpSmm.inf
 
   MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
   MdeModulePkg/Core/Pei/PeiMain.inf
-- 
2.37.1.windows.1



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




[edk2-devel] [PATCH 3/5] MdePkg: Add definitions in DEC for SPI NOR Flash SPDF driver

2023-07-25 Thread Chang, Abner via groups.io
From: abnchang 

BZ#: 4473

Signed-off-by: Abner Chang 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Cc: Abdul Lateef Attar 
---
 MdePkg/MdePkg.dec | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index b85614992b9..47d8daba826 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -875,6 +875,12 @@
   ## Include/Protocol/CcMeasurement.h
   gEfiCcFinalEventsTableGuid = { 0xdd4a4648, 0x2de7, 0x4665, { 0x96, 0x4d, 
0x21, 0xd9, 0xef, 0x5f, 0xb4, 0x46 }}
 
+  #
+  # SPI NOR flash JEDEC Serial Flash Discoverable Parameters (SFDP) driver GUID
+  #
+  gEdk2JedecSfdpSpiDxeDriverGuid  = { 0xBE71701E, 0xB63C, 0x4574, { 0x9C, 
0x5C, 0x36, 0x29, 0xE8, 0xEA, 0xC4, 0x14 }}
+  gEdk2JedecSfdpSpiSmmDriverGuid  = { 0x95A1E915, 0x195C, 0x477C, { 0x92, 
0x6F, 0x7E, 0x24, 0x67, 0xC1, 0xB3, 0x1F }}
+
 [Guids.IA32, Guids.X64]
   ## Include/Guid/Cper.h
   gEfiIa32X64ErrorTypeCacheCheckGuid = { 0xA55701F5, 0xE3EF, 0x43de, { 0xAC, 
0x72, 0x24, 0x9B, 0x57, 0x3F, 0xAD, 0x2C }}
@@ -2232,6 +2238,19 @@
   # @Prompt Speculation Barrier Type.
   gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType|0x01|UINT8|0x30001018
 
+  ## SPI NOR Flash operation retry counts
+  #  0x:  No retry
+  #  0x:  Maximum retry value
+  #
+  # @Prompt SPI NOR Flash Operation Retry Value
+  
gEfiMdePkgTokenSpaceGuid.PcdSpiNorFlashOperationRetryCount|0x|UINT32|0x30001019
+
+  ## SPI NOR Flash operation delay in microseconds
+  #  Deafult is set to 0x000f microseconds
+  #
+  # @Prompt SPI NOR Flash Operation Delay in Microseconds
+  
gEfiMdePkgTokenSpaceGuid.PcdSpiNorFlashOperationDelayMicroseconds|0x000F|UINT32|0x3000101A
+
 [PcdsFixedAtBuild,PcdsPatchableInModule]
   ## Indicates the maximum length of unicode string used in the following
   #  BaseLib functions: StrLen(), StrSize(), StrCmp(), StrnCmp(), StrCpy(), 
StrnCpy()
-- 
2.37.1.windows.1



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




[edk2-devel] [PATCH 1/5] MdePkg/Include: Update definitions of SPI related header files

2023-07-25 Thread Chang, Abner via groups.io
From: abnchang 

BZ#: 4471
Update definitions according to PI spec v1.8 Errata as it
is approved in PIWG (Ticket #2394).

Signed-off-by: Abner Chang 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Cc: Abdul Lateef Attar 
---
 MdePkg/Include/Protocol/SpiConfiguration.h |  8 
 MdePkg/Include/Protocol/SpiHc.h| 14 ++
 MdePkg/Include/Protocol/SpiIo.h| 10 ++
 3 files changed, 32 insertions(+)

diff --git a/MdePkg/Include/Protocol/SpiConfiguration.h 
b/MdePkg/Include/Protocol/SpiConfiguration.h
index 3f8fb9ff62c..cffdc8e232d 100644
--- a/MdePkg/Include/Protocol/SpiConfiguration.h
+++ b/MdePkg/Include/Protocol/SpiConfiguration.h
@@ -2,6 +2,7 @@
   This file defines the SPI Configuration Protocol.
 
   Copyright (c) 2017, Intel Corporation. All rights reserved.
+  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
   @par Revision Reference:
@@ -168,6 +169,13 @@ typedef struct _EFI_SPI_BUS {
   VOID*ClockParameter;
 } EFI_SPI_BUS;
 
+///
+/// Definitions of SPI Part Attributes.
+///
+#define SPI_PART_SUPPORTS_2_BIT_DATA_BUS_WIDTH  BIT0
+#define SPl_PART_SUPPORTS_4_B1T_DATA_BUS_WIDTH  BIT1
+#define SPl_PART_SUPPORTS_8_B1T_DATA_BUS_WIDTH  BIT2
+
 ///
 /// The EFI_SPI_PERIPHERAL data structure describes how a specific block of
 /// logic which is connected to the SPI bus. This data structure also selects
diff --git a/MdePkg/Include/Protocol/SpiHc.h b/MdePkg/Include/Protocol/SpiHc.h
index 30128dd5c4d..645bfdefe9b 100644
--- a/MdePkg/Include/Protocol/SpiHc.h
+++ b/MdePkg/Include/Protocol/SpiHc.h
@@ -2,6 +2,7 @@
   This file defines the SPI Host Controller Protocol.
 
   Copyright (c) 2017, Intel Corporation. All rights reserved.
+  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
   @par Revision Reference:
@@ -121,6 +122,19 @@ typedef EFI_STATUS
   IN EFI_SPI_BUS_TRANSACTION*BusTransaction
   );
 
+///
+/// Definitions of SPI Host Controller Attributes.
+///
+#define HC_SUPPORTS_WRITE_ONLY_OPERATIONS   BIT0
+#define HC_SUPPORTS_READ_ONLY_OPERATIONSBIT1
+#define HC_SUPPORTS_WRITE_THEN_READ_OPERATIONS  BIT2
+#define HC_TX_FRAME_IN_MOST_SIGNIFICANT_BITSBIT3
+#define HC_RX_FRAME_IN_MOST_SIGNIFICANT_BITSBIT4
+#define HC_SUPPORTS_2_BIT_DATA_BUS_WIDTHBIT5
+#define HC_SUPPORTS_4_BIT_DATA_BUS_WIDTHBIT6
+#define HC_SUPPORTS_8_BIT_DATA_BUS_WIDTHBIT7
+#define HC_TRANSFER_SIZE_INCLUDES_OPCODEBIT8
+#define HC_TRANSFER_SIZE_INCLUDES_ADDRESS   BIT9
 ///
 /// Support a SPI data transaction between the SPI controller and a SPI chip.
 ///
diff --git a/MdePkg/Include/Protocol/SpiIo.h b/MdePkg/Include/Protocol/SpiIo.h
index b4fc5e03b88..0ea881fd115 100644
--- a/MdePkg/Include/Protocol/SpiIo.h
+++ b/MdePkg/Include/Protocol/SpiIo.h
@@ -2,6 +2,7 @@
   This file defines the SPI I/O Protocol.
 
   Copyright (c) 2017, Intel Corporation. All rights reserved.
+  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
   @par Revision Reference:
@@ -223,6 +224,15 @@ typedef struct _EFI_SPI_BUS_TRANSACTION {
   UINT8   *ReadBuffer;
 } EFI_SPI_BUS_TRANSACTION;
 
+///
+/// Definitions of SPI I/O Attributes.
+///
+#define SPI_IO_SUPPORTS_2_BIT_DATA_BUS_WIDTH   BIT0
+#define SPI_IO_SUPPORTS_4_BIT_DATA_BUS_WIDTH   BIT1
+#define SPI_IO_SUPPORTS_8_BIT_DATA_BUS_WIDTH   BIT2
+#define SPI_IO_TRANSFER_SIZE_INCLUDES_OPCODE   BIT3
+#define SPI_IO_TRANSFER_SIZE_INCLUDES_ADDRESS  BIT4
+
 ///
 /// Support managed SPI data transactions between the SPI controller and a SPI
 /// chip.
-- 
2.37.1.windows.1



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




[edk2-devel] [PATCH 2/5] MdePkg/Include: Add SPI NOR Flash JEDEC SFDP header file

2023-07-25 Thread Chang, Abner via groups.io
From: abnchang 

BZ#: 4472
Add definition of JEDEC Serial Flash Discoverable Parameters
(SFDP) specification.
https://www.jedec.org/standards-documents/docs/jesd216b

Signed-off-by: Abner Chang 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Cc: Abdul Lateef Attar 
---
 .../IndustryStandard/SpiNorFlashJedecSfdp.h   | 324 ++
 1 file changed, 324 insertions(+)
 create mode 100644 MdePkg/Include/IndustryStandard/SpiNorFlashJedecSfdp.h

diff --git a/MdePkg/Include/IndustryStandard/SpiNorFlashJedecSfdp.h 
b/MdePkg/Include/IndustryStandard/SpiNorFlashJedecSfdp.h
new file mode 100644
index 000..44ab5a12633
--- /dev/null
+++ b/MdePkg/Include/IndustryStandard/SpiNorFlashJedecSfdp.h
@@ -0,0 +1,324 @@
+/** @file
+  SPI NOR Flash JEDEC Serial Flash Discoverable Parameters (SFDP)
+  header file.
+
+  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Revision Reference:
+- JEDEC Standard, JESD216F.02
+  https://www.jedec.org/document_search?search_api_views_fulltext=JESD216
+
+  @par Glossary:
+- SFDP - Serial Flash Discoverable Parameters
+- PTP  - Parameter Table Pointer
+**/
+
+#ifndef SPI_NOR_FLASH_JEDEC_H_
+#define SPI_NOR_FLASH_JEDEC_H_
+
+#include 
+
+#define SFDP_HEADER_SIGNATURE  0x50444653
+#define SFDP_SUPPORTED_MAJOR_REVISION  0x1ul
+
+/// JEDEC Basic Flash Parameter Header
+#define SFDP_BASIC_PARAMETER_ID_LSB  0x00
+#define SFDP_BASIC_PARAMETER_ID_MSB  0xFF
+
+///
+/// JDEC Sector Map Parameter Header and Table
+///
+#define SFDP_SECTOR_MAP_PARAMETER_ID_LSB0x81
+#define SFDP_FOUR_BYTE_ADDRESS_INSTRUCTION_LSB  0x84
+#define SFDP_SECTOR_MAP_PARAMETER_ID_MSB0xFF
+
+#define SFDP_FLASH_MEMORY_DENSITY_4GBIT  0x8000
+
+#pragma pack (1)
+typedef struct _SFDP_HEADER {
+  UINT32Signature;
+  UINT32MinorRev: 8;
+  UINT32MajorRev: 8;
+  UINT32NumParameterHeaders : 8;
+  UINT32AccessProtocol  : 8;
+} SFDP_HEADER;
+
+typedef struct _SFDP_PARAMETER_HEADER {
+  UINT32IdLsb: 8;
+  UINT32MinorRev : 8;
+  UINT32MajorRev : 8;
+  UINT32Length   : 8;
+  UINT32TablePointer : 24;
+  UINT32IdMsb: 8;
+} SFDP_PARAMETER_HEADER;
+
+typedef struct _SFDP_BASIC_FLASH_PARAMETER {
+  // DWORD 1
+  UINT32EraseSizes : 2;
+  UINT32WriteGranularity   : 1;
+  UINT32VolatileStatusBlockProtect : 1;
+  UINT32WriteEnableVolatileStatus  : 1;
+  UINT32Unused1Dw1 : 3;
+  UINT32FourKEraseInstr: 8;
+  UINT32FastRead112: 1;
+  UINT32AddressBytes   : 2;
+  UINT32DtrClocking: 1;
+  UINT32FastRead122: 1;
+  UINT32FastRead144: 1;
+  UINT32FastRead114: 1;
+  UINT32Unused2Dw1 : 9;
+  // DWORD 2
+  UINT32Density;
+  // DWORD 3
+  // Fast Read 144
+  UINT32FastRead144Dummy   : 5;
+  UINT32FastRead144ModeClk : 3;
+  UINT32FastRead144Instr   : 8;
+  // Fast Read 114
+  UINT32FastRead114Dummy   : 5;
+  UINT32FastRead114ModeClk : 3;
+  UINT32FastRead114Instr   : 8;
+  // DWORD 4
+  // Fast Read 112
+  UINT32FastRead112Dummy   : 5;
+  UINT32FastRead112ModeClk : 3;
+  UINT32FastRead112Instr   : 8;
+  // Fast Read 122
+  UINT32FastRead122Dummy   : 5;
+  UINT32FastRead122ModeClk : 3;
+  UINT32FastRead122Instr   : 8;
+  // DWORD 5
+  UINT32FastRead222: 1;
+  UINT32Unused1Dw5 : 3;
+  UINT32FastRead444: 1;
+  UINT32Unused2Dw5 : 27;
+  // DWORD 6
+  UINT32UnusedDw6  : 16;
+  // Fast Read 222
+  UINT32FastRead222Dummy   : 5;
+  UINT32FastRead222ModeClk : 3;
+  UINT32FastRead222Instr   : 8;
+  // DWORD 7
+  UINT32UnusedDw7  : 16;
+  // Fast Read 444
+  UINT32FastRead444Dummy   : 5;
+  UINT32FastRead444ModeClk : 3;
+  UINT32FastRead444Instr   : 8;
+  // DWORD 8
+  UINT32Erase1Size : 8;
+  UINT32Erase1Instr: 8;
+  UINT32Erase2Size : 8;
+  UINT32Erase2Instr: 8;
+  // DWORD 9
+  UINT32Erase3Size : 8;
+  UINT32Erase3Instr: 8;
+  UINT32Erase4Size : 8;
+  UINT32Erase4Instr: 8;
+  // DWORD 10
+  UINT32EraseMultiplier: 4;
+  UINT32Erase1Time : 7;
+  UINT32Erase2Time : 7;
+  UINT32Erase3Time : 7;
+  UINT32Erase4Time : 7;
+  // DWORD 11
+  UINT32ProgramMultiplier  : 4;
+  UINT32PageSize   : 4;
+  UINT32

[edk2-devel] [PATCH 0/5] SPI NOR Flash Driver for SFDP flash device

2023-07-25 Thread Chang, Abner via groups.io
From: Abner Chang 

This patch fixes the missing SPI defintions per to the
PIWG approval against PI spec 1.8 errata for ticket #2394.
This patch also provides the implemtation of SPI NOR flash
driver that supports JEDEC SFDP specification.
This driver support the flash device that has the GUID
gEdk2JedecSfdpSpiDxeDriverGuid or gEdk2JedecSfdpSpiSmmDriverGuid
declared in EFI_SPI_PERIPHERAL SpiPeripheralDriverGuid structure.

The driver has been verified with Macronix MX25U6435F flash device.

Signed-off-by: Abner Chang 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Cc: Abdul Lateef Attar 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 

abnchang (5):
  MdePkg/Include: Update definitions of SPI related header files
  MdePkg/Include: Add SPI NOR Flash JEDEC SFDP header file
  MdePkg: Add definitions in DEC for SPI NOR Flash SPDF driver
  MdeModulePkg/SpiNorFlashJedecSfdp: SPI NOR Flash JEDEC SFDP
  MdeModulePkg: Add SPI NOR FLash SFDP drivers to DSC

 MdePkg/MdePkg.dec |   19 +
 MdeModulePkg/MdeModulePkg.dsc |2 +
 .../SpiNorFlashJedecSfdpDxe.inf   |   63 +
 .../SpiNorFlashJedecSfdpSmm.inf   |   63 +
 .../Spi/SpiNorFlashJedecSfdp/SpiNorFlash.h|  274 +++
 .../SpiNorFlashJedecSfdpInternal.h|  294 +++
 .../IndustryStandard/SpiNorFlashJedecSfdp.h   |  324 +++
 MdePkg/Include/Protocol/SpiConfiguration.h|8 +
 MdePkg/Include/Protocol/SpiHc.h   |   14 +
 MdePkg/Include/Protocol/SpiIo.h   |   10 +
 .../Spi/SpiNorFlashJedecSfdp/SpiNorFlash.c| 1114 +++
 .../SpiNorFlashJedecSfdp.c| 1772 +
 .../SpiNorFlashJedecSfdpDxe.c |  261 +++
 .../SpiNorFlashJedecSfdpSmm.c |  234 +++
 .../SpiNorFlashJedecSfdpDxe.uni   |   13 +
 .../SpiNorFlashJedecSfdpExtra.uni |   11 +
 .../SpiNorFlashJedecSfdpSmm.uni   |   13 +
 17 files changed, 4489 insertions(+)
 create mode 100644 
MdeModulePkg/Bus/Spi/SpiNorFlashJedecSfdp/SpiNorFlashJedecSfdpDxe.inf
 create mode 100644 
MdeModulePkg/Bus/Spi/SpiNorFlashJedecSfdp/SpiNorFlashJedecSfdpSmm.inf
 create mode 100644 MdeModulePkg/Bus/Spi/SpiNorFlashJedecSfdp/SpiNorFlash.h
 create mode 100644 
MdeModulePkg/Bus/Spi/SpiNorFlashJedecSfdp/SpiNorFlashJedecSfdpInternal.h
 create mode 100644 MdePkg/Include/IndustryStandard/SpiNorFlashJedecSfdp.h
 create mode 100644 MdeModulePkg/Bus/Spi/SpiNorFlashJedecSfdp/SpiNorFlash.c
 create mode 100644 
MdeModulePkg/Bus/Spi/SpiNorFlashJedecSfdp/SpiNorFlashJedecSfdp.c
 create mode 100644 
MdeModulePkg/Bus/Spi/SpiNorFlashJedecSfdp/SpiNorFlashJedecSfdpDxe.c
 create mode 100644 
MdeModulePkg/Bus/Spi/SpiNorFlashJedecSfdp/SpiNorFlashJedecSfdpSmm.c
 create mode 100644 
MdeModulePkg/Bus/Spi/SpiNorFlashJedecSfdp/SpiNorFlashJedecSfdpDxe.uni
 create mode 100644 
MdeModulePkg/Bus/Spi/SpiNorFlashJedecSfdp/SpiNorFlashJedecSfdpExtra.uni
 create mode 100644 
MdeModulePkg/Bus/Spi/SpiNorFlashJedecSfdp/SpiNorFlashJedecSfdpSmm.uni

-- 
2.37.1.windows.1



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




Re: [edk2-devel] [PATCH v4] SecurityPkg/SecureBoot: Support RSA 512 and RSA 384

2023-07-25 Thread Sheng Wei
Hi Jiewen,
Thank you for the comments.
I will update the patch and follow the process.
BR
Sheng Wei

> -Original Message-
> From: Yao, Jiewen 
> Sent: 2023年7月25日 14:06
> To: Sheng, W ; devel@edk2.groups.io
> Cc: Wang, Jian J ; Xu, Min M ;
> Chen, Zeyi ; Wang, Fiona 
> Subject: RE: [PATCH v4] SecurityPkg/SecureBoot: Support RSA 512 and RSA
> 384
> 
> Thanks for the update, Wei.
> 
> From process perspective, please always do following:
> 
> 1) Please describe what is the difference between this version and previous
> version. As such, we can know what is delta and we can focus on the delta.
> 
> 2) Please describe what test has been done for this specific version. Such as
> unit test, integration test, etc.
> 
> 3) Please split the patch based upon package. The reason is that we need
> different reviewer for each package.
> 
> 
> For the patch, I have below comment:
> 
> 1) Please don't use magic number. Please always define MACRO for better
> maintenance.
> 
> +  if (KeyInfo->KeyType == 0) {
> 
> Please use "if (KeyInfo->KeyType == KEY_TYPE_RSASSA) {"
> 
> 
> Thank you
> Yao, Jiewen
> 
> 
> > -Original Message-
> > From: Sheng, W 
> > Sent: Thursday, July 6, 2023 4:06 PM
> > To: devel@edk2.groups.io
> > Cc: Yao, Jiewen ; Wang, Jian J
> > ; Xu, Min M ; Chen, Zeyi
> > ; Wang, Fiona 
> > Subject: [PATCH v4] SecurityPkg/SecureBoot: Support RSA 512 and RSA
> > 384
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3413
> >
> > Cc: Jiewen Yao 
> > Cc: Jian J Wang 
> > Cc: Min Xu 
> > Cc: Zeyi Chen 
> > Cc: Fiona Wang 
> > Signed-off-by: Sheng Wei 
> > ---
> >  CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c   |   3 +-
> >  MdePkg/Include/Guid/ImageAuthentication.h |  26 +++
> >  MdePkg/MdePkg.dec |   2 +
> >  .../Library/AuthVariableLib/AuthService.c | 220 +++---
> >  .../AuthVariableLib/AuthServiceInternal.h |   4 +-
> >  .../Library/AuthVariableLib/AuthVariableLib.c |  42 ++--
> >  .../DxeImageVerificationLib.c |  73 +++---
> >  .../SecureBootConfigDxe.inf   |  16 ++
> >  .../SecureBootConfigImpl.c| 114 +++--
> >  .../SecureBootConfigImpl.h|   2 +
> >  .../SecureBootConfigStrings.uni   |   6 +
> >  11 files changed, 416 insertions(+), 92 deletions(-)
> >
> > diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c
> > b/CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c
> > index 027dbb6842..944bcf8d38 100644
> > --- a/CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c
> > +++ b/CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c
> > @@ -591,7 +591,8 @@ ImageTimestampVerify (
> >// Register & Initialize necessary digest algorithms for PKCS#7 Handling.
> >
> >//
> >
> >if ((EVP_add_digest (EVP_md5 ()) == 0) || (EVP_add_digest (EVP_sha1
> > ()) == 0)
> > ||
> >
> > -  (EVP_add_digest (EVP_sha256 ()) == 0) || ((EVP_add_digest_alias
> > (SN_sha1WithRSAEncryption, SN_sha1WithRSA)) == 0))
> >
> > +  (EVP_add_digest (EVP_sha256 ()) == 0) || (EVP_add_digest
> > + (EVP_sha384 ())
> > == 0) ||
> >
> > +  (EVP_add_digest (EVP_sha512 ()) == 0) || ((EVP_add_digest_alias
> > (SN_sha1WithRSAEncryption, SN_sha1WithRSA)) == 0))
> >
> >{
> >
> >  return FALSE;
> >
> >}
> >
> > diff --git a/MdePkg/Include/Guid/ImageAuthentication.h
> > b/MdePkg/Include/Guid/ImageAuthentication.h
> > index fe83596571..c8ea2c14fb 100644
> > --- a/MdePkg/Include/Guid/ImageAuthentication.h
> > +++ b/MdePkg/Include/Guid/ImageAuthentication.h
> > @@ -144,6 +144,30 @@ typedef struct {
> >  0x3c5766e8, 0x269c, 0x4e34, {0xaa, 0x14, 0xed, 0x77, 0x6e, 0x85,
> > 0xb3, 0xb6} \
> >
> >}
> >
> >
> >
> > +///
> >
> > +/// This identifies a signature containing an RSA-3072 key. The key
> > +(only the
> > modulus
> >
> > +/// since the public key exponent is known to be 0x10001) shall be
> > +stored in big-
> > endian
> >
> > +/// order.
> >
> > +/// The SignatureHeader size shall always be 0. The SignatureSize
> > +shall always be
> > 16 (size
> >
> > +/// of SignatureOwner component) + 384 bytes.
> >
> > +///
> >
> > +#define EFI_CERT_RSA3072_GUID \
> >
> > +  { \
> >
> > +0xedd320c2, 0xb057, 0x4b8e, {0xad, 0x46, 0x2c, 0x9b, 0x85, 0x89,
> > + 0xee,
> > 0x92 } \
> >
> > +  }
> >
> > +
> >
> > +///
> >
> > +/// This identifies a signature containing an RSA-4096 key. The key
> > +(only the
> > modulus
> >
> > +/// since the public key exponent is known to be 0x10001) shall be
> > +stored in big-
> > endian
> >
> > +/// order.
> >
> > +/// The SignatureHeader size shall always be 0. The SignatureSize
> > +shall always be
> > 16 (size
> >
> > +/// of SignatureOwner component) + 512 bytes.
> >
> > +///
> >
> > +#define EFI_CERT_RSA4096_GUID \
> >
> > +  { \
> >
> > +0xb23e89a6, 0x8c8b, 0x4412, {0x85, 0x73, 0x15, 0x4e, 0x8d, 0x00,
> > + 0x98,
> > 0x2c } \
> >
> > +  }
> >
> > +
> >
> >  ///
> >
> >  /// This identifies a signature containing a RSA-2048 signature of a 
> > SHA-256

Re: [edk2-devel] [PATCH v4] SecurityPkg/SecureBoot: Support RSA 512 and RSA 384

2023-07-25 Thread Yao, Jiewen
Thanks for the update, Wei.

>From process perspective, please always do following:

1) Please describe what is the difference between this version and previous 
version. As such, we can know what is delta and we can focus on the delta.

2) Please describe what test has been done for this specific version. Such as 
unit test, integration test, etc.

3) Please split the patch based upon package. The reason is that we need 
different reviewer for each package.


For the patch, I have below comment:

1) Please don't use magic number. Please always define MACRO for better 
maintenance.

+  if (KeyInfo->KeyType == 0) {

Please use "if (KeyInfo->KeyType == KEY_TYPE_RSASSA) {"


Thank you
Yao, Jiewen


> -Original Message-
> From: Sheng, W 
> Sent: Thursday, July 6, 2023 4:06 PM
> To: devel@edk2.groups.io
> Cc: Yao, Jiewen ; Wang, Jian J ;
> Xu, Min M ; Chen, Zeyi ; Wang,
> Fiona 
> Subject: [PATCH v4] SecurityPkg/SecureBoot: Support RSA 512 and RSA 384
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3413
> 
> Cc: Jiewen Yao 
> Cc: Jian J Wang 
> Cc: Min Xu 
> Cc: Zeyi Chen 
> Cc: Fiona Wang 
> Signed-off-by: Sheng Wei 
> ---
>  CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c   |   3 +-
>  MdePkg/Include/Guid/ImageAuthentication.h |  26 +++
>  MdePkg/MdePkg.dec |   2 +
>  .../Library/AuthVariableLib/AuthService.c | 220 +++---
>  .../AuthVariableLib/AuthServiceInternal.h |   4 +-
>  .../Library/AuthVariableLib/AuthVariableLib.c |  42 ++--
>  .../DxeImageVerificationLib.c |  73 +++---
>  .../SecureBootConfigDxe.inf   |  16 ++
>  .../SecureBootConfigImpl.c| 114 +++--
>  .../SecureBootConfigImpl.h|   2 +
>  .../SecureBootConfigStrings.uni   |   6 +
>  11 files changed, 416 insertions(+), 92 deletions(-)
> 
> diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c
> b/CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c
> index 027dbb6842..944bcf8d38 100644
> --- a/CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c
> +++ b/CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c
> @@ -591,7 +591,8 @@ ImageTimestampVerify (
>// Register & Initialize necessary digest algorithms for PKCS#7 Handling.
> 
>//
> 
>if ((EVP_add_digest (EVP_md5 ()) == 0) || (EVP_add_digest (EVP_sha1 ()) == 
> 0)
> ||
> 
> -  (EVP_add_digest (EVP_sha256 ()) == 0) || ((EVP_add_digest_alias
> (SN_sha1WithRSAEncryption, SN_sha1WithRSA)) == 0))
> 
> +  (EVP_add_digest (EVP_sha256 ()) == 0) || (EVP_add_digest (EVP_sha384 
> ())
> == 0) ||
> 
> +  (EVP_add_digest (EVP_sha512 ()) == 0) || ((EVP_add_digest_alias
> (SN_sha1WithRSAEncryption, SN_sha1WithRSA)) == 0))
> 
>{
> 
>  return FALSE;
> 
>}
> 
> diff --git a/MdePkg/Include/Guid/ImageAuthentication.h
> b/MdePkg/Include/Guid/ImageAuthentication.h
> index fe83596571..c8ea2c14fb 100644
> --- a/MdePkg/Include/Guid/ImageAuthentication.h
> +++ b/MdePkg/Include/Guid/ImageAuthentication.h
> @@ -144,6 +144,30 @@ typedef struct {
>  0x3c5766e8, 0x269c, 0x4e34, {0xaa, 0x14, 0xed, 0x77, 0x6e, 0x85, 0xb3, 
> 0xb6}
> \
> 
>}
> 
> 
> 
> +///
> 
> +/// This identifies a signature containing an RSA-3072 key. The key (only the
> modulus
> 
> +/// since the public key exponent is known to be 0x10001) shall be stored in 
> big-
> endian
> 
> +/// order.
> 
> +/// The SignatureHeader size shall always be 0. The SignatureSize shall 
> always be
> 16 (size
> 
> +/// of SignatureOwner component) + 384 bytes.
> 
> +///
> 
> +#define EFI_CERT_RSA3072_GUID \
> 
> +  { \
> 
> +0xedd320c2, 0xb057, 0x4b8e, {0xad, 0x46, 0x2c, 0x9b, 0x85, 0x89, 0xee,
> 0x92 } \
> 
> +  }
> 
> +
> 
> +///
> 
> +/// This identifies a signature containing an RSA-4096 key. The key (only the
> modulus
> 
> +/// since the public key exponent is known to be 0x10001) shall be stored in 
> big-
> endian
> 
> +/// order.
> 
> +/// The SignatureHeader size shall always be 0. The SignatureSize shall 
> always be
> 16 (size
> 
> +/// of SignatureOwner component) + 512 bytes.
> 
> +///
> 
> +#define EFI_CERT_RSA4096_GUID \
> 
> +  { \
> 
> +0xb23e89a6, 0x8c8b, 0x4412, {0x85, 0x73, 0x15, 0x4e, 0x8d, 0x00, 0x98,
> 0x2c } \
> 
> +  }
> 
> +
> 
>  ///
> 
>  /// This identifies a signature containing a RSA-2048 signature of a SHA-256 
> hash.
> The
> 
>  /// SignatureHeader size shall always be 0. The SignatureSize shall always 
> be 16
> (size of
> 
> @@ -330,6 +354,8 @@ typedef struct {
>  extern EFI_GUID  gEfiImageSecurityDatabaseGuid;
> 
>  extern EFI_GUID  gEfiCertSha256Guid;
> 
>  extern EFI_GUID  gEfiCertRsa2048Guid;
> 
> +extern EFI_GUID  gEfiCertRsa3072Guid;
> 
> +extern EFI_GUID  gEfiCertRsa4096Guid;
> 
>  extern EFI_GUID  gEfiCertRsa2048Sha256Guid;
> 
>  extern EFI_GUID  gEfiCertSha1Guid;
> 
>  extern EFI_GUID  gEfiCertRsa2048Sha1Guid;
> 
> diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
> index d6c4179b2a..c88e88fa6b 100644
> --- a/MdePkg/MdePkg.dec
> +++ b/MdePkg/MdePkg.dec