TianoCore EDK2 master
|
#include <Library/AcpiLib.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Protocol/AcpiTable.h>
#include <AcpiTableGenerator.h>
#include <ConfigurationManagerObject.h>
#include <ConfigurationManagerHelper.h>
#include <Library/AcpiHelperLib.h>
#include <Library/TableHelperLib.h>
#include <Library/AmlLib/AmlLib.h>
#include <Library/SsdtPcieSupportLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
#include "SsdtPcieGenerator.h"
Go to the source code of this file.
Macros | |
#define | PCI_MAX_DEVICE_COUNT_PER_BUS 32 |
#define | PCI_MAX_FUNCTION_COUNT_PER_DEVICE 8 |
#define | SSDT_PCI_GENERATOR_REVISION CREATE_REVISION (1, 0) |
Variables | |
STATIC ACPI_PCI_GENERATOR | SsdtPcieGenerator |
SSDT Pcie Table Generator.
Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file SsdtPcieGenerator.c.
#define PCI_MAX_DEVICE_COUNT_PER_BUS 32 |
Definition at line 37 of file SsdtPcieGenerator.c.
#define PCI_MAX_FUNCTION_COUNT_PER_DEVICE 8 |
Definition at line 38 of file SsdtPcieGenerator.c.
#define SSDT_PCI_GENERATOR_REVISION CREATE_REVISION (1, 0) |
This macro defines the SSDT Pci Table Generator revision.
Definition at line 1152 of file SsdtPcieGenerator.c.
EFI_STATUS EFIAPI AcpiSsdtPcieLibConstructor | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
Register the Generator with the ACPI Table Factory.
[in] | ImageHandle | The handle to the image. |
[in] | SystemTable | Pointer to the System Table. |
EFI_SUCCESS | The Generator is registered. |
EFI_INVALID_PARAMETER | A parameter is invalid. |
EFI_ALREADY_STARTED | The Generator for the Table ID is already registered. |
Definition at line 1209 of file SsdtPcieGenerator.c.
EFI_STATUS EFIAPI AcpiSsdtPcieLibDestructor | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
Deregister the Generator from the ACPI Table Factory.
[in] | ImageHandle | The handle to the image. |
[in] | SystemTable | Pointer to the System Table. |
EFI_SUCCESS | The Generator is deregistered. |
EFI_INVALID_PARAMETER | A parameter is invalid. |
EFI_NOT_FOUND | The Generator is not registered. |
Definition at line 1237 of file SsdtPcieGenerator.c.
STATIC EFI_STATUS EFIAPI BuildSsdtPciTable | ( | IN ACPI_PCI_GENERATOR * | Generator, |
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST | CfgMgrProtocol, | ||
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST | AcpiTableInfo, | ||
IN CONST CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO * | PciInfo, | ||
IN UINT32 | Uid, | ||
OUT EFI_ACPI_DESCRIPTION_HEADER ** | Table | ||
) |
Build an Ssdt table describing a Pci device.
[in] | Generator | The SSDT Pci generator. |
[in] | CfgMgrProtocol | Pointer to the Configuration Manager Protocol interface. |
[in] | AcpiTableInfo | Pointer to the ACPI table information. |
[in] | PciInfo | Pci device information. |
[in] | Uid | Unique Id of the Pci device. |
[out] | Table | If success, contains the created SSDT table. |
EFI_SUCCESS | The function completed successfully. |
EFI_INVALID_PARAMETER | Invalid parameter. |
EFI_OUT_OF_RESOURCES | Could not allocate memory. |
Definition at line 867 of file SsdtPcieGenerator.c.
STATIC EFI_STATUS EFIAPI BuildSsdtPciTableEx | ( | IN CONST ACPI_TABLE_GENERATOR * | This, |
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST | AcpiTableInfo, | ||
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST | CfgMgrProtocol, | ||
OUT EFI_ACPI_DESCRIPTION_HEADER *** | Table, | ||
OUT UINTN *CONST | TableCount | ||
) |
Construct SSDT tables describing Pci root complexes.
This function invokes the Configuration Manager protocol interface to get the required hardware information for generating the ACPI table.
If this function allocates any resources then they must be freed in the FreeXXXXTableResourcesEx function.
[in] | This | Pointer to the ACPI table generator. |
[in] | AcpiTableInfo | Pointer to the ACPI table information. |
[in] | CfgMgrProtocol | Pointer to the Configuration Manager Protocol interface. |
[out] | Table | Pointer to a list of generated ACPI table(s). |
[out] | TableCount | Number of generated ACPI table(s). |
EFI_SUCCESS | Table generated successfully. |
EFI_BAD_BUFFER_SIZE | The size returned by the Configuration Manager is less than the Object size for the requested object. |
EFI_INVALID_PARAMETER | A parameter is invalid. |
EFI_NOT_FOUND | Could not find information. |
EFI_OUT_OF_RESOURCES | Could not allocate memory. |
EFI_UNSUPPORTED | Unsupported configuration. |
Definition at line 971 of file SsdtPcieGenerator.c.
STATIC EFI_STATUS EFIAPI FreeSsdtPciTableEx | ( | IN CONST ACPI_TABLE_GENERATOR *CONST | This, |
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST | AcpiTableInfo, | ||
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST | CfgMgrProtocol, | ||
IN OUT EFI_ACPI_DESCRIPTION_HEADER ***CONST | Table, | ||
IN CONST UINTN | TableCount | ||
) |
Free any resources allocated for constructing the tables.
[in] | This | Pointer to the ACPI table generator. |
[in] | AcpiTableInfo | Pointer to the ACPI Table Info. |
[in] | CfgMgrProtocol | Pointer to the Configuration Manager Protocol Interface. |
[in,out] | Table | Pointer to an array of pointers to ACPI Table(s). |
[in] | TableCount | Number of ACPI table(s). |
EFI_SUCCESS | The resources were freed successfully. |
EFI_INVALID_PARAMETER | The table pointer is NULL or invalid. |
Definition at line 1102 of file SsdtPcieGenerator.c.
STATIC EFI_STATUS EFIAPI GenerateMotherboardDevice | ( | IN AML_OBJECT_NODE_HANDLE | PciNode, |
OUT AML_OBJECT_NODE_HANDLE * | CrsNode | ||
) |
Generate a RES0 device node to reserve PNP motherboard resources for a given PCI node.
[in] | PciNode | Parent PCI node handle of the generated resource object. |
[out] | CrsNode | CRS node of the AML tree to populate. |
EFI_SUCCESS | The function completed successfully. |
EFI_INVALID_PARAMETER | Invalid input parameter. |
EFI_OUT_OF_RESOURCES | Could not allocate memory. |
Definition at line 639 of file SsdtPcieGenerator.c.
STATIC EFI_STATUS EFIAPI GeneratePciCrs | ( | IN ACPI_PCI_GENERATOR * | Generator, |
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST | CfgMgrProtocol, | ||
IN CONST CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO * | PciInfo, | ||
IN OUT AML_OBJECT_NODE_HANDLE | PciNode | ||
) |
Generate a _CRS method for the Pci device.
[in] | Generator | The SSDT Pci generator. |
[in] | CfgMgrProtocol | Pointer to the Configuration Manager Protocol interface. |
[in] | PciInfo | Pci device information. |
[in,out] | PciNode | Pci node to amend. |
EFI_SUCCESS | The function completed successfully. |
EFI_INVALID_PARAMETER | Invalid parameter. |
EFI_OUT_OF_RESOURCES | Could not allocate memory. |
Definition at line 451 of file SsdtPcieGenerator.c.
STATIC EFI_STATUS EFIAPI GeneratePciDevice | ( | IN ACPI_PCI_GENERATOR * | Generator, |
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST | CfgMgrProtocol, | ||
IN CONST CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO * | PciInfo, | ||
IN UINT32 | Uid, | ||
IN OUT AML_ROOT_NODE_HANDLE * | RootNode | ||
) |
Generate a Pci device.
[in] | Generator | The SSDT Pci generator. |
[in] | CfgMgrProtocol | Pointer to the Configuration Manager Protocol interface. |
[in] | PciInfo | Pci device information. |
[in] | Uid | Unique Id of the Pci device. |
[in,out] | RootNode | RootNode of the AML tree to populate. |
EFI_SUCCESS | The function completed successfully. |
EFI_INVALID_PARAMETER | Invalid parameter. |
EFI_OUT_OF_RESOURCES | Could not allocate memory. |
Definition at line 765 of file SsdtPcieGenerator.c.
STATIC EFI_STATUS EFIAPI GeneratePciDeviceInfo | ( | IN CONST CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO * | PciInfo, |
IN UINT32 | Uid, | ||
IN OUT AML_OBJECT_NODE_HANDLE | PciNode | ||
) |
Generate required Pci device information.
ASL code: Name (_UID, <Uid>) // Uid of the Pci device Name (_HID, EISAID ("PNP0A08")) // PCI Express Root Bridge Name (_CID, EISAID ("PNP0A03")) // Compatible PCI Root Bridge Name (_SEG, <Pci segment group>) // PCI Segment Group number Name (_BBN, <Bus number>) // PCI Base Bus Number Name (_CCA, 1) // Initially mark the PCI coherent
[in] | PciInfo | Pci device information. |
[in] | Uid | Unique Id of the Pci device. |
[in,out] | PciNode | Pci node to amend. |
EFI_SUCCESS | Success. |
EFI_INVALID_PARAMETER | Invalid parameter. |
EFI_OUT_OF_RESOURCES | Failed to allocate memory. |
Definition at line 210 of file SsdtPcieGenerator.c.
STATIC EFI_STATUS EFIAPI GeneratePrt | ( | IN ACPI_PCI_GENERATOR * | Generator, |
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST | CfgMgrProtocol, | ||
IN CONST CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO * | PciInfo, | ||
IN UINT32 | Uid, | ||
IN OUT AML_OBJECT_NODE_HANDLE | PciNode | ||
) |
Generate a _PRT object (Pci Routing Table) for the Pci device.
Cf. ACPI 6.4 specification, s6.2.13 "_PRT (PCI Routing Table)"
[in] | Generator | The SSDT Pci generator. |
[in] | CfgMgrProtocol | Pointer to the Configuration Manager Protocol interface. |
[in] | PciInfo | Pci device information. |
[in] | Uid | Unique Id of the Pci device. |
[in,out] | PciNode | Pci node to amend. |
EFI_SUCCESS | The function completed successfully. |
EFI_INVALID_PARAMETER | Invalid parameter. |
EFI_OUT_OF_RESOURCES | Could not allocate memory. |
Definition at line 305 of file SsdtPcieGenerator.c.
GET_OBJECT_LIST | ( | EObjNameSpaceArchCommon | , |
EArchCommonObjCmRef | , | ||
CM_ARCH_COMMON_OBJ_REF | |||
) |
ARM standard SSDT Pcie Table Generator.
Requirements: The following Configuration Manager Object(s) are required by this Generator:
GET_OBJECT_LIST | ( | EObjNameSpaceArchCommon | , |
EArchCommonObjPciAddressMapInfo | , | ||
CM_ARCH_COMMON_PCI_ADDRESS_MAP_INFO | |||
) |
This macro expands to a function that retrieves the Pci Address Mapping Information from the Configuration Manager.
GET_OBJECT_LIST | ( | EObjNameSpaceArchCommon | , |
EArchCommonObjPciConfigSpaceInfo | , | ||
CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO | |||
) |
This macro expands to a function that retrieves the Pci Configuration Space Information from the Configuration Manager.
GET_OBJECT_LIST | ( | EObjNameSpaceArchCommon | , |
EArchCommonObjPciInterruptMapInfo | , | ||
CM_ARCH_COMMON_PCI_INTERRUPT_MAP_INFO | |||
) |
This macro expands to a function that retrieves the Pci Interrupt Mapping Information from the Configuration Manager.
STATIC UINT32 EFIAPI MappingTableAdd | ( | IN MAPPING_TABLE * | MappingTable, |
IN UINT32 | Integer | ||
) |
Add a new entry to the MappingTable and return its index.
If an entry with [Integer] is already available in the table, return its index without adding a new entry.
[in] | MappingTable | The mapping table structure. |
[in] | Integer | New Integer entry to add. |
The | index of the Integer entry in the MappingTable. |
Definition at line 159 of file SsdtPcieGenerator.c.
STATIC VOID EFIAPI MappingTableFree | ( | IN OUT MAPPING_TABLE * | MappingTable | ) |
Free the MappingTable.
[in,out] | MappingTable | The mapping table structure. |
Definition at line 134 of file SsdtPcieGenerator.c.
STATIC EFI_STATUS EFIAPI MappingTableInitialize | ( | IN MAPPING_TABLE * | MappingTable, |
IN UINT32 | Count | ||
) |
Initialize the MappingTable.
[in] | MappingTable | The mapping table structure. |
[in] | Count | Number of entries to allocate in the MappingTable. |
EFI_SUCCESS | Success. |
EFI_INVALID_PARAMETER | Invalid parameter. |
EFI_OUT_OF_RESOURCES | Failed to allocate memory. |
Definition at line 100 of file SsdtPcieGenerator.c.
STATIC EFI_STATUS EFIAPI ReserveEcamSpace | ( | IN ACPI_PCI_GENERATOR * | Generator, |
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST | CfgMgrProtocol, | ||
IN CONST CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO * | PciInfo, | ||
IN OUT AML_OBJECT_NODE_HANDLE | PciNode | ||
) |
Reserves ECAM space for PCI config space
[in] | Generator | The SSDT Pci generator. |
[in] | CfgMgrProtocol | Pointer to the Configuration Manager Protocol interface. |
[in] | PciInfo | Pci device information. |
[in,out] | PciNode | RootNode of the AML tree to populate. |
EFI_SUCCESS | The function completed successfully. |
EFI_INVALID_PARAMETER | Invalid parameter. |
EFI_OUT_OF_RESOURCES | Could not allocate memory. |
Definition at line 698 of file SsdtPcieGenerator.c.
STATIC ACPI_PCI_GENERATOR SsdtPcieGenerator |
The interface for the SSDT Pci Table Generator.
Definition at line 1157 of file SsdtPcieGenerator.c.