mb/google/herobrine: Only retrieve sku_id from EC once
Currently, we are getting the sku id from the EC every time we call the sku_id() function. However, this will never change so we only need to retrieve it once. Inserting exit condition if sku id is already set, then don't get it from the EC again. Also, removing the ram_code function, which does nothing right now. There is already a weak stub_function for this in src/lib/coreboot_table.c that already does the same thing. BUG=b:260740438,b:182963902 BRANCH=None TEST=make sure image still boots to login on herobrine device Change-Id: Ia787968100baf58a41ccce0cf95ed3ec9ce1758a Signed-off-by: Shelley Chen <shchen@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/70162 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Doug Anderson <dianders@chromium.org>
This commit is contained in:
parent
98d0574746
commit
474da028ab
|
@ -11,6 +11,9 @@
|
|||
uint32_t board_id(void)
|
||||
{
|
||||
static uint32_t id = UNDEFINED_STRAPPING_ID;
|
||||
if (id != UNDEFINED_STRAPPING_ID)
|
||||
return id;
|
||||
|
||||
gpio_t pins[3] = { 0 };
|
||||
if (CONFIG(BOARD_GOOGLE_HEROBRINE_REV0)) {
|
||||
pins[2] = GPIO(75);
|
||||
|
@ -22,20 +25,7 @@ uint32_t board_id(void)
|
|||
pins[0] = GPIO(48);
|
||||
}
|
||||
|
||||
if (id == UNDEFINED_STRAPPING_ID)
|
||||
id = gpio_base3_value(pins, ARRAY_SIZE(pins));
|
||||
|
||||
printk(BIOS_INFO, "BoardID :%d - "
|
||||
"Machine model: "
|
||||
"Qualcomm Technologies, Inc. "
|
||||
"sc7280 platform\n", id);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
uint32_t ram_code(void)
|
||||
{
|
||||
static uint32_t id = UNDEFINED_STRAPPING_ID;
|
||||
id = gpio_base3_value(pins, ARRAY_SIZE(pins));
|
||||
|
||||
return id;
|
||||
}
|
||||
|
@ -44,6 +34,14 @@ uint32_t sku_id(void)
|
|||
{
|
||||
static uint32_t id = UNDEFINED_STRAPPING_ID;
|
||||
|
||||
/*
|
||||
* This means that we already retrieved the sku id from the EC once
|
||||
* during this boot, so no need to do it again as we'll get the same
|
||||
* value again.
|
||||
*/
|
||||
if (id != UNDEFINED_STRAPPING_ID)
|
||||
return id;
|
||||
|
||||
/* Update modem status in 9th bit of sku id */
|
||||
uint32_t mask = 1 << 9;
|
||||
id = google_chromeec_get_board_sku();
|
||||
|
|
Loading…
Reference in New Issue