mb/google/rex: Enable building for Chrome OS

Enable building for Chrome OS and add associated ACPI configuration.

BUG=b:224325352
TEST=util/abuild/abuild -p none -t google/rex -a -c max

Signed-off-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Change-Id: I75cb2d30d699166a056ed9d3c0779816b733b0d2
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64621
Reviewed-by: Tarun Tuli <taruntuli@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Eric Lai 2022-05-24 09:25:57 +08:00 committed by Subrata Banik
parent 7c304f8d34
commit 366fba27a8
7 changed files with 61 additions and 0 deletions

View File

@ -9,6 +9,7 @@ config BOARD_GOOGLE_BASEBOARD_REX
select BOARD_GOOGLE_REX_COMMON
select EC_GOOGLE_CHROMEEC
select EC_GOOGLE_CHROMEEC_ESPI
select MAINBOARD_HAS_CHROMEOS
select SOC_INTEL_METEORLAKE
select SYSTEM_TYPE_LAPTOP
@ -22,6 +23,7 @@ config BASEBOARD_DIR
default "rex" if BOARD_GOOGLE_BASEBOARD_REX
config CHROMEOS
select EC_GOOGLE_CHROMEEC_SWITCHES
select GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC
select VBOOT_LID_SWITCH

View File

@ -1,8 +1,12 @@
bootblock-y += bootblock.c
verstage-$(CONFIG_CHROMEOS) += chromeos.c
romstage-y += romstage.c
romstage-$(CONFIG_CHROMEOS) += chromeos.c
ramstage-y += mainboard.c
ramstage-$(CONFIG_CHROMEOS) += chromeos.c
ramstage-y += ec.c
VARIANT_DIR:=$(call strip_quotes,$(CONFIG_VARIANT_DIR))

View File

@ -0,0 +1,29 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <baseboard/gpio.h>
#include <bootmode.h>
#include <boot/coreboot_tables.h>
#include <gpio.h>
#include <types.h>
void fill_lb_gpios(struct lb_gpios *gpios)
{
struct lb_gpio chromeos_gpios[] = {
{-1, ACTIVE_HIGH, get_lid_switch(), "lid"},
{-1, ACTIVE_HIGH, 0, "power"},
{-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"},
{GPIO_EC_IN_RW, ACTIVE_HIGH, gpio_get(GPIO_EC_IN_RW), "EC in RW"},
};
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
}
int get_write_protect_state(void)
{
return gpio_get(GPIO_PCH_WP);
}
int get_ec_is_trusted(void)
{
/* EC is trusted if not in RW. */
return !gpio_get(GPIO_EC_IN_RW);
}

View File

@ -1,8 +1,10 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <acpi/acpi.h>
#include <baseboard/variants.h>
#include <device/device.h>
#include <ec/ec.h>
#include <vendorcode/google/chromeos/chromeos.h>
static void mainboard_init(void *chip_info)
{
@ -11,6 +13,17 @@ static void mainboard_init(void *chip_info)
pads = variant_gpio_table(&num);
gpio_configure_pads(pads, num);
}
static void mainboard_fill_ssdt(const struct device *dev)
{
/* TODO: Add mainboard-specific SSDT entries */
}
static void mainboard_smbios_strings(struct device *dev, struct smbios_type11 *t)
{
/* TODO: Add mainboard-smbios entries */
}
static void mainboard_dev_init(struct device *dev)
{
mainboard_ec_init();
@ -19,6 +32,8 @@ static void mainboard_dev_init(struct device *dev)
static void mainboard_enable(struct device *dev)
{
dev->ops->init = mainboard_dev_init;
dev->ops->get_smbios_strings = mainboard_smbios_strings;
dev->ops->acpi_fill_ssdt = mainboard_fill_ssdt;
}
struct chip_operations mainboard_ops = {

View File

@ -5,6 +5,7 @@
#include <soc/gpio.h>
#include <stdint.h>
#include <vendorcode/google/chromeos/chromeos.h>
/* The next set of functions return the gpio table and fill in the number of entries for
* each table.

View File

@ -32,3 +32,8 @@ const struct pad_config *__weak variant_romstage_gpio_table(size_t *num)
*num = 0;
return NULL;
}
static const struct cros_gpio cros_gpios[] = {
};
DECLARE_WEAK_CROS_GPIOS(cros_gpios);

View File

@ -6,6 +6,11 @@
#include <soc/gpe.h>
#include <soc/gpio.h>
/* Fixme: Update proper GPIO number based on schematics */
/* WP signal to PCH */
#define GPIO_PCH_WP 0
/* EC in RW or RO */
#define GPIO_EC_IN_RW 0
/* GPIO IRQ for tight timestamps / wake support */
#define EC_SYNC_IRQ 0
/* eSPI virtual wire reporting */