Date   

[edk2-staging/RiscV64QemuVirt PATCH 04/29] MdePkg: Add BaseRiscVSbiLib Library for RISC-V

Sunil V L
 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4076

This library is required to make SBI ecalls from the S-mode EDK2.

Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>
Cc: Zhiguang Liu <zhiguang.liu@...>
Signed-off-by: Sunil V L <sunilvl@...>
---
MdePkg/MdePkg.dec | 4 +
MdePkg/MdePkg.dsc | 3 +
.../BaseRiscVSbiLib/BaseRiscVSbiLib.inf | 25 ++
MdePkg/Include/Library/BaseRiscVSbiLib.h | 127 ++++++++++
.../Library/BaseRiscVSbiLib/BaseRiscVSbiLib.c | 227 ++++++++++++++++++
5 files changed, 386 insertions(+)
create mode 100644 MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.inf
create mode 100644 MdePkg/Include/Library/BaseRiscVSbiLib.h
create mode 100644 MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.c

diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 8f1bcfdc3e97..1762068ffad7 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -307,6 +307,10 @@ [LibraryClasses.IA32, LibraryClasses.X64]
## @libraryclass Provides function to support TDX processing.
TdxLib|Include/Library/TdxLib.h

+[LibraryClasses.RISCV64]
+ ## @libraryclass Provides function to make ecalls to SBI
+ BaseRiscVSbiLib|Include/Library/BaseRiscVSbiLib.h
+
[Guids]
#
# GUID defined in UEFI2.1/UEFI2.0/EFI1.1
diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
index cc1ac196a931..fd08122f441d 100644
--- a/MdePkg/MdePkg.dsc
+++ b/MdePkg/MdePkg.dsc
@@ -188,4 +188,7 @@ [Components.ARM, Components.AARCH64]
MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.inf
MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf

+[Components.RISCV64]
+ MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.inf
+
[BuildOptions]
diff --git a/MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.inf b/MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.inf
new file mode 100644
index 000000000000..d03132bf01c1
--- /dev/null
+++ b/MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.inf
@@ -0,0 +1,25 @@
+## @file
+# RISC-V Library to call SBI ecalls
+#
+# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x0001001b
+ BASE_NAME = BaseRiscVSbiLib
+ FILE_GUID = D742CF3D-E600-4009-8FB5-318073008508
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = RiscVSbiLib
+
+[Sources]
+ BaseRiscVSbiLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ BaseLib
diff --git a/MdePkg/Include/Library/BaseRiscVSbiLib.h b/MdePkg/Include/Library/BaseRiscVSbiLib.h
new file mode 100644
index 000000000000..e9886187526a
--- /dev/null
+++ b/MdePkg/Include/Library/BaseRiscVSbiLib.h
@@ -0,0 +1,127 @@
+/** @file
+ Library to call the RISC-V SBI ecalls
+
+ Copyright (c) 2021-2022, Hewlett Packard Development LP. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Glossary:
+ - Hart - Hardware Thread, similar to a CPU core
+
+ Currently, EDK2 needs to call SBI only to set the time and to do system reset.
+
+**/
+
+#ifndef RISCV_SBI_LIB_H_
+#define RISCV_SBI_LIB_H_
+
+#include <Uefi.h>
+
+/* SBI Extension IDs */
+#define SBI_EXT_TIME 0x54494D45
+#define SBI_EXT_SRST 0x53525354
+
+/* SBI function IDs for TIME extension*/
+#define SBI_EXT_TIME_SET_TIMER 0x0
+
+/* SBI function IDs for SRST extension */
+#define SBI_EXT_SRST_RESET 0x0
+
+#define SBI_SRST_RESET_TYPE_SHUTDOWN 0x0
+#define SBI_SRST_RESET_TYPE_COLD_REBOOT 0x1
+#define SBI_SRST_RESET_TYPE_WARM_REBOOT 0x2
+#define SBI_SRST_RESET_TYPE_LAST SBI_SRST_RESET_TYPE_WARM_REBOOT
+
+#define SBI_SRST_RESET_REASON_NONE 0x0
+#define SBI_SRST_RESET_REASON_SYSFAIL 0x1
+
+/* SBI return error codes */
+#define SBI_SUCCESS 0
+#define SBI_ERR_FAILED -1
+#define SBI_ERR_NOT_SUPPORTED -2
+#define SBI_ERR_INVALID_PARAM -3
+#define SBI_ERR_DENIED -4
+#define SBI_ERR_INVALID_ADDRESS -5
+#define SBI_ERR_ALREADY_AVAILABLE -6
+#define SBI_ERR_ALREADY_STARTED -7
+#define SBI_ERR_ALREADY_STOPPED -8
+
+#define SBI_LAST_ERR SBI_ERR_ALREADY_STOPPED
+
+typedef struct {
+ UINT64 BootHartId;
+ VOID *PeiServiceTable; // PEI Service table
+ UINT64 FlattenedDeviceTree; // Pointer to Flattened Device tree
+} EFI_RISCV_FIRMWARE_CONTEXT;
+
+//
+// EDK2 OpenSBI firmware extension return status.
+//
+typedef struct {
+ UINTN Error; ///< SBI status code
+ UINTN Value; ///< Value returned
+} SBI_RET;
+
+VOID
+EFIAPI
+SbiSetTimer (
+ IN UINT64 Time
+ );
+
+EFI_STATUS
+EFIAPI
+SbiSystemReset (
+ IN UINTN ResetType,
+ IN UINTN ResetReason
+ );
+
+/**
+ Get firmware context of the calling hart.
+
+ @param[out] FirmwareContext The firmware context pointer.
+**/
+VOID
+EFIAPI
+GetFirmwareContext (
+ OUT EFI_RISCV_FIRMWARE_CONTEXT **FirmwareContext
+ );
+
+/**
+ Set firmware context of the calling hart.
+
+ @param[in] FirmwareContext The firmware context pointer.
+**/
+VOID
+EFIAPI
+SetFirmwareContext (
+ IN EFI_RISCV_FIRMWARE_CONTEXT *FirmwareContext
+ );
+
+/**
+ Get pointer to OpenSBI Firmware Context
+
+ Get the pointer of firmware context.
+
+ @param FirmwareContextPtr Pointer to retrieve pointer to the
+ Firmware Context.
+**/
+VOID
+EFIAPI
+GetFirmwareContextPointer (
+ IN OUT EFI_RISCV_FIRMWARE_CONTEXT **FirmwareContextPtr
+ );
+
+/**
+ Set pointer to OpenSBI Firmware Context
+
+ Set the pointer of firmware context.
+
+ @param FirmwareContextPtr Pointer to Firmware Context.
+**/
+VOID
+EFIAPI
+SetFirmwareContextPointer (
+ IN EFI_RISCV_FIRMWARE_CONTEXT *FirmwareContextPtr
+ );
+
+#endif
diff --git a/MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.c b/MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.c
new file mode 100644
index 000000000000..5db95a008069
--- /dev/null
+++ b/MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.c
@@ -0,0 +1,227 @@
+/** @file
+ Instance of the SBI ecall library.
+
+ It allows calling an SBI function via an ecall from S-Mode.
+
+ Copyright (c) 2021-2022, Hewlett Packard Development LP. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseRiscVSbiLib.h>
+
+//
+// Maximum arguments for SBI ecall
+// It's possible to pass more but no SBI call uses more as of SBI 0.2.
+// The additional arguments would have to be passed on the stack instead of as
+// registers, like it's done now.
+//
+#define SBI_CALL_MAX_ARGS 6
+
+/**
+ Call SBI call using ecall instruction.
+
+ Asserts when NumArgs exceeds SBI_CALL_MAX_ARGS.
+
+ @param[in] ExtId SBI extension ID.
+ @param[in] FuncId SBI function ID.
+ @param[in] NumArgs Number of arguments to pass to the ecall.
+ @param[in] ... Argument list for the ecall.
+
+ @retval Returns SBI_RET structure with value and error code.
+
+**/
+STATIC
+SBI_RET
+EFIAPI
+SbiCall (
+ IN UINTN ExtId,
+ IN UINTN FuncId,
+ IN UINTN NumArgs,
+ ...
+ )
+{
+ UINTN I;
+ SBI_RET Ret;
+ UINTN Args[SBI_CALL_MAX_ARGS];
+ VA_LIST ArgList;
+
+ VA_START (ArgList, NumArgs);
+
+ ASSERT (NumArgs <= SBI_CALL_MAX_ARGS);
+
+ for (I = 0; I < SBI_CALL_MAX_ARGS; I++) {
+ if (I < NumArgs) {
+ Args[I] = VA_ARG (ArgList, UINTN);
+ } else {
+ // Default to 0 for all arguments that are not given
+ Args[I] = 0;
+ }
+ }
+
+ VA_END (ArgList);
+
+ register UINTN a0 asm ("a0") = Args[0];
+ register UINTN a1 asm ("a1") = Args[1];
+ register UINTN a2 asm ("a2") = Args[2];
+ register UINTN a3 asm ("a3") = Args[3];
+ register UINTN a4 asm ("a4") = Args[4];
+ register UINTN a5 asm ("a5") = Args[5];
+ register UINTN a6 asm ("a6") = (UINTN)(FuncId);
+ register UINTN a7 asm ("a7") = (UINTN)(ExtId);
+
+ asm volatile ("ecall" \
+ : "+r" (a0), "+r" (a1) \
+ : "r" (a2), "r" (a3), "r" (a4), "r" (a5), "r" (a6), "r" (a7) \
+ : "memory"); \
+ Ret.Error = a0;
+ Ret.Value = a1;
+ return Ret;
+}
+
+/**
+ Translate SBI error code to EFI status.
+
+ @param[in] SbiError SBI error code
+ @retval EFI_STATUS
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+TranslateError (
+ IN UINTN SbiError
+ )
+{
+ switch (SbiError) {
+ case SBI_SUCCESS:
+ return EFI_SUCCESS;
+ case SBI_ERR_FAILED:
+ return EFI_DEVICE_ERROR;
+ break;
+ case SBI_ERR_NOT_SUPPORTED:
+ return EFI_UNSUPPORTED;
+ break;
+ case SBI_ERR_INVALID_PARAM:
+ return EFI_INVALID_PARAMETER;
+ break;
+ case SBI_ERR_DENIED:
+ return EFI_ACCESS_DENIED;
+ break;
+ case SBI_ERR_INVALID_ADDRESS:
+ return EFI_LOAD_ERROR;
+ break;
+ case SBI_ERR_ALREADY_AVAILABLE:
+ return EFI_ALREADY_STARTED;
+ break;
+ default:
+ //
+ // Reaches here only if SBI has defined a new error type
+ //
+ ASSERT (FALSE);
+ return EFI_UNSUPPORTED;
+ break;
+ }
+}
+
+/**
+ Clear pending timer interrupt bit and set timer for next event after Time.
+
+ To clear the timer without scheduling a timer event, set Time to a
+ practically infinite value or mask the timer interrupt by clearing sie.STIE.
+
+ @param[in] Time The time offset to the next scheduled timer interrupt.
+**/
+VOID
+EFIAPI
+SbiSetTimer (
+ IN UINT64 Time
+ )
+{
+ SbiCall (SBI_EXT_TIME, SBI_EXT_TIME_SET_TIMER, 1, Time);
+}
+
+EFI_STATUS
+EFIAPI
+SbiSystemReset (
+ IN UINTN ResetType,
+ IN UINTN ResetReason
+ )
+{
+ SBI_RET Ret;
+
+ Ret = SbiCall (
+ SBI_EXT_SRST,
+ SBI_EXT_SRST_RESET,
+ 2,
+ ResetType,
+ ResetReason
+ );
+
+ return TranslateError (Ret.Error);
+}
+
+/**
+ Get firmware context of the calling hart.
+
+ @param[out] FirmwareContext The firmware context pointer.
+ @retval EFI_SUCCESS The operation succeeds.
+**/
+VOID
+EFIAPI
+GetFirmwareContext (
+ OUT EFI_RISCV_FIRMWARE_CONTEXT **FirmwareContext
+ )
+{
+ *FirmwareContext = (EFI_RISCV_FIRMWARE_CONTEXT *)RiscVGetSupervisorScratch ();
+}
+
+/**
+ Set firmware context of the calling hart.
+
+ @param[in] FirmwareContext The firmware context pointer.
+**/
+VOID
+EFIAPI
+SetFirmwareContext (
+ IN EFI_RISCV_FIRMWARE_CONTEXT *FirmwareContext
+ )
+{
+ RiscVSetSupervisorScratch ((UINT64)FirmwareContext);
+}
+
+/**
+ Get pointer to OpenSBI Firmware Context
+
+ Get the pointer of firmware context through OpenSBI FW Extension SBI.
+
+ @param FirmwareContextPtr Pointer to retrieve pointer to the
+ Firmware Context.
+**/
+VOID
+EFIAPI
+GetFirmwareContextPointer (
+ IN OUT EFI_RISCV_FIRMWARE_CONTEXT **FirmwareContextPtr
+ )
+{
+ GetFirmwareContext (FirmwareContextPtr);
+}
+
+/**
+ Set the pointer to OpenSBI Firmware Context
+
+ Set the pointer of firmware context through OpenSBI FW Extension SBI.
+
+ @param FirmwareContextPtr Pointer to Firmware Context.
+**/
+VOID
+EFIAPI
+SetFirmwareContextPointer (
+ IN EFI_RISCV_FIRMWARE_CONTEXT *FirmwareContextPtr
+ )
+{
+ SetFirmwareContext (FirmwareContextPtr);
+}
--
2.25.1


[edk2-staging/RiscV64QemuVirt PATCH 03/29] MdePkg/BaseLib: RISC-V: Add few more helper functions

Sunil V L
 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4076

Few of the basic helper functions required for any
RISC-V CPU were added in edk2-platforms. To support
qemu virt, they need to be added in BaseLib.

Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>
Cc: Zhiguang Liu <zhiguang.liu@...>
Cc: Daniel Schaefer <git@...>
Signed-off-by: Sunil V L <sunilvl@...>
---
MdePkg/Library/BaseLib/BaseLib.inf | 2 +
MdePkg/Include/Library/BaseLib.h | 50 +++++++++++++++++
MdePkg/Library/BaseLib/RiscV64/CpuScratch.S | 31 +++++++++++
MdePkg/Library/BaseLib/RiscV64/ReadTimer.S | 24 +++++++++
.../Library/BaseLib/RiscV64/RiscVInterrupt.S | 53 +++++++++++++++++--
5 files changed, 156 insertions(+), 4 deletions(-)
create mode 100644 MdePkg/Library/BaseLib/RiscV64/CpuScratch.S
create mode 100644 MdePkg/Library/BaseLib/RiscV64/ReadTimer.S

diff --git a/MdePkg/Library/BaseLib/BaseLib.inf b/MdePkg/Library/BaseLib/BaseLib.inf
index 6be5be9428f2..86d7bb080971 100644
--- a/MdePkg/Library/BaseLib/BaseLib.inf
+++ b/MdePkg/Library/BaseLib/BaseLib.inf
@@ -401,6 +401,8 @@ [Sources.RISCV64]
RiscV64/RiscVCpuPause.S | GCC
RiscV64/RiscVInterrupt.S | GCC
RiscV64/FlushCache.S | GCC
+ RiscV64/CpuScratch.S | GCC
+ RiscV64/ReadTimer.S | GCC

