iPXE
Data Structures | Defines | Functions
pcibackup.h File Reference

PCI configuration space backup and restoration. More...

#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  pci_config_backup
 A PCI configuration space backup. More...

Defines

#define PCI_CONFIG_BACKUP_EXCLUDE_END   0xff
 PCI configuration space backup exclusion list end marker.
#define PCI_CONFIG_BACKUP_EXCLUDE(...)   { __VA_ARGS__, PCI_CONFIG_BACKUP_EXCLUDE_END }
 Define a PCI configuration space backup exclusion list.

Functions

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


Define Documentation

#define PCI_CONFIG_BACKUP_EXCLUDE_END   0xff

PCI configuration space backup exclusion list end marker.

Definition at line 20 of file pcibackup.h.

Referenced by pci_backup_excluded().

#define PCI_CONFIG_BACKUP_EXCLUDE (   ...)    { __VA_ARGS__, PCI_CONFIG_BACKUP_EXCLUDE_END }

Define a PCI configuration space backup exclusion list.

Definition at line 23 of file pcibackup.h.

Referenced by arbel_reset(), and hermon_reset().


Function Documentation

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

Back up PCI configuration space.

Parameters:
pciPCI device
backupPCI configuration space backup
excludePCI configuration space backup exclusion list, or NULL

Definition at line 66 of file pcibackup.c.

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

Referenced by arbel_reset(), hermon_reset(), and qib7322_reset().

                                           {
        unsigned int offset;
        uint32_t *dword;

        for ( offset = 0, dword = backup->dwords ; offset < 0x100 ;
              offset += sizeof ( *dword ) , dword++ ) {
                if ( ! pci_backup_excluded ( pci, offset, exclude ) )
                        pci_read_config_dword ( pci, offset, dword );
        }
}
void pci_restore ( struct pci_device pci,
struct pci_config_backup backup,
const uint8_t exclude 
)

Restore PCI configuration space.

Parameters:
pciPCI device
backupPCI configuration space backup
excludePCI configuration space backup exclusion list, or NULL

Definition at line 85 of file pcibackup.c.

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

Referenced by arbel_reset(), hermon_reset(), and qib7322_reset().

                                            {
        unsigned int offset;
        uint32_t *dword;

        for ( offset = 0, dword = backup->dwords ; offset < 0x100 ;
              offset += sizeof ( *dword ) , dword++ ) {
                if ( ! pci_backup_excluded ( pci, offset, exclude ) )
                        pci_write_config_dword ( pci, offset, *dword );
        }
}