iPXE
Defines | Functions | Variables
pcibios.h File Reference

PCI configuration space access via PCI BIOS. More...

#include <stdint.h>

Go to the source code of this file.

Defines

#define PCIAPI_PREFIX_pcbios   __pcbios_
#define PCIBIOS_INSTALLATION_CHECK   0xb1010000
#define PCIBIOS_READ_CONFIG_BYTE   0xb1080000
#define PCIBIOS_READ_CONFIG_WORD   0xb1090000
#define PCIBIOS_READ_CONFIG_DWORD   0xb10a0000
#define PCIBIOS_WRITE_CONFIG_BYTE   0xb10b0000
#define PCIBIOS_WRITE_CONFIG_WORD   0xb10c0000
#define PCIBIOS_WRITE_CONFIG_DWORD   0xb10d0000

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
int pcibios_read (struct pci_device *pci, uint32_t command, uint32_t *value)
 Read configuration space via PCI BIOS.
int pcibios_write (struct pci_device *pci, uint32_t command, uint32_t value)
 Write configuration space via PCI BIOS.
static __always_inline int PCIAPI_INLINE (pcbios, pci_read_config_byte)(struct pci_device *pci
 Read byte from PCI configuration space via PCI BIOS.

Variables

static __always_inline int
unsigned int 
where

Detailed Description

PCI configuration space access via PCI BIOS.

Definition in file pcibios.h.


Define Documentation

#define PCIAPI_PREFIX_pcbios   __pcbios_

Definition at line 17 of file pcibios.h.

#define PCIBIOS_INSTALLATION_CHECK   0xb1010000

Definition at line 22 of file pcibios.h.

Referenced by pcibios_num_bus().

#define PCIBIOS_READ_CONFIG_BYTE   0xb1080000

Definition at line 23 of file pcibios.h.

#define PCIBIOS_READ_CONFIG_WORD   0xb1090000

Definition at line 24 of file pcibios.h.

#define PCIBIOS_READ_CONFIG_DWORD   0xb10a0000

Definition at line 25 of file pcibios.h.

#define PCIBIOS_WRITE_CONFIG_BYTE   0xb10b0000

Definition at line 26 of file pcibios.h.

#define PCIBIOS_WRITE_CONFIG_WORD   0xb10c0000

Definition at line 27 of file pcibios.h.

#define PCIBIOS_WRITE_CONFIG_DWORD   0xb10d0000

Definition at line 28 of file pcibios.h.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
int pcibios_read ( struct pci_device pci,
uint32_t  command,
uint32_t value 
)

Read configuration space via PCI BIOS.

Parameters:
pciPCI device
commandPCI BIOS command
valueValue read
Return values:
rcReturn status code

Definition at line 71 of file pcibios.c.

References __asm__(), pci_device::busdevfn, REAL_CODE, and status.

                                                                              {
        int discard_b, discard_D;
        uint16_t status;

        __asm__ __volatile__ ( REAL_CODE ( "stc\n\t"
                                           "int $0x1a\n\t"
                                           "jnc 1f\n\t"
                                           "xorl %%eax, %%eax\n\t"
                                           "decl %%eax\n\t"
                                           "movl %%eax, %%ecx\n\t"
                                           "\n1:\n\t" )
                               : "=a" ( status ), "=b" ( discard_b ),
                                 "=c" ( *value ), "=D" ( discard_D )
                               : "a" ( command >> 16 ), "D" ( command ),
                                 "b" ( pci->busdevfn )
                               : "edx" );

        return ( status >> 8 );
}
int pcibios_write ( struct pci_device pci,
uint32_t  command,
uint32_t  value 
)

Write configuration space via PCI BIOS.

Parameters:
pciPCI device
commandPCI BIOS command
valueValue to be written
Return values:
rcReturn status code

Definition at line 99 of file pcibios.c.

References __asm__(), pci_device::busdevfn, REAL_CODE, and status.

                                                                              {
        int discard_b, discard_c, discard_D;
        uint16_t status;

        __asm__ __volatile__ ( REAL_CODE ( "stc\n\t"
                                           "int $0x1a\n\t"
                                           "jnc 1f\n\t"
                                           "movb $0xff, %%ah\n\t"
                                           "\n1:\n\t" )
                               : "=a" ( status ), "=b" ( discard_b ),
                                 "=c" ( discard_c ), "=D" ( discard_D )
                               : "a" ( command >> 16 ), "D" ( command ),
                                 "b" ( pci->busdevfn ), "c" ( value )
                               : "edx" );
        
        return ( status >> 8 );
}
static __always_inline int PCIAPI_INLINE ( pcbios  ,
pci_read_config_byte   
) [inline, static]

Read byte from PCI configuration space via PCI BIOS.

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 45 of file pcibios.h.