Edward O'Callaghan has uploaded this change for review.

View Change

internal: Move is_laptop into board_cfg

Change-Id: I24e38e4457299934acdcd70325d0bf0f4b139e5f
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
---
M board_enable.c
M include/programmer.h
M internal.c
3 files changed, 18 insertions(+), 9 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/55/73455/1
diff --git a/board_enable.c b/board_enable.c
index 146b40f..f10f5fc 100644
--- a/board_enable.c
+++ b/board_enable.c
@@ -2282,7 +2282,7 @@
static int p2_not_a_laptop(struct board_cfg *cfg)
{
/* label this board as not a laptop */
- g_is_laptop = 0;
+ cfg->is_laptop = 0;
msg_pdbg("Laptop detection overridden by P2 board enable.\n");
return 0;
}
@@ -2292,7 +2292,7 @@
*/
static int p2_whitelist_laptop(struct board_cfg *cfg)
{
- g_is_laptop = 1;
+ cfg->is_laptop = 1;
laptop_ok = true;
msg_pdbg("Whitelisted laptop detected.\n");
return 0;
diff --git a/include/programmer.h b/include/programmer.h
index bc5e8ba..ec92702 100644
--- a/include/programmer.h
+++ b/include/programmer.h
@@ -161,6 +161,7 @@
};

struct board_cfg {
+ int is_laptop;
};

struct board_match {
@@ -266,7 +267,6 @@
#endif

#if CONFIG_INTERNAL == 1
-extern int g_is_laptop;
extern bool laptop_ok;
extern bool force_boardmismatch;
void probe_superio(void);
diff --git a/internal.c b/internal.c
index d59fcf2..7f0e0e9 100644
--- a/internal.c
+++ b/internal.c
@@ -27,7 +27,6 @@
#include "hwaccess_x86_io.h"
#endif

-int g_is_laptop = 0;
bool laptop_ok = false;

bool force_boardmismatch = false;
@@ -150,7 +149,7 @@
const char *cb_model = NULL;
#endif
bool force_boardenable = false;
- struct board_cfg bcfg;
+ struct board_cfg bcfg = {0};

ret = get_params(cfg,
&force_boardenable, &force_boardmismatch,
@@ -205,9 +204,9 @@
}
}

- g_is_laptop = 2; /* Assume that we don't know by default. */
+ bcfg.is_laptop = 2; /* Assume that we don't know by default. */

- dmi_init(&g_is_laptop);
+ dmi_init(&bcfg.is_laptop);

/* In case Super I/O probing would cause pretty explosions. */
board_handle_before_superio(&bcfg, force_boardenable);
@@ -230,7 +229,7 @@
* this isn't a laptop. Board-enables may override this,
* non-legacy buses (SPI and opaque atm) are probed anyway.
*/
- if (g_is_laptop && !(laptop_ok || force_laptop || (not_a_laptop && g_is_laptop == 2)))
+ if (bcfg.is_laptop && !(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
@@ -260,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(g_is_laptop, laptop_ok);
+ report_nonwl_laptop_detected(bcfg.is_laptop, laptop_ok);

ret = 0;


To view, visit change 73455. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I24e38e4457299934acdcd70325d0bf0f4b139e5f
Gerrit-Change-Number: 73455
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-MessageType: newchange