mb/google/auron: Use `get_gpios` function

Change-Id: I91424a45ae67186987630b7686102f467f57e7ee
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/49779
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
This commit is contained in:
Angel Pons 2021-01-20 23:25:59 +01:00
parent 75f6ab35ff
commit f9acd37d7f
6 changed files with 22 additions and 79 deletions

View File

@ -74,6 +74,8 @@ void fill_spd_for_index(uint8_t spd[], unsigned int spd_index)
size_t spd_file_len; size_t spd_file_len;
uint8_t *spd_file = cbfs_map("spd.bin", &spd_file_len); uint8_t *spd_file = cbfs_map("spd.bin", &spd_file_len);
printk(BIOS_DEBUG, "SPD index %d\n", spd_index);
if (!spd_file) if (!spd_file)
die("SPD data not found."); die("SPD data not found.");

View File

@ -19,25 +19,14 @@
/* Copy SPD data for on-board memory */ /* Copy SPD data for on-board memory */
void mainboard_fill_spd_data(struct pei_data *pei_data) void mainboard_fill_spd_data(struct pei_data *pei_data)
{ {
int spd_bits[3] = { const int gpio_vector[] = {
SPD_GPIO_BIT0, SPD_GPIO_BIT0,
SPD_GPIO_BIT1, SPD_GPIO_BIT1,
SPD_GPIO_BIT2 SPD_GPIO_BIT2,
-1,
}; };
int spd_gpio[3];
int spd_index;
spd_gpio[0] = get_gpio(SPD_GPIO_BIT0); const unsigned int spd_index = get_gpios(gpio_vector);
spd_gpio[1] = get_gpio(SPD_GPIO_BIT1);
spd_gpio[2] = get_gpio(SPD_GPIO_BIT2);
spd_index = spd_gpio[2] << 2 | spd_gpio[1] << 1 | spd_gpio[0];
printk(BIOS_DEBUG, "SPD: index %d (GPIO%d=%d GPIO%d=%d GPIO%d=%d)\n",
spd_index,
spd_bits[2], spd_gpio[2],
spd_bits[1], spd_gpio[1],
spd_bits[0], spd_gpio[0]);
fill_spd_for_index(pei_data->spd_data[0][0], spd_index); fill_spd_for_index(pei_data->spd_data[0][0], spd_index);

View File

@ -19,25 +19,14 @@
/* Copy SPD data for on-board memory */ /* Copy SPD data for on-board memory */
void mainboard_fill_spd_data(struct pei_data *pei_data) void mainboard_fill_spd_data(struct pei_data *pei_data)
{ {
int spd_bits[3] = { const int gpio_vector[] = {
SPD_GPIO_BIT0, SPD_GPIO_BIT0,
SPD_GPIO_BIT1, SPD_GPIO_BIT1,
SPD_GPIO_BIT2 SPD_GPIO_BIT2,
-1,
}; };
int spd_gpio[3];
int spd_index;
spd_gpio[0] = get_gpio(SPD_GPIO_BIT0); const unsigned int spd_index = get_gpios(gpio_vector);
spd_gpio[1] = get_gpio(SPD_GPIO_BIT1);
spd_gpio[2] = get_gpio(SPD_GPIO_BIT2);
spd_index = spd_gpio[2] << 2 | spd_gpio[1] << 1 | spd_gpio[0];
printk(BIOS_DEBUG, "SPD: index %d (GPIO%d=%d GPIO%d=%d GPIO%d=%d)\n",
spd_index,
spd_bits[2], spd_gpio[2],
spd_bits[1], spd_gpio[1],
spd_bits[0], spd_gpio[0]);
fill_spd_for_index(pei_data->spd_data[0][0], spd_index); fill_spd_for_index(pei_data->spd_data[0][0], spd_index);

View File

@ -19,25 +19,14 @@
/* Copy SPD data for on-board memory */ /* Copy SPD data for on-board memory */
void mainboard_fill_spd_data(struct pei_data *pei_data) void mainboard_fill_spd_data(struct pei_data *pei_data)
{ {
int spd_bits[3] = { const int gpio_vector[] = {
SPD_GPIO_BIT0, SPD_GPIO_BIT0,
SPD_GPIO_BIT1, SPD_GPIO_BIT1,
SPD_GPIO_BIT2 SPD_GPIO_BIT2,
-1,
}; };
int spd_gpio[3];
int spd_index;
spd_gpio[0] = get_gpio(SPD_GPIO_BIT0); const unsigned int spd_index = get_gpios(gpio_vector);
spd_gpio[1] = get_gpio(SPD_GPIO_BIT1);
spd_gpio[2] = get_gpio(SPD_GPIO_BIT2);
spd_index = spd_gpio[2] << 2 | spd_gpio[1] << 1 | spd_gpio[0];
printk(BIOS_DEBUG, "SPD: index %d (GPIO%d=%d GPIO%d=%d GPIO%d=%d)\n",
spd_index,
spd_bits[2], spd_gpio[2],
spd_bits[1], spd_gpio[1],
spd_bits[0], spd_gpio[0]);
fill_spd_for_index(pei_data->spd_data[0][0], spd_index); fill_spd_for_index(pei_data->spd_data[0][0], spd_index);

View File

@ -20,29 +20,15 @@
/* Copy SPD data for on-board memory */ /* Copy SPD data for on-board memory */
void mainboard_fill_spd_data(struct pei_data *pei_data) void mainboard_fill_spd_data(struct pei_data *pei_data)
{ {
int spd_bits[4] = { const int gpio_vector[] = {
SPD_GPIO_BIT0, SPD_GPIO_BIT0,
SPD_GPIO_BIT1, SPD_GPIO_BIT1,
SPD_GPIO_BIT2, SPD_GPIO_BIT2,
SPD_GPIO_BIT3 SPD_GPIO_BIT3,
-1,
}; };
int spd_gpio[4];
int spd_index;
spd_gpio[0] = get_gpio(SPD_GPIO_BIT0); const unsigned int spd_index = get_gpios(gpio_vector);
spd_gpio[1] = get_gpio(SPD_GPIO_BIT1);
spd_gpio[2] = get_gpio(SPD_GPIO_BIT2);
spd_gpio[3] = get_gpio(SPD_GPIO_BIT3);
spd_index = (spd_gpio[3] << 3) | (spd_gpio[2] << 2) |
(spd_gpio[1] << 1) | spd_gpio[0];
printk(BIOS_DEBUG, "SPD: index %d (GPIO%d=%d GPIO%d=%d GPIO%d=%d GPIO%d=%d)\n",
spd_index,
spd_bits[3], spd_gpio[3],
spd_bits[2], spd_gpio[2],
spd_bits[1], spd_gpio[1],
spd_bits[0], spd_gpio[0]);
/* CH0 */ /* CH0 */
fill_spd_for_index(pei_data->spd_data[0][0], spd_index); fill_spd_for_index(pei_data->spd_data[0][0], spd_index);

View File

@ -20,27 +20,15 @@
/* Copy SPD data for on-board memory */ /* Copy SPD data for on-board memory */
void mainboard_fill_spd_data(struct pei_data *pei_data) void mainboard_fill_spd_data(struct pei_data *pei_data)
{ {
int spd_bits[4] = { const int gpio_vector[] = {
SPD_GPIO_BIT0, SPD_GPIO_BIT0,
SPD_GPIO_BIT1, SPD_GPIO_BIT1,
SPD_GPIO_BIT2, SPD_GPIO_BIT2,
SPD_GPIO_BIT3 SPD_GPIO_BIT3,
-1,
}; };
int spd_gpio[4];
int spd_index;
spd_gpio[0] = get_gpio(spd_bits[0]); const unsigned int spd_index = get_gpios(gpio_vector);
spd_gpio[1] = get_gpio(spd_bits[1]);
spd_gpio[2] = get_gpio(spd_bits[2]);
spd_gpio[3] = get_gpio(spd_bits[3]);
spd_index = (spd_gpio[3] << 3) | (spd_gpio[2] << 2) |
(spd_gpio[1] << 1) | spd_gpio[0];
printk(BIOS_DEBUG, "SPD: index %d (GPIO%d=%d GPIO%d=%d "
"GPIO%d=%d GPIO%d=%d)\n", spd_index,
spd_bits[3], spd_gpio[3], spd_bits[2], spd_gpio[2],
spd_bits[1], spd_gpio[1], spd_bits[0], spd_gpio[0]);
fill_spd_for_index(pei_data->spd_data[0][0], spd_index); fill_spd_for_index(pei_data->spd_data[0][0], spd_index);