iPXE
Defines | Enumerations | Functions
pciea.h File Reference

PCI Enhanced Allocation. More...

#include <ipxe/pci.h>

Go to the source code of this file.

Defines

#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)   ( ( (desc) >> 0 ) & 0x7 )
 Entry size.
#define PCIEA_DESC_BEI(desc)   ( ( (desc) >> 4 ) & 0xf )
 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.


Define Documentation

#define PCIEA_ENTRIES   2

Number of entries.

Definition at line 15 of file pciea.h.

Referenced by pciea_offset().

#define PCIEA_ENTRIES_MASK   0x3f

Definition at line 16 of file pciea.h.

Referenced by pciea_offset().

#define PCIEA_FIRST   4

First entry.

Definition at line 19 of file pciea.h.

Referenced by pciea_offset().

#define PCIEA_DESC   0

Entry descriptor.

Definition at line 22 of file pciea.h.

#define PCIEA_DESC_SIZE (   desc)    ( ( (desc) >> 0 ) & 0x7 )

Entry size.

Definition at line 25 of file pciea.h.

Referenced by pciea_offset().

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

BAR equivalent indicator.

Definition at line 28 of file pciea.h.

Referenced by pciea_offset().

#define PCIEA_DESC_ENABLED   0x80000000UL

Entry is enabled.

Definition at line 48 of file pciea.h.

Referenced by pciea_offset().

#define PCIEA_LOW_BASE   4

Base address low dword.

Definition at line 51 of file pciea.h.

Referenced by pciea_bar_start().

#define PCIEA_LOW_LIMIT   8

Limit low dword.

Definition at line 54 of file pciea.h.

Referenced by pciea_bar_size().

#define PCIEA_LOW_ATTR_64BIT   0x00000002UL

BAR is 64-bit.

Definition at line 57 of file pciea.h.

Referenced by pciea_bar_value().

#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().

#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

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.

               {
        PCIEA_BEI_BAR_0 = 0,            /**< Standard BAR 0 */
        PCIEA_BEI_BAR_1 = 1,            /**< Standard BAR 1 */
        PCIEA_BEI_BAR_2 = 2,            /**< Standard BAR 2 */
        PCIEA_BEI_BAR_3 = 3,            /**< Standard BAR 3 */
        PCIEA_BEI_BAR_4 = 4,            /**< Standard BAR 4 */
        PCIEA_BEI_BAR_5 = 5,            /**< Standard BAR 5 */
        PCIEA_BEI_ROM = 8,              /**< Expansion ROM BAR */
        PCIEA_BEI_VF_BAR_0 = 9,         /**< Virtual function BAR 0 */
        PCIEA_BEI_VF_BAR_1 = 10,        /**< Virtual function BAR 1 */
        PCIEA_BEI_VF_BAR_2 = 11,        /**< Virtual function BAR 2 */
        PCIEA_BEI_VF_BAR_3 = 12,        /**< Virtual function BAR 3 */
        PCIEA_BEI_VF_BAR_4 = 13,        /**< Virtual function BAR 4 */
        PCIEA_BEI_VF_BAR_5 = 14,        /**< Virtual function BAR 5 */
};

Function Documentation

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.

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.

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

Referenced by txnic_bgx_probe(), and txnic_pf_probe().

                                                                           {
        unsigned long base;

        base = pciea_bar_value ( pci, bei, PCIEA_LOW_BASE );
        return ( base & ~PCIEA_LOW_ATTR_MASK );
}
unsigned long pciea_bar_size ( struct pci_device pci,
unsigned int  bei 
)

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.

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

Referenced by txnic_pf_probe().

                                                                          {
        unsigned long limit;

        limit = pciea_bar_value ( pci, bei, PCIEA_LOW_LIMIT );
        return ( limit ? ( ( limit | PCIEA_LOW_ATTR_MASK ) + 1 ) : 0 );
}