Draw struct flashchip into struct flashprog_flashctx
We used to have a reference to a dynamically allocated struct flashchip
inside the flash context. But now that we only ever allocate both in one
go, we can let go of the reference and make it a single structure.
Change-Id: I857acb1def6d133a5cbc28fc7a99b7b1a22b55e0
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/494
diff --git a/nicintel_eeprom.c b/nicintel_eeprom.c
index e5df1f8..c8bfb05 100644
--- a/nicintel_eeprom.c
+++ b/nicintel_eeprom.c
@@ -106,12 +106,12 @@
static int nicintel_ee_prepare_i210(struct flashctx *flash)
{
/* Emulated eeprom has a fixed size of 4 KB */
- flash->chip->total_size = 4;
- flash->chip->page_size = flashprog_flash_getsize(flash);
- flash->chip->tested = TEST_OK_PREW;
- flash->chip->gran = write_gran_1byte_implicit_erase;
- flash->chip->block_erasers->eraseblocks[0].size = flash->chip->page_size;
- flash->chip->block_erasers->eraseblocks[0].count = 1;
+ flash->chip.total_size = 4;
+ flash->chip.page_size = flashprog_flash_getsize(flash);
+ flash->chip.tested = TEST_OK_PREW;
+ flash->chip.gran = write_gran_1byte_implicit_erase;
+ flash->chip.block_erasers->eraseblocks[0].size = flash->chip.page_size;
+ flash->chip.block_erasers->eraseblocks[0].count = 1;
return 1;
}
@@ -119,16 +119,16 @@
static int nicintel_ee_prepare_82580(struct flashctx *flash)
{
if (nicintel_pci->device_id == UNPROG_DEVICE)
- flash->chip->total_size = 16; /* Fall back to minimum supported size. */
+ flash->chip.total_size = 16; /* Fall back to minimum supported size. */
else {
uint32_t tmp = pci_mmio_readl(nicintel_eebar + EEC);
tmp = ((tmp >> EE_SIZE) & EE_SIZE_MASK);
switch (tmp) {
case 7:
- flash->chip->total_size = 16;
+ flash->chip.total_size = 16;
break;
case 8:
- flash->chip->total_size = 32;
+ flash->chip.total_size = 32;
break;
default:
msg_cerr("Unsupported chip size 0x%x\n", tmp);
@@ -136,11 +136,11 @@
}
}
- flash->chip->page_size = EE_PAGE_MASK + 1;
- flash->chip->tested = TEST_OK_PREW;
- flash->chip->gran = write_gran_1byte_implicit_erase;
- flash->chip->block_erasers->eraseblocks[0].size = (EE_PAGE_MASK + 1);
- flash->chip->block_erasers->eraseblocks[0].count = (flashprog_flash_getsize(flash)) / (EE_PAGE_MASK + 1);
+ flash->chip.page_size = EE_PAGE_MASK + 1;
+ flash->chip.tested = TEST_OK_PREW;
+ flash->chip.gran = write_gran_1byte_implicit_erase;
+ flash->chip.block_erasers->eraseblocks[0].size = (EE_PAGE_MASK + 1);
+ flash->chip.block_erasers->eraseblocks[0].count = (flashprog_flash_getsize(flash)) / (EE_PAGE_MASK + 1);
return 1;
}