TianoCore EDK2 master
Loading...
Searching...
No Matches
PciConfigSpaceParser.h File Reference

Go to the source code of this file.

Data Structures

struct  PciParserTable
 

Macros

#define READ_BITS(ADDR, OFF, LEN)   (((ADDR) >> (OFF)) & ((1<<(LEN))-1))
 
#define READ_PCI_N(ADDR)   READ_BITS((ADDR), 31, 1)
 0 if relocatable.
 
#define READ_PCI_P(ADDR)   READ_BITS((ADDR), 30, 1)
 1 if prefetchable.
 
#define READ_PCI_T(ADDR)   READ_BITS((ADDR), 29, 1)
 1 if aliased.
 
#define READ_PCI_SS(ADDR)   READ_BITS((ADDR), 24, 2)
 
#define READ_PCI_BBBBBBBB(ADDR)   READ_BITS((ADDR), 16, 8)
 Bus number.
 
#define READ_PCI_DDDDD(ADDR)   READ_BITS((ADDR), 11, 5)
 Device number.
 
#define PCI_ADDRESS_CELLS   3U
 
#define PCI_SIZE_CELLS   2U
 
#define PCI_INTERRUPTS_CELLS   1U
 
#define DT_PCI_IRQ_FLAGS(x)   (((x) & 0xF) == BIT0)
 

Typedefs

typedef enum PciMappingTable PCI_MAPPING_TABLE
 
typedef struct PciParserTable PCI_PARSER_TABLE
 

Enumerations

enum  PciMappingTable { PciMappingTableAddress , PciMappingTableInterrupt , PciMappingTableMax }
 

Functions

EFI_STATUS EFIAPI PciConfigInfoParser (IN CONST FDT_HW_INFO_PARSER_HANDLE FdtParserHandle, IN INT32 FdtBranch)
 

Detailed Description

PCI Configuration Space Parser.

Copyright (c) 2021, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Reference(s):
  • linux/Documentation/devicetree/bindings/pci/host-generic-pci.yaml
  • PCI Firmware Specification - Revision 3.0
  • Open Firmware Recommended Practice: Interrupt Mapping, Version 0.9
  • Devicetree Specification Release v0.3
  • linux kernel code

Definition in file PciConfigSpaceParser.h.

Macro Definition Documentation

◆ DT_PCI_IRQ_FLAGS

#define DT_PCI_IRQ_FLAGS (   x)    (((x) & 0xF) == BIT0)

PCI interrupt flags for device-tree.

Local Bus Specification Revision 3.0, s2.2.6., Interrupt Pins:

  • 'Interrupts on PCI are optional and defined as "level sensitive," asserted low (negative true)'

Definition at line 65 of file PciConfigSpaceParser.h.

◆ PCI_ADDRESS_CELLS

#define PCI_ADDRESS_CELLS   3U

Number of device-tree cells used for PCI nodes properties.

Values are well defined, except the "#interrupt-cells" which is assumed to be 1.

Definition at line 55 of file PciConfigSpaceParser.h.

◆ PCI_INTERRUPTS_CELLS

#define PCI_INTERRUPTS_CELLS   1U

Definition at line 57 of file PciConfigSpaceParser.h.

◆ PCI_SIZE_CELLS

#define PCI_SIZE_CELLS   2U

Definition at line 56 of file PciConfigSpaceParser.h.

◆ READ_BITS

#define READ_BITS (   ADDR,
  OFF,
  LEN 
)    (((ADDR) >> (OFF)) & ((1<<(LEN))-1))

Read LEN bits at OFF offsets bits of the ADDR.

Parameters
[in]ADDRAddress to read the bits from.
[in]OFFOffset of the bits to read.
[in]LENNumber of bits to read.
Returns
The bits read.

Definition at line 26 of file PciConfigSpaceParser.h.

◆ READ_PCI_BBBBBBBB

#define READ_PCI_BBBBBBBB (   ADDR)    READ_BITS((ADDR), 16, 8)

Bus number.

Definition at line 46 of file PciConfigSpaceParser.h.

◆ READ_PCI_DDDDD

#define READ_PCI_DDDDD (   ADDR)    READ_BITS((ADDR), 11, 5)

Device number.

Definition at line 48 of file PciConfigSpaceParser.h.

◆ READ_PCI_N

#define READ_PCI_N (   ADDR)    READ_BITS((ADDR), 31, 1)

0 if relocatable.

Definition at line 31 of file PciConfigSpaceParser.h.

◆ READ_PCI_P

#define READ_PCI_P (   ADDR)    READ_BITS((ADDR), 30, 1)

1 if prefetchable.

Definition at line 33 of file PciConfigSpaceParser.h.

◆ READ_PCI_SS

#define READ_PCI_SS (   ADDR)    READ_BITS((ADDR), 24, 2)

Space code.

00: Configuration Space 01: I/O Space 10: 32-bit-address Memory Space 11: 64-bit-address Memory Space

Definition at line 44 of file PciConfigSpaceParser.h.

◆ READ_PCI_T

#define READ_PCI_T (   ADDR)    READ_BITS((ADDR), 29, 1)

1 if aliased.

Definition at line 35 of file PciConfigSpaceParser.h.

Typedef Documentation

◆ PCI_MAPPING_TABLE

Indexes in the mapping table.

◆ PCI_PARSER_TABLE

PCI parser table

Multiple address-map and interrupt map can correspond to one host-pci device. This structure allows to temporarily store the CmObjects created and generate tokens once the whole device tree is parsed.

Enumeration Type Documentation

◆ PciMappingTable

Indexes in the mapping table.

Enumerator
PciMappingTableAddress 

0 - Address mapping

PciMappingTableInterrupt 

1 - Interrupt mapping

PciMappingTableMax 

2 - Max

Definition at line 69 of file PciConfigSpaceParser.h.

Function Documentation

◆ PciConfigInfoParser()

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.

Parameters
[in]FdtParserHandleA handle to the parser instance.
[in]FdtBranchWhen searching for DT node name, restrict the search to this Device Tree branch.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_ABORTEDAn error occurred.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_NOT_FOUNDNot found.
EFI_UNSUPPORTEDUnsupported.

Definition at line 722 of file PciConfigSpaceParser.c.