From a721181a08430836352cb23a544e92fdc8d55b99 Mon Sep 17 00:00:00 2001 From: Anastasia Klimchuk Date: Thu, 19 May 2022 14:40:37 +1000 Subject: dummyflasher: Wire variable size feature via opaque infra Wire "variable size" feature in dummy programmer via opaque infra. This patch fixes the broken build with CONFIG_DUMMY=no. Dummyflasher registers opaque master for the case when it is initialised with EMULATE_VARIABLE_SIZE. Dummy opaque master emulates read/write/erase as simple memory operations over `data->flashchip_contents`. The feature works via "Opaque flash chip" in flashchips.c which has one block eraser at the moment. If this changes in future, each block eraser needs to be updated in `probe_variable_size`. Fixes: https://ticket.coreboot.org/issues/365 TEST=the following scenarious run successfully Testing build $ make clean && make CONFIG_DUMMY=no $ flashrom -h : dummy is not in the list $ make clean && make CONFIG_EVERYTHING=yes $ flashrom -h : dummy is in the list Testing "variable size" feature $ flashrom -p dummy:size=8388608,emulate=VARIABLE_SIZE -V $ flashrom -p dummy:size=8388608,emulate=VARIABLE_SIZE -r /tmp/dump.bin -V $ head -c 8388608 /tmp/image.bin $ flashrom -p dummy:image=/tmp/image.bin,size=8388608,emulate=VARIABLE_SIZE -w /tmp/dump.bin -V also same as above with erase_to_zero=yes Testing standard flow $ flashrom -p dummy:emulate=W25Q128FV -V $ flashrom -p dummy:emulate=W25Q128FV -r /tmp/dump.bin -V $ head -c 16777216 /tmp/image.bin $ flashrom -p dummy:image=/tmp/image.bin,emulate=W25Q128FV -w /tmp/dump.bin -V Testing invalid combination of programmer params (`init_data` fails and prints error message which is WAI) $ flashrom -p dummy:size=8388608 -V -> init_data: size parameter is only valid for VARIABLE_SIZE chip. $ flashrom -p dummy:emulate=VARIABLE_SIZE -V -> init_data: the size parameter is not given. $ flashrom -p dummy:emulate=W25Q128FV,erase_to_zero=yes -V -> init_data: erase_to_zero parameter is not valid for real chip. Change-Id: I76402bfdf8b1a75489e4509fec92c9a777d0cf58 Signed-off-by: Anastasia Klimchuk Reviewed-on: https://review.coreboot.org/c/flashrom/+/64488 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber Reviewed-by: Edward O'Callaghan --- flashchips.c | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'flashchips.c') diff --git a/flashchips.c b/flashchips.c index c333fd16..71a6bfbd 100644 --- a/flashchips.c +++ b/flashchips.c @@ -19962,28 +19962,6 @@ const struct flashchip flashchips[] = { .read = NULL, }, - { - .vendor = "Generic", - .name = "Variable Size SPI chip", - .bustype = BUS_SPI, - .manufacture_id = PROGMANUF_ID, - .model_id = PROGDEV_ID, - .total_size = 64, /* This size is set temporarily */ - .page_size = 256, - .feature_bits = FEATURE_4BA_READ | FEATURE_4BA_WRITE, - .tested = TEST_OK_PREW, - .probe = probe_variable_size, - .block_erasers = - { - { - .eraseblocks = { {64 * 1024, 1} }, - .block_erase = spi_block_erase_c7, - } - }, - .write = spi_chip_write_256, - .read = spi_chip_read, - }, - { .vendor = "Generic", .name = "unknown SPI chip (RDID)", -- cgit v1.2.3