iPXE
pciea.h File Reference

PCI Enhanced Allocation. More...

#include <ipxe/pci.h>

Go to the source code of this file.

Macros

#define PCIEA_ENTRIES   2
 Number of entries.
#define PCIEA_ENTRIES_MASK   0x3f
#define PCIEA_FIRST   4
 First entry.
#define PCIEA_DESC   0
 Entry descriptor.
#define PCIEA_DESC_SIZE(desc)
 Entry size.
#define PCIEA_DESC_BEI(desc)
 BAR equivalent indicator.
#define PCIEA_DESC_ENABLED   0x80000000UL
 Entry is enabled.
#define PCIEA_LOW_BASE   4
 Base address low dword.
#define PCIEA_LOW_LIMIT   8
 Limit low dword.
#define PCIEA_LOW_ATTR_64BIT   0x00000002UL
 BAR is 64-bit.
#define PCIEA_LOW_ATTR_MASK   0x00000003UL
 Low dword attribute bit mask.
#define PCIEA_LOW_HIGH   8
 Offset to high dwords.

Enumerations

enum  pciea_bei {
  PCIEA_BEI_BAR_0 = 0 , PCIEA_BEI_BAR_1 = 1 , PCIEA_BEI_BAR_2 = 2 , PCIEA_BEI_BAR_3 = 3 ,
  PCIEA_BEI_BAR_4 = 4 , PCIEA_BEI_BAR_5 = 5 , PCIEA_BEI_ROM = 8 , PCIEA_BEI_VF_BAR_0 = 9 ,
  PCIEA_BEI_VF_BAR_1 = 10 , PCIEA_BEI_VF_BAR_2 = 11 , PCIEA_BEI_VF_BAR_3 = 12 , PCIEA_BEI_VF_BAR_4 = 13 ,
  PCIEA_BEI_VF_BAR_5 = 14
}
 BAR equivalent indicators. More...

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
unsigned long pciea_bar_start (struct pci_device *pci, unsigned int bei)
 Find the start of a PCI Enhanced Allocation BAR equivalent.
unsigned long pciea_bar_size (struct pci_device *pci, unsigned int bei)
 Find the size of a PCI Enhanced Allocation BAR equivalent.

Detailed Description

PCI Enhanced Allocation.

Definition in file pciea.h.

Macro Definition Documentation

◆ PCIEA_ENTRIES

#define PCIEA_ENTRIES   2

Number of entries.

Definition at line 15 of file pciea.h.

Referenced by pciea_offset().

◆ PCIEA_ENTRIES_MASK

#define PCIEA_ENTRIES_MASK   0x3f

Definition at line 16 of file pciea.h.

Referenced by pciea_offset().

◆ PCIEA_FIRST

#define PCIEA_FIRST   4

First entry.

Definition at line 19 of file pciea.h.

Referenced by pciea_offset().

◆ PCIEA_DESC

#define PCIEA_DESC   0

Entry descriptor.

Definition at line 22 of file pciea.h.

◆ PCIEA_DESC_SIZE

#define PCIEA_DESC_SIZE ( desc)
Value:
( ( (desc) >> 0 ) & 0x7 )
struct ena_llq_option desc
Descriptor counts.
Definition ena.h:9

Entry size.

Definition at line 25 of file pciea.h.

Referenced by pciea_offset().

◆ PCIEA_DESC_BEI

#define PCIEA_DESC_BEI ( desc)
Value:
( ( (desc) >> 4 ) & 0xf )

BAR equivalent indicator.

Definition at line 28 of file pciea.h.

Referenced by pciea_offset().

◆ PCIEA_DESC_ENABLED

#define PCIEA_DESC_ENABLED   0x80000000UL

Entry is enabled.

Definition at line 48 of file pciea.h.

Referenced by pciea_offset().

◆ PCIEA_LOW_BASE

#define PCIEA_LOW_BASE   4

Base address low dword.

Definition at line 51 of file pciea.h.

Referenced by pciea_bar_start().

◆ PCIEA_LOW_LIMIT

#define PCIEA_LOW_LIMIT   8

Limit low dword.

Definition at line 54 of file pciea.h.

Referenced by pciea_bar_size().

◆ PCIEA_LOW_ATTR_64BIT

#define PCIEA_LOW_ATTR_64BIT   0x00000002UL

BAR is 64-bit.

Definition at line 57 of file pciea.h.

Referenced by pciea_bar_value().

◆ PCIEA_LOW_ATTR_MASK

#define PCIEA_LOW_ATTR_MASK   0x00000003UL

Low dword attribute bit mask.

Definition at line 60 of file pciea.h.

Referenced by pciea_bar_size(), and pciea_bar_start().

◆ PCIEA_LOW_HIGH

#define PCIEA_LOW_HIGH   8

Offset to high dwords.

Definition at line 63 of file pciea.h.

Referenced by pciea_bar_value().

Enumeration Type Documentation

◆ pciea_bei

enum pciea_bei

BAR equivalent indicators.

Enumerator
PCIEA_BEI_BAR_0 

Standard BAR 0.

PCIEA_BEI_BAR_1 

Standard BAR 1.

PCIEA_BEI_BAR_2 

Standard BAR 2.

PCIEA_BEI_BAR_3 

Standard BAR 3.

PCIEA_BEI_BAR_4 

Standard BAR 4.

PCIEA_BEI_BAR_5 

Standard BAR 5.

PCIEA_BEI_ROM 

