ACPI: Replace uses of CBMEM_ID_ACPI_GNVS

These are the simple cbmem_find() cases. Also drop the redundant
error messages.

Change-Id: I78e5445eb09c322ff94fe4f65345eb2997bd10ef
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/42361
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Kyösti Mälkki 2020-06-14 12:01:58 +03:00 committed by Patrick Georgi
parent e37459ed64
commit 5daa1d3898
18 changed files with 47 additions and 62 deletions

View File

@ -5,9 +5,9 @@
#include <device/device.h>
#include <device/mmio.h>
#include <acpi/acpi.h>
#include <acpi/acpi_gnvs.h>
#include <amdblocks/agesawrapper.h>
#include <amdblocks/amd_pci_util.h>
#include <cbmem.h>
#include <baseboard/variants.h>
#include <boardid.h>
#include <smbios.h>
@ -165,7 +165,7 @@ static void mainboard_final(void *chip_info)
{
struct global_nvs_t *gnvs;
gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);
gnvs = acpi_get_gnvs();
if (gnvs) {
gnvs->tmps = CTL_TDP_SENSOR_ID;

View File

@ -6,9 +6,9 @@
#include <device/device.h>
#include <device/mmio.h>
#include <acpi/acpi.h>
#include <acpi/acpi_gnvs.h>
#include <amdblocks/amd_pci_util.h>
#include <amdblocks/gpio_banks.h>
#include <cbmem.h>
#include <baseboard/variants.h>
#include <boardid.h>
#include <gpio.h>
@ -196,7 +196,7 @@ static void mainboard_final(void *chip_info)
{
struct global_nvs_t *gnvs;
gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);
gnvs = acpi_get_gnvs();
reset_backlight_gpio(NULL);

View File

@ -10,6 +10,7 @@
#include <device/pci.h>
#include <device/pci_ops.h>
#include <cbmem.h>
#include <acpi/acpi_gnvs.h>
#include <amdblocks/amd_pci_util.h>
#include <amdblocks/reset.h>
#include <amdblocks/acpimmio.h>
@ -308,7 +309,7 @@ static void set_nvs_sws(void *unused)
sws = cbmem_find(CBMEM_ID_POWER_STATE);
if (sws == NULL)
return;
gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);
gnvs = acpi_get_gnvs();
if (gnvs == NULL)
return;
@ -336,7 +337,7 @@ void southbridge_init(void *chip_info)
static void set_sb_final_nvs(void)
{
struct global_nvs_t *gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);
struct global_nvs_t *gnvs = acpi_get_gnvs();
if (gnvs == NULL)
return;

View File

@ -8,6 +8,7 @@
#include <device/pci.h>
#include <device/pci_ops.h>
#include <cbmem.h>
#include <acpi/acpi_gnvs.h>
#include <amdblocks/amd_pci_util.h>
#include <amdblocks/agesawrapper.h>
#include <amdblocks/reset.h>
@ -542,7 +543,7 @@ static void set_nvs_sws(void *unused)
sws = cbmem_find(CBMEM_ID_POWER_STATE);
if (sws == NULL)
return;
gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);
gnvs = acpi_get_gnvs();
if (gnvs == NULL)
return;
@ -575,7 +576,7 @@ static void set_sb_final_nvs(void)
size_t fwsize;
const struct device *sd, *sata;
struct global_nvs_t *gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);
struct global_nvs_t *gnvs = acpi_get_gnvs();
if (gnvs == NULL)
return;

View File

@ -2,7 +2,7 @@
#include <device/mmio.h>
#include <device/pci_ops.h>
#include <cbmem.h>
#include <acpi/acpi_gnvs.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
@ -53,11 +53,9 @@ static void lpe_enable_acpi_mode(struct device *dev)
global_nvs_t *gnvs;
/* Find ACPI NVS to update BARs */
gnvs = (global_nvs_t *)cbmem_find(CBMEM_ID_ACPI_GNVS);
if (!gnvs) {
printk(BIOS_ERR, "Unable to locate Global NVS\n");
gnvs = acpi_get_gnvs();
if (!gnvs)
return;
}
/* Save BAR0, BAR1, and firmware base to ACPI NVS */
assign_device_nvs(dev, &gnvs->dev.lpe_bar0, PCI_BASE_ADDRESS_0);

View File

