From 76c392d29481129ed425df62739666b94a3438d0 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Thu, 13 Apr 2017 14:15:56 -0700 Subject: [PATCH] mainboard/google/poppy: Provide baseboard and variant concepts In order to be able to share code across different poppy variants, provide the concept of baseboard and variants. New directory layout: variants/baseboard - code variants/baseboard/include/baseboard - headers variants/poppy - code variants/poppy/include/variant - headers New boards would then add themselves under their board name within "variants" directory. This is purely an organizational change. BUG=b:37375693 Change-Id: If6c1c5f479cfffe768abf27495d379744104e2dc Signed-off-by: Furquan Shaikh Reviewed-on: https://review.coreboot.org/19322 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/mainboard/google/poppy/Kconfig | 8 +++++++ src/mainboard/google/poppy/Makefile.inc | 6 ++++++ src/mainboard/google/poppy/bootblock.c | 2 +- src/mainboard/google/poppy/chromeos.c | 2 +- src/mainboard/google/poppy/dsdt.asl | 6 +++--- src/mainboard/google/poppy/ec.c | 2 +- src/mainboard/google/poppy/ramstage.c | 2 +- src/mainboard/google/poppy/smihandler.c | 2 +- src/mainboard/google/poppy/spd/spd.c | 2 +- .../{ => variants/baseboard}/devicetree.cb | 0 .../include/baseboard}/acpi/dptf.asl | 0 .../baseboard/include/baseboard}/ec.h | 6 +++--- .../baseboard/include/baseboard}/gpio.h | 8 +++---- .../poppy/include/variant/acpi/dptf.asl | 16 ++++++++++++++ .../poppy/variants/poppy/include/variant/ec.h | 21 +++++++++++++++++++ .../variants/poppy/include/variant/gpio.h | 21 +++++++++++++++++++ 16 files changed, 88 insertions(+), 16 deletions(-) rename src/mainboard/google/poppy/{ => variants/baseboard}/devicetree.cb (100%) rename src/mainboard/google/poppy/{ => variants/baseboard/include/baseboard}/acpi/dptf.asl (100%) rename src/mainboard/google/poppy/{ => variants/baseboard/include/baseboard}/ec.h (96%) rename src/mainboard/google/poppy/{ => variants/baseboard/include/baseboard}/gpio.h (99%) create mode 100644 src/mainboard/google/poppy/variants/poppy/include/variant/acpi/dptf.asl create mode 100644 src/mainboard/google/poppy/variants/poppy/include/variant/ec.h create mode 100644 src/mainboard/google/poppy/variants/poppy/include/variant/gpio.h diff --git a/src/mainboard/google/poppy/Kconfig b/src/mainboard/google/poppy/Kconfig index e97df9b5ac..1bdda14907 100644 --- a/src/mainboard/google/poppy/Kconfig +++ b/src/mainboard/google/poppy/Kconfig @@ -18,6 +18,10 @@ config BOARD_GOOGLE_BASEBOARD_POPPY if BOARD_GOOGLE_BASEBOARD_POPPY +config DEVICETREE + string + default "variants/baseboard/devicetree.cb" + config DRIVER_TPM_SPI_BUS default 0x1 @@ -59,6 +63,10 @@ config POPPY_USE_SPI_TPM select SPI_TPM select TPM2 +config VARIANT_DIR + string + default "poppy" if BOARD_GOOGLE_POPPY + config VBOOT select EC_GOOGLE_CHROMEEC_SWITCHES select VBOOT_LID_SWITCH diff --git a/src/mainboard/google/poppy/Makefile.inc b/src/mainboard/google/poppy/Makefile.inc index 64a948c059..b151b0c140 100644 --- a/src/mainboard/google/poppy/Makefile.inc +++ b/src/mainboard/google/poppy/Makefile.inc @@ -30,3 +30,9 @@ ramstage-y += mainboard.c ramstage-y += ramstage.c smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c + +subdirs-y += variants/baseboard +CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/include + +subdirs-y += variants/$(VARIANT_DIR) +CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/include diff --git a/src/mainboard/google/poppy/bootblock.c b/src/mainboard/google/poppy/bootblock.c index 2fdbe40671..7057916c68 100644 --- a/src/mainboard/google/poppy/bootblock.c +++ b/src/mainboard/google/poppy/bootblock.c @@ -16,7 +16,7 @@ #include #include -#include "gpio.h" +#include static void early_config_gpio(void) { diff --git a/src/mainboard/google/poppy/chromeos.c b/src/mainboard/google/poppy/chromeos.c index b7877aadf3..250effd4a1 100644 --- a/src/mainboard/google/poppy/chromeos.c +++ b/src/mainboard/google/poppy/chromeos.c @@ -21,7 +21,7 @@ #include #include -#include "gpio.h" +#include #if ENV_RAMSTAGE #include diff --git a/src/mainboard/google/poppy/dsdt.asl b/src/mainboard/google/poppy/dsdt.asl index f92f8a9f25..55ca5d9662 100644 --- a/src/mainboard/google/poppy/dsdt.asl +++ b/src/mainboard/google/poppy/dsdt.asl @@ -13,8 +13,8 @@ * GNU General Public License for more details. */ -#include "ec.h" -#include "gpio.h" +#include +#include DefinitionBlock( "dsdt.aml", @@ -67,6 +67,6 @@ DefinitionBlock( Scope (\_SB) { /* Dynamic Platform Thermal Framework */ - #include "acpi/dptf.asl" + #include } } diff --git a/src/mainboard/google/poppy/ec.c b/src/mainboard/google/poppy/ec.c index ad60e49b80..f0559ca6f7 100644 --- a/src/mainboard/google/poppy/ec.c +++ b/src/mainboard/google/poppy/ec.c @@ -16,7 +16,7 @@ #include #include -#include "ec.h" +#include void mainboard_ec_init(void) { diff --git a/src/mainboard/google/poppy/ramstage.c b/src/mainboard/google/poppy/ramstage.c index 821dcca46b..b2c0ed7df1 100644 --- a/src/mainboard/google/poppy/ramstage.c +++ b/src/mainboard/google/poppy/ramstage.c @@ -15,7 +15,7 @@ #include -#include "gpio.h" +#include void mainboard_silicon_init_params(FSP_SIL_UPD *params) { diff --git a/src/mainboard/google/poppy/smihandler.c b/src/mainboard/google/poppy/smihandler.c index a17ae671ce..88aa90581b 100644 --- a/src/mainboard/google/poppy/smihandler.c +++ b/src/mainboard/google/poppy/smihandler.c @@ -17,7 +17,7 @@ #include #include -#include "ec.h" +#include void mainboard_smi_espi_handler(void) { diff --git a/src/mainboard/google/poppy/spd/spd.c b/src/mainboard/google/poppy/spd/spd.c index 9b9967916d..fa0012a908 100644 --- a/src/mainboard/google/poppy/spd/spd.c +++ b/src/mainboard/google/poppy/spd/spd.c @@ -23,7 +23,7 @@ #include #include -#include "../gpio.h" +#include #include "spd.h" static void mainboard_print_spd_info(uint8_t spd[]) diff --git a/src/mainboard/google/poppy/devicetree.cb b/src/mainboard/google/poppy/variants/baseboard/devicetree.cb similarity index 100% rename from src/mainboard/google/poppy/devicetree.cb rename to src/mainboard/google/poppy/variants/baseboard/devicetree.cb diff --git a/src/mainboard/google/poppy/acpi/dptf.asl b/src/mainboard/google/poppy/variants/baseboard/include/baseboard/acpi/dptf.asl similarity index 100% rename from src/mainboard/google/poppy/acpi/dptf.asl rename to src/mainboard/google/poppy/variants/baseboard/include/baseboard/acpi/dptf.asl diff --git a/src/mainboard/google/poppy/ec.h b/src/mainboard/google/poppy/variants/baseboard/include/baseboard/ec.h similarity index 96% rename from src/mainboard/google/poppy/ec.h rename to src/mainboard/google/poppy/variants/baseboard/include/baseboard/ec.h index 331bbbc4a4..157dc8f424 100644 --- a/src/mainboard/google/poppy/ec.h +++ b/src/mainboard/google/poppy/variants/baseboard/include/baseboard/ec.h @@ -13,13 +13,13 @@ * GNU General Public License for more details. */ -#ifndef __MAINBOARD_EC_H__ -#define __MAINBOARD_EC_H__ +#ifndef __BASEBOARD_EC_H__ +#define __BASEBOARD_EC_H__ #include #include -#include "gpio.h" +#include #define MAINBOARD_EC_SCI_EVENTS \ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_CLOSED) |\ diff --git a/src/mainboard/google/poppy/gpio.h b/src/mainboard/google/poppy/variants/baseboard/include/baseboard/gpio.h similarity index 99% rename from src/mainboard/google/poppy/gpio.h rename to src/mainboard/google/poppy/variants/baseboard/include/baseboard/gpio.h index aa477cfc19..57d5e18b67 100644 --- a/src/mainboard/google/poppy/gpio.h +++ b/src/mainboard/google/poppy/variants/baseboard/include/baseboard/gpio.h @@ -13,8 +13,8 @@ * GNU General Public License for more details. */ -#ifndef __MAINBOARD_GPIO_H__ -#define __MAINBOARD_GPIO_H__ +#ifndef __BASEBOARD_GPIO_H__ +#define __BASEBOARD_GPIO_H__ #include #include @@ -396,6 +396,6 @@ static const struct pad_config early_gpio_table[] = { PAD_CFG_GPI_APIC_INVERT(GPP_E0, NONE, PLTRST), }; -#endif +#endif /* __ACPI__ */ -#endif +#endif /* BASEBOARD_GPIO_H */ diff --git a/src/mainboard/google/poppy/variants/poppy/include/variant/acpi/dptf.asl b/src/mainboard/google/poppy/variants/poppy/include/variant/acpi/dptf.asl new file mode 100644 index 0000000000..a9ec74269f --- /dev/null +++ b/src/mainboard/google/poppy/variants/poppy/include/variant/acpi/dptf.asl @@ -0,0 +1,16 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2017 Google Inc. + * + * 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 diff --git a/src/mainboard/google/poppy/variants/poppy/include/variant/ec.h b/src/mainboard/google/poppy/variants/poppy/include/variant/ec.h new file mode 100644 index 0000000000..ef47d3751c --- /dev/null +++ b/src/mainboard/google/poppy/variants/poppy/include/variant/ec.h @@ -0,0 +1,21 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2017 Google Inc. + * + * 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. + */ + +#ifndef __MAINBOARD_EC_H__ +#define __MAINBOARD_EC_H__ + +#include + +#endif /* __MAINBOARD_EC_H__ */ diff --git a/src/mainboard/google/poppy/variants/poppy/include/variant/gpio.h b/src/mainboard/google/poppy/variants/poppy/include/variant/gpio.h new file mode 100644 index 0000000000..4f79495e4f --- /dev/null +++ b/src/mainboard/google/poppy/variants/poppy/include/variant/gpio.h @@ -0,0 +1,21 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2017 Google Inc. + * + * 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. + */ + +#ifndef __MAINBOARD_GPIO_H__ +#define __MAINBOARD_GPIO_H__ + +#include + +#endif /* __MAINBOARD_GPIO_H__ */