Skip to content

Commit

Permalink
ChromeOS: Promote variant_cros_gpio()
Browse files Browse the repository at this point in the history
The only purpose of mainboard_chromeos_acpi_generate()
was to pass cros_gpio array for ACPI \\OIPG package
generation.

Promote variant_cros_gpio() from baseboards to ChromeOS
declaration.

Change-Id: I5c2ac1dcea35f1f00dea401528404bc6ca0ab53c
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58897
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
  • Loading branch information
kmalkki authored and felixheld committed Apr 6, 2022
1 parent afe5562 commit 4fdd84e
Show file tree
Hide file tree
Showing 70 changed files with 97 additions and 321 deletions.
10 changes: 4 additions & 6 deletions src/mainboard/amd/chausie/chromeos.c
Expand Up @@ -18,11 +18,9 @@ int get_write_protect_state(void)
return 0;
}

static const struct cros_gpio cros_gpios[] = {
/* No ChromeOS GPIOs */
};

void mainboard_chromeos_acpi_generate(void)
const struct cros_gpio *variant_cros_gpios(size_t *num)
{
chromeos_acpi_gpio_generate(cros_gpios, ARRAY_SIZE(cros_gpios));
/* No ChromeOS GPIOs */
*num = 0;
return NULL;
}
10 changes: 4 additions & 6 deletions src/mainboard/amd/majolica/chromeos.c
Expand Up @@ -18,11 +18,9 @@ int get_write_protect_state(void)
return 0;
}

static const struct cros_gpio cros_gpios[] = {
/* No ChromeOS GPIOs */
};

void mainboard_chromeos_acpi_generate(void)
const struct cros_gpio *variant_cros_gpios(size_t *num)
{
chromeos_acpi_gpio_generate(cros_gpios, ARRAY_SIZE(cros_gpios));
/* No ChromeOS GPIOs */
*num = 0;
return NULL;
}
5 changes: 3 additions & 2 deletions src/mainboard/emulation/qemu-q35/chromeos.c
Expand Up @@ -20,9 +20,10 @@ static const struct cros_gpio cros_gpios[] = {
CROS_GPIO_REC_AL(CROS_GPIO_VIRTUAL, "QEMU"),
};

void mainboard_chromeos_acpi_generate(void)
const struct cros_gpio *variant_cros_gpios(size_t *num)
{
chromeos_acpi_gpio_generate(cros_gpios, ARRAY_SIZE(cros_gpios));
*num = ARRAY_SIZE(cros_gpios);
return cros_gpios;
}

int get_ec_is_trusted(void)
Expand Down
5 changes: 3 additions & 2 deletions src/mainboard/google/auron/chromeos.c
Expand Up @@ -36,9 +36,10 @@ static const struct cros_gpio cros_gpios[] = {
CROS_GPIO_WP_AH(CROS_WP_GPIO, CROS_GPIO_DEVICE_NAME),
};

void mainboard_chromeos_acpi_generate(void)
const struct cros_gpio *variant_cros_gpios(size_t *num)
{
chromeos_acpi_gpio_generate(cros_gpios, ARRAY_SIZE(cros_gpios));
*num = ARRAY_SIZE(cros_gpios);
return cros_gpios;
}

int get_ec_is_trusted(void)
Expand Down
5 changes: 3 additions & 2 deletions src/mainboard/google/beltino/chromeos.c
Expand Up @@ -70,9 +70,10 @@ static const struct cros_gpio cros_gpios[] = {
CROS_GPIO_WP_AH(GPIO_SPI_WP, CROS_GPIO_DEVICE_NAME),
};

void mainboard_chromeos_acpi_generate(void)
const struct cros_gpio *variant_cros_gpios(size_t *num)
{
chromeos_acpi_gpio_generate(cros_gpios, ARRAY_SIZE(cros_gpios));
*num = ARRAY_SIZE(cros_gpios);
return cros_gpios;
}

int get_ec_is_trusted(void)
Expand Down
10 changes: 0 additions & 10 deletions src/mainboard/google/brya/chromeos.c
@@ -1,12 +1,10 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */

#include <baseboard/gpio.h>
#include <baseboard/variants.h>
#include <bootmode.h>
#include <boot/coreboot_tables.h>
#include <gpio.h>
#include <types.h>
#include <vendorcode/google/chromeos/chromeos.h>

