4 Copyright (c) 2019, ARM Limited. All rights reserved.
5 SPDX-License-Identifier: BSD-2-Clause-Patent
8 - ACPI 6.3 Specification, January 2019
11 - Cm or CM - Configuration Manager
15 #include <Library/AcpiLib.h>
16 #include <Library/BaseLib.h>
17 #include <Library/DebugLib.h>
18 #include <Library/MemoryAllocationLib.h>
19 #include <Protocol/AcpiTable.h>
21 // Module specific include files.
22 #include <AcpiTableGenerator.h>
23 #include <ConfigurationManagerObject.h>
24 #include <ConfigurationManagerHelper.h>
25 #include <Library/TableHelperLib.h>
26 #include <Protocol/ConfigurationManagerProtocol.h>
29 ARM standard SRAT Generator
32 The following Configuration Manager Object(s) are used by this Generator:
33 - EArmObjGicCInfo (REQUIRED)
34 - EArmObjGicItsInfo (OPTIONAL)
35 - EArmObjMemoryAffinityInfo (OPTIONAL)
36 - EArmObjGenericInitiatorAffinityInfo (OPTIONAL)
37 - EArmObjDeviceHandleAcpi (OPTIONAL)
38 - EArmObjDeviceHandlePci (OPTIONAL)
41 /** This macro expands to a function that retrieves the GIC
42 CPU interface Information from the Configuration Manager.
50 /** This macro expands to a function that retrieves the GIC
51 Interrupt Translation Service Information from the
52 Configuration Manager.
61 This macro expands to a function that retrieves the Memory Affinity
62 information from the Configuration Manager.
66 EArmObjMemoryAffinityInfo
,
67 CM_ARM_MEMORY_AFFINITY_INFO
71 This macro expands to a function that retrieves the Generic Initiator Affinity
72 information from the Configuration Manager.
76 EArmObjGenericInitiatorAffinityInfo
,
77 CM_ARM_GENERIC_INITIATOR_AFFINITY_INFO
81 This macro expands to a function that retrieves the ACPI Device Handle
82 information from the Configuration Manager.
86 EArmObjDeviceHandleAcpi
,
87 CM_ARM_DEVICE_HANDLE_ACPI
91 This macro expands to a function that retrieves the PCI Device Handle
92 information from the Configuration Manager.
96 EArmObjDeviceHandlePci
,
97 CM_ARM_DEVICE_HANDLE_PCI
101 /** Return the PCI Device information in BDF format
103 PCI Bus Number - Max 256 busses (Bits 15:8 of BDF)
104 PCI Device Mumber - Max 32 devices (Bits 7:3 of BDF)
105 PCI Function Number - Max 8 functions (Bits 2:0 of BDF)
107 @param [in] DeviceHandlePci Pointer to the PCI Device Handle.
109 @retval BDF value corresponding to the PCI Device Handle.
114 IN CONST CM_ARM_DEVICE_HANDLE_PCI
* DeviceHandlePci
118 Bdf
= (UINT16
)DeviceHandlePci
->BusNumber
<< 8;
119 Bdf
|= (DeviceHandlePci
->DeviceNumber
& 0x1F) << 3;
120 Bdf
|= DeviceHandlePci
->FunctionNumber
& 0x7;
124 /** Add the GICC Affinity Structures in the SRAT Table.
126 @param [in] CfgMgrProtocol Pointer to the Configuration Manager
128 @param [in] Srat Pointer to the SRAT Table.
129 @param [in] GicCAffOffset Offset of the GICC Affinity
130 information in the SRAT Table.
131 @param [in] GicCInfo Pointer to the GIC CPU Information list.
132 @param [in] GicCCount Count of GIC CPU Interfaces.
134 @retval EFI_SUCCESS Table generated successfully.
139 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL
* CONST CfgMgrProtocol
,
140 IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER
* CONST Srat
,
141 IN CONST UINT32 GicCAffOffset
,
142 IN CONST CM_ARM_GICC_INFO
* GicCInfo
,
146 EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE
* GicCAff
;
148 ASSERT (Srat
!= NULL
);
149 ASSERT (GicCInfo
!= NULL
);
151 GicCAff
= (EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE
*)((UINT8
*)Srat
+
154 while (GicCCount
-- != 0) {
155 DEBUG ((DEBUG_INFO
, "SRAT: GicCAff = 0x%p\n", GicCAff
));
157 GicCAff
->Type
= EFI_ACPI_6_3_GICC_AFFINITY
;
158 GicCAff
->Length
= sizeof (EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE
);
159 GicCAff
->ProximityDomain
= GicCInfo
->ProximityDomain
;
160 GicCAff
->AcpiProcessorUid
= GicCInfo
->AcpiProcessorUid
;
161 GicCAff
->Flags
= GicCInfo
->AffinityFlags
;
162 GicCAff
->ClockDomain
= GicCInfo
->ClockDomain
;
171 /** Add the GIC ITS Affinity Structures in the SRAT Table.
173 @param [in] CfgMgrProtocol Pointer to the Configuration Manager
175 @param [in] Srat Pointer to the SRAT Table.
176 @param [in] GicItsAffOffset Offset of the GIC ITS Affinity
177 information in the SRAT Table.
178 @param [in] GicItsInfo Pointer to the GIC ITS Information list.
179 @param [in] GicItsCount Count of GIC ITS.
181 @retval EFI_SUCCESS Table generated successfully.
186 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL
* CONST CfgMgrProtocol
,
187 IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER
* CONST Srat
,
188 IN CONST UINT32 GicItsAffOffset
,
189 IN CONST CM_ARM_GIC_ITS_INFO
* GicItsInfo
,
190 IN UINT32 GicItsCount
193 EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE
* GicItsAff
;
195 ASSERT (Srat
!= NULL
);
196 ASSERT (GicItsInfo
!= NULL
);
198 GicItsAff
= (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE
*)((UINT8
*)Srat
+
201 while (GicItsCount
-- != 0) {
202 DEBUG ((DEBUG_INFO
, "SRAT: GicItsAff = 0x%p\n", GicItsAff
));
204 GicItsAff
->Type
= EFI_ACPI_6_3_GIC_ITS_AFFINITY
;
205 GicItsAff
->Length
= sizeof (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE
);
206 GicItsAff
->ProximityDomain
= GicItsInfo
->ProximityDomain
;
207 GicItsAff
->Reserved
[0] = EFI_ACPI_RESERVED_BYTE
;
208 GicItsAff
->Reserved
[1] = EFI_ACPI_RESERVED_BYTE
;
209 GicItsAff
->ItsId
= GicItsInfo
->GicItsId
;
218 /** Add the Memory Affinity Structures in the SRAT Table.
220 @param [in] CfgMgrProtocol Pointer to the Configuration Manager
222 @param [in] Srat Pointer to the SRAT Table.
223 @param [in] MemAffOffset Offset of the Memory Affinity
224 information in the SRAT Table.
225 @param [in] MemAffInfo Pointer to the Memory Affinity Information list.
226 @param [in] MemAffCount Count of Memory Affinity objects.
228 @retval EFI_SUCCESS Table generated successfully.
233 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL
* CONST CfgMgrProtocol
,
234 IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER
* CONST Srat
,
235 IN CONST UINT32 MemAffOffset
,
236 IN CONST CM_ARM_MEMORY_AFFINITY_INFO
* MemAffInfo
,
237 IN UINT32 MemAffCount
240 EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE
* MemAff
;
242 ASSERT (Srat
!= NULL
);
243 ASSERT (MemAffInfo
!= NULL
);
245 MemAff
= (EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE
*)((UINT8
*)Srat
+
248 while (MemAffCount
-- != 0) {
249 DEBUG ((DEBUG_INFO
, "SRAT: MemAff = 0x%p\n", MemAff
));
251 MemAff
->Type
= EFI_ACPI_6_3_MEMORY_AFFINITY
;
252 MemAff
->Length
= sizeof (EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE
);
253 MemAff
->ProximityDomain
= MemAffInfo
->ProximityDomain
;
254 MemAff
->Reserved1
= EFI_ACPI_RESERVED_WORD
;
255 MemAff
->AddressBaseLow
= (UINT32
)(MemAffInfo
->BaseAddress
& MAX_UINT32
);
256 MemAff
->AddressBaseHigh
= (UINT32
)(MemAffInfo
->BaseAddress
>> 32);
257 MemAff
->LengthLow
= (UINT32
)(MemAffInfo
->Length
& MAX_UINT32
);
258 MemAff
->LengthHigh
= (UINT32
)(MemAffInfo
->Length
>> 32);
259 MemAff
->Reserved2
= EFI_ACPI_RESERVED_DWORD
;
260 MemAff
->Flags
= MemAffInfo
->Flags
;
261 MemAff
->Reserved3
= EFI_ACPI_RESERVED_QWORD
;
271 /** Add the Generic Initiator Affinity Structures in the SRAT Table.
273 @param [in] CfgMgrProtocol Pointer to the Configuration Manager
275 @param [in] Srat Pointer to the SRAT Table.
276 @param [in] GenInitAffOff Offset of the Generic Initiator Affinity
277 information in the SRAT Table.
278 @param [in] GenInitAffInfo Pointer to the Generic Initiator Affinity
280 @param [in] GenInitAffCount Count of Generic Initiator Affinity
283 @retval EFI_SUCCESS Table generated successfully.
284 @retval EFI_INVALID_PARAMETER A parameter is invalid.
285 @retval EFI_NOT_FOUND The required object information is not found.
286 @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
287 Manager is less than the Object size for the
292 AddGenericInitiatorAffinity (
293 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL
* CONST CfgMgrProtocol
,
294 IN EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER
* CONST Srat
,
295 IN CONST UINT32 GenInitAffOff
,
296 IN CONST CM_ARM_GENERIC_INITIATOR_AFFINITY_INFO
* GenInitAffInfo
,
297 IN UINT32 GenInitAffCount
301 EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY_STRUCTURE
* GenInitAff
;
302 CM_ARM_DEVICE_HANDLE_ACPI
* DeviceHandleAcpi
;
303 CM_ARM_DEVICE_HANDLE_PCI
* DeviceHandlePci
;
304 UINT32 DeviceHandleCount
;
306 ASSERT (Srat
!= NULL
);
307 ASSERT (GenInitAffInfo
!= NULL
);
309 GenInitAff
= (EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY_STRUCTURE
*)(
310 (UINT8
*)Srat
+ GenInitAffOff
);
312 while (GenInitAffCount
-- != 0) {
313 DEBUG ((DEBUG_INFO
, "SRAT: GenInitAff = 0x%p\n", GenInitAff
));
315 GenInitAff
->Type
= EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY
;
317 sizeof (EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY_STRUCTURE
);
318 GenInitAff
->Reserved1
= EFI_ACPI_RESERVED_WORD
;
319 GenInitAff
->DeviceHandleType
= GenInitAffInfo
->DeviceHandleType
;
320 GenInitAff
->ProximityDomain
= GenInitAffInfo
->ProximityDomain
;
322 if (GenInitAffInfo
->DeviceHandleToken
== CM_NULL_TOKEN
) {
325 "ERROR: SRAT: Invalid Device Handle Token.\n"
328 return EFI_INVALID_PARAMETER
;
331 if (GenInitAffInfo
->DeviceHandleType
== EFI_ACPI_6_3_ACPI_DEVICE_HANDLE
) {
332 Status
= GetEArmObjDeviceHandleAcpi (
334 GenInitAffInfo
->DeviceHandleToken
,
338 if (EFI_ERROR (Status
)) {
341 "ERROR: SRAT: Failed to get ACPI Device Handle Inf."
342 " DeviceHandleToken = %p."
344 GenInitAffInfo
->DeviceHandleToken
,
350 // We are expecting only one device handle.
351 ASSERT (DeviceHandleCount
== 1);
353 // Populate the ACPI device handle information.
354 GenInitAff
->DeviceHandle
.Acpi
.AcpiHid
= DeviceHandleAcpi
->Hid
;
355 GenInitAff
->DeviceHandle
.Acpi
.AcpiUid
= DeviceHandleAcpi
->Uid
;
356 GenInitAff
->DeviceHandle
.Acpi
.Reserved
[0] = EFI_ACPI_RESERVED_BYTE
;
357 GenInitAff
->DeviceHandle
.Acpi
.Reserved
[1] = EFI_ACPI_RESERVED_BYTE
;
358 GenInitAff
->DeviceHandle
.Acpi
.Reserved
[2] = EFI_ACPI_RESERVED_BYTE
;
359 GenInitAff
->DeviceHandle
.Acpi
.Reserved
[3] = EFI_ACPI_RESERVED_BYTE
;
360 } else if (GenInitAffInfo
->DeviceHandleType
==
361 EFI_ACPI_6_3_PCI_DEVICE_HANDLE
) {
362 Status
= GetEArmObjDeviceHandlePci (
364 GenInitAffInfo
->DeviceHandleToken
,
368 if (EFI_ERROR (Status
)) {
371 "ERROR: SRAT: Failed to get ACPI Device Handle Inf."
372 " DeviceHandleToken = %p."
374 GenInitAffInfo
->DeviceHandleToken
,
380 // We are expecting only one device handle
381 ASSERT (DeviceHandleCount
== 1);
383 // Populate the ACPI device handle information.
384 GenInitAff
->DeviceHandle
.Pci
.PciSegment
= DeviceHandlePci
->SegmentNumber
;
385 GenInitAff
->DeviceHandle
.Pci
.PciBdfNumber
= GetBdf (DeviceHandlePci
);
387 GenInitAff
->DeviceHandle
.Pci
.Reserved
[0] = EFI_ACPI_RESERVED_BYTE
;
388 GenInitAff
->DeviceHandle
.Pci
.Reserved
[1] = EFI_ACPI_RESERVED_BYTE
;
389 GenInitAff
->DeviceHandle
.Pci
.Reserved
[2] = EFI_ACPI_RESERVED_BYTE
;
390 GenInitAff
->DeviceHandle
.Pci
.Reserved
[3] = EFI_ACPI_RESERVED_BYTE
;
391 GenInitAff
->DeviceHandle
.Pci
.Reserved
[4] = EFI_ACPI_RESERVED_BYTE
;
392 GenInitAff
->DeviceHandle
.Pci
.Reserved
[5] = EFI_ACPI_RESERVED_BYTE
;
393 GenInitAff
->DeviceHandle
.Pci
.Reserved
[6] = EFI_ACPI_RESERVED_BYTE
;
394 GenInitAff
->DeviceHandle
.Pci
.Reserved
[7] = EFI_ACPI_RESERVED_BYTE
;
395 GenInitAff
->DeviceHandle
.Pci
.Reserved
[8] = EFI_ACPI_RESERVED_BYTE
;
396 GenInitAff
->DeviceHandle
.Pci
.Reserved
[9] = EFI_ACPI_RESERVED_BYTE
;
397 GenInitAff
->DeviceHandle
.Pci
.Reserved
[10] = EFI_ACPI_RESERVED_BYTE
;
398 GenInitAff
->DeviceHandle
.Pci
.Reserved
[11] = EFI_ACPI_RESERVED_BYTE
;
402 "ERROR: SRAT: Invalid Device Handle Type.\n"
405 return EFI_INVALID_PARAMETER
;
408 GenInitAff
->Flags
= GenInitAffInfo
->Flags
;
409 GenInitAff
->Reserved2
[0] = EFI_ACPI_RESERVED_BYTE
;
410 GenInitAff
->Reserved2
[1] = EFI_ACPI_RESERVED_BYTE
;
419 /** Construct the SRAT ACPI table.
421 Called by the Dynamic Table Manager, this function invokes the
422 Configuration Manager protocol interface to get the required hardware
423 information for generating the ACPI table.
425 If this function allocates any resources then they must be freed
426 in the FreeXXXXTableResources function.
428 @param [in] This Pointer to the table generator.
429 @param [in] AcpiTableInfo Pointer to the ACPI Table Info.
430 @param [in] CfgMgrProtocol Pointer to the Configuration Manager
432 @param [out] Table Pointer to the constructed ACPI Table.
434 @retval EFI_SUCCESS Table generated successfully.
435 @retval EFI_INVALID_PARAMETER A parameter is invalid.
436 @retval EFI_NOT_FOUND The required object was not found.
437 @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
438 Manager is less than the Object size for the
440 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
446 IN CONST ACPI_TABLE_GENERATOR
* CONST This
,
447 IN CONST CM_STD_OBJ_ACPI_TABLE_INFO
* CONST AcpiTableInfo
,
448 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL
* CONST CfgMgrProtocol
,
449 OUT EFI_ACPI_DESCRIPTION_HEADER
** CONST Table
457 UINT32 GenInitiatorAffCount
;
459 UINT32 GicCAffOffset
;
460 UINT32 GicItsAffOffset
;
462 UINT32 GenInitiatorAffOffset
;
464 CM_ARM_GICC_INFO
* GicCInfo
;
465 CM_ARM_GIC_ITS_INFO
* GicItsInfo
;
466 CM_ARM_MEMORY_AFFINITY_INFO
* MemAffInfo
;
467 CM_ARM_GENERIC_INITIATOR_AFFINITY_INFO
* GenInitiatorAffInfo
;
469 EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER
* Srat
;
473 (AcpiTableInfo
!= NULL
) &&
474 (CfgMgrProtocol
!= NULL
) &&
476 (AcpiTableInfo
->TableGeneratorId
== This
->GeneratorID
) &&
477 (AcpiTableInfo
->AcpiTableSignature
== This
->AcpiTableSignature
)
480 if ((AcpiTableInfo
->AcpiTableRevision
< This
->MinAcpiTableRevision
) ||
481 (AcpiTableInfo
->AcpiTableRevision
> This
->AcpiTableRevision
)) {
484 "ERROR: SRAT: Requested table revision = %d is not supported. "
485 "Supported table revisions: Minimum = %d. Maximum = %d\n",
486 AcpiTableInfo
->AcpiTableRevision
,
487 This
->MinAcpiTableRevision
,
488 This
->AcpiTableRevision
490 return EFI_INVALID_PARAMETER
;
495 Status
= GetEArmObjGicCInfo (
501 if (EFI_ERROR (Status
)) {
504 "ERROR: SRAT: Failed to get GICC Info. Status = %r\n",
510 if (GicCCount
== 0) {
513 "ERROR: SRAT: GIC CPU Interface information not provided.\n"
516 Status
= EFI_INVALID_PARAMETER
;
520 Status
= GetEArmObjGicItsInfo (
526 if (EFI_ERROR (Status
) && (Status
!= EFI_NOT_FOUND
)) {
529 "ERROR: SRAT: Failed to get GIC ITS Info. Status = %r\n",
535 Status
= GetEArmObjMemoryAffinityInfo (
541 if (EFI_ERROR (Status
) && (Status
!= EFI_NOT_FOUND
)) {
544 "ERROR: SRAT: Failed to get Memory Affinity Info. Status = %r\n",
550 Status
= GetEArmObjGenericInitiatorAffinityInfo (
553 &GenInitiatorAffInfo
,
554 &GenInitiatorAffCount
556 if (EFI_ERROR (Status
) && (Status
!= EFI_NOT_FOUND
)) {
559 "ERROR: SRAT: Failed to get Generic Initiator Affinity Info."
566 // Calculate the size of the SRAT table
567 TableSize
= sizeof (EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER
);
569 GicCAffOffset
= TableSize
;
570 TableSize
+= (sizeof (EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE
) * GicCCount
);
572 if (GicItsCount
!= 0) {
573 GicItsAffOffset
= TableSize
;
574 TableSize
+= (sizeof (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE
) *
578 if (MemAffCount
!= 0) {
579 MemAffOffset
= TableSize
;
580 TableSize
+= (sizeof (EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE
) *
584 if (GenInitiatorAffCount
!= 0) {
585 GenInitiatorAffOffset
= TableSize
;
586 TableSize
+= (sizeof (EFI_ACPI_6_3_GENERIC_INITIATOR_AFFINITY_STRUCTURE
) *
587 GenInitiatorAffCount
);
590 // Allocate the Buffer for SRAT table
591 *Table
= (EFI_ACPI_DESCRIPTION_HEADER
*)AllocateZeroPool (TableSize
);
592 if (*Table
== NULL
) {
593 Status
= EFI_OUT_OF_RESOURCES
;
596 "ERROR: SRAT: Failed to allocate memory for SRAT Table, Size = %d," \
604 Srat
= (EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER
*)*Table
;
608 "SRAT: Srat = 0x%p TableSize = 0x%x\n",
613 Status
= AddAcpiHeader (
620 if (EFI_ERROR (Status
)) {
623 "ERROR: SRAT: Failed to add ACPI header. Status = %r\n",
629 // Setup the Reserved fields
630 // Reserved1 must be set to 1 for backward compatibility
632 Srat
->Reserved2
= EFI_ACPI_RESERVED_QWORD
;
634 Status
= AddGICCAffinity (
641 if (EFI_ERROR (Status
)) {
644 "ERROR: SRAT: Failed to add GICC Affinity structures. Status = %r\n",
650 if (GicItsCount
!= 0) {
651 Status
= AddGICItsAffinity (
658 if (EFI_ERROR (Status
)) {
661 "ERROR: SRAT: Failed to add GIC ITS Affinity structures. Status = %r\n",
668 if (MemAffCount
!= 0) {
669 Status
= AddMemoryAffinity (
676 if (EFI_ERROR (Status
)) {
679 "ERROR: SRAT: Failed to add Memory Affinity structures. Status = %r\n",
686 if (GenInitiatorAffCount
!= 0) {
687 Status
= AddGenericInitiatorAffinity (
690 GenInitiatorAffOffset
,
694 if (EFI_ERROR (Status
)) {
697 "ERROR: SRAT: Failed to add Generic Initiator Affinity structures."
709 if (*Table
!= NULL
) {
717 /** Free any resources allocated for constructing the SRAT.
719 @param [in] This Pointer to the table generator.
720 @param [in] AcpiTableInfo Pointer to the ACPI Table Info.
721 @param [in] CfgMgrProtocol Pointer to the Configuration Manager
723 @param [in, out] Table Pointer to the ACPI Table.
725 @retval EFI_SUCCESS The resources were freed successfully.
726 @retval EFI_INVALID_PARAMETER The table pointer is NULL or invalid.
730 FreeSratTableResources (
731 IN CONST ACPI_TABLE_GENERATOR
* CONST This
,
732 IN CONST CM_STD_OBJ_ACPI_TABLE_INFO
* CONST AcpiTableInfo
,
733 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL
* CONST CfgMgrProtocol
,
734 IN OUT EFI_ACPI_DESCRIPTION_HEADER
** CONST Table
739 (AcpiTableInfo
!= NULL
) &&
740 (CfgMgrProtocol
!= NULL
) &&
741 (AcpiTableInfo
->TableGeneratorId
== This
->GeneratorID
) &&
742 (AcpiTableInfo
->AcpiTableSignature
== This
->AcpiTableSignature
)
745 if ((Table
== NULL
) || (*Table
== NULL
)) {
746 DEBUG ((DEBUG_ERROR
, "ERROR: SRAT: Invalid Table Pointer\n"));
748 return EFI_INVALID_PARAMETER
;
756 /** The SRAT Table Generator revision.
758 #define SRAT_GENERATOR_REVISION CREATE_REVISION (1, 0)
760 /** The interface for the SRAT Table Generator.
764 ACPI_TABLE_GENERATOR SratGenerator
= {
766 CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSrat
),
767 // Generator Description
768 L
"ACPI.STD.SRAT.GENERATOR",
769 // ACPI Table Signature
770 EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_SIGNATURE
,
771 // ACPI Table Revision supported by this Generator
772 EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_REVISION
,
773 // Minimum supported ACPI Table Revision
774 EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_REVISION
,
776 TABLE_GENERATOR_CREATOR_ID_ARM
,
778 SRAT_GENERATOR_REVISION
,
779 // Build Table function
781 // Free Resource function
782 FreeSratTableResources
,
783 // Extended build function not needed
785 // Extended build function not implemented by the generator.
786 // Hence extended free resource function is not required.
790 /** Register the Generator with the ACPI Table Factory.
792 @param [in] ImageHandle The handle to the image.
793 @param [in] SystemTable Pointer to the System Table.
795 @retval EFI_SUCCESS The Generator is registered.
796 @retval EFI_INVALID_PARAMETER A parameter is invalid.
797 @retval EFI_ALREADY_STARTED The Generator for the Table ID
798 is already registered.
802 AcpiSratLibConstructor (
803 IN EFI_HANDLE ImageHandle
,
804 IN EFI_SYSTEM_TABLE
* SystemTable
808 Status
= RegisterAcpiTableGenerator (&SratGenerator
);
809 DEBUG ((DEBUG_INFO
, "SRAT: Register Generator. Status = %r\n", Status
));
810 ASSERT_EFI_ERROR (Status
);
814 /** Deregister the Generator from the ACPI Table Factory.
816 @param [in] ImageHandle The handle to the image.
817 @param [in] SystemTable Pointer to the System Table.
819 @retval EFI_SUCCESS The Generator is deregistered.
820 @retval EFI_INVALID_PARAMETER A parameter is invalid.
821 @retval EFI_NOT_FOUND The Generator is not registered.
825 AcpiSratLibDestructor (
826 IN EFI_HANDLE ImageHandle
,
827 IN EFI_SYSTEM_TABLE
* SystemTable
831 Status
= DeregisterAcpiTableGenerator (&SratGenerator
);
832 DEBUG ((DEBUG_INFO
, "SRAT: Deregister Generator. Status = %r\n", Status
));
833 ASSERT_EFI_ERROR (Status
);