iPXE
Defines | 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.

Defines

#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.
static __always_inline int PCIAPI_INLINE (direct, pci_num_bus)(void)
 Determine number of PCI buses within system.
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.

Variables

static __always_inline int
unsigned int 
where

Detailed Description

PCI configuration space access via Type 1 accesses.

Definition in file pcidirect.h.


Define Documentation

#define PCIAPI_PREFIX_direct   __direct_

Definition at line 12 of file pcidirect.h.

#define PCIDIRECT_CONFIG_ADDRESS   0xcf8

Definition at line 21 of file pcidirect.h.

Referenced by pcidirect_prepare().

#define PCIDIRECT_CONFIG_DATA   0xcfc

Definition at line 22 of file pcidirect.h.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
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.

References pci_device::busdevfn, outl(), and PCIDIRECT_CONFIG_ADDRESS.

                                                             {
        uint16_t busdevfn = ( pci->busdevfn & 0xffff );

        outl ( ( 0x80000000 | ( busdevfn << 8 ) | ( where & ~3 ) ),
               PCIDIRECT_CONFIG_ADDRESS );
}
static __always_inline int PCIAPI_INLINE ( direct  ,
pci_num_bus   
) [inline, static]

Determine number of PCI buses within system.

Return values:
num_busNumber of buses

Definition at line 34 of file pcidirect.h.

                                               {
        /* No way to work this out via Type 1 accesses */
        return 0x100;
}
static __always_inline int PCIAPI_INLINE ( direct  ,
pci_read_config_byte   
) [inline, static]

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

Variable Documentation

__always_inline int unsigned int where

Definition at line 49 of file pcidirect.h.