void fill_lb_gpios(struct lb_gpios *gpios)
{
Expand All @@ -24,14 +22,6 @@ int get_write_protect_state(void)
return gpio_get(GPIO_PCH_WP);
}

void mainboard_chromeos_acpi_generate(void)
{
const struct cros_gpio *gpios;
size_t num;
gpios = variant_cros_gpios(&num);
chromeos_acpi_gpio_generate(gpios, num);
}

int get_ec_is_trusted(void)
{
/* EC is trusted if not in RW. */
Expand Down
Expand Up @@ -15,7 +15,6 @@
const struct pad_config *variant_gpio_table(size_t *num);
const struct pad_config *variant_gpio_override_table(size_t *num);
const struct pad_config *variant_early_gpio_table(size_t *num);
const struct cros_gpio *variant_cros_gpios(size_t *num);
const struct pad_config *variant_romstage_gpio_table(size_t *num);

const struct mb_cfg *variant_memory_params(void);
Expand Down
5 changes: 3 additions & 2 deletions src/mainboard/google/butterfly/chromeos.c
Expand Up @@ -53,9 +53,10 @@ static const struct cros_gpio cros_gpios[] = {
CROS_GPIO_WP_AL(WP_GPIO, CROS_GPIO_DEVICE_NAME),
};

void mainboard_chromeos_acpi_generate(void)
const struct cros_gpio *variant_cros_gpios(size_t *num)
{
chromeos_acpi_gpio_generate(cros_gpios, ARRAY_SIZE(cros_gpios));
*num = ARRAY_SIZE(cros_gpios);
return cros_gpios;
}

int get_ec_is_trusted(void)
Expand Down
5 changes: 3 additions & 2 deletions src/mainboard/google/cyan/chromeos.c
Expand Up @@ -60,9 +60,10 @@ static const struct cros_gpio cros_gpios[] = {
CROS_GPIO_WP_AH(0x10013, CROS_GPIO_DEVICE_NAME),
};

void mainboard_chromeos_acpi_generate(void)
const struct cros_gpio *variant_cros_gpios(size_t *num)
{
chromeos_acpi_gpio_generate(cros_gpios, ARRAY_SIZE(cros_gpios));
*num = ARRAY_SIZE(cros_gpios);
return cros_gpios;
}

int get_ec_is_trusted(void)
Expand Down
11 changes: 0 additions & 11 deletions src/mainboard/google/dedede/chromeos.c
@@ -1,12 +1,10 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */

#include <baseboard/gpio.h>
#include <baseboard/variants.h>
#include <bootmode.h>
#include <boot/coreboot_tables.h>
#include <gpio.h>
#include <types.h>
#include <vendorcode/google/chromeos/chromeos.h>

void fill_lb_gpios(struct lb_gpios *gpios)
{
Expand All @@ -24,15 +22,6 @@ int get_write_protect_state(void)
return gpio_get(GPIO_PCH_WP);
}

void mainboard_chromeos_acpi_generate(void)
{
const struct cros_gpio *gpios;
size_t num;

gpios = variant_cros_gpios(&num);
chromeos_acpi_gpio_generate(gpios, num);
}

int get_ec_is_trusted(void)
{
/* EC is trusted if not in RW. */
Expand Down
Expand Up @@ -13,7 +13,6 @@
const struct pad_config *variant_base_gpio_table(size_t *num);
const struct pad_config *variant_early_gpio_table(size_t *num);
const struct pad_config *variant_sleep_gpio_table(size_t *num);
const struct cros_gpio *variant_cros_gpios(size_t *num);
const struct pad_config *variant_override_gpio_table(size_t *num);

/**
Expand Down
10 changes: 0 additions & 10 deletions src/mainboard/google/deltaur/chromeos.c
@@ -1,6 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */

#include <baseboard/variants.h>
#include <baseboard/gpio.h>
#include <bootmode.h>
#include <boot/coreboot_tables.h>
Expand Down Expand Up @@ -42,15 +41,6 @@ static bool raw_get_recovery_mode_switch(void)
return !gpio_get(GPIO_REC_MODE);
}

void mainboard_chromeos_acpi_generate(void)
{
const struct cros_gpio *cros_gpios;
size_t num_gpios = 0;

cros_gpios = variant_cros_gpios(&num_gpios);

chromeos_acpi_gpio_generate(cros_gpios, num_gpios);
}

int get_recovery_mode_switch(void)
{
Expand Down
Expand Up @@ -28,7 +28,5 @@

const struct pad_config *override_gpio_table(size_t *num);
const struct pad_config *override_early_gpio_table(size_t *num);
struct cros_gpio;
const struct cros_gpio *override_cros_gpios(size_t *num);

#endif
Expand Up @@ -6,7 +6,6 @@
#include <soc/gpio.h>
#include <soc/meminit.h>
#include <stddef.h>
#include <vendorcode/google/chromeos/chromeos.h>

/*
* The next set of functions return the gpio table and fill in the number of
Expand All @@ -16,8 +15,6 @@ const struct pad_config *variant_base_gpio_table(size_t *num);
const struct pad_config *variant_early_gpio_table(size_t *num);
const struct pad_config *variant_override_gpio_table(size_t *num);

const struct cros_gpio *variant_cros_gpios(size_t *num);

const struct mb_cfg *variant_memory_params(void);
void variant_memory_init(FSPM_UPD *mupd);

Expand Down
9 changes: 0 additions & 9 deletions src/mainboard/google/drallion/chromeos.c
Expand Up @@ -40,15 +40,6 @@ static bool raw_get_recovery_mode_switch(void)
return !gpio_get(GPP_E8);
}

void mainboard_chromeos_acpi_generate(void)
{
const struct cros_gpio *cros_gpios;
size_t num_gpios = 0;

cros_gpios = variant_cros_gpios(&num_gpios);

chromeos_acpi_gpio_generate(cros_gpios, num_gpios);
}

int get_recovery_mode_switch(void)
{
Expand Down
Expand Up @@ -29,7 +29,4 @@
const struct pad_config *variant_gpio_table(size_t *num);
const struct pad_config *variant_early_gpio_table(size_t *num);

struct cros_gpio;
const struct cros_gpio *variant_cros_gpios(size_t *num);

#endif
5 changes: 3 additions & 2 deletions src/mainboard/google/eve/chromeos.c
Expand Up @@ -32,9 +32,10 @@ static const struct cros_gpio cros_gpios[] = {
CROS_GPIO_WP_AH(GPIO_PCH_WP, CROS_GPIO_DEVICE_NAME),
};

void mainboard_chromeos_acpi_generate(void)
const struct cros_gpio *variant_cros_gpios(size_t *num)
{
chromeos_acpi_gpio_generate(cros_gpios, ARRAY_SIZE(cros_gpios));
*num = ARRAY_SIZE(cros_gpios);
return cros_gpios;
}

int get_ec_is_trusted(void)
Expand Down
11 changes: 0 additions & 11 deletions src/mainboard/google/fizz/chromeos.c
Expand Up @@ -3,10 +3,8 @@
#include <bootmode.h>
#include <boot/coreboot_tables.h>
#include <gpio.h>
#include <baseboard/variants.h>
#include <soc/gpio.h>
#include <types.h>
#include <vendorcode/google/chromeos/chromeos.h>

#include <variant/gpio.h>

Expand All @@ -28,15 +26,6 @@ int get_write_protect_state(void)
return gpio_get(GPIO_PCH_WP);
}

void mainboard_chromeos_acpi_generate(void)
{
const struct cros_gpio *gpios;
size_t num;

gpios = variant_cros_gpios(&num);
chromeos_acpi_gpio_generate(gpios, num);
}

int get_ec_is_trusted(void)
{
/* EC is trusted if not in RW. */
Expand Down
Expand Up @@ -5,7 +5,6 @@

#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
Expand All @@ -14,8 +13,6 @@
const struct pad_config *variant_gpio_table(size_t *num);
const struct pad_config *variant_early_gpio_table(size_t *num);

const struct cros_gpio *variant_cros_gpios(size_t *num);

void variant_smi_sleep(u8 slp_typ);

struct nhlt;
Expand Down
5 changes: 3 additions & 2 deletions src/mainboard/google/glados/chromeos.c
Expand Up @@ -31,9 +31,10 @@ static const struct cros_gpio cros_gpios[] = {
CROS_GPIO_WP_AH(GPIO_PCH_WP, CROS_GPIO_DEVICE_NAME),
};

void mainboard_chromeos_acpi_generate(void)
const struct cros_gpio *variant_cros_gpios(size_t *num)
{
chromeos_acpi_gpio_generate(cros_gpios, ARRAY_SIZE(cros_gpios));
*num = ARRAY_SIZE(cros_gpios);
return cros_gpios;
}

int get_ec_is_trusted(void)
Expand Down
5 changes: 3 additions & 2 deletions src/mainboard/google/guybrush/chromeos.c
Expand Up @@ -23,9 +23,10 @@ static const struct cros_gpio cros_gpios[] = {
CROS_GPIO_WP_AL(CROS_WP_GPIO, GPIO_DEVICE_NAME),
};

void mainboard_chromeos_acpi_generate(void)
const struct cros_gpio *variant_cros_gpios(size_t *num)
{
chromeos_acpi_gpio_generate(cros_gpios, ARRAY_SIZE(cros_gpios));
*num = ARRAY_SIZE(cros_gpios);
return cros_gpios;
}

int get_ec_is_trusted(void)
Expand Down
12 changes: 0 additions & 12 deletions src/mainboard/google/hatch/chromeos.c
@@ -1,13 +1,11 @@
/* SPDX-License-Identifier: GPL-2.0-only */

#include <baseboard/variants.h>
#include <bootmode.h>
#include <boot/coreboot_tables.h>
#include <ec/google/chromeec/ec.h>
#include <gpio.h>
#include <variant/gpio.h>
#include <types.h>
#include <vendorcode/google/chromeos/chromeos.h>

void fill_lb_gpios(struct lb_gpios *gpios)
{
Expand All @@ -26,16 +24,6 @@ int get_write_protect_state(void)
return gpio_get(GPIO_PCH_WP);
}

void mainboard_chromeos_acpi_generate(void)
{
const struct cros_gpio *cros_gpios;
size_t num_gpios = 0;

cros_gpios = variant_cros_gpios(&num_gpios);

chromeos_acpi_gpio_generate(cros_gpios, num_gpios);
}

int get_ec_is_trusted(void)
{
/* EC is trusted if not in RW. */
Expand Down
Expand Up @@ -6,7 +6,6 @@
#include <soc/cnl_memcfg_init.h>
#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
Expand All @@ -28,9 +27,6 @@ const struct pad_config *variant_sleep_gpio_table(u8 slp_typ, size_t *num);
/* Return GPIO pads that need to be configured before ramstage */
const struct pad_config *variant_early_gpio_table(size_t *num);

/* Return ChromeOS gpio table and fill in number of entries. */
const struct cros_gpio *variant_cros_gpios(size_t *num);

/* Modify devictree settings during ramstage. */
void variant_devtree_update(void);

Expand Down
5 changes: 3 additions & 2 deletions src/mainboard/google/jecht/chromeos.c
Expand Up @@ -72,9 +72,10 @@ static const struct cros_gpio cros_gpios[] = {
CROS_GPIO_WP_AH(GPIO_SPI_WP, CROS_GPIO_DEVICE_NAME),
};

void mainboard_chromeos_acpi_generate(void)
const struct cros_gpio *variant_cros_gpios(size_t *num)
{
chromeos_acpi_gpio_generate(cros_gpios, ARRAY_SIZE(cros_gpios));
*num = ARRAY_SIZE(cros_gpios);
return cros_gpios;
}

int get_ec_is_trusted(void)
Expand Down
5 changes: 3 additions & 2 deletions src/mainboard/google/kahlee/chromeos.c
Expand Up @@ -30,9 +30,10 @@ static const struct cros_gpio cros_gpios[] = {
CROS_GPIO_WP_AL(CROS_WP_GPIO, GPIO_DEVICE_NAME),
};

void mainboard_chromeos_acpi_generate(void)
const struct cros_gpio *variant_cros_gpios(size_t *num)
{
chromeos_acpi_gpio_generate(cros_gpios, ARRAY_SIZE(cros_gpios));
*num = ARRAY_SIZE(cros_gpios);
return cros_gpios;
}

int get_ec_is_trusted(void)
Expand Down

0 comments on commit 4fdd84e

Please sign in to comment.