Wonkyu Kim has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/87247?usp=email )
Change subject: src/ec/intel: read board id one time from EC per stage ......................................................................
src/ec/intel: read board id one time from EC per stage
Using static variables to store the board ID optimizes boot time by reading the ID once per stage and retaining it for subsequent use. This approach reduces redundant hardware access, ensuring efficient and consistent retrieval of the board ID throughout the boot process. Static variables help streamline operations, minimize overhead, and improve performance by maintaining the board ID in a fixed memory location, enhancing the efficiency of each boot stage.
Signed-off-by: Wonkyu Kim wonkyu.kim@intel.com Change-Id: I166ca1abdf7838f91319d0bcf11354055ed93eef --- M src/ec/intel/board_id.c 1 file changed, 15 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/47/87247/1
diff --git a/src/ec/intel/board_id.c b/src/ec/intel/board_id.c index 72d74c5..4455e63 100644 --- a/src/ec/intel/board_id.c +++ b/src/ec/intel/board_id.c @@ -2,6 +2,7 @@
#include <boardid.h> #include "board_id.h" +#include <console/console.h> #include <ec/acpi/ec.h> #include <ec/google/chromeec/ec.h> #include <types.h> @@ -21,13 +22,20 @@ { static int id = BOARD_ID_UNKNOWN;
- if (CONFIG(EC_GOOGLE_CHROMEEC)) { /* CHROME_EC */ - id = get_board_id_via_ext_ec(); - } else { /* WINDOWS_EC */ - if (send_ec_command(EC_FAB_ID_CMD) == 0) { - id = recv_ec_data() << 8; - id |= recv_ec_data(); + /* Read board id one time per stage */ + if (id == BOARD_ID_UNKNOWN) { + if (CONFIG(EC_GOOGLE_CHROMEEC)) { /* CHROME_EC */ + id = get_board_id_via_ext_ec(); + printk(BIOS_INFO, "[ChromeEC] "); + } else { /* WINDOWS_EC */ + if (send_ec_command(EC_FAB_ID_CMD) == 0) { + id = recv_ec_data() << 8; + id |= recv_ec_data(); + printk(BIOS_INFO, "[WinEC] "); + } } + id &= BOARD_ID_MASK; + printk(BIOS_INFO, "board id: 0x%x\n", id); } - return (id & BOARD_ID_MASK); + return id; }