* [PATCH edk2-platforms v1 1/6] Platform/ARM: FVP: Remove usage of function macros
2021-01-22 13:29 [PATCH edk2-platforms v1 0/6] Fix platform support for dynamic tables framework Sami Mujawar
@ 2021-01-22 13:29 ` Sami Mujawar
2021-01-22 13:29 ` [PATCH edk2-platforms v1 2/6] Platform/ARM: Juno: " Sami Mujawar
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Sami Mujawar @ 2021-01-22 13:29 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, ard.biesheuvel, leif, thomas.abraham,
Matteo.Carlini, Ben.Adderson, nd
The Configuration Manager code for FVP uses function macros to
prepare and return CM objects.
However, according to section 5.5.2.1 of the edk2 coding standard,
use of functional macros is not allowed.
See https://edk2-docs.gitbook.io/edk-ii-c-coding-standards-specification/
5_source_files/55_preprocessor_directives#5-5-2-1-functional-macros-are-
generally-discouraged
Therefore, replace the function macros with static helper functions.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c | 347 ++++++++++++++------
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h | 73 +---
2 files changed, 266 insertions(+), 154 deletions(-)
diff --git a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
index a48eb0285c60177078324bdbcd8fa29c308e6a13..3298f9f9f79a2b23f181d3e961298f1c366976ee 100644
--- a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
+++ b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
@@ -1,7 +1,7 @@
/** @file
Configuration Manager Dxe
- Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
+ Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -219,6 +219,98 @@ EDKII_PLATFORM_REPOSITORY_INFO VExpressPlatRepositoryInfo = {
}
};
+/** A helper function for returning the Configuration Manager Objects.
+
+ @param [in] CmObjectId The Configuration Manager Object ID.
+ @param [in] Object Pointer to the Object(s).
+ @param [in] ObjectSize Total size of the Object(s).
+ @param [in] ObjectCount Number of Objects.
+ @param [in, out] CmObjectDesc Pointer to the Configuration Manager Object
+ descriptor describing the requested Object.
+
+ @retval EFI_SUCCESS Success.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+HandleCmObject (
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN VOID * Object,
+ IN CONST UINTN ObjectSize,
+ IN CONST UINTN ObjectCount,
+ IN OUT CM_OBJ_DESCRIPTOR * CONST CmObjectDesc
+ )
+{
+ CmObjectDesc->ObjectId = CmObjectId;
+ CmObjectDesc->Size = ObjectSize;
+ CmObjectDesc->Data = (VOID*)Object;
+ CmObjectDesc->Count = ObjectCount;
+ DEBUG ((
+ DEBUG_INFO,
+ "INFO: CmObjectId = %x, Ptr = 0x%p, Size = %d, Count = %d\n",
+ CmObjectId,
+ CmObjectDesc->Data,
+ CmObjectDesc->Size,
+ CmObjectDesc->Count
+ ));
+ return EFI_SUCCESS;
+}
+
+/** A helper function for returning the Configuration Manager Objects that
+ match the token.
+
+ @param [in] This Pointer to the Configuration Manager Protocol.
+ @param [in] CmObjectId The Configuration Manager Object ID.
+ @param [in] Object Pointer to the Object(s).
+ @param [in] ObjectSize Total size of the Object(s).
+ @param [in] ObjectCount Number of Objects.
+ @param [in] Token A token identifying the object.
+ @param [in] HandlerProc A handler function to search the object
+ referenced by the token.
+ @param [in, out] CmObjectDesc Pointer to the Configuration Manager Object
+ descriptor describing the requested Object.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object information is not found.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+HandleCmObjectRefByToken (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST This,
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN VOID * Object,
+ IN CONST UINTN ObjectSize,
+ IN CONST UINTN ObjectCount,
+ IN CONST CM_OBJECT_TOKEN Token,
+ IN CONST CM_OBJECT_HANDLER_PROC HandlerProc,
+ IN OUT CM_OBJ_DESCRIPTOR * CONST CmObjectDesc
+ )
+{
+ EFI_STATUS Status;
+ CmObjectDesc->ObjectId = CmObjectId;
+ if (Token == CM_NULL_TOKEN) {
+ CmObjectDesc->Size = ObjectSize;
+ CmObjectDesc->Data = (VOID*)Object;
+ CmObjectDesc->Count = ObjectCount;
+ Status = EFI_SUCCESS;
+ } else {
+ Status = HandlerProc (This, CmObjectId, Token, CmObjectDesc);
+ }
+
+ DEBUG ((
+ DEBUG_INFO,
+ "INFO: Token = 0x%p, CmObjectId = %x, Ptr = 0x%p, Size = %d, Count = %d\n",
+ (VOID*)Token,
+ CmObjectId,
+ CmObjectDesc->Data,
+ CmObjectDesc->Size,
+ CmObjectDesc->Count
+ ));
+ return Status;
+}
+
/** Initialize the platform configuration repository.
@param [in] This Pointer to the Configuration Manager Protocol.
@@ -304,28 +396,36 @@ GetStandardNameSpaceObject (
EFI_STATUS Status;
EDKII_PLATFORM_REPOSITORY_INFO * PlatformRepo;
- Status = EFI_SUCCESS;
if ((This == NULL) || (CmObject == NULL)) {
ASSERT (This != NULL);
ASSERT (CmObject != NULL);
return EFI_INVALID_PARAMETER;
}
+
+ Status = EFI_NOT_FOUND;
PlatformRepo = This->PlatRepoInfo;
switch (GET_CM_OBJECT_ID (CmObjectId)) {
- HANDLE_CM_OBJECT (
- EStdObjCfgMgrInfo,
- CmObjectId,
- PlatformRepo->CmInfo,
- 1
- );
- HANDLE_CM_OBJECT (
- EStdObjAcpiTableList,
- CmObjectId,
- PlatformRepo->CmAcpiTableList,
- (sizeof (PlatformRepo->CmAcpiTableList) /
- sizeof (PlatformRepo->CmAcpiTableList[0]))
- );
+ case EStdObjCfgMgrInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->CmInfo,
+ sizeof (PlatformRepo->CmInfo),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EStdObjAcpiTableList:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->CmAcpiTableList,
+ sizeof (PlatformRepo->CmAcpiTableList),
+ ARRAY_SIZE (PlatformRepo->CmAcpiTableList),
+ CmObject
+ );
+ break;
+
default: {
Status = EFI_NOT_FOUND;
DEBUG ((
@@ -366,100 +466,149 @@ GetArmNameSpaceObject (
EFI_STATUS Status;
EDKII_PLATFORM_REPOSITORY_INFO * PlatformRepo;
- Status = EFI_SUCCESS;
if ((This == NULL) || (CmObject == NULL)) {
ASSERT (This != NULL);
ASSERT (CmObject != NULL);
return EFI_INVALID_PARAMETER;
}
+
+ Status = EFI_NOT_FOUND;
PlatformRepo = This->PlatRepoInfo;
switch (GET_CM_OBJECT_ID (CmObjectId)) {
- HANDLE_CM_OBJECT (
- EArmObjBootArchInfo,
- CmObjectId,
- PlatformRepo->BootArchInfo,
- 1
- );
+ case EArmObjBootArchInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->BootArchInfo,
+ sizeof (PlatformRepo->BootArchInfo),
+ 1,
+ CmObject
+ );
+ break;
+
#ifdef HEADLESS_PLATFORM
- HANDLE_CM_OBJECT (
- EArmObjFixedFeatureFlags,
- CmObjectId,
- PlatformRepo->FixedFeatureFlags,
- 1
- );
+ case EArmObjFixedFeatureFlags:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->FixedFeatureFlags,
+ sizeof (PlatformRepo->FixedFeatureFlags),
+ 1,
+ CmObject
+ );
+ break;
#endif
- HANDLE_CM_OBJECT (
- EArmObjPowerManagementProfileInfo,
- CmObjectId,
- PlatformRepo->PmProfileInfo,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjGenericTimerInfo,
- CmObjectId,
- PlatformRepo->GenericTimerInfo,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjPlatformGenericWatchdogInfo,
- CmObjectId,
- PlatformRepo->Watchdog,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjPlatformGTBlockInfo,
- CmObjectId,
- PlatformRepo->GTBlockInfo,
- (sizeof (PlatformRepo->GTBlockInfo) /
- sizeof (PlatformRepo->GTBlockInfo[0]))
- );
- HANDLE_CM_OBJECT_REF_BY_TOKEN (
- EArmObjGTBlockTimerFrameInfo,
- CmObjectId,
- PlatformRepo->GTBlock0TimerInfo,
- (sizeof (PlatformRepo->GTBlock0TimerInfo) /
- sizeof (PlatformRepo->GTBlock0TimerInfo[0])),
- Token,
- GetGTBlockTimerFrameInfo
- );
- HANDLE_CM_OBJECT (
- EArmObjGicCInfo,
- CmObjectId,
- PlatformRepo->GicCInfo,
- (sizeof (PlatformRepo->GicCInfo) /
- sizeof (PlatformRepo->GicCInfo[0]))
- );
- HANDLE_CM_OBJECT (
- EArmObjGicDInfo,
- CmObjectId,
- PlatformRepo->GicDInfo,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjGicRedistributorInfo,
- CmObjectId,
- PlatformRepo->GicRedistInfo,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjSerialConsolePortInfo,
- CmObjectId,
- PlatformRepo->SpcrSerialPort,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjSerialDebugPortInfo,
- CmObjectId,
- PlatformRepo->DbgSerialPort,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjGicItsInfo,
- CmObjectId,
- PlatformRepo->GicItsInfo,
- 1
- );
+ case EArmObjPowerManagementProfileInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->PmProfileInfo,
+ sizeof (PlatformRepo->PmProfileInfo),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjGenericTimerInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->GenericTimerInfo,
+ sizeof (PlatformRepo->GenericTimerInfo),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjPlatformGenericWatchdogInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->Watchdog,
+ sizeof (PlatformRepo->Watchdog),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjPlatformGTBlockInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ PlatformRepo->GTBlockInfo,
+ sizeof (PlatformRepo->GTBlockInfo),
+ ARRAY_SIZE (PlatformRepo->GTBlockInfo),
+ CmObject
+ );
+ break;
+
+ case EArmObjGTBlockTimerFrameInfo:
+ Status = HandleCmObjectRefByToken (
+ This,
+ CmObjectId,
+ PlatformRepo->GTBlock0TimerInfo,
+ sizeof (PlatformRepo->GTBlock0TimerInfo),
+ ARRAY_SIZE (PlatformRepo->GTBlock0TimerInfo),
+ Token,
+ GetGTBlockTimerFrameInfo,
+ CmObject
+ );
+ break;
+
+ case EArmObjGicCInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ PlatformRepo->GicCInfo,
+ sizeof (PlatformRepo->GicCInfo),
+ ARRAY_SIZE (PlatformRepo->GicCInfo),
+ CmObject
+ );
+ break;
+
+ case EArmObjGicDInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->GicDInfo,
+ sizeof (PlatformRepo->GicDInfo),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjGicRedistributorInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->GicRedistInfo,
+ sizeof (PlatformRepo->GicRedistInfo),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjSerialConsolePortInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->SpcrSerialPort,
+ sizeof (PlatformRepo->SpcrSerialPort),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjSerialDebugPortInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->DbgSerialPort,
+ sizeof (PlatformRepo->DbgSerialPort),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjGicItsInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->GicItsInfo,
+ sizeof (PlatformRepo->GicItsInfo),
+ 1,
+ CmObject
+ );
+ break;
default: {
Status = EFI_NOT_FOUND;
diff --git a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
index 6fb959ab7ae2c77f750781d05660957488fae8cd..c25ba9fac52fe049236948185dfc052c44a71e4b 100644
--- a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
+++ b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
@@ -1,6 +1,6 @@
/** @file
- Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
+ Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -52,61 +52,24 @@ extern CHAR8 dsdt_aml_code[];
EnergyEfficiency /* UINT8 ProcessorPowerEfficiencyClass*/ \
}
-/** A helper macro for returning configuration manager objects
-*/
-#define HANDLE_CM_OBJECT(ObjId, CmObjectId, Object, ObjectCount) \
- case ObjId: { \
- CmObject->ObjectId = CmObjectId; \
- CmObject->Size = sizeof (Object); \
- CmObject->Data = (VOID*)&Object; \
- CmObject->Count = ObjectCount; \
- DEBUG (( \
- DEBUG_INFO, \
- #CmObjectId ": Ptr = 0x%p, Size = %d, Count = %d\n", \
- CmObject->Data, \
- CmObject->Size, \
- CmObject->Count \
- )); \
- break; \
- }
+/** A function that prepares Configuration Manager Objects for returning.
-/** A helper macro for returning configuration manager objects
- referenced by token
-*/
-#define HANDLE_CM_OBJECT_REF_BY_TOKEN( \
- ObjId, \
- CmObjectId, \
- Object, \
- ObjectCount, \
- Token, \
- HandlerProc \
- ) \
- case ObjId: { \
- CmObject->ObjectId = CmObjectId; \
- if (Token == CM_NULL_TOKEN) { \
- CmObject->Size = sizeof (Object); \
- CmObject->Data = (VOID*)&Object; \
- CmObject->Count = ObjectCount; \
- DEBUG (( \
- DEBUG_INFO, \
- #CmObjectId ": Ptr = 0x%p, Size = %d, Count = %d\n", \
- CmObject->Data, \
- CmObject->Size, \
- CmObject->Count \
- )); \
- } else { \
- Status = HandlerProc (This, CmObjectId, Token, CmObject); \
- DEBUG (( \
- DEBUG_INFO, \
- #CmObjectId ": Token = 0x%p, Ptr = 0x%p, Size = %d, Count = %d\n", \
- (VOID*)Token, \
- CmObject->Data, \
- CmObject->Size, \
- CmObject->Count \
- )); \
- } \
- break; \
- }
+ @param [in] This Pointer to the Configuration Manager Protocol.
+ @param [in] CmObjectId The Configuration Manager Object ID.
+ @param [in] Token A token for identifying the object.
+ @param [out] CmObject Pointer to the Configuration Manager Object
+ descriptor describing the requested Object.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object information is not found.
+**/
+typedef EFI_STATUS (*CM_OBJECT_HANDLER_PROC) (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST This,
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN CONST CM_OBJECT_TOKEN Token,
+ IN OUT CM_OBJ_DESCRIPTOR * CONST CmObject
+ );
/** The number of CPUs
*/
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH edk2-platforms v1 2/6] Platform/ARM: Juno: Remove usage of function macros
2021-01-22 13:29 [PATCH edk2-platforms v1 0/6] Fix platform support for dynamic tables framework Sami Mujawar
2021-01-22 13:29 ` [PATCH edk2-platforms v1 1/6] Platform/ARM: FVP: Remove usage of function macros Sami Mujawar
@ 2021-01-22 13:29 ` Sami Mujawar
2021-01-22 13:29 ` [PATCH edk2-platforms v1 3/6] Platform/ARM: FVP: Fix serial port usage Sami Mujawar
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Sami Mujawar @ 2021-01-22 13:29 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, ard.biesheuvel, leif, thomas.abraham,
Matteo.Carlini, Ben.Adderson, nd
The Configuration Manager code for Juno uses function macros to
prepare and return CM objects.
However, according to section 5.5.2.1 of the edk2 coding standard,
use of functional macros is not allowed.
See https://edk2-docs.gitbook.io/edk-ii-c-coding-standards-specification/
5_source_files/55_preprocessor_directives#5-5-2-1-functional-macros-are-
generally-discouraged
Therefore, replace the function macros with static helper functions.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c | 448 ++++++++++++++------
Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h | 104 +----
2 files changed, 336 insertions(+), 216 deletions(-)
diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
index 913cffc9b994319065b5292b0d28970a0a0d8320..8d92a8a666af4c5555343a929cb2d5063e54ffd5 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
@@ -1,7 +1,7 @@
/** @file
Configuration Manager Dxe
- Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
+ Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -559,6 +559,149 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformRepositoryInfo = {
}
};
+/** A helper function for returning the Configuration Manager Objects.
+
+ @param [in] CmObjectId The Configuration Manager Object ID.
+ @param [in] Object Pointer to the Object(s).
+ @param [in] ObjectSize Total size of the Object(s).
+ @param [in] ObjectCount Number of Objects.
+ @param [in, out] CmObjectDesc Pointer to the Configuration Manager Object
+ descriptor describing the requested Object.
+
+ @retval EFI_SUCCESS Success.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+HandleCmObject (
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN VOID * Object,
+ IN CONST UINTN ObjectSize,
+ IN CONST UINTN ObjectCount,
+ IN OUT CM_OBJ_DESCRIPTOR * CONST CmObjectDesc
+ )
+{
+ CmObjectDesc->ObjectId = CmObjectId;
+ CmObjectDesc->Size = ObjectSize;
+ CmObjectDesc->Data = (VOID*)Object;
+ CmObjectDesc->Count = ObjectCount;
+ DEBUG ((
+ DEBUG_INFO,
+ "INFO: CmObjectId = %x, Ptr = 0x%p, Size = %d, Count = %d\n",
+ CmObjectId,
+ CmObjectDesc->Data,
+ CmObjectDesc->Size,
+ CmObjectDesc->Count
+ ));
+ return EFI_SUCCESS;
+}
+
+/** A helper function for returning the Configuration Manager Objects that
+ match the token.
+
+ @param [in] This Pointer to the Configuration Manager Protocol.
+ @param [in] CmObjectId The Configuration Manager Object ID.
+ @param [in] Object Pointer to the Object(s).
+ @param [in] ObjectSize Total size of the Object(s).
+ @param [in] ObjectCount Number of Objects.
+ @param [in] Token A token identifying the object.
+ @param [in] HandlerProc A handler function to search the object
+ referenced by the token.
+ @param [in, out] CmObjectDesc Pointer to the Configuration Manager Object
+ descriptor describing the requested Object.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object information is not found.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+HandleCmObjectRefByToken (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST This,
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN VOID * Object,
+ IN CONST UINTN ObjectSize,
+ IN CONST UINTN ObjectCount,
+ IN CONST CM_OBJECT_TOKEN Token,
+ IN CONST CM_OBJECT_HANDLER_PROC HandlerProc,
+ IN OUT CM_OBJ_DESCRIPTOR * CONST CmObjectDesc
+ )
+{
+ EFI_STATUS Status;
+ CmObjectDesc->ObjectId = CmObjectId;
+ if (Token == CM_NULL_TOKEN) {
+ CmObjectDesc->Size = ObjectSize;
+ CmObjectDesc->Data = (VOID*)Object;
+ CmObjectDesc->Count = ObjectCount;
+ Status = EFI_SUCCESS;
+ } else {
+ Status = HandlerProc (This, CmObjectId, Token, CmObjectDesc);
+ }
+
+ DEBUG ((
+ DEBUG_INFO,
+ "INFO: Token = 0x%p, CmObjectId = %x, Ptr = 0x%p, Size = %d, Count = %d\n",
+ (VOID*)Token,
+ CmObjectId,
+ CmObjectDesc->Data,
+ CmObjectDesc->Size,
+ CmObjectDesc->Count
+ ));
+ return Status;
+}
+
+/** A helper function for returning Configuration Manager Object(s) referenced
+ by token when the entire platform repository is in scope and the
+ CM_NULL_TOKEN value is not allowed.
+
+ @param [in] This Pointer to the Configuration Manager Protocol.
+ @param [in] CmObjectId The Configuration Manager Object ID.
+ @param [in] Token A token identifying the object.
+ @param [in] HandlerProc A handler function to search the object(s)
+ referenced by the token.
+ @param [in, out] CmObjectDesc Pointer to the Configuration Manager Object
+ descriptor describing the requested Object.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object information is not found.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+HandleCmObjectSearchPlatformRepo (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST This,
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN CONST CM_OBJECT_TOKEN Token,
+ IN CONST CM_OBJECT_HANDLER_PROC HandlerProc,
+ IN OUT CM_OBJ_DESCRIPTOR * CONST CmObjectDesc
+ )
+{
+ EFI_STATUS Status;
+ CmObjectDesc->ObjectId = CmObjectId;
+ if (Token == CM_NULL_TOKEN) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: CM_NULL_TOKEN value is not allowed when searching"
+ " the entire platform repository.\n"
+ ));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = HandlerProc (This, CmObjectId, Token, CmObjectDesc);
+ DEBUG ((
+ DEBUG_INFO,
+ "INFO: Token = 0x%p, CmObjectId = %x, Ptr = 0x%p, Size = %d, Count = %d\n",
+ CmObjectId,
+ (VOID*)Token,
+ CmObjectDesc->Data,
+ CmObjectDesc->Size,
+ CmObjectDesc->Count
+ ));
+ return Status;
+}
+
/** Initialize the platform configuration repository.
@param [in] This Pointer to the Configuration Manager Protocol.
@@ -760,46 +903,42 @@ GetStandardNameSpaceObject (
EDKII_PLATFORM_REPOSITORY_INFO * PlatformRepo;
UINT32 TableCount;
- Status = EFI_SUCCESS;
if ((This == NULL) || (CmObject == NULL)) {
ASSERT (This != NULL);
ASSERT (CmObject != NULL);
return EFI_INVALID_PARAMETER;
}
+
+ Status = EFI_NOT_FOUND;
PlatformRepo = This->PlatRepoInfo;
switch (GET_CM_OBJECT_ID (CmObjectId)) {
- HANDLE_CM_OBJECT (
- EStdObjCfgMgrInfo,
- CmObjectId,
- PlatformRepo->CmInfo,
- 1
- );
+ case EStdObjCfgMgrInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->CmInfo,
+ sizeof (PlatformRepo->CmInfo),
+ 1,
+ CmObject
+ );
+ break;
case EStdObjAcpiTableList:
- CmObject->ObjectId = CmObjectId;
- TableCount = sizeof (PlatformRepo->CmAcpiTableList) /
- sizeof (PlatformRepo->CmAcpiTableList[0]);
- if (PlatformRepo->JunoRevision != JUNO_REVISION_R0) {
- CmObject->Size = sizeof (PlatformRepo->CmAcpiTableList);
- CmObject->Count = TableCount;
- } else {
+ TableCount = ARRAY_SIZE (PlatformRepo->CmAcpiTableList);
+ if (PlatformRepo->JunoRevision == JUNO_REVISION_R0) {
/* The last 2 tables in the ACPI table list enable PCIe support.
- Reduce the CmObject size so that the PCIe specific ACPI
+ Reduce the TableCount so that the PCIe specific ACPI
tables are not installed on Juno R0
*/
- CmObject->Size = sizeof (PlatformRepo->CmAcpiTableList[0]) *
- (TableCount - 2);
- CmObject->Count = TableCount - 2;
+ TableCount -= 2;
}
- CmObject->Data = (VOID*)&PlatformRepo->CmAcpiTableList;
- DEBUG ((
- DEBUG_INFO,
- "EStdObjAcpiTableList: Ptr = 0x%p. Size = %d, Count = %d\n",
- CmObject->Data,
- CmObject->Size,
- CmObject->Count
- ));
+ Status = HandleCmObject (
+ CmObjectId,
+ PlatformRepo->CmAcpiTableList,
+ (sizeof (PlatformRepo->CmAcpiTableList[0]) * TableCount),
+ TableCount,
+ CmObject
+ );
break;
default: {
@@ -842,120 +981,171 @@ GetArmNameSpaceObject (
EFI_STATUS Status;
EDKII_PLATFORM_REPOSITORY_INFO * PlatformRepo;
- Status = EFI_SUCCESS;
if ((This == NULL) || (CmObject == NULL)) {
ASSERT (This != NULL);
ASSERT (CmObject != NULL);
return EFI_INVALID_PARAMETER;
}
+
+ Status = EFI_NOT_FOUND;
PlatformRepo = This->PlatRepoInfo;
switch (GET_CM_OBJECT_ID (CmObjectId)) {
- HANDLE_CM_OBJECT (
- EArmObjBootArchInfo,
- CmObjectId,
- PlatformRepo->BootArchInfo,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjPowerManagementProfileInfo,
- CmObjectId,
- PlatformRepo->PmProfileInfo,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjGenericTimerInfo,
- CmObjectId,
- PlatformRepo->GenericTimerInfo,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjPlatformGenericWatchdogInfo,
- CmObjectId,
- PlatformRepo->Watchdog,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjPlatformGTBlockInfo,
- CmObjectId,
- PlatformRepo->GTBlockInfo,
- (sizeof (PlatformRepo->GTBlockInfo) /
- sizeof (PlatformRepo->GTBlockInfo[0]))
- );
- HANDLE_CM_OBJECT_REF_BY_TOKEN (
- EArmObjGTBlockTimerFrameInfo,
- CmObjectId,
- PlatformRepo->GTBlock0TimerInfo,
- (sizeof (PlatformRepo->GTBlock0TimerInfo) /
- sizeof (PlatformRepo->GTBlock0TimerInfo[0])),
- Token,
- GetGTBlockTimerFrameInfo
- );
- HANDLE_CM_OBJECT_REF_BY_TOKEN (
- EArmObjGicCInfo,
- CmObjectId,
- PlatformRepo->GicCInfo,
- ARRAY_SIZE (PlatformRepo->GicCInfo),
- Token,
- GetGicCInfo
- );
- HANDLE_CM_OBJECT (
- EArmObjGicDInfo,
- CmObjectId,
- PlatformRepo->GicDInfo,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjSerialConsolePortInfo,
- CmObjectId,
- PlatformRepo->SpcrSerialPort,
- 1
- );
+ case EArmObjBootArchInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->BootArchInfo,
+ sizeof (PlatformRepo->BootArchInfo),
+ 1,
+ CmObject
+ );
+ break;
+ case EArmObjPowerManagementProfileInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->PmProfileInfo,
+ sizeof (PlatformRepo->PmProfileInfo),
+ 1,
+ CmObject
+ );
+ break;
- HANDLE_CM_OBJECT (
- EArmObjSerialDebugPortInfo,
- CmObjectId,
- PlatformRepo->DbgSerialPort,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjGicMsiFrameInfo,
- CmObjectId,
- PlatformRepo->GicMsiFrameInfo,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjProcHierarchyInfo,
- CmObjectId,
- PlatformRepo->ProcHierarchyInfo,
- ARRAY_SIZE (PlatformRepo->ProcHierarchyInfo)
- );
- HANDLE_CM_OBJECT (
- EArmObjCacheInfo,
- CmObjectId,
- PlatformRepo->CacheInfo,
- ARRAY_SIZE (PlatformRepo->CacheInfo)
- );
- HANDLE_CM_OBJECT_SEARCH_PLAT_REPO (
- EArmObjCmRef,
- CmObjectId,
- Token,
- GetCmObjRefs
- );
+ case EArmObjGenericTimerInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->GenericTimerInfo,
+ sizeof (PlatformRepo->GenericTimerInfo),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjPlatformGenericWatchdogInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->Watchdog,
+ sizeof (PlatformRepo->Watchdog),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjPlatformGTBlockInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ PlatformRepo->GTBlockInfo,
+ sizeof (PlatformRepo->GTBlockInfo),
+ ARRAY_SIZE (PlatformRepo->GTBlockInfo),
+ CmObject
+ );
+ break;
+
+ case EArmObjGTBlockTimerFrameInfo:
+ Status = HandleCmObjectRefByToken (
+ This,
+ CmObjectId,
+ PlatformRepo->GTBlock0TimerInfo,
+ sizeof (PlatformRepo->GTBlock0TimerInfo),
+ ARRAY_SIZE (PlatformRepo->GTBlock0TimerInfo),
+ Token,
+ GetGTBlockTimerFrameInfo,
+ CmObject
+ );
+ break;
+
+ case EArmObjGicCInfo:
+ Status = HandleCmObjectRefByToken (
+ This,
+ CmObjectId,
+ PlatformRepo->GicCInfo,
+ sizeof (PlatformRepo->GicCInfo),
+ ARRAY_SIZE (PlatformRepo->GicCInfo),
+ Token,
+ GetGicCInfo,
+ CmObject
+ );
+ break;
+
+ case EArmObjGicDInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->GicDInfo,
+ sizeof (PlatformRepo->GicDInfo),
+ 1,
+ CmObject
+ );
+ break;
+ case EArmObjSerialConsolePortInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->SpcrSerialPort,
+ sizeof (PlatformRepo->SpcrSerialPort),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjSerialDebugPortInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->DbgSerialPort,
+ sizeof (PlatformRepo->DbgSerialPort),
+ 1,
+ CmObject
+ );
+ break;
+ case EArmObjGicMsiFrameInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->GicMsiFrameInfo,
+ sizeof (PlatformRepo->GicMsiFrameInfo),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjProcHierarchyInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ PlatformRepo->ProcHierarchyInfo,
+ sizeof (PlatformRepo->ProcHierarchyInfo),
+ ARRAY_SIZE (PlatformRepo->ProcHierarchyInfo),
+ CmObject
+ );
+ break;
+
+ case EArmObjCacheInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ PlatformRepo->CacheInfo,
+ sizeof (PlatformRepo->CacheInfo),
+ ARRAY_SIZE (PlatformRepo->CacheInfo),
+ CmObject
+ );
+ break;
+
+ case EArmObjCmRef:
+ Status = HandleCmObjectSearchPlatformRepo (
+ This,
+ CmObjectId,
+ Token,
+ GetCmObjRefs,
+ CmObject
+ );
+ break;
case EArmObjPciConfigSpaceInfo:
if (PlatformRepo->JunoRevision != JUNO_REVISION_R0) {
- CmObject->ObjectId = CmObjectId;
- CmObject->Size = sizeof (PlatformRepo->PciConfigInfo);
- CmObject->Count = 1;
- CmObject->Data = (VOID*)&PlatformRepo->PciConfigInfo;
- DEBUG ((
- DEBUG_INFO,
- "EArmObjPciConfigSpaceInfo: Ptr = 0x%p, Size = %d, Count = %d\n",
- CmObject->Data,
- CmObject->Size,
- CmObject->Count
- ));
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->PciConfigInfo,
+ sizeof (PlatformRepo->PciConfigInfo),
+ 1,
+ CmObject
+ );
+ } else {
+ // No PCIe on Juno R0.
+ Status = EFI_NOT_FOUND;
}
break;
diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
index 2073ae4902e540de869612353bfaf0ebacaea50d..f382c7f967420c4fa8f272f3fee5c8f191999b23 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
@@ -1,6 +1,6 @@
/** @file
- Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
+ Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -91,94 +91,24 @@ extern CHAR8 ssdtuart_aml_code[];
(WritePolicy << 4) \
)
-/** A helper macro for returning configuration manager objects
-*/
-#define HANDLE_CM_OBJECT(ObjId, CmObjectId, Object, ObjectCount) \
- case ObjId: { \
- CmObject->ObjectId = CmObjectId; \
- CmObject->Size = sizeof (Object); \
- CmObject->Data = (VOID*)&Object; \
- CmObject->Count = ObjectCount; \
- DEBUG (( \
- DEBUG_INFO, \
- #CmObjectId ": Ptr = 0x%p, Size = %d, Count = %d\n", \
- CmObject->Data, \
- CmObject->Size, \
- CmObject->Count \
- )); \
- break; \
- }
+/** A function that prepares Configuration Manager Objects for returning.
-/** A helper macro for returning configuration manager objects
- referenced by token
-*/
-#define HANDLE_CM_OBJECT_REF_BY_TOKEN( \
- ObjId, \
- CmObjectId, \
- Object, \
- ObjectCount, \
- Token, \
- HandlerProc \
- ) \
- case ObjId: { \
- CmObject->ObjectId = CmObjectId; \
- if (Token == CM_NULL_TOKEN) { \
- CmObject->Size = sizeof (Object); \
- CmObject->Data = (VOID*)&Object; \
- CmObject->Count = ObjectCount; \
- DEBUG (( \
- DEBUG_INFO, \
- #CmObjectId ": Ptr = 0x%p, Size = %d, Count = %d\n", \
- CmObject->Data, \
- CmObject->Size, \
- CmObject->Count \
- )); \
- } else { \
- Status = HandlerProc (This, CmObjectId, Token, CmObject); \
- DEBUG (( \
- DEBUG_INFO, \
- #CmObjectId ": Token = 0x%p, Ptr = 0x%p, Size = %d, Count = %d\n", \
- (VOID*)Token, \
- CmObject->Data, \
- CmObject->Size, \
- CmObject->Count \
- )); \
- } \
- break; \
- }
+ @param [in] This Pointer to the Configuration Manager Protocol.
+ @param [in] CmObjectId The Configuration Manager Object ID.
+ @param [in] Token A token for identifying the object.
+ @param [out] CmObject Pointer to the Configuration Manager Object
+ descriptor describing the requested Object.
-/** A helper macro for returning configuration manager objects referenced
- by token when the entire platform repository is in scope and the
- CM_NULL_TOKEN value is not allowed.
-*/
-#define HANDLE_CM_OBJECT_SEARCH_PLAT_REPO( \
- ObjId, \
- CmObjectId, \
- Token, \
- HandlerProc \
- ) \
- case ObjId: { \
- CmObject->ObjectId = CmObjectId; \
- if (Token == CM_NULL_TOKEN) { \
- Status = EFI_INVALID_PARAMETER; \
- DEBUG (( \
- DEBUG_ERROR, \
- #ObjId ": CM_NULL_TOKEN value is not allowed when searching" \
- " the entire platform repository.\n" \
- )); \
- } else { \
- Status = HandlerProc (This, CmObjectId, Token, CmObject); \
- DEBUG (( \
- DEBUG_INFO, \
- #ObjId ": Token = 0x%p, Ptr = 0x%p, Size = %d, Count = %d\n", \
- (VOID*)Token, \
- CmObject->Data, \
- CmObject->Size, \
- CmObject->Count \
- )); \
- } \
- break; \
- }
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object information is not found.
+**/
+typedef EFI_STATUS (*CM_OBJECT_HANDLER_PROC) (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST This,
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN CONST CM_OBJECT_TOKEN Token,
+ IN OUT CM_OBJ_DESCRIPTOR * CONST CmObject
+ );
/** The number of CPUs
*/
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH edk2-platforms v1 3/6] Platform/ARM: FVP: Fix serial port usage
2021-01-22 13:29 [PATCH edk2-platforms v1 0/6] Fix platform support for dynamic tables framework Sami Mujawar
2021-01-22 13:29 ` [PATCH edk2-platforms v1 1/6] Platform/ARM: FVP: Remove usage of function macros Sami Mujawar
2021-01-22 13:29 ` [PATCH edk2-platforms v1 2/6] Platform/ARM: Juno: " Sami Mujawar
@ 2021-01-22 13:29 ` Sami Mujawar
2021-01-22 13:29 ` [PATCH edk2-platforms v1 4/6] Platform/ARM: Juno: Remove PL050 KMI description from DSDT Sami Mujawar
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Sami Mujawar @ 2021-01-22 13:29 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, ard.biesheuvel, leif, thomas.abraham,
Matteo.Carlini, Ben.Adderson, nd
The serial ports on FVP are follows:
UART# Address Interrupt No.
----- ------- -------------
UART0 0x1c090000 0x25
UART1 0x1c0a0000 0x26
UART2 0x1c0b0000 0x27
UART3 0x1c0c0000 0x28
See Fast Model Reference Manual at:
https://developer.arm.com/documentation/100964/1113/
The FVP firmware configures the debug log output on UART1 and the
UEFI shell is configured to use UART0. The Serial Port Console
Redirector (SPCR) table is configured such that the UEFI shell is
migrated to the OS serial console.
When Dynamic Tables Framework is enabled, the FVP Configuration
Manager uses the PCDs PcdSerialRegisterBase and PL011UartInterrupt
to populate the SPCR table.
The current firmware implementation has two problems:
1. The PL011UartInterrupt was not set to the correct interrupt
number. Therefore, the OS serial console was not fully
functional (serial output was printed but input could not
be provided).
2. The OS serial console was setup on UART1, while it should
have been UART0.
Therefore, when Dynamic Tables Framework is enabled fix the UART
base address and interrupt number such that UART0 is configured
in the SPCR table. Also remove ConfigurationManager.dsc.inc as
this is now redundant.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc | 11 ++++++++---
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager.dsc.inc | 19 -------------------
2 files changed, 8 insertions(+), 22 deletions(-)
diff --git a/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc b/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc
index a6f536a332281a624403dac2e4bf18aa9ba96d0b..f8c703c4b22b2a26028ba0562e0eae5948c3292d 100644
--- a/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc
+++ b/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011-2018, ARM Limited. All rights reserved.
+# Copyright (c) 2011-2021, ARM Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -34,7 +34,6 @@ [Defines]
!include Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
!ifdef DYNAMIC_TABLES_FRAMEWORK
!include DynamicTablesPkg/DynamicTables.dsc.inc
- !include Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager.dsc.inc
!endif
[LibraryClasses.common]
@@ -126,7 +125,7 @@ [PcdsFixedAtBuild.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x1c0a0000
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultReceiveFifoDepth|0
- gArmPlatformTokenSpaceGuid.PL011UartInterrupt|0x25
+ gArmPlatformTokenSpaceGuid.PL011UartInterrupt|0x26
## PL011 Serial Debug UART (DBG2)
gArmPlatformTokenSpaceGuid.PcdSerialDbgRegisterBase|0x1c0b0000
@@ -267,6 +266,12 @@ [Components.common]
!ifndef DYNAMIC_TABLES_FRAMEWORK
MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
Platform/ARM/VExpressPkg/AcpiTables/AcpiTables.inf
+!else
+ Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf {
+ <PcdsFixedAtBuild>
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x1c090000
+ gArmPlatformTokenSpaceGuid.PL011UartInterrupt|0x25
+ }
!endif
ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
diff --git a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager.dsc.inc b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager.dsc.inc
deleted file mode 100644
index 0915c154cce6b0686f67a383dc69231ed3ed6f36..0000000000000000000000000000000000000000
--- a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager.dsc.inc
+++ /dev/null
@@ -1,19 +0,0 @@
-## @file
-# dsc include file for Configuration Manager
-#
-# Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-##
-
-[Defines]
-
-[BuildOptions]
-# Required for pre-processing ASL files that include ArmPlatform.h
- *_*_*_ASLPP_FLAGS = $(PLATFORM_FLAGS)
-
-[LibraryClasses.common]
-
-[Components.common]
- # Configuration Manager
- Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH edk2-platforms v1 4/6] Platform/ARM: Juno: Remove PL050 KMI description from DSDT
2021-01-22 13:29 [PATCH edk2-platforms v1 0/6] Fix platform support for dynamic tables framework Sami Mujawar
` (2 preceding siblings ...)
2021-01-22 13:29 ` [PATCH edk2-platforms v1 3/6] Platform/ARM: FVP: Fix serial port usage Sami Mujawar
@ 2021-01-22 13:29 ` Sami Mujawar
2021-01-22 13:29 ` [PATCH edk2-platforms v1 5/6] Platform/ARM: Juno: Remove Serial port SSDT Sami Mujawar
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Sami Mujawar @ 2021-01-22 13:29 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, ard.biesheuvel, leif, thomas.abraham,
Matteo.Carlini, Ben.Adderson, nd
Remove the PL050 PS/2 Keyboard/Mouse Interface (KMI) controller
description from the Juno DSDT as:
- PS/2 ports are now considered as legacy ports. Alternatively,
a USB Keyboard/Mouse can be connected to Juno USB ports.
- Concurrent usage of the Juno KMI and USB appear to trigger
I/O errors from the USB mass storage driver. This has proven
to be problematic as USB drivers typically cannot recover from
this issue.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
Platform/ARM/JunoPkg/AcpiTables/Dsdt.asl | 16 +---------------
Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl | 16 +---------------
2 files changed, 2 insertions(+), 30 deletions(-)
diff --git a/Platform/ARM/JunoPkg/AcpiTables/Dsdt.asl b/Platform/ARM/JunoPkg/AcpiTables/Dsdt.asl
index 186fd6a471b45f43f407a620c1316c4b1006fba1..c17c74e174081836a61106224b687621854bcd29 100644
--- a/Platform/ARM/JunoPkg/AcpiTables/Dsdt.asl
+++ b/Platform/ARM/JunoPkg/AcpiTables/Dsdt.asl
@@ -1,7 +1,7 @@
/** @file
Differentiated System Description Table Fields (DSDT)
- Copyright (c) 2014-2018, ARM Ltd. All rights reserved.<BR>
+ Copyright (c) 2014-2021, ARM Ltd. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -233,20 +233,6 @@ DefinitionBlock("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARM-JUNO", EFI_ACPI_ARM_O
}
//
- // Keyboard and Mouse
- //
- Device(KMI0) {
- Name(_HID, "ARMH0501")
- Name(_CID, "PL050_KBD")
- Name(_CRS, ResourceTemplate() {
- Memory32Fixed(ReadWrite, 0x1C060008, 0x4)
- Memory32Fixed(ReadWrite, 0x1C060000, 0x4)
- Memory32Fixed(ReadOnly, 0x1C060004, 0x4)
- Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 197 }
- })
- }
-
- //
// LAN9118 Ethernet
//
Device(ETH0) {
diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
index 6c045083873eecb02c7d3b4e25e8c28948f796af..63c70c1e4f060d089a3a02aee36a7e9cbf6ae6b0 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
@@ -1,7 +1,7 @@
/** @file
Differentiated System Description Table Fields (DSDT)
- Copyright (c) 2014 - 2019, ARM Ltd. All rights reserved.<BR>
+ Copyright (c) 2014 - 2021, ARM Ltd. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -233,20 +233,6 @@ DefinitionBlock("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARM-JUNO", EFI_ACPI_ARM_O
}
//
- // Keyboard and Mouse
- //
- Device(KMI0) {
- Name(_HID, "ARMH0501")
- Name(_CID, "PL050_KBD")
- Name(_CRS, ResourceTemplate() {
- Memory32Fixed(ReadWrite, 0x1C060008, 0x4)
- Memory32Fixed(ReadWrite, 0x1C060000, 0x4)
- Memory32Fixed(ReadOnly, 0x1C060004, 0x4)
- Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 197 }
- })
- }
-
- //
// LAN9118 Ethernet
//
Device(ETH0) {
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH edk2-platforms v1 5/6] Platform/ARM: Juno: Remove Serial port SSDT
2021-01-22 13:29 [PATCH edk2-platforms v1 0/6] Fix platform support for dynamic tables framework Sami Mujawar
` (3 preceding siblings ...)
2021-01-22 13:29 ` [PATCH edk2-platforms v1 4/6] Platform/ARM: Juno: Remove PL050 KMI description from DSDT Sami Mujawar
@ 2021-01-22 13:29 ` Sami Mujawar
2021-01-22 13:29 ` [PATCH edk2-platforms v1 6/6] Platform/ARM: FVP: Remove Serial port description from DSDT Sami Mujawar
2021-01-25 12:56 ` [PATCH edk2-platforms v1 0/6] Fix platform support for dynamic tables framework Leif Lindholm
6 siblings, 0 replies; 8+ messages in thread
From: Sami Mujawar @ 2021-01-22 13:29 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, ard.biesheuvel, leif, thomas.abraham,
Matteo.Carlini, Ben.Adderson, nd
Dynamic Tables Framework has been updated to add support for
Dynamic AML. The SPCR and DBG generators have also been updated
to dynamically generate the AML description for the Serial Ports.
Therefore, the SSDT serial port description is redundant when
Dynamic Tables Framework is enabled, so remove it.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/SsdtUart.asl | 42 --------------------
Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c | 7 ----
Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h | 3 +-
Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf | 3 +-
4 files changed, 2 insertions(+), 53 deletions(-)
diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/SsdtUart.asl b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/SsdtUart.asl
deleted file mode 100644
index 55a7ffc83fd6bb44ed9b9ca8b0a53e757aa2dd58..0000000000000000000000000000000000000000
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/SsdtUart.asl
+++ /dev/null
@@ -1,42 +0,0 @@
-/** @file
- SSDT for UART
-
- Copyright (c) 2014 - 2019, ARM Ltd. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-#include "ArmPlatform.h"
-
-DefinitionBlock("SsdtUart.aml", "SSDT", 1, "ARMLTD", "ARM-JUNO", EFI_ACPI_ARM_OEM_REVISION) {
- Scope(_SB) {
- // UART PL011
- Device(COM2) {
- Name(_HID, "ARMH0011")
- Name(_CID, "PL011")
- Name(_UID, Zero)
-
- Method(_STA) {
- Return (0xF)
- }
-
- Method(_CRS, 0x0, NotSerialized) {
- Name(RBUF, ResourceTemplate() {
- Memory32Fixed(
- ReadWrite,
- FixedPcdGet64 (PcdSerialRegisterBase),
- 0x1000
- )
- Interrupt(
- ResourceConsumer,
- Level,
- ActiveHigh,
- Exclusive
- ) {
- FixedPcdGet32 (PL011UartInterrupt)
- }
- })
- Return (RBUF)
- }
- }
- }
-}
diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
index 8d92a8a666af4c5555343a929cb2d5063e54ffd5..80a98a10d869d48fc768db7bf5bfccb41f483fc3 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
@@ -83,13 +83,6 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformRepositoryInfo = {
CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdt),
(EFI_ACPI_DESCRIPTION_HEADER*)ssdtjunousb_aml_code
},
- // SSDT table describing the PL011 UART
- {
- EFI_ACPI_6_2_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
- 0, // Unused
- CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdt),
- (EFI_ACPI_DESCRIPTION_HEADER*)ssdtuart_aml_code
- },
// PPTT Table
{
EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE,
diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
index f382c7f967420c4fa8f272f3fee5c8f191999b23..771b00c31b9e168d2b416a87b8743d2e063f1744 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
@@ -19,7 +19,6 @@
extern CHAR8 dsdt_aml_code[];
extern CHAR8 ssdtjunousb_aml_code[];
extern CHAR8 ssdtpci_aml_code[];
-extern CHAR8 ssdtuart_aml_code[];
/** The configuration manager version
*/
@@ -116,7 +115,7 @@ typedef EFI_STATUS (*CM_OBJECT_HANDLER_PROC) (
/** The number of ACPI tables to install
*/
-#define PLAT_ACPI_TABLE_COUNT 11
+#define PLAT_ACPI_TABLE_COUNT 10
/** The number of platform generic timer blocks
*/
diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
index a3e7db12f8c913f7111b5ff4ad724a5bdcc35956..00be2c435bd6eefe4b26017608b62f085bb2d7f7 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
@@ -1,7 +1,7 @@
## @file
# Configuration Manager Dxe
#
-# Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
+# Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
@@ -25,7 +25,6 @@ [Sources]
AslTables/Dsdt.asl
AslTables/SsdtJunoUsb.asl
AslTables/SsdtPci.asl
- AslTables/SsdtUart.asl
[Packages]
ArmPkg/ArmPkg.dec
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH edk2-platforms v1 6/6] Platform/ARM: FVP: Remove Serial port description from DSDT
2021-01-22 13:29 [PATCH edk2-platforms v1 0/6] Fix platform support for dynamic tables framework Sami Mujawar
` (4 preceding siblings ...)
2021-01-22 13:29 ` [PATCH edk2-platforms v1 5/6] Platform/ARM: Juno: Remove Serial port SSDT Sami Mujawar
@ 2021-01-22 13:29 ` Sami Mujawar
2021-01-25 12:56 ` [PATCH edk2-platforms v1 0/6] Fix platform support for dynamic tables framework Leif Lindholm
6 siblings, 0 replies; 8+ messages in thread
From: Sami Mujawar @ 2021-01-22 13:29 UTC (permalink / raw)
To: devel
Cc: Sami Mujawar, ard.biesheuvel, leif, thomas.abraham,
Matteo.Carlini, Ben.Adderson, nd
Dynamic Tables Framework has been updated to add support for
Dynamic AML. The SPCR and DBG generators have also been updated
to dynamically generate the AML description for the Serial Ports.
Therefore, the serial port description in the DSDT is redundant
when Dynamic Tables Framework is enabled, so remove it.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl | 22 +-------------------
1 file changed, 1 insertion(+), 21 deletions(-)
diff --git a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
index 9192a0070772209e5cec8d7d9a71ea7a9e10aa69..eb5466229d1f10f465ca417166de5c1c1ea212e8 100644
--- a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
+++ b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
@@ -1,7 +1,7 @@
/** @file
Differentiated System Description Table Fields (DSDT)
- Copyright (c) 2014-2017, ARM Ltd. All rights reserved.<BR>
+ Copyright (c) 2014-2021, ARM Ltd. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -43,25 +43,5 @@ DefinitionBlock("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARM-VEXP", 1) {
Name(_HID, "ACPI0007")
Name(_UID, 7)
}
-
- // UART PL011
- Device(COM2) {
- Name(_HID, "ARMH0011")
- Name(_CID, "PL011")
- Name(_UID, Zero)
-
- Method(_STA) {
- Return(0xF)
- }
-
- Method(_CRS, 0x0, NotSerialized) {
- Name(RBUF, ResourceTemplate() {
- Memory32Fixed(ReadWrite, 0x1c090000, 0x1000)
- Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x25 }
- })
- Return (RBUF)
- }
- }
-
} // Scope(_SB)
}
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH edk2-platforms v1 0/6] Fix platform support for dynamic tables framework
2021-01-22 13:29 [PATCH edk2-platforms v1 0/6] Fix platform support for dynamic tables framework Sami Mujawar
` (5 preceding siblings ...)
2021-01-22 13:29 ` [PATCH edk2-platforms v1 6/6] Platform/ARM: FVP: Remove Serial port description from DSDT Sami Mujawar
@ 2021-01-25 12:56 ` Leif Lindholm
6 siblings, 0 replies; 8+ messages in thread
From: Leif Lindholm @ 2021-01-25 12:56 UTC (permalink / raw)
To: Sami Mujawar
Cc: devel, ard.biesheuvel, thomas.abraham, Matteo.Carlini,
Ben.Adderson, nd
Hi Sami,
On Fri, Jan 22, 2021 at 13:29:29 +0000, Sami Mujawar wrote:
> This patch series fixes the following issues for FVP & Juno platform
> when Dynamic Tables Framework is enabled.
> - Remove the usage of function macros as this does not comply with
> the edk2 coding standard.
> - Fix serial port usage on FVP.
> - Remove serial port description from SSDT and DSDT as this is now
> generated by Dynamic AML.
>
> This series also includes a patch to remove PL050 KMI support on
> Juno.
>
> The changes can be seen at:
> https://github.com/samimujawar/edk2-platforms/tree/1608_fix_config_mgr_handlers_v1
>
> Sami Mujawar (6):
> Platform/ARM: FVP: Remove usage of function macros
> Platform/ARM: Juno: Remove usage of function macros
> Platform/ARM: FVP: Fix serial port usage
> Platform/ARM: Juno: Remove PL050 KMI description from DSDT
> Platform/ARM: Juno: Remove Serial port SSDT
> Platform/ARM: FVP: Remove Serial port description from DSDT
For the series:
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
Pushed as c6d565eddf6f..fcf693c9e8d6.
Many thanks for quick response time.
>
> Platform/ARM/JunoPkg/AcpiTables/Dsdt.asl | 16 +-
> Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl | 16 +-
> Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/SsdtUart.asl | 42 --
> Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c | 455 ++++++++++++++------
> Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h | 107 +----
> Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf | 3 +-
> Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc | 11 +-
> Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager.dsc.inc | 19 -
> Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl | 22 +-
> Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c | 347 ++++++++++-----
> Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h | 73 +---
> 11 files changed, 615 insertions(+), 496 deletions(-)
> delete mode 100644 Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/SsdtUart.asl
> delete mode 100644 Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager.dsc.inc
>
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
>
^ permalink raw reply [flat|nested] 8+ messages in thread