From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by mx.groups.io with SMTP id smtpd.web11.380.1596212372197870463 for ; Fri, 31 Jul 2020 09:19:32 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=y2L1JPu5; spf=pass (domain: nuviainc.com, ip: 209.85.128.43, mailfrom: tomas@nuviainc.com) Received: by mail-wm1-f43.google.com with SMTP id d190so8961776wmd.4 for ; Fri, 31 Jul 2020 09:19:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=b2BLvAHFFO5cm5EwidZjvzfFqT93kcS+b5oHOIIwOWA=; b=y2L1JPu5EbnvF3jfYocz23b7ubFUePbtNdLhDmNK/g3RN6RrE9OwujWD04nXqbOi/p 9XpwWq//6+cCI90ItmoYGsT4km8NmN7XMMQOyMCuTXtETZgR0616seG17VU7Lzk+Kd0s NND/pAP1fz2u9fA+S0eUYClQEmeZPeLPJBGy2V4/ZwmstdfwEvYrz9EfbUqbfJsSeBKv lkSdyWN4rlgZye3RWyMKdDhKYyHg8Pq98aye8Mt4xW/ZZID+b+qKwRkg6vLF9ZLLBm5M QRtLsY9gwLTnxUI2cTwaGV1Qx9aMdz6iUiO7LSkXiUvaiIynD10zOjBJsyZY9yDxnpTY 2+3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=b2BLvAHFFO5cm5EwidZjvzfFqT93kcS+b5oHOIIwOWA=; b=Hn2IzwbNbodyuDyzvQ8Mi84Gg872ry+nR7Xkweu2+n5nym4GXKvoxkY9WkrL0r8P7a MC+0TELE4wDRixMK3ZJXc6t5QhwSY/9c/K0Z3VGmtxDEj5GkNbV3MrvF1By5BfI0A731 3T6h6C12FOxz8H5UM088JadJtNr6Lrc50ifN4Q3bo70pNpQGXiOi5GWPK5c6mlW47DfV J5i3RhioqMYPiYirnudZ0UjZQ7QeiN4l85skaqAwKgi5N3zHj4Lw3bjwpLZmTzdNXmLb Ir7Yr60iMuCsg0VRdUFXpoYVfsmXkMb1VxoI6FWYUdcR0G5L5jV4QNIJ1f5pMfhtPhwa o+7Q== X-Gm-Message-State: AOAM532XPgKziFcNVoElehUjoeCSRM0rCS258RFXQOjiU5iwnGOI4xre Y2k//RBLA2S43iJe1QH/ILyYZCbaHrSk62U7QEd6/taSKmL5D0kPw5wE80kMjZpNatdEIKi4mBn vLoe2NDNAQ4V5iSXgNhmkOqHjgCvpUp8lHR4Mi0F9iRa2c4ai+F1tdW8JCSEhOHV2daY= X-Google-Smtp-Source: ABdhPJw020QsAkIxymYlWxxEkoeaODQdD0WUrtiLH4xzI8iRIxY6uanqJkIW9mX0JuBcVUX7E9Fhfw== X-Received: by 2002:a1c:b188:: with SMTP id a130mr4255963wmf.125.1596212369976; Fri, 31 Jul 2020 09:19:29 -0700 (PDT) Return-Path: Received: from localhost.localdomain (cpc159317-cmbg20-2-0-cust162.5-4.cable.virginm.net. [81.111.29.163]) by smtp.gmail.com with ESMTPSA id v11sm14149739wrr.10.2020.07.31.09.19.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2020 09:19:29 -0700 (PDT) From: "Tomas Pilar (tpilar)" To: devel@edk2.groups.io Cc: Sami Mujawar , Alexei Fedorov Subject: [PATCH 2/8] DynamicTablesPkg: Fold Namespaces into CmObjectId Enums Date: Fri, 31 Jul 2020 17:19:20 +0100 Message-Id: <20200731161926.341330-3-tomas@nuviainc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200731161926.341330-1-tomas@nuviainc.com> References: <20200731161926.341330-1-tomas@nuviainc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The enums for CmObjectIds defined in Dynamic Tables Framework that are used to identify types of configuration manager objects already include their namespaces in the symbols for enum values. Namespace enum values are shifted up by NAMESPACE_BIT_SHIFT and the enums tables for CmObjectIds are bitwise-ORed with their corresponding namespace. This means we no longer need to use macros to compose and decompose CmObjectIds. The macros are adjusted so that they result in NOP. Cc: Sami Mujawar Cc: Alexei Fedorov Signed-off-by: Tomas Pilar --- .../Include/ArmNameSpaceObjects.h | 3 +- .../Include/ConfigurationManagerNameSpace.h | 43 ++++++++++++++ .../Include/ConfigurationManagerObject.h | 57 ++++++++----------- .../Include/StandardNameSpaceObjects.h | 7 ++- 4 files changed, 72 insertions(+), 38 deletions(-) create mode 100644 DynamicTablesPkg/Include/ConfigurationManagerNameSpace.h diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h index 2f32696031..cf7846e024 100644 --- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h +++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h @@ -14,6 +14,7 @@ #define ARM_NAMESPACE_OBJECTS_H_ #include +#include #pragma pack(1) @@ -21,7 +22,7 @@ in the ARM Namespace */ typedef enum ArmObjectID { - EArmObjReserved, ///< 0 - Reserved + EArmObjReserved = EObjNameSpaceArm, ///< 0 - Reserved, namespace starts at 0x10000000 EArmObjBootArchInfo, ///< 1 - Boot Architecture Info EArmObjCpuInfo, ///< 2 - CPU Info EArmObjPowerManagementProfileInfo, ///< 3 - Power Management Profile Info diff --git a/DynamicTablesPkg/Include/ConfigurationManagerNameSpace.h b/DynamicTablesPkg/Include/ConfigurationManagerNameSpace.h new file mode 100644 index 0000000000..acba77e2b3 --- /dev/null +++ b/DynamicTablesPkg/Include/ConfigurationManagerNameSpace.h @@ -0,0 +1,43 @@ +/** @file + + Copyright (c) 2020, ARM Limited. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef CONFIGURATION_MANAGER_NAMESPACE_H_ +#define CONFIGURATION_MANAGER_NAMESPACE_H_ + +/** The EOBJECT_NAMESPACE_ID enum describes the defined namespaces + for the Configuration Manager Objects. + + Description of Configuration Manager Object ID +_______________________________________________________________________________ +|31 |30 |29 |28 || 27 | 26 | 25 | 24 || 23 | 22 | 21 | 20 || 19 | 18 | 17 | 16| +------------------------------------------------------------------------------- +| Name Space ID || 0 | 0 | 0 | 0 || 0 | 0 | 0 | 0 || 0 | 0 | 0 | 0| +_______________________________________________________________________________ + +Bits: [31:28] - Name Space ID + 0000 - Standard + 0001 - ARM + 1000 - Custom/OEM + All other values are reserved. + +Bits: [27:16] - Reserved. +_______________________________________________________________________________ +|15 |14 |13 |12 || 11 | 10 | 9 | 8 || 7 | 6 | 5 | 4 || 3 | 2 | 1 | 0| +------------------------------------------------------------------------------- +| 0 | 0 | 0 | 0 || 0 | 0 | 0 | 0 || Object ID | +_______________________________________________________________________________ + +Bits: [15:8] - Are reserved and must be zero. +Bits: [7:0] - Object ID +*/ +typedef enum ObjectNameSpaceID { + EObjNameSpaceStandard = 0x00000000, ///< Standard Objects Namespace + EObjNameSpaceArm = 0x10000000, ///< ARM Objects Namespace + EObjNameSpaceOem = 0x80000000, ///< OEM Objects Namespace +} EOBJECT_NAMESPACE_ID; + +#endif diff --git a/DynamicTablesPkg/Include/ConfigurationManagerObject.h b/DynamicTablesPkg/Include/ConfigurationManagerObject.h index b0d3e709ec..9d39bd8a9e 100644 --- a/DynamicTablesPkg/Include/ConfigurationManagerObject.h +++ b/DynamicTablesPkg/Include/ConfigurationManagerObject.h @@ -86,25 +86,11 @@ typedef UINT32 CM_OBJECT_ID; /** A mask for Object ID */ -#define OBJECT_ID_MASK 0xFF +#define OBJECT_ID_MASK 0x000000FF /** A mask for Namespace ID */ -#define NAMESPACE_ID_MASK 0xF - -/** Starting bit position for Namespace ID -*/ -#define NAMESPACE_ID_BIT_SHIFT 28 - -/** The EOBJECT_NAMESPACE_ID enum describes the defined namespaces - for the Configuration Manager Objects. -*/ -typedef enum ObjectNameSpaceID { - EObjNameSpaceStandard, ///< Standard Objects Namespace - EObjNameSpaceArm, ///< ARM Objects Namespace - EObjNameSpaceOem = 0x8, ///< OEM Objects Namespace - EObjNameSpaceMax -} EOBJECT_NAMESPACE_ID; +#define NAMESPACE_ID_MASK 0xF0000000 /** A descriptor for Configuration Manager Objects. @@ -133,19 +119,21 @@ typedef struct CmObjDescriptor { @retval Returns the Namespace ID corresponding to the CmObjectID. **/ -#define GET_CM_NAMESPACE_ID(CmObjectId) \ - (((CmObjectId) >> NAMESPACE_ID_BIT_SHIFT) & \ - NAMESPACE_ID_MASK) +#define GET_CM_NAMESPACE_ID(CmObjectId) ((CmObjectId) & NAMESPACE_ID_MASK) + +/** Deprecated, use just CmObjectId. -/** This macro returns the Object ID from the CmObjectID. + This macro returns the Object ID from the CmObjectID. @param [in] CmObjectId The Configuration Manager Object ID. @retval Returns the Object ID corresponding to the CmObjectID. **/ -#define GET_CM_OBJECT_ID(CmObjectId) ((CmObjectId) & OBJECT_ID_MASK) +#define GET_CM_OBJECT_ID(CmObjectId) (CmObjectId) -/** This macro returns a Configuration Manager Object ID +/** Deprecated. Use just ObjectId. + + This macro returns a Configuration Manager Object ID from the NameSpace ID and the ObjectID. @param [in] NameSpaceId The namespace ID for the Object. @@ -153,38 +141,39 @@ typedef struct CmObjDescriptor { @retval Returns the Configuration Manager Object ID. **/ -#define CREATE_CM_OBJECT_ID(NameSpaceId, ObjectId) \ - ((((NameSpaceId) & NAMESPACE_ID_MASK) << NAMESPACE_ID_BIT_SHIFT) | \ - ((ObjectId) & OBJECT_ID_MASK)) +#define CREATE_CM_OBJECT_ID(NameSpaceId, ObjectId) (ObjectId) + +/** Deprecated, use just ObjectId. -/** This macro returns a Configuration Manager Object ID + This macro returns a Configuration Manager Object ID in the Standard Object Namespace. @param [in] ObjectId The Object ID. @retval Returns a Standard Configuration Manager Object ID. **/ -#define CREATE_CM_STD_OBJECT_ID(ObjectId) \ - (CREATE_CM_OBJECT_ID (EObjNameSpaceStandard, ObjectId)) +#define CREATE_CM_STD_OBJECT_ID(ObjectId) (ObjectId) -/** This macro returns a Configuration Manager Object ID +/** Deprecated, use just ObjectId. + + This macro returns a Configuration Manager Object ID in the ARM Object Namespace. @param [in] ObjectId The Object ID. @retval Returns an ARM Configuration Manager Object ID. **/ -#define CREATE_CM_ARM_OBJECT_ID(ObjectId) \ - (CREATE_CM_OBJECT_ID (EObjNameSpaceArm, ObjectId)) +#define CREATE_CM_ARM_OBJECT_ID(ObjectId) (ObjectId) + +/** Deprecated, use just ObjectId. -/** This macro returns a Configuration Manager Object ID + This macro returns a Configuration Manager Object ID in the OEM Object Namespace. @param [in] ObjectId The Object ID. @retval Returns an OEM Configuration Manager Object ID. **/ -#define CREATE_CM_OEM_OBJECT_ID(ObjectId) \ - (CREATE_CM_OBJECT_ID (EObjNameSpaceOem, ObjectId)) +#define CREATE_CM_OEM_OBJECT_ID(ObjectId) (ObjectId) #endif // CONFIGURATION_MANAGER_OBJECT_H_ diff --git a/DynamicTablesPkg/Include/StandardNameSpaceObjects.h b/DynamicTablesPkg/Include/StandardNameSpaceObjects.h index 0ba6b16369..053ef937a4 100644 --- a/DynamicTablesPkg/Include/StandardNameSpaceObjects.h +++ b/DynamicTablesPkg/Include/StandardNameSpaceObjects.h @@ -15,6 +15,7 @@ #include #include +#include #pragma pack(1) @@ -44,9 +45,9 @@ typedef UINTN CM_OBJECT_TOKEN; in the Standard Namespace. */ typedef enum StdObjectID { - EStdObjCfgMgrInfo = 0x00000000, ///< 0 - Configuration Manager Info - EStdObjAcpiTableList, ///< 1 - ACPI table Info List - EStdObjSmbiosTableList, ///< 2 - SMBIOS table Info List + EStdObjCfgMgrInfo = EObjNameSpaceStandard, ///< 0 - Configuration Manager Info, namespace starts at 0 + EStdObjAcpiTableList, ///< 1 - ACPI table Info List + EStdObjSmbiosTableList, ///< 2 - SMBIOS table Info List EStdObjMax } ESTD_OBJECT_ID; -- 2.25.1