Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/39019 )
Change subject: mainboard/google/hatch: Migrate hatch onto SKU ID helpers ......................................................................
mainboard/google/hatch: Migrate hatch onto SKU ID helpers
Change-Id: I96e10010fd375b127f1e10387d6f7a839bc35fdd Signed-off-by: Edward O'Callaghan quasisec@google.com --- M src/mainboard/google/hatch/Kconfig M src/mainboard/google/hatch/mainboard.c M src/mainboard/google/hatch/variants/akemi/gpio.c M src/mainboard/google/hatch/variants/akemi/variant.c M src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h M src/mainboard/google/hatch/variants/dratini/variant.c M src/mainboard/google/hatch/variants/kindred/gpio.c M src/mainboard/google/hatch/variants/kindred/variant.c 8 files changed, 10 insertions(+), 36 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/19/39019/1
diff --git a/src/mainboard/google/hatch/Kconfig b/src/mainboard/google/hatch/Kconfig index 783ec73..4d79066 100644 --- a/src/mainboard/google/hatch/Kconfig +++ b/src/mainboard/google/hatch/Kconfig @@ -130,4 +130,8 @@ select VBOOT_EARLY_EC_SYNC select VBOOT_LID_SWITCH
+config EC_GOOGLE_CHROMEEC_SKU_ID_MAX + int + default 0xff # LEGACY SKU_ID space. + endif # BOARD_GOOGLE_BASEBOARD_HATCH diff --git a/src/mainboard/google/hatch/mainboard.c b/src/mainboard/google/hatch/mainboard.c index 5761b08..888acf7 100644 --- a/src/mainboard/google/hatch/mainboard.c +++ b/src/mainboard/google/hatch/mainboard.c @@ -21,36 +21,9 @@ #include <string.h> #include <stdint.h>
-#define SKU_UNKNOWN 0xFFFFFFFF -#define SKU_MAX 255 - -uint32_t get_board_sku(void) -{ - static uint32_t sku_id = SKU_UNKNOWN; - - if (sku_id != SKU_UNKNOWN) - return sku_id; - - if (google_chromeec_cbi_get_sku_id(&sku_id)) - sku_id = SKU_UNKNOWN; - - return sku_id; -} - const char *smbios_system_sku(void) { - static char sku_str[7]; /* sku{0..255} */ - uint32_t sku_id = get_board_sku(); - - if ((sku_id == SKU_UNKNOWN) || (sku_id > SKU_MAX)) { - printk(BIOS_ERR, "%s: Unexpected SKU ID %u\n", - __func__, sku_id); - return ""; - } - - snprintf(sku_str, sizeof(sku_str), "sku%u", sku_id); - - return sku_str; + return google_chromeec_smbios_system_sku(); }
const char *smbios_mainboard_manufacturer(void) diff --git a/src/mainboard/google/hatch/variants/akemi/gpio.c b/src/mainboard/google/hatch/variants/akemi/gpio.c index cfc185e..5df011a 100644 --- a/src/mainboard/google/hatch/variants/akemi/gpio.c +++ b/src/mainboard/google/hatch/variants/akemi/gpio.c @@ -136,7 +136,7 @@
const struct pad_config *override_gpio_table(size_t *num) { - uint32_t sku_id = get_board_sku(); + uint32_t sku_id = google_chromeec_get_board_sku(); /* For SSD SKU */ if ((sku_id == 2) || (sku_id == 4)) { *num = ARRAY_SIZE(ssd_sku_gpio_table); diff --git a/src/mainboard/google/hatch/variants/akemi/variant.c b/src/mainboard/google/hatch/variants/akemi/variant.c index 8440b5c..2965659 100644 --- a/src/mainboard/google/hatch/variants/akemi/variant.c +++ b/src/mainboard/google/hatch/variants/akemi/variant.c @@ -28,7 +28,7 @@ ssd_host = pcidev_path_on_root(PCH_DEVFN_SATA);
/* SKU ID 2 and 4 do not have eMMC, hence disable it. */ - sku_id = get_board_sku(); + sku_id = google_chromeec_get_board_sku(); if ((sku_id == 2) || (sku_id == 4)) { if (emmc_host == NULL) return; diff --git a/src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h index 9d1b91e..c780b97 100644 --- a/src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h @@ -44,9 +44,6 @@ /* Return ChromeOS gpio table and fill in number of entries. */ const struct cros_gpio *variant_cros_gpios(size_t *num);
-/* Return board SKU */ -uint32_t get_board_sku(void); - /* Modify devictree settings during ramstage. */ void variant_devtree_update(void);
diff --git a/src/mainboard/google/hatch/variants/dratini/variant.c b/src/mainboard/google/hatch/variants/dratini/variant.c index 3a51a55..8689113 100644 --- a/src/mainboard/google/hatch/variants/dratini/variant.c +++ b/src/mainboard/google/hatch/variants/dratini/variant.c @@ -20,7 +20,7 @@ const char *get_wifi_sar_cbfs_filename(void) { const char *filename = NULL; - uint32_t sku_id = get_board_sku(); + uint32_t sku_id = google_chromeec_get_board_sku();
switch (sku_id) { case SKU_21_DRAGONAIR: diff --git a/src/mainboard/google/hatch/variants/kindred/gpio.c b/src/mainboard/google/hatch/variants/kindred/gpio.c index fbb47f9..37789e9 100644 --- a/src/mainboard/google/hatch/variants/kindred/gpio.c +++ b/src/mainboard/google/hatch/variants/kindred/gpio.c @@ -191,7 +191,7 @@
const struct pad_config *override_gpio_table(size_t *num) { - uint32_t sku_id = get_board_sku(); + uint32_t sku_id = google_chromeec_get_board_sku(); /* For SSD SKU */ if (sku_id == 1 || sku_id == 3 || sku_id == 23 || sku_id == 24) { *num = ARRAY_SIZE(ssd_sku_gpio_table); diff --git a/src/mainboard/google/hatch/variants/kindred/variant.c b/src/mainboard/google/hatch/variants/kindred/variant.c index 1e1d083..f264868 100644 --- a/src/mainboard/google/hatch/variants/kindred/variant.c +++ b/src/mainboard/google/hatch/variants/kindred/variant.c @@ -28,7 +28,7 @@ ssd_host = pcidev_path_on_root(PCH_DEVFN_SATA);
/* SKU ID 1/3/23/24 doesn't have a eMMC device, hence disable it. */ - sku_id = get_board_sku(); + sku_id = google_chromeec_get_board_sku(); if (sku_id == 1 || sku_id == 3 || sku_id == 23 || sku_id == 24) { if (emmc_host == NULL) return;
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/39019 )
Change subject: mainboard/google/hatch: Migrate hatch onto SKU ID helpers ......................................................................
Patch Set 2:
NOT
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/39019 )
Change subject: mainboard/google/hatch: Migrate onto SKU ID helpers ......................................................................
Patch Set 6:
This change is ready for review.
Hello Aaron Durbin, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/39019
to look at the new patch set (#7).
Change subject: mainboard/google/hatch: Migrate onto SKU ID helpers ......................................................................
mainboard/google/hatch: Migrate onto SKU ID helpers
Leverage the common sku id space helper encoders and set the sku id max to 0xff for legacy to ensure we behave the same.
BUG=b:149348474 BRANCH=none TEST=tested on hatch
Change-Id: I96e10010fd375b127f1e10387d6f7a839bc35fdd Signed-off-by: Edward O'Callaghan quasisec@google.com --- M src/mainboard/google/hatch/Kconfig M src/mainboard/google/hatch/mainboard.c M src/mainboard/google/hatch/variants/akemi/gpio.c M src/mainboard/google/hatch/variants/akemi/variant.c M src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h M src/mainboard/google/hatch/variants/dratini/variant.c M src/mainboard/google/hatch/variants/kindred/gpio.c M src/mainboard/google/hatch/variants/kindred/variant.c 8 files changed, 14 insertions(+), 36 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/19/39019/7
Hello Aaron Durbin, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/39019
to look at the new patch set (#9).
Change subject: mainboard/google/hatch: Migrate onto SKU ID helpers ......................................................................
mainboard/google/hatch: Migrate onto SKU ID helpers
Leverage the common sku id space helper encoders and set the sku id max to 0xff for legacy to ensure we behave the same.
BUG=b:149348474 BRANCH=none TEST=tested on hatch
Change-Id: I96e10010fd375b127f1e10387d6f7a839bc35fdd Signed-off-by: Edward O'Callaghan quasisec@google.com --- M src/mainboard/google/hatch/Kconfig M src/mainboard/google/hatch/mainboard.c M src/mainboard/google/hatch/variants/akemi/gpio.c M src/mainboard/google/hatch/variants/akemi/variant.c M src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h M src/mainboard/google/hatch/variants/dratini/variant.c M src/mainboard/google/hatch/variants/kindred/gpio.c M src/mainboard/google/hatch/variants/kindred/variant.c 8 files changed, 10 insertions(+), 36 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/19/39019/9
Hello Aaron Durbin, build bot (Jenkins), Furquan Shaikh,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/39019
to look at the new patch set (#14).
Change subject: mainboard/google/hatch: Migrate onto SKU ID helpers ......................................................................
mainboard/google/hatch: Migrate onto SKU ID helpers
Leverage the common sku id space helper encoders.
BUG=b:149348474 BRANCH=none TEST=tested on hatch
Change-Id: I96e10010fd375b127f1e10387d6f7a839bc35fdd Signed-off-by: Edward O'Callaghan quasisec@google.com --- M src/mainboard/google/hatch/Kconfig M src/mainboard/google/hatch/mainboard.c M src/mainboard/google/hatch/variants/akemi/gpio.c M src/mainboard/google/hatch/variants/akemi/variant.c M src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h M src/mainboard/google/hatch/variants/dratini/variant.c M src/mainboard/google/hatch/variants/kindred/gpio.c M src/mainboard/google/hatch/variants/kindred/variant.c 8 files changed, 10 insertions(+), 36 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/19/39019/14
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/39019 )
Change subject: mainboard/google/hatch: Migrate onto SKU ID helpers ......................................................................
Patch Set 14: Code-Review+2
Edward O'Callaghan has submitted this change. ( https://review.coreboot.org/c/coreboot/+/39019 )
Change subject: mainboard/google/hatch: Migrate onto SKU ID helpers ......................................................................
mainboard/google/hatch: Migrate onto SKU ID helpers
Leverage the common sku id space helper encoders.
BUG=b:149348474 BRANCH=none TEST=tested on hatch
Change-Id: I96e10010fd375b127f1e10387d6f7a839bc35fdd Signed-off-by: Edward O'Callaghan quasisec@google.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/39019 Reviewed-by: Furquan Shaikh furquan@google.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/mainboard/google/hatch/Kconfig M src/mainboard/google/hatch/mainboard.c M src/mainboard/google/hatch/variants/akemi/gpio.c M src/mainboard/google/hatch/variants/akemi/variant.c M src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h M src/mainboard/google/hatch/variants/dratini/variant.c M src/mainboard/google/hatch/variants/kindred/gpio.c M src/mainboard/google/hatch/variants/kindred/variant.c 8 files changed, 10 insertions(+), 36 deletions(-)
Approvals: build bot (Jenkins): Verified Furquan Shaikh: Looks good to me, approved
diff --git a/src/mainboard/google/hatch/Kconfig b/src/mainboard/google/hatch/Kconfig index 783ec73..92d94db 100644 --- a/src/mainboard/google/hatch/Kconfig +++ b/src/mainboard/google/hatch/Kconfig @@ -11,6 +11,7 @@ select DRIVERS_USB_ACPI select EC_GOOGLE_CHROMEEC select EC_GOOGLE_CHROMEEC_BOARDID + select EC_GOOGLE_CHROMEEC_SKUID select EC_GOOGLE_CHROMEEC_ESPI select GOOGLE_SMBIOS_MAINBOARD_VERSION select HAVE_ACPI_RESUME diff --git a/src/mainboard/google/hatch/mainboard.c b/src/mainboard/google/hatch/mainboard.c index 5761b08..888acf7 100644 --- a/src/mainboard/google/hatch/mainboard.c +++ b/src/mainboard/google/hatch/mainboard.c @@ -21,36 +21,9 @@ #include <string.h> #include <stdint.h>
-#define SKU_UNKNOWN 0xFFFFFFFF -#define SKU_MAX 255 - -uint32_t get_board_sku(void) -{ - static uint32_t sku_id = SKU_UNKNOWN; - - if (sku_id != SKU_UNKNOWN) - return sku_id; - - if (google_chromeec_cbi_get_sku_id(&sku_id)) - sku_id = SKU_UNKNOWN; - - return sku_id; -} - const char *smbios_system_sku(void) { - static char sku_str[7]; /* sku{0..255} */ - uint32_t sku_id = get_board_sku(); - - if ((sku_id == SKU_UNKNOWN) || (sku_id > SKU_MAX)) { - printk(BIOS_ERR, "%s: Unexpected SKU ID %u\n", - __func__, sku_id); - return ""; - } - - snprintf(sku_str, sizeof(sku_str), "sku%u", sku_id); - - return sku_str; + return google_chromeec_smbios_system_sku(); }
const char *smbios_mainboard_manufacturer(void) diff --git a/src/mainboard/google/hatch/variants/akemi/gpio.c b/src/mainboard/google/hatch/variants/akemi/gpio.c index cfc185e..b141f02 100644 --- a/src/mainboard/google/hatch/variants/akemi/gpio.c +++ b/src/mainboard/google/hatch/variants/akemi/gpio.c @@ -17,6 +17,7 @@ #include <baseboard/gpio.h> #include <baseboard/variants.h> #include <commonlib/helpers.h> +#include <ec/google/chromeec/ec.h>
static const struct pad_config ssd_sku_gpio_table[] = { /* A18 : NC */ @@ -136,7 +137,7 @@
const struct pad_config *override_gpio_table(size_t *num) { - uint32_t sku_id = get_board_sku(); + uint32_t sku_id = google_chromeec_get_board_sku(); /* For SSD SKU */ if ((sku_id == 2) || (sku_id == 4)) { *num = ARRAY_SIZE(ssd_sku_gpio_table); diff --git a/src/mainboard/google/hatch/variants/akemi/variant.c b/src/mainboard/google/hatch/variants/akemi/variant.c index 8440b5c..2965659 100644 --- a/src/mainboard/google/hatch/variants/akemi/variant.c +++ b/src/mainboard/google/hatch/variants/akemi/variant.c @@ -28,7 +28,7 @@ ssd_host = pcidev_path_on_root(PCH_DEVFN_SATA);
/* SKU ID 2 and 4 do not have eMMC, hence disable it. */ - sku_id = get_board_sku(); + sku_id = google_chromeec_get_board_sku(); if ((sku_id == 2) || (sku_id == 4)) { if (emmc_host == NULL) return; diff --git a/src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h index 9d1b91e..c780b97 100644 --- a/src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h @@ -44,9 +44,6 @@ /* Return ChromeOS gpio table and fill in number of entries. */ const struct cros_gpio *variant_cros_gpios(size_t *num);
-/* Return board SKU */ -uint32_t get_board_sku(void); - /* Modify devictree settings during ramstage. */ void variant_devtree_update(void);
diff --git a/src/mainboard/google/hatch/variants/dratini/variant.c b/src/mainboard/google/hatch/variants/dratini/variant.c index 3a51a55..bda30df 100644 --- a/src/mainboard/google/hatch/variants/dratini/variant.c +++ b/src/mainboard/google/hatch/variants/dratini/variant.c @@ -16,11 +16,12 @@ #include <baseboard/variants.h> #include <variant/sku.h> #include <sar.h> +#include <ec/google/chromeec/ec.h>
const char *get_wifi_sar_cbfs_filename(void) { const char *filename = NULL; - uint32_t sku_id = get_board_sku(); + uint32_t sku_id = google_chromeec_get_board_sku();
switch (sku_id) { case SKU_21_DRAGONAIR: diff --git a/src/mainboard/google/hatch/variants/kindred/gpio.c b/src/mainboard/google/hatch/variants/kindred/gpio.c index fbb47f9..f53b91b 100644 --- a/src/mainboard/google/hatch/variants/kindred/gpio.c +++ b/src/mainboard/google/hatch/variants/kindred/gpio.c @@ -17,6 +17,7 @@ #include <baseboard/gpio.h> #include <baseboard/variants.h> #include <commonlib/helpers.h> +#include <ec/google/chromeec/ec.h>
static const struct pad_config ssd_sku_gpio_table[] = { /* A0 : SAR0_INT_ODL */ @@ -191,7 +192,7 @@
const struct pad_config *override_gpio_table(size_t *num) { - uint32_t sku_id = get_board_sku(); + uint32_t sku_id = google_chromeec_get_board_sku(); /* For SSD SKU */ if (sku_id == 1 || sku_id == 3 || sku_id == 23 || sku_id == 24) { *num = ARRAY_SIZE(ssd_sku_gpio_table); diff --git a/src/mainboard/google/hatch/variants/kindred/variant.c b/src/mainboard/google/hatch/variants/kindred/variant.c index 1e1d083..f264868 100644 --- a/src/mainboard/google/hatch/variants/kindred/variant.c +++ b/src/mainboard/google/hatch/variants/kindred/variant.c @@ -28,7 +28,7 @@ ssd_host = pcidev_path_on_root(PCH_DEVFN_SATA);
/* SKU ID 1/3/23/24 doesn't have a eMMC device, hence disable it. */ - sku_id = get_board_sku(); + sku_id = google_chromeec_get_board_sku(); if (sku_id == 1 || sku_id == 3 || sku_id == 23 || sku_id == 24) { if (emmc_host == NULL) return;
9elements QA has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/39019 )
Change subject: mainboard/google/hatch: Migrate onto SKU ID helpers ......................................................................
Patch Set 15:
Automatic boot test returned (PASS/FAIL/TOTAL): 3/0/3 Emulation targets: EMULATION_QEMU_X86_Q35 using payload TianoCore : SUCCESS : https://lava.9esec.io/r/929 EMULATION_QEMU_X86_Q35 using payload SeaBIOS : SUCCESS : https://lava.9esec.io/r/928 EMULATION_QEMU_X86_I440FX using payload SeaBIOS : SUCCESS : https://lava.9esec.io/r/927
Please note: This test is under development and might not be accurate at all!