summaryrefslogtreecommitdiffstats
path: root/nicintel_spi.c
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2013-01-05 23:52:45 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2013-01-05 23:52:45 +0000
commitb1c04297f1f115cdb904644ae48f1234a3cbc16e (patch)
tree1a13a2aa0134dbede16c017dd102efc81eb97ee0 /nicintel_spi.c
parente50ae6b37e1e49359254ac64bc6052744128f569 (diff)
downloadflashrom-b1c04297f1f115cdb904644ae48f1234a3cbc16e.zip
flashrom-b1c04297f1f115cdb904644ae48f1234a3cbc16e.tar.gz
Decouple BAR reading from pci device init, handle errors gracefully
Pcidev_init() now returns struct pci_device * instead of a BAR stored in PCI config space. This allows for real error checking instead of having exit(1) everywhere in pcidev.c. Binary file (standard input) matches Corresponding to flashrom svn r1644.
Diffstat (limited to 'nicintel_spi.c')
-rw-r--r--nicintel_spi.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/nicintel_spi.c b/nicintel_spi.c
index f61c2b1..0045c09 100644
--- a/nicintel_spi.c
+++ b/nicintel_spi.c
@@ -166,14 +166,17 @@ static int nicintel_spi_shutdown(void *data)
int nicintel_spi_init(void)
{
+ struct pci_dev *dev = NULL;
uint32_t tmp;
if (rget_io_perms())
return 1;
- /* No need to check for errors, pcidev_init() will not return in case of errors. */
- io_base_addr = pcidev_init(PCI_BASE_ADDRESS_0, nics_intel_spi);
+ dev = pcidev_init(nics_intel_spi, PCI_BASE_ADDRESS_0);
+ if (!dev)
+ return 1;
+ io_base_addr = pcidev_readbar(dev, PCI_BASE_ADDRESS_0);
nicintel_spibar = physmap("Intel Gigabit NIC w/ SPI flash",
io_base_addr, MEMMAP_SIZE);
/* Automatic restore of EECD on shutdown is not possible because EECD
OpenPOWER on IntegriCloud