pcibackup.c File Reference

PCI configuration space backup and restoration. More...

#include <stdint.h>
#include <gpxe/pci.h>
#include <gpxe/pcibackup.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER)
static int pci_backup_excluded (struct pci_device *pci, unsigned int offset, const uint8_t *exclude)
 Check PCI configuration space offset against exclusion list.
void pci_backup (struct pci_device *pci, struct pci_config_backup *backup, const uint8_t *exclude)
 Back up PCI configuration space.
void pci_restore (struct pci_device *pci, struct pci_config_backup *backup, const uint8_t *exclude)
 Restore PCI configuration space.


Detailed Description

PCI configuration space backup and restoration.

Definition in file pcibackup.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER   ) 

static int pci_backup_excluded ( struct pci_device pci,
unsigned int  offset,
const uint8_t exclude 
) [static]

Check PCI configuration space offset against exclusion list.

Parameters:
pci PCI device
offset Offset within PCI configuration space
exclude PCI configuration space backup exclusion list, or NULL

Definition at line 39 of file pcibackup.c.

References DBGC, and PCI_CONFIG_BACKUP_EXCLUDE_END.

Referenced by pci_backup(), and pci_restore().

00040                                                {
00041 
00042         if ( ! exclude )
00043                 return 0;
00044         for ( ; *exclude != PCI_CONFIG_BACKUP_EXCLUDE_END ; exclude++ ) {
00045                 if ( offset == *exclude ) {
00046                         DBGC ( pci, "PCI %p skipping configuration offset "
00047                                "%02x\n", pci, offset );
00048                         return 1;
00049                 }
00050         }
00051         return 0;
00052 }

void pci_backup ( struct pci_device pci,
struct pci_config_backup backup,
const uint8_t exclude 
)

Back up PCI configuration space.

Parameters:
pci PCI device
backup PCI configuration space backup
exclude PCI configuration space backup exclusion list, or NULL

Definition at line 61 of file pcibackup.c.

References pci_config_backup::dwords, offset, pci_backup_excluded(), and pci_read_config_dword().

Referenced by hermon_reset().

00062                                            {
00063         unsigned int offset;
00064         uint32_t *dword;
00065 
00066         for ( offset = 0, dword = backup->dwords ; offset < 0x100 ;
00067               offset += sizeof ( *dword ) , dword++ ) {
00068                 if ( ! pci_backup_excluded ( pci, offset, exclude ) )
00069                         pci_read_config_dword ( pci, offset, dword );
00070         }
00071 }

void pci_restore ( struct pci_device pci,
struct pci_config_backup backup,
const uint8_t exclude 
)

Restore PCI configuration space.

Parameters:
pci PCI device
backup PCI configuration space backup
exclude PCI configuration space backup exclusion list, or NULL

Definition at line 80 of file pcibackup.c.

References pci_config_backup::dwords, offset, pci_backup_excluded(), and pci_write_config_dword().

Referenced by hermon_reset().

00081                                             {
00082         unsigned int offset;
00083         uint32_t *dword;
00084 
00085         for ( offset = 0, dword = backup->dwords ; offset < 0x100 ;
00086               offset += sizeof ( *dword ) , dword++ ) {
00087                 if ( ! pci_backup_excluded ( pci, offset, exclude ) )
00088                         pci_write_config_dword ( pci, offset, *dword );
00089         }
00090 }


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