mirror of https://github.com/ipxe/ipxe.git
[pci] Cache ECAM mapping errors
When an error occurs during ECAM configuration space mapping, preserve the error within the existing cached mapping (instead of invalidating the cached mapping) in order to avoid flooding the debug log with repeated identical mapping errors. Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/1073/head
parent
74ec00a9f3
commit
1f3a37e342
|
@ -127,7 +127,7 @@ static int ecam_access ( struct pci_device *pci ) {
|
||||||
|
|
||||||
/* Reuse mapping if possible */
|
/* Reuse mapping if possible */
|
||||||
if ( ( pci->busdevfn - ecam.range.start ) < ecam.range.count )
|
if ( ( pci->busdevfn - ecam.range.start ) < ecam.range.count )
|
||||||
return 0;
|
return ecam.rc;
|
||||||
|
|
||||||
/* Clear any existing mapping */
|
/* Clear any existing mapping */
|
||||||
if ( ecam.regs ) {
|
if ( ecam.regs ) {
|
||||||
|
@ -145,6 +145,7 @@ static int ecam_access ( struct pci_device *pci ) {
|
||||||
if ( ecam.range.start > pci->busdevfn ) {
|
if ( ecam.range.start > pci->busdevfn ) {
|
||||||
DBGC ( &ecam, "ECAM found no allocation for " PCI_FMT "\n",
|
DBGC ( &ecam, "ECAM found no allocation for " PCI_FMT "\n",
|
||||||
PCI_ARGS ( pci ) );
|
PCI_ARGS ( pci ) );
|
||||||
|
rc = -ENOENT;
|
||||||
goto err_find;
|
goto err_find;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,12 +166,13 @@ static int ecam_access ( struct pci_device *pci ) {
|
||||||
DBGC ( &ecam, "ECAM %04x:[%02x-%02x] mapped [%08llx,%08llx) -> %p\n",
|
DBGC ( &ecam, "ECAM %04x:[%02x-%02x] mapped [%08llx,%08llx) -> %p\n",
|
||||||
le16_to_cpu ( ecam.alloc.segment ), ecam.alloc.start,
|
le16_to_cpu ( ecam.alloc.segment ), ecam.alloc.start,
|
||||||
ecam.alloc.end, base, ( base + len ), ecam.regs );
|
ecam.alloc.end, base, ( base + len ), ecam.regs );
|
||||||
|
ecam.rc = 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
iounmap ( ecam.regs );
|
iounmap ( ecam.regs );
|
||||||
err_ioremap:
|
err_ioremap:
|
||||||
err_find:
|
err_find:
|
||||||
ecam.range.count = 0;
|
ecam.rc = rc;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,8 @@ struct ecam_mapping {
|
||||||
struct pci_range range;
|
struct pci_range range;
|
||||||
/** MMIO base address */
|
/** MMIO base address */
|
||||||
void *regs;
|
void *regs;
|
||||||
|
/** Mapping result */
|
||||||
|
int rc;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct pci_api ecam_api;
|
extern struct pci_api ecam_api;
|
||||||
|
|
Loading…
Reference in New Issue