soc/intel: Drop `dev` parameter from soc_get_gen_io_dec_range()

This change drops the parameter `struct device *dev` from the function
`soc_get_gen_io_dec_range()`. This function uses the parameter dev to
get a pointer to config structure for extracting the decode ranges
configured by mainboard in device tree. However, there is no separate
chip driver for the LPC device which means that the SoC code can use
`config_of_soc()` to get to SoC chip config instead of using the LPC
device.

This change is being done in preparation to clean up the device
tree/chip config access in early stages that allows for optimizing
the inclusion of device tree elements in the early stages.

Change-Id: I3ea53ddc771f592dd0ea5e5e809be2d2eff7f16d
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/49209
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
This commit is contained in:
Furquan Shaikh 2020-12-23 14:11:00 -08:00 committed by Patrick Georgi
parent 2136c5af5f
commit e4f7e04050
10 changed files with 18 additions and 25 deletions

View File

@ -35,9 +35,9 @@ const struct lpc_mmio_range *soc_get_fixed_mmio_ranges()
return lpc_fixed_mmio_ranges; return lpc_fixed_mmio_ranges;
} }
void soc_get_gen_io_dec_range(const struct device *dev, uint32_t *gen_io_dec) void soc_get_gen_io_dec_range(uint32_t *gen_io_dec)
{ {
const config_t *config = config_of(dev); const config_t *config = config_of_soc();
gen_io_dec[0] = config->gen1_dec; gen_io_dec[0] = config->gen1_dec;
gen_io_dec[1] = config->gen2_dec; gen_io_dec[1] = config->gen2_dec;

View File

@ -33,9 +33,9 @@ const struct lpc_mmio_range *soc_get_fixed_mmio_ranges()
return cnl_lpc_fixed_mmio_ranges; return cnl_lpc_fixed_mmio_ranges;
} }
void soc_get_gen_io_dec_range(const struct device *dev, uint32_t *gen_io_dec) void soc_get_gen_io_dec_range(uint32_t *gen_io_dec)
{ {
const config_t *config = config_of(dev); const config_t *config = config_of_soc();
gen_io_dec[0] = config->gen1_dec; gen_io_dec[0] = config->gen1_dec;
gen_io_dec[1] = config->gen2_dec; gen_io_dec[1] = config->gen2_dec;

View File

@ -98,8 +98,7 @@ void lpc_io_setup_comm_a_b(void);
/* Enable PCH LPC by setting up generic decode range registers. */ /* Enable PCH LPC by setting up generic decode range registers. */
void pch_enable_lpc(void); void pch_enable_lpc(void);
/* Get SoC's generic IO decoder range register settings. */ /* Get SoC's generic IO decoder range register settings. */
void soc_get_gen_io_dec_range(const struct device *dev, void soc_get_gen_io_dec_range(uint32_t gen_io_dec[LPC_NUM_GENERIC_IO_RANGES]);
uint32_t gen_io_dec[LPC_NUM_GENERIC_IO_RANGES]);
/* Mirror generic IO decoder range register settings into DMI PCR. */ /* Mirror generic IO decoder range register settings into DMI PCR. */
void soc_setup_dmi_pcr_io_dec(uint32_t gen_io_dec[LPC_NUM_GENERIC_IO_RANGES]); void soc_setup_dmi_pcr_io_dec(uint32_t gen_io_dec[LPC_NUM_GENERIC_IO_RANGES]);
/* Add resource into LPC PCI device space */ /* Add resource into LPC PCI device space */

View File

@ -270,15 +270,9 @@ static void lpc_set_gen_decode_range(
void pch_enable_lpc(void) void pch_enable_lpc(void)
{ {
/* Lookup device tree in romstage */
const struct device *dev;
uint32_t gen_io_dec[LPC_NUM_GENERIC_IO_RANGES]; uint32_t gen_io_dec[LPC_NUM_GENERIC_IO_RANGES];
dev = pcidev_on_root(PCH_DEV_SLOT_LPC, 0); soc_get_gen_io_dec_range(gen_io_dec);
if (!dev)
return;
soc_get_gen_io_dec_range(dev, gen_io_dec);
lpc_set_gen_decode_range(gen_io_dec); lpc_set_gen_decode_range(gen_io_dec);
soc_setup_dmi_pcr_io_dec(gen_io_dec); soc_setup_dmi_pcr_io_dec(gen_io_dec);
if (ENV_PAYLOAD_LOADER) if (ENV_PAYLOAD_LOADER)

View File

@ -31,9 +31,9 @@ const struct lpc_mmio_range *soc_get_fixed_mmio_ranges()
return ehl_lpc_fixed_mmio_ranges; return ehl_lpc_fixed_mmio_ranges;
} }
void soc_get_gen_io_dec_range(const struct device *dev, uint32_t *gen_io_dec) void soc_get_gen_io_dec_range(uint32_t *gen_io_dec)
{ {
const config_t *config = config_of(dev); const config_t *config = config_of_soc();
gen_io_dec[0] = config->gen1_dec; gen_io_dec[0] = config->gen1_dec;
gen_io_dec[1] = config->gen2_dec; gen_io_dec[1] = config->gen2_dec;

View File

@ -32,9 +32,9 @@ const struct lpc_mmio_range *soc_get_fixed_mmio_ranges()
return icl_lpc_fixed_mmio_ranges; return icl_lpc_fixed_mmio_ranges;
} }
void soc_get_gen_io_dec_range(const struct device *dev, uint32_t *gen_io_dec) void soc_get_gen_io_dec_range(uint32_t *gen_io_dec)
{ {
const config_t *config = config_of(dev); const config_t *config = config_of_soc();
gen_io_dec[0] = config->gen1_dec; gen_io_dec[0] = config->gen1_dec;
gen_io_dec[1] = config->gen2_dec; gen_io_dec[1] = config->gen2_dec;

View File

@ -32,9 +32,9 @@ const struct lpc_mmio_range *soc_get_fixed_mmio_ranges()
return jsl_lpc_fixed_mmio_ranges; return jsl_lpc_fixed_mmio_ranges;
} }
void soc_get_gen_io_dec_range(const struct device *dev, uint32_t *gen_io_dec) void soc_get_gen_io_dec_range(uint32_t *gen_io_dec)
{ {
const config_t *config = config_of(dev); const config_t *config = config_of_soc();
gen_io_dec[0] = config->gen1_dec; gen_io_dec[0] = config->gen1_dec;
gen_io_dec[1] = config->gen2_dec; gen_io_dec[1] = config->gen2_dec;

View File

@ -29,9 +29,9 @@ const struct lpc_mmio_range *soc_get_fixed_mmio_ranges(void)
return skl_lpc_fixed_mmio_ranges; return skl_lpc_fixed_mmio_ranges;
} }
void soc_get_gen_io_dec_range(const struct device *dev, uint32_t *gen_io_dec) void soc_get_gen_io_dec_range(uint32_t *gen_io_dec)
{ {
const config_t *config = config_of(dev); const config_t *config = config_of_soc();
gen_io_dec[0] = config->gen1_dec; gen_io_dec[0] = config->gen1_dec;
gen_io_dec[1] = config->gen2_dec; gen_io_dec[1] = config->gen2_dec;

View File

@ -38,9 +38,9 @@ const struct lpc_mmio_range *soc_get_fixed_mmio_ranges()
return tgl_lpc_fixed_mmio_ranges; return tgl_lpc_fixed_mmio_ranges;
} }
void soc_get_gen_io_dec_range(const struct device *dev, uint32_t *gen_io_dec) void soc_get_gen_io_dec_range(uint32_t *gen_io_dec)
{ {
const config_t *config = config_of(dev); const config_t *config = config_of_soc();
gen_io_dec[0] = config->gen1_dec; gen_io_dec[0] = config->gen1_dec;
gen_io_dec[1] = config->gen2_dec; gen_io_dec[1] = config->gen2_dec;

View File

@ -18,9 +18,9 @@ const struct lpc_mmio_range *soc_get_fixed_mmio_ranges(void)
return xeon_lpc_fixed_mmio_ranges; return xeon_lpc_fixed_mmio_ranges;
} }
void soc_get_gen_io_dec_range(const struct device *dev, uint32_t *gen_io_dec) void soc_get_gen_io_dec_range(uint32_t *gen_io_dec)
{ {
const config_t *config = config_of(dev); const config_t *config = config_of_soc();
gen_io_dec[0] = config->gen1_dec; gen_io_dec[0] = config->gen1_dec;
gen_io_dec[1] = config->gen2_dec; gen_io_dec[1] = config->gen2_dec;