Attention is currently required from: Anastasia Klimchuk.

Edward O'Callaghan has uploaded this change for review.

View Change

pcidev: Pass flashprg down to pcidev_init() entry

MAYBE needed to remove singletons.

Change-Id: I77bd8e85db770d1105a0c49838b2559aa2615cf1
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
---
M atahpt.c
M atapromise.c
M atavia.c
M drkaiser.c
M gfxnvidia.c
M include/programmer.h
M it8212.c
M nic3com.c
M nicintel.c
M nicintel_eeprom.c
M nicintel_spi.c
M nicnatsemi.c
M nicrealtek.c
M ogp_spi.c
M pcidev.c
M satamv.c
M satasii.c
M tests/tests.c
18 files changed, 30 insertions(+), 18 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/19/72819/1
diff --git a/atahpt.c b/atahpt.c
index f059b19..8283c40 100644
--- a/atahpt.c
+++ b/atahpt.c
@@ -86,7 +86,7 @@
if (rget_io_perms())
return 1;

- dev = pcidev_init(cfg, ata_hpt, PCI_BASE_ADDRESS_4);
+ dev = pcidev_init(flashprog, cfg, ata_hpt, PCI_BASE_ADDRESS_4);
if (!dev)
return 1;

diff --git a/atapromise.c b/atapromise.c
index 208597b..fe97b69 100644
--- a/atapromise.c
+++ b/atapromise.c
@@ -128,7 +128,7 @@
if (rget_io_perms())
return 1;

- dev = pcidev_init(cfg, ata_promise, PCI_BASE_ADDRESS_4);
+ dev = pcidev_init(flashprog, cfg, ata_promise, PCI_BASE_ADDRESS_4);
if (!dev)
return 1;

diff --git a/atavia.c b/atavia.c
index ba3c2ec..bc38cc0 100644
--- a/atavia.c
+++ b/atavia.c
@@ -158,7 +158,7 @@
}
free(arg);

- dev = pcidev_init(cfg, ata_via, PCI_ROM_ADDRESS); /* Actually no BAR setup needed at all. */
+ dev = pcidev_init(flashprog, cfg, ata_via, PCI_ROM_ADDRESS); /* Actually no BAR setup needed at all. */
if (!dev)
return 1;

diff --git a/drkaiser.c b/drkaiser.c
index 8be5dba..96178fc 100644
--- a/drkaiser.c
+++ b/drkaiser.c
@@ -81,7 +81,7 @@
uint32_t addr;
uint8_t *bar;

- dev = pcidev_init(cfg, drkaiser_pcidev, PCI_BASE_ADDRESS_2);
+ dev = pcidev_init(flashprog, cfg, drkaiser_pcidev, PCI_BASE_ADDRESS_2);
if (!dev)
return 1;

diff --git a/gfxnvidia.c b/gfxnvidia.c
index d445ab7..24063d4 100644
--- a/gfxnvidia.c
+++ b/gfxnvidia.c
@@ -106,7 +106,7 @@
uint32_t reg32;
uint8_t *bar;

- dev = pcidev_init(cfg, gfx_nvidia, PCI_BASE_ADDRESS_0);
+ dev = pcidev_init(flashprog, cfg, gfx_nvidia, PCI_BASE_ADDRESS_0);
if (!dev)
return 1;

