aboutsummaryrefslogtreecommitdiff
path: root/src/include/ipxe/efi
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2014-09-04 16:00:11 +0100
committerMichael Brown <mcb30@ipxe.org>2014-09-04 16:00:11 +0100
commitf94d6516326ba05928602ab1de2e4e713cbe35ee (patch)
treec31f452620a9519fe9514ae82c61795e2d3973ba /src/include/ipxe/efi
parent4c5b7945c34392dda8a22c0759c15f78f90bb8a3 (diff)
downloadipxe-f94d6516326ba05928602ab1de2e4e713cbe35ee.zip
ipxe-f94d6516326ba05928602ab1de2e4e713cbe35ee.tar.gz
ipxe-f94d6516326ba05928602ab1de2e4e713cbe35ee.tar.bz2
[efi] Avoid returning uninitialised data from PCI configuration space reads
Under UEFI, reads from PCI configuration space may fail. If this happens, we should return all-ones (which will mimic the behaviour of an absent PCI device). Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/efi')
-rw-r--r--src/include/ipxe/efi/efi_pci_api.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/include/ipxe/efi/efi_pci_api.h b/src/include/ipxe/efi/efi_pci_api.h
index 1bc43e3..498a038 100644
--- a/src/include/ipxe/efi/efi_pci_api.h
+++ b/src/include/ipxe/efi/efi_pci_api.h
@@ -55,6 +55,7 @@ static inline __always_inline int
PCIAPI_INLINE ( efi, pci_read_config_byte ) ( struct pci_device *pci,
unsigned int where,
uint8_t *value ) {
+ *value = 0xff;
return efipci_read ( pci,
EFIPCI_LOCATION ( where, EFIPCI_WIDTH_BYTE ),
value );
@@ -72,6 +73,7 @@ static inline __always_inline int
PCIAPI_INLINE ( efi, pci_read_config_word ) ( struct pci_device *pci,
unsigned int where,
uint16_t *value ) {
+ *value = 0xffff;
return efipci_read ( pci,
EFIPCI_LOCATION ( where, EFIPCI_WIDTH_WORD ),
value );
@@ -89,6 +91,7 @@ static inline __always_inline int
PCIAPI_INLINE ( efi, pci_read_config_dword ) ( struct pci_device *pci,
unsigned int where,
uint32_t *value ) {
+ *value = 0xffffffffUL;
return efipci_read ( pci,
EFIPCI_LOCATION ( where, EFIPCI_WIDTH_DWORD ),
value );