Shelley Chen has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/70162 )
Change subject: mb/google/herobrine: Only retrieve sku_id from EC once ......................................................................
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 --- M src/mainboard/google/herobrine/boardid.c 1 file changed, 31 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/62/70162/1
diff --git a/src/mainboard/google/herobrine/boardid.c b/src/mainboard/google/herobrine/boardid.c index fc058e2..3169f97 100644 --- a/src/mainboard/google/herobrine/boardid.c +++ b/src/mainboard/google/herobrine/boardid.c @@ -33,17 +33,18 @@ return id; }
-uint32_t ram_code(void) -{ - static uint32_t id = UNDEFINED_STRAPPING_ID; - - return id; -} - 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();