2 Configuration Manager Dxe
4 Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
9 - Cm or CM - Configuration Manager
13 #include <IndustryStandard/DebugPort2Table.h>
14 #include <IndustryStandard/IoRemappingTable.h>
15 #include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>
16 #include <IndustryStandard/SerialPortConsoleRedirectionTable.h>
17 #include <Library/BaseMemoryLib.h>
18 #include <Library/DebugLib.h>
19 #include <Library/DynamicPlatRepoLib.h>
20 #include <Library/HobLib.h>
21 #include <Library/HwInfoParserLib.h>
22 #include <Library/IoLib.h>
23 #include <Library/PcdLib.h>
24 #include <Library/TableHelperLib.h>
25 #include <Library/UefiBootServicesTableLib.h>
26 #include <Protocol/AcpiTable.h>
27 #include <Protocol/ConfigurationManagerProtocol.h>
29 #include "ConfigurationManager.h"
32 // The platform configuration repository information.
35 EDKII_PLATFORM_REPOSITORY_INFO mKvmtoolPlatRepositoryInfo
= {
37 // Configuration Manager information
39 { CONFIGURATION_MANAGER_REVISION
, CFG_MGR_OEM_ID
},
49 EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE
,
50 EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_REVISION
,
51 CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt
),
58 EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE
,
59 EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION
,
60 CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdGtdt
),
67 EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE
,
68 EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
,
69 CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMadt
),
76 EFI_ACPI_6_3_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE
,
77 EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_REVISION
,
78 CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSpcr
),
85 EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE
,
87 CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdDsdt
),
88 (EFI_ACPI_DESCRIPTION_HEADER
*)dsdt_aml_code
91 // SSDT Cpu Hierarchy Table
94 EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE
,
96 CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdtCpuTopology
),
103 EFI_ACPI_6_3_DEBUG_PORT_2_TABLE_SIGNATURE
,
104 EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION
,
105 CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdDbg2
),
112 EFI_ACPI_6_3_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE
,
113 EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION
,
114 CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMcfg
),
118 // SSDT table describing the PCI root complex
121 EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE
,
123 CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdtPciExpress
),
130 EFI_ACPI_6_3_IO_REMAPPING_TABLE_SIGNATURE
,
131 EFI_ACPI_IO_REMAPPING_TABLE_REVISION
,
132 CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdIort
),
138 // Power management profile information
140 { EFI_ACPI_6_3_PM_PROFILE_ENTERPRISE_SERVER
}, // PowerManagement Profile
147 // Reference token for this Iort node
149 REFERENCE_TOKEN (ItsGroupInfo
),
151 // The number of ITS identifiers in the ITS node.
155 // Reference token for the ITS identifier array
157 REFERENCE_TOKEN (ItsIdentifierArray
)
161 // ITS identifier array
164 { 0 }, // The ITS Identifier
168 // Root Complex node info
172 // Reference token for this Iort node
174 REFERENCE_TOKEN (RootComplexInfo
),
176 // Number of ID mappings
180 // Reference token for the ID mapping array
182 REFERENCE_TOKEN (DeviceIdMapping
[0]),
184 // Memory access properties : Cache coherent attributes
186 EFI_ACPI_IORT_MEM_ACCESS_PROP_CCA
,
188 // Memory access properties : Allocation hints
192 // Memory access properties : Memory access flags
198 EFI_ACPI_IORT_ROOT_COMPLEX_ATS_UNSUPPORTED
,
200 // PCI segment number
204 /// Memory address size limit
206 MEMORY_ADDRESS_SIZE_LIMIT
210 // Array of Device ID mappings
214 // Device ID mapping for Root complex node
215 // RootComplex -> ITS Group
223 // Number of input IDs
233 REFERENCE_TOKEN (ItsGroupInfo
),
243 A helper function for returning the Configuration Manager Objects.
245 @param [in] CmObjectId The Configuration Manager Object ID.
246 @param [in] Object Pointer to the Object(s).
247 @param [in] ObjectSize Total size of the Object(s).
248 @param [in] ObjectCount Number of Objects.
249 @param [in, out] CmObjectDesc Pointer to the Configuration Manager Object
250 descriptor describing the requested Object.
252 @retval EFI_SUCCESS Success.
258 IN CONST CM_OBJECT_ID CmObjectId
,
260 IN CONST UINTN ObjectSize
,
261 IN CONST UINTN ObjectCount
,
262 IN OUT CM_OBJ_DESCRIPTOR
*CONST CmObjectDesc
265 CmObjectDesc
->ObjectId
= CmObjectId
;
266 CmObjectDesc
->Size
= ObjectSize
;
267 CmObjectDesc
->Data
= Object
;
268 CmObjectDesc
->Count
= ObjectCount
;
271 "INFO: CmObjectId = " FMT_CM_OBJECT_ID
", "
272 "Ptr = 0x%p, Size = %lu, Count = %lu\n",
282 A helper function for returning the Configuration Manager Objects that
285 @param [in] This Pointer to the Configuration Manager Protocol.
286 @param [in] CmObjectId The Configuration Manager Object ID.
287 @param [in] Object Pointer to the Object(s).
288 @param [in] ObjectSize Total size of the Object(s).
289 @param [in] ObjectCount Number of Objects.
290 @param [in] Token A token identifying the object.
291 @param [in] HandlerProc A handler function to search the object
292 referenced by the token.
293 @param [in, out] CmObjectDesc Pointer to the Configuration Manager Object
294 descriptor describing the requested Object.
296 @retval EFI_SUCCESS Success.
297 @retval EFI_INVALID_PARAMETER A parameter is invalid.
298 @retval EFI_NOT_FOUND The required object information is not found.
303 HandleCmObjectRefByToken (
304 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL
*CONST This
,
305 IN CONST CM_OBJECT_ID CmObjectId
,
307 IN CONST UINTN ObjectSize
,
308 IN CONST UINTN ObjectCount
,
309 IN CONST CM_OBJECT_TOKEN Token
,
310 IN CONST CM_OBJECT_HANDLER_PROC HandlerProc
,
311 IN OUT CM_OBJ_DESCRIPTOR
*CONST CmObjectDesc
316 CmObjectDesc
->ObjectId
= CmObjectId
;
317 if (Token
== CM_NULL_TOKEN
) {
318 CmObjectDesc
->Size
= ObjectSize
;
319 CmObjectDesc
->Data
= Object
;
320 CmObjectDesc
->Count
= ObjectCount
;
321 Status
= EFI_SUCCESS
;
323 Status
= HandlerProc (This
, CmObjectId
, Token
, CmObjectDesc
);
328 "INFO: Token = 0x%p, CmObjectId = " FMT_CM_OBJECT_ID
", "
329 "Ptr = 0x%p, Size = %lu, Count = %lu\n",
340 Return an ITS identifier array.
342 @param [in] This Pointer to the Configuration Manager Protocol.
343 @param [in] CmObjectId The Configuration Manager Object ID.
344 @param [in] Token A token for identifying the object
345 @param [out] CmObject Pointer to the Configuration Manager Object
346 descriptor describing the requested Object.
348 @retval EFI_SUCCESS Success.
349 @retval EFI_INVALID_PARAMETER A parameter is invalid.
350 @retval EFI_NOT_FOUND The required object information is not found.
354 GetItsIdentifierArray (
355 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL
*CONST This
,
356 IN CONST CM_OBJECT_ID CmObjectId
,
357 IN CONST CM_OBJECT_TOKEN Token
,
358 OUT CM_OBJ_DESCRIPTOR
*CONST CmObject
361 EDKII_PLATFORM_REPOSITORY_INFO
*PlatformRepo
;
363 if ((This
== NULL
) || (CmObject
== NULL
)) {
364 ASSERT (This
!= NULL
);
365 ASSERT (CmObject
!= NULL
);
366 return EFI_INVALID_PARAMETER
;
369 PlatformRepo
= This
->PlatRepoInfo
;
371 if (Token
!= (CM_OBJECT_TOKEN
)&PlatformRepo
->ItsIdentifierArray
) {
372 return EFI_NOT_FOUND
;
375 CmObject
->ObjectId
= CmObjectId
;
376 CmObject
->Size
= sizeof (PlatformRepo
->ItsIdentifierArray
);
377 CmObject
->Data
= (VOID
*)&PlatformRepo
->ItsIdentifierArray
;
378 CmObject
->Count
= ARRAY_SIZE (PlatformRepo
->ItsIdentifierArray
);
383 Return a device Id mapping array.
385 @param [in] This Pointer to the Configuration Manager Protocol.
386 @param [in] CmObjectId The Configuration Manager Object ID.
387 @param [in] Token A token for identifying the object
388 @param [out] CmObject Pointer to the Configuration Manager Object
389 descriptor describing the requested Object.
391 @retval EFI_SUCCESS Success.
392 @retval EFI_INVALID_PARAMETER A parameter is invalid.
393 @retval EFI_NOT_FOUND The required object information is not found.
397 GetDeviceIdMappingArray (
398 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL
*CONST This
,
399 IN CONST CM_OBJECT_ID CmObjectId
,
400 IN CONST CM_OBJECT_TOKEN Token
,
401 OUT CM_OBJ_DESCRIPTOR
*CONST CmObject
404 EDKII_PLATFORM_REPOSITORY_INFO
*PlatformRepo
;
406 if ((This
== NULL
) || (CmObject
== NULL
)) {
407 ASSERT (This
!= NULL
);
408 ASSERT (CmObject
!= NULL
);
409 return EFI_INVALID_PARAMETER
;
412 PlatformRepo
= This
->PlatRepoInfo
;
414 if (Token
!= (CM_OBJECT_TOKEN
)&PlatformRepo
->DeviceIdMapping
[0]) {
415 return EFI_NOT_FOUND
;
418 CmObject
->ObjectId
= CmObjectId
;
419 CmObject
->Size
= sizeof (CM_ARM_ID_MAPPING
);
420 CmObject
->Data
= (VOID
*)Token
;
426 Function pointer called by the parser to add information.
428 Callback function that the parser can use to add new
429 CmObj. This function must copy the CmObj data and not rely on
430 the parser preserving the CmObj memory.
431 This function is responsible of the Token allocation.
433 @param [in] ParserHandle A handle to the parser instance.
434 @param [in] Context A pointer to the caller's context provided in
436 @param [in] CmObjDesc CM_OBJ_DESCRIPTOR containing the CmObj(s) to add.
437 @param [out] Token If provided and success, contain the token
438 generated for the CmObj.
440 @retval EFI_SUCCESS The function completed successfully.
441 @retval EFI_INVALID_PARAMETER Invalid parameter.
447 IN HW_INFO_PARSER_HANDLE ParserHandle
,
449 IN CONST CM_OBJ_DESCRIPTOR
*CmObjDesc
,
450 OUT CM_OBJECT_TOKEN
*Token OPTIONAL
454 EDKII_PLATFORM_REPOSITORY_INFO
*PlatformRepo
;
456 if ((ParserHandle
== NULL
) ||
460 ASSERT (ParserHandle
!= NULL
);
461 ASSERT (Context
!= NULL
);
462 ASSERT (CmObjDesc
!= NULL
);
463 return EFI_INVALID_PARAMETER
;
466 PlatformRepo
= (EDKII_PLATFORM_REPOSITORY_INFO
*)Context
;
470 // Print the received objects.
472 ParseCmObjDesc (CmObjDesc
);
475 Status
= DynPlatRepoAddObject (
476 PlatformRepo
->DynamicPlatformRepo
,
480 if (EFI_ERROR (Status
)) {
481 ASSERT_EFI_ERROR (Status
);
488 Cleanup the platform configuration repository.
490 @param [in] This Pointer to the Configuration Manager Protocol.
492 @retval EFI_SUCCESS Success
493 @retval EFI_INVALID_PARAMETER A parameter is invalid.
498 CleanupPlatformRepository (
499 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL
*CONST This
503 EDKII_PLATFORM_REPOSITORY_INFO
*PlatformRepo
;
506 ASSERT (This
!= NULL
);
507 return EFI_INVALID_PARAMETER
;
510 PlatformRepo
= This
->PlatRepoInfo
;
513 // Shutdown the dynamic repo and free all objects.
515 Status
= DynamicPlatRepoShutdown (PlatformRepo
->DynamicPlatformRepo
);
516 if (EFI_ERROR (Status
)) {
517 ASSERT_EFI_ERROR (Status
);
524 Status
= HwInfoParserShutdown (PlatformRepo
->FdtParserHandle
);
525 if (EFI_ERROR (Status
)) {
526 ASSERT_EFI_ERROR (Status
);
533 Initialize the platform configuration repository.
535 @param [in] This Pointer to the Configuration Manager Protocol.
537 @retval EFI_SUCCESS Success
538 @retval EFI_INVALID_PARAMETER A parameter is invalid.
539 @retval EFI_OUT_OF_RESOURCES An allocation has failed.
544 InitializePlatformRepository (
545 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL
*CONST This
549 EDKII_PLATFORM_REPOSITORY_INFO
*PlatformRepo
;
553 ASSERT (This
!= NULL
);
554 return EFI_INVALID_PARAMETER
;
557 Hob
= GetFirstGuidHob (&gFdtHobGuid
);
558 if ((Hob
== NULL
) || (GET_GUID_HOB_DATA_SIZE (Hob
) != sizeof (UINT64
))) {
560 ASSERT (GET_GUID_HOB_DATA_SIZE (Hob
) != sizeof (UINT64
));
561 return EFI_NOT_FOUND
;
564 PlatformRepo
= This
->PlatRepoInfo
;
565 PlatformRepo
->FdtBase
= (VOID
*)*(UINTN
*)GET_GUID_HOB_DATA (Hob
);
568 // Initialise the dynamic platform repository.
570 Status
= DynamicPlatRepoInit (&PlatformRepo
->DynamicPlatformRepo
);
571 if (EFI_ERROR (Status
)) {
572 ASSERT_EFI_ERROR (Status
);
577 // Initialise the FDT parser
579 Status
= HwInfoParserInit (
580 PlatformRepo
->FdtBase
,
583 &PlatformRepo
->FdtParserHandle
585 if (EFI_ERROR (Status
)) {
586 ASSERT_EFI_ERROR (Status
);
590 Status
= HwInfoParse (PlatformRepo
->FdtParserHandle
);
591 if (EFI_ERROR (Status
)) {
592 ASSERT_EFI_ERROR (Status
);
596 Status
= DynamicPlatRepoFinalise (PlatformRepo
->DynamicPlatformRepo
);
597 if (EFI_ERROR (Status
)) {
598 ASSERT_EFI_ERROR (Status
);
605 CleanupPlatformRepository (This
);
610 Return a standard namespace object.
612 @param [in] This Pointer to the Configuration Manager Protocol.
613 @param [in] CmObjectId The Configuration Manager Object ID.
614 @param [in] Token An optional token identifying the object. If
615 unused this must be CM_NULL_TOKEN.
616 @param [in, out] CmObject Pointer to the Configuration Manager Object
617 descriptor describing the requested Object.
619 @retval EFI_SUCCESS Success.
620 @retval EFI_INVALID_PARAMETER A parameter is invalid.
621 @retval EFI_NOT_FOUND The required object information is not found.
625 GetStandardNameSpaceObject (
626 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL
*CONST This
,
627 IN CONST CM_OBJECT_ID CmObjectId
,
628 IN CONST CM_OBJECT_TOKEN Token OPTIONAL
,
629 IN OUT CM_OBJ_DESCRIPTOR
*CONST CmObject
633 EDKII_PLATFORM_REPOSITORY_INFO
*PlatformRepo
;
634 UINTN AcpiTableCount
;
635 CM_OBJ_DESCRIPTOR CmObjDesc
;
637 if ((This
== NULL
) || (CmObject
== NULL
)) {
638 ASSERT (This
!= NULL
);
639 ASSERT (CmObject
!= NULL
);
640 return EFI_INVALID_PARAMETER
;
643 Status
= EFI_NOT_FOUND
;
644 PlatformRepo
= This
->PlatRepoInfo
;
646 switch (GET_CM_OBJECT_ID (CmObjectId
)) {
647 case EStdObjCfgMgrInfo
:
648 Status
= HandleCmObject (
650 &PlatformRepo
->CmInfo
,
651 sizeof (PlatformRepo
->CmInfo
),
657 case EStdObjAcpiTableList
:
658 AcpiTableCount
= ARRAY_SIZE (PlatformRepo
->CmAcpiTableList
);
661 // Get Pci config space information.
663 Status
= DynamicPlatRepoGetObject (
664 PlatformRepo
->DynamicPlatformRepo
,
665 CREATE_CM_ARM_OBJECT_ID (EArmObjPciConfigSpaceInfo
),
669 if (Status
== EFI_NOT_FOUND
) {
671 // The last 3 tables are for PCIe. If PCIe information is not
672 // present, Kvmtool was launched without the PCIe option.
673 // Therefore, reduce the table count by 3.
676 } else if (EFI_ERROR (Status
)) {
677 ASSERT_EFI_ERROR (Status
);
682 // Get the Gic version.
684 Status
= DynamicPlatRepoGetObject (
685 PlatformRepo
->DynamicPlatformRepo
,
686 CREATE_CM_ARM_OBJECT_ID (EArmObjGicDInfo
),
690 if (EFI_ERROR (Status
)) {
691 ASSERT_EFI_ERROR (Status
);
695 if (((CM_ARM_GICD_INFO
*)CmObjDesc
.Data
)->GicVersion
< 3) {
697 // IORT is only required for GicV3/4
702 Status
= HandleCmObject (
704 PlatformRepo
->CmAcpiTableList
,
705 (sizeof (PlatformRepo
->CmAcpiTableList
[0]) * AcpiTableCount
),
712 Status
= EFI_NOT_FOUND
;
715 "ERROR: CmObjectId " FMT_CM_OBJECT_ID
". Status = %r\n",
726 Return an ARM namespace object.
728 @param [in] This Pointer to the Configuration Manager Protocol.
729 @param [in] CmObjectId The Configuration Manager Object ID.
730 @param [in] Token An optional token identifying the object. If
731 unused this must be CM_NULL_TOKEN.
732 @param [in, out] CmObject Pointer to the Configuration Manager Object
733 descriptor describing the requested Object.
735 @retval EFI_SUCCESS Success.
736 @retval EFI_INVALID_PARAMETER A parameter is invalid.
737 @retval EFI_NOT_FOUND The required object information is not found.
741 GetArmNameSpaceObject (
742 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL
*CONST This
,
743 IN CONST CM_OBJECT_ID CmObjectId
,
744 IN CONST CM_OBJECT_TOKEN Token OPTIONAL
,
745 IN OUT CM_OBJ_DESCRIPTOR
*CONST CmObject
749 EDKII_PLATFORM_REPOSITORY_INFO
*PlatformRepo
;
751 if ((This
== NULL
) || (CmObject
== NULL
)) {
752 ASSERT (This
!= NULL
);
753 ASSERT (CmObject
!= NULL
);
754 return EFI_INVALID_PARAMETER
;
757 Status
= EFI_NOT_FOUND
;
758 PlatformRepo
= This
->PlatRepoInfo
;
761 // First check among the static objects.
763 switch (GET_CM_OBJECT_ID (CmObjectId
)) {
764 case EArmObjPowerManagementProfileInfo
:
765 Status
= HandleCmObject (
767 &PlatformRepo
->PmProfileInfo
,
768 sizeof (PlatformRepo
->PmProfileInfo
),
774 case EArmObjItsGroup
:
775 Status
= HandleCmObject (
777 &PlatformRepo
->ItsGroupInfo
,
778 sizeof (PlatformRepo
->ItsGroupInfo
),
784 case EArmObjGicItsIdentifierArray
:
785 Status
= HandleCmObjectRefByToken (
788 PlatformRepo
->ItsIdentifierArray
,
789 sizeof (PlatformRepo
->ItsIdentifierArray
),
790 ARRAY_SIZE (PlatformRepo
->ItsIdentifierArray
),
792 GetItsIdentifierArray
,
797 case EArmObjRootComplex
:
798 Status
= HandleCmObject (
800 &PlatformRepo
->RootComplexInfo
,
801 sizeof (PlatformRepo
->RootComplexInfo
),
807 case EArmObjIdMappingArray
:
808 Status
= HandleCmObjectRefByToken (
811 PlatformRepo
->DeviceIdMapping
,
812 sizeof (PlatformRepo
->DeviceIdMapping
),
813 ARRAY_SIZE (PlatformRepo
->DeviceIdMapping
),
815 GetDeviceIdMappingArray
,
822 // No match found among the static objects.
823 // Check the dynamic objects.
825 Status
= DynamicPlatRepoGetObject (
826 PlatformRepo
->DynamicPlatformRepo
,
834 if (Status
== EFI_NOT_FOUND
) {
837 "INFO: CmObjectId " FMT_CM_OBJECT_ID
". Status = %r\n",
842 ASSERT_EFI_ERROR (Status
);
849 Return an OEM namespace object.
851 @param [in] This Pointer to the Configuration Manager Protocol.
852 @param [in] CmObjectId The Configuration Manager Object ID.
853 @param [in] Token An optional token identifying the object. If
854 unused this must be CM_NULL_TOKEN.
855 @param [in, out] CmObject Pointer to the Configuration Manager Object
856 descriptor describing the requested Object.
858 @retval EFI_SUCCESS Success.
859 @retval EFI_INVALID_PARAMETER A parameter is invalid.
860 @retval EFI_NOT_FOUND The required object information is not found.
864 GetOemNameSpaceObject (
865 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL
*CONST This
,
866 IN CONST CM_OBJECT_ID CmObjectId
,
867 IN CONST CM_OBJECT_TOKEN Token OPTIONAL
,
868 IN OUT CM_OBJ_DESCRIPTOR
*CONST CmObject
873 Status
= EFI_SUCCESS
;
874 if ((This
== NULL
) || (CmObject
== NULL
)) {
875 ASSERT (This
!= NULL
);
876 ASSERT (CmObject
!= NULL
);
877 return EFI_INVALID_PARAMETER
;
880 switch (GET_CM_OBJECT_ID (CmObjectId
)) {
882 Status
= EFI_NOT_FOUND
;
885 "ERROR: CmObjectId " FMT_CM_OBJECT_ID
". Status = %r\n",
896 The GetObject function defines the interface implemented by the
897 Configuration Manager Protocol for returning the Configuration
900 @param [in] This Pointer to the Configuration Manager Protocol.
901 @param [in] CmObjectId The Configuration Manager Object ID.
902 @param [in] Token An optional token identifying the object. If
903 unused this must be CM_NULL_TOKEN.
904 @param [in, out] CmObject Pointer to the Configuration Manager Object
905 descriptor describing the requested Object.
907 @retval EFI_SUCCESS Success.
908 @retval EFI_INVALID_PARAMETER A parameter is invalid.
909 @retval EFI_NOT_FOUND The required object information is not found.
913 ArmKvmtoolPlatformGetObject (
914 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL
*CONST This
,
915 IN CONST CM_OBJECT_ID CmObjectId
,
916 IN CONST CM_OBJECT_TOKEN Token OPTIONAL
,
917 IN OUT CM_OBJ_DESCRIPTOR
*CONST CmObject
922 if ((This
== NULL
) || (CmObject
== NULL
)) {
923 ASSERT (This
!= NULL
);
924 ASSERT (CmObject
!= NULL
);
925 return EFI_INVALID_PARAMETER
;
928 switch (GET_CM_NAMESPACE_ID (CmObjectId
)) {
929 case EObjNameSpaceStandard
:
930 Status
= GetStandardNameSpaceObject (This
, CmObjectId
, Token
, CmObject
);
932 case EObjNameSpaceArm
:
933 Status
= GetArmNameSpaceObject (This
, CmObjectId
, Token
, CmObject
);
935 case EObjNameSpaceOem
:
936 Status
= GetOemNameSpaceObject (This
, CmObjectId
, Token
, CmObject
);
939 Status
= EFI_INVALID_PARAMETER
;
942 "ERROR: Unknown Namespace CmObjectId " FMT_CM_OBJECT_ID
". "
954 The SetObject function defines the interface implemented by the
955 Configuration Manager Protocol for updating the Configuration
958 @param [in] This Pointer to the Configuration Manager Protocol.
959 @param [in] CmObjectId The Configuration Manager Object ID.
960 @param [in] Token An optional token identifying the object. If
961 unused this must be CM_NULL_TOKEN.
962 @param [in] CmObject Pointer to the Configuration Manager Object
963 descriptor describing the Object.
965 @retval EFI_UNSUPPORTED This operation is not supported.
969 ArmKvmtoolPlatformSetObject (
970 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL
*CONST This
,
971 IN CONST CM_OBJECT_ID CmObjectId
,
972 IN CONST CM_OBJECT_TOKEN Token OPTIONAL
,
973 IN CM_OBJ_DESCRIPTOR
*CONST CmObject
976 return EFI_UNSUPPORTED
;
980 // A structure describing the configuration manager protocol interface.
984 EDKII_CONFIGURATION_MANAGER_PROTOCOL mKvmtoolPlatformConfigManagerProtocol
= {
985 CREATE_REVISION (1, 0),
986 ArmKvmtoolPlatformGetObject
,
987 ArmKvmtoolPlatformSetObject
,
988 &mKvmtoolPlatRepositoryInfo
992 Entrypoint of Configuration Manager Dxe.
998 @retval EFI_LOAD_ERROR
999 @retval EFI_OUT_OF_RESOURCES
1003 ConfigurationManagerDxeInitialize (
1004 IN EFI_HANDLE ImageHandle
,
1005 IN EFI_SYSTEM_TABLE
*SystemTable
1010 Status
= gBS
->InstallProtocolInterface (
1012 &gEdkiiConfigurationManagerProtocolGuid
,
1013 EFI_NATIVE_INTERFACE
,
1014 (VOID
*)&mKvmtoolPlatformConfigManagerProtocol
1016 if (EFI_ERROR (Status
)) {
1019 "ERROR: Failed to get Install Configuration Manager Protocol." \
1026 Status
= InitializePlatformRepository (
1027 &mKvmtoolPlatformConfigManagerProtocol
1029 if (EFI_ERROR (Status
)) {
1032 "ERROR: Failed to initialize the Platform Configuration Repository." \
1042 gBS
->UninstallProtocolInterface (
1044 &gEdkiiConfigurationManagerProtocolGuid
,
1045 (VOID
*)&mKvmtoolPlatformConfigManagerProtocol
1051 Unload function for this image.
1053 @param ImageHandle Handle for the image of this driver.
1055 @retval EFI_SUCCESS Driver unloaded successfully.
1056 @retval other Driver can not unloaded.
1060 ConfigurationManagerDxeUnloadImage (
1061 IN EFI_HANDLE ImageHandle
1064 return CleanupPlatformRepository (&mKvmtoolPlatformConfigManagerProtocol
);