Attention is currently required from: Thomas Heijligen, Angel Pons.
Hello build bot (Jenkins), Thomas Heijligen, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/73456
to look at the new patch set (#2).
Change subject: internal: Move laptop_ok into board_cfg
......................................................................
internal: Move laptop_ok into board_cfg
Due to how internal is structured around chipset_flash_enable()
entry we need to prepare a crafted programmer_cfg that contains
a board_enable substructure with data derived from the board_enable
subsystem. While this is certainly not perfection, it does make
clear the relationships between board_enable into chipset_flash_enable
and subsequently the overall internal programmer initialisation
in a RAII fashion at the type level over closure upon global
state that is impossible to reason about.
Also flip predicate in report_nonwl_laptop_detected() and
return early with the trivial base-case.
TEST=`$ sudo ./flashrom -p internal --flash-name`.
Change-Id: I459215253845c2af73262943ce91a36464e9eb06
Signed-off-by: Edward O'Callaghan <quasisec(a)google.com>
---
M board_enable.c
M chipset_enable.c
M flashrom.c
M include/programmer.h
M internal.c
5 files changed, 69 insertions(+), 44 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/56/73456/2
--
To view, visit https://review.coreboot.org/c/flashrom/+/73456
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I459215253845c2af73262943ce91a36464e9eb06
Gerrit-Change-Number: 73456
Gerrit-PatchSet: 2
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: newpatchset
Attention is currently required from: Thomas Heijligen, Stefan Reinauer, Anastasia Klimchuk.
Peter Marheine has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/73359 )
Change subject: doc: Add build instructions
......................................................................
Patch Set 3:
(1 comment)
File doc/developers_doc/building_from_source.rst:
https://review.coreboot.org/c/flashrom/+/73359/comment/218e1cf7_861729a0
PS3, Line 175: .. todo:: Write a sphinx extension to render ``meson_options.txt`` here
`meson configure` will print out all options including project-specific ones, and the inline documentation for options isn't very useful right now (it doesn't seem useful unless you already have some idea of what the options do).
I think the important options should either be documented manually here (providing more context for those that are typically interesting), or document that `meson configure` will show them (assuming that the plain information you get from there isn't very useful and it's not worth much effort to provide it inline here).
--
To view, visit https://review.coreboot.org/c/flashrom/+/73359
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I96771e98b313a6d26dd2be940ff37998d4124324
Gerrit-Change-Number: 73359
Gerrit-PatchSet: 3
Gerrit-Owner: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: Alexander Goncharov <chat(a)joursoir.net>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-CC: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-CC: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Mon, 06 Mar 2023 02:04:51 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Thomas Heijligen, Angel Pons.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/73456 )
Change subject: internal: Move laptop_ok into board_cfg
......................................................................
Patch Set 1:
(1 comment)
File internal.c:
https://review.coreboot.org/c/flashrom/+/73456/comment/b07d9582_4fdc19b7
PS1, Line 158:
: /* Unconditionally reset global state from previous operation. */
: bcfg.laptop_ok = false;
actually can delete this now.
--
To view, visit https://review.coreboot.org/c/flashrom/+/73456
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I459215253845c2af73262943ce91a36464e9eb06
Gerrit-Change-Number: 73456
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Mon, 06 Mar 2023 00:38:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Angel Pons.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/71623 )
Change subject: board_enables: Allow for prog cfg coupling with board cfg
......................................................................
Patch Set 3:
This change is ready for review.
--
To view, visit https://review.coreboot.org/c/flashrom/+/71623
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I7058a693e714a6966a842ae97cc8da7296e63e5e
Gerrit-Change-Number: 71623
Gerrit-PatchSet: 3
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-CC: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Mon, 06 Mar 2023 00:31:00 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/73456 )
Change subject: internal: Move laptop_ok into board_cfg
......................................................................
internal: Move laptop_ok into board_cfg
Due to how internal is structured around chipset_flash_enable()
entry we need to prepare a crafted programmer_cfg that contains
a board_enable substructure with data derived from the board_enable
subsystem. While this is certainly not perfection, it does make
clear the relationships between board_enable into chipset_flash_enable
and subsequently the overall internal programmer initialisation
in a RAII fashion at the type level over closure upon global
state that is impossible to reason about.
TEST=`$ sudo ./flashrom -p internal --flash-name`.
Change-Id: I459215253845c2af73262943ce91a36464e9eb06
Signed-off-by: Edward O'Callaghan <quasisec(a)google.com>
---
M board_enable.c
M chipset_enable.c
M flashrom.c
M include/programmer.h
M internal.c
5 files changed, 40 insertions(+), 19 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/56/73456/1
diff --git a/board_enable.c b/board_enable.c
index f10f5fc..d9af44e 100644
--- a/board_enable.c
+++ b/board_enable.c
@@ -2293,7 +2293,7 @@
static int p2_whitelist_laptop(struct board_cfg *cfg)
{
cfg->is_laptop = 1;
- laptop_ok = true;
+ cfg->laptop_ok = true;
msg_pdbg("Whitelisted laptop detected.\n");
return 0;
}
diff --git a/chipset_enable.c b/chipset_enable.c
index e1dd6a3..16ef0f4 100644
--- a/chipset_enable.c
+++ b/chipset_enable.c
@@ -826,7 +826,7 @@
/* Suppress unknown laptop warning if we booted from SPI. */
if (boot_buses & BUS_SPI)
- laptop_ok = true;
+ cfg->bcfg->laptop_ok = true;
return 0;
}
@@ -971,7 +971,7 @@
/* Suppress unknown laptop warning if we booted from SPI. */
if (!ret && (boot_buses & BUS_SPI))
- laptop_ok = true;
+ cfg->bcfg->laptop_ok = true;
_freepci_ret:
pci_free_dev(spi_dev);
@@ -1087,7 +1087,7 @@
/* Suppress unknown laptop warning if we booted from SPI. */
if (boot_buses & BUS_SPI)
- laptop_ok = true;
+ cfg->bcfg->laptop_ok = true;
return 0;
}
@@ -1676,7 +1676,7 @@
/* Suppress unknown laptop warning if we booted from SPI. */
if (!ret && want_spi)
- laptop_ok = true;
+ cfg->bcfg->laptop_ok = true;
return ret;
}
diff --git a/flashrom.c b/flashrom.c
index 3cf67f1..da46354 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -65,10 +65,6 @@
*/
static bool may_register_shutdown = false;
-struct programmer_cfg {
- char *params;
-};
-
/* Register a function to be executed on programmer shutdown.
* The advantage over atexit() is that you can supply a void pointer which will
* be used as parameter to the registered function upon programmer shutdown.
diff --git a/include/programmer.h b/include/programmer.h
index ec92702..5b304f5 100644
--- a/include/programmer.h
+++ b/include/programmer.h
@@ -30,7 +30,11 @@
USB,
OTHER,
};
-struct programmer_cfg;
+struct board_cfg;
+struct programmer_cfg {
+ char *params;
+ struct board_cfg *bcfg;
+};
struct dev_entry {
uint16_t vendor_id;
@@ -162,6 +166,7 @@
struct board_cfg {
int is_laptop;
+ bool laptop_ok;
};
struct board_match {
@@ -267,7 +272,6 @@
#endif
#if CONFIG_INTERNAL == 1
-extern bool laptop_ok;
extern bool force_boardmismatch;
void probe_superio(void);
int register_superio(struct superio s);
diff --git a/internal.c b/internal.c
index 7f0e0e9..79d6352 100644
--- a/internal.c
+++ b/internal.c
@@ -27,8 +27,6 @@
#include "hwaccess_x86_io.h"
#endif
-bool laptop_ok = false;
-
bool force_boardmismatch = false;
enum chipbustype internal_buses_supported = BUS_NONE;
@@ -108,9 +106,9 @@
}
// FIXME: remove '_' suffix from parameters once global shadowing is fixed.
-static void report_nonwl_laptop_detected(int is_laptop, bool laptop_ok_)
+static void report_nonwl_laptop_detected(int is_laptop, bool laptop_ok)
{
- if (is_laptop && !laptop_ok_) {
+ if (is_laptop && !laptop_ok) {
msg_pinfo("========================================================================\n");
if (is_laptop == 1) {
msg_pinfo("You seem to be running flashrom on an unknown laptop. Some\n"
@@ -159,7 +157,7 @@
return ret;
/* Unconditionally reset global state from previous operation. */
- laptop_ok = false;
+ bcfg.laptop_ok = false;
/* Default to Parallel/LPC/FWH flash devices. If a known host controller
* is found, the host controller init routine sets the
@@ -229,13 +227,15 @@
* this isn't a laptop. Board-enables may override this,
* non-legacy buses (SPI and opaque atm) are probed anyway.
*/
- if (bcfg.is_laptop && !(laptop_ok || force_laptop || (not_a_laptop && bcfg.is_laptop == 2)))
+ if (bcfg.is_laptop && !(bcfg.laptop_ok || force_laptop || (not_a_laptop && bcfg.is_laptop == 2)))
internal_buses_supported = BUS_NONE;
/* try to enable it. Failure IS an option, since not all motherboards
* really need this to be done, etc., etc.
*/
- ret = chipset_flash_enable(cfg);
+ struct programmer_cfg icfg = *cfg;
+ icfg.bcfg = &bcfg;
+ ret = chipset_flash_enable(&icfg);
if (ret == -2) {
msg_perr("WARNING: No chipset found. Flash detection "
"will most likely fail.\n");
@@ -259,7 +259,7 @@
internal_par_init(internal_buses_supported);
/* Report if a non-whitelisted laptop is detected that likely uses a legacy bus. */
- report_nonwl_laptop_detected(bcfg.is_laptop, laptop_ok);
+ report_nonwl_laptop_detected(bcfg.is_laptop, bcfg.laptop_ok);
ret = 0;
--
To view, visit https://review.coreboot.org/c/flashrom/+/73456
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I459215253845c2af73262943ce91a36464e9eb06
Gerrit-Change-Number: 73456
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-MessageType: newchange
Attention is currently required from: Felix Singer, Thomas Heijligen.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/72864 )
Change subject: wbsio_spi.c: Convert to direct driver entry
......................................................................
Patch Set 2:
(3 comments)
Patchset:
PS2:
> The entries in `test_build. […]
Done
File wbsio_spi.c:
https://review.coreboot.org/c/flashrom/+/72864/comment/742defac_c885f0fb
PS2, Line 240: msg_perr("There is currently no way to determine if the programmer works on a board. "
> This programmer is known to work only on the 'Intel D201GLY' mainboard. […]
Done
https://review.coreboot.org/c/flashrom/+/72864/comment/9c634650_3c577ec5
PS2, Line 265: const struct programmer_entry programmer_wbsio_spi = {
> ``devs. […]
Done
--
To view, visit https://review.coreboot.org/c/flashrom/+/72864
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I54b166048089bc502b99a345c02e91894590894e
Gerrit-Change-Number: 72864
Gerrit-PatchSet: 2
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Comment-Date: Sun, 05 Mar 2023 23:24:51 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Thomas Heijligen <src(a)posteo.de>
Gerrit-MessageType: comment