summaryrefslogtreecommitdiff
path: root/src/soc/intel/apollolake
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/intel/apollolake')
-rw-r--r--src/soc/intel/apollolake/acpi.c17
-rw-r--r--src/soc/intel/apollolake/chip.c31
-rw-r--r--src/soc/intel/apollolake/cpu.c9
-rw-r--r--src/soc/intel/apollolake/pmutil.c8
-rw-r--r--src/soc/intel/apollolake/pnpconfig.c6
-rw-r--r--src/soc/intel/apollolake/romstage.c11
6 files changed, 17 insertions, 65 deletions
diff --git a/src/soc/intel/apollolake/acpi.c b/src/soc/intel/apollolake/acpi.c
index cec706f5e0..f729f3139e 100644
--- a/src/soc/intel/apollolake/acpi.c
+++ b/src/soc/intel/apollolake/acpi.c
@@ -90,7 +90,7 @@ acpi_cstate_t *soc_get_cstate_map(size_t *entries)
void acpi_create_gnvs(struct global_nvs_t *gnvs)
{
struct soc_intel_apollolake_config *cfg;
- struct device *dev = SA_DEV_ROOT;
+ cfg = config_of_path(SA_DEVFN_ROOT);
/* Clear out GNVS. */
memset(gnvs, 0, sizeof(*gnvs));
@@ -110,12 +110,6 @@ void acpi_create_gnvs(struct global_nvs_t *gnvs)
/* CPU core count */
gnvs->pcnt = dev_count_cpu();
- if (!dev || !dev->chip_info) {
- printk(BIOS_ERR, "BUG! Could not find SOC devicetree config\n");
- return;
- }
- cfg = dev->chip_info;
-
/* Enable DPTF based on mainboard configuration */
gnvs->dpte = cfg->dptf_enable;
@@ -158,7 +152,7 @@ int soc_madt_sci_irq_polarity(int sci)
void soc_fill_fadt(acpi_fadt_t *fadt)
{
const struct soc_intel_apollolake_config *cfg;
- struct device *dev = SA_DEV_ROOT;
+ cfg = config_of_path(SA_DEVFN_ROOT);
fadt->pm_tmr_blk = ACPI_BASE_ADDRESS + PM1_TMR;
@@ -174,13 +168,8 @@ void soc_fill_fadt(acpi_fadt_t *fadt)
fadt->x_pm_tmr_blk.bit_width = fadt->pm_tmr_len * 8;
fadt->x_pm_tmr_blk.addrl = ACPI_BASE_ADDRESS + PM1_TMR;
- if (!dev || !dev->chip_info) {
- printk(BIOS_ERR, "BUG! Could not find SOC devicetree config\n");
- return;
- }
- cfg = dev->chip_info;
- if(cfg->lpss_s0ix_enable)
+ if (cfg->lpss_s0ix_enable)
fadt->flags |= ACPI_FADT_LOW_PWR_IDLE_S0;
}
diff --git a/src/soc/intel/apollolake/chip.c b/src/soc/intel/apollolake/chip.c
index 1d5e6d95ba..3c4bf968e9 100644
--- a/src/soc/intel/apollolake/chip.c
+++ b/src/soc/intel/apollolake/chip.c
@@ -295,24 +295,18 @@ static void pcie_override_devicetree_after_silicon_init(void)
static void set_power_limits(void)
{
static struct soc_intel_apollolake_config *cfg;
- struct device *dev = SA_DEV_ROOT;
msr_t rapl_msr_reg, limit;
uint32_t power_unit;
uint32_t tdp, min_power, max_power;
uint32_t pl2_val;
+ cfg = config_of_path(SA_DEVFN_ROOT);
+
if (CONFIG(APL_SKIP_SET_POWER_LIMITS)) {
printk(BIOS_INFO, "Skip the RAPL settings.\n");
return;
}
- if (!dev || !dev->chip_info) {
- printk(BIOS_ERR, "BUG! Could not find SOC devicetree config\n");
- return;
- }
-
- cfg = dev->chip_info;
-
/* Get units */
rapl_msr_reg = rdmsr(MSR_PKG_POWER_SKU_UNIT);
power_unit = 1 << (rapl_msr_reg.lo & 0xf);
@@ -368,15 +362,9 @@ static void set_power_limits(void)
static void set_sci_irq(void)
{
static struct soc_intel_apollolake_config *cfg;
- struct device *dev = SA_DEV_ROOT;
uint32_t scis;
- if (!dev || !dev->chip_info) {
- printk(BIOS_ERR, "BUG! Could not find SOC devicetree config\n");
- return;
- }
-
- cfg = dev->chip_info;
+ cfg = config_of_path(SA_DEVFN_ROOT);
/* Change only if a device tree entry exists. */
if (cfg->sci_irq) {
@@ -550,7 +538,7 @@ static void disable_dev(struct device *dev, FSP_S_CONFIG *silconfig)
static void parse_devicetree(FSP_S_CONFIG *silconfig)
{
- struct device *dev = SA_DEV_ROOT;
+ struct device *dev = pcidev_path_on_root(SA_DEVFN_ROOT);
if (!dev) {
printk(BIOS_ERR, "Could not find root device\n");
@@ -679,21 +667,16 @@ void platform_fsp_silicon_init_params_cb(FSPS_UPD *silupd)
{
FSP_S_CONFIG *silconfig = &silupd->FspsConfig;
static struct soc_intel_apollolake_config *cfg;
+ struct device *dev;
/* Load VBT before devicetree-specific config. */
silconfig->GraphicsConfigPtr = (uintptr_t)vbt_get();
- struct device *dev = SA_DEV_ROOT;
-
- if (!dev || !dev->chip_info) {
- printk(BIOS_ERR, "BUG! Could not find SOC devicetree config\n");
- return;
- }
+ dev = pcidev_path_on_root(SA_DEVFN_ROOT);
+ cfg = config_of(dev);
mainboard_devtree_update(dev);
- cfg = dev->chip_info;
-
/* Parse device tree and disable unused device*/
parse_devicetree(silconfig);
diff --git a/src/soc/intel/apollolake/cpu.c b/src/soc/intel/apollolake/cpu.c
index aad0f6b522..625d956ea7 100644
--- a/src/soc/intel/apollolake/cpu.c
+++ b/src/soc/intel/apollolake/cpu.c
@@ -295,14 +295,7 @@ void cpu_lock_sgx_memory(void)
int soc_fill_sgx_param(struct sgx_param *sgx_param)
{
- struct device *dev = SA_DEV_ROOT;
- assert(dev != NULL);
- config_t *conf = dev->chip_info;
-
- if (!conf) {
- printk(BIOS_ERR, "Failed to get chip_info for SGX param\n");
- return -1;
- }
+ config_t *conf = config_of_path(SA_DEVFN_ROOT);
sgx_param->enable = conf->sgx_enable;
return 0;
diff --git a/src/soc/intel/apollolake/pmutil.c b/src/soc/intel/apollolake/pmutil.c
index 1bf3202f27..84b61da6b1 100644
--- a/src/soc/intel/apollolake/pmutil.c
+++ b/src/soc/intel/apollolake/pmutil.c
@@ -148,13 +148,7 @@ void soc_get_gpi_gpe_configs(uint8_t *dw0, uint8_t *dw1, uint8_t *dw2)
{
DEVTREE_CONST struct soc_intel_apollolake_config *config;
- /* Look up the device in devicetree */
- DEVTREE_CONST struct device *dev = pcidev_path_on_root(SA_DEVFN_ROOT);
- if (!dev || !dev->chip_info) {
- printk(BIOS_ERR, "BUG! Could not find SOC devicetree config\n");
- return;
- }
- config = dev->chip_info;
+ config = config_of_path(SA_DEVFN_ROOT);
/* Assign to out variable */
*dw0 = config->gpe0_dw1;
diff --git a/src/soc/intel/apollolake/pnpconfig.c b/src/soc/intel/apollolake/pnpconfig.c
index f9d493ed3e..0e9e93118a 100644
--- a/src/soc/intel/apollolake/pnpconfig.c
+++ b/src/soc/intel/apollolake/pnpconfig.c
@@ -37,8 +37,10 @@ static void pnp_settings(void *unused)
int index;
size_t arrsize;
const struct pnpconfig *pnpconfigarr;
- struct device *dev = SA_DEV_ROOT;
- struct soc_intel_apollolake_config *config = dev->chip_info;
+ struct soc_intel_apollolake_config *config;
+
+ config = config_of_path(SA_DEVFN_ROOT);
+
switch (config->pnp_settings) {
case PNP_PERF:
pnpconfigarr = perf;
diff --git a/src/soc/intel/apollolake/romstage.c b/src/soc/intel/apollolake/romstage.c
index 72a566a763..6d3b346582 100644
--- a/src/soc/intel/apollolake/romstage.c
+++ b/src/soc/intel/apollolake/romstage.c
@@ -100,17 +100,8 @@ static void soc_early_romstage_init(void)
/* Thermal throttle activation offset */
static void configure_thermal_target(void)
{
- const struct device *dev = pcidev_path_on_root(SA_DEVFN_ROOT);
- if (!dev) {
- printk(BIOS_ERR, "Could not find SOC devicetree config\n");
- return;
- }
- const config_t *conf = dev->chip_info;
- if (!dev->chip_info) {
- printk(BIOS_ERR, "Could not find chip info\n");
- return;
- }
msr_t msr;
+ const config_t *conf = config_of_path(SA_DEVFN_ROOT);
if (!conf->tcc_offset)
return;