2020-04-05 15:46:45 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2015-05-06 00:07:29 +02:00
|
|
|
|
|
|
|
|
2020-06-14 11:01:58 +02:00
|
|
|
#include <acpi/acpi_gnvs.h>
|
2015-05-06 00:07:29 +02:00
|
|
|
#include <console/console.h>
|
|
|
|
#include <device/device.h>
|
|
|
|
#include <device/pci.h>
|
|
|
|
#include <soc/iosf.h>
|
|
|
|
#include <soc/nvs.h>
|
|
|
|
#include <soc/ramstage.h>
|
|
|
|
|
2018-05-24 22:29:44 +02:00
|
|
|
void scc_enable_acpi_mode(struct device *dev, int iosf_reg, int nvs_index)
|
2015-05-06 00:07:29 +02:00
|
|
|
{
|
|
|
|
struct resource *bar;
|
2020-06-17 22:37:49 +02:00
|
|
|
struct global_nvs *gnvs;
|
2015-05-06 00:07:29 +02:00
|
|
|
|
|
|
|
/* Find ACPI NVS to update BARs */
|
2020-06-14 11:01:58 +02:00
|
|
|
gnvs = acpi_get_gnvs();
|
|
|
|
if (!gnvs)
|
2015-05-06 00:07:29 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* Save BAR0 and BAR1 to ACPI NVS */
|
|
|
|
bar = find_resource(dev, PCI_BASE_ADDRESS_0);
|
|
|
|
if (bar)
|
2017-03-22 06:34:01 +01:00
|
|
|
gnvs->dev.scc_bar0[nvs_index] = bar->base;
|
|
|
|
bar = find_resource(dev, PCI_BASE_ADDRESS_2);
|
|
|
|
if (bar)
|
|
|
|
gnvs->dev.scc_bar1[nvs_index] = bar->base;
|
2015-05-06 00:07:29 +02:00
|
|
|
|
|
|
|
/* Device is enabled in ACPI mode */
|
|
|
|
gnvs->dev.scc_en[nvs_index] = 1;
|
|
|
|
}
|