aboutsummaryrefslogtreecommitdiffstats
path: root/src/drivers/bus
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2022-11-13 20:42:09 +0000
committerMichael Brown <mcb30@ipxe.org>2022-11-13 20:42:09 +0000
commitca2be7e094c900542e36f70f3abc3c8ff7c3055d (patch)
treedc22399acbc7aba0a69f673fb93d7d095a179a85 /src/drivers/bus
parent688646fe6d034e98fe7cbcc9403a2d0f70434f40 (diff)
downloadipxe-ca2be7e094c900542e36f70f3abc3c8ff7c3055d.tar.gz
[pci] Allow PCI config space backup to be limited by maximum offset
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/bus')
-rw-r--r--src/drivers/bus/pcibackup.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/drivers/bus/pcibackup.c b/src/drivers/bus/pcibackup.c
index fecad8192..4cf126f83 100644
--- a/src/drivers/bus/pcibackup.c
+++ b/src/drivers/bus/pcibackup.c
@@ -61,14 +61,15 @@ pci_backup_excluded ( struct pci_device *pci, unsigned int offset,
*
* @v pci PCI device
* @v backup PCI configuration space backup
+ * @v limit Maximum offset in PCI configuration space
* @v exclude PCI configuration space backup exclusion list, or NULL
*/
void pci_backup ( struct pci_device *pci, struct pci_config_backup *backup,
- const uint8_t *exclude ) {
+ unsigned int limit, const uint8_t *exclude ) {
unsigned int offset;
uint32_t *dword;
- for ( offset = 0, dword = backup->dwords ; offset < 0x100 ;
+ for ( offset = 0, dword = backup->dwords ; offset < limit ;
offset += sizeof ( *dword ) , dword++ ) {
if ( ! pci_backup_excluded ( pci, offset, exclude ) )
pci_read_config_dword ( pci, offset, dword );
@@ -80,14 +81,15 @@ void pci_backup ( struct pci_device *pci, struct pci_config_backup *backup,
*
* @v pci PCI device
* @v backup PCI configuration space backup
+ * @v limit Maximum offset in PCI configuration space
* @v exclude PCI configuration space backup exclusion list, or NULL
*/
void pci_restore ( struct pci_device *pci, struct pci_config_backup *backup,
- const uint8_t *exclude ) {
+ unsigned int limit, const uint8_t *exclude ) {
unsigned int offset;
uint32_t *dword;
- for ( offset = 0, dword = backup->dwords ; offset < 0x100 ;
+ for ( offset = 0, dword = backup->dwords ; offset < limit ;
offset += sizeof ( *dword ) , dword++ ) {
if ( ! pci_backup_excluded ( pci, offset, exclude ) )
pci_write_config_dword ( pci, offset, *dword );