iPXE
Functions
pcibackup.c File Reference

PCI configuration space backup and restoration. More...

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

Go to the source code of this file.

Functions

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

Detailed Description

PCI configuration space backup and restoration.

Definition in file pcibackup.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ pci_backup_excluded()

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
pciPCI device
offsetOffset within PCI configuration space
excludePCI configuration space backup exclusion list, or NULL

Definition at line 44 of file pcibackup.c.

45  {
46 
47  if ( ! exclude )
48  return 0;
49  for ( ; *exclude != PCI_CONFIG_BACKUP_EXCLUDE_END ; exclude++ ) {
50  if ( offset == *exclude ) {
51  DBGC ( pci, "PCI %p skipping configuration offset "
52  "%02x\n", pci, offset );
53  return 1;
54  }
55  }
56  return 0;
57 }
#define DBGC(...)
Definition: compiler.h:505
static userptr_t size_t offset
Offset of the first segment within the content.
Definition: deflate.h:259
#define PCI_CONFIG_BACKUP_EXCLUDE_END
PCI configuration space backup exclusion list end marker.
Definition: pcibackup.h:20

References DBGC, offset, and PCI_CONFIG_BACKUP_EXCLUDE_END.

Referenced by pci_backup(), and pci_restore().

◆ pci_backup()

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.

67  {
68  unsigned int offset;
69  uint32_t *dword;
70 
71  for ( offset = 0, dword = backup->dwords ; offset < 0x100 ;
72  offset += sizeof ( *dword ) , dword++ ) {
73  if ( ! pci_backup_excluded ( pci, offset, exclude ) )
75  }
76 }
int pci_read_config_dword(struct pci_device *pci, unsigned int where, uint32_t *value)
Read 32-bit dword from PCI configuration space.
static userptr_t size_t offset
Offset of the first segment within the content.
Definition: deflate.h:259
unsigned int uint32_t
Definition: stdint.h:12
uint32_t dwords[64]
Definition: pcibackup.h:16
unsigned long int dword
Definition: smc9000.h:40
static int pci_backup_excluded(struct pci_device *pci, unsigned int offset, const uint8_t *exclude)
Check PCI configuration space offset against exclusion list.
Definition: pcibackup.c:44

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

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

◆ pci_restore()

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.

86  {
87  unsigned int offset;
88  uint32_t *dword;
89 
90  for ( offset = 0, dword = backup->dwords ; offset < 0x100 ;
91  offset += sizeof ( *dword ) , dword++ ) {
92  if ( ! pci_backup_excluded ( pci, offset, exclude ) )
94  }
95 }
static userptr_t size_t offset
Offset of the first segment within the content.
Definition: deflate.h:259
unsigned int uint32_t
Definition: stdint.h:12
int pci_write_config_dword(struct pci_device *pci, unsigned int where, uint32_t value)
Write 32-bit dword to PCI configuration space.
uint32_t dwords[64]
Definition: pcibackup.h:16
unsigned long int dword
Definition: smc9000.h:40
static int pci_backup_excluded(struct pci_device *pci, unsigned int offset, const uint8_t *exclude)
Check PCI configuration space offset against exclusion list.
Definition: pcibackup.c:44

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

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