From b091b33c2a4695fdc422126128da05d3d5c9fb77 Mon Sep 17 00:00:00 2001 From: Sheng-Liang Pan Date: Wed, 11 Dec 2019 08:35:04 +0800 Subject: mb/google/octopus/variants/bobba: fix LTE power sequence and move get_board_sku to smm stage. fix Power_off section power sequence. power_off_lte_module() should run in smm stage, add variant.c in smm stage. also move get_board_sku() to mainboard_misc.c so that we can use it in smm stage and ramstage. BUG=b:144327240 BRANCH=octopus TEST=build image and verify on the DUT with LTE DB. Change-Id: I287ba1cb092a95b3a9dd1f960a3b84fd85b9b221 Signed-off-by: Pan Sheng-Liang Reviewed-on: https://review.coreboot.org/c/coreboot/+/37649 Reviewed-by: Marco Chen Reviewed-by: Ren Kuo Tested-by: build bot (Jenkins) --- src/mainboard/google/octopus/Makefile.inc | 2 + src/mainboard/google/octopus/mainboard.c | 32 ------------- src/mainboard/google/octopus/mainboard_misc.c | 54 ++++++++++++++++++++++ .../google/octopus/variants/bobba/Makefile.inc | 2 + 4 files changed, 58 insertions(+), 32 deletions(-) create mode 100644 src/mainboard/google/octopus/mainboard_misc.c (limited to 'src/mainboard/google/octopus') diff --git a/src/mainboard/google/octopus/Makefile.inc b/src/mainboard/google/octopus/Makefile.inc index aa055246d2..d36d5f7dbe 100644 --- a/src/mainboard/google/octopus/Makefile.inc +++ b/src/mainboard/google/octopus/Makefile.inc @@ -5,10 +5,12 @@ romstage-$(CONFIG_CHROMEOS) += chromeos.c ramstage-$(CONFIG_CHROMEOS) += chromeos.c ramstage-y += ec.c +ramstage-y += mainboard_misc.c ramstage-y += mainboard.c verstage-$(CONFIG_CHROMEOS) += chromeos.c smm-y += smihandler.c +smm-y += mainboard_misc.c subdirs-y += variants/baseboard CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/include diff --git a/src/mainboard/google/octopus/mainboard.c b/src/mainboard/google/octopus/mainboard.c index 3312d4d988..0ab4693bfc 100644 --- a/src/mainboard/google/octopus/mainboard.c +++ b/src/mainboard/google/octopus/mainboard.c @@ -117,38 +117,6 @@ struct chip_operations mainboard_ops = { .enable_dev = mainboard_enable, }; -#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; -} - void __weak variant_update_devtree(struct device *dev) { /* Place holder for common updates. */ diff --git a/src/mainboard/google/octopus/mainboard_misc.c b/src/mainboard/google/octopus/mainboard_misc.c new file mode 100644 index 0000000000..3672f66692 --- /dev/null +++ b/src/mainboard/google/octopus/mainboard_misc.c @@ -0,0 +1,54 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2019 Intel Corp. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include + +#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; +} diff --git a/src/mainboard/google/octopus/variants/bobba/Makefile.inc b/src/mainboard/google/octopus/variants/bobba/Makefile.inc index ba865e9f82..7ee7e70d4b 100644 --- a/src/mainboard/google/octopus/variants/bobba/Makefile.inc +++ b/src/mainboard/google/octopus/variants/bobba/Makefile.inc @@ -2,3 +2,5 @@ bootblock-y += gpio.c ramstage-y += gpio.c ramstage-y += variant.c + +smm-y += variant.c -- cgit v1.2.3