TianoCore EDK2 master
|
#include "CmObjectDescUtility.h"
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include "FdtHwInfoParser.h"
#include "Pci/PciConfigSpaceParser.h"
Go to the source code of this file.
Functions | |
STATIC EFI_STATUS EFIAPI | GetPciSegGroup (IN CONST VOID *Fdt, IN INT32 HostPciNode, OUT INT32 *SegGroup) |
STATIC EFI_STATUS EFIAPI | PopulateBusRange (IN CONST VOID *Fdt, IN INT32 HostPciNode, IN OUT PCI_PARSER_TABLE *PciInfo) |
STATIC EFI_STATUS EFIAPI | ParseAddressMap (IN CONST VOID *Fdt, IN INT32 HostPciNode, IN INT32 AddressCells, IN OUT PCI_PARSER_TABLE *PciInfo) |
STATIC EFI_STATUS EFIAPI | ParseIrqMap (IN CONST VOID *Fdt, IN INT32 HostPciNode, IN OUT PCI_PARSER_TABLE *PciInfo) |
STATIC EFI_STATUS EFIAPI | PciNodeParser (IN CONST VOID *Fdt, IN INT32 HostPciNode, IN OUT PCI_PARSER_TABLE *PciInfo) |
STATIC EFI_STATUS EFIAPI | PciInfoAdd (IN CONST FDT_HW_INFO_PARSER_HANDLE FdtParserHandle, IN PCI_PARSER_TABLE *PciTableInfo) |
STATIC EFI_STATUS EFIAPI | FreeParserTable (IN PCI_PARSER_TABLE *PciTableInfo) |
EFI_STATUS EFIAPI | PciConfigInfoParser (IN CONST FDT_HW_INFO_PARSER_HANDLE FdtParserHandle, IN INT32 FdtBranch) |
Variables | |
STATIC CONST COMPATIBILITY_STR | PciCompatibleStr [] |
STATIC CONST COMPATIBILITY_INFO | PciCompatibleInfo |
PCI Configuration Space Parser.
Copyright (c) 2021, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file PciConfigSpaceParser.c.
STATIC EFI_STATUS EFIAPI FreeParserTable | ( | IN PCI_PARSER_TABLE * | PciTableInfo | ) |
Free the CmObjDesc of the ParserTable.
[in] | PciTableInfo | PCI_PARSER_TABLE structure containing the CmObjs to free. |
EFI_SUCCESS | The function completed successfully. |
EFI_INVALID_PARAMETER | Invalid parameter. |
Definition at line 657 of file PciConfigSpaceParser.c.
STATIC EFI_STATUS EFIAPI GetPciSegGroup | ( | IN CONST VOID * | Fdt, |
IN INT32 | HostPciNode, | ||
OUT INT32 * | SegGroup | ||
) |
Get the Segment group (also called: Domain Id) of a host-pci node.
kernel/Documentation/devicetree/bindings/pci/pci.txt: "It is required to either not set this property at all or set it for all host bridges in the system"
The function checks the "linux,pci-domain" property of the host-pci node. Either all host-pci nodes must have this property, or none of them. If the property is available, read it. Otherwise dynamically assign the Ids.
[in] | Fdt | Pointer to a Flattened Device Tree (Fdt). |
[in] | HostPciNode | Offset of a host-pci node. |
[out] | SegGroup | Segment group assigned to the host-pci controller. |
EFI_SUCCESS | The function completed successfully. |
EFI_ABORTED | An error occurred. |
EFI_INVALID_PARAMETER | Invalid parameter. |
Definition at line 58 of file PciConfigSpaceParser.c.
STATIC EFI_STATUS EFIAPI ParseAddressMap | ( | IN CONST VOID * | Fdt, |
IN INT32 | HostPciNode, | ||
IN INT32 | AddressCells, | ||
IN OUT PCI_PARSER_TABLE * | PciInfo | ||
) |
Parse the PCI address map.
The PCI address map is available in the "ranges" device-tree property.
[in] | Fdt | Pointer to a Flattened Device Tree (Fdt). |
[in] | HostPciNode | Offset of a host-pci node. |
[in] | AddressCells | # of cells used to encode an address on the parent bus. |
[in,out] | PciInfo | PCI_PARSER_TABLE structure storing information about the current host-pci. |
EFI_SUCCESS | The function completed successfully. |
EFI_ABORTED | An error occurred. |
EFI_INVALID_PARAMETER | Invalid parameter. |
EFI_OUT_OF_RESOURCES | An allocation has failed. |
Definition at line 176 of file PciConfigSpaceParser.c.
STATIC EFI_STATUS EFIAPI ParseIrqMap | ( | IN CONST VOID * | Fdt, |
IN INT32 | HostPciNode, | ||
IN OUT PCI_PARSER_TABLE * | PciInfo | ||
) |
Parse the PCI interrupt map.
The PCI interrupt map is available in the "interrupt-map" and "interrupt-map-mask" device-tree properties.
Cf Devicetree Specification Release v0.3, s2.4.3 Interrupt Nexus Properties
An interrupt-map must be as: interrupt-map = < [child unit address] [child interrupt specifier] [interrupt-parent] [parent unit address] [parent interrupt specifier] >
[in] | Fdt | Pointer to a Flattened Device Tree (Fdt). |
[in] | HostPciNode | Offset of a host-pci node. |
[in,out] | PciInfo | PCI_PARSER_TABLE structure storing information about the current host-pci. |
EFI_SUCCESS | The function completed successfully. |
EFI_ABORTED | An error occurred. |
EFI_INVALID_PARAMETER | Invalid parameter. |
EFI_NOT_FOUND | Not found. |
EFI_OUT_OF_RESOURCES | An allocation has failed. |
Definition at line 285 of file PciConfigSpaceParser.c.
EFI_STATUS EFIAPI PciConfigInfoParser | ( | IN CONST FDT_HW_INFO_PARSER_HANDLE | FdtParserHandle, |
IN INT32 | FdtBranch | ||
) |
CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO parser function.
The following structure is populated: typedef struct CmArchCommonPciConfigSpaceInfo { UINT64 BaseAddress; // {Populated} UINT16 PciSegmentGroupNumber; // {Populated} UINT8 StartBusNumber; // {Populated} UINT8 EndBusNumber; // {Populated} } CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO;
typedef struct CmArchCommonPciAddressMapInfo { UINT8 SpaceCode; // {Populated} UINT64 PciAddress; // {Populated} UINT64 CpuAddress; // {Populated} UINT64 AddressSize; // {Populated} } CM_ARCH_COMMON_PCI_ADDRESS_MAP_INFO;
typedef struct CmArchCommonPciInterruptMapInfo { UINT8 PciBus; // {Populated} UINT8 PciDevice; // {Populated} UINT8 PciInterrupt; // {Populated} CM_ARCH_COMMON_GENERIC_INTERRUPT IntcInterrupt; // {Populated} } CM_ARCH_COMMON_PCI_INTERRUPT_MAP_INFO;
A parser parses a Device Tree to populate a specific CmObj type. None, one or many CmObj can be created by the parser. The created CmObj are then handed to the parser's caller through the HW_INFO_ADD_OBJECT interface. This can also be a dispatcher. I.e. a function that not parsing a Device Tree but calling other parsers.
[in] | FdtParserHandle | A handle to the parser instance. |
[in] | FdtBranch | When searching for DT node name, restrict the search to this Device Tree branch. |
EFI_SUCCESS | The function completed successfully. |
EFI_ABORTED | An error occurred. |
EFI_INVALID_PARAMETER | Invalid parameter. |
EFI_NOT_FOUND | Not found. |
EFI_UNSUPPORTED | Unsupported. |
Definition at line 722 of file PciConfigSpaceParser.c.
STATIC EFI_STATUS EFIAPI PciInfoAdd | ( | IN CONST FDT_HW_INFO_PARSER_HANDLE | FdtParserHandle, |
IN PCI_PARSER_TABLE * | PciTableInfo | ||
) |
Add the parsed Pci information to the Configuration Manager.
CmObj of the following types are concerned:
[in] | FdtParserHandle | A handle to the parser instance. |
[in] | PciTableInfo | PCI_PARSER_TABLE structure containing the CmObjs to add. |
EFI_SUCCESS | The function completed successfully. |
EFI_INVALID_PARAMETER | Invalid parameter. |
EFI_OUT_OF_RESOURCES | An allocation has failed. |
Definition at line 589 of file PciConfigSpaceParser.c.
STATIC EFI_STATUS EFIAPI PciNodeParser | ( | IN CONST VOID * | Fdt, |
IN INT32 | HostPciNode, | ||
IN OUT PCI_PARSER_TABLE * | PciInfo | ||
) |
Parse a Host-pci node.
[in] | Fdt | Pointer to a Flattened Device Tree (Fdt). |
[in] | HostPciNode | Offset of a host-pci node. |
[in,out] | PciInfo | The CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO to populate. |
EFI_SUCCESS | The function completed successfully. |
EFI_ABORTED | An error occurred. |
EFI_INVALID_PARAMETER | Invalid parameter. |
EFI_OUT_OF_RESOURCES | An allocation has failed. |
Definition at line 473 of file PciConfigSpaceParser.c.
STATIC EFI_STATUS EFIAPI PopulateBusRange | ( | IN CONST VOID * | Fdt, |
IN INT32 | HostPciNode, | ||
IN OUT PCI_PARSER_TABLE * | PciInfo | ||
) |
Parse the bus-range controlled by this host-pci node.
[in] | Fdt | Pointer to a Flattened Device Tree (Fdt). |
[in] | HostPciNode | Offset of a host-pci node. |
[in,out] | PciInfo | PCI_PARSER_TABLE structure storing information about the current host-pci. |
EFI_SUCCESS | The function completed successfully. |
EFI_ABORTED | An error occurred. |
EFI_INVALID_PARAMETER | Invalid parameter. |
Definition at line 119 of file PciConfigSpaceParser.c.
STATIC CONST COMPATIBILITY_INFO PciCompatibleInfo |
COMPATIBILITY_INFO structure for the PCIe.
Definition at line 32 of file PciConfigSpaceParser.c.
STATIC CONST COMPATIBILITY_STR PciCompatibleStr[] |
List of "compatible" property values for host PCIe bridges nodes.
Any other "compatible" value is not supported by this module.
Definition at line 26 of file PciConfigSpaceParser.c.