Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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>
  • Loading branch information
mcb30 committed Sep 4, 2014
1 parent 4c5b794 commit f94d651
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/include/ipxe/efi/efi_pci_api.h
Expand Up @@ -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 );
Expand All @@ -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 );
Expand All @@ -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 );
Expand Down

0 comments on commit f94d651

Please sign in to comment.