[Packages]
MdePkg/MdePkg.dec
diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index a6f9a194ef1c..9724b84eef89 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -150,6 +150,56 @@ typedef struct {

#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 8

+VOID
+ RiscVSetSupervisorScratch (
+ UINT64
+ );
+
+UINT64
+RiscVGetSupervisorScratch (
+ VOID
+ );
+
+VOID
+ RiscVSetSupervisorStvec (
+ UINT64
+ );
+
+UINT64
+RiscVGetSupervisorStvec (
+ VOID
+ );
+
+UINT64
+RiscVGetSupervisorTrapCause (
+ VOID
+ );
+
+VOID
+ RiscVSetSupervisorAddressTranslationRegister (
+ UINT64
+ );
+
+UINT64
+RiscVReadTimer (
+ VOID
+ );
+
+VOID
+RiscVEnableTimerInterrupt (
+ VOID
+ );
+
+VOID
+RiscVDisableTimerInterrupt (
+ VOID
+ );
+
+VOID
+RiscVClearPendingTimerInterrupt (
+ VOID
+ );
+
#endif // defined (MDE_CPU_RISCV64)

//
diff --git a/MdePkg/Library/BaseLib/RiscV64/CpuScratch.S b/MdePkg/Library/BaseLib/RiscV64/CpuScratch.S
new file mode 100644
index 000000000000..dd7adc21eb07
--- /dev/null
+++ b/MdePkg/Library/BaseLib/RiscV64/CpuScratch.S
@@ -0,0 +1,31 @@
+//------------------------------------------------------------------------------
+//
+// CPU scratch register related functions for RISC-V
+//
+// Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+//------------------------------------------------------------------------------
+
+#include <Register/RiscV64/RiscVImpl.h>
+
+.data
+.align 3
+.section .text
+
+//
+// Set Supervisor mode scratch.
+// @param a0 : Value set to Supervisor mode scratch
+//
+ASM_FUNC (RiscVSetSupervisorScratch)
+ csrrw a1, CSR_SSCRATCH, a0
+ ret
+
+//
+// Get Supervisor mode scratch.
+// @retval a0 : Value in Supervisor mode scratch
+//
+ASM_FUNC (RiscVGetSupervisorScratch)
+ csrr a0, CSR_SSCRATCH
+ ret
diff --git a/MdePkg/Library/BaseLib/RiscV64/ReadTimer.S b/MdePkg/Library/BaseLib/RiscV64/ReadTimer.S
new file mode 100644
index 000000000000..bdddb67618ab
--- /dev/null
+++ b/MdePkg/Library/BaseLib/RiscV64/ReadTimer.S
@@ -0,0 +1,24 @@
+//------------------------------------------------------------------------------
+//
+// Read CPU timer
+//
+// Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+// Copyright (c) 2022, Ventana Micro Systems Inc. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+//------------------------------------------------------------------------------
+
+#include <Register/RiscV64/RiscVImpl.h>
+
+.data
+.align 3
+.section .text
+
+//
+// Read TIME CSR.
+// @retval a0 : 64-bit timer.
+//
+ASM_FUNC (RiscVReadTimer)
+ csrr a0, CSR_TIME
+ ret
diff --git a/MdePkg/Library/BaseLib/RiscV64/RiscVInterrupt.S b/MdePkg/Library/BaseLib/RiscV64/RiscVInterrupt.S
index 87b3468fc7fd..6a1b90a7e45c 100644
--- a/MdePkg/Library/BaseLib/RiscV64/RiscVInterrupt.S
+++ b/MdePkg/Library/BaseLib/RiscV64/RiscVInterrupt.S
@@ -8,13 +8,13 @@
//
//------------------------------------------------------------------------------

+#include <Register/RiscV64/RiscVImpl.h>
+
ASM_GLOBAL ASM_PFX(RiscVDisableSupervisorModeInterrupts)
ASM_GLOBAL ASM_PFX(RiscVEnableSupervisorModeInterrupt)
ASM_GLOBAL ASM_PFX(RiscVGetSupervisorModeInterrupts)

-#define SSTATUS_SIE 0x00000002
-#define CSR_SSTATUS 0x100
- #define SSTATUS_SPP_BIT_POSITION 8
+#define SSTATUS_SPP_BIT_POSITION 8

//
// This routine disables supervisor mode interrupt
@@ -53,11 +53,56 @@ InTrap:
ret

//
+// Set Supervisor mode trap vector.
+// @param a0 : Value set to Supervisor mode trap vector
+//
+ASM_FUNC (RiscVSetSupervisorStvec)
+ csrrw a1, CSR_STVEC, a0
+ ret
+
+//
+// Get Supervisor mode trap vector.
+// @retval a0 : Value in Supervisor mode trap vector
+//
+ASM_FUNC (RiscVGetSupervisorStvec)
+ csrr a0, CSR_STVEC
+ ret
+
+//
+// Get Supervisor trap cause CSR.
+//
+ASM_FUNC (RiscVGetSupervisorTrapCause)
+ csrrs a0, CSR_SCAUSE, 0
+ ret
+//
// This routine returns supervisor mode interrupt
// status.
//
-ASM_PFX(RiscVGetSupervisorModeInterrupts):
+ASM_FUNC (RiscVGetSupervisorModeInterrupts)
csrr a0, CSR_SSTATUS
andi a0, a0, SSTATUS_SIE
ret

+//
+// This routine disables supervisor mode timer interrupt
+//
+ASM_FUNC (RiscVDisableTimerInterrupt)
+ li a0, SIP_STIP
+ csrc CSR_SIE, a0
+ ret
+
+//
+// This routine enables supervisor mode timer interrupt
+//
+ASM_FUNC (RiscVEnableTimerInterrupt)
+ li a0, SIP_STIP
+ csrs CSR_SIE, a0
+ ret
+
+//
+// This routine clears pending supervisor mode timer interrupt
+//
+ASM_FUNC (RiscVClearPendingTimerInterrupt)
+ li a0, SIP_STIP
+ csrc CSR_SIP, a0
+ ret
--
2.25.1


[edk2-staging/RiscV64QemuVirt PATCH 02/29] MdePkg: Add RISCV_EFI_BOOT_PROTOCOL related definitions

Sunil V L
 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4076

RISC-V UEFI based platforms need to support RISCV_EFI_BOOT_PROTOCOL.
Add this protocol GUID definition and the header file required.

Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>
Cc: Zhiguang Liu <zhiguang.liu@...>
Signed-off-by: Sunil V L <sunilvl@...>
---
MdePkg/MdePkg.dec | 6 ++++
MdePkg/Include/Protocol/RiscVBootProtocol.h | 32 +++++++++++++++++++++
2 files changed, 38 insertions(+)
create mode 100644 MdePkg/Include/Protocol/RiscVBootProtocol.h

diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index f1ebf9e251c1..8f1bcfdc3e97 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -1915,6 +1915,12 @@ [Protocols]
## Include/Protocol/ShellDynamicCommand.h
gEfiShellDynamicCommandProtocolGuid = { 0x3c7200e9, 0x005f, 0x4ea4, {0x87, 0xde, 0xa3, 0xdf, 0xac, 0x8a, 0x27, 0xc3 }}

+ #
+ # Protocols defined for RISC-V systems
+ #
+ ## Include/Protocol/RiscVBootProtocol.h
+ gRiscVEfiBootProtocolGuid = { 0xccd15fec, 0x6f73, 0x4eec, { 0x83, 0x95, 0x3e, 0x69, 0xe4, 0xb9, 0x40, 0xbf }}
+
#
# [Error.gEfiMdePkgTokenSpaceGuid]
# 0x80000001 | Invalid value provided.
diff --git a/MdePkg/Include/Protocol/RiscVBootProtocol.h b/MdePkg/Include/Protocol/RiscVBootProtocol.h
new file mode 100644
index 000000000000..d0d40618b483
--- /dev/null
+++ b/MdePkg/Include/Protocol/RiscVBootProtocol.h
@@ -0,0 +1,32 @@
+/** @file
+ RISC-V Boot Protocol mandatory for RISC-V UEFI platforms.
+
+ Specification available at
+ https://github.com/riscv-non-isa/riscv-uefi
+
+ Copyright (c) 2022, Ventana Micro Systems Inc. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __RISCV_BOOT_PROTOCOL_H__
+#define __RISCV_BOOT_PROTOCOL_H__
+
+typedef struct _RISCV_EFI_BOOT_PROTOCOL RISCV_EFI_BOOT_PROTOCOL;
+
+#define RISCV_EFI_BOOT_PROTOCOL_REVISION 0x00010000
+#define RISCV_EFI_BOOT_PROTOCOL_LATEST_VERSION \
+ RISCV_EFI_BOOT_PROTOCOL_REVISION
+
+typedef EFI_STATUS
+(EFIAPI *EFI_GET_BOOT_HARTID)(
+ IN RISCV_EFI_BOOT_PROTOCOL *This,
+ OUT UINTN *BootHartId
+ );
+
+typedef struct _RISCV_EFI_BOOT_PROTOCOL {
+ UINT64 Revision;
+ EFI_GET_BOOT_HARTID GetBootHartId;
+} RISCV_EFI_BOOT_PROTOCOL;
+
+#endif
--
2.25.1


[edk2-staging/RiscV64QemuVirt PATCH 01/29] MdePkg/Register: Add register definition header files for RISC-V

Sunil V L
 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4076

Add register definitions and access routines for RISC-V. These
headers are leveraged from opensbi repo.

Cc: Daniel Schaefer <git@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>
Cc: Zhiguang Liu <zhiguang.liu@...>
Signed-off-by: Sunil V L <sunilvl@...>
---
.../Include/Register/RiscV64/RiscVEncoding.h | 124 ++++++++++++++++++
MdePkg/Include/Register/RiscV64/RiscVImpl.h | 24 ++++
2 files changed, 148 insertions(+)
create mode 100644 MdePkg/Include/Register/RiscV64/RiscVEncoding.h
create mode 100644 MdePkg/Include/Register/RiscV64/RiscVImpl.h

diff --git a/MdePkg/Include/Register/RiscV64/RiscVEncoding.h b/MdePkg/Include/Register/RiscV64/RiscVEncoding.h
new file mode 100644
index 000000000000..c98c36ac4cde
--- /dev/null
+++ b/MdePkg/Include/Register/RiscV64/RiscVEncoding.h
@@ -0,0 +1,124 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
+ *
+ * Copyright (c) 2019 Western Digital Corporation or its affiliates. All rights reserved.<BR>
+ * Copyright (c) 2022 Ventana Micro Systems Inc. All rights reserved.<BR>
+ *
+ */
+
+#ifndef __RISCV_ENCODING_H__
+#define __RISCV_ENCODING_H__
+
+/* clang-format off */
+#define MSTATUS_SIE 0x00000002UL
+#define MSTATUS_MIE 0x00000008UL
+#define MSTATUS_SPIE_SHIFT 5
+#define MSTATUS_SPIE (1UL << MSTATUS_SPIE_SHIFT)
+#define MSTATUS_UBE 0x00000040UL
+#define MSTATUS_MPIE 0x00000080UL
+#define MSTATUS_SPP_SHIFT 8
+#define MSTATUS_SPP (1UL << MSTATUS_SPP_SHIFT)
+#define MSTATUS_MPP_SHIFT 11
+#define MSTATUS_MPP (3UL << MSTATUS_MPP_SHIFT)
+
+#define SSTATUS_SIE MSTATUS_SIE
+#define SSTATUS_SPIE_SHIFT MSTATUS_SPIE_SHIFT
+#define SSTATUS_SPIE MSTATUS_SPIE
+#define SSTATUS_SPP_SHIFT MSTATUS_SPP_SHIFT
+#define SSTATUS_SPP MSTATUS_SPP
+
+#define IRQ_S_SOFT 1
+#define IRQ_VS_SOFT 2
+#define IRQ_M_SOFT 3
+#define IRQ_S_TIMER 5
+#define IRQ_VS_TIMER 6
+#define IRQ_M_TIMER 7
+#define IRQ_S_EXT 9
+#define IRQ_VS_EXT 10
+#define IRQ_M_EXT 11
+#define IRQ_S_GEXT 12
+#define IRQ_PMU_OVF 13
+
+#define MIP_SSIP (1UL << IRQ_S_SOFT)
+#define MIP_VSSIP (1UL << IRQ_VS_SOFT)
+#define MIP_MSIP (1UL << IRQ_M_SOFT)
+#define MIP_STIP (1UL << IRQ_S_TIMER)
+#define MIP_VSTIP (1UL << IRQ_VS_TIMER)
+#define MIP_MTIP (1UL << IRQ_M_TIMER)
+#define MIP_SEIP (1UL << IRQ_S_EXT)
+#define MIP_VSEIP (1UL << IRQ_VS_EXT)
+#define MIP_MEIP (1UL << IRQ_M_EXT)
+#define MIP_SGEIP (1UL << IRQ_S_GEXT)
+#define MIP_LCOFIP (1UL << IRQ_PMU_OVF)
+
+#define SIP_SSIP MIP_SSIP
+#define SIP_STIP MIP_STIP
+
+#define PRV_U 0UL
+#define PRV_S 1UL
+#define PRV_M 3UL
+
+#define SATP64_MODE 0xF000000000000000ULL
+#define SATP64_ASID 0x0FFFF00000000000ULL
+#define SATP64_PPN 0x00000FFFFFFFFFFFULL
+
+#define SATP_MODE_OFF 0UL
+#define SATP_MODE_SV32 1UL
+#define SATP_MODE_SV39 8UL
+#define SATP_MODE_SV48 9UL
+#define SATP_MODE_SV57 10UL
+#define SATP_MODE_SV64 11UL
+
+#define SATP_MODE SATP64_MODE
+
+/* ===== User-level CSRs ===== */
+
+/* User Counters/Timers */
+#define CSR_CYCLE 0xc00
+#define CSR_TIME 0xc01
+
+/* ===== Supervisor-level CSRs ===== */
+
+/* Supervisor Trap Setup */
+#define CSR_SSTATUS 0x100
+#define CSR_SEDELEG 0x102
+#define CSR_SIDELEG 0x103
+#define CSR_SIE 0x104
+#define CSR_STVEC 0x105
+
+/* Supervisor Configuration */
+#define CSR_SENVCFG 0x10a
+
+/* Supervisor Trap Handling */
+#define CSR_SSCRATCH 0x140
+#define CSR_SEPC 0x141
+#define CSR_SCAUSE 0x142
+#define CSR_STVAL 0x143
+#define CSR_SIP 0x144
+
+/* Supervisor Protection and Translation */
+#define CSR_SATP 0x180
+
+/* ===== Trap/Exception Causes ===== */
+
+#define CAUSE_MISALIGNED_FETCH 0x0
+#define CAUSE_FETCH_ACCESS 0x1
+#define CAUSE_ILLEGAL_INSTRUCTION 0x2
+#define CAUSE_BREAKPOINT 0x3
+#define CAUSE_MISALIGNED_LOAD 0x4
+#define CAUSE_LOAD_ACCESS 0x5
+#define CAUSE_MISALIGNED_STORE 0x6
+#define CAUSE_STORE_ACCESS 0x7
+#define CAUSE_USER_ECALL 0x8
+#define CAUSE_SUPERVISOR_ECALL 0x9
+#define CAUSE_VIRTUAL_SUPERVISOR_ECALL 0xa
+#define CAUSE_MACHINE_ECALL 0xb
+#define CAUSE_FETCH_PAGE_FAULT 0xc
+#define CAUSE_LOAD_PAGE_FAULT 0xd
+#define CAUSE_STORE_PAGE_FAULT 0xf
+#define CAUSE_FETCH_GUEST_PAGE_FAULT 0x14
+#define CAUSE_LOAD_GUEST_PAGE_FAULT 0x15
+#define CAUSE_VIRTUAL_INST_FAULT 0x16
+#define CAUSE_STORE_GUEST_PAGE_FAULT 0x17
+
+#endif
diff --git a/MdePkg/Include/Register/RiscV64/RiscVImpl.h b/MdePkg/Include/Register/RiscV64/RiscVImpl.h
new file mode 100644
index 000000000000..7dc100ecf510
--- /dev/null
+++ b/MdePkg/Include/Register/RiscV64/RiscVImpl.h
@@ -0,0 +1,24 @@
+/** @file
+ RISC-V package definitions.
+
+ Copyright (c) 2016 - 2022, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+#include <Register/RiscV64/RiscVEncoding.h>
+
+#ifndef __RISCV_IMPL_H_
+#define __RISCV_IMPL_H_
+
+#define _ASM_FUNC(Name, Section) \
+ .global Name ; \
+ .section #Section, "ax" ; \
+ .type Name, %function ; \
+ .p2align 2 ; \
+ Name:
+
+#define ASM_FUNC(Name) _ASM_FUNC(ASM_PFX(Name), .text. ## Name)
+#define RISCV_TIMER_COMPARE_BITS 32
+
+#endif
--
2.25.1


[edk2-staging/RiscV64QemuVirt PATCH 00/29] Add support for RISC-V virt machine

Sunil V L
 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4076

Add support for RISC-V qemu virt machine. Most of the changes are migrated from
edk2-platforms repo and followed the latest guidelines for EDK2 code structuring.

The changes at a high level are,

1) MdePkg:
- Add RISC-V register definitions
- Add RISCV_EFI_BOOT_PROTOCOL related definitions
- Add BaseRiscVSbiLib library to make ecall to machine mode firmware

2) UefiCpuPkg:
- Refactor modules/libraries as per latest guidelines
- Add RISC-V support in below modules/libraries.
- CpuTimerLib, CpuExceptionHandlerLib, CpuDxe
- Add new CpuTimerDxe module

3) ArmVirtPkg:
- Migrate below libraries/modules to OvmfPkg
- PlatformBootManagerLib, PlatformHasAcpiDtDxe
- Fix up the consumers of these modules

4) OvmfPkg:
- Refactor the libraries/modules as per latest guidelines
- Add RISC-V support for below libraries/modules.
- Sec, ResetSystemLib, PlatformInitLib, PlatformPei
- Add NorFlashDxe driver and NorFlashQemuLib (Copied from ARM)
- Add new DSC/FDF files to build for RISC-V virt machine

The changes are tested on risc-v qemu with an additional patch series to
enable pflash available at https://github.com/vlsunil/qemu/tree/pflash_v3

Cc: Abner Chang <abner.chang@...>
Cc: Daniel Schaefer <git@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>
Cc: Zhiguang Liu <zhiguang.liu@...>
Cc: Ard Biesheuvel <ardb+tianocore@...>
Cc: Jiewen Yao <jiewen.yao@...>
Cc: Jordan Justen <jordan.l.justen@...>
Cc: Gerd Hoffmann <kraxel@...>
Cc: Rebecca Cran <rebecca@...>
Cc: Peter Grehan <grehan@...>
Cc: Brijesh Singh <brijesh.singh@...>
Cc: Erdem Aktas <erdemaktas@...>
Cc: James Bottomley <jejb@...>
Cc: Min Xu <min.m.xu@...>
Cc: Tom Lendacky <thomas.lendacky@...>
Cc: Eric Dong <eric.dong@...>
Cc: Ray Ni <ray.ni@...>
Cc: Rahul Kumar <rahul1.kumar@...>
Cc: Leif Lindholm <quic_llindhol@...>
Cc: Sami Mujawar <sami.mujawar@...>
Cc: Andrew Fish <afish@...>
Cc: Anup Patel <apatel@...>

Sunil V L (29):
MdePkg/Register: Add register definition header files for RISC-V
MdePkg: Add RISCV_EFI_BOOT_PROTOCOL related definitions
MdePkg/BaseLib: RISC-V: Add few more helper functions
MdePkg: Add BaseRiscVSbiLib Library for RISC-V
OvmfPkg/PlatformInitLib: Refactor to allow other architectures
OvmfPkg/PlatformInitLib: Add support for RISC-V
OvmfPkg/ResetSystemLib: Refactor to allow other architectures.
OvmfPkg/ResetSystemLib: Add support for RISC-V
OvmfPkg/Sec: Refactor to allow other architectures
OvmfPkg/Sec: Add RISC-V support
OvmfPkg/PlatformPei: Refactor to allow other architectures
OvmfPkg/PlatformPei: Add support for RISC-V
UefiCpuPkg/CpuTimerLib: Refactor to allow other architectures
UefiCpuPkg/CpuTimerLib: Add support for RISC-V
UefiCpuPkg/CpuExceptionHandlerLib: Refactor to allow other
architectures
UefiCpuPkg/CpuExceptionHandlerLib: Add support for RISC-V
UefiCpuPkg/CpuDxe: Refactor to allow other architectures
UefiCpuPkg/CpuDxe: Add support for RISC-V
UefiCpuPkg/CpuDxe: Add RISC-V Boot protocol support
UefiCpuPkg: Add CpuTimerDxe module
ArmVirtPkg/PlatformHasAcpiDtDxe: Move to OvmfPkg
ArmVirtPkg: Fix up the location of PlatformHasAcpiDtDxe
ArmVirtPkg/PlatformBootManagerLib: Move to OvmfPkg
ArmVirtPkg: Fix up the paths to PlatformBootManagerLib
OvmfPkg: Add NorFlashQemuLib library
OvmfPkg: Add generic Qemu NOR flash DXE driver
OvmfPkg: RiscVVirt: Add Qemu Virt platform support
Maintainers.txt: Add entry for OvmfPkg/RiscVVirt
UefiCpuPkg/UefiCpuPkg.ci.yaml: Ignore RISC-V file

ArmVirtPkg/ArmVirtPkg.dec | 9 -
MdePkg/MdePkg.dec | 10 +
OvmfPkg/OvmfPkg.dec | 22 +
ArmVirtPkg/ArmVirtCloudHv.dsc | 2 +-
ArmVirtPkg/ArmVirtQemu.dsc | 8 +-
ArmVirtPkg/ArmVirtQemuKernel.dsc | 6 +-
MdePkg/MdePkg.dsc | 3 +
OvmfPkg/Platforms/RiscVVirt/RiscVVirt.dsc | 726 +++++++++++++
UefiCpuPkg/UefiCpuPkg.dsc | 15 +-
OvmfPkg/Platforms/RiscVVirt/RiscVVirt.fdf | 406 ++++++++
.../CloudHvHasAcpiDtDxe.inf | 2 +-
.../KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf | 2 +-
MdePkg/Library/BaseLib/BaseLib.inf | 2 +
.../BaseRiscVSbiLib/BaseRiscVSbiLib.inf | 25 +
OvmfPkg/Drivers/NorFlashDxe/NorFlashDxe.inf | 69 ++
.../NorFlashQemuLib/NorFlashQemuLib.inf | 40 +
.../NorFlashQemuUnifiedLib.inf | 30 +
.../PlatformBootManagerLib.inf | 3 +-
.../PlatformInitLib/PlatformInitLib.inf | 31 +-
.../ResetSystemLib/BaseResetSystemLib.inf | 12 +-
.../BaseResetSystemLibBhyve.inf | 4 +-
.../BaseResetSystemLibMicrovm.inf | 2 +-
.../ResetSystemLib/DxeResetSystemLib.inf | 15 +-
.../PlatformHasAcpiDtDxe.inf | 3 +-
OvmfPkg/PlatformPei/PlatformPei.inf | 43 +-
OvmfPkg/Sec/SecMain.inf | 34 +-
UefiCpuPkg/CpuDxe/CpuDxe.inf | 39 +-
UefiCpuPkg/CpuTimerDxe/CpuTimerDxe.inf | 51 +
.../DxeCpuExceptionHandlerLib.inf | 21 +-
.../PeiCpuExceptionHandlerLib.inf | 8 +-
.../SecPeiCpuExceptionHandlerLib.inf | 19 +-
.../SmmCpuExceptionHandlerLib.inf | 8 +-
.../Xcode5SecPeiCpuExceptionHandlerLib.inf | 6 +-
.../Library/CpuTimerLib/BaseCpuTimerLib.inf | 9 +-
MdePkg/Include/Library/BaseLib.h | 50 +
MdePkg/Include/Library/BaseRiscVSbiLib.h | 127 +++
MdePkg/Include/Protocol/RiscVBootProtocol.h | 32 +
.../Include/Register/RiscV64/RiscVEncoding.h | 124 +++
MdePkg/Include/Register/RiscV64/RiscVImpl.h | 24 +
OvmfPkg/Drivers/NorFlashDxe/NorFlash.h | 422 ++++++++
OvmfPkg/Include/Library/NorFlashPlatformLib.h | 30 +
OvmfPkg/Include/Library/PlatformInitLib.h | 6 +
.../PlatformBootManagerLibVirt}/PlatformBm.h | 0
OvmfPkg/PlatformPei/{ => Ia32_X64}/Platform.h | 0
OvmfPkg/PlatformPei/RiscV64/Platform.h | 97 ++
OvmfPkg/Sec/{ => Ia32_X64}/AmdSev.h | 0
OvmfPkg/Sec/RiscV64/SecMain.h | 65 ++
OvmfPkg/Sec/SecMainCommon.h | 73 ++
UefiCpuPkg/CpuDxe/{ => Ia32_X64}/CpuDxe.h | 0
UefiCpuPkg/CpuDxe/{ => Ia32_X64}/CpuGdt.h | 0
UefiCpuPkg/CpuDxe/{ => Ia32_X64}/CpuMp.h | 0
.../CpuDxe/{ => Ia32_X64}/CpuPageTable.h | 0
UefiCpuPkg/CpuDxe/{ => RiscV64}/CpuDxe.h | 122 +--
UefiCpuPkg/CpuTimerDxe/RiscV64/Timer.h | 177 ++++
.../{ => Ia32_X64}/CpuExceptionCommon.h | 0
.../RiscV64/CpuExceptionHandlerLib.h | 116 +++
.../Library/BaseRiscVSbiLib/BaseRiscVSbiLib.c | 227 ++++
OvmfPkg/Drivers/NorFlashDxe/NorFlash.c | 972 ++++++++++++++++++
.../Drivers/NorFlashDxe/NorFlashBlockIoDxe.c | 123 +++
OvmfPkg/Drivers/NorFlashDxe/NorFlashDxe.c | 506 +++++++++
OvmfPkg/Drivers/NorFlashDxe/NorFlashFvb.c | 777 ++++++++++++++
.../Library/NorFlashQemuLib/NorFlashQemuLib.c | 136 +++
.../NorFlashQemuLib/NorFlashQemuUnifiedLib.c | 40 +
.../PlatformBootManagerLibVirt}/PlatformBm.c | 0
.../PlatformBootManagerLibVirt}/QemuKernel.c | 0
.../PlatformInitLib/{ => Ia32_X64}/Cmos.c | 0
.../PlatformInitLib/{ => Ia32_X64}/IntelTdx.c | 0
.../{ => Ia32_X64}/IntelTdxNull.c | 0
.../{ => Ia32_X64}/MemDetect.c | 0
.../PlatformInitLib/{ => Ia32_X64}/Platform.c | 0
.../PlatformInitLib/RiscV64/PlatformPeiLib.c | 73 ++
.../{ => Ia32_X64}/BaseResetShutdown.c | 0
.../{ => Ia32_X64}/BaseResetShutdownBhyve.c | 0
.../{ => Ia32_X64}/DxeResetShutdown.c | 0
.../{ => Ia32_X64}/DxeResetSystemLibMicrovm.c | 0
.../{ => Ia32_X64}/ResetSystemLib.c | 0
.../{ => Ia32_X64}/ResetSystemLibMicrovm.c | 0
.../ResetSystemLib/RiscV64/DxeResetShutdown.c | 20 +
.../ResetSystemLib/RiscV64/ResetSystemLib.c | 128 +++
.../PlatformHasAcpiDtDxe.c | 0
OvmfPkg/PlatformPei/{ => Ia32_X64}/AmdSev.c | 0
.../PlatformPei/{ => Ia32_X64}/ClearCache.c | 0
.../{ => Ia32_X64}/FeatureControl.c | 0
OvmfPkg/PlatformPei/{ => Ia32_X64}/Fv.c | 0
OvmfPkg/PlatformPei/{ => Ia32_X64}/IntelTdx.c | 0
.../PlatformPei/{ => Ia32_X64}/MemDetect.c | 0
.../PlatformPei/{ => Ia32_X64}/MemTypeInfo.c | 0
OvmfPkg/PlatformPei/{ => Ia32_X64}/Platform.c | 0
OvmfPkg/PlatformPei/{ => RiscV64}/Fv.c | 43 +-
OvmfPkg/PlatformPei/RiscV64/MemDetect.c | 212 ++++
OvmfPkg/PlatformPei/RiscV64/Platform.c | 372 +++++++
OvmfPkg/Sec/{ => Ia32_X64}/AmdSev.c | 0
OvmfPkg/Sec/{ => Ia32_X64}/SecMain.c | 227 +---
OvmfPkg/Sec/RiscV64/SecMain.c | 573 +++++++++++
OvmfPkg/Sec/SecMainCommon.c | 238 +++++
UefiCpuPkg/CpuDxe/{ => Ia32_X64}/CpuDxe.c | 0
UefiCpuPkg/CpuDxe/{ => Ia32_X64}/CpuGdt.c | 0
UefiCpuPkg/CpuDxe/{ => Ia32_X64}/CpuMp.c | 0
.../CpuDxe/{ => Ia32_X64}/CpuPageTable.c | 0
UefiCpuPkg/CpuDxe/RiscV64/CpuDxe.c | 365 +++++++
UefiCpuPkg/CpuTimerDxe/RiscV64/Timer.c | 294 ++++++
.../{ => Ia32_X64}/CpuExceptionCommon.c | 0
.../{ => Ia32_X64}/DxeException.c | 0
.../{ => Ia32_X64}/PeiCpuException.c | 0
.../{ => Ia32_X64}/PeiDxeSmmCpuException.c | 0
.../{ => Ia32_X64}/SecPeiCpuException.c | 0
.../{ => Ia32_X64}/SmmException.c | 0
.../CpuExceptionHandlerLib.c} | 83 +-
.../{ => Ia32_X64}/BaseCpuTimerLib.c | 0
.../CpuTimerLib/{ => Ia32_X64}/CpuTimerLib.c | 0
.../Library/CpuTimerLib/RiscV64/CpuTimerLib.c | 199 ++++
ArmVirtPkg/ArmVirtPkg.ci.yaml | 1 -
ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc | 2 +-
Maintainers.txt | 4 +
MdePkg/Library/BaseLib/RiscV64/CpuScratch.S | 31 +
MdePkg/Library/BaseLib/RiscV64/ReadTimer.S | 24 +
.../Library/BaseLib/RiscV64/RiscVInterrupt.S | 53 +-
OvmfPkg/OvmfPkg.ci.yaml | 1 +
OvmfPkg/Platforms/RiscVVirt/RiscVVirt.fdf.inc | 66 ++
OvmfPkg/Platforms/RiscVVirt/VarStore.fdf.inc | 79 ++
OvmfPkg/Sec/RiscV64/SecEntry.S | 23 +
UefiCpuPkg/CpuTimerDxe/CpuTimer.uni | 15 +
UefiCpuPkg/CpuTimerDxe/CpuTimerExtra.uni | 13 +
.../RiscV64/SupervisorTrapHandler.S | 105 ++
UefiCpuPkg/UefiCpuPkg.ci.yaml | 1 +
125 files changed, 8658 insertions(+), 518 deletions(-)
create mode 100644 OvmfPkg/Platforms/RiscVVirt/RiscVVirt.dsc
create mode 100644 OvmfPkg/Platforms/RiscVVirt/RiscVVirt.fdf
create mode 100644 MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.inf
create mode 100644 OvmfPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
create mode 100644 OvmfPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf
create mode 100644 OvmfPkg/Library/NorFlashQemuLib/NorFlashQemuUnifiedLib.inf
rename {ArmVirtPkg/Library/PlatformBootManagerLib => OvmfPkg/Library/PlatformBootManagerLibVirt}/PlatformBootManagerLib.inf (92%)
rename {ArmVirtPkg => OvmfPkg}/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf (89%)
create mode 100644 UefiCpuPkg/CpuTimerDxe/CpuTimerDxe.inf
create mode 100644 MdePkg/Include/Library/BaseRiscVSbiLib.h
create mode 100644 MdePkg/Include/Protocol/RiscVBootProtocol.h
create mode 100644 MdePkg/Include/Register/RiscV64/RiscVEncoding.h
create mode 100644 MdePkg/Include/Register/RiscV64/RiscVImpl.h
create mode 100644 OvmfPkg/Drivers/NorFlashDxe/NorFlash.h
create mode 100644 OvmfPkg/Include/Library/NorFlashPlatformLib.h
rename {ArmVirtPkg/Library/PlatformBootManagerLib => OvmfPkg/Library/PlatformBootManagerLibVirt}/PlatformBm.h (100%)
rename OvmfPkg/PlatformPei/{ => Ia32_X64}/Platform.h (100%)
create mode 100644 OvmfPkg/PlatformPei/RiscV64/Platform.h
rename OvmfPkg/Sec/{ => Ia32_X64}/AmdSev.h (100%)
create mode 100644 OvmfPkg/Sec/RiscV64/SecMain.h
create mode 100644 OvmfPkg/Sec/SecMainCommon.h
copy UefiCpuPkg/CpuDxe/{ => Ia32_X64}/CpuDxe.h (100%)
rename UefiCpuPkg/CpuDxe/{ => Ia32_X64}/CpuGdt.h (100%)
rename UefiCpuPkg/CpuDxe/{ => Ia32_X64}/CpuMp.h (100%)
rename UefiCpuPkg/CpuDxe/{ => Ia32_X64}/CpuPageTable.h (100%)
rename UefiCpuPkg/CpuDxe/{ => RiscV64}/CpuDxe.h (69%)
create mode 100644 UefiCpuPkg/CpuTimerDxe/RiscV64/Timer.h
rename UefiCpuPkg/Library/CpuExceptionHandlerLib/{ => Ia32_X64}/CpuExceptionCommon.h (100%)
create mode 100644 UefiCpuPkg/Library/CpuExceptionHandlerLib/RiscV64/CpuExceptionHandlerLib.h
create mode 100644 MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.c
create mode 100644 OvmfPkg/Drivers/NorFlashDxe/NorFlash.c
create mode 100644 OvmfPkg/Drivers/NorFlashDxe/NorFlashBlockIoDxe.c
create mode 100644 OvmfPkg/Drivers/NorFlashDxe/NorFlashDxe.c
create mode 100644 OvmfPkg/Drivers/NorFlashDxe/NorFlashFvb.c
create mode 100644 OvmfPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c
create mode 100644 OvmfPkg/Library/NorFlashQemuLib/NorFlashQemuUnifiedLib.c
rename {ArmVirtPkg/Library/PlatformBootManagerLib => OvmfPkg/Library/PlatformBootManagerLibVirt}/PlatformBm.c (100%)
rename {ArmVirtPkg/Library/PlatformBootManagerLib => OvmfPkg/Library/PlatformBootManagerLibVirt}/QemuKernel.c (100%)
rename OvmfPkg/Library/PlatformInitLib/{ => Ia32_X64}/Cmos.c (100%)
rename OvmfPkg/Library/PlatformInitLib/{ => Ia32_X64}/IntelTdx.c (100%)
rename OvmfPkg/Library/PlatformInitLib/{ => Ia32_X64}/IntelTdxNull.c (100%)
rename OvmfPkg/Library/PlatformInitLib/{ => Ia32_X64}/MemDetect.c (100%)
rename OvmfPkg/Library/PlatformInitLib/{ => Ia32_X64}/Platform.c (100%)
create mode 100644 OvmfPkg/Library/PlatformInitLib/RiscV64/PlatformPeiLib.c
rename OvmfPkg/Library/ResetSystemLib/{ => Ia32_X64}/BaseResetShutdown.c (100%)
rename OvmfPkg/Library/ResetSystemLib/{ => Ia32_X64}/BaseResetShutdownBhyve.c (100%)
rename OvmfPkg/Library/ResetSystemLib/{ => Ia32_X64}/DxeResetShutdown.c (100%)
rename OvmfPkg/Library/ResetSystemLib/{ => Ia32_X64}/DxeResetSystemLibMicrovm.c (100%)
rename OvmfPkg/Library/ResetSystemLib/{ => Ia32_X64}/ResetSystemLib.c (100%)
rename OvmfPkg/Library/ResetSystemLib/{ => Ia32_X64}/ResetSystemLibMicrovm.c (100%)
create mode 100644 OvmfPkg/Library/ResetSystemLib/RiscV64/DxeResetShutdown.c
create mode 100644 OvmfPkg/Library/ResetSystemLib/RiscV64/ResetSystemLib.c
rename {ArmVirtPkg => OvmfPkg}/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c (100%)
rename OvmfPkg/PlatformPei/{ => Ia32_X64}/AmdSev.c (100%)
rename OvmfPkg/PlatformPei/{ => Ia32_X64}/ClearCache.c (100%)
rename OvmfPkg/PlatformPei/{ => Ia32_X64}/FeatureControl.c (100%)
copy OvmfPkg/PlatformPei/{ => Ia32_X64}/Fv.c (100%)
rename OvmfPkg/PlatformPei/{ => Ia32_X64}/IntelTdx.c (100%)
rename OvmfPkg/PlatformPei/{ => Ia32_X64}/MemDetect.c (100%)
rename OvmfPkg/PlatformPei/{ => Ia32_X64}/MemTypeInfo.c (100%)
rename OvmfPkg/PlatformPei/{ => Ia32_X64}/Platform.c (100%)
rename OvmfPkg/PlatformPei/{ => RiscV64}/Fv.c (63%)
create mode 100644 OvmfPkg/PlatformPei/RiscV64/MemDetect.c
create mode 100644 OvmfPkg/PlatformPei/RiscV64/Platform.c
rename OvmfPkg/Sec/{ => Ia32_X64}/AmdSev.c (100%)
rename OvmfPkg/Sec/{ => Ia32_X64}/SecMain.c (75%)
create mode 100644 OvmfPkg/Sec/RiscV64/SecMain.c
create mode 100644 OvmfPkg/Sec/SecMainCommon.c
rename UefiCpuPkg/CpuDxe/{ => Ia32_X64}/CpuDxe.c (100%)
rename UefiCpuPkg/CpuDxe/{ => Ia32_X64}/CpuGdt.c (100%)
rename UefiCpuPkg/CpuDxe/{ => Ia32_X64}/CpuMp.c (100%)
rename UefiCpuPkg/CpuDxe/{ => Ia32_X64}/CpuPageTable.c (100%)
create mode 100644 UefiCpuPkg/CpuDxe/RiscV64/CpuDxe.c
create mode 100644 UefiCpuPkg/CpuTimerDxe/RiscV64/Timer.c
rename UefiCpuPkg/Library/CpuExceptionHandlerLib/{ => Ia32_X64}/CpuExceptionCommon.c (100%)
rename UefiCpuPkg/Library/CpuExceptionHandlerLib/{ => Ia32_X64}/DxeException.c (100%)
rename UefiCpuPkg/Library/CpuExceptionHandlerLib/{ => Ia32_X64}/PeiCpuException.c (100%)
rename UefiCpuPkg/Library/CpuExceptionHandlerLib/{ => Ia32_X64}/PeiDxeSmmCpuException.c (100%)
rename UefiCpuPkg/Library/CpuExceptionHandlerLib/{ => Ia32_X64}/SecPeiCpuException.c (100%)
copy UefiCpuPkg/Library/CpuExceptionHandlerLib/{ => Ia32_X64}/SmmException.c (100%)
rename UefiCpuPkg/Library/CpuExceptionHandlerLib/{SmmException.c => RiscV64/CpuExceptionHandlerLib.c} (67%)
rename UefiCpuPkg/Library/CpuTimerLib/{ => Ia32_X64}/BaseCpuTimerLib.c (100%)
rename UefiCpuPkg/Library/CpuTimerLib/{ => Ia32_X64}/CpuTimerLib.c (100%)
create mode 100644 UefiCpuPkg/Library/CpuTimerLib/RiscV64/CpuTimerLib.c
create mode 100644 MdePkg/Library/BaseLib/RiscV64/CpuScratch.S
create mode 100644 MdePkg/Library/BaseLib/RiscV64/ReadTimer.S
create mode 100644 OvmfPkg/Platforms/RiscVVirt/RiscVVirt.fdf.inc
create mode 100644 OvmfPkg/Platforms/RiscVVirt/VarStore.fdf.inc
create mode 100644 OvmfPkg/Sec/RiscV64/SecEntry.S
create mode 100644 UefiCpuPkg/CpuTimerDxe/CpuTimer.uni
create mode 100644 UefiCpuPkg/CpuTimerDxe/CpuTimerExtra.uni
create mode 100644 UefiCpuPkg/Library/CpuExceptionHandlerLib/RiscV64/SupervisorTrapHandler.S

--
2.25.1


Re: [PATCH 14/14] ShellPkg/AcpiView: Update PCCT fields for ACPI 6.5

PierreGondois
 

+ Ray Ni
+ Zhichao Gao

as the patch wasn't sent to them.

On 10/10/22 11:20, PierreGondois via groups.io wrote:
From: Pierre Gondois <pierre.gondois@...>
The ACPI specification updated some terms in accordance with:
s1.1.1 Principle of Inclusive Terminology
Update the PCCT parser accordincly with these new terms.
Cc: Ray Ni <ray.ni@...>
Cc: Zhichao Gao <zhichao.gao@...>
Signed-off-by: Pierre Gondois <Pierre.Gondois@...>
---
.../UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c
index 8cffdaaf0716..8ad39090afe3 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c
@@ -146,7 +146,7 @@ ValidatePccDoorbellGas (
IN VOID *Context
)
{
- // For slave subspaces this field is optional, if not present the field
+ // For responder subspaces this field is optional, if not present the field
// should just contain zeros.
if (*PccSubspaceType == EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) {
if (IsZeroBuffer (
@@ -214,7 +214,7 @@ ValidatePccErrStatusGas (
IN VOID *Context
)
{
- // This field is ignored by the OSPM on slave channels.
+ // This field is ignored by the OSPM on responder channels.
if (*PccSubspaceType == EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) {
return;
}
@@ -237,7 +237,7 @@ ValidatePlatInterrupt (
IN VOID *Context
)
{
- // If a slave subspace is present in the PCCT, then the global Platform
+ // If a responder subspace is present in the PCCT, then the global Platform
// Interrupt flag must be set to 1.
if ((*PccSubspaceType == EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) &&
((*PccGlobalFlags & EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) !=


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

Sean Rhodes
 

+ Matt

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


On Mon, 10 Oct 2022 at 10:25, Ni, Ray <ray.ni@...> wrote:

The logic I shared below is from the LogoDxe driver which produces EDKII_PLATFORM_LOGO_PROTOCOL.

This driver should know the image size and it can account for the image size.

 

Thanks,

Ray

 

From: Sean Rhodes <sean@...>
Sent: Monday, October 10, 2022 4:51 PM
To: Ni, Ray <ray.ni@...>
Cc: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@...>; Wang, Jian J <jian.j.wang@...>; Gao, Liming <gaoliming@...>
Subject: Re: [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the position of the Logo

 

Hi Ray

 

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

 

Thanks

 

Sean

 

On Sat, 8 Oct 2022 at 03:02, Ni, Ray <ray.ni@...> wrote:

Sean,
I remember that I evaluated the BGRT requirement when designing the PlatformLogo protocol.

So, I went back to got the code I wrote long time ago as below.
I didn't try to understand them now. Does it make sense to you?

    Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID **) &GraphicsOutput);
    if (!EFI_ERROR (Status)) {
      //
      // Center of LOGO is in the vertical position 38.2% when PcdBootLogoOnlyEnable is TRUE
      // Y = (VerticalResolution - LogoHeight) / 2
      // Y' = VerticalResolution * 0.382 - LogoHeight * 0.5
      // OffsetY + Y = Y'
      // OffsetY = Y' - Y = -0.118 * VerticalResolution
      //
      *Attribute = EdkiiPlatformLogoDisplayAttributeCenter;
      *OffsetX   = 0;
      *OffsetY   = -118 * (INTN) GraphicsOutput->Mode->Info->VerticalResolution / 1000;
    }

Thanks,
Ray

> -----Original Message-----
> From: Sean Rhodes <sean@...>
> Sent: Monday, September 26, 2022 4:10 PM
> To: devel@edk2.groups.io
> Cc: Rhodes, Sean <sean@...>; Gao, Zhichao
> <zhichao.gao@...>; Ni, Ray <ray.ni@...>; Wang, Jian J
> <jian.j.wang@...>; Gao, Liming <gaoliming@...>
> Subject: [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the
> position of the Logo
>
> When set to true, the Logo is positioned according to the BGRT
> specification, 38.2% from the top of the screen. When set to false,
> no behaviour is changed and the logo is positioned centrally.
>
> Cc: Zhichao Gao <zhichao.gao@...>
> Cc: Ray Ni <ray.ni@...>
> Cc: Jian J Wang <jian.j.wang@...>
> Cc: Liming Gao <gaoliming@...>
> Signed-off-by: Sean Rhodes <sean@...>
> ---
>  MdeModulePkg/Logo/Logo.c      | 5 +++++
>  MdeModulePkg/Logo/LogoDxe.inf | 4 ++++
>  MdeModulePkg/MdeModulePkg.dec | 6 ++++++
>  MdeModulePkg/MdeModulePkg.uni | 6 ++++++
>  4 files changed, 21 insertions(+)
>
> diff --git a/MdeModulePkg/Logo/Logo.c b/MdeModulePkg/Logo/Logo.c
> index 8ab874d2da..1638d0f984 100644
> --- a/MdeModulePkg/Logo/Logo.c
> +++ b/MdeModulePkg/Logo/Logo.c
> @@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #include <Protocol/HiiPackageList.h>
>
>  #include <Library/UefiBootServicesTableLib.h>
>
>  #include <Library/DebugLib.h>
>
> +#include <Library/PcdLib.h>
>
>
>
>  typedef struct {
>
>    EFI_IMAGE_ID                             ImageId;
>
> @@ -69,6 +70,10 @@ GetImage (
>      return EFI_NOT_FOUND;
>
>    }
>
>
>
> +  if (FixedPcdGetBool (PcdFollowMicrosoftRecommended)) {
>
> +    mLogos[Current].Attribute =
> EdkiiPlatformLogoDisplayAttributeMicrosoftRecommended;
>
> +  }
>
> +
>
>    (*Instance)++;
>
>    *Attribute = mLogos[Current].Attribute;
>
>    *OffsetX   = mLogos[Current].OffsetX;
>
> diff --git a/MdeModulePkg/Logo/LogoDxe.inf
> b/MdeModulePkg/Logo/LogoDxe.inf
> index 41215d25d8..ce29950089 100644
> --- a/MdeModulePkg/Logo/LogoDxe.inf
> +++ b/MdeModulePkg/Logo/LogoDxe.inf
> @@ -41,6 +41,7 @@
>    UefiBootServicesTableLib
>
>    UefiDriverEntryPoint
>
>    DebugLib
>
> +  PcdLib
>
>
>
>  [Protocols]
>
>    gEfiHiiDatabaseProtocolGuid        ## CONSUMES
>
> @@ -48,6 +49,9 @@
>    gEfiHiiPackageListProtocolGuid     ## PRODUCES CONSUMES
>
>    gEdkiiPlatformLogoProtocolGuid     ## PRODUCES
>
>
>
> +[Pcd]
>
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended
> ## CONSUMES
>
> +
>
>  [Depex]
>
>    gEfiHiiDatabaseProtocolGuid AND
>
>    gEfiHiiImageExProtocolGuid
>
> diff --git a/MdeModulePkg/MdeModulePkg.dec
> b/MdeModulePkg/MdeModulePkg.dec
> index 58e6ab0048..ac437990f1 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -2102,6 +2102,12 @@
>    # @Prompt The shared bit mask when Intel Tdx is enabled.
>
>
> gEfiMdeModulePkgTokenSpaceGuid.PcdTdxSharedBitMask|0x0|UINT64|0x
> 10000025
>
>
>
> +  ## This PCD sets the position of the Boot Logo.
>
> +  #   TRUE  - The Logo is positioned following the recommendations from
> Microsoft.
>
> +  #   FALSE - The logo is positioned in the center of the screen.
>
> +  # @ Prompt This position of the boot logo
>
> +
> gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended|FA
> LSE|BOOLEAN|0x10000026
>
> +
>
>  [PcdsPatchableInModule]
>
>    ## Specify memory size with page number for PEI code when
>
>    #  Loading Module at Fixed Address feature is enabled.
>
> diff --git a/MdeModulePkg/MdeModulePkg.uni
> b/MdeModulePkg/MdeModulePkg.uni
> index 33ce9f6198..09c1ac1cc1 100644
> --- a/MdeModulePkg/MdeModulePkg.uni
> +++ b/MdeModulePkg/MdeModulePkg.uni
> @@ -1338,3 +1338,9 @@
>  #string
> STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPcieResizableBarSupport_HEL
> P #language en-US "Indicates if the PCIe Resizable BAR Capability
> Supported.<BR><BR>\n"
>
>                                                                                              "TRUE  - PCIe Resizable BAR
> Capability is supported.<BR>\n"
>
>                                                                                              "FALSE - PCIe Resizable BAR
> Capability is not supported.<BR>"
>
> +
>
> +#string
> STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowMicrosoftRecommende
> d_PROMPT #language en-US "The position of the Boot Logo"
>
> +
>
> +#string
> STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowMicrosoftRecommend_
> HELP   #language en-US "Sets the position of the Logo. When set to true, the
> Logo is positioned following the recommendations"
>
> +                                                                                             " from Microsoft, 38.2% from
> the top of the screen."
>
> +
>
> --
> 2.34.1


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

Ni, Ray
 

The logic I shared below is from the LogoDxe driver which produces EDKII_PLATFORM_LOGO_PROTOCOL.

This driver should know the image size and it can account for the image size.

 

Thanks,

Ray

 

From: Sean Rhodes <sean@...>
Sent: Monday, October 10, 2022 4:51 PM
To: Ni, Ray <ray.ni@...>
Cc: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@...>; Wang, Jian J <jian.j.wang@...>; Gao, Liming <gaoliming@...>
Subject: Re: [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the position of the Logo

 

Hi Ray

 

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

 

Thanks

 

Sean

 

On Sat, 8 Oct 2022 at 03:02, Ni, Ray <ray.ni@...> wrote:

Sean,
I remember that I evaluated the BGRT requirement when designing the PlatformLogo protocol.

So, I went back to got the code I wrote long time ago as below.
I didn't try to understand them now. Does it make sense to you?

    Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID **) &GraphicsOutput);
    if (!EFI_ERROR (Status)) {
      //
      // Center of LOGO is in the vertical position 38.2% when PcdBootLogoOnlyEnable is TRUE
      // Y = (VerticalResolution - LogoHeight) / 2
      // Y' = VerticalResolution * 0.382 - LogoHeight * 0.5
      // OffsetY + Y = Y'
      // OffsetY = Y' - Y = -0.118 * VerticalResolution
      //
      *Attribute = EdkiiPlatformLogoDisplayAttributeCenter;
      *OffsetX   = 0;
      *OffsetY   = -118 * (INTN) GraphicsOutput->Mode->Info->VerticalResolution / 1000;
    }

Thanks,
Ray

> -----Original Message-----
> From: Sean Rhodes <sean@...>
> Sent: Monday, September 26, 2022 4:10 PM
> To: devel@edk2.groups.io
> Cc: Rhodes, Sean <sean@...>; Gao, Zhichao
> <zhichao.gao@...>; Ni, Ray <ray.ni@...>; Wang, Jian J
> <jian.j.wang@...>; Gao, Liming <gaoliming@...>
> Subject: [PATCH 2/3] MdeModulePkg/Logo: Add a PCD to control the
> position of the Logo
>
> When set to true, the Logo is positioned according to the BGRT
> specification, 38.2% from the top of the screen. When set to false,
> no behaviour is changed and the logo is positioned centrally.
>
> Cc: Zhichao Gao <zhichao.gao@...>
> Cc: Ray Ni <ray.ni@...>
> Cc: Jian J Wang <jian.j.wang@...>
> Cc: Liming Gao <gaoliming@...>
> Signed-off-by: Sean Rhodes <sean@...>
> ---
>  MdeModulePkg/Logo/Logo.c      | 5 +++++
>  MdeModulePkg/Logo/LogoDxe.inf | 4 ++++
>  MdeModulePkg/MdeModulePkg.dec | 6 ++++++
>  MdeModulePkg/MdeModulePkg.uni | 6 ++++++
>  4 files changed, 21 insertions(+)
>
> diff --git a/MdeModulePkg/Logo/Logo.c b/MdeModulePkg/Logo/Logo.c
> index 8ab874d2da..1638d0f984 100644
> --- a/MdeModulePkg/Logo/Logo.c
> +++ b/MdeModulePkg/Logo/Logo.c
> @@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #include <Protocol/HiiPackageList.h>
>
>  #include <Library/UefiBootServicesTableLib.h>
>
>  #include <Library/DebugLib.h>
>
> +#include <Library/PcdLib.h>
>
>
>
>  typedef struct {
>
>    EFI_IMAGE_ID                             ImageId;
>
> @@ -69,6 +70,10 @@ GetImage (
>      return EFI_NOT_FOUND;
>
>    }
>
>
>
> +  if (FixedPcdGetBool (PcdFollowMicrosoftRecommended)) {
>
> +    mLogos[Current].Attribute =
> EdkiiPlatformLogoDisplayAttributeMicrosoftRecommended;
>
> +  }
>
> +
>
>    (*Instance)++;
>
>    *Attribute = mLogos[Current].Attribute;
>
>    *OffsetX   = mLogos[Current].OffsetX;
>
> diff --git a/MdeModulePkg/Logo/LogoDxe.inf
> b/MdeModulePkg/Logo/LogoDxe.inf
> index 41215d25d8..ce29950089 100644
> --- a/MdeModulePkg/Logo/LogoDxe.inf
> +++ b/MdeModulePkg/Logo/LogoDxe.inf
> @@ -41,6 +41,7 @@
>    UefiBootServicesTableLib
>
>    UefiDriverEntryPoint
>
>    DebugLib
>
> +  PcdLib
>
>
>
>  [Protocols]
>
>    gEfiHiiDatabaseProtocolGuid        ## CONSUMES
>
> @@ -48,6 +49,9 @@
>    gEfiHiiPackageListProtocolGuid     ## PRODUCES CONSUMES
>
>    gEdkiiPlatformLogoProtocolGuid     ## PRODUCES
>
>
>
> +[Pcd]
>
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended
> ## CONSUMES
>
> +
>
>  [Depex]
>
>    gEfiHiiDatabaseProtocolGuid AND
>
>    gEfiHiiImageExProtocolGuid
>
> diff --git a/MdeModulePkg/MdeModulePkg.dec
> b/MdeModulePkg/MdeModulePkg.dec
> index 58e6ab0048..ac437990f1 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -2102,6 +2102,12 @@
>    # @Prompt The shared bit mask when Intel Tdx is enabled.
>
>
> gEfiMdeModulePkgTokenSpaceGuid.PcdTdxSharedBitMask|0x0|UINT64|0x
> 10000025
>
>
>
> +  ## This PCD sets the position of the Boot Logo.
>
> +  #   TRUE  - The Logo is positioned following the recommendations from
> Microsoft.
>
> +  #   FALSE - The logo is positioned in the center of the screen.
>
> +  # @ Prompt This position of the boot logo
>
> +
> gEfiMdeModulePkgTokenSpaceGuid.PcdFollowMicrosoftRecommended|FA
> LSE|BOOLEAN|0x10000026
>
> +
>
>  [PcdsPatchableInModule]
>
>    ## Specify memory size with page number for PEI code when
>
>    #  Loading Module at Fixed Address feature is enabled.
>
> diff --git a/MdeModulePkg/MdeModulePkg.uni
> b/MdeModulePkg/MdeModulePkg.uni
> index 33ce9f6198..09c1ac1cc1 100644
> --- a/MdeModulePkg/MdeModulePkg.uni
> +++ b/MdeModulePkg/MdeModulePkg.uni
> @@ -1338,3 +1338,9 @@
>  #string
> STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPcieResizableBarSupport_HEL
> P #language en-US "Indicates if the PCIe Resizable BAR Capability
> Supported.<BR><BR>\n"
>
>                                                                                              "TRUE  - PCIe Resizable BAR
> Capability is supported.<BR>\n"
>
>                                                                                              "FALSE - PCIe Resizable BAR
> Capability is not supported.<BR>"
>
> +
>
> +#string
> STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowMicrosoftRecommende
> d_PROMPT #language en-US "The position of the Boot Logo"
>
> +
>
> +#string
> STR_gEfiMdeModulePkgTokenSpaceGuid_PcdFollowMicrosoftRecommend_
> HELP   #language en-US "Sets the position of the Logo. When set to true, the
> Logo is positioned following the recommendations"
>
> +                                                                                             " from Microsoft, 38.2% from
> the top of the screen."
>
> +
>
> --
> 2.34.1


[PATCH 14/14] ShellPkg/AcpiView: Update PCCT fields for ACPI 6.5

PierreGondois
 

From: Pierre Gondois <pierre.gondois@...>

The ACPI specification updated some terms in accordance with:
s1.1.1 Principle of Inclusive Terminology

Update the PCCT parser accordincly with these new terms.

Cc: Ray Ni <ray.ni@...>
Cc: Zhichao Gao <zhichao.gao@...>
Signed-off-by: Pierre Gondois <Pierre.Gondois@...>
---
.../UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/Pc=
ctParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/Pc=
ctParser.c
index 8cffdaaf0716..8ad39090afe3 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParse=
r.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParse=
r.c
@@ -146,7 +146,7 @@ ValidatePccDoorbellGas (
IN VOID *Context
)
{
- // For slave subspaces this field is optional, if not present the fiel=
d
+ // For responder subspaces this field is optional, if not present the =
field
// should just contain zeros.
if (*PccSubspaceType =3D=3D EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED=
_PCC) {
if (IsZeroBuffer (
@@ -214,7 +214,7 @@ ValidatePccErrStatusGas (
IN VOID *Context
)
{
- // This field is ignored by the OSPM on slave channels.
+ // This field is ignored by the OSPM on responder channels.
if (*PccSubspaceType =3D=3D EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED=
_PCC) {
return;
}
@@ -237,7 +237,7 @@ ValidatePlatInterrupt (
IN VOID *Context
)
{
- // If a slave subspace is present in the PCCT, then the global Platfor=
m
+ // If a responder subspace is present in the PCCT, then the global Pla=
tform
// Interrupt flag must be set to 1.
if ((*PccSubspaceType =3D=3D EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDE=
D_PCC) &&
((*PccGlobalFlags & EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) !=3D
--=20
2.25.1


[PATCH 13/14] DynamicTablesPkg: Readme.md: Update available tables for generation

PierreGondois
 

From: Pierre Gondois <pierre.gondois@...>

The following tables can now be generated by the DynamicTablesPkg:
- PCCT
- PPTT
- SRAT

Update the documentation accordingly.

Signed-off-by: Pierre Gondois <Pierre.Gondois@...>
---
DynamicTablesPkg/Readme.md | 3 +++
1 file changed, 3 insertions(+)

diff --git a/DynamicTablesPkg/Readme.md b/DynamicTablesPkg/Readme.md
index 5f92d4c6cb2e..6b0a6c7a4001 100644
--- a/DynamicTablesPkg/Readme.md
+++ b/DynamicTablesPkg/Readme.md
@@ -53,7 +53,10 @@ The framework currently supports the following table g=
enerators for ARM:
* MADT - Multiple APIC Description Table
* MCFG - PCI Express memory mapped configuration space base address
Description Table
+* PCCT - Platform Communications Channel Table
+* PPTT - Processor Properties Topology Table
* SPCR - Serial Port Console Redirection Table
+* SRAT - System Resource Affinity Table
* SSDT - Secondary System Description Table. This is essentially
a RAW table generator.
=20
--=20
2.25.1


[PATCH 12/14] DynamicTablesPkg/AmlLib: Allow larger AccessSize for Pcc address space

PierreGondois
 

From: Pierre Gondois <pierre.gondois@...>

For Pcc address space, the AccessSize field of a Register is
used to delcare the Pcc Subspace Id. This Id can be up to 256.

Cf. ACPI 6.4, s14.7 Referencing the PCC address space

Signed-off-by: Pierre Gondois <Pierre.Gondois@...>
---
.../Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDa=
taCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceD=
ataCodeGen.c
index 332962bed441..3901b6e47333 100644
--- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeG=
en.c
+++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeG=
en.c
@@ -1257,7 +1257,12 @@ AmlCodeGenRdRegister (
AML_DATA_NODE *RdNode;
EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR RdRegister;
=20
- if ((AccessSize > EFI_ACPI_6_4_QWORD) ||
+ // Cf Cf. ACPI 6.4, s14.7 Referencing the PCC address space
+ // The AccessSize represents the Subspace Id for the PCC address space=
.
+ if (((AddressSpace =3D=3D EFI_ACPI_6_3_PLATFORM_COMMUNICATION_CHANNEL)=
&&
+ (AccessSize > 256)) ||
+ ((AddressSpace !=3D EFI_ACPI_6_3_PLATFORM_COMMUNICATION_CHANNEL) &=
&
+ (AccessSize > EFI_ACPI_6_4_QWORD)) ||
((NameOpNode =3D=3D NULL) && (NewRdNode =3D=3D NULL)))
{
ASSERT (0);
--=20
2.25.1


[PATCH 11/14] DynamicTablesPkg: Add PCCT Generator

PierreGondois
 

From: Pierre Gondois <pierre.gondois@...>

The Platform Communication Channel Table (PCCT) generator collates
the relevant information required for generating a PCCT table from
configuration manager using the configuration manager protocol.
The DynamicTablesManager then install the PCCT table.

From ACPI 6.4, s14 PLATFORM COMMUNICATIONS CHANNEL (PCC):
The platform communication channel (PCC) is a generic mechanism
for OSPM to communicate with an entity in the platform.

Signed-off-by: Pierre Gondois <pierre.gondois@...>
---
DynamicTablesPkg/DynamicTables.dsc.inc | 4 +-
DynamicTablesPkg/Include/AcpiTableGenerator.h | 3 +-
.../Arm/AcpiPcctLibArm/AcpiPcctLibArm.inf | 30 +
.../Acpi/Arm/AcpiPcctLibArm/PcctGenerator.c | 1186 +++++++++++++++++
.../Acpi/Arm/AcpiPcctLibArm/PcctGenerator.h | 43 +
.../ConfigurationManagerObjectParser.c | 46 +-
6 files changed, 1287 insertions(+), 25 deletions(-)
create mode 100644 DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/Acpi=
PcctLibArm.inf
create mode 100644 DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/Pcct=
Generator.c
create mode 100644 DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/Pcct=
Generator.h

diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc b/DynamicTablesPkg/Dy=
namicTables.dsc.inc
index 3d4fa0c4c4b6..3e38fa0d0d99 100644
--- a/DynamicTablesPkg/DynamicTables.dsc.inc
+++ b/DynamicTablesPkg/DynamicTables.dsc.inc
@@ -1,7 +1,7 @@
## @file
# Dsc include file for Dynamic Tables Framework.
#
-# Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
+# Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -33,6 +33,7 @@ [Components.common]
DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/AcpiRawLibArm.inf
DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/AcpiSpcrLibArm.inf
DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/AcpiSratLibArm.inf
+ DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/AcpiPcctLibArm.inf
=20
# AML Fixup
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/SsdtSerialP=
ortLibArm.inf
@@ -57,6 +58,7 @@ [Components.common]
NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiRawLibArm/AcpiRawLibArm=
.inf
NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/AcpiSpcrLibA=
rm.inf
NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/AcpiSratLibA=
rm.inf
+ NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/AcpiPcctLibA=
rm.inf
=20
# AML Fixup
NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/Ss=
dtSerialPortLibArm.inf
diff --git a/DynamicTablesPkg/Include/AcpiTableGenerator.h b/DynamicTable=
sPkg/Include/AcpiTableGenerator.h
index f962dbff57df..d0eda011c301 100644
--- a/DynamicTablesPkg/Include/AcpiTableGenerator.h
+++ b/DynamicTablesPkg/Include/AcpiTableGenerator.h
@@ -1,6 +1,6 @@
/** @file
=20
- Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
+ Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.<BR>
=20
SPDX-License-Identifier: BSD-2-Clause-Patent
=20
@@ -98,6 +98,7 @@ typedef enum StdAcpiTableId {
EStdAcpiTableIdSsdtCmn600, ///< SSDT Cmn-600 Genera=
tor
EStdAcpiTableIdSsdtCpuTopology, ///< SSDT Cpu Topology
EStdAcpiTableIdSsdtPciExpress, ///< SSDT Pci Express Ge=
nerator
+ EStdAcpiTableIdPcct, ///< PCCT Generator
EStdAcpiTableIdMax
} ESTD_ACPI_TABLE_ID;
=20
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/AcpiPcctLib=
Arm.inf b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/AcpiPcctLibArm=
.inf
new file mode 100644
index 000000000000..da54585c2dd9
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/AcpiPcctLibArm.inf
@@ -0,0 +1,30 @@
+## @file
+# Pcct Table Generator
+#
+# Copyright (c) 2022, Arm Limited. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+ INF_VERSION =3D 0x0001001B
+ BASE_NAME =3D AcpiPcctLibArm
+ FILE_GUID =3D 38FE945C-D6ED-4CD6-8D20-FCEF3260D15A
+ VERSION_STRING =3D 1.0
+ MODULE_TYPE =3D DXE_DRIVER
+ LIBRARY_CLASS =3D NULL|DXE_DRIVER
+ CONSTRUCTOR =3D AcpiPcctLibConstructor
+ DESTRUCTOR =3D AcpiPcctLibDestructor
+
+[Sources]
+ PcctGenerator.c
+ PcctGenerator.h
+
+[Packages]
+ DynamicTablesPkg/DynamicTablesPkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+ BaseLib
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/PcctGenerat=
or.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/PcctGenerator.c
new file mode 100644
index 000000000000..36caf4aaeab7
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/PcctGenerator.c
@@ -0,0 +1,1186 @@
+/** @file
+ PCCT Table Generator
+
+ Copyright (c) 2022, Arm Limited. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Reference(s):
+ - ACPI 6.4 Specification - January 2021
+ s14 PLATFORM COMMUNICATIONS CHANNEL (PCC)
+
+**/
+
+#include <Library/AcpiLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Protocol/AcpiTable.h>
+
+// Module specific include files.
+#include <AcpiTableGenerator.h>
+#include <ConfigurationManagerObject.h>
+#include <ConfigurationManagerHelper.h>
+#include <Library/TableHelperLib.h>
+#include <Protocol/ConfigurationManagerProtocol.h>
+#include "PcctGenerator.h"
+
+/** ARM standard PCCT Generator
+
+Requirements:
+ The following Configuration Manager Object(s) are required by
+ this Generator:
+ - EArmObjPccSubspaceType0Info
+ - EArmObjPccSubspaceType1Info
+ - EArmObjPccSubspaceType2Info
+ - EArmObjPccSubspaceType3Info
+ - EArmObjPccSubspaceType4Info
+ - EArmObjPccSubspaceType5Info
+*/
+
+/** This macro expands to a function that retrieves the PCC
+ Subspace of Type 0 Information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArm,
+ EArmObjPccSubspaceType0Info,
+ CM_ARM_PCC_SUBSPACE_TYPE0_INFO
+ );
+
+/** This macro expands to a function that retrieves the PCC
+ Subspace of Type 1 Information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArm,
+ EArmObjPccSubspaceType1Info,
+ CM_ARM_PCC_SUBSPACE_TYPE1_INFO
+ );
+
+/** This macro expands to a function that retrieves the PCC
+ Subspace of Type 2 Information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArm,
+ EArmObjPccSubspaceType2Info,
+ CM_ARM_PCC_SUBSPACE_TYPE2_INFO
+ );
+
+/** This macro expands to a function that retrieves the PCC
+ Subspace of Type 3 Information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArm,
+ EArmObjPccSubspaceType3Info,
+ CM_ARM_PCC_SUBSPACE_TYPE3_INFO
+ );
+
+/** This macro expands to a function that retrieves the PCC
+ Subspace of Type 4 Information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArm,
+ EArmObjPccSubspaceType4Info,
+ CM_ARM_PCC_SUBSPACE_TYPE4_INFO
+ );
+
+/** This macro expands to a function that retrieves the PCC
+ Subspace of Type 5 Information from the Configuration Manager.
+*/
+GET_OBJECT_LIST (
+ EObjNameSpaceArm,
+ EArmObjPccSubspaceType5Info,
+ CM_ARM_PCC_SUBSPACE_TYPE5_INFO
+ );
+
+/** The Platform is capable of generating an interrupt
+ to indicate completion of a command.
+
+ Cf: s14.1.1 Platform Communications Channel Global Flags
+ Platform Interrupt flag
+ and s14.1.6 Extended PCC subspaces (types 3 and 4)
+ If a responder subspace is included in the PCCT,
+ then the global Platform Interrupt flag must be set to 1
+
+ Set this variable and populate the PCCT flag accordingly if either:
+ - One of the PCCT Subspace uses interrupts.
+ - A PCC Subspace of type 4 is used.
+*/
+STATIC BOOLEAN mHasPlatformInterrupt;
+
+/** Initialize the MappingTable.
+
+ @param [in] MappingTable The mapping table structure.
+ @param [in] Count Number of entries to allocate in the
+ MappingTable.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+MappingTableInitialize (
+ IN MAPPING_TABLE *MappingTable,
+ IN UINT32 Count
+ )
+{
+ VOID **Table;
+
+ if ((MappingTable =3D=3D NULL) ||
+ (Count =3D=3D 0))
+ {
+ ASSERT (0);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Table =3D AllocateZeroPool (sizeof (*Table) * Count);
+ if (Table =3D=3D NULL) {
+ ASSERT (0);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ MappingTable->Table =3D Table;
+ MappingTable->MaxIndex =3D Count;
+
+ return EFI_SUCCESS;
+}
+
+/** Free the MappingTable.
+
+ @param [in, out] MappingTable The mapping table structure.
+**/
+STATIC
+VOID
+EFIAPI
+MappingTableFree (
+ IN OUT MAPPING_TABLE *MappingTable
+ )
+{
+ ASSERT (MappingTable !=3D NULL);
+ ASSERT (MappingTable->Table !=3D NULL);
+
+ if (MappingTable->Table !=3D NULL) {
+ FreePool (MappingTable->Table);
+ }
+}
+
+/** Add a new entry for CmArmPccSubspace at Index.
+
+ @param [in] MappingTable The mapping table structure.
+ @param [in] CmArmPccSubspace Pointer to a CM_ARM_PCC_SUBSPACE_TYPE[X]=
_INFO.
+ @param [in] Index Index at which CmArmPccSubspace must be =
added.
+ This is the Subspace Id.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_BUFFER_TOO_SMALL Buffer too small.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+MappingTableAdd (
+ IN MAPPING_TABLE *MappingTable,
+ IN VOID *CmArmPccSubspace,
+ IN UINT32 Index
+ )
+{
+ if ((MappingTable =3D=3D NULL) ||
+ (MappingTable->Table =3D=3D NULL) ||
+ (CmArmPccSubspace =3D=3D NULL))
+ {
+ ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if ((Index >=3D MappingTable->MaxIndex) ||
+ (MappingTable->Table[Index] !=3D 0))
+ {
+ ASSERT_EFI_ERROR (EFI_BUFFER_TOO_SMALL);
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+ // Just map the Pcc Subspace in the Table.
+ MappingTable->Table[Index] =3D CmArmPccSubspace;
+ return EFI_SUCCESS;
+}
+
+/** Parse the CmPccArray objects and add them to the MappingTable.
+
+ @param [in] MappingTable The mapping table structure.
+ @param [in] CmPccArray Pointer to an array of CM_ARM_PCC_SUBSPAC=
E_TYPE[X]_INFO.
+ @param [in] CmPccCount Count of objects in CmPccArray.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_BUFFER_TOO_SMALL Buffer too small.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+MapPccSubspaceId (
+ IN MAPPING_TABLE *MappingTable,
+ IN VOID *CmPccArray,
+ IN UINT32 CmPccCount
+ )
+{
+ EFI_STATUS Status;
+ UINT8 *PccBuffer;
+ UINT32 Index;
+ UINT32 CmObjSize;
+ PCC_SUBSPACE_GENERIC_INFO *GenericPcc;
+
+ if (CmPccCount =3D=3D 0) {
+ return EFI_SUCCESS;
+ }
+
+ if ((CmPccArray =3D=3D NULL) || (MappingTable =3D=3D NULL)) {
+ ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ GenericPcc =3D (PCC_SUBSPACE_GENERIC_INFO *)CmPccArray;
+
+ switch (GenericPcc->Type) {
+ case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_GENERIC:
+ CmObjSize =3D sizeof (CM_ARM_PCC_SUBSPACE_TYPE0_INFO);
+ break;
+
+ case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_1_HW_REDUCED_COMMUNICATIONS:
+ CmObjSize =3D sizeof (CM_ARM_PCC_SUBSPACE_TYPE1_INFO);
+ break;
+
+ case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_2_HW_REDUCED_COMMUNICATIONS:
+ CmObjSize =3D sizeof (CM_ARM_PCC_SUBSPACE_TYPE2_INFO);
+ break;
+
+ case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_3_EXTENDED_PCC:
+ CmObjSize =3D sizeof (CM_ARM_PCC_SUBSPACE_TYPE3_INFO);
+ break;
+
+ case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC:
+ CmObjSize =3D sizeof (CM_ARM_PCC_SUBSPACE_TYPE4_INFO);
+ break;
+
+ case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_5_HW_REGISTERS_COMMUNICATIONS:
+ CmObjSize =3D sizeof (CM_ARM_PCC_SUBSPACE_TYPE5_INFO);
+ break;
+
+ default:
+ ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ PccBuffer =3D (UINT8 *)CmPccArray;
+
+ // Map the Pcc channel to their Subspace Id.
+ for (Index =3D 0; Index < CmPccCount; Index++) {
+ GenericPcc =3D (PCC_SUBSPACE_GENERIC_INFO *)PccBuffer;
+
+ Status =3D MappingTableAdd (
+ MappingTable,
+ PccBuffer,
+ GenericPcc->SubspaceId
+ );
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+ }
+
+ PccBuffer +=3D CmObjSize;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/** Add one PCCT Subspace structure of Type 0 (Generic).
+
+ @param [in] PccCmObj Pointer to a CmObj PCCT Subspace info structur=
e.
+ @param [in] PccAcpi Pointer to the ACPI PCCT Subspace structure to=
populate.
+
+ @retval EFI_SUCCESS Table generated successfully.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+AddSubspaceStructType0 (
+ IN CM_ARM_PCC_SUBSPACE_TYPE0_INFO *PccCmObj,
+ IN EFI_ACPI_6_4_PCCT_SUBSPACE_GENERIC *PccAcpi
+ )
+{
+ PCC_MAILBOX_REGISTER_INFO *Doorbell;
+ PCC_SUBSPACE_CHANNEL_TIMING_INFO *ChannelTiming;
+
+ if ((PccCmObj =3D=3D NULL) ||
+ (PccCmObj->Type !=3D EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_GENERIC) ||
+ (PccAcpi =3D=3D NULL))
+ {
+ ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Doorbell =3D &PccCmObj->DoorbellReg;
+ ChannelTiming =3D &PccCmObj->ChannelTiming;
+
+ PccAcpi->Type =3D PccCmObj->Type;
+ PccAcpi->Length =3D sizeof (EFI_ACPI_6_4_PCCT_SUBSPAC=
E_GENERIC);
+ *(UINT32 *)&PccAcpi->Reserved[0] =3D EFI_ACPI_RESERVED_DWORD;
+ *(UINT16 *)&PccAcpi->Reserved[4] =3D EFI_ACPI_RESERVED_WORD;
+ PccAcpi->BaseAddress =3D PccCmObj->BaseAddress;
+ PccAcpi->AddressLength =3D PccCmObj->AddressLength;
+
+ CopyMem (
+ &PccAcpi->DoorbellRegister,
+ &Doorbell->Register,
+ sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
+ );
+ PccAcpi->DoorbellPreserve =3D Doorbell->PreserveMask;
+ PccAcpi->DoorbellWrite =3D Doorbell->WriteMask;
+
+ PccAcpi->NominalLatency =3D ChannelTiming->NominalLatenc=
y;
+ PccAcpi->MaximumPeriodicAccessRate =3D ChannelTiming->MaxPeriodicAc=
cessRate;
+ PccAcpi->MinimumRequestTurnaroundTime =3D ChannelTiming->MinRequestTur=
naroundTime;
+
+ return EFI_SUCCESS;
+}
+
+/** Add one PCCT subspace structure of Type 1 (HW-Reduced).
+
+ @param [in] PccCmObj Pointer to a CmObj PCCT Subspace info structur=
e.
+ @param [in] PccAcpi Pointer to the ACPI PCCT Subspace structure to=
populate.
+
+ @retval EFI_SUCCESS Table generated successfully.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+AddSubspaceStructType1 (
+ IN CM_ARM_PCC_SUBSPACE_TYPE1_INFO *PccCmObj,
+ IN EFI_ACPI_6_4_PCCT_SUBSPACE_1_HW_REDUCED_COMMUNICATIONS *PccAcpi
+ )
+{
+ CM_ARM_PCC_SUBSPACE_TYPE0_INFO *GenericPccCmObj;
+ PCC_MAILBOX_REGISTER_INFO *Doorbell;
+ PCC_SUBSPACE_CHANNEL_TIMING_INFO *ChannelTiming;
+
+ GenericPccCmObj =3D (CM_ARM_PCC_SUBSPACE_TYPE0_INFO *)PccCmObj;
+
+ if ((PccCmObj =3D=3D NULL) ||
+ (GenericPccCmObj->Type !=3D EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_1_HW_R=
EDUCED_COMMUNICATIONS) ||
+ (PccAcpi =3D=3D NULL))
+ {
+ ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Doorbell =3D &GenericPccCmObj->DoorbellReg;
+ ChannelTiming =3D &GenericPccCmObj->ChannelTiming;
+
+ PccAcpi->Type =3D GenericPccCmObj->Type;
+ PccAcpi->Length =3D sizeof (EFI_ACPI_6_4_PCCT_SUBSPACE=
_1_HW_REDUCED_COMMUNICATIONS);
+ PccAcpi->PlatformInterrupt =3D PccCmObj->PlatIrq.Interrupt;
+ PccAcpi->PlatformInterruptFlags =3D PccCmObj->PlatIrq.Flags;
+ PccAcpi->Reserved =3D EFI_ACPI_RESERVED_BYTE;
+ PccAcpi->BaseAddress =3D GenericPccCmObj->BaseAddress;
+ PccAcpi->AddressLength =3D GenericPccCmObj->AddressLength;
+
+ CopyMem (
+ &PccAcpi->DoorbellRegister,
+ &Doorbell->Register,
+ sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
+ );
+ PccAcpi->DoorbellPreserve =3D Doorbell->PreserveMask;
+ PccAcpi->DoorbellWrite =3D Doorbell->WriteMask;
+
+ PccAcpi->NominalLatency =3D ChannelTiming->NominalLatenc=
y;
+ PccAcpi->MaximumPeriodicAccessRate =3D ChannelTiming->MaxPeriodicAc=
cessRate;
+ PccAcpi->MinimumRequestTurnaroundTime =3D ChannelTiming->MinRequestTur=
naroundTime;
+
+ if ((PccCmObj->PlatIrq.Interrupt !=3D 0)) {
+ mHasPlatformInterrupt =3D TRUE;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/** Add one PCCT subspace structure of Type 2 (HW-Reduced).
+
+ @param [in] PccCmObj Pointer to a CmObj PCCT Subspace info structur=
e.
+ @param [in] PccAcpi Pointer to the ACPI PCCT Subspace structure to=
populate.
+
+ @retval EFI_SUCCESS Table generated successfully.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+AddSubspaceStructType2 (
+ IN CM_ARM_PCC_SUBSPACE_TYPE2_INFO *PccCmObj,
+ IN EFI_ACPI_6_4_PCCT_SUBSPACE_2_HW_REDUCED_COMMUNICATIONS *PccAcpi
+ )
+{
+ CM_ARM_PCC_SUBSPACE_TYPE0_INFO *GenericPccCmObj;
+ PCC_MAILBOX_REGISTER_INFO *Doorbell;
+ PCC_MAILBOX_REGISTER_INFO *PlatIrqAck;
+ PCC_SUBSPACE_CHANNEL_TIMING_INFO *ChannelTiming;
+
+ GenericPccCmObj =3D (CM_ARM_PCC_SUBSPACE_TYPE0_INFO *)PccCmObj;
+
+ if ((PccCmObj =3D=3D NULL) ||
+ (GenericPccCmObj->Type !=3D EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_2_HW_R=
EDUCED_COMMUNICATIONS) ||
+ (PccAcpi =3D=3D NULL))
+ {
+ ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Doorbell =3D &GenericPccCmObj->DoorbellReg;
+ PlatIrqAck =3D &PccCmObj->PlatIrqAckReg;
+ ChannelTiming =3D &GenericPccCmObj->ChannelTiming;
+
+ PccAcpi->Type =3D GenericPccCmObj->Type;
+ PccAcpi->Length =3D sizeof (EFI_ACPI_6_4_PCCT_SUBSPACE=
_2_HW_REDUCED_COMMUNICATIONS);
+ PccAcpi->PlatformInterrupt =3D PccCmObj->PlatIrq.Interrupt;
+ PccAcpi->PlatformInterruptFlags =3D PccCmObj->PlatIrq.Flags;
+ PccAcpi->BaseAddress =3D GenericPccCmObj->BaseAddress;
+ PccAcpi->Reserved =3D EFI_ACPI_RESERVED_BYTE;
+ PccAcpi->BaseAddress =3D GenericPccCmObj->BaseAddress;
+ PccAcpi->AddressLength =3D GenericPccCmObj->AddressLength;
+
+ CopyMem (
+ &PccAcpi->DoorbellRegister,
+ &Doorbell->Register,
+ sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
+ );
+ PccAcpi->DoorbellPreserve =3D Doorbell->PreserveMask;
+ PccAcpi->DoorbellWrite =3D Doorbell->WriteMask;
+
+ PccAcpi->NominalLatency =3D ChannelTiming->NominalLatenc=
y;
+ PccAcpi->MaximumPeriodicAccessRate =3D ChannelTiming->MaxPeriodicAc=
cessRate;
+ PccAcpi->MinimumRequestTurnaroundTime =3D ChannelTiming->MinRequestTur=
naroundTime;
+
+ CopyMem (
+ &PccAcpi->PlatformInterruptAckRegister,
+ &PlatIrqAck->Register,
+ sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
+ );
+ PccAcpi->PlatformInterruptAckPreserve =3D PlatIrqAck->PreserveMask;
+ PccAcpi->PlatformInterruptAckWrite =3D PlatIrqAck->WriteMask;
+
+ if ((PccCmObj->PlatIrq.Interrupt !=3D 0)) {
+ mHasPlatformInterrupt =3D TRUE;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/** Add one PCCT subspace structure of Type 3 or 4 (Extended).
+
+ @param [in] PccCmObj Pointer to a CmObj PCCT Subspace info structur=
e.
+ @param [in] PccAcpi Pointer to the ACPI PCCT Subspace structure to=
populate.
+
+ @retval EFI_SUCCESS Table generated successfully.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+AddSubspaceStructType34 (
+ IN CM_ARM_PCC_SUBSPACE_TYPE3_INFO *PccCmObj,
+ IN EFI_ACPI_6_4_PCCT_SUBSPACE_3_EXTENDED_PCC *PccAcpi
+ )
+{
+ CM_ARM_PCC_SUBSPACE_TYPE0_INFO *GenericPccCmObj;
+ PCC_MAILBOX_REGISTER_INFO *Doorbell;
+ PCC_MAILBOX_REGISTER_INFO *PlatIrqAck;
+ PCC_MAILBOX_REGISTER_INFO *CmdCompleteCheck;
+ PCC_MAILBOX_REGISTER_INFO *CmdCompleteUpdate;
+ PCC_MAILBOX_REGISTER_INFO *ErrorStatus;
+ PCC_SUBSPACE_CHANNEL_TIMING_INFO *ChannelTiming;
+
+ GenericPccCmObj =3D (CM_ARM_PCC_SUBSPACE_TYPE0_INFO *)PccCmObj;
+
+ if ((PccCmObj =3D=3D NULL) ||
+ ((GenericPccCmObj->Type !=3D EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_3_EXT=
ENDED_PCC) &&
+ (GenericPccCmObj->Type !=3D EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXT=
ENDED_PCC)) ||
+ (PccAcpi =3D=3D NULL))
+ {
+ ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Doorbell =3D &GenericPccCmObj->DoorbellReg;
+ PlatIrqAck =3D &PccCmObj->PlatIrqAckReg;
+ CmdCompleteCheck =3D &PccCmObj->CmdCompleteCheckReg;
+ CmdCompleteUpdate =3D &PccCmObj->CmdCompleteUpdateReg;
+ ErrorStatus =3D &PccCmObj->ErrorStatusReg;
+ ChannelTiming =3D &GenericPccCmObj->ChannelTiming;
+
+ PccAcpi->Type =3D GenericPccCmObj->Type;
+ PccAcpi->Length =3D sizeof (EFI_ACPI_6_4_PCCT_SUBSPACE=
_3_EXTENDED_PCC);
+ PccAcpi->PlatformInterrupt =3D PccCmObj->PlatIrq.Interrupt;
+ PccAcpi->PlatformInterruptFlags =3D PccCmObj->PlatIrq.Flags;
+ PccAcpi->Reserved =3D EFI_ACPI_RESERVED_BYTE;
+ PccAcpi->BaseAddress =3D GenericPccCmObj->BaseAddress;
+ PccAcpi->AddressLength =3D GenericPccCmObj->AddressLength;
+
+ CopyMem (
+ &PccAcpi->DoorbellRegister,
+ &Doorbell->Register,
+ sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
+ );
+ PccAcpi->DoorbellPreserve =3D Doorbell->PreserveMask;
+ PccAcpi->DoorbellWrite =3D Doorbell->WriteMask;
+
+ PccAcpi->NominalLatency =3D ChannelTiming->NominalLatenc=
y;
+ PccAcpi->MaximumPeriodicAccessRate =3D ChannelTiming->MaxPeriodicAc=
cessRate;
+ PccAcpi->MinimumRequestTurnaroundTime =3D ChannelTiming->MinRequestTur=
naroundTime;
+
+ CopyMem (
+ &PccAcpi->PlatformInterruptAckRegister,
+ &PlatIrqAck->Register,
+ sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
+ );
+ PccAcpi->PlatformInterruptAckPreserve =3D PlatIrqAck->PreserveMask;
+ PccAcpi->PlatformInterruptAckSet =3D PlatIrqAck->WriteMask;
+
+ PccAcpi->Reserved1[0] =3D EFI_ACPI_RESERVED_BYTE;
+ PccAcpi->Reserved1[1] =3D EFI_ACPI_RESERVED_BYTE;
+ PccAcpi->Reserved1[1] =3D EFI_ACPI_RESERVED_BYTE;
+ PccAcpi->Reserved1[3] =3D EFI_ACPI_RESERVED_BYTE;
+ PccAcpi->Reserved1[4] =3D EFI_ACPI_RESERVED_BYTE;
+ PccAcpi->Reserved1[5] =3D EFI_ACPI_RESERVED_BYTE;
+ PccAcpi->Reserved1[6] =3D EFI_ACPI_RESERVED_BYTE;
+ PccAcpi->Reserved1[7] =3D EFI_ACPI_RESERVED_BYTE;
+
+ CopyMem (
+ &PccAcpi->CommandCompleteCheckRegister,
+ &CmdCompleteCheck->Register,
+ sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
+ );
+ PccAcpi->CommandCompleteCheckMask =3D CmdCompleteCheck->PreserveMask;
+ // No Write mask.
+
+ CopyMem (
+ &PccAcpi->CommandCompleteUpdateRegister,
+ &CmdCompleteUpdate->Register,
+ sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
+ );
+ PccAcpi->CommandCompleteUpdatePreserve =3D CmdCompleteUpdate->Preserve=
Mask;
+ PccAcpi->CommandCompleteUpdateSet =3D CmdCompleteUpdate->WriteMas=
k;
+
+ CopyMem (
+ &PccAcpi->ErrorStatusRegister,
+ &ErrorStatus->Register,
+ sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
+ );
+ PccAcpi->ErrorStatusMask =3D ErrorStatus->PreserveMask;
+ // No Write mask.
+
+ if (GenericPccCmObj->Type =3D=3D EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXT=
ENDED_PCC) {
+ mHasPlatformInterrupt =3D TRUE;
+ } else if ((PccCmObj->PlatIrq.Interrupt !=3D 0)) {
+ mHasPlatformInterrupt =3D TRUE;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/** Add one PCCT subspace structure of Type 5 (HW-Registers).
+
+ @param [in] PccCmObj Pointer to a CmObj PCCT Subspace info structur=
e.
+ @param [in] PccAcpi Pointer to the ACPI PCCT Subspace structure to=
populate.
+
+ @retval EFI_SUCCESS Table generated successfully.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+AddSubspaceStructType5 (
+ IN CM_ARM_PCC_SUBSPACE_TYPE5_INFO *PccCmOb=
j,
+ IN EFI_ACPI_6_4_PCCT_SUBSPACE_5_HW_REGISTERS_COMMUNICATIONS *PccAcpi
+ )
+{
+ CM_ARM_PCC_SUBSPACE_TYPE0_INFO *GenericPccCmObj;
+ PCC_MAILBOX_REGISTER_INFO *Doorbell;
+ PCC_MAILBOX_REGISTER_INFO *CmdCompleteCheck;
+ PCC_MAILBOX_REGISTER_INFO *ErrorStatus;
+ PCC_SUBSPACE_CHANNEL_TIMING_INFO *ChannelTiming;
+
+ GenericPccCmObj =3D (CM_ARM_PCC_SUBSPACE_TYPE0_INFO *)PccCmObj;
+
+ if ((PccCmObj =3D=3D NULL) ||
+ (GenericPccCmObj->Type !=3D EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_5_HW_R=
EGISTERS_COMMUNICATIONS) ||
+ (PccAcpi =3D=3D NULL))
+ {
+ ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Doorbell =3D &GenericPccCmObj->DoorbellReg;
+ CmdCompleteCheck =3D &PccCmObj->CmdCompleteCheckReg;
+ ErrorStatus =3D &PccCmObj->ErrorStatusReg;
+ ChannelTiming =3D &GenericPccCmObj->ChannelTiming;
+
+ PccAcpi->Type =3D GenericPccCmObj->Type;
+ PccAcpi->Length =3D sizeof (EFI_ACPI_6_4_PCCT_SUBSPAC=
E_5_HW_REGISTERS_COMMUNICATIONS);
+ PccAcpi->Version =3D PccCmObj->Version;
+ PccAcpi->BaseAddress =3D GenericPccCmObj->BaseAddress;
+ PccAcpi->SharedMemoryRangeLength =3D GenericPccCmObj->AddressLength;
+
+ CopyMem (
+ &PccAcpi->DoorbellRegister,
+ &Doorbell->Register,
+ sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
+ );
+ PccAcpi->DoorbellPreserve =3D Doorbell->PreserveMask;
+ PccAcpi->DoorbellWrite =3D Doorbell->WriteMask;
+
+ CopyMem (
+ &PccAcpi->CommandCompleteCheckRegister,
+ &CmdCompleteCheck->Register,
+ sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
+ );
+ PccAcpi->CommandCompleteCheckMask =3D CmdCompleteCheck->PreserveMask;
+ // No Write mask.
+
+ CopyMem (
+ &PccAcpi->ErrorStatusRegister,
+ &ErrorStatus->Register,
+ sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
+ );
+ PccAcpi->ErrorStatusMask =3D ErrorStatus->PreserveMask;
+ // No Write mask.
+
+ PccAcpi->NominalLatency =3D ChannelTiming->NominalLatency;
+ // No MaximumPeriodicAccessRate.
+ PccAcpi->MinimumRequestTurnaroundTime =3D ChannelTiming->MinRequestTur=
naroundTime;
+
+ return EFI_SUCCESS;
+}
+
+/** Populate the PCCT table using the MappingTable.
+
+ @param [in] MappingTable The mapping table structure.
+ @param [in] Pcc Pointer to an array of Pcc Subpace structure=
s.
+ @param [in] Size Size of the Pcc array.
+
+ @retval EFI_SUCCESS Table generated successfully.
+ @retval EFI_BUFFER_TOO_SMALL Buffer too small.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+PopulatePcctTable (
+ IN MAPPING_TABLE *MappingTable,
+ IN VOID *Pcc,
+ IN UINT32 Size
+ )
+{
+ EFI_STATUS Status;
+ UINT8 *PccBuffer;
+ UINT32 CmObjSize;
+ UINT32 Index;
+ UINT32 MaxIndex;
+ VOID **Table;
+ VOID *CurrentPccSubspace;
+
+ ASSERT (MappingTable !=3D NULL);
+ ASSERT (MappingTable->Table !=3D NULL);
+
+ PccBuffer =3D Pcc;
+ MaxIndex =3D MappingTable->MaxIndex;
+ Table =3D MappingTable->Table;
+
+ for (Index =3D 0; Index < MaxIndex; Index++) {
+ CurrentPccSubspace =3D Table[Index];
+ if (CurrentPccSubspace =3D=3D NULL) {
+ ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ switch (((PCC_SUBSPACE_GENERIC_INFO *)CurrentPccSubspace)->Type) {
+ case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_GENERIC:
+ Status =3D AddSubspaceStructType0 (
+ (CM_ARM_PCC_SUBSPACE_TYPE0_INFO *)CurrentPccSubspace,
+ (EFI_ACPI_6_4_PCCT_SUBSPACE_GENERIC *)PccBuffer
+ );
+
+ CmObjSize =3D sizeof (EFI_ACPI_6_4_PCCT_SUBSPACE_GENERIC);
+ break;
+
+ case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_1_HW_REDUCED_COMMUNICATIONS:
+ Status =3D AddSubspaceStructType1 (
+ (CM_ARM_PCC_SUBSPACE_TYPE1_INFO *)CurrentPccSubspace,
+ (EFI_ACPI_6_4_PCCT_SUBSPACE_1_HW_REDUCED_COMMUNICATIO=
NS *)PccBuffer
+ );
+
+ CmObjSize =3D sizeof (EFI_ACPI_6_4_PCCT_SUBSPACE_1_HW_REDUCED_CO=
MMUNICATIONS);
+ break;
+
+ case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_2_HW_REDUCED_COMMUNICATIONS:
+ Status =3D AddSubspaceStructType2 (
+ (CM_ARM_PCC_SUBSPACE_TYPE2_INFO *)CurrentPccSubspace,
+ (EFI_ACPI_6_4_PCCT_SUBSPACE_2_HW_REDUCED_COMMUNICATIO=
NS *)PccBuffer
+ );
+
+ CmObjSize =3D sizeof (EFI_ACPI_6_4_PCCT_SUBSPACE_2_HW_REDUCED_CO=
MMUNICATIONS);
+ break;
+
+ case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_3_EXTENDED_PCC:
+ Status =3D AddSubspaceStructType34 (
+ (CM_ARM_PCC_SUBSPACE_TYPE3_INFO *)CurrentPccSubspace,
+ (EFI_ACPI_6_4_PCCT_SUBSPACE_3_EXTENDED_PCC *)PccBuffe=
r
+ );
+
+ CmObjSize =3D sizeof (EFI_ACPI_6_4_PCCT_SUBSPACE_3_EXTENDED_PCC)=
;
+ break;
+
+ case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC:
+ Status =3D AddSubspaceStructType34 (
+ (CM_ARM_PCC_SUBSPACE_TYPE4_INFO *)CurrentPccSubspace,
+ (EFI_ACPI_6_4_PCCT_SUBSPACE_4_EXTENDED_PCC *)PccBuffe=
r
+ );
+
+ CmObjSize =3D sizeof (EFI_ACPI_6_4_PCCT_SUBSPACE_4_EXTENDED_PCC)=
;
+ break;
+
+ case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_5_HW_REGISTERS_COMMUNICATIONS=
:
+ Status =3D AddSubspaceStructType5 (
+ (CM_ARM_PCC_SUBSPACE_TYPE5_INFO *)CurrentPccSubspace,
+ (EFI_ACPI_6_4_PCCT_SUBSPACE_5_HW_REGISTERS_COMMUNICAT=
IONS *)PccBuffer
+ );
+
+ CmObjSize =3D sizeof (EFI_ACPI_6_4_PCCT_SUBSPACE_5_HW_REGISTERS_=
COMMUNICATIONS);
+ break;
+
+ default:
+ ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER);
+ return EFI_INVALID_PARAMETER;
+ } // switch
+
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+ }
+
+ if (Size < CmObjSize) {
+ ASSERT_EFI_ERROR (EFI_BUFFER_TOO_SMALL);
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+ PccBuffer +=3D CmObjSize;
+ Size -=3D CmObjSize;
+ } // for
+
+ return EFI_SUCCESS;
+}
+
+/** Construct the PCCT ACPI table.
+
+ Called by the Dynamic Table Manager, this function invokes the
+ Configuration Manager protocol interface to get the required hardware
+ information for generating the ACPI table.
+
+ If this function allocates any resources then they must be freed
+ in the FreeXXXXTableResources function.
+
+ @param [in] This Pointer to the table generator.
+ @param [in] AcpiTableInfo Pointer to the ACPI Table Info.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [out] Table Pointer to the constructed ACPI Table.
+
+ @retval EFI_SUCCESS Table generated successfully.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object was not found.
+ @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
+ Manager is less than the Object size for=
the
+ requested object.
+ @retval EFI_BUFFER_TOO_SMALL Buffer too small.
+ @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+BuildPcctTable (
+ IN CONST ACPI_TABLE_GENERATOR *CONST This,
+ IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol=
,
+ OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
+ )
+{
+ EFI_STATUS Status;
+ ACPI_PCCT_GENERATOR *Generator;
+ UINT32 TableSize;
+ EFI_ACPI_6_4_PLATFORM_COMMUNICATION_CHANNEL_TABLE_HEADER *Pcct;
+ UINT8 *Buffer;
+
+ MAPPING_TABLE *MappingTable;
+ UINT32 MappingTableCount;
+
+ CM_ARM_PCC_SUBSPACE_TYPE0_INFO *PccType0;
+ UINT32 PccType0Count;
+ CM_ARM_PCC_SUBSPACE_TYPE1_INFO *PccType1;
+ UINT32 PccType1Count;
+ CM_ARM_PCC_SUBSPACE_TYPE2_INFO *PccType2;
+ UINT32 PccType2Count;
+ CM_ARM_PCC_SUBSPACE_TYPE3_INFO *PccType3;
+ UINT32 PccType3Count;
+ CM_ARM_PCC_SUBSPACE_TYPE4_INFO *PccType4;
+ UINT32 PccType4Count;
+ CM_ARM_PCC_SUBSPACE_TYPE5_INFO *PccType5;
+ UINT32 PccType5Count;
+
+ ASSERT (This !=3D NULL);
+ ASSERT (AcpiTableInfo !=3D NULL);
+ ASSERT (CfgMgrProtocol !=3D NULL);
+ ASSERT (Table !=3D NULL);
+ ASSERT (AcpiTableInfo->TableGeneratorId =3D=3D This->GeneratorID);
+ ASSERT (AcpiTableInfo->AcpiTableSignature =3D=3D This->AcpiTableSignat=
ure);
+
+ if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
+ (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
+ {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: PCCT: Requested table revision =3D %d, is not supported."
+ "Supported table revision: Minimum =3D %d, Maximum =3D %d\n",
+ AcpiTableInfo->AcpiTableRevision,
+ This->MinAcpiTableRevision,
+ This->AcpiTableRevision
+ ));
+ ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Generator =3D (ACPI_PCCT_GENERATOR *)This;
+ MappingTable =3D &Generator->MappingTable;
+ *Table =3D NULL;
+
+ // First get all the Pcc Subpace CmObj of type X.
+
+ Status =3D GetEArmObjPccSubspaceType0Info (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &PccType0,
+ &PccType0Count
+ );
+ if (EFI_ERROR (Status) && (Status !=3D EFI_NOT_FOUND)) {
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
+
+ Status =3D GetEArmObjPccSubspaceType1Info (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &PccType1,
+ &PccType1Count
+ );
+ if (EFI_ERROR (Status) && (Status !=3D EFI_NOT_FOUND)) {
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
+
+ Status =3D GetEArmObjPccSubspaceType2Info (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &PccType2,
+ &PccType2Count
+ );
+ if (EFI_ERROR (Status) && (Status !=3D EFI_NOT_FOUND)) {
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
+
+ Status =3D GetEArmObjPccSubspaceType3Info (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &PccType3,
+ &PccType3Count
+ );
+ if (EFI_ERROR (Status) && (Status !=3D EFI_NOT_FOUND)) {
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
+
+ Status =3D GetEArmObjPccSubspaceType4Info (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &PccType4,
+ &PccType4Count
+ );
+ if (EFI_ERROR (Status) && (Status !=3D EFI_NOT_FOUND)) {
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
+
+ Status =3D GetEArmObjPccSubspaceType5Info (
+ CfgMgrProtocol,
+ CM_NULL_TOKEN,
+ &PccType5,
+ &PccType5Count
+ );
+ if (EFI_ERROR (Status) && (Status !=3D EFI_NOT_FOUND)) {
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
+
+ // Count the number of Pcc Subspaces.
+ MappingTableCount =3D PccType0Count;
+ MappingTableCount +=3D PccType1Count;
+ MappingTableCount +=3D PccType2Count;
+ MappingTableCount +=3D PccType3Count;
+ MappingTableCount +=3D PccType4Count;
+ MappingTableCount +=3D PccType5Count;
+
+ Status =3D MappingTableInitialize (MappingTable, MappingTableCount);
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
+
+ // Map the Subspace Ids for all types.
+
+ Status =3D MapPccSubspaceId (MappingTable, PccType0, PccType0Count);
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
+
+ Status =3D MapPccSubspaceId (MappingTable, PccType1, PccType1Count);
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
+
+ Status =3D MapPccSubspaceId (MappingTable, PccType2, PccType2Count);
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
+
+ Status =3D MapPccSubspaceId (MappingTable, PccType3, PccType3Count);
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
+
+ Status =3D MapPccSubspaceId (MappingTable, PccType4, PccType4Count);
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
+
+ Status =3D MapPccSubspaceId (MappingTable, PccType5, PccType5Count);
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
+
+ // Compute the size of the PCCT table.
+ TableSize =3D sizeof (EFI_ACPI_6_4_PLATFORM_COMMUNICATION_CHANNEL_TAB=
LE_HEADER);
+ TableSize +=3D PccType0Count * sizeof (EFI_ACPI_6_4_PCCT_SUBSPACE_GENE=
RIC);
+ TableSize +=3D PccType1Count * sizeof (EFI_ACPI_6_4_PCCT_SUBSPACE_1_HW=
_REDUCED_COMMUNICATIONS);
+ TableSize +=3D PccType2Count * sizeof (EFI_ACPI_6_4_PCCT_SUBSPACE_2_HW=
_REDUCED_COMMUNICATIONS);
+ TableSize +=3D PccType3Count * sizeof (EFI_ACPI_6_4_PCCT_SUBSPACE_3_EX=
TENDED_PCC);
+ TableSize +=3D PccType4Count * sizeof (EFI_ACPI_6_4_PCCT_SUBSPACE_4_EX=
TENDED_PCC);
+ TableSize +=3D PccType5Count * sizeof (EFI_ACPI_6_4_PCCT_SUBSPACE_5_HW=
_REGISTERS_COMMUNICATIONS);
+
+ // Allocate a Buffer for the PCCT table.
+ *Table =3D (EFI_ACPI_DESCRIPTION_HEADER *)AllocateZeroPool (TableSize)=
;
+ if (*Table =3D=3D NULL) {
+ Status =3D EFI_OUT_OF_RESOURCES;
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
+
+ Pcct =3D (EFI_ACPI_6_4_PLATFORM_COMMUNICATION_CHANNEL_TABLE_HEADER *)*=
Table;
+
+ Status =3D AddAcpiHeader (
+ CfgMgrProtocol,
+ This,
+ &Pcct->Header,
+ AcpiTableInfo,
+ TableSize
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: PCCT: Failed to add ACPI header. Status =3D %r\n",
+ Status
+ ));
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
+
+ Buffer =3D (UINT8 *)Pcct;
+ Buffer +=3D sizeof (EFI_ACPI_6_4_PLATFORM_COMMUNICATION_CHANNEL_TAB=
LE_HEADER);
+ TableSize -=3D sizeof (EFI_ACPI_6_4_PLATFORM_COMMUNICATION_CHANNEL_TAB=
LE_HEADER);
+
+ // Populate the PCCT table by following the Subspace Id mapping.
+ Status =3D PopulatePcctTable (MappingTable, Buffer, TableSize);
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ goto error_handler;
+ }
+
+ // Setup the Reserved fields once mHasPlatformInterrupt hase been popu=
lated.
+ Pcct->Flags =3D mHasPlatformInterrupt;
+ Pcct->Reserved =3D EFI_ACPI_RESERVED_QWORD;
+
+ MappingTableFree (MappingTable);
+
+ return Status;
+
+error_handler:
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: PCCT: Failed to install table. Status =3D %r\n",
+ Status
+ ));
+
+ if (*Table !=3D NULL) {
+ FreePool (*Table);
+ *Table =3D NULL;
+ }
+
+ MappingTableFree (MappingTable);
+
+ return Status;
+}
+
+/** Free any resources allocated for constructing the PCCT.
+
+ @param [in] This Pointer to the table generator.
+ @param [in] AcpiTableInfo Pointer to the ACPI Table Info.
+ @param [in] CfgMgrProtocol Pointer to the Configuration Manager
+ Protocol Interface.
+ @param [in, out] Table Pointer to the ACPI Table.
+
+ @retval EFI_SUCCESS The resources were freed successfully.
+ @retval EFI_INVALID_PARAMETER The table pointer is NULL or invalid.
+**/
+STATIC
+EFI_STATUS
+FreePcctTableResources (
+ IN CONST ACPI_TABLE_GENERATOR *CONST This,
+ IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableI=
nfo,
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProt=
ocol,
+ IN OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table
+ )
+{
+ ASSERT (This !=3D NULL);
+ ASSERT (AcpiTableInfo !=3D NULL);
+ ASSERT (CfgMgrProtocol !=3D NULL);
+ ASSERT (AcpiTableInfo->TableGeneratorId =3D=3D This->GeneratorID);
+ ASSERT (AcpiTableInfo->AcpiTableSignature =3D=3D This->AcpiTableSignat=
ure);
+
+ if ((Table =3D=3D NULL) || (*Table =3D=3D NULL)) {
+ DEBUG ((DEBUG_ERROR, "ERROR: PCCT: Invalid Table Pointer\n"));
+ ASSERT ((Table !=3D NULL) && (*Table !=3D NULL));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ FreePool (*Table);
+ *Table =3D NULL;
+ return EFI_SUCCESS;
+}
+
+/** This macro defines the PCCT Table Generator revision.
+*/
+#define PCCT_GENERATOR_REVISION CREATE_REVISION (1, 0)
+
+/** The interface for the PCCT Table Generator.
+*/
+STATIC
+ACPI_PCCT_GENERATOR PcctGenerator =3D {
+ // ACPI table generator header
+ {
+ // Generator ID
+ CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdPcct),
+ // Generator Description
+ L"ACPI.STD.PCCT.GENERATOR",
+ // ACPI Table Signature
+ EFI_ACPI_6_4_PLATFORM_COMMUNICATIONS_CHANNEL_TABLE_SIGNATURE,
+ // ACPI Table Revision supported by this Generator
+ EFI_ACPI_6_4_PLATFORM_COMMUNICATION_CHANNEL_TABLE_REVISION,
+ // Minimum ACPI Table Revision supported by this Generator
+ EFI_ACPI_6_4_PLATFORM_COMMUNICATION_CHANNEL_TABLE_REVISION,
+ // Creator ID
+ TABLE_GENERATOR_CREATOR_ID_ARM,
+ // Creator Revision
+ PCCT_GENERATOR_REVISION,
+ // Build Table function
+ BuildPcctTable,
+ // Free Resource function
+ FreePcctTableResources,
+ // Extended build function not needed
+ NULL,
+ // Extended build function not implemented by the generator.
+ // Hence extended free resource function is not required.
+ NULL
+ },
+
+ // Private fields are defined from here.
+
+ // Mapping Table
+ {
+ // Table
+ NULL,
+ // MaxIndex
+ 0,
+ },
+};
+
+/** Register the Generator with the ACPI Table Factory.
+
+ @param [in] ImageHandle The handle to the image.
+ @param [in] SystemTable Pointer to the System Table.
+
+ @retval EFI_SUCCESS The Generator is registered.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_ALREADY_STARTED The Generator for the Table ID
+ is already registered.
+**/
+EFI_STATUS
+EFIAPI
+AcpiPcctLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status =3D RegisterAcpiTableGenerator (&PcctGenerator.Header);
+ DEBUG ((DEBUG_INFO, "PCCT: Register Generator. Status =3D %r\n", Statu=
s));
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
+
+/** Deregister the Generator from the ACPI Table Factory.
+
+ @param [in] ImageHandle The handle to the image.
+ @param [in] SystemTable Pointer to the System Table.
+
+ @retval EFI_SUCCESS The Generator is deregistered.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The Generator is not registered.
+**/
+EFI_STATUS
+EFIAPI
+AcpiPcctLibDestructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status =3D DeregisterAcpiTableGenerator (&PcctGenerator.Header);
+ DEBUG ((DEBUG_INFO, "PCCT: Deregister Generator. Status =3D %r\n", Sta=
tus));
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/PcctGenerat=
or.h b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/PcctGenerator.h
new file mode 100644
index 000000000000..0631a1f5b74b
--- /dev/null
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPcctLibArm/PcctGenerator.h
@@ -0,0 +1,43 @@
+/** @file
+ PCCT Table Generator
+
+ Copyright (c) 2022, Arm Limited. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Reference(s):
+ - ACPI 6.4 Specification - January 2021
+ s14 PLATFORM COMMUNICATIONS CHANNEL (PCC)
+
+**/
+
+#ifndef PCCT_GENERATOR_H_
+#define PCCT_GENERATOR_H_
+
+#pragma pack(1)
+
+/** Structure used to map a Pcc Subspace to an index.
+*/
+typedef struct MappingTable {
+ /// Mapping table for Subspace Ids.
+ /// Subspace ID/Index <-> CM_ARM_PCC_SUBSPACE_TYPE[X]_INFO pointer
+ VOID **Table;
+
+ /// Number of entries in the Table.
+ UINT32 MaxIndex;
+} MAPPING_TABLE;
+
+/** A structure holding the Pcct generator and additional private data.
+*/
+typedef struct AcpiPcctGenerator {
+ /// ACPI Table generator header
+ ACPI_TABLE_GENERATOR Header;
+
+ // Private fields are defined from here.
+
+ /// Table to map: Subspace ID/Index <-> CM_ARM_PCC_SUBSPACE_TYPE[X]_IN=
FO pointer
+ MAPPING_TABLE MappingTable;
+} ACPI_PCCT_GENERATOR;
+
+#pragma pack()
+
+#endif // PCCT_GENERATOR_H_
diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/Configuration=
ManagerObjectParser.c b/DynamicTablesPkg/Library/Common/TableHelperLib/Co=
nfigurationManagerObjectParser.c
index 21d1f3f08b16..4d7aa7963fae 100644
--- a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManager=
ObjectParser.c
+++ b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManager=
ObjectParser.c
@@ -539,7 +539,7 @@ STATIC CONST CM_OBJ_PARSER CmArmCpcInfoParser[] =3D =
{
{ "NominalFrequencyInteger", 4, =
"0x%lx", NULL },
};
=20
-/** A parser for the CM_ARM_MAILBOX_REGISTER_INFO struct.
+/** A parser for the PCC_MAILBOX_REGISTER_INFO struct.
*/
STATIC CONST CM_OBJ_PARSER CmArmMailboxRegisterInfoParser[] =3D {
{ "Register", sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE), NUL=
L, NULL,
@@ -548,7 +548,7 @@ STATIC CONST CM_OBJ_PARSER CmArmMailboxRegisterInfoP=
arser[] =3D {
{ "WriteMask", 8, "0x=
%llx", NULL },
};
=20
-/** A parser for the CM_ARM_PCC_SUBSPACE_CHANNEL_TIMING_INFO struct.
+/** A parser for the PCC_SUBSPACE_CHANNEL_TIMING_INFO struct.
*/
STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceChannelTimingInfoParser[] =3D=
{
{ "NominalLatency", 4, "0x%x", NULL },
@@ -559,14 +559,14 @@ STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceChannel=
TimingInfoParser[] =3D {
/** A parser for EArmObjPccSubspaceType0Info.
*/
STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceType0InfoParser[] =3D {
- { "SubspaceId", 1, "=
0x%x", NULL },
- { "Type", 1, "=
0x%x", NULL },
- { "BaseAddress", 8, "=
0x%llx", NULL },
- { "AddressLength", 8, "=
0x%llx", NULL },
- { "DoorbellReg", sizeof (CM_ARM_MAILBOX_REGISTER_INFO),
+ { "SubspaceId", 1, "0x%x", =
NULL },
+ { "Type", 1, "0x%x", =
NULL },
+ { "BaseAddress", 8, "0x%llx"=
, NULL },
+ { "AddressLength", 8, "0x%llx"=
, NULL },
+ { "DoorbellReg", sizeof (PCC_MAILBOX_REGISTER_INFO),
NULL, NULL, CmArmMailboxRegisterInfoParser,
ARRAY_SIZE (CmArmMailboxRegisterInfoParser) },
- { "DoorbellReg", sizeof (CM_ARM_PCC_SUBSPACE_CHANNEL_TIMING_INFO),
+ { "DoorbellReg", sizeof (PCC_SUBSPACE_CHANNEL_TIMING_INFO),
NULL, NULL, CmArmPccSubspaceChannelTimingInfoParser,
ARRAY_SIZE (CmArmPccSubspaceChannelTimingInfoParser) },
};
@@ -574,7 +574,7 @@ STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceType0Info=
Parser[] =3D {
/** A parser for EArmObjPccSubspaceType1Info.
*/
STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceType1InfoParser[] =3D {
- { "GenericPccInfo", sizeof (CM_ARM_PCC_SUBSPACE_GENERIC_INFO),
+ { "GenericPccInfo", sizeof (PCC_SUBSPACE_GENERIC_INFO),
NULL, NULL, CmArmPccSubspaceType0InfoParser,
ARRAY_SIZE (CmArmPccSubspaceType0InfoParser) },
{ "PlatIrq", sizeof (CM_ARM_GENERIC_INTERRUPT),
@@ -585,12 +585,12 @@ STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceType1In=
foParser[] =3D {
/** A parser for EArmObjPccSubspaceType2Info.
*/
STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceType2InfoParser[] =3D {
- { "GenericPccInfo", sizeof (CM_ARM_PCC_SUBSPACE_GENERIC_INFO),
+ { "GenericPccInfo", sizeof (PCC_SUBSPACE_GENERIC_INFO),
NULL, NULL, CmArmPccSubspaceType0InfoParser,
ARRAY_SIZE (CmArmPccSubspaceType0InfoParser) },
- { "PlatIrq", sizeof (CM_ARM_GENERIC_INTERRUPT), NULL,NUL=
L,
+ { "PlatIrq", sizeof (CM_ARM_GENERIC_INTERRUPT), NULL,NULL,
CmArmGenericInterruptParser, ARRAY_SIZE (CmArmGenericInterruptParser=
) },
- { "PlatIrqAckReg", sizeof (CM_ARM_MAILBOX_REGISTER_INFO),
+ { "PlatIrqAckReg", sizeof (PCC_MAILBOX_REGISTER_INFO),
NULL, NULL, CmArmMailboxRegisterInfoParser,
ARRAY_SIZE (CmArmMailboxRegisterInfoParser) },
};
@@ -598,21 +598,21 @@ STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceType2In=
foParser[] =3D {
/** A parser for EArmObjPccSubspaceType3Info or EArmObjPccSubspaceType4I=
nfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceType34InfoParser[] =3D {
- { "GenericPccInfo", sizeof (CM_ARM_PCC_SUBSPACE_GENERIC_INFO),
+ { "GenericPccInfo", sizeof (PCC_SUBSPACE_GENERIC_INFO),
NULL, NULL, CmArmPccSubspaceType0InfoParser,
ARRAY_SIZE (CmArmPccSubspaceType0InfoParser) },
- { "PlatIrq", sizeof (CM_ARM_GENERIC_INTERRUPT), NU=
LL,NULL,
+ { "PlatIrq", sizeof (CM_ARM_GENERIC_INTERRUPT), NULL,NULL=
,
CmArmGenericInterruptParser, ARRAY_SIZE (CmArmGenericInterruptParser=
) },
- { "PlatIrqAckReg", sizeof (CM_ARM_MAILBOX_REGISTER_INFO),
+ { "PlatIrqAckReg", sizeof (PCC_MAILBOX_REGISTER_INFO),
NULL, NULL, CmArmMailboxRegisterInfoParser,
ARRAY_SIZE (CmArmMailboxRegisterInfoParser) },
- { "CmdCompleteCheckReg", sizeof (CM_ARM_MAILBOX_REGISTER_INFO),
+ { "CmdCompleteCheckReg", sizeof (PCC_MAILBOX_REGISTER_INFO),
NULL, NULL, CmArmMailboxRegisterInfoParser,
ARRAY_SIZE (CmArmMailboxRegisterInfoParser) },
- { "CmdCompleteUpdateReg", sizeof (CM_ARM_MAILBOX_REGISTER_INFO),
+ { "CmdCompleteUpdateReg", sizeof (PCC_MAILBOX_REGISTER_INFO),
NULL, NULL, CmArmMailboxRegisterInfoParser,
ARRAY_SIZE (CmArmMailboxRegisterInfoParser) },
- { "ErrorStatusReg", sizeof (CM_ARM_MAILBOX_REGISTER_INFO),
+ { "ErrorStatusReg", sizeof (PCC_MAILBOX_REGISTER_INFO),
NULL, NULL, CmArmMailboxRegisterInfoParser,
ARRAY_SIZE (CmArmMailboxRegisterInfoParser) },
};
@@ -620,16 +620,16 @@ STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceType34I=
nfoParser[] =3D {
/** A parser for EArmObjPccSubspaceType5Info.
*/
STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceType5InfoParser[] =3D {
- { "GenericPccInfo", sizeof (CM_ARM_PCC_SUBSPACE_GENERIC_INFO),
+ { "GenericPccInfo", sizeof (PCC_SUBSPACE_GENERIC_INFO),
NULL, NULL, CmArmPccSubspaceType0InfoParser,
ARRAY_SIZE (CmArmPccSubspaceType0InfoParser) },
- { "Version", 2, "0x=
%x",NULL },
- { "PlatIrq", sizeof (CM_ARM_GENERIC_INTERRUPT), NUL=
L, NULL,
+ { "Version", 2, "0x%x",NUL=
L },
+ { "PlatIrq", sizeof (CM_ARM_GENERIC_INTERRUPT), NULL, NUL=
L,
CmArmGenericInterruptParser, ARRAY_SIZE (CmArmGenericInterruptParser=
) },
- { "CmdCompleteCheckReg", sizeof (CM_ARM_MAILBOX_REGISTER_INFO),
+ { "CmdCompleteCheckReg", sizeof (PCC_MAILBOX_REGISTER_INFO),
NULL, NULL, CmArmMailboxRegisterInfoParser,
ARRAY_SIZE (CmArmMailboxRegisterInfoParser) },
- { "ErrorStatusReg", sizeof (CM_ARM_MAILBOX_REGISTER_INFO),
+ { "ErrorStatusReg", sizeof (PCC_MAILBOX_REGISTER_INFO),
NULL, NULL, CmArmMailboxRegisterInfoParser,
ARRAY_SIZE (CmArmMailboxRegisterInfoParser) },
};
--=20
2.25.1


[PATCH 10/14] DynamicTablesPkg: Add PCCT related objects

PierreGondois
 

From: Pierre Gondois <pierre.gondois@...>

Introduce the following CmObj in the ArmNameSpaceObjects:
- CM_ARM_MAILBOX_REGISTER_INFO
- CM_ARM_PCC_SUBSPACE_CHANNEL_TIMING_INFO
- CM_ARM_PCC_SUBSPACE_GENERIC_INFO
- CM_ARM_PCC_SUBPSACE_TYPE0_INFO
- CM_ARM_PCC_SUBPSACE_TYPE1_INFO
- CM_ARM_PCC_SUBPSACE_TYPE2_INFO
- CM_ARM_PCC_SUBPSACE_TYPE3_INFO
- CM_ARM_PCC_SUBPSACE_TYPE4_INFO
- CM_ARM_PCC_SUBPSACE_TYPE5_INFO

These objects allow to describe mailbox registers, pcc timings
and PCCT subspaces. They prepare the enablement of a PCCT generator.

Also add the CmObjParsers associated to each object.

Signed-off-by: Pierre Gondois <Pierre.Gondois@...>
---
.../Include/ArmNameSpaceObjects.h | 277 +++++++++++++++---
.../ConfigurationManagerObjectParser.c | 107 +++++++
2 files changed, 341 insertions(+), 43 deletions(-)

diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h b/DynamicTabl=
esPkg/Include/ArmNameSpaceObjects.h
index d711f3ec5938..5d5a8ce92a09 100644
--- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
@@ -22,49 +22,55 @@
in the ARM Namespace
*/
typedef enum ArmObjectID {
- EArmObjReserved, ///< 0 - Reserved
- EArmObjBootArchInfo, ///< 1 - Boot Architecture Info
- EArmObjCpuInfo, ///< 2 - CPU Info
- EArmObjPowerManagementProfileInfo, ///< 3 - Power Management Profil=
e Info
- EArmObjGicCInfo, ///< 4 - GIC CPU Interface Info
- EArmObjGicDInfo, ///< 5 - GIC Distributor Info
- EArmObjGicMsiFrameInfo, ///< 6 - GIC MSI Frame Info
- EArmObjGicRedistributorInfo, ///< 7 - GIC Redistributor Info
- EArmObjGicItsInfo, ///< 8 - GIC ITS Info
- EArmObjSerialConsolePortInfo, ///< 9 - Serial Console Port Inf=
o
- EArmObjSerialDebugPortInfo, ///< 10 - Serial Debug Port Info
- EArmObjGenericTimerInfo, ///< 11 - Generic Timer Info
- EArmObjPlatformGTBlockInfo, ///< 12 - Platform GT Block Info
- EArmObjGTBlockTimerFrameInfo, ///< 13 - Generic Timer Block Fra=
me Info
- EArmObjPlatformGenericWatchdogInfo, ///< 14 - Platform Generic Watchd=
og
- EArmObjPciConfigSpaceInfo, ///< 15 - PCI Configuration Space=
Info
- EArmObjHypervisorVendorIdentity, ///< 16 - Hypervisor Vendor Id
- EArmObjFixedFeatureFlags, ///< 17 - Fixed feature flags for=
FADT
- EArmObjItsGroup, ///< 18 - ITS Group
- EArmObjNamedComponent, ///< 19 - Named Component
- EArmObjRootComplex, ///< 20 - Root Complex
- EArmObjSmmuV1SmmuV2, ///< 21 - SMMUv1 or SMMUv2
- EArmObjSmmuV3, ///< 22 - SMMUv3
- EArmObjPmcg, ///< 23 - PMCG
- EArmObjGicItsIdentifierArray, ///< 24 - GIC ITS Identifier Arra=
y
- EArmObjIdMappingArray, ///< 25 - ID Mapping Array
- EArmObjSmmuInterruptArray, ///< 26 - SMMU Interrupt Array
- EArmObjProcHierarchyInfo, ///< 27 - Processor Hierarchy Inf=
o
- EArmObjCacheInfo, ///< 28 - Cache Info
- EArmObjReserved29, ///< 29 - Reserved
- EArmObjCmRef, ///< 30 - CM Object Reference
- EArmObjMemoryAffinityInfo, ///< 31 - Memory Affinity Info
- EArmObjDeviceHandleAcpi, ///< 32 - Device Handle Acpi
- EArmObjDeviceHandlePci, ///< 33 - Device Handle Pci
- EArmObjGenericInitiatorAffinityInfo, ///< 34 - Generic Initiator Affin=
ity
- EArmObjSerialPortInfo, ///< 35 - Generic Serial Port Inf=
o
- EArmObjCmn600Info, ///< 36 - CMN-600 Info
- EArmObjLpiInfo, ///< 37 - Lpi Info
- EArmObjPciAddressMapInfo, ///< 38 - Pci Address Map Info
- EArmObjPciInterruptMapInfo, ///< 39 - Pci Interrupt Map Info
- EArmObjRmr, ///< 40 - Reserved Memory Range N=
ode
- EArmObjMemoryRangeDescriptor, ///< 41 - Memory Range Descriptor
- EArmObjCpcInfo, ///< 42 - Continuous Performance =
Control Info
+ EArmObjReserved, ///< 0 -=
Reserved
+ EArmObjBootArchInfo, ///< 1 -=
Boot Architecture Info
+ EArmObjCpuInfo, ///< 2 -=
CPU Info
+ EArmObjPowerManagementProfileInfo, ///< 3 -=
Power Management Profile Info
+ EArmObjGicCInfo, ///< 4 -=
GIC CPU Interface Info
+ EArmObjGicDInfo, ///< 5 -=
GIC Distributor Info
+ EArmObjGicMsiFrameInfo, ///< 6 -=
GIC MSI Frame Info
+ EArmObjGicRedistributorInfo, ///< 7 -=
GIC Redistributor Info
+ EArmObjGicItsInfo, ///< 8 -=
GIC ITS Info
+ EArmObjSerialConsolePortInfo, ///< 9 -=
Serial Console Port Info
+ EArmObjSerialDebugPortInfo, ///< 10 -=
Serial Debug Port Info
+ EArmObjGenericTimerInfo, ///< 11 -=
Generic Timer Info
+ EArmObjPlatformGTBlockInfo, ///< 12 -=
Platform GT Block Info
+ EArmObjGTBlockTimerFrameInfo, ///< 13 -=
Generic Timer Block Frame Info
+ EArmObjPlatformGenericWatchdogInfo, ///< 14 -=
Platform Generic Watchdog
+ EArmObjPciConfigSpaceInfo, ///< 15 -=
PCI Configuration Space Info
+ EArmObjHypervisorVendorIdentity, ///< 16 -=
Hypervisor Vendor Id
+ EArmObjFixedFeatureFlags, ///< 17 -=
Fixed feature flags for FADT
+ EArmObjItsGroup, ///< 18 -=
ITS Group
+ EArmObjNamedComponent, ///< 19 -=
Named Component
+ EArmObjRootComplex, ///< 20 -=
Root Complex
+ EArmObjSmmuV1SmmuV2, ///< 21 -=
SMMUv1 or SMMUv2
+ EArmObjSmmuV3, ///< 22 -=
SMMUv3
+ EArmObjPmcg, ///< 23 -=
PMCG
+ EArmObjGicItsIdentifierArray, ///< 24 -=
GIC ITS Identifier Array
+ EArmObjIdMappingArray, ///< 25 -=
ID Mapping Array
+ EArmObjSmmuInterruptArray, ///< 26 -=
SMMU Interrupt Array
+ EArmObjProcHierarchyInfo, ///< 27 -=
Processor Hierarchy Info
+ EArmObjCacheInfo, ///< 28 -=
Cache Info
+ EArmObjReserved29, ///< 29 -=
Reserved
+ EArmObjCmRef, ///< 30 -=
CM Object Reference
+ EArmObjMemoryAffinityInfo, ///< 31 -=
Memory Affinity Info
+ EArmObjDeviceHandleAcpi, ///< 32 -=
Device Handle Acpi
+ EArmObjDeviceHandlePci, ///< 33 -=
Device Handle Pci
+ EArmObjGenericInitiatorAffinityInfo, ///< 34 -=
Generic Initiator Affinity
+ EArmObjSerialPortInfo, ///< 35 -=
Generic Serial Port Info
+ EArmObjCmn600Info, ///< 36 -=
CMN-600 Info
+ EArmObjLpiInfo, ///< 37 -=
Lpi Info
+ EArmObjPciAddressMapInfo, ///< 38 -=
Pci Address Map Info
+ EArmObjPciInterruptMapInfo, ///< 39 -=
Pci Interrupt Map Info
+ EArmObjRmr, ///< 40 -=
Reserved Memory Range Node
+ EArmObjMemoryRangeDescriptor, ///< 41 -=
Memory Range Descriptor
+ EArmObjCpcInfo, ///< 42 -=
Continuous Performance Control Info
+ EArmObjPccSubspaceType0Info, ///< 43 -=
Pcc Subspace Type 0 Info
+ EArmObjPccSubspaceType1Info, ///< 44 -=
Pcc Subspace Type 2 Info
+ EArmObjPccSubspaceType2Info, ///< 45 -=
Pcc Subspace Type 2 Info
+ EArmObjPccSubspaceType3Info, ///< 46 -=
Pcc Subspace Type 3 Info
+ EArmObjPccSubspaceType4Info, ///< 47 -=
Pcc Subspace Type 4 Info
+ EArmObjPccSubspaceType5Info, ///< 48 -=
Pcc Subspace Type 5 Info
EArmObjMax
} EARM_OBJECT_ID;
=20
@@ -1095,6 +1101,191 @@ typedef struct CmArmRmrDescriptor {
*/
typedef AML_CPC_INFO CM_ARM_CPC_INFO;
=20
+/** A structure that describes a
+ PCC Mailbox Register.
+*/
+typedef struct PccMailboxRegisterInfo {
+ /// GAS describing the Register.
+ EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE Register;
+
+ /** Mask of bits to preserve when writing.
+
+ This mask is also used for registers the Register is only read
+ and there is no write mask required. E.g.:
+ - Error Status mask (Cf. PCC Subspace types 3/4/5).
+ - Command Complete Check mask (Cf. PCC Subspace types 3/4/5).
+ */
+ UINT64 PreserveMask;
+
+ /// Mask of bits to set when writing.
+ UINT64 WriteMask;
+} PCC_MAILBOX_REGISTER_INFO;
+
+/** A structure that describes the
+ PCC Subspace CHannel Timings.
+*/
+typedef struct PccSubspaceChannelTimingInfo {
+ /// Expected latency to process a command, in microseconds.
+ UINT32 NominalLatency;
+
+ /** Maximum number of periodic requests that the subspace channel can
+ support, reported in commands per minute. 0 indicates no limitatio=
n.
+
+ This field is ignored for the PCC Subspace type 5 (HW Registers base=
d).
+ */
+ UINT32 MaxPeriodicAccessRate;
+
+ /** Minimum amount of time that OSPM must wait after the completion
+ of a command before issuing the next command, in microseconds.
+ */
+ UINT16 MinRequestTurnaroundTime;
+} PCC_SUBSPACE_CHANNEL_TIMING_INFO;
+
+/** A structure that describes a
+ Generic PCC Subspace (Type 0).
+*/
+typedef struct CmArmPccSubspaceGenericInfo {
+ /** Subspace Id.
+
+ Cf. ACPI 6.4, s14.7 Referencing the PCC address space
+ Cf. s14.1.2 Platform Communications Channel Subspace Structures
+ The subspace ID of a PCC subspace is its index in the array of
+ subspace structures, starting with subspace 0.
+
+ At most 256 subspaces are supported.
+ */
+ UINT8 SubspaceId;
+
+ /// Table type (or subspace).
+ UINT8 Type;
+
+ /// Base address of the shared memory range.
+ /// This field is ignored for the PCC Subspace type 5 (HW Registers ba=
sed).
+ UINT64 BaseAddress;
+
+ /// Address length.
+ UINT64 AddressLength;
+
+ /// Doorbell Register.
+ PCC_MAILBOX_REGISTER_INFO DoorbellReg;
+
+ /// Mailbox Timings.
+ PCC_SUBSPACE_CHANNEL_TIMING_INFO ChannelTiming;
+} PCC_SUBSPACE_GENERIC_INFO;
+
+/** A structure that describes a
+ PCC Subspace of type 0 (Generic).
+
+ ID: EArmObjPccSubspaceType0Info
+*/
+typedef PCC_SUBSPACE_GENERIC_INFO CM_ARM_PCC_SUBSPACE_TYPE0_INFO;
+
+/** A structure that describes a
+ PCC Subspace of type 1 (HW-Reduced).
+
+ ID: EArmObjPccSubspaceType1Info
+*/
+typedef struct CmArmPccSubspaceType1Info {
+ /** Generic Pcc information.
+
+ The Subspace of Type0 contains information that can be re-used
+ in other Subspace types.
+ */
+ PCC_SUBSPACE_GENERIC_INFO GenericPccInfo;
+
+ /// Platform Interrupt.
+ CM_ARM_GENERIC_INTERRUPT PlatIrq;
+} CM_ARM_PCC_SUBSPACE_TYPE1_INFO;
+
+/** A structure that describes a
+ PCC Subspace of type 2 (HW-Reduced).
+
+ ID: EArmObjPccSubspaceType2Info
+*/
+typedef struct CmArmPccSubspaceType2Info {
+ /** Generic Pcc information.
+
+ The Subspace of Type0 contains information that can be re-used
+ in other Subspace types.
+ */
+ PCC_SUBSPACE_GENERIC_INFO GenericPccInfo;
+
+ /// Platform Interrupt.
+ CM_ARM_GENERIC_INTERRUPT PlatIrq;
+
+ /// Platform Interrupt Register.
+ PCC_MAILBOX_REGISTER_INFO PlatIrqAckReg;
+} CM_ARM_PCC_SUBSPACE_TYPE2_INFO;
+
+/** A structure that describes a
+ PCC Subspace of type 3 (Extended)
+
+ ID: EArmObjPccSubspaceType3Info
+*/
+typedef struct CmArmPccSubspaceType3Info {
+ /** Generic Pcc information.
+
+ The Subspace of Type0 contains information that can be re-used
+ in other Subspace types.
+ */
+ PCC_SUBSPACE_GENERIC_INFO GenericPccInfo;
+
+ /// Platform Interrupt.
+ CM_ARM_GENERIC_INTERRUPT PlatIrq;
+
+ /// Platform Interrupt Register.
+ PCC_MAILBOX_REGISTER_INFO PlatIrqAckReg;
+
+ /// Command Complete Check Register.
+ /// The WriteMask field is not used.
+ PCC_MAILBOX_REGISTER_INFO CmdCompleteCheckReg;
+
+ /// Command Complete Update Register.
+ PCC_MAILBOX_REGISTER_INFO CmdCompleteUpdateReg;
+
+ /// Error Status Register.
+ /// The WriteMask field is not used.
+ PCC_MAILBOX_REGISTER_INFO ErrorStatusReg;
+} CM_ARM_PCC_SUBSPACE_TYPE3_INFO;
+
+/** A structure that describes a
+ PCC Subspace of type 4 (Extended)
+
+ ID: EArmObjPccSubspaceType4Info
+*/
+typedef CM_ARM_PCC_SUBSPACE_TYPE3_INFO CM_ARM_PCC_SUBSPACE_TYPE4_INFO;
+
+/** A structure that describes a
+ PCC Subspace of type 5 (HW-Registers).
+
+ ID: EArmObjPccSubspaceType5Info
+*/
+typedef struct CmArmPccSubspaceType5Info {
+ /** Generic Pcc information.
+
+ The Subspace of Type0 contains information that can be re-used
+ in other Subspace types.
+
+ MaximumPeriodicAccessRate doesn't need to be populated for
+ this structure.
+ */
+ PCC_SUBSPACE_GENERIC_INFO GenericPccInfo;
+
+ /// Version.
+ UINT16 Version;
+
+ /// Platform Interrupt.
+ CM_ARM_GENERIC_INTERRUPT PlatIrq;
+
+ /// Command Complete Check Register.
+ /// The WriteMask field is not used.
+ PCC_MAILBOX_REGISTER_INFO CmdCompleteCheckReg;
+
+ /// Error Status Register.
+ /// The WriteMask field is not used.
+ PCC_MAILBOX_REGISTER_INFO ErrorStatusReg;
+} CM_ARM_PCC_SUBSPACE_TYPE5_INFO;
+
#pragma pack()
=20
#endif // ARM_NAMESPACE_OBJECTS_H_
diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/Configuration=
ManagerObjectParser.c b/DynamicTablesPkg/Library/Common/TableHelperLib/Co=
nfigurationManagerObjectParser.c
index 2126beba8b9f..21d1f3f08b16 100644
--- a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManager=
ObjectParser.c
+++ b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManager=
ObjectParser.c
@@ -539,6 +539,101 @@ STATIC CONST CM_OBJ_PARSER CmArmCpcInfoParser[] =3D=
{
{ "NominalFrequencyInteger", 4, =
"0x%lx", NULL },
};
=20
+/** A parser for the CM_ARM_MAILBOX_REGISTER_INFO struct.
+*/
+STATIC CONST CM_OBJ_PARSER CmArmMailboxRegisterInfoParser[] =3D {
+ { "Register", sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE), NUL=
L, NULL,
+ AcpiGenericAddressParser, ARRAY_SIZE (AcpiGenericAddressParser) },
+ { "PreserveMask", 8, "0x=
%llx", NULL },
+ { "WriteMask", 8, "0x=
%llx", NULL },
+};
+
+/** A parser for the CM_ARM_PCC_SUBSPACE_CHANNEL_TIMING_INFO struct.
+*/
+STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceChannelTimingInfoParser[] =3D=
{
+ { "NominalLatency", 4, "0x%x", NULL },
+ { "MaxPeriodicAccessRate", 4, "0x%x", NULL },
+ { "MinRequestTurnaroundTime", 2, "0x%x", NULL },
+};
+
+/** A parser for EArmObjPccSubspaceType0Info.
+*/
+STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceType0InfoParser[] =3D {
+ { "SubspaceId", 1, "=
0x%x", NULL },
+ { "Type", 1, "=
0x%x", NULL },
+ { "BaseAddress", 8, "=
0x%llx", NULL },
+ { "AddressLength", 8, "=
0x%llx", NULL },
+ { "DoorbellReg", sizeof (CM_ARM_MAILBOX_REGISTER_INFO),
+ NULL, NULL, CmArmMailboxRegisterInfoParser,
+ ARRAY_SIZE (CmArmMailboxRegisterInfoParser) },
+ { "DoorbellReg", sizeof (CM_ARM_PCC_SUBSPACE_CHANNEL_TIMING_INFO),
+ NULL, NULL, CmArmPccSubspaceChannelTimingInfoParser,
+ ARRAY_SIZE (CmArmPccSubspaceChannelTimingInfoParser) },
+};
+
+/** A parser for EArmObjPccSubspaceType1Info.
+*/
+STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceType1InfoParser[] =3D {
+ { "GenericPccInfo", sizeof (CM_ARM_PCC_SUBSPACE_GENERIC_INFO),
+ NULL, NULL, CmArmPccSubspaceType0InfoParser,
+ ARRAY_SIZE (CmArmPccSubspaceType0InfoParser) },
+ { "PlatIrq", sizeof (CM_ARM_GENERIC_INTERRUPT),
+ NULL, NULL, CmArmGenericInterruptParser,
+ ARRAY_SIZE (CmArmGenericInterruptParser) },
+};
+
+/** A parser for EArmObjPccSubspaceType2Info.
+*/
+STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceType2InfoParser[] =3D {
+ { "GenericPccInfo", sizeof (CM_ARM_PCC_SUBSPACE_GENERIC_INFO),
+ NULL, NULL, CmArmPccSubspaceType0InfoParser,
+ ARRAY_SIZE (CmArmPccSubspaceType0InfoParser) },
+ { "PlatIrq", sizeof (CM_ARM_GENERIC_INTERRUPT), NULL,NUL=
L,
+ CmArmGenericInterruptParser, ARRAY_SIZE (CmArmGenericInterruptParser=
) },
+ { "PlatIrqAckReg", sizeof (CM_ARM_MAILBOX_REGISTER_INFO),
+ NULL, NULL, CmArmMailboxRegisterInfoParser,
+ ARRAY_SIZE (CmArmMailboxRegisterInfoParser) },
+};
+
+/** A parser for EArmObjPccSubspaceType3Info or EArmObjPccSubspaceType4I=
nfo.
+*/
+STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceType34InfoParser[] =3D {
+ { "GenericPccInfo", sizeof (CM_ARM_PCC_SUBSPACE_GENERIC_INFO),
+ NULL, NULL, CmArmPccSubspaceType0InfoParser,
+ ARRAY_SIZE (CmArmPccSubspaceType0InfoParser) },
+ { "PlatIrq", sizeof (CM_ARM_GENERIC_INTERRUPT), NU=
LL,NULL,
+ CmArmGenericInterruptParser, ARRAY_SIZE (CmArmGenericInterruptParser=
) },
+ { "PlatIrqAckReg", sizeof (CM_ARM_MAILBOX_REGISTER_INFO),
+ NULL, NULL, CmArmMailboxRegisterInfoParser,
+ ARRAY_SIZE (CmArmMailboxRegisterInfoParser) },
+ { "CmdCompleteCheckReg", sizeof (CM_ARM_MAILBOX_REGISTER_INFO),
+ NULL, NULL, CmArmMailboxRegisterInfoParser,
+ ARRAY_SIZE (CmArmMailboxRegisterInfoParser) },
+ { "CmdCompleteUpdateReg", sizeof (CM_ARM_MAILBOX_REGISTER_INFO),
+ NULL, NULL, CmArmMailboxRegisterInfoParser,
+ ARRAY_SIZE (CmArmMailboxRegisterInfoParser) },
+ { "ErrorStatusReg", sizeof (CM_ARM_MAILBOX_REGISTER_INFO),
+ NULL, NULL, CmArmMailboxRegisterInfoParser,
+ ARRAY_SIZE (CmArmMailboxRegisterInfoParser) },
+};
+
+/** A parser for EArmObjPccSubspaceType5Info.
+*/
+STATIC CONST CM_OBJ_PARSER CmArmPccSubspaceType5InfoParser[] =3D {
+ { "GenericPccInfo", sizeof (CM_ARM_PCC_SUBSPACE_GENERIC_INFO),
+ NULL, NULL, CmArmPccSubspaceType0InfoParser,
+ ARRAY_SIZE (CmArmPccSubspaceType0InfoParser) },
+ { "Version", 2, "0x=
%x",NULL },
+ { "PlatIrq", sizeof (CM_ARM_GENERIC_INTERRUPT), NUL=
L, NULL,
+ CmArmGenericInterruptParser, ARRAY_SIZE (CmArmGenericInterruptParser=
) },
+ { "CmdCompleteCheckReg", sizeof (CM_ARM_MAILBOX_REGISTER_INFO),
+ NULL, NULL, CmArmMailboxRegisterInfoParser,
+ ARRAY_SIZE (CmArmMailboxRegisterInfoParser) },
+ { "ErrorStatusReg", sizeof (CM_ARM_MAILBOX_REGISTER_INFO),
+ NULL, NULL, CmArmMailboxRegisterInfoParser,
+ ARRAY_SIZE (CmArmMailboxRegisterInfoParser) },
+};
+
/** A parser for Arm namespace objects.
*/
STATIC CONST CM_OBJ_PARSER_ARRAY ArmNamespaceObjectParser[] =3D {
@@ -623,6 +718,18 @@ STATIC CONST CM_OBJ_PARSER_ARRAY ArmNamespaceObject=
Parser[] =3D {
ARRAY_SIZE (CmArmMemoryRangeDescriptorInfoParser) },
{ "EArmObjCpcInfo", CmArmCpcInfoParser,
ARRAY_SIZE (CmArmCpcInfoParser) },
+ { "EArmObjPccSubspaceType0Info", CmArmPccSubspaceType0InfoPars=
er,
+ ARRAY_SIZE (CmArmPccSubspaceType0InfoParser) },
+ { "EArmObjPccSubspaceType1Info", CmArmPccSubspaceType1InfoPars=
er,
+ ARRAY_SIZE (CmArmPccSubspaceType1InfoParser) },
+ { "EArmObjPccSubspaceType2Info", CmArmPccSubspaceType2InfoPars=
er,
+ ARRAY_SIZE (CmArmPccSubspaceType2InfoParser) },
+ { "EArmObjPccSubspaceType3Info", CmArmPccSubspaceType34InfoPar=
ser,
+ ARRAY_SIZE (CmArmPccSubspaceType34InfoParser) },
+ { "EArmObjPccSubspaceType4Info", CmArmPccSubspaceType34InfoPar=
ser,
+ ARRAY_SIZE (CmArmPccSubspaceType34InfoParser) },
+ { "EArmObjPccSubspaceType5Info", CmArmPccSubspaceType5InfoPars=
er,
+ ARRAY_SIZE (CmArmPccSubspaceType5InfoParser) },
{ "EArmObjMax", NULL, =
0 },
};
=20
--=20
2.25.1


[PATCH 09/14] DynamicTablesPkg: Fix Ssdt PCI generation comments

PierreGondois
 

From: Pierre Gondois <pierre.gondois@...>

The second model of the _PRT object is used. Indeed:
- the interrupts described are not re-configurable
- OSes are aware of the polarity of PCI legacy interrupts,
so there is no need to accurately describe the polarity.

Also, fix a comment for the CM_ARM_PCI_INTERRUPT_MAP_INFO obj.

Signed-off-by: Pierre Gondois <Pierre.Gondois@...>
---
DynamicTablesPkg/Include/ArmNameSpaceObjects.h | 2 +-
.../Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c | 8 ++------
2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h b/DynamicTabl=
esPkg/Include/ArmNameSpaceObjects.h
index cd39e609d6c4..d711f3ec5938 100644
--- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
@@ -1014,7 +1014,7 @@ typedef struct CmArmPciInterruptMapInfo {
/// Value on 8 bits (max 255).
UINT8 PciBus;
=20
- /// Pci Bus.
+ /// Pci Device.
/// Value on 5 bits (max 31).
UINT8 PciDevice;
=20
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPci=
eGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtP=
cieGenerator.c
index 85098752c614..c54ae6f551f6 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenera=
tor.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenera=
tor.c
@@ -288,12 +288,6 @@ GeneratePciDeviceInfo (
=20
Cf. ACPI 6.4 specification, s6.2.13 "_PRT (PCI Routing Table)"
=20
- The first model (defining a _CRS object) is used. This is necessary be=
cause
- PCI legacy interrupts are active low and GICv2 SPI interrupts are acti=
ve
- high.
- Even though PCI interrupts cannot be re-routed, only the first model a=
llows
- to specify the activation state (low/high).
-
@param [in] Generator The SSDT Pci generator.
@param [in] CfgMgrProtocol Pointer to the Configuration Manager
Protocol interface.
@@ -397,6 +391,8 @@ GeneratePrt (
High word-Device #, Low word-Function #. (for example, device 3,
function 2 is 0x00030002). To refer to all the functions on a dev=
ice #,
use a function number of FFFF).
+
+ Use the second model for _PRT object and describe a hardwired inte=
rrupt.
*/
Status =3D AmlAddPrtEntry (
(IrqMapInfo->PciDevice << 16) | 0xFFFF,
--=20
2.25.1


[PATCH 08/14] DynamicTablesPkg: FdtHwInfoParserLib: Remove wrong comment

PierreGondois
 

From: Pierre Gondois <pierre.gondois@...>

commit 13136cc3111f ("DynamicTablesPkg: FdtHwInfoParserLib:
Parse Pmu info")
adds support for pmu parsing. Thus, remove the wrong comment.

Signed-off-by: Pierre Gondois <pierre.gondois@...>
---
.../Library/FdtHwInfoParserLib/Gic/ArmGicCParser.c | 3 ---
.../Library/FdtHwInfoParserLib/Gic/ArmGicCParser.h | 3 ---
2 files changed, 6 deletions(-)

diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParse=
r.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.c
index fb01aa0d19e2..2c72bd0c582e 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.c
@@ -785,9 +785,6 @@ GicCPmuNodeParser (
UINT32 AffinityFlags; // {default =3D 0}
} CM_ARM_GICC_INFO;
=20
- The pmu information can be found in the pmu node. There is no support
- for now.
-
A parser parses a Device Tree to populate a specific CmObj type. None,
one or many CmObj can be created by the parser.
The created CmObj are then handed to the parser's caller through the
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParse=
r.h b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.h
index fd980484a28d..539f39cecb22 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.h
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.h
@@ -41,9 +41,6 @@
UINT32 AffinityFlags; // {default =3D 0}
} CM_ARM_GICC_INFO;
=20
- The pmu information can be found in the pmu node. There is no support
- for now.
-
A parser parses a Device Tree to populate a specific CmObj type. None,
one or many CmObj can be created by the parser.
The created CmObj are then handed to the parser's caller through the
--=20
2.25.1


[PATCH 07/14] DynamicTablesPkg: Remove deprecated APIs

PierreGondois
 

From: Pierre Gondois <pierre.gondois@...>

commit 691c5f776274 ("DynamicTablesPkg: Deprecate Crs specific methods
in AmlLib")
deprecates some APIs. Finally remove them.

Signed-off-by: Pierre Gondois <Pierre.Gondois@...>
---
.../Include/Library/AmlLib/AmlLib.h | 138 ------------------
.../Library/Common/AmlLib/Api/AmlApi.c | 85 -----------
.../AmlLib/CodeGen/AmlResourceDataCodeGen.c | 76 ----------
3 files changed, 299 deletions(-)

diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTa=
blesPkg/Include/Library/AmlLib/AmlLib.h
index 0d8446d78256..9210c5091548 100644
--- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
+++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
@@ -1390,142 +1390,4 @@ AmlCreateCpcNode (
OUT AML_OBJECT_NODE_HANDLE *NewCpcNode OPTIONAL
);
=20
-// DEPRECATED APIS
-#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
-
-/** DEPRECATED API
-
- Get the first Resource Data element contained in a "_CRS" object.
-
- In the following ASL code, the function will return the Resource Data
- node corresponding to the "QWordMemory ()" ASL macro.
- Name (_CRS, ResourceTemplate() {
- QWordMemory (...) {...},
- Interrupt (...) {...}
- }
- )
-
- Note:
- - The "_CRS" object must be declared using ASL "Name (Declare Named O=
bject)".
- - "_CRS" declared using ASL "Method (Declare Control Method)" is not
- supported.
-
- @ingroup UserApis
-
- @param [in] NameOpCrsNode NameOp object node defining a "_CRS" objec=
t.
- Must have an OpCode=3DAML_NAME_OP, SubOpCo=
de=3D0.
- NameOp object nodes are defined in ASL
- using the "Name ()" function.
- @param [out] OutRdNode Pointer to the first Resource Data element=
of
- the "_CRS" object. A Resource Data element
- is stored in a data node.
-
- @retval EFI_SUCCESS The function completed successfully.
- @retval EFI_INVALID_PARAMETER Invalid parameter.
-**/
-EFI_STATUS
-EFIAPI
-AmlNameOpCrsGetFirstRdNode (
- IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
- OUT AML_DATA_NODE_HANDLE *OutRdNode
- );
-
-/** DEPRECATED API
-
- Get the Resource Data element following the CurrRdNode Resource Data.
-
- In the following ASL code, if CurrRdNode corresponds to the first
- "QWordMemory ()" ASL macro, the function will return the Resource Data
- node corresponding to the "Interrupt ()" ASL macro.
- Name (_CRS, ResourceTemplate() {
- QwordMemory (...) {...},
- Interrupt (...) {...}
- }
- )
-
- The CurrRdNode Resource Data node must be defined in an object named "=
_CRS"
- and defined by a "Name ()" ASL function.
-
- @ingroup UserApis
-
- @param [in] CurrRdNode Pointer to the current Resource Data elemen=
t of
- the "_CRS" variable.
- @param [out] OutRdNode Pointer to the Resource Data element follow=
ing
- the CurrRdNode.
- Contain a NULL pointer if CurrRdNode is the
- last Resource Data element in the list.
- The "End Tag" is not considered as a resour=
ce
- data element and is not returned.
-
- @retval EFI_SUCCESS The function completed successfully.
- @retval EFI_INVALID_PARAMETER Invalid parameter.
-**/
-EFI_STATUS
-EFIAPI
-AmlNameOpCrsGetNextRdNode (
- IN AML_DATA_NODE_HANDLE CurrRdNode,
- OUT AML_DATA_NODE_HANDLE *OutRdNode
- );
-
-/** DEPRECATED API
-
- Add an Interrupt Resource Data node.
-
- This function creates a Resource Data element corresponding to the
- "Interrupt ()" ASL function, stores it in an AML Data Node.
-
- It then adds it after the input CurrRdNode in the list of resource dat=
a
- element.
-
- The Resource Data effectively created is an Extended Interrupt Resourc=
e
- Data. See ACPI 6.3 specification, s6.4.3.6 "Extended Interrupt Descrip=
tor"
- for more information about Extended Interrupt Resource Data.
-
- The Extended Interrupt contains one single interrupt.
-
- This function allocates memory to create a data node. It is the caller=
's
- responsibility to either:
- - attach this node to an AML tree;
- - delete this node.
-
- Note: The _CRS node must be defined using the ASL Name () function.
- e.g. Name (_CRS, ResourceTemplate () {
- ...
- }
-
- @ingroup CodeGenApis
-
- @param [in] NameOpCrsNode NameOp object node defining a "_CRS" ob=
ject.
- Must have an OpCode=3DAML_NAME_OP, SubO=
pCode=3D0.
- NameOp object nodes are defined in ASL
- using the "Name ()" function.
- @param [in] ResourceConsumer The device consumes the specified inter=
rupt
- or produces it for use by a child devic=
e.
- @param [in] EdgeTriggered The interrupt is edge triggered or
- level triggered.
- @param [in] ActiveLow The interrupt is active-high or active-=
low.
- @param [in] Shared The interrupt can be shared with other
- devices or not (Exclusive).
- @param [in] IrqList Interrupt list. Must be non-NULL.
- @param [in] IrqCount Interrupt count. Must be non-zero.
-
-
- @retval EFI_SUCCESS The function completed successfully.
- @retval EFI_INVALID_PARAMETER Invalid parameter.
- @retval EFI_OUT_OF_RESOURCES Could not allocate memory.
-**/
-EFI_STATUS
-EFIAPI
-AmlCodeGenCrsAddRdInterrupt (
- IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
- IN BOOLEAN ResourceConsumer,
- IN BOOLEAN EdgeTriggered,
- IN BOOLEAN ActiveLow,
- IN BOOLEAN Shared,
- IN UINT32 *IrqList,
- IN UINT8 IrqCount
- );
-
-#endif // DISABLE_NEW_DEPRECATED_INTERFACES
-
#endif // AML_LIB_H_
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c b/Dynami=
cTablesPkg/Library/Common/AmlLib/Api/AmlApi.c
index 519afdc1eafa..9f162abe2d09 100644
--- a/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c
+++ b/DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c
@@ -429,88 +429,3 @@ AmlAttachNode (
{
return AmlVarListAddTail (ParentNode, NewNode);
}
-
-// DEPRECATED APIS
-#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
-
-/** DEPRECATED API
-
- Get the first Resource Data element contained in a "_CRS" object.
-
- In the following ASL code, the function will return the Resource Data
- node corresponding to the "QWordMemory ()" ASL macro.
- Name (_CRS, ResourceTemplate() {
- QWordMemory (...) {...},
- Interrupt (...) {...}
- }
- )
-
- Note:
- - The "_CRS" object must be declared using ASL "Name (Declare Named O=
bject)".
- - "_CRS" declared using ASL "Method (Declare Control Method)" is not
- supported.
-
- @ingroup UserApis
-
- @param [in] NameOpCrsNode NameOp object node defining a "_CRS" objec=
t.
- Must have an OpCode=3DAML_NAME_OP, SubOpCo=
de=3D0.
- NameOp object nodes are defined in ASL
- using the "Name ()" function.
- @param [out] OutRdNode Pointer to the first Resource Data element=
of
- the "_CRS" object. A Resource Data element
- is stored in a data node.
-
- @retval EFI_SUCCESS The function completed successfully.
- @retval EFI_INVALID_PARAMETER Invalid parameter.
-**/
-EFI_STATUS
-EFIAPI
-AmlNameOpCrsGetFirstRdNode (
- IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
- OUT AML_DATA_NODE_HANDLE *OutRdNode
- )
-{
- return AmlNameOpGetFirstRdNode (NameOpCrsNode, OutRdNode);
-}
-
-/** DEPRECATED API
-
- Get the Resource Data element following the CurrRdNode Resource Data.
-
- In the following ASL code, if CurrRdNode corresponds to the first
- "QWordMemory ()" ASL macro, the function will return the Resource Data
- node corresponding to the "Interrupt ()" ASL macro.
- Name (_CRS, ResourceTemplate() {
- QwordMemory (...) {...},
- Interrupt (...) {...}
- }
- )
-
- The CurrRdNode Resource Data node must be defined in an object named "=
_CRS"
- and defined by a "Name ()" ASL function.
-
- @ingroup UserApis
-
- @param [in] CurrRdNode Pointer to the current Resource Data elemen=
t of
- the "_CRS" variable.
- @param [out] OutRdNode Pointer to the Resource Data element follow=
ing
- the CurrRdNode.
- Contain a NULL pointer if CurrRdNode is the
- last Resource Data element in the list.
- The "End Tag" is not considered as a resour=
ce
- data element and is not returned.
-
- @retval EFI_SUCCESS The function completed successfully.
- @retval EFI_INVALID_PARAMETER Invalid parameter.
-**/
-EFI_STATUS
-EFIAPI
-AmlNameOpCrsGetNextRdNode (
- IN AML_DATA_NODE_HANDLE CurrRdNode,
- OUT AML_DATA_NODE_HANDLE *OutRdNode
- )
-{
- return AmlNameOpGetNextRdNode (CurrRdNode, OutRdNode);
-}
-
-#endif // DISABLE_NEW_DEPRECATED_INTERFACES
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDa=
taCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceD=
ataCodeGen.c
index 32c3ab534d0b..332962bed441 100644
--- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeG=
en.c
+++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeG=
en.c
@@ -1406,79 +1406,3 @@ error_handler:
=20
return Status;
}
-
-// DEPRECATED APIS
-#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
-
-/** DEPRECATED API
-
- Add an Interrupt Resource Data node.
-
- This function creates a Resource Data element corresponding to the
- "Interrupt ()" ASL function, stores it in an AML Data Node.
-
- It then adds it after the input CurrRdNode in the list of resource dat=
a
- element.
-
- The Resource Data effectively created is an Extended Interrupt Resourc=
e
- Data. See ACPI 6.3 specification, s6.4.3.6 "Extended Interrupt Descrip=
tor"
- for more information about Extended Interrupt Resource Data.
-
- The Extended Interrupt contains one single interrupt.
-
- This function allocates memory to create a data node. It is the caller=
's
- responsibility to either:
- - attach this node to an AML tree;
- - delete this node.
-
- Note: The _CRS node must be defined using the ASL Name () function.
- e.g. Name (_CRS, ResourceTemplate () {
- ...
- }
-
- @ingroup UserApis
-
- @param [in] NameOpCrsNode NameOp object node defining a "_CRS" ob=
ject.
- Must have an OpCode=3DAML_NAME_OP, SubO=
pCode=3D0.
- NameOp object nodes are defined in ASL
- using the "Name ()" function.
- @param [in] ResourceConsumer The device consumes the specified inter=
rupt
- or produces it for use by a child devic=
e.
- @param [in] EdgeTriggered The interrupt is edge triggered or
- level triggered.
- @param [in] ActiveLow The interrupt is active-high or active-=
low.
- @param [in] Shared The interrupt can be shared with other
- devices or not (Exclusive).
- @param [in] IrqList Interrupt list. Must be non-NULL.
- @param [in] IrqCount Interrupt count. Must be non-zero.
-
-
- @retval EFI_SUCCESS The function completed successfully.
- @retval EFI_INVALID_PARAMETER Invalid parameter.
- @retval EFI_OUT_OF_RESOURCES Could not allocate memory.
-**/
-EFI_STATUS
-EFIAPI
-AmlCodeGenCrsAddRdInterrupt (
- IN AML_OBJECT_NODE_HANDLE NameOpCrsNode,
- IN BOOLEAN ResourceConsumer,
- IN BOOLEAN EdgeTriggered,
- IN BOOLEAN ActiveLow,
- IN BOOLEAN Shared,
- IN UINT32 *IrqList,
- IN UINT8 IrqCount
- )
-{
- return AmlCodeGenRdInterrupt (
- ResourceConsumer,
- EdgeTriggered,
- ActiveLow,
- Shared,
- IrqList,
- IrqCount,
- NameOpCrsNode,
- NULL
- );
-}
-
-#endif // DISABLE_NEW_DEPRECATED_INTERFACES
--=20
2.25.1


[PATCH 06/14] DynamicTablesPkg: Fix wrong/missing fields in CmObjParser

PierreGondois
 

From: Pierre Gondois <pierre.gondois@...>

Add missing fields to the following CmObjParser objects:
- EArmObjGicDInfo
- EArmObjCacheInfo
and fix wrong formatting of:
- EArmObjLpiInfo

Signed-off-by: Pierre Gondois <Pierre.Gondois@...>
---
.../ConfigurationManagerObjectParser.c | 24 ++++++++++---------
1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/Configuration=
ManagerObjectParser.c b/DynamicTablesPkg/Library/Common/TableHelperLib/Co=
nfigurationManagerObjectParser.c
index 040aaa4cbb17..2126beba8b9f 100644
--- a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManager=
ObjectParser.c
+++ b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManager=
ObjectParser.c
@@ -303,7 +303,8 @@ STATIC CONST CM_OBJ_PARSER CmArmProcHierarchyInfoPar=
ser[] =3D {
{ "ParentToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL=
},
{ "GicCToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL=
},
{ "NoOfPrivateResources", 4, "0x%x", NULL=
},
- { "PrivateResourcesArrayToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL=
}
+ { "PrivateResourcesArrayToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL=
},
+ { "LpiToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL=
},
};
=20
/** A parser for EArmObjCacheInfo.
@@ -315,7 +316,8 @@ STATIC CONST CM_OBJ_PARSER CmArmCacheInfoParser[] =3D=
{
{ "NumberOfSets", 4, "0x%x", NULL },
{ "Associativity", 4, "0x%x", NULL },
{ "Attributes", 1, "0x%x", NULL },
- { "LineSize", 2, "0x%x", NULL }
+ { "LineSize", 2, "0x%x", NULL },
+ { "CacheId", 4, "0x%x", NULL },
};
=20
/** A parser for EArmObjProcNodeIdInfo.
@@ -400,14 +402,14 @@ STATIC CONST CM_OBJ_PARSER AcpiGenericAddressParse=
r[] =3D {
/** A parser for EArmObjLpiInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmLpiInfoParser[] =3D {
- { "MinResidency", 4, =
"0x%x", NULL },
- { "WorstCaseWakeLatency", 4, =
"0x%x", NULL },
- { "Flags", 4, =
"0x%x", NULL },
- { "ArchFlags", 4, =
"0x%x", NULL },
- { "ResCntFreq", 4, =
"0x%x", NULL },
- { "EnableParentState", 4, =
"0x%x", NULL },
- { "IsInteger", 1, =
"%d", NULL },
- { "IntegerEntryMethod", 8, =
"0x%llx", NULL },
+ { "MinResidency", 4, =
"0x%x", NULL },
+ { "WorstCaseWakeLatency", 4, =
"0x%x", NULL },
+ { "Flags", 4, =
"0x%x", NULL },
+ { "ArchFlags", 4, =
"0x%x", NULL },
+ { "ResCntFreq", 4, =
"0x%x", NULL },
+ { "EnableParentState", 4, =
"0x%x", NULL },
+ { "IsInteger", 1, =
"%d", NULL },
+ { "IntegerEntryMethod", 8, =
"0x%llx", NULL },
{ "RegisterEntryMethod", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STR=
UCTURE),
NULL, NULL, AcpiGenericAddressParser,
ARRAY_SIZE (AcpiGenericAddressParser) },
@@ -417,7 +419,7 @@ STATIC CONST CM_OBJ_PARSER CmArmLpiInfoParser[] =3D =
{
{ "UsageCounterRegister", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STR=
UCTURE),
NULL, NULL, AcpiGenericAddressParser,
ARRAY_SIZE (AcpiGenericAddressParser) },
- { "StateName", 16, =
"0x%a", NULL },
+ { "StateName", 16, =
"NULL", PrintString },
};
=20
/** A parser for EArmObjPciAddressMapInfo.
--=20
2.25.1


[PATCH 05/14] DynamicTablesPkg: Fix GTBlock and GTBlockTimerFrame CmObjParsers

PierreGondois
 

From: Pierre Gondois <pierre.gondois@...>

The CmObjParsers of the following objects was inverted, probably
due to a wrong ordering placement in the file defining the structures:
-EArmObjGTBlockTimerFrameInfo
-EArmObjPlatformGTBlockInfo

Assign the correct parser for each object, and re-order the
structures in the file defining them.

Signed-off-by: Pierre Gondois <Pierre.Gondois@...>
---
.../Include/ArmNameSpaceObjects.h | 32 +++++++++----------
.../ConfigurationManagerObjectParser.c | 22 ++++++-------
2 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h b/DynamicTabl=
esPkg/Include/ArmNameSpaceObjects.h
index c66b441d532d..cd39e609d6c4 100644
--- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
@@ -353,6 +353,22 @@ typedef struct CmArmGenericTimerInfo {
UINT32 VirtualPL2TimerFlags;
} CM_ARM_GENERIC_TIMER_INFO;
=20
+/** A structure that describes the
+ Platform Generic Block Timer information for the Platform.
+
+ ID: EArmObjPlatformGTBlockInfo
+*/
+typedef struct CmArmGTBlockInfo {
+ /// The physical base address for the GT Block Timer structure
+ UINT64 GTBlockPhysicalAddress;
+
+ /// The number of timer frames implemented in the GT Block
+ UINT32 GTBlockTimerFrameCount;
+
+ /// Reference token for the GT Block timer frame list
+ CM_OBJECT_TOKEN GTBlockTimerFrameToken;
+} CM_ARM_GTBLOCK_INFO;
+
/** A structure that describes the
Platform Generic Block Timer Frame information for the Platform.
=20
@@ -390,22 +406,6 @@ typedef struct CmArmGTBlockTimerFrameInfo {
UINT32 CommonFlags;
} CM_ARM_GTBLOCK_TIMER_FRAME_INFO;
=20
-/** A structure that describes the
- Platform Generic Block Timer information for the Platform.
-
- ID: EArmObjPlatformGTBlockInfo
-*/
-typedef struct CmArmGTBlockInfo {
- /// The physical base address for the GT Block Timer structure
- UINT64 GTBlockPhysicalAddress;
-
- /// The number of timer frames implemented in the GT Block
- UINT32 GTBlockTimerFrameCount;
-
- /// Reference token for the GT Block timer frame list
- CM_OBJECT_TOKEN GTBlockTimerFrameToken;
-} CM_ARM_GTBLOCK_INFO;
-
/** A structure that describes the
Arm Generic Watchdog information for the Platform.
=20
diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/Configuration=
ManagerObjectParser.c b/DynamicTablesPkg/Library/Common/TableHelperLib/Co=
nfigurationManagerObjectParser.c
index f82541240ae0..040aaa4cbb17 100644
--- a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManager=
ObjectParser.c
+++ b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManager=
ObjectParser.c
@@ -127,6 +127,14 @@ STATIC CONST CM_OBJ_PARSER CmArmGenericTimerInfoPar=
ser[] =3D {
=20
/** A parser for EArmObjPlatformGTBlockInfo.
*/
+STATIC CONST CM_OBJ_PARSER CmArmGTBlockInfoParser[] =3D {
+ { "GTBlockPhysicalAddress", 8, "0x%llx", NULL }=
,
+ { "GTBlockTimerFrameCount", 4, "0x%x", NULL }=
,
+ { "GTBlockTimerFrameToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }
+};
+
+/** A parser for EArmObjGTBlockTimerFrameInfo.
+*/
STATIC CONST CM_OBJ_PARSER CmArmGTBlockTimerFrameInfoParser[] =3D {
{ "FrameNumber", 1, "0x%x", NULL },
{ "PhysicalAddressCntBase", 8, "0x%llx", NULL },
@@ -138,14 +146,6 @@ STATIC CONST CM_OBJ_PARSER CmArmGTBlockTimerFrameIn=
foParser[] =3D {
{ "CommonFlags", 4, "0x%x", NULL }
};
=20
-/** A parser for EArmObjGTBlockTimerFrameInfo.
-*/
-STATIC CONST CM_OBJ_PARSER CmArmGTBlockInfoParser[] =3D {
- { "GTBlockPhysicalAddress", 8, "0x%llx", NULL }=
,
- { "GTBlockTimerFrameCount", 4, "0x%x", NULL }=
,
- { "GTBlockTimerFrameToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }
-};
-
/** A parser for EArmObjPlatformGenericWatchdogInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmGenericWatchdogInfoParser[] =3D {
@@ -560,10 +560,10 @@ STATIC CONST CM_OBJ_PARSER_ARRAY ArmNamespaceObjec=
tParser[] =3D {
ARRAY_SIZE (CmArmSerialPortInfoParser) },
{ "EArmObjGenericTimerInfo", CmArmGenericTimerInfoParser,
ARRAY_SIZE (CmArmGenericTimerInfoParser) },
- { "EArmObjPlatformGTBlockInfo", CmArmGTBlockTimerFrameInfoPar=
ser,
- ARRAY_SIZE (CmArmGTBlockTimerFrameInfoParser) },
- { "EArmObjGTBlockTimerFrameInfo", CmArmGTBlockInfoParser,
+ { "EArmObjPlatformGTBlockInfo", CmArmGTBlockInfoParser,
ARRAY_SIZE (CmArmGTBlockInfoParser) },
+ { "EArmObjGTBlockTimerFrameInfo", CmArmGTBlockTimerFrameInfoPar=
ser,
+ ARRAY_SIZE (CmArmGTBlockTimerFrameInfoParser) },
{ "EArmObjPlatformGenericWatchdogInfo", CmArmGenericWatchdogInfoParse=
r,
ARRAY_SIZE (CmArmGenericWatchdogInfoParser) },
{ "EArmObjPciConfigSpaceInfo", CmArmPciConfigSpaceInfoParser=
,
--=20
2.25.1


[PATCH 04/14] DynamicTablesPkg: Update CmObjParser for MinorRevision

PierreGondois
 

From: Pierre Gondois <pierre.gondois@...>

commit 0d23c447d6f5 ("DynamicTablesPkg: Add support to specify FADT
minor revision")
adds new 'MinorRevision' field to CM_STD_OBJ_ACPI_TABLE_INFO.
Reflect the change in this patch to the CmObjectParser.

Signed-off-by: Pierre Gondois <Pierre.Gondois@...>
---
.../Common/TableHelperLib/ConfigurationManagerObjectParser.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/Configuration=
ManagerObjectParser.c b/DynamicTablesPkg/Library/Common/TableHelperLib/Co=
nfigurationManagerObjectParser.c
index 80ebb0708661..f82541240ae0 100644
--- a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManager=
ObjectParser.c
+++ b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManager=
ObjectParser.c
@@ -639,7 +639,8 @@ STATIC CONST CM_OBJ_PARSER StdObjAcpiTableInfoParser=
[] =3D {
{ "TableGeneratorId", sizeof (ACPI_TABLE_GENERATOR_ID), "0x%x"=
, NULL },
{ "AcpiTableData", sizeof (EFI_ACPI_DESCRIPTION_HEADER *), "0x%p"=
, NULL },
{ "OemTableId", 8, "0x%LL=
X", NULL },
- { "OemRevision", 4, "0x%x"=
, NULL }
+ { "OemRevision", 4, "0x%x"=
, NULL },
+ { "MinorRevision", 1, "0x%x"=
, NULL },
};
=20
/** A parser for EStdObjSmbiosTableList.
--=20
2.25.1


[PATCH 03/14] DynamicTablesPkg: Update CmObjParser for IORT Rev E.d

PierreGondois
 

From: Pierre Gondois <pierre.gondois@...>

commit de200b7e2c3c ("DynamicTablesPkg: Update ArmNameSpaceObjects for
IORT Rev E.d")
adds new CmObj structures and fields to the ArmNameSpaceObjects.
Update the CmObjectParser accordingly.

Signed-off-by: Pierre Gondois <Pierre.Gondois@...>
---
.../ConfigurationManagerObjectParser.c | 59 ++++++++++++++-----
1 file changed, 45 insertions(+), 14 deletions(-)

diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/Configuration=
ManagerObjectParser.c b/DynamicTablesPkg/Library/Common/TableHelperLib/Co=
nfigurationManagerObjectParser.c
index b46f19693bb5..80ebb0708661 100644
--- a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManager=
ObjectParser.c
+++ b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManager=
ObjectParser.c
@@ -183,21 +183,23 @@ STATIC CONST CM_OBJ_PARSER CmArmFixedFeatureFlagsP=
arser[] =3D {
STATIC CONST CM_OBJ_PARSER CmArmItsGroupNodeParser[] =3D {
{ "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{ "ItsIdCount", 4, "0x%x", NULL },
- { "ItsIdToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }
+ { "ItsIdToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
+ { "Identifier", 4, "0x%x", NULL },
};
=20
/** A parser for EArmObjNamedComponent.
*/
STATIC CONST CM_OBJ_PARSER CmArmNamedComponentNodeParser[] =3D {
- { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
- { "IdMappingCount", 4, "0x%x", NULL },
- { "IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
- { "Flags", 4, "0x%x", NULL },
- { "CacheCoherent", 4, "0x%x", NULL },
- { "AllocationHints", 1, "0x%x", NULL },
- { "MemoryAccessFlags", 1, "0x%x", NULL },
- { "AddressSizeLimit", 1, "0x%x", NULL },
- { "ObjectName", sizeof (CHAR8 *), "%a", NULL }
+ { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }=
,
+ { "IdMappingCount", 4, "0x%x", NULL }=
,
+ { "IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }=
,
+ { "Flags", 4, "0x%x", NULL }=
,
+ { "CacheCoherent", 4, "0x%x", NULL }=
,
+ { "AllocationHints", 1, "0x%x", NULL }=
,
+ { "MemoryAccessFlags", 1, "0x%x", NULL }=
,
+ { "AddressSizeLimit", 1, "0x%x", NULL }=
,
+ { "ObjectName", 1, NULL, PrintString }=
,
+ { "Identifier", 4, "0x%x", NULL }=
,
};
=20
/** A parser for EArmObjRootComplex.
@@ -211,7 +213,10 @@ STATIC CONST CM_OBJ_PARSER CmArmRootComplexNodePars=
er[] =3D {
{ "MemoryAccessFlags", 1, "0x%x", NULL },
{ "AtsAttribute", 4, "0x%x", NULL },
{ "PciSegmentNumber", 4, "0x%x", NULL },
- { "MemoryAddressSize", 1, "0x%x", NULL }
+ { "MemoryAddressSize", 1, "0x%x", NULL },
+ { "PasidCapabilities", 2, "0x%x", NULL },
+ { "Flags", 4, "0x%x", NULL },
+ { "Identifier", 4, "0x%x", NULL },
};
=20
/** A parser for EArmObjSmmuV1SmmuV2.
@@ -231,7 +236,8 @@ STATIC CONST CM_OBJ_PARSER CmArmSmmuV1SmmuV2NodePars=
er[] =3D {
{ "SMMU_NSgIrpt", 4, "0x%x", NULL },
{ "SMMU_NSgIrptFlags", 4, "0x%x", NULL },
{ "SMMU_NSgCfgIrpt", 4, "0x%x", NULL },
- { "SMMU_NSgCfgIrptFlags", 4, "0x%x", NULL }
+ { "SMMU_NSgCfgIrptFlags", 4, "0x%x", NULL },
+ { "Identifier", 4, "0x%x", NULL },
};
=20
/** A parser for EArmObjSmmuV3.
@@ -249,7 +255,8 @@ STATIC CONST CM_OBJ_PARSER CmArmSmmuV3NodeParser[] =3D=
{
{ "GerrInterrupt", 4, "0x%x", NULL },
{ "SyncInterrupt", 4, "0x%x", NULL },
{ "ProximityDomain", 4, "0x%x", NULL },
- { "DeviceIdMappingIndex", 4, "0x%x", NULL }
+ { "DeviceIdMappingIndex", 4, "0x%x", NULL },
+ { "Identifier", 4, "0x%x", NULL },
};
=20
/** A parser for EArmObjPmcg.
@@ -261,7 +268,8 @@ STATIC CONST CM_OBJ_PARSER CmArmPmcgNodeParser[] =3D=
{
{ "BaseAddress", 8, "0x%llx", NULL },
{ "OverflowInterrupt", 4, "0x%x", NULL },
{ "Page1BaseAddress", 8, "0x%llx", NULL },
- { "ReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }
+ { "ReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
+ { "Identifier", 4, "0x%x", NULL },
};
=20
/** A parser for EArmObjGicItsIdentifierArray.
@@ -432,6 +440,25 @@ STATIC CONST CM_OBJ_PARSER CmPciInterruptMapInfoPar=
ser[] =3D {
ARRAY_SIZE (CmArmGenericInterruptParser) },
};
=20
+/** A parser for EArmObjRmr.
+*/
+STATIC CONST CM_OBJ_PARSER CmArmRmrInfoParser[] =3D {
+ { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
+ { "IdMappingCount", 4, "0x%x", NULL },
+ { "IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
+ { "Identifier", 4, "0x%x", NULL },
+ { "Flags", 4, "0x%x", NULL },
+ { "MemRangeDescCount", 4, "0x%x", NULL },
+ { "MemRangeDescToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
+};
+
+/** A parser for EArmObjMemoryRangeDescriptor.
+*/
+STATIC CONST CM_OBJ_PARSER CmArmMemoryRangeDescriptorInfoParser[] =3D {
+ { "BaseAddress", 8, "0x%llx", NULL },
+ { "Length", 8, "0x%llx", NULL },
+};
+
/** A parser for EArmObjCpcInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArmCpcInfoParser[] =3D {
@@ -588,6 +615,10 @@ STATIC CONST CM_OBJ_PARSER_ARRAY ArmNamespaceObject=
Parser[] =3D {
ARRAY_SIZE (CmArmPciAddressMapInfoParser) },
{ "EArmObjPciInterruptMapInfo", CmPciInterruptMapInfoParser,
ARRAY_SIZE (CmPciInterruptMapInfoParser) },
+ { "EArmObjRmr", CmArmRmrInfoParser,
+ ARRAY_SIZE (CmArmRmrInfoParser) },
+ { "EArmObjMemoryRangeDescriptor", CmArmMemoryRangeDescriptorInf=
oParser,
+ ARRAY_SIZE (CmArmMemoryRangeDescriptorInfoParser) },
{ "EArmObjCpcInfo", CmArmCpcInfoParser,
ARRAY_SIZE (CmArmCpcInfoParser) },
{ "EArmObjMax", NULL, =
0 },
--=20
2.25.1