Edward O'Callaghan has uploaded this change for review.

View Change

par: plumb max_rom_decode into register func

Change-Id: Id4a4ba09ac493a67aedd3897e7cfc1377e12bdbe
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
---
M atahpt.c
M atapromise.c
M atavia.c
M drkaiser.c
M dummyflasher.c
M gfxnvidia.c
M include/programmer.h
M internal.c
M it8212.c
M nic3com.c
M nicintel.c
M nicnatsemi.c
M nicrealtek.c
M parallel.c
M satamv.c
M satasii.c
M serprog.c
17 files changed, 32 insertions(+), 26 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/77/68677/1
diff --git a/atahpt.c b/atahpt.c
index 89b44c2..53b2c83 100644
--- a/atahpt.c
+++ b/atahpt.c
@@ -112,7 +112,7 @@
data->flash_access = pci_read_long(dev, REG_FLASH_ACCESS);
pci_write_long(dev, REG_FLASH_ACCESS, data->flash_access | BIT_FLASH_ACCESS);

- return register_par_master(&par_master_atahpt, BUS_PARALLEL, data);
+ return register_par_master(&par_master_atahpt, BUS_PARALLEL, data, 0);
}

const struct programmer_entry programmer_atahpt = {
diff --git a/atapromise.c b/atapromise.c
index 625eb83..cda3d42 100644
--- a/atapromise.c
+++ b/atapromise.c
@@ -175,8 +175,7 @@
data->bar = bar;
data->rom_size = rom_size;

- max_rom_decode.parallel = rom_size;
- return register_par_master(&par_master_atapromise, BUS_PARALLEL, data);
+ return register_par_master(&par_master_atapromise, BUS_PARALLEL, data, rom_size);
}

const struct programmer_entry programmer_atapromise = {
diff --git a/atavia.c b/atavia.c
index b392999..b4c05c4 100644
--- a/atavia.c
+++ b/atavia.c
@@ -182,7 +182,7 @@
return 1;
}

- return register_par_master(&lpc_master_atavia, BUS_LPC, NULL);
+ return register_par_master(&lpc_master_atavia, BUS_LPC, NULL, 0);
}

const struct programmer_entry programmer_atavia = {
diff --git a/drkaiser.c b/drkaiser.c
index 96f2c99..443d41e 100644
--- a/drkaiser.c
+++ b/drkaiser.c
@@ -112,9 +112,7 @@
data->flash_access = pci_read_word(dev, PCI_MAGIC_DRKAISER_ADDR);
pci_write_word(dev, PCI_MAGIC_DRKAISER_ADDR, PCI_MAGIC_DRKAISER_VALUE);

- max_rom_decode.parallel = 128 * 1024;
-
- return register_par_master(&par_master_drkaiser, BUS_PARALLEL, data);
+ return register_par_master(&par_master_drkaiser, BUS_PARALLEL, data, 128 * 1024);
}

const struct programmer_entry programmer_drkaiser = {
diff --git a/dummyflasher.c b/dummyflasher.c
index 110a88c..2feecd5 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -1415,7 +1415,7 @@
if (dummy_buses_supported & BUS_NONSPI)
register_par_master(&par_master_dummyflasher,
dummy_buses_supported & BUS_NONSPI,
- data);
+ data, 0);
if (dummy_buses_supported & BUS_SPI)
register_spi_master(&spi_master_dummyflasher, data);

diff --git a/gfxnvidia.c b/gfxnvidia.c
index 1d484ea..9ccf1ad 100644
--- a/gfxnvidia.c
+++ b/gfxnvidia.c
@@ -142,7 +142,7 @@

/* Write/erase doesn't work. */
programmer_may_write = false;
- return register_par_master(&par_master_gfxnvidia, BUS_PARALLEL, data);
+ return register_par_master(&par_master_gfxnvidia, BUS_PARALLEL, data, 0);
}

const struct programmer_entry programmer_gfxnvidia = {
diff --git a/include/programmer.h b/include/programmer.h
index 4da7330..e8f5ccc 100644
--- a/include/programmer.h
+++ b/include/programmer.h
@@ -438,7 +438,7 @@
int (*shutdown)(void *data);
void *data;
};
-int register_par_master(const struct par_master *mst, const enum chipbustype buses, void *data);
+int register_par_master(const struct par_master *mst, const enum chipbustype buses, void *data, uint32_t max_decode_size);

/* programmer.c */
void *fallback_map(const char *descr, uintptr_t phys_addr, size_t len);
diff --git a/internal.c b/internal.c
index 1b3b8b0..7cd3f22 100644
--- a/internal.c
+++ b/internal.c
@@ -306,7 +306,7 @@
#endif

if (internal_buses_supported & BUS_NONSPI)
- register_par_master(&par_master_internal, internal_buses_supported, NULL);
+ register_par_master(&par_master_internal, internal_buses_supported, NULL, max_rom_decode.parallel);

