From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (EUR05-VI1-obe.outbound.protection.outlook.com [40.107.21.61]) by mx.groups.io with SMTP id smtpd.web10.8664.1611322192080664878 for ; Fri, 22 Jan 2021 05:29:52 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=4PnbW6UP; spf=pass (domain: arm.com, ip: 40.107.21.61, mailfrom: sami.mujawar@arm.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Aw7W1CNbdRFtdj4bsVD4IoV1PMdHrbygm6FkLPdrXU0=; b=4PnbW6UPybJwzKB0HUTD2pK9ECsGGIg/snfyeS1WVBQuBRyMytY1KnRmZqadFctbhGq/21qX7gucLAgxBvLEb+6iEB6m6S8Fcy0cdjCAN/1a+bOqt0mgwmK5dhG0RxFrxITCZAIroKGFtT0sFfDGFtn+MuOmW8MBY1FkOMYwkfM= Received: from AM6P191CA0005.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:8b::18) by AM0PR08MB4162.eurprd08.prod.outlook.com (2603:10a6:208:12a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.13; Fri, 22 Jan 2021 13:29:49 +0000 Received: from AM5EUR03FT010.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8b:cafe::2f) by AM6P191CA0005.outlook.office365.com (2603:10a6:209:8b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Fri, 22 Jan 2021 13:29:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT010.mail.protection.outlook.com (10.152.16.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Fri, 22 Jan 2021 13:29:48 +0000 Received: ("Tessian outbound e989e14f9207:v71"); Fri, 22 Jan 2021 13:29:48 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 365f7c537a2fb700 X-CR-MTA-TID: 64aa7808 Received: from fbe6d546cf5b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 5420BE31-543A-4EBD-9A7C-2F7E97B3BE96.1; Fri, 22 Jan 2021 13:29:41 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id fbe6d546cf5b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 22 Jan 2021 13:29:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bpnUvpBcxc+5Kr60bk++y2xFZ8XDREHd5ZbW6M9IdxK/ORTlR2HJ6G8kEMCmgPf4qVy3+MBBOgj1VOf7jfOALZHU+EyX2CHcrOYEFQ2u6MsrMz86nRsmHzIE7uTxfYuCz+OYpnDpMQW8qqpjvKkmWwgjwivLNc4b3qovkTCGieHo1MU0WFk2LffKFH1kOtJsEnS6nMd1xHhxP9POwU9p0N187FRwWMfqKEYc7OFBBqgDgtngC661/hWGnPsFqS96zO2XC9KXrv0Flk73tDndtI2wKof3EODFU7IOXTL9iSNbFNEnX9DW6QLZLwq08T+4nU+kwRpzu4Gd4C+HEnD0Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Aw7W1CNbdRFtdj4bsVD4IoV1PMdHrbygm6FkLPdrXU0=; b=h300EW8raMLqDbfO7ATIQYZuTTxbcUXSzb8dab+BVoa4CXYH8d6a30oPGlCUMhqO61mEYA663vGbvfVQgus0X6fRoAnQF4k/qk5ZK/97LD+fowcwEAGV2MqY8jwqdquaQvqtySa714omQcD4ynXgMju0I87KWQqcAqJShtcZO2AVJrM5MOGdrdOIwF8l5HSmRDnWbB+CqjQ8J2zpqvwg7JP6iUCv6h0WKPsIrXDZx+7A05wnqDcTFXFbvT7lPTOQMMQXGLahoNiZdkv6A9xtczuXRlZanAYNA3E3zr2PY64i06ELtNDIXGf3Efy6JFS406SDQCKOvcYP8GjA/cTIuQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Aw7W1CNbdRFtdj4bsVD4IoV1PMdHrbygm6FkLPdrXU0=; b=4PnbW6UPybJwzKB0HUTD2pK9ECsGGIg/snfyeS1WVBQuBRyMytY1KnRmZqadFctbhGq/21qX7gucLAgxBvLEb+6iEB6m6S8Fcy0cdjCAN/1a+bOqt0mgwmK5dhG0RxFrxITCZAIroKGFtT0sFfDGFtn+MuOmW8MBY1FkOMYwkfM= Received: from DB6PR0202CA0024.eurprd02.prod.outlook.com (2603:10a6:4:29::34) by VI1PR0801MB1757.eurprd08.prod.outlook.com (2603:10a6:800:5a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.13; Fri, 22 Jan 2021 13:29:39 +0000 Received: from DB5EUR03FT005.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:29:cafe::dc) by DB6PR0202CA0024.outlook.office365.com (2603:10a6:4:29::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Fri, 22 Jan 2021 13:29:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT005.mail.protection.outlook.com (10.152.20.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3784.11 via Frontend Transport; Fri, 22 Jan 2021 13:29:38 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2044.4; Fri, 22 Jan 2021 13:29:37 +0000 Received: from E107187.Arm.com (10.57.3.168) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2044.4 via Frontend Transport; Fri, 22 Jan 2021 13:29:36 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , Subject: [PATCH edk2-platforms v1 1/6] Platform/ARM: FVP: Remove usage of function macros Date: Fri, 22 Jan 2021 13:29:30 +0000 Message-ID: <20210122132935.22484-2-sami.mujawar@arm.com> X-Mailer: git-send-email 2.11.0.windows.3 In-Reply-To: <20210122132935.22484-1-sami.mujawar@arm.com> References: <20210122132935.22484-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f49fddb9-bde4-4a46-9873-08d8bed9ca70 X-MS-TrafficTypeDiagnostic: VI1PR0801MB1757:|AM0PR08MB4162: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:1923;OLM:1923; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: kCrP0Kmy9P7kTUNQ2znLz0kkylIZ9vJzJUihX9TMCa5TYFSXBklrUND8yz2ia4/x4QLBlKme8BflAImdyAb9zzDK+6VMtGDoxE8561YLHh+CUaKddqNFcFBbAy8NOd4XnL6XtfwdKLYoE/N3DIbeiDfjGG/u6AiEnvov7U6oboF9fa5htJDpDsTICUlvhe0Q77Uurd7CfhVbuTicz8Lj6zssv1Z95TUTiftgVy4s2iLR2u2BJmVsA8Z7nz7sBsSG+v0k1mNj0pzIdW3OxgXzyBVf747M2fKIz2EqodgwmE3dL0c0/z3I/plkvkpjISpnL9ThEcln2PGWZEEEQAd1Hix20ljtOLwhYCd7d7tfo17pMI6bpqEYWN3VVErfdsEWwGkMtaVtknXGxmm65/kwKKB6ZWT3K6pAfQOFohSAA1pq1YLkEK103l/bj3l3ZmLnsJ63oFFspJbliac3k/Fti/3wBH3+7iO++XlFAMUCjpXBxVqNzH/WcShTwJ0xcdqneuIdB5Cv2I0Xy5rP9SwCk2YJPgu2PwYg48qe61ZPrbwrKlciSxCW7aD3sMFJOCF0 X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(136003)(396003)(376002)(39840400004)(346002)(46966006)(6666004)(30864003)(44832011)(83380400001)(82310400003)(81166007)(6916009)(54906003)(4326008)(478600001)(356005)(2906002)(70206006)(47076005)(316002)(1076003)(5660300002)(36756003)(966005)(70586007)(8676002)(86362001)(2616005)(336012)(426003)(7696005)(26005)(8936002)(186003)(36610700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1757 Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 6e686702-5bc4-4f8c-32d0-08d8bed9c499 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jBjz+ctp5bJOTcZPkFAxhy5GN4h2TD9bRCVGTvBh91t9vhFkkaug0Cw85dm10QkGKis2b7fwseKLBsmYfXEtfmk5Et1ifif8ThIER2gdfTy9doUDRRcZuAfzGWezN/SjuTq2yejTQsqcajqKFO4TFiZmNmC3seS+eZGCzwdJPYSiY4GEkeKO/trkLrZOHOlEPdu2pHrCTQUjChFdtjFqGjGk7DsBOttvBMlfZQPCY+mWI1i/l39ZpU9Bnc8vCo7nbjt2fjNXYlNAqVLHlEoorYgyYGA8KTGza33B+0pEsXfTXEKdtA9u9jWVFApbaE8hhU8fq6XBbT3v1ctUBtmvDKFhdSwXVoD4pj8G/vCadc6zM34RLVitSoab44X0h8v9sj6lmoeey2in/FF/QYJ1cMsA4bLj9HeSm7t50IYaBIo66zPvUF9eYi5qeyBcIoIitXqWo7Kxf7weD97FaP9+Dl9alkwdqrpQVH3jRG5QPbdS06pM3bdnufC/d3aHQUx+rRt1qdGgkQ1INv+ox+GFeqg1donZO4sCJWzueRi8pR4= X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(396003)(39850400004)(376002)(136003)(346002)(46966006)(47076005)(26005)(54906003)(2906002)(5660300002)(36756003)(44832011)(30864003)(316002)(1076003)(8936002)(2616005)(82310400003)(82740400003)(8676002)(186003)(966005)(70586007)(336012)(7696005)(6666004)(83380400001)(478600001)(4326008)(426003)(86362001)(81166007)(6916009)(70206006);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2021 13:29:48.5612 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f49fddb9-bde4-4a46-9873-08d8bed9ca70 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4162 Content-Type: text/plain 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 --- 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.
+ Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.
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.
+ Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.
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)'