@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <stdint.h>
#include <cbmem.h>
#include <acpi/acpi_gnvs.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
@ -31,11 +31,9 @@ static void dev_enable_acpi_mode(struct device *dev, int iosf_reg,
global_nvs_t *gnvs;
/* Find ACPI NVS to update BARs */
gnvs = (global_nvs_t *)cbmem_find(CBMEM_ID_ACPI_GNVS);
if (!gnvs) {
printk(BIOS_ERR, "Unable to locate Global NVS\n");
gnvs = acpi_get_gnvs();
if (!gnvs)
return;
}
/* Save BAR0 and BAR1 to ACPI NVS */
bar = find_resource(dev, PCI_BASE_ADDRESS_0);

View File

@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <cbmem.h>
#include <acpi/acpi_gnvs.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
@ -84,11 +84,9 @@ void scc_enable_acpi_mode(struct device *dev, int iosf_reg, int nvs_index)
global_nvs_t *gnvs;
/* Find ACPI NVS to update BARs */
gnvs = (global_nvs_t *)cbmem_find(CBMEM_ID_ACPI_GNVS);
if (!gnvs) {
printk(BIOS_ERR, "Unable to locate Global NVS\n");
gnvs = acpi_get_gnvs();
if (!gnvs)
return;
}
/* Save BAR0 and BAR1 to ACPI NVS */
bar = find_resource(dev, PCI_BASE_ADDRESS_0);

View File

@ -2,7 +2,7 @@
#include <device/mmio.h>
#include <device/pci_ops.h>
#include <cbmem.h>
#include <acpi/acpi_gnvs.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
@ -56,11 +56,9 @@ static void lpe_enable_acpi_mode(struct device *dev)
global_nvs_t *gnvs;
/* Find ACPI NVS to update BARs */
gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);
if (!gnvs) {
printk(BIOS_ERR, "Unable to locate Global NVS\n");
gnvs = acpi_get_gnvs();
if (!gnvs)
return;
}
/* Save BAR0, BAR1, and firmware base to ACPI NVS */
assign_device_nvs(dev, &gnvs->dev.lpe_bar0, PCI_BASE_ADDRESS_0);

View File

@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <stdint.h>
#include <cbmem.h>
#include <acpi/acpi_gnvs.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
@ -30,11 +30,9 @@ static void dev_enable_acpi_mode(struct device *dev, int iosf_reg, int nvs_index
global_nvs_t *gnvs;
/* Find ACPI NVS to update BARs */
gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);
if (!gnvs) {
printk(BIOS_ERR, "Unable to locate Global NVS\n");
gnvs = acpi_get_gnvs();
if (!gnvs)
return;
}
/* Save BAR0 and BAR1 to ACPI NVS */
bar = find_resource(dev, PCI_BASE_ADDRESS_0);

View File

@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <cbmem.h>
#include <acpi/acpi_gnvs.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
@ -18,11 +18,9 @@ void scc_enable_acpi_mode(struct device *dev, int iosf_reg, int nvs_index)
__FILE__, __func__, dev_name(dev), iosf_reg, nvs_index);
/* Find ACPI NVS to update BARs */
gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);
if (!gnvs) {
printk(BIOS_ERR, "Unable to locate Global NVS\n");
gnvs = acpi_get_gnvs();
if (!gnvs)
return;
}
/* Save BAR0 and BAR1 to ACPI NVS */
bar = find_resource(dev, PCI_BASE_ADDRESS_0);

View File

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <cbmem.h>
#include <acpi/acpi_gnvs.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
@ -85,11 +85,9 @@ static void adsp_init(struct device *dev)
printk(BIOS_INFO, "ADSP: Enable ACPI Mode IRQ3\n");
/* Find ACPI NVS to update BARs */
gnvs = (global_nvs_t *)cbmem_find(CBMEM_ID_ACPI_GNVS);
if (!gnvs) {
printk(BIOS_ERR, "Unable to locate Global NVS\n");
gnvs = acpi_get_gnvs();
if (!gnvs)
return;
}
/* Save BAR0 and BAR1 to ACPI NVS */
gnvs->dev.bar0[SIO_NVS_ADSP] = (u32)bar0->base;

View File