diff --git a/include/programmer.h b/include/programmer.h
index 4e8aedd..f658882 100644
--- a/include/programmer.h
+++ b/include/programmer.h
@@ -121,7 +121,7 @@
extern struct pci_access *pacc;
int pci_init_common(void);
uintptr_t pcidev_readbar(struct pci_dev *dev, int bar);
-struct pci_dev *pcidev_init(const struct programmer_cfg *cfg, const struct dev_entry *devs, int bar);
+struct pci_dev *pcidev_init(struct flashrom_programmer *, const struct programmer_cfg *cfg, const struct dev_entry *devs, int bar);
struct pci_dev *pcidev_scandev(struct pci_filter *filter, struct pci_dev *start);
struct pci_dev *pcidev_getdevfn(struct pci_dev *dev, const int func);
struct pci_dev *pcidev_find_vendorclass(uint16_t vendor, uint16_t devclass);
diff --git a/it8212.c b/it8212.c
index 9528b4d..9e1a9c4 100644
--- a/it8212.c
+++ b/it8212.c
@@ -72,7 +72,7 @@
{
uint8_t *bar;

- struct pci_dev *dev = pcidev_init(cfg, devs_it8212, PCI_ROM_ADDRESS);
+ struct pci_dev *dev = pcidev_init(flashprog, cfg, devs_it8212, PCI_ROM_ADDRESS);
if (!dev)
return 1;

diff --git a/nic3com.c b/nic3com.c
index de9762e..9c24f3c 100644
--- a/nic3com.c
+++ b/nic3com.c
@@ -105,7 +105,7 @@
if (rget_io_perms())
return 1;

- dev = pcidev_init(cfg, nics_3com, PCI_BASE_ADDRESS_0);
+ dev = pcidev_init(flashprog, cfg, nics_3com, PCI_BASE_ADDRESS_0);
if (!dev)
return 1;

diff --git a/nicintel.c b/nicintel.c
index 444b894..0940d39 100644
--- a/nicintel.c
+++ b/nicintel.c
@@ -79,7 +79,7 @@
uint8_t *control_bar;

/* FIXME: BAR2 is not available if the device uses the CardBus function. */
- dev = pcidev_init(cfg, nics_intel, PCI_BASE_ADDRESS_2);
+ dev = pcidev_init(flashprog, cfg, nics_intel, PCI_BASE_ADDRESS_2);
if (!dev)
return 1;

diff --git a/nicintel_eeprom.c b/nicintel_eeprom.c
index 58a14fd..cc1c7ce 100644
--- a/nicintel_eeprom.c
+++ b/nicintel_eeprom.c
@@ -485,7 +485,7 @@
uint32_t eec = 0;
uint8_t *eebar;

- struct pci_dev *dev = pcidev_init(cfg, nics_intel_ee, PCI_BASE_ADDRESS_0);
+ struct pci_dev *dev = pcidev_init(flashprog, cfg, nics_intel_ee, PCI_BASE_ADDRESS_0);
if (!dev)
return 1;

diff --git a/nicintel_spi.c b/nicintel_spi.c
index 16cf5f6..643bb2e 100644
--- a/nicintel_spi.c
+++ b/nicintel_spi.c
@@ -289,7 +289,7 @@
{
struct pci_dev *dev = NULL;

- dev = pcidev_init(cfg, nics_intel_spi, PCI_BASE_ADDRESS_0);
+ dev = pcidev_init(flashprog, cfg, nics_intel_spi, PCI_BASE_ADDRESS_0);
if (!dev)
return 1;

diff --git a/nicnatsemi.c b/nicnatsemi.c
index 5ec356a..3455ee5 100644
--- a/nicnatsemi.c
+++ b/nicnatsemi.c
@@ -90,7 +90,7 @@
if (rget_io_perms())
return 1;

- dev = pcidev_init(cfg, nics_natsemi, PCI_BASE_ADDRESS_0);
+ dev = pcidev_init(flashprog, cfg, nics_natsemi, PCI_BASE_ADDRESS_0);
if (!dev)
return 1;

diff --git a/nicrealtek.c b/nicrealtek.c
index 68868e5..25f0fa0 100644
--- a/nicrealtek.c
+++ b/nicrealtek.c
@@ -101,7 +101,7 @@
if (rget_io_perms())
return 1;

- dev = pcidev_init(cfg, nics_realtek, PCI_BASE_ADDRESS_0);
+ dev = pcidev_init(flashprog, cfg, nics_realtek, PCI_BASE_ADDRESS_0);
if (!dev)
return 1;

diff --git a/ogp_spi.c b/ogp_spi.c
index bee97ec..4b9ad8d 100644
--- a/ogp_spi.c
+++ b/ogp_spi.c
@@ -140,7 +140,7 @@
}
free(type);

- dev = pcidev_init(cfg, ogp_spi, PCI_BASE_ADDRESS_0);
+ dev = pcidev_init(flashprog, cfg, ogp_spi, PCI_BASE_ADDRESS_0);
if (!dev)
return 1;

diff --git a/pcidev.c b/pcidev.c
index 0b35944..8d7ddbe 100644
--- a/pcidev.c
+++ b/pcidev.c
@@ -257,7 +257,7 @@
* also matches the specified bus:device.function.
* For convenience, this function also registers its own undo handlers.
*/
-struct pci_dev *pcidev_init(const struct programmer_cfg *cfg, const struct dev_entry *devs, int bar)
+struct pci_dev *pcidev_init(struct flashrom_programmer *flashprog, const struct programmer_cfg *cfg, const struct dev_entry *devs, int bar)
{
struct pci_dev *dev;
struct pci_dev *found_dev = NULL;
diff --git a/satamv.c b/satamv.c
index c2592d4..8bb92ee 100644
--- a/satamv.c
+++ b/satamv.c
@@ -120,7 +120,7 @@
return 1;

/* BAR0 has all internal registers memory mapped. */
- dev = pcidev_init(cfg, satas_mv, PCI_BASE_ADDRESS_0);
+ dev = pcidev_init(flashprog, cfg, satas_mv, PCI_BASE_ADDRESS_0);
if (!dev)
return 1;

diff --git a/satasii.c b/satasii.c
index 8b9c794..214d4c9 100644
--- a/satasii.c
+++ b/satasii.c
@@ -106,7 +106,7 @@
uint16_t reg_offset, id;
uint8_t *bar;

- dev = pcidev_init(cfg, satas_sii, PCI_BASE_ADDRESS_0);
+ dev = pcidev_init(flashprog, cfg, satas_sii, PCI_BASE_ADDRESS_0);
if (!dev)
return 1;

diff --git a/tests/tests.c b/tests/tests.c
index 0912f35..76430b7 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -53,7 +53,7 @@
.device_id = NON_ZERO,
};

-struct pci_dev *__wrap_pcidev_init(const struct programmer_cfg *cfg, void *devs, int bar)
+struct pci_dev *__wrap_pcidev_init(struct flashrom_programmer *flashprog, const struct programmer_cfg *cfg, void *devs, int bar)
{
LOG_ME;
return &mock_pci_dev;

To view, visit change 72819. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I77bd8e85db770d1105a0c49838b2559aa2615cf1
Gerrit-Change-Number: 72819
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Attention: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-MessageType: newchange