Expansion ROM BAR.

PCIEA_BEI_VF_BAR_0 

Virtual function BAR 0.

PCIEA_BEI_VF_BAR_1 

Virtual function BAR 1.

PCIEA_BEI_VF_BAR_2 

Virtual function BAR 2.

PCIEA_BEI_VF_BAR_3 

Virtual function BAR 3.

PCIEA_BEI_VF_BAR_4 

Virtual function BAR 4.

PCIEA_BEI_VF_BAR_5 

Virtual function BAR 5.

Definition at line 31 of file pciea.h.

31 {
32 PCIEA_BEI_BAR_0 = 0, /**< Standard BAR 0 */
33 PCIEA_BEI_BAR_1 = 1, /**< Standard BAR 1 */
34 PCIEA_BEI_BAR_2 = 2, /**< Standard BAR 2 */
35 PCIEA_BEI_BAR_3 = 3, /**< Standard BAR 3 */
36 PCIEA_BEI_BAR_4 = 4, /**< Standard BAR 4 */
37 PCIEA_BEI_BAR_5 = 5, /**< Standard BAR 5 */
38 PCIEA_BEI_ROM = 8, /**< Expansion ROM BAR */
39 PCIEA_BEI_VF_BAR_0 = 9, /**< Virtual function BAR 0 */
40 PCIEA_BEI_VF_BAR_1 = 10, /**< Virtual function BAR 1 */
41 PCIEA_BEI_VF_BAR_2 = 11, /**< Virtual function BAR 2 */
42 PCIEA_BEI_VF_BAR_3 = 12, /**< Virtual function BAR 3 */
43 PCIEA_BEI_VF_BAR_4 = 13, /**< Virtual function BAR 4 */
44 PCIEA_BEI_VF_BAR_5 = 14, /**< Virtual function BAR 5 */
45};
@ PCIEA_BEI_VF_BAR_5
Virtual function BAR 5.
Definition pciea.h:44
@ PCIEA_BEI_BAR_4
Standard BAR 4.
Definition pciea.h:36
@ PCIEA_BEI_VF_BAR_3
Virtual function BAR 3.
Definition pciea.h:42
@ PCIEA_BEI_BAR_3
Standard BAR 3.
Definition pciea.h:35
@ PCIEA_BEI_VF_BAR_2
Virtual function BAR 2.
Definition pciea.h:41
@ PCIEA_BEI_BAR_0
Standard BAR 0.
Definition pciea.h:32
@ PCIEA_BEI_VF_BAR_1
Virtual function BAR 1.
Definition pciea.h:40
@ PCIEA_BEI_BAR_2
Standard BAR 2.
Definition pciea.h:34
@ PCIEA_BEI_VF_BAR_0
Virtual function BAR 0.
Definition pciea.h:39
@ PCIEA_BEI_BAR_1
Standard BAR 1.
Definition pciea.h:33
@ PCIEA_BEI_ROM
Expansion ROM BAR.
Definition pciea.h:38
@ PCIEA_BEI_VF_BAR_4
Virtual function BAR 4.
Definition pciea.h:43
@ PCIEA_BEI_BAR_5
Standard BAR 5.
Definition pciea.h:37

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ pciea_bar_start()

unsigned long pciea_bar_start ( struct pci_device * pci,
unsigned int bei )
extern

Find the start of a PCI Enhanced Allocation BAR equivalent.

Parameters
pciPCI device
beiBAR equivalent indicator
Return values
startBAR start address

If the address exceeds the size of an unsigned long (i.e. if a 64-bit BAR has a non-zero high dword on a 32-bit machine), the return value will be zero.

Definition at line 130 of file pciea.c.

130 {
131 unsigned long base;
132
133 base = pciea_bar_value ( pci, bei, PCIEA_LOW_BASE );
134 return ( base & ~PCIEA_LOW_ATTR_MASK );
135}
uint32_t base
Base.
Definition librm.h:3
static unsigned long pciea_bar_value(struct pci_device *pci, unsigned int bei, unsigned int low_offset)
Read PCI Enhanced Allocation BAR equivalent value.
Definition pciea.c:88
#define PCIEA_LOW_ATTR_MASK
Low dword attribute bit mask.
Definition pciea.h:60
#define PCIEA_LOW_BASE
Base address low dword.
Definition pciea.h:51

References base, pciea_bar_value(), PCIEA_LOW_ATTR_MASK, and PCIEA_LOW_BASE.

Referenced by txnic_bgx_probe(), and txnic_pf_probe().

◆ pciea_bar_size()

unsigned long pciea_bar_size ( struct pci_device * pci,
unsigned int bei )
extern

Find the size of a PCI Enhanced Allocation BAR equivalent.

Parameters
pciPCI device
beiBAR equivalent indicator
Return values
sizeBAR size

Definition at line 144 of file pciea.c.

144 {
145 unsigned long limit;
146
147 limit = pciea_bar_value ( pci, bei, PCIEA_LOW_LIMIT );
148 return ( limit ? ( ( limit | PCIEA_LOW_ATTR_MASK ) + 1 ) : 0 );
149}
uint16_t limit
Limit.
Definition librm.h:1
#define PCIEA_LOW_LIMIT
Limit low dword.
Definition pciea.h:54

References limit, pciea_bar_value(), PCIEA_LOW_ATTR_MASK, and PCIEA_LOW_LIMIT.

Referenced by txnic_pf_probe().