storm: make sure board ID is calculated only once
Figuring out board_id on storm requires reading tertiary gpios, which takes time. Let's calculate it once and reuse it when necessary. BUG=none TEST=verified board ID reported as 0 and 1 on proto0 and proto0.2 respectively. Change-Id: I69f6afa3de8a175a1d723e95902efd15607e68b7 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 080c839c1c0c1b5e389b2382144ef67535bb4ff1 Original-Change-Id: I4e237077d1d9a96daebba462cd00f3f40be14518 Original-Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/217086 Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Original-Reviewed-by: David Hendricks <dhendrix@chromium.org> Reviewed-on: http://review.coreboot.org/9119 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
parent
1de971dd32
commit
2786ce0b48
|
@ -37,7 +37,9 @@
|
|||
* revision.
|
||||
*/
|
||||
|
||||
uint8_t board_id(void)
|
||||
static int board_id_value = -1;
|
||||
|
||||
static uint8_t get_board_id(void)
|
||||
{
|
||||
uint8_t bid;
|
||||
gpio_t hw_rev_gpios[] = {29, 30, 68};
|
||||
|
@ -50,3 +52,11 @@ uint8_t board_id(void)
|
|||
|
||||
return bid;
|
||||
}
|
||||
|
||||
uint8_t board_id(void)
|
||||
{
|
||||
if (board_id_value < 0)
|
||||
board_id_value = get_board_id();
|
||||
|
||||
return board_id_value;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue