src/mainboard: Const'ify pci_devfn_t devices

Change-Id: I5bb1a819475383719dbda32d9b5fea63da1e6713
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/40611
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Elyes HAOUAS 2020-04-22 16:49:28 +02:00 committed by Angel Pons
parent cfdac82661
commit a4faec3b01
8 changed files with 18 additions and 20 deletions

View File

@ -35,7 +35,7 @@ void bootblock_mainboard_early_init(void)
pm_io_write8(0x24, 1); pm_io_write8(0x24, 1);
/* Set LPC decode enables. */ /* Set LPC decode enables. */
pci_devfn_t dev = PCI_DEV(0, 0x14, 3); const pci_devfn_t dev = PCI_DEV(0, 0x14, 3);
pci_write_config32(dev, 0x44, 0xff03ffd5); pci_write_config32(dev, 0x44, 0xff03ffd5);
/* enable SIO LPC decode */ /* enable SIO LPC decode */

View File

@ -41,9 +41,7 @@ static void bootblock_northbridge_init(void)
static void enable_spi_prefetch(void) static void enable_spi_prefetch(void)
{ {
u8 reg8; u8 reg8;
pci_devfn_t dev; const pci_devfn_t dev = PCI_DEV(0, 0x1f, 0);
dev = PCI_DEV(0, 0x1f, 0);
reg8 = pci_read_config8(dev, 0xdc); reg8 = pci_read_config8(dev, 0xdc);
reg8 &= ~(3 << 2); reg8 &= ~(3 << 2);

View File

@ -29,20 +29,20 @@ void fill_lb_gpios(struct lb_gpios *gpios)
int get_write_protect_state(void) int get_write_protect_state(void)
{ {
pci_devfn_t dev = PCI_DEV(0, 0x1f, 2); const pci_devfn_t dev = PCI_DEV(0, 0x1f, 2);
return (pci_s_read_config32(dev, SATA_SP) >> FLAG_SPI_WP) & 1; return (pci_s_read_config32(dev, SATA_SP) >> FLAG_SPI_WP) & 1;
} }
int get_recovery_mode_switch(void) int get_recovery_mode_switch(void)
{ {
pci_devfn_t dev = PCI_DEV(0, 0x1f, 2); const pci_devfn_t dev = PCI_DEV(0, 0x1f, 2);
return (pci_s_read_config32(dev, SATA_SP) >> FLAG_REC_MODE) & 1; return (pci_s_read_config32(dev, SATA_SP) >> FLAG_REC_MODE) & 1;
} }
void init_bootmode_straps(void) void init_bootmode_straps(void)
{ {
u32 flags = 0; u32 flags = 0;
pci_devfn_t dev = PCI_DEV(0, 0x1f, 2); const pci_devfn_t dev = PCI_DEV(0, 0x1f, 2);
/* Write Protect: GPIO58 = GPIO_SPI_WP, active high */ /* Write Protect: GPIO58 = GPIO_SPI_WP, active high */
if (get_gpio(GPIO_SPI_WP)) if (get_gpio(GPIO_SPI_WP))

View File

@ -30,20 +30,20 @@ void fill_lb_gpios(struct lb_gpios *gpios)
int get_write_protect_state(void) int get_write_protect_state(void)
{ {
pci_devfn_t dev = PCI_DEV(0, 0x1f, 2); const pci_devfn_t dev = PCI_DEV(0, 0x1f, 2);
return (pci_s_read_config32(dev, SATA_SP) >> FLAG_SPI_WP) & 1; return (pci_s_read_config32(dev, SATA_SP) >> FLAG_SPI_WP) & 1;
} }
int get_recovery_mode_switch(void) int get_recovery_mode_switch(void)
{ {
pci_devfn_t dev = PCI_DEV(0, 0x1f, 2); const pci_devfn_t dev = PCI_DEV(0, 0x1f, 2);
return (pci_s_read_config32(dev, SATA_SP) >> FLAG_REC_MODE) & 1; return (pci_s_read_config32(dev, SATA_SP) >> FLAG_REC_MODE) & 1;
} }
void init_bootmode_straps(void) void init_bootmode_straps(void)
{ {
u32 flags = 0; u32 flags = 0;
pci_devfn_t dev = PCI_DEV(0, 0x1f, 2); const pci_devfn_t dev = PCI_DEV(0, 0x1f, 2);
/* Write Protect: GPIO58 = GPIO_SPI_WP, active high */ /* Write Protect: GPIO58 = GPIO_SPI_WP, active high */
if (get_gpio(GPIO_SPI_WP)) if (get_gpio(GPIO_SPI_WP))

View File

@ -15,7 +15,7 @@
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {
pci_devfn_t dev = PCI_DEV(0, 0x1f, 0); const pci_devfn_t dev = PCI_DEV(0, 0x1f, 0);
u16 gen_pmcon_1 = pci_s_read_config32(dev, GEN_PMCON_1); u16 gen_pmcon_1 = pci_s_read_config32(dev, GEN_PMCON_1);
struct lb_gpio chromeos_gpios[] = { struct lb_gpio chromeos_gpios[] = {

View File

@ -60,7 +60,7 @@ int get_recovery_mode_switch(void)
if (ec_rec_flag_good) if (ec_rec_flag_good)
return ec_in_rec_mode; return ec_in_rec_mode;
pci_devfn_t dev = PCI_DEV(0, 0x1f, 0); const pci_devfn_t dev = PCI_DEV(0, 0x1f, 0);
u8 reg8 = pci_s_read_config8(dev, GEN_PMCON_3); u8 reg8 = pci_s_read_config8(dev, GEN_PMCON_3);
u8 ec_status = ec_read(EC_STATUS_REG); u8 ec_status = ec_read(EC_STATUS_REG);

View File

@ -21,7 +21,7 @@
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {
pci_devfn_t dev = PCI_DEV(0, 0x1f, 0); const pci_devfn_t dev = PCI_DEV(0, 0x1f, 0);
u16 gen_pmcon_1 = pci_s_read_config32(dev, GEN_PMCON_1); u16 gen_pmcon_1 = pci_s_read_config32(dev, GEN_PMCON_1);
u8 lid = ec_read(0x83); u8 lid = ec_read(0x83);
@ -44,20 +44,20 @@ void fill_lb_gpios(struct lb_gpios *gpios)
int get_write_protect_state(void) int get_write_protect_state(void)
{ {
pci_devfn_t dev = PCI_DEV(0, 0x1f, 2); const pci_devfn_t dev = PCI_DEV(0, 0x1f, 2);
return (pci_s_read_config32(dev, SATA_SP) >> FLAG_SPI_WP) & 1; return (pci_s_read_config32(dev, SATA_SP) >> FLAG_SPI_WP) & 1;
} }
int get_recovery_mode_switch(void) int get_recovery_mode_switch(void)
{ {
pci_devfn_t dev = PCI_DEV(0, 0x1f, 2); const pci_devfn_t dev = PCI_DEV(0, 0x1f, 2);
return (pci_s_read_config32(dev, SATA_SP) >> FLAG_REC_MODE) & 1; return (pci_s_read_config32(dev, SATA_SP) >> FLAG_REC_MODE) & 1;
} }
void init_bootmode_straps(void) void init_bootmode_straps(void)
{ {
u32 flags = 0; u32 flags = 0;
pci_devfn_t dev = PCI_DEV(0, 0x1f, 2); const pci_devfn_t dev = PCI_DEV(0, 0x1f, 2);
/* Write Protect: GPIO24 = KBC3_SPI_WP#, active high */ /* Write Protect: GPIO24 = KBC3_SPI_WP#, active high */
if (get_gpio(GPIO_SPI_WP)) if (get_gpio(GPIO_SPI_WP))

View File

@ -17,7 +17,7 @@
void fill_lb_gpios(struct lb_gpios *gpios) void fill_lb_gpios(struct lb_gpios *gpios)
{ {
pci_devfn_t dev = PCI_DEV(0, 0x1f, 0); const pci_devfn_t dev = PCI_DEV(0, 0x1f, 0);
u16 gen_pmcon_1 = pci_s_read_config32(dev, GEN_PMCON_1); u16 gen_pmcon_1 = pci_s_read_config32(dev, GEN_PMCON_1);
struct lb_gpio chromeos_gpios[] = { struct lb_gpio chromeos_gpios[] = {
@ -40,20 +40,20 @@ void fill_lb_gpios(struct lb_gpios *gpios)
int get_write_protect_state(void) int get_write_protect_state(void)
{ {
pci_devfn_t dev = PCI_DEV(0, 0x1f, 2); const pci_devfn_t dev = PCI_DEV(0, 0x1f, 2);
return (pci_s_read_config32(dev, SATA_SP) >> FLAG_SPI_WP) & 1; return (pci_s_read_config32(dev, SATA_SP) >> FLAG_SPI_WP) & 1;
} }
int get_recovery_mode_switch(void) int get_recovery_mode_switch(void)
{ {
pci_devfn_t dev = PCI_DEV(0, 0x1f, 2); const pci_devfn_t dev = PCI_DEV(0, 0x1f, 2);
return (pci_s_read_config32(dev, SATA_SP) >> FLAG_REC_MODE) & 1; return (pci_s_read_config32(dev, SATA_SP) >> FLAG_REC_MODE) & 1;
} }
void init_bootmode_straps(void) void init_bootmode_straps(void)
{ {
u32 flags = 0; u32 flags = 0;
pci_devfn_t dev = PCI_DEV(0, 0x1f, 2); const pci_devfn_t dev = PCI_DEV(0, 0x1f, 2);
/* Write Protect: GPIO68 = CHP3_SPI_WP, active high */ /* Write Protect: GPIO68 = CHP3_SPI_WP, active high */
if (get_gpio(GPIO_SPI_WP)) if (get_gpio(GPIO_SPI_WP))