efi_pci.h File Reference

gPXE PCI I/O API for EFI More...

Go to the source code of this file.

Defines

#define PCIAPI_PREFIX_efi   __efi_
#define EFIPCI_WIDTH_BYTE   0
#define EFIPCI_WIDTH_WORD   1
#define EFIPCI_WIDTH_DWORD   2
#define EFIPCI_LOCATION(_offset, _width)   ( (_offset) | ( (_width) << 16 ) )
#define EFIPCI_OFFSET(_location)   ( (_location) & 0xffff )
#define EFIPCI_WIDTH(_location)   ( (_location) >> 16 )

Functions

 FILE_LICENCE (GPL2_OR_LATER)
int efipci_read (struct pci_device *pci, unsigned long location, void *value)
int efipci_write (struct pci_device *pci, unsigned long location, unsigned long value)
static __always_inline int PCIAPI_INLINE (efi, pci_max_bus)(void)
 Determine maximum PCI bus number within system.
static __always_inline int PCIAPI_INLINE (efi, pci_read_config_byte)(struct pci_device *pci
 Read byte from PCI configuration space via EFI.

Variables

static __always_inline int
unsigned int 
where


Detailed Description

gPXE PCI I/O API for EFI

Definition in file efi_pci.h.


Define Documentation

#define PCIAPI_PREFIX_efi   __efi_

Definition at line 15 of file efi_pci.h.

#define EFIPCI_WIDTH_BYTE   0

Definition at line 19 of file efi_pci.h.

#define EFIPCI_WIDTH_WORD   1

Definition at line 20 of file efi_pci.h.

#define EFIPCI_WIDTH_DWORD   2

Definition at line 21 of file efi_pci.h.

#define EFIPCI_LOCATION ( _offset,
_width   )     ( (_offset) | ( (_width) << 16 ) )

Definition at line 23 of file efi_pci.h.

#define EFIPCI_OFFSET ( _location   )     ( (_location) & 0xffff )

Definition at line 25 of file efi_pci.h.

Referenced by efipci_address(), efipci_read(), and efipci_write().

#define EFIPCI_WIDTH ( _location   )     ( (_location) >> 16 )

Definition at line 26 of file efi_pci.h.

Referenced by efipci_read(), and efipci_write().


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER   ) 

int efipci_read ( struct pci_device pci,
unsigned long  location,
void *  value 
)

Definition at line 43 of file efi_pci.c.

References pci_device::bus, DBG, pci_device::devfn, efi_strerror(), efipci_address(), EFIPCI_OFFSET, EFIPCI_WIDTH, EIO, _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL::Pci, PCI_FUNC, PCI_SLOT, and EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS::Read.

00044                                 {
00045         EFI_STATUS efirc;
00046 
00047         if ( ( efirc = efipci->Pci.Read ( efipci, EFIPCI_WIDTH ( location ),
00048                                           efipci_address ( pci, location ), 1,
00049                                           value ) ) != 0 ) {
00050                 DBG ( "EFIPCI config read from %02x:%02x.%x offset %02lx "
00051                       "failed: %s\n", pci->bus, PCI_SLOT ( pci->devfn ),
00052                       PCI_FUNC ( pci->devfn ), EFIPCI_OFFSET ( location ),
00053                       efi_strerror ( efirc ) );
00054                 return -EIO;
00055         }
00056 
00057         return 0;
00058 }

int efipci_write ( struct pci_device pci,
unsigned long  location,
unsigned long  value 
)

Definition at line 60 of file efi_pci.c.

References pci_device::bus, DBG, pci_device::devfn, efi_strerror(), efipci_address(), EFIPCI_OFFSET, EFIPCI_WIDTH, EIO, _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL::Pci, PCI_FUNC, PCI_SLOT, and EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS::Write.

00061                                          {
00062         EFI_STATUS efirc;
00063 
00064         if ( ( efirc = efipci->Pci.Write ( efipci, EFIPCI_WIDTH ( location ),
00065                                            efipci_address ( pci, location ), 1,
00066                                            &value ) ) != 0 ) {
00067                 DBG ( "EFIPCI config write to %02x:%02x.%x offset %02lx "
00068                       "failed: %s\n", pci->bus, PCI_SLOT ( pci->devfn ),
00069                       PCI_FUNC ( pci->devfn ), EFIPCI_OFFSET ( location ),
00070                       efi_strerror ( efirc ) );
00071                 return -EIO;
00072         }
00073 
00074         return 0;
00075 }

static __always_inline int PCIAPI_INLINE ( efi  ,
pci_max_bus   
) [inline, static]

Determine maximum PCI bus number within system.

Return values:
max_bus Maximum bus number

Definition at line 41 of file efi_pci.h.

00041                                             {
00042         /* No way to work this out via EFI */
00043         return 0xff;
00044 }

static __always_inline int PCIAPI_INLINE ( efi  ,
pci_read_config_byte   
) [inline, static]

Read byte from PCI configuration space via EFI.

Parameters:
pci PCI device
where Location within PCI configuration space
value Value read
Return values:
rc Return status code


Variable Documentation

__always_inline int unsigned int where

Definition at line 56 of file efi_pci.h.


Generated on Tue Apr 6 20:01:48 2010 for gPXE by  doxygen 1.5.7.1