@ -2,7 +2,7 @@
#include <device/mmio.h>
#include <device/pci_ops.h>
#include <cbmem.h>
#include <acpi/acpi_gnvs.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
@ -236,11 +236,9 @@ static void serialio_init(struct device *dev)
global_nvs_t *gnvs;
/* Find ACPI NVS to update BARs */
gnvs = (global_nvs_t *)cbmem_find(CBMEM_ID_ACPI_GNVS);
if (!gnvs) {
printk(BIOS_ERR, "Unable to locate Global NVS\n");
gnvs = acpi_get_gnvs();
if (!gnvs)
return;
}
/* Save BAR0 and BAR1 to ACPI NVS */
gnvs->dev.bar0[sio_index] = (u32)bar0->base;

View File

@ -1,8 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpi.h>
#include <acpi/acpi_gnvs.h>
#include <bootstate.h>
#include <cbmem.h>
#include <console/console.h>
#include <soc/nvs.h>
#include <stdint.h>
@ -16,7 +16,7 @@ __weak int soc_fill_acpi_wake(uint32_t *pm1, uint32_t **gpe0)
/* Save wake source data for ACPI _SWS methods in NVS */
static void acpi_save_wake_source(void *unused)
{
global_nvs_t *gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);
global_nvs_t *gnvs = acpi_get_gnvs();
uint32_t pm1, *gpe0;
int gpe_reg, gpe_reg_count;
int reg_size = sizeof(uint32_t) * 8;

View File

@ -6,6 +6,7 @@
#include <bootstate.h>
#include <cbmem.h>
#include <cf9_reset.h>
#include <acpi/acpi_gnvs.h>
#include <console/console.h>
#include <cpu/intel/turbo.h>
#include <cpu/x86/msr.h>
@ -456,7 +457,7 @@ void generate_cpu_entries(const struct device *device)
/* Save wake source data for ACPI _SWS methods in NVS */
static void acpi_save_wake_source(void *unused)
{
global_nvs_t *gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);
global_nvs_t *gnvs = acpi_get_gnvs();
uint32_t pm1, *gpe0;
int gpe_reg, gpe_reg_count;
int reg_size = sizeof(uint32_t) * 8;

View File

@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpi.h>
#include <cbmem.h>
#include <acpi/acpi_gnvs.h>
#include <console/uart.h>
#include <device/device.h>
#include <device/pci.h>
@ -167,7 +167,7 @@ static void uart_read_resources(struct device *dev)
*/
static bool pch_uart_init_debug_controller_on_resume(void)
{
global_nvs_t *gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);
global_nvs_t *gnvs = acpi_get_gnvs();
if (gnvs)
return !!gnvs->uior;

View File

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <cbmem.h>
#include <acpi/acpi_gnvs.h>
#include <nhlt.h>
#include <soc/nvs.h>
@ -15,7 +15,7 @@ uintptr_t nhlt_soc_serialize_oem_overrides(struct nhlt *nhlt,
{
global_nvs_t *gnvs;
gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);
gnvs = acpi_get_gnvs();
if (gnvs == NULL)
return acpi_addr;

View File

@ -1,8 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpi.h>
#include <acpi/acpi_gnvs.h>
#include <acpi/acpigen.h>
#include <cbmem.h>
#include <types.h>
#include <string.h>
#include <version.h>
@ -51,7 +51,7 @@ static void acpi_create_serialio_ssdt_entry(int id, global_nvs_t *gnvs)
void acpi_create_serialio_ssdt(acpi_header_t *ssdt)
{
unsigned long current = (unsigned long)ssdt + sizeof(acpi_header_t);
global_nvs_t *gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);
global_nvs_t *gnvs = acpi_get_gnvs();
int id;
if (!gnvs)

View File

@ -2,7 +2,7 @@
#include <device/mmio.h>
#include <device/pci_ops.h>
#include <cbmem.h>
#include <acpi/acpi_gnvs.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
@ -208,11 +208,9 @@ static void serialio_init(struct device *dev)
global_nvs_t *gnvs;
/* Find ACPI NVS to update BARs */
gnvs = (global_nvs_t *)cbmem_find(CBMEM_ID_ACPI_GNVS);
if (!gnvs) {
printk(BIOS_ERR, "Unable to locate Global NVS\n");
gnvs = acpi_get_gnvs();
if (!gnvs)
return;
}
/* Save BAR0 and BAR1 to ACPI NVS */
gnvs->s0b[sio_index] = (u32)bar0->base;