diff options
author | Shelley Chen <shchen@google.com> | 2022-11-29 11:14:34 -0800 |
---|---|---|
committer | Shelley Chen <shchen@google.com> | 2022-11-30 21:53:28 +0000 |
commit | 474da028ab436c9668d2c9a5142c5f1ab9460044 (patch) | |
tree | 97b53da06173d922c02b688d3605002bc2fcce4d /src | |
parent | 98d0574746c102f63ef5f69e446482d872ee11de (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/mainboard/google/herobrine/boardid.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/mainboard/google/herobrine/boardid.c b/src/mainboard/google/herobrine/boardid.c index fc058e2b1a..1f0c88fcb8 100644 --- a/src/mainboard/google/herobrine/boardid.c +++ b/src/mainboard/google/herobrine/boardid.c @@ -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(); |