iPXE
Macros | Functions | Variables
pcidirect.h File Reference

PCI configuration space access via Type 1 accesses. More...

#include <stdint.h>
#include <ipxe/io.h>

Go to the source code of this file.

Macros

#define PCIAPI_PREFIX_direct   __direct_
 
#define PCIDIRECT_CONFIG_ADDRESS   0xcf8
 
#define PCIDIRECT_CONFIG_DATA   0xcfc
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
void pcidirect_prepare (struct pci_device *pci, int where)
 Prepare for Type 1 PCI configuration space access. More...
 
static __always_inline int PCIAPI_INLINE (direct, pci_num_bus)(void)
 Determine number of PCI buses within system. More...
 
static __always_inline int PCIAPI_INLINE (direct, pci_read_config_byte)(struct pci_device *pci
 Read byte from PCI configuration space via Type 1 access. More...
 
static __always_inline int PCIAPI_INLINE (direct, pci_read_config_word)(struct pci_device *pci
 Read word from PCI configuration space via Type 1 access. More...
 
static __always_inline int PCIAPI_INLINE (direct, pci_read_config_dword)(struct pci_device *pci
 Read dword from PCI configuration space via Type 1 access. More...
 
static __always_inline int PCIAPI_INLINE (direct, pci_write_config_byte)(struct pci_device *pci
 Write byte to PCI configuration space via Type 1 access. More...
 
 outb (value, PCIDIRECT_CONFIG_DATA+(where &3))
 
static __always_inline int PCIAPI_INLINE (direct, pci_write_config_word)(struct pci_device *pci
 Write word to PCI configuration space via Type 1 access. More...
 
 outw (value, PCIDIRECT_CONFIG_DATA+(where &2))
 
static __always_inline int PCIAPI_INLINE (direct, pci_write_config_dword)(struct pci_device *pci
 Write dword to PCI configuration space via Type 1 access. More...
 
 outl (value, PCIDIRECT_CONFIG_DATA)
 

Variables

static __always_inline int unsigned int where
 
static __always_inline int unsigned int uint8_tvalue
 
 return
 

Detailed Description

PCI configuration space access via Type 1 accesses.

Definition in file pcidirect.h.

Macro Definition Documentation

◆ PCIAPI_PREFIX_direct

#define PCIAPI_PREFIX_direct   __direct_

Definition at line 12 of file pcidirect.h.

◆ PCIDIRECT_CONFIG_ADDRESS

#define PCIDIRECT_CONFIG_ADDRESS   0xcf8

Definition at line 21 of file pcidirect.h.

◆ PCIDIRECT_CONFIG_DATA

#define PCIDIRECT_CONFIG_DATA   0xcfc

Definition at line 22 of file pcidirect.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ pcidirect_prepare()

void pcidirect_prepare ( struct pci_device pci,
int  where 
)

Prepare for Type 1 PCI configuration space access.

Parameters
pciPCI device
whereLocation within PCI configuration space

Definition at line 41 of file pcidirect.c.

41  {
42  uint16_t busdevfn = ( pci->busdevfn & 0xffff );
43 
44  outl ( ( 0x80000000 | ( busdevfn << 8 ) | ( where & ~3 ) ),
46 }
unsigned short uint16_t
Definition: stdint.h:11
#define outl(data, io_addr)
Definition: io.h:329
static __always_inline int unsigned int where
Definition: efi_pci_api.h:56
#define PCIDIRECT_CONFIG_ADDRESS
Definition: pcidirect.h:21
uint32_t busdevfn
Segment, bus, device, and function (bus:dev.fn) number.
Definition: pci.h:210

References pci_device::busdevfn, outl, PCIDIRECT_CONFIG_ADDRESS, and where.

◆ PCIAPI_INLINE() [1/7]

static __always_inline int PCIAPI_INLINE ( direct  ,
pci_num_bus   
)
inlinestatic

Determine number of PCI buses within system.

Return values
num_busNumber of buses

Definition at line 34 of file pcidirect.h.

34  {
35  /* No way to work this out via Type 1 accesses */
36  return 0x100;
37 }

◆ PCIAPI_INLINE() [2/7]

static __always_inline int PCIAPI_INLINE ( direct  ,
pci_read_config_byte   
)
inlinestatic

Read byte from PCI configuration space via Type 1 access.

Parameters
pciPCI device
whereLocation within PCI configuration space
valueValue read
Return values
rcReturn status code

◆ PCIAPI_INLINE() [3/7]

static __always_inline int PCIAPI_INLINE ( direct  ,
pci_read_config_word   
)
inlinestatic

Read word from PCI configuration space via Type 1 access.

Parameters
pciPCI device
whereLocation within PCI configuration space
valueValue read
Return values
rcReturn status code

◆ PCIAPI_INLINE() [4/7]

static __always_inline int PCIAPI_INLINE ( direct  ,
pci_read_config_dword   
)
inlinestatic

Read dword from PCI configuration space via Type 1 access.

Parameters
pciPCI device
whereLocation within PCI configuration space
valueValue read
Return values
rcReturn status code

◆ PCIAPI_INLINE() [5/7]

static __always_inline int PCIAPI_INLINE ( direct  ,
pci_write_config_byte   
)
inlinestatic

Write byte to PCI configuration space via Type 1 access.

Parameters
pciPCI device
whereLocation within PCI configuration space
valueValue to be written
Return values
rcReturn status code

◆ outb()

outb ( value  ,
PCIDIRECT_CONFIG_DATA where &3 
)

◆ PCIAPI_INLINE() [6/7]

static __always_inline int PCIAPI_INLINE ( direct  ,
pci_write_config_word   
)
inlinestatic

Write word to PCI configuration space via Type 1 access.

Parameters
pciPCI device
whereLocation within PCI configuration space
valueValue to be written
Return values
rcReturn status code

◆ outw()

outw ( value  ,
PCIDIRECT_CONFIG_DATA where &2 
)

◆ PCIAPI_INLINE() [7/7]

static __always_inline int PCIAPI_INLINE ( direct  ,
pci_write_config_dword   
)
inlinestatic

Write dword to PCI configuration space via Type 1 access.

Parameters
pciPCI device
whereLocation within PCI configuration space
valueValue to be written
Return values
rcReturn status code

◆ outl()

outl ( value  ,
PCIDIRECT_CONFIG_DATA   
)

Variable Documentation

◆ where

__always_inline int unsigned int where

Definition at line 49 of file pcidirect.h.

◆ value

__always_inline int unsigned int uint32_t value
Initial value:
{
void pcidirect_prepare(struct pci_device *pci, int where)
Prepare for Type 1 PCI configuration space access.
Definition: pcidirect.c:41
static __always_inline int unsigned int where
Definition: pcidirect.h:49

Definition at line 50 of file pcidirect.h.

◆ return

return

Definition at line 53 of file pcidirect.h.