summaryrefslogtreecommitdiffstats
path: root/pcidev.c
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2009-05-16 01:30:48 +0000
committerUwe Hermann <uwe@hermann-uwe.de>2009-05-16 01:30:48 +0000
commitb79140252ae001fb1459010661b2ea8db912fc4c (patch)
treea1ae8fe1136cb4e2d406477fb5c3e5a758801c0d /pcidev.c
parent6ca891fa724407aad3a1ece0957a41686619f1e9 (diff)
downloadflashrom-b79140252ae001fb1459010661b2ea8db912fc4c.zip
flashrom-b79140252ae001fb1459010661b2ea8db912fc4c.tar.gz
Older libpci versions (
E.g. 2.2.8, as it's default on current FreeBSD 7.2) don't properly fill the base_addr[0] struct member, so revert back to an explicit pci_read_long() call, otherwise detection of PCI devices and their base address will fail with strange error messages. Thanks Idwer Vollering <vidwer@gmail.com> for reporting and testing. Corresponding to flashrom svn r518. Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
Diffstat (limited to 'pcidev.c')
-rw-r--r--pcidev.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pcidev.c b/pcidev.c
index 549d083..f07fe80 100644
--- a/pcidev.c
+++ b/pcidev.c
@@ -26,6 +26,8 @@
#include <errno.h>
#include "flash.h"
+#define PCI_IO_BASE_ADDRESS 0x10
+
uint32_t io_base_addr;
struct pci_access *pacc;
struct pci_filter filter;
@@ -40,7 +42,8 @@ uint32_t pcidev_validate(struct pci_dev *dev, struct pcidev_status *devs)
if (dev->device_id != devs[i].device_id)
continue;
- addr = (uint32_t)(dev->base_addr[0] & ~0x03);
+ /* Don't use dev->base_addr[0], won't work on older libpci. */
+ addr = pci_read_long(dev, PCI_IO_BASE_ADDRESS) & ~0x03;
printf("Found \"%s %s\" (%04x:%04x, BDF %02x:%02x.%x)\n",
devs[i].vendor_name, devs[i].device_name, dev->vendor_id,
OpenPOWER on IntegriCloud