Edward O'Callaghan has submitted this change. ( https://review.coreboot.org/c/flashrom/+/54907 )
Change subject: dummyflasher.c: Get rid of get_data_from_context()
......................................................................
dummyflasher.c: Get rid of get_data_from_context()
Relying on the global state 'dummy_buses_supported' to
determine the member master struct [mst.par or mst.spi]
is both buggy and ultimately unnecessary. It became
apparent after commit 4eef651ff503f81b77 just how fragile
this really was as the 'defaults' simultaneously selected
both buses causing get_data_from_context() to fall-though
however memory happened to workout by chance due to the
union. With the member master structs now being struct
fields the subtle bug is more apparent.
BUG=none
BRANCH=none
TEST=`./flashrom -r /tmp/fwupdater.apnSQQ -p dummy:emulate=VARIABLE_SIZE,image=test_update.sh.tmp.emu,size=8388608`
Change-Id: I07a34faf50ff0679cb3d6bc683142f82160010b1
Signed-off-by: Edward O'Callaghan <quasisec(a)google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/54907
Reviewed-by: Anastasia Klimchuk <aklm(a)chromium.org>
Reviewed-by: Sam McNally <sammc(a)google.com>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
---
M dummyflasher.c
1 file changed, 2 insertions(+), 14 deletions(-)
Approvals:
build bot (Jenkins): Verified
Sam McNally: Looks good to me, approved
Anastasia Klimchuk: Looks good to me, but someone else must approve
diff --git a/dummyflasher.c b/dummyflasher.c
index 587fc61..b7cfab8 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -103,18 +103,6 @@
#endif
#endif
-static enum chipbustype dummy_buses_supported = BUS_NONE;
-
-static struct emu_data* get_data_from_context(const struct flashctx *flash)
-{
- if (dummy_buses_supported & BUS_NONSPI)
- return (struct emu_data *)flash->mst->par.data;
- else if (dummy_buses_supported & BUS_SPI)
- return (struct emu_data *)flash->mst->spi.data;
-
- return NULL; /* buses was set to BUS_NONE. */
-}
-
void *dummy_map(const char *descr, uintptr_t phys_addr, size_t len)
{
msg_pspew("%s: Mapping %s, 0x%zx bytes at 0x%0*" PRIxPTR "\n",
@@ -688,7 +676,7 @@
/* Convert the parameters to lowercase. */
tolower_string(bustext);
- dummy_buses_supported = BUS_NONE;
+ enum chipbustype dummy_buses_supported = BUS_NONE;
if (strstr(bustext, "parallel")) {
dummy_buses_supported |= BUS_PARALLEL;
msg_pdbg("Enabling support for %s flash.\n", "parallel");
@@ -1041,7 +1029,7 @@
int probe_variable_size(struct flashctx *flash)
{
unsigned int i;
- const struct emu_data *emu_data = get_data_from_context(flash);
+ const struct emu_data *emu_data = flash->mst->spi.data;
/* Skip the probing if we don't emulate this chip. */
if (!emu_data || emu_data->emu_chip != EMULATE_VARIABLE_SIZE)
--
To view, visit https://review.coreboot.org/c/flashrom/+/54907
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I07a34faf50ff0679cb3d6bc683142f82160010b1
Gerrit-Change-Number: 54907
Gerrit-PatchSet: 3
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Namyoon Woo <namyoon(a)google.com>
Gerrit-Reviewer: Sam McNally <sammc(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: merged
Edward O'Callaghan has submitted this change. ( https://review.coreboot.org/c/flashrom/+/54906 )
Change subject: dummyflasher.c: Inline data fetch for spi workers
......................................................................
dummyflasher.c: Inline data fetch for spi workers
The spi callbacks do not need par logic to fetch the
data field. Instead of going though get_data_from_context()
just fetch 'data' directly out of mst.spi.
This leads us towards a path of removing dummy_buses_supported
from global state.
BUG=none
BRANCH=none
TEST=`./flashrom -r /tmp/fwupdater.apnSQQ -p dummy:emulate=VARIABLE_SIZE,image=test_update.sh.tmp.emu,size=8388608`
Change-Id: I63b8d8861df75f52f241f09614146990fdfe59ed
Signed-off-by: Edward O'Callaghan <quasisec(a)google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/54906
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Sam McNally <sammc(a)google.com>
Reviewed-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M dummyflasher.c
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
build bot (Jenkins): Verified
Sam McNally: Looks good to me, approved
Anastasia Klimchuk: Looks good to me, but someone else must approve
diff --git a/dummyflasher.c b/dummyflasher.c
index 4661f3d..587fc61 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -129,7 +129,7 @@
static int dummy_spi_write_256(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len)
{
- struct emu_data *emu_data = get_data_from_context(flash);
+ struct emu_data *emu_data = flash->mst->spi.data;
return spi_write_chunked(flash, buf, start, len,
emu_data->spi_write_256_chunksize);
}
@@ -570,7 +570,7 @@
unsigned char *readarr)
{
unsigned int i;
- struct emu_data *emu_data = get_data_from_context(flash);
+ struct emu_data *emu_data = flash->mst->spi.data;
if (!emu_data) {
msg_perr("No data in flash context!\n");
return 1;
--
To view, visit https://review.coreboot.org/c/flashrom/+/54906
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I63b8d8861df75f52f241f09614146990fdfe59ed
Gerrit-Change-Number: 54906
Gerrit-PatchSet: 2
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Sam McNally <sammc(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: merged
Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/54890 )
Change subject: programmer: Introduce default shutdown function
......................................................................
Patch Set 1:
(1 comment)
Commit Message:
https://review.coreboot.org/c/flashrom/+/54890/comment/6c871a4f_ec3cf9f3
PS1, Line 13: lot of par masters that
: will use it in the nearest future.
> Yes sure, my main goal was to get some comments, thank you for comment! […]
I have an update: there are 4 more customers that would be using default_shutdown function (bitbang spi masters):
CB:54994
CB:54995
CB:54996
CB:54998
So if you are saying this is a good direction, maybe we can consider going ahead with it?
If this goes after bitbangs, that would be 5 places to change - still fine. And then 10 par masters would use default shutdown straight away.
--
To view, visit https://review.coreboot.org/c/flashrom/+/54890
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I8b20717ba549e12edffbc5d1643ff064a4f0c517
Gerrit-Change-Number: 54890
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Thu, 27 May 2021 02:00:22 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Edward O'Callaghan <quasisec(a)chromium.org>
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: comment
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/54998
to look at the new patch set (#2).
Change subject: rayer_spi.c: Refactor singleton states into reentrant pattern
......................................................................
rayer_spi.c: Refactor singleton states into reentrant pattern
Move global singleton states into a struct and store within
the bitbang_spi_master data field for the life-time of the driver.
This is one of the steps on the way to move spi_master data
memory management behind the initialisation API, for more
context see other patches under the same topic "register_master_api".
BUG=b:185191942
TEST=builds
Change-Id: Idde4557d89f80fe5d5884ce6c8cdf538ad2e5d68
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M rayer_spi.c
1 file changed, 93 insertions(+), 40 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/98/54998/2
--
To view, visit https://review.coreboot.org/c/flashrom/+/54998
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Idde4557d89f80fe5d5884ce6c8cdf538ad2e5d68
Gerrit-Change-Number: 54998
Gerrit-PatchSet: 2
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: newpatchset