Edward O'Callaghan has uploaded this change for review.
tree/drivers: Migrate to rget_io_perms_req framework
Drop bespoke calls in driver init() entry-points in favour
of using the programmer requirements flag.
Change-Id: Idbb53e97e1cc208bfdb94bd66c5d5840750c8f40
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
---
M atahpt.c
M atapromise.c
M internal.c
M nic3com.c
M nicnatsemi.c
M nicrealtek.c
M rayer_spi.c
M satamv.c
8 files changed, 21 insertions(+), 26 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/63/68663/1
diff --git a/atahpt.c b/atahpt.c
index 89b44c2..12d1c57 100644
--- a/atahpt.c
+++ b/atahpt.c
@@ -89,9 +89,6 @@
struct pci_dev *dev = NULL;
uint32_t io_base_addr;
- if (rget_io_perms())
- return 1;
-
dev = pcidev_init(cfg, ata_hpt, PCI_BASE_ADDRESS_4);
if (!dev)
return 1;
@@ -118,6 +115,7 @@
const struct programmer_entry programmer_atahpt = {
.name = "atahpt",
.type = PCI,
+ .rget_io_perms_req = true,
.devs.dev = ata_hpt,
.init = atahpt_init,
};
diff --git a/atapromise.c b/atapromise.c
index 625eb83..197fd82 100644
--- a/atapromise.c
+++ b/atapromise.c
@@ -131,9 +131,6 @@
uint8_t *bar;
size_t rom_size;
- if (rget_io_perms())
- return 1;
-
dev = pcidev_init(cfg, ata_promise, PCI_BASE_ADDRESS_4);
if (!dev)
return 1;
@@ -182,6 +179,7 @@
const struct programmer_entry programmer_atapromise = {
.name = "atapromise",
.type = PCI,
+ .rget_io_perms_req = true,
.devs.dev = ata_promise,
.init = atapromise_init,
};
diff --git a/internal.c b/internal.c
index 8c834e2..798fa69 100644
--- a/internal.c
+++ b/internal.c
@@ -236,11 +236,6 @@
}
#if defined(__i386__) || defined(__x86_64__)
- if (rget_io_perms()) {
- ret = 1;
- goto internal_init_exit;
- }
-
if ((cb_parse_table(&cb_vendor, &cb_model) == 0) && (board_vendor != NULL) && (board_model != NULL)) {
if (strcasecmp(board_vendor, cb_vendor) || strcasecmp(board_model, cb_model)) {
msg_pwarn("Warning: The mainboard IDs set by -p internal:mainboard (%s:%s) do not\n"
@@ -347,6 +342,7 @@
const struct programmer_entry programmer_internal = {
.name = "internal",
.type = OTHER,
+ .rget_io_perms_req = true,
.devs.note = NULL,
.init = internal_init,
};
diff --git a/nic3com.c b/nic3com.c
index efba979..7ab6ef3 100644
--- a/nic3com.c
+++ b/nic3com.c
@@ -108,9 +108,6 @@
uint32_t internal_conf = 0;
uint16_t id;
- if (rget_io_perms())
- return 1;
-
dev = pcidev_init(cfg, nics_3com, PCI_BASE_ADDRESS_0);
if (!dev)
return 1;
@@ -166,6 +163,7 @@
const struct programmer_entry programmer_nic3com = {
.name = "nic3com",
.type = PCI,
+ .rget_io_perms_req = true,
.devs.dev = nics_3com,
.init = nic3com_init,
};
diff --git a/nicnatsemi.c b/nicnatsemi.c
index efa879a..96425a5 100644
--- a/nicnatsemi.c
+++ b/nicnatsemi.c
@@ -93,9 +93,6 @@
struct pci_dev *dev = NULL;
uint32_t io_base_addr;
- if (rget_io_perms())
- return 1;
-
dev = pcidev_init(cfg, nics_natsemi, PCI_BASE_ADDRESS_0);
if (!dev)
return 1;
@@ -125,6 +122,7 @@
const struct programmer_entry programmer_nicnatsemi = {
.name = "nicnatsemi",
.type = PCI,
+ .rget_io_perms_req = true,
.devs.dev = nics_natsemi,
.init = nicnatsemi_init,
};
diff --git a/nicrealtek.c b/nicrealtek.c
index 103ea9e..4aa1305 100644
--- a/nicrealtek.c
+++ b/nicrealtek.c
@@ -104,9 +104,6 @@
int bios_rom_addr;
int bios_rom_data;
- if (rget_io_perms())
- return 1;
-
dev = pcidev_init(cfg, nics_realtek, PCI_BASE_ADDRESS_0);
if (!dev)
return 1;
@@ -144,6 +141,7 @@
const struct programmer_entry programmer_nicrealtek = {
.name = "nicrealtek",
.type = PCI,
+ .rget_io_perms_req = true,
.devs.dev = nics_realtek,
.init = nicrealtek_init,
};
diff --git a/rayer_spi.c b/rayer_spi.c
index 8fdcc01..00a873a 100644
--- a/rayer_spi.c
+++ b/rayer_spi.c
@@ -294,9 +294,6 @@
msg_pinfo("Using %s pinout.\n", prog->description);
pinout = (struct rayer_pinout *)prog->dev_data;
- if (rget_io_perms())
- return 1;
-
/* Get the initial value before writing to any line. */
lpt_outbyte = INB(lpt_iobase);
@@ -327,6 +324,7 @@
.name = "rayer_spi",
.type = OTHER,
/* FIXME */
+ .rget_io_perms_req = true,
.devs.note = "RayeR parallel port programmer\n",
.init = rayer_spi_init,
};
diff --git a/satamv.c b/satamv.c
index dcd53c7..e046d56 100644
--- a/satamv.c
+++ b/satamv.c
@@ -122,9 +122,6 @@
uint16_t iobar;
uint8_t *bar;
- if (rget_io_perms())
- return 1;
-
/* BAR0 has all internal registers memory mapped. */
dev = pcidev_init(cfg, satas_mv, PCI_BASE_ADDRESS_0);
if (!dev)
@@ -209,6 +206,7 @@
const struct programmer_entry programmer_satamv = {
.name = "satamv",
.type = PCI,
+ .rget_io_perms_req = true,
.devs.dev = satas_mv,
.init = satamv_init,
};
To view, visit change 68663. To unsubscribe, or for help writing mail filters, visit settings.