mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 15:12:36 +02:00
nicintel_eeprom: pack pci device struct into programmer's data
Move global variable into a struct and store within the opaque_master data field for the life-time of the driver. This is one of the steps on the way to move opaque_master data memory management behind the initialisation API. TOPIC=register_master_api TEST=builds Change-Id: I69271bc77a6d7211e692c0b48d1853b95ffa80e9 Signed-off-by: Alexander Goncharov <chat@joursoir.net> Ticket: https://ticket.coreboot.org/issues/391 Reviewed-on: https://review.coreboot.org/c/flashrom/+/66691 Reviewed-by: Felix Singer <felixsinger@posteo.net> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
7ebb18985d
commit
9307e68d68
@ -72,11 +72,12 @@
|
||||
#define EE_PAGE_MASK 0x3f
|
||||
|
||||
static uint8_t *nicintel_eebar;
|
||||
static struct pci_dev *nicintel_pci;
|
||||
|
||||
#define UNPROG_DEVICE 0x1509
|
||||
|
||||
struct nicintel_eeprom_data {
|
||||
struct pci_dev *nicintel_pci;
|
||||
|
||||
/* Intel 82580 variable(s) */
|
||||
uint32_t eec;
|
||||
|
||||
@ -125,7 +126,9 @@ static int nicintel_ee_probe_i210(struct flashctx *flash)
|
||||
|
||||
static int nicintel_ee_probe_82580(struct flashctx *flash)
|
||||
{
|
||||
if (nicintel_pci->device_id == UNPROG_DEVICE)
|
||||
const struct nicintel_eeprom_data *data = flash->mst->opaque.data;
|
||||
|
||||
if (data->nicintel_pci->device_id == UNPROG_DEVICE)
|
||||
flash->chip->total_size = 16; /* Fall back to minimum supported size. */
|
||||
else {
|
||||
uint32_t tmp = pci_mmio_readl(nicintel_eebar + EEC);
|
||||
@ -434,7 +437,7 @@ static int nicintel_ee_shutdown_82580(void *opaque_data)
|
||||
struct nicintel_eeprom_data *data = opaque_data;
|
||||
int ret = 0;
|
||||
|
||||
if (nicintel_pci->device_id != UNPROG_DEVICE) {
|
||||
if (data->nicintel_pci->device_id != UNPROG_DEVICE) {
|
||||
uint32_t old_eec = data->eec;
|
||||
/* Request bitbanging and unselect the chip first to be safe. */
|
||||
if (nicintel_ee_req() || nicintel_ee_bitset(EEC, EE_CS, 1)) {
|
||||
@ -490,7 +493,6 @@ static int nicintel_ee_init(void)
|
||||
if (!nicintel_eebar)
|
||||
return 1;
|
||||
|
||||
nicintel_pci = dev;
|
||||
if (dev->device_id != UNPROG_DEVICE) {
|
||||
eec = pci_mmio_readl(nicintel_eebar + EEC);
|
||||
|
||||
@ -518,6 +520,7 @@ static int nicintel_ee_init(void)
|
||||
msg_perr("Unable to allocate space for OPAQUE master data\n");
|
||||
return 1;
|
||||
}
|
||||
data->nicintel_pci = dev;
|
||||
data->eec = eec;
|
||||
data->done_i20_write = false;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user