/* Report if a non-whitelisted laptop is detected that likely uses a legacy bus. */
if (is_laptop && !laptop_ok) {
diff --git a/it8212.c b/it8212.c
index 8fe2b59..c4d5075 100644
--- a/it8212.c
+++ b/it8212.c
@@ -103,8 +103,7 @@
data->decode_access = pci_read_long(dev, PCI_ROM_ADDRESS);
pci_write_long(dev, PCI_ROM_ADDRESS, io_base_addr | 0x01);

- max_rom_decode.parallel = IT8212_MEMMAP_SIZE;
- return register_par_master(&par_master_it8212, BUS_PARALLEL, data);
+ return register_par_master(&par_master_it8212, BUS_PARALLEL, data, IT8212_MEMMAP_SIZE);
}
const struct programmer_entry programmer_it8212 = {
.name = "it8212",
diff --git a/nic3com.c b/nic3com.c
index efba979..537fbfe 100644
--- a/nic3com.c
+++ b/nic3com.c
@@ -148,9 +148,7 @@
data->internal_conf = internal_conf;
data->id = id;

- max_rom_decode.parallel = 128 * 1024;
-
- return register_par_master(&par_master_nic3com, BUS_PARALLEL, data);
+ return register_par_master(&par_master_nic3com, BUS_PARALLEL, data, 128 * 1024);

init_err_cleanup_exit:
/* 3COM 3C90xB cards need a special fixup. */
diff --git a/nicintel.c b/nicintel.c
index 47edbb7..ef806d9 100644
--- a/nicintel.c
+++ b/nicintel.c
@@ -124,8 +124,7 @@
data->nicintel_bar = bar;
data->nicintel_control_bar = control_bar;

- max_rom_decode.parallel = NICINTEL_MEMMAP_SIZE;
- return register_par_master(&par_master_nicintel, BUS_PARALLEL, data);
+ return register_par_master(&par_master_nicintel, BUS_PARALLEL, data, NICINTEL_MEMMAP_SIZE);
}

const struct programmer_entry programmer_nicintel = {
diff --git a/nicnatsemi.c b/nicnatsemi.c
index efa879a..d291770 100644
--- a/nicnatsemi.c
+++ b/nicnatsemi.c
@@ -117,8 +117,7 @@
* max_rom_decode.parallel = 65536; and the mask in the read/write
* functions below wants to be 0x0000FFFF.
*/
- max_rom_decode.parallel = 131072;
- return register_par_master(&par_master_nicnatsemi, BUS_PARALLEL, data);
+ return register_par_master(&par_master_nicnatsemi, BUS_PARALLEL, data, 131072);
}


diff --git a/nicrealtek.c b/nicrealtek.c
index 103ea9e..6a41519 100644
--- a/nicrealtek.c
+++ b/nicrealtek.c
@@ -138,7 +138,7 @@
data->bios_rom_addr = bios_rom_addr;
data->bios_rom_data = bios_rom_data;

- return register_par_master(&par_master_nicrealtek, BUS_PARALLEL, data);
+ return register_par_master(&par_master_nicrealtek, BUS_PARALLEL, data, 0);
}

const struct programmer_entry programmer_nicrealtek = {
diff --git a/parallel.c b/parallel.c
index e635088..67e70f6 100644
--- a/parallel.c
+++ b/parallel.c
@@ -65,7 +65,7 @@

int register_par_master(const struct par_master *mst,
const enum chipbustype buses,
- void *data)
+ void *data, uint32_t max_decode_size)
{
struct registered_master rmst = {0};

@@ -96,6 +96,11 @@
return ERROR_FLASHROM_BUG;
}

+ if (max_decode_size)
+ max_rom_decode.parallel = max_decode_size;
+ else
+ max_rom_decode.parallel = 0xffffffff;
+
rmst.buses_supported = buses;
rmst.par = *mst;
if (data)
diff --git a/satamv.c b/satamv.c
index dcd53c7..1a33ee3 100644
--- a/satamv.c
+++ b/satamv.c
@@ -202,8 +202,7 @@

/* 512 kByte with two 8-bit latches, and
* 4 MByte with additional 3-bit latch. */
- max_rom_decode.parallel = 4 * 1024 * 1024;
- return register_par_master(&par_master_satamv, BUS_PARALLEL, data);
+ return register_par_master(&par_master_satamv, BUS_PARALLEL, data, 4 * 1024 * 1024);
}

const struct programmer_entry programmer_satamv = {
diff --git a/satasii.c b/satasii.c
index 011562e..5517fd7 100644
--- a/satasii.c
+++ b/satasii.c
@@ -146,7 +146,7 @@
}
data->bar = bar;

- return register_par_master(&par_master_satasii, BUS_PARALLEL, data);
+ return register_par_master(&par_master_satasii, BUS_PARALLEL, data, 0);
}
const struct programmer_entry programmer_satasii = {
.name = "satasii",
diff --git a/serprog.c b/serprog.c
index a3a3db3..afe8fdf 100644
--- a/serprog.c
+++ b/serprog.c
@@ -933,7 +933,7 @@
if (serprog_buses_supported & BUS_SPI)
register_spi_master(&spi_master_serprog, NULL);
if (serprog_buses_supported & BUS_NONSPI)
- register_par_master(&par_master_serprog, serprog_buses_supported & BUS_NONSPI, NULL);
+ register_par_master(&par_master_serprog, serprog_buses_supported & BUS_NONSPI, NULL, 0);
return 0;

init_err_cleanup_exit:

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

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id4a4ba09ac493a67aedd3897e7cfc1377e12bdbe
Gerrit-Change-Number: 68677
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-MessageType: newchange