2018-12-15 11:59:07 +00:00
|
|
|
/** @file
|
|
|
|
|
|
2024-02-14 10:06:54 +00:00
|
|
|
Copyright (c) 2017 - 2024, Arm Limited. All rights reserved.
|
2024-07-31 10:51:52 +00:00
|
|
|
Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved.
|
2018-12-15 11:59:07 +00:00
|
|
|
|
2019-04-03 16:03:32 -07:00
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
2018-12-15 11:59:07 +00:00
|
|
|
|
|
|
|
|
@par Glossary:
|
|
|
|
|
- Cm or CM - Configuration Manager
|
|
|
|
|
- Obj or OBJ - Object
|
2024-07-31 10:51:52 +00:00
|
|
|
- X64 or x64 - X64 Architecture
|
2018-12-15 11:59:07 +00:00
|
|
|
**/
|
|
|
|
|
|
DynamicTablesPkg: Replace include guards with #pragma once
Replace traditional `#ifndef`/`#define`/`#endif` include guards with
`#pragma` once.
`#pragma once` is a widely supported preprocessor directive that
prevents header files from being included multiple times. It is
supported by all toolchains used to build edk2: GCC, Clang/LLVM, and
MSVC.
Compared to macro-based include guards, `#pragma once`:
- Eliminates the risk of macro name collisions or copy/paste errors
where two headers inadvertently use the same guard macro.
- Eliminate inconsistency in the way include guard macros are named
(e.g., some files use `__FILE_H__`, others use `FILE_H_`, etc.).
- Reduces boilerplate (three lines replaced by one).
- Avoids polluting the macro namespace with guard symbols.
- Can improve build times as the preprocessor can skip re-opening the
file entirely, rather than re-reading it to find the matching
`#endif` ("multiple-include optimization").
- Note that some compilers may already optimize traditional include
guards, by recognzining the idiomatic pattern.
This change is made acknowledging that overall portability of the
code will technically be reduced, as `#pragma once` is not part of the
C/C++ standards.
However, this is considered acceptable given:
1. edk2 already defines a subset of supported compilers in
BaseTools/Conf/tools_def.template, all of which have supported
`#pragma once` for over two decades.
2. There have been concerns raised to the project about inconsistent
include guard naming and potential macro collisions.
Approximate compiler support dates:
- MSVC: Supported since Visual C++ 4.2 (1996)
- GCC: Supported since 3.4 (2004)
(http://gnu.ist.utl.pt/software/gcc/gcc-3.4/changes.html)
- Clang (LLVM based): Since initial release in 2007
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2026-02-03 12:36:36 -05:00
|
|
|
#pragma once
|
2018-12-15 11:59:07 +00:00
|
|
|
|
2024-03-06 09:04:09 +00:00
|
|
|
#include <ArchCommonNameSpaceObjects.h>
|
2018-12-15 11:59:07 +00:00
|
|
|
#include <ArmNameSpaceObjects.h>
|
2024-07-02 11:03:15 +05:30
|
|
|
#include <RiscVNameSpaceObjects.h>
|
2018-12-15 11:59:07 +00:00
|
|
|
#include <StandardNameSpaceObjects.h>
|
2024-07-31 10:51:52 +00:00
|
|
|
#include <X64NameSpaceObjects.h>
|
2018-12-15 11:59:07 +00:00
|
|
|
|
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
|
|
/** The CM_OBJECT_ID type is used to identify 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
|
2024-02-14 10:06:54 +00:00
|
|
|
0001 - Arch Common
|
|
|
|
|
0010 - ARM
|
2024-07-31 10:51:52 +00:00
|
|
|
0011 - X64
|
2024-07-02 11:03:15 +05:30
|
|
|
0100 - RISC-V
|
2024-02-14 10:06:54 +00:00
|
|
|
1111 - Custom/OEM
|
2018-12-15 11:59:07 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
|
|
Object ID's in the Standard Namespace:
|
|
|
|
|
0 - Configuration Manager Revision
|
|
|
|
|
1 - ACPI Table List
|
|
|
|
|
2 - SMBIOS Table List
|
|
|
|
|
|
2024-03-08 16:31:21 +00:00
|
|
|
Object ID's in the Arch Common Namespace:
|
|
|
|
|
See EARCH_COMMON_OBJECT_ID.
|
|
|
|
|
|
2018-12-15 11:59:07 +00:00
|
|
|
Object ID's in the ARM Namespace:
|
2024-03-08 16:31:21 +00:00
|
|
|
See EARM_OBJECT_ID.
|
2018-12-15 11:59:07 +00:00
|
|
|
*/
|
|
|
|
|
typedef UINT32 CM_OBJECT_ID;
|
|
|
|
|
|
2021-07-08 16:03:07 +01:00
|
|
|
//
|
|
|
|
|
// Helper macro to format a CM_OBJECT_ID.
|
|
|
|
|
//
|
|
|
|
|
#define FMT_CM_OBJECT_ID "0x%lx"
|
|
|
|
|
|
2018-12-15 11:59:07 +00:00
|
|
|
/** A mask for Object ID
|
|
|
|
|
*/
|
|
|
|
|
#define OBJECT_ID_MASK 0xFF
|
|
|
|
|
|
|
|
|
|
/** 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 {
|
2024-02-14 10:06:54 +00:00
|
|
|
EObjNameSpaceStandard, ///< Standard Objects Namespace
|
|
|
|
|
EObjNameSpaceArchCommon, ///< Arch Common Objects Namespace
|
|
|
|
|
EObjNameSpaceArm, ///< ARM Objects Namespace
|
2024-07-31 10:51:52 +00:00
|
|
|
EObjNameSpaceX64, ///< X64 Objects Namespace
|
2024-07-02 11:03:15 +05:30
|
|
|
EObjNameSpaceRiscV, ///< RISC-V Objects Namespace
|
2024-02-14 10:06:54 +00:00
|
|
|
EObjNameSpaceOem = 0xF, ///< OEM Objects Namespace
|
|
|
|
|
EObjNameSpaceMax,
|
2018-12-15 11:59:07 +00:00
|
|
|
} EOBJECT_NAMESPACE_ID;
|
|
|
|
|
|
|
|
|
|
/** A descriptor for Configuration Manager Objects.
|
|
|
|
|
|
|
|
|
|
The Configuration Manager Protocol interface uses this descriptor
|
|
|
|
|
to return the Configuration Manager Objects.
|
|
|
|
|
*/
|
|
|
|
|
typedef struct CmObjDescriptor {
|
|
|
|
|
/// Object Id
|
|
|
|
|
CM_OBJECT_ID ObjectId;
|
|
|
|
|
|
|
|
|
|
/// Size of the described Object or Object List
|
|
|
|
|
UINT32 Size;
|
|
|
|
|
|
|
|
|
|
/// Pointer to the described Object or Object List
|
|
|
|
|
VOID *Data;
|
|
|
|
|
|
|
|
|
|
/// Count of objects in the list
|
|
|
|
|
UINT32 Count;
|
|
|
|
|
} CM_OBJ_DESCRIPTOR;
|
|
|
|
|
|
|
|
|
|
#pragma pack()
|
|
|
|
|
|
|
|
|
|
/** This macro returns the namespace ID from the CmObjectID.
|
|
|
|
|
|
|
|
|
|
@param [in] CmObjectId The Configuration Manager Object ID.
|
|
|
|
|
|
|
|
|
|
@retval Returns the Namespace ID corresponding to the CmObjectID.
|
|
|
|
|
**/
|
|
|
|
|
#define GET_CM_NAMESPACE_ID(CmObjectId) \
|
|
|
|
|
(((CmObjectId) >> NAMESPACE_ID_BIT_SHIFT) & \
|
|
|
|
|
NAMESPACE_ID_MASK)
|
|
|
|
|
|
|
|
|
|
/** 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)
|
|
|
|
|
|
|
|
|
|
/** This macro returns a Configuration Manager Object ID
|
|
|
|
|
from the NameSpace ID and the ObjectID.
|
|
|
|
|
|
|
|
|
|
@param [in] NameSpaceId The namespace ID for the Object.
|
|
|
|
|
@param [in] ObjectId The Object ID.
|
|
|
|
|
|
|
|
|
|
@retval Returns the Configuration Manager Object ID.
|
|
|
|
|
**/
|
|
|
|
|
#define CREATE_CM_OBJECT_ID(NameSpaceId, ObjectId) \
|
2024-07-08 05:00:11 -07:00
|
|
|
(((((CM_OBJECT_ID)NameSpaceId) & NAMESPACE_ID_MASK) << NAMESPACE_ID_BIT_SHIFT) | \
|
|
|
|
|
(((CM_OBJECT_ID)ObjectId) & OBJECT_ID_MASK))
|
2018-12-15 11:59:07 +00:00
|
|
|
|
|
|
|
|
/** 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))
|
|
|
|
|
|
|
|
|
|
/** 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))
|
|
|
|
|
|
2024-07-02 11:03:15 +05:30
|
|
|
/** This macro returns a Configuration Manager Object ID
|
|
|
|
|
in the RISC-V Object Namespace.
|
|
|
|
|
|
|
|
|
|
@param [in] ObjectId The Object ID.
|
|
|
|
|
|
|
|
|
|
@retval Returns an RISC-V Configuration Manager Object ID.
|
|
|
|
|
**/
|
|
|
|
|
#define CREATE_CM_RISCV_OBJECT_ID(ObjectId) \
|
|
|
|
|
(CREATE_CM_OBJECT_ID (EObjNameSpaceRiscV, ObjectId))
|
|
|
|
|
|
2024-02-14 10:06:54 +00:00
|
|
|
/** This macro returns a Configuration Manager Object ID
|
|
|
|
|
in the Arch Common Object Namespace.
|
|
|
|
|
|
|
|
|
|
@param [in] ObjectId The Object ID.
|
|
|
|
|
|
|
|
|
|
@retval Returns an Arch Common Configuration Manager Object ID.
|
|
|
|
|
**/
|
|
|
|
|
#define CREATE_CM_ARCH_COMMON_OBJECT_ID(ObjectId) \
|
|
|
|
|
(CREATE_CM_OBJECT_ID (EObjNameSpaceArchCommon, ObjectId))
|
|
|
|
|
|
2018-12-15 11:59:07 +00:00
|
|
|
/** 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))
|
|
|
|
|
|
2024-07-31 10:51:52 +00:00
|
|
|
/** This macro returns a Configuration Manager Object ID
|
|
|
|
|
in the X64 Object Namespace.
|
|
|
|
|
|
|
|
|
|
@param [in] ObjectId The Object ID.
|
|
|
|
|
|
|
|
|
|
@retval Returns X64 Configuration Manager Object ID.
|
|
|
|
|
**/
|
|
|
|
|
#define CREATE_CM_X64_OBJECT_ID(ObjectId) \
|
|
|
|
|
(CREATE_CM_OBJECT_ID (EObjNameSpaceX64, ObjectId))
|