blob: 8894aa5c758b039abecb930ba8bb5b294c90bf81 [file] [log] [blame]
Angel Ponsba38f372020-04-05 15:46:45 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Lee Leahy77ff0b12015-05-05 15:07:29 -07002
Kyösti Mälkki5daa1d32020-06-14 12:01:58 +03003#include <acpi/acpi_gnvs.h>
Lee Leahy77ff0b12015-05-05 15:07:29 -07004#include <device/device.h>
5#include <device/pci.h>
Lee Leahy77ff0b12015-05-05 15:07:29 -07006#include <soc/iosf.h>
Kyösti Mälkki4abc7312021-01-12 17:46:30 +02007#include <soc/device_nvs.h>
Lee Leahy77ff0b12015-05-05 15:07:29 -07008#include <soc/ramstage.h>
9
Elyes HAOUASb13fac32018-05-24 22:29:44 +020010void scc_enable_acpi_mode(struct device *dev, int iosf_reg, int nvs_index)
Lee Leahy77ff0b12015-05-05 15:07:29 -070011{
Lee Leahy77ff0b12015-05-05 15:07:29 -070012 struct resource *bar;
Kyösti Mälkki4abc7312021-01-12 17:46:30 +020013 struct device_nvs *dev_nvs = acpi_get_device_nvs();
Lee Leahy77ff0b12015-05-05 15:07:29 -070014
15 /* Save BAR0 and BAR1 to ACPI NVS */
Angel Ponsc1bfbe02021-11-03 13:18:53 +010016 bar = probe_resource(dev, PCI_BASE_ADDRESS_0);
Lee Leahy77ff0b12015-05-05 15:07:29 -070017 if (bar)
Kyösti Mälkki4abc7312021-01-12 17:46:30 +020018 dev_nvs->scc_bar0[nvs_index] = bar->base;
Angel Ponsc1bfbe02021-11-03 13:18:53 +010019 bar = probe_resource(dev, PCI_BASE_ADDRESS_2);
Hannah Williamsad8669ef2017-03-21 22:34:01 -070020 if (bar)
Kyösti Mälkki4abc7312021-01-12 17:46:30 +020021 dev_nvs->scc_bar1[nvs_index] = bar->base;
Lee Leahy77ff0b12015-05-05 15:07:29 -070022
Lee Leahy77ff0b12015-05-05 15:07:29 -070023 /* Device is enabled in ACPI mode */
Kyösti Mälkki4abc7312021-01-12 17:46:30 +020024 dev_nvs->scc_en[nvs_index] = 1;
Lee Leahy77ff0b12015-05-05 15:07:29 -070025}