soc/intel/*: Use SSDT to pass A4GB and A4GS

GNVS is more fragile as you need to keep struct elements in sync with
ASL code.

Change-Id: I2cd5e6b56e4a0dbbb11f4a0ac97e8f84d53b90ec
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64216
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
This commit is contained in:
Arthur Heymans 2022-05-09 14:33:15 +02:00
parent 159520ed78
commit 08769c6d14
25 changed files with 54 additions and 51 deletions

View File

@ -445,9 +445,6 @@ void soc_fill_gnvs(struct global_nvs *gnvs)
/* Set USB2/USB3 wake enable bitmaps. */ /* Set USB2/USB3 wake enable bitmaps. */
gnvs->u2we = config->usb2_wake_enable_bitmap; gnvs->u2we = config->usb2_wake_enable_bitmap;
gnvs->u3we = config->usb3_wake_enable_bitmap; gnvs->u3we = config->usb3_wake_enable_bitmap;
/* Fill in Above 4GB MMIO resource */
sa_fill_gnvs(gnvs);
} }
int soc_madt_sci_irq_polarity(int sci) int soc_madt_sci_irq_polarity(int sci)

View File

@ -11,6 +11,7 @@
#include <intelblocks/irq.h> #include <intelblocks/irq.h>
#include <intelblocks/itss.h> #include <intelblocks/itss.h>
#include <intelblocks/pcie_rp.h> #include <intelblocks/pcie_rp.h>
#include <intelblocks/systemagent.h>
#include <intelblocks/xdci.h> #include <intelblocks/xdci.h>
#include <soc/intel/common/vbt.h> #include <soc/intel/common/vbt.h>
#include <soc/itss.h> #include <soc/itss.h>
@ -188,6 +189,7 @@ static struct device_operations pci_domain_ops = {
.scan_bus = &pci_domain_scan_bus, .scan_bus = &pci_domain_scan_bus,
#if CONFIG(HAVE_ACPI_TABLES) #if CONFIG(HAVE_ACPI_TABLES)
.acpi_name = &soc_acpi_name, .acpi_name = &soc_acpi_name,
.acpi_fill_ssdt = ssdt_set_above_4g_pci,
#endif #endif
}; };

View File

@ -86,9 +86,6 @@ void soc_fill_gnvs(struct global_nvs *gnvs)
gnvs->scdp = gpio_get_pad_portid(cfg->sdcard_cd_gpio); gnvs->scdp = gpio_get_pad_portid(cfg->sdcard_cd_gpio);
gnvs->scdo = gpio_acpi_pin(cfg->sdcard_cd_gpio); gnvs->scdo = gpio_acpi_pin(cfg->sdcard_cd_gpio);
} }
/* Fill in Above 4GB MMIO resource */
sa_fill_gnvs(gnvs);
} }
int soc_madt_sci_irq_polarity(int sci) int soc_madt_sci_irq_polarity(int sci)

View File

@ -23,6 +23,4 @@ Field (GNVS, ByteAcc, NoLock, Preserve)
SCDP, 8, // 0x29 - SD_CD GPIO portid SCDP, 8, // 0x29 - SD_CD GPIO portid
SCDO, 8, // 0x2A - GPIO pad offset relative to the community SCDO, 8, // 0x2A - GPIO pad offset relative to the community
UIOR, 8, // 0x2B - UART debug controller init on S3 resume UIOR, 8, // 0x2B - UART debug controller init on S3 resume
A4GB, 64, // 0x2C - 0x33 Base of above 4GB MMIO Resource
A4GS, 64, // 0x34 - 0x3B Length of above 4GB MMIO Resource
} }

View File

@ -22,6 +22,9 @@ Device (MCHC)
} }
} }
External (A4GS, IntObj)
External (A4GB, IntObj)
/* Current Resource Settings */ /* Current Resource Settings */
Method (_CRS, 0, Serialized) Method (_CRS, 0, Serialized)
{ {

View File

@ -22,6 +22,7 @@
#include <intelblocks/gpio.h> #include <intelblocks/gpio.h>
#include <intelblocks/itss.h> #include <intelblocks/itss.h>
#include <intelblocks/pmclib.h> #include <intelblocks/pmclib.h>
#include <intelblocks/systemagent.h>
#include <option.h> #include <option.h>
#include <soc/cpu.h> #include <soc/cpu.h>
#include <soc/heci.h> #include <soc/heci.h>
@ -202,6 +203,7 @@ static struct device_operations pci_domain_ops = {
.set_resources = pci_domain_set_resources, .set_resources = pci_domain_set_resources,
.scan_bus = pci_domain_scan_bus, .scan_bus = pci_domain_scan_bus,
.acpi_name = &soc_acpi_name, .acpi_name = &soc_acpi_name,
.acpi_fill_ssdt = ssdt_set_above_4g_pci,
}; };
static struct device_operations cpu_bus_ops = { static struct device_operations cpu_bus_ops = {

View File

@ -28,8 +28,6 @@ struct __packed global_nvs {
uint8_t scdo; /* 0x2A - GPIO pad offset relative to the community */ uint8_t scdo; /* 0x2A - GPIO pad offset relative to the community */
uint8_t uior; /* 0x2B - UART debug controller init on S3 uint8_t uior; /* 0x2B - UART debug controller init on S3
resume */ resume */
uint64_t a4gb; /* 0x2C - 0x33 Base of above 4GB MMIO Resource */
uint64_t a4gs; /* 0x34 - 0x3B Length of above 4GB MMIO Resource */
}; };
#endif /* _SOC_APOLLOLAKE_NVS_H_ */ #endif /* _SOC_APOLLOLAKE_NVS_H_ */

View File

@ -179,9 +179,6 @@ void soc_fill_gnvs(struct global_nvs *gnvs)
/* Set USB2/USB3 wake enable bitmaps. */ /* Set USB2/USB3 wake enable bitmaps. */
gnvs->u2we = config->usb2_wake_enable_bitmap; gnvs->u2we = config->usb2_wake_enable_bitmap;
gnvs->u3we = config->usb3_wake_enable_bitmap; gnvs->u3we = config->usb3_wake_enable_bitmap;
/* Fill in Above 4GB MMIO resource */
sa_fill_gnvs(gnvs);
} }
int soc_madt_sci_irq_polarity(int sci) int soc_madt_sci_irq_polarity(int sci)

View File

@ -10,6 +10,7 @@
#include <intelblocks/irq.h> #include <intelblocks/irq.h>
#include <intelblocks/itss.h> #include <intelblocks/itss.h>
#include <intelblocks/pcie_rp.h> #include <intelblocks/pcie_rp.h>
#include <intelblocks/systemagent.h>
#include <intelblocks/xdci.h> #include <intelblocks/xdci.h>
#include <soc/intel/common/vbt.h> #include <soc/intel/common/vbt.h>
#include <soc/pci_devs.h> #include <soc/pci_devs.h>
@ -176,6 +177,7 @@ static struct device_operations pci_domain_ops = {
.scan_bus = &pci_domain_scan_bus, .scan_bus = &pci_domain_scan_bus,
#if CONFIG(HAVE_ACPI_TABLES) #if CONFIG(HAVE_ACPI_TABLES)
.acpi_name = &soc_acpi_name, .acpi_name = &soc_acpi_name,
.acpi_fill_ssdt = ssdt_set_above_4g_pci,
#endif #endif
}; };

View File

@ -22,7 +22,5 @@ Field (GNVS, ByteAcc, NoLock, Preserve)
U2WE, 16, // 0x2b - 0x2c USB2 Wake Enable Bitmap U2WE, 16, // 0x2b - 0x2c USB2 Wake Enable Bitmap
U3WE, 16, // 0x2d - 0x2e USB3 Wake Enable Bitmap U3WE, 16, // 0x2d - 0x2e USB3 Wake Enable Bitmap
UIOR, 8, // 0x2f - UART debug controller init on S3 resume UIOR, 8, // 0x2f - UART debug controller init on S3 resume
A4GB, 64, // 0x30 - 0x37 Base of above 4GB MMIO Resource , 64, // 0x30 - 0x37 Hest log buffer (used in SMM, not ASL code)
A4GS, 64, // 0x38 - 0x3f Length of above 4GB MMIO Resource
, 64, // 0x40 - 0x47 Hest log buffer (used in SMM, not ASL code)
} }

View File

@ -45,6 +45,9 @@ Device (MCHC)
} }
} }
External (A4GS, IntObj)
External (A4GB, IntObj)
Method (_CRS, 0, Serialized) Method (_CRS, 0, Serialized)
{ {
Name (MCRS, ResourceTemplate () Name (MCRS, ResourceTemplate ()

View File

@ -24,9 +24,7 @@ struct __packed global_nvs {
u16 u2we; /* 0x2b - 0x2c USB2 Wake Enable Bitmap */ u16 u2we; /* 0x2b - 0x2c USB2 Wake Enable Bitmap */
u16 u3we; /* 0x2d - 0x2e USB3 Wake Enable Bitmap */ u16 u3we; /* 0x2d - 0x2e USB3 Wake Enable Bitmap */
u8 uior; /* 0x2f - UART debug controller init on S3 resume */ u8 uior; /* 0x2f - UART debug controller init on S3 resume */
u64 a4gb; /* 0x30 - 0x37 Base of above 4GB MMIO Resource */ u64 hest_log_addr; /* 0x30 - 0x37 err log addr (used in SMM, not ASL code) */
u64 a4gs; /* 0x38 - 0x3f Length of above 4GB MMIO Resource */
u64 hest_log_addr; /* 0x40 - 47 err log addr (used in SMM, not ASL code) */
}; };
#endif #endif

View File

@ -77,8 +77,6 @@ uintptr_t sa_get_gsm_base(void);
uintptr_t sa_get_tseg_base(void); uintptr_t sa_get_tseg_base(void);
/* API to get TSEG size */ /* API to get TSEG size */
size_t sa_get_tseg_size(void); size_t sa_get_tseg_size(void);
/* Fill MMIO resource above 4GB into GNVS */
void sa_fill_gnvs(struct global_nvs *gnvs);
/* API to lock PAM registers */ /* API to lock PAM registers */
void sa_lock_pam(void); void sa_lock_pam(void);
@ -104,4 +102,7 @@ int soc_get_uncore_prmmr_base_and_mask(uint64_t *base, uint64_t *mask);
/* Returns the maximum supported capacity of a channel as encoded by DDRSZ in MiB */ /* Returns the maximum supported capacity of a channel as encoded by DDRSZ in MiB */
uint32_t soc_systemagent_max_chan_capacity_mib(u8 capid0_a_ddrsz); uint32_t soc_systemagent_max_chan_capacity_mib(u8 capid0_a_ddrsz);
/* To be called in the acpi_fill_ssdt op of the domain */
void ssdt_set_above_4g_pci(const struct device *dev);
#endif /* SOC_INTEL_COMMON_BLOCK_SA_H */ #endif /* SOC_INTEL_COMMON_BLOCK_SA_H */

View File

@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpigen.h>
#include <cbmem.h> #include <cbmem.h>
#include <console/console.h> #include <console/console.h>
#include <cpu/cpu.h> #include <cpu/cpu.h>
@ -119,7 +120,7 @@ static const struct sa_mem_map_descriptor sa_memory_map[MAX_MAP_ENTRIES] = {
}; };
/* Read DRAM memory map register value through PCI configuration space */ /* Read DRAM memory map register value through PCI configuration space */
static void sa_read_map_entry(struct device *dev, static void sa_read_map_entry(const struct device *dev,
const struct sa_mem_map_descriptor *entry, uint64_t *result) const struct sa_mem_map_descriptor *entry, uint64_t *result)
{ {
uint64_t value = 0; uint64_t value = 0;
@ -136,17 +137,6 @@ static void sa_read_map_entry(struct device *dev,
*result = value; *result = value;
} }
/* Fill MMIO resource above 4GB into GNVS */
void sa_fill_gnvs(struct global_nvs *gnvs)
{
struct device *sa_dev = pcidev_path_on_root(SA_DEVFN_ROOT);
sa_read_map_entry(sa_dev, &sa_memory_map[SA_TOUUD_REG], &gnvs->a4gb);
gnvs->a4gs = POWER_OF_2(cpu_phys_address_size()) - gnvs->a4gb;
printk(BIOS_DEBUG, "PCI space above 4GB MMIO is at 0x%llx, len = 0x%llx\n",
gnvs->a4gb, gnvs->a4gs);
}
static void sa_get_mem_map(struct device *dev, uint64_t *values) static void sa_get_mem_map(struct device *dev, uint64_t *values)
{ {
int i; int i;
@ -315,6 +305,25 @@ void sa_lock_pam(void)
pci_or_config8(dev, PAM0, PAM_LOCK); pci_or_config8(dev, PAM0, PAM_LOCK);
} }
void ssdt_set_above_4g_pci(const struct device *dev)
{
if (dev->path.type != DEVICE_PATH_DOMAIN)
return;
uint64_t touud;
sa_read_map_entry(pcidev_path_on_root(SA_DEVFN_ROOT), &sa_memory_map[SA_TOUUD_REG],
&touud);
const uint64_t len = POWER_OF_2(cpu_phys_address_size()) - touud;
const char *scope = acpi_device_path(dev);
acpigen_write_scope(scope);
acpigen_write_name_qword("A4GB", touud);
acpigen_write_name_qword("A4GS", len);
acpigen_pop_len();
printk(BIOS_DEBUG, "PCI space above 4GB MMIO is at 0x%llx, len = 0x%llx\n", touud, len);
}
static struct device_operations systemagent_ops = { static struct device_operations systemagent_ops = {
.read_resources = systemagent_read_resources, .read_resources = systemagent_read_resources,
.set_resources = pci_dev_set_resources, .set_resources = pci_dev_set_resources,

View File

@ -243,9 +243,6 @@ void soc_fill_gnvs(struct global_nvs *gnvs)
/* Set USB2/USB3 wake enable bitmaps. */ /* Set USB2/USB3 wake enable bitmaps. */
gnvs->u2we = config->usb2_wake_enable_bitmap; gnvs->u2we = config->usb2_wake_enable_bitmap;
gnvs->u3we = config->usb3_wake_enable_bitmap; gnvs->u3we = config->usb3_wake_enable_bitmap;
/* Fill in Above 4GB MMIO resource */
sa_fill_gnvs(gnvs);
} }
int soc_madt_sci_irq_polarity(int sci) int soc_madt_sci_irq_polarity(int sci)

View File

@ -9,6 +9,7 @@
#include <intelblocks/gpio.h> #include <intelblocks/gpio.h>
#include <intelblocks/itss.h> #include <intelblocks/itss.h>
#include <intelblocks/pcie_rp.h> #include <intelblocks/pcie_rp.h>
#include <intelblocks/systemagent.h>
#include <intelblocks/xdci.h> #include <intelblocks/xdci.h>
#include <soc/intel/common/vbt.h> #include <soc/intel/common/vbt.h>
#include <soc/itss.h> #include <soc/itss.h>
@ -134,6 +135,7 @@ static struct device_operations pci_domain_ops = {
.scan_bus = &pci_domain_scan_bus, .scan_bus = &pci_domain_scan_bus,
#if CONFIG(HAVE_ACPI_TABLES) #if CONFIG(HAVE_ACPI_TABLES)
.acpi_name = &soc_acpi_name, .acpi_name = &soc_acpi_name,
.acpi_fill_ssdt = ssdt_set_above_4g_pci,
#endif #endif
}; };

View File

@ -174,9 +174,6 @@ void soc_fill_gnvs(struct global_nvs *gnvs)
/* Set USB2/USB3 wake enable bitmaps. */ /* Set USB2/USB3 wake enable bitmaps. */
gnvs->u2we = config->usb2_wake_enable_bitmap; gnvs->u2we = config->usb2_wake_enable_bitmap;
gnvs->u3we = config->usb3_wake_enable_bitmap; gnvs->u3we = config->usb3_wake_enable_bitmap;
/* Fill in Above 4GB MMIO resource */
sa_fill_gnvs(gnvs);
} }
int soc_madt_sci_irq_polarity(int sci) int soc_madt_sci_irq_polarity(int sci)

View File

@ -8,6 +8,7 @@
#include <intelblocks/cfg.h> #include <intelblocks/cfg.h>
#include <intelblocks/gpio.h> #include <intelblocks/gpio.h>
#include <intelblocks/itss.h> #include <intelblocks/itss.h>
#include <intelblocks/systemagent.h>
#include <intelblocks/xdci.h> #include <intelblocks/xdci.h>
#include <soc/intel/common/vbt.h> #include <soc/intel/common/vbt.h>
#include <soc/itss.h> #include <soc/itss.h>
@ -124,9 +125,10 @@ static struct device_operations pci_domain_ops = {
.read_resources = &pci_domain_read_resources, .read_resources = &pci_domain_read_resources,
.set_resources = &pci_domain_set_resources, .set_resources = &pci_domain_set_resources,
.scan_bus = &pci_domain_scan_bus, .scan_bus = &pci_domain_scan_bus,
#if CONFIG(HAVE_ACPI_TABLES) #if CONFIG(HAVE_ACPI_TABLES)
.acpi_name = &soc_acpi_name, .acpi_name = &soc_acpi_name,
#endif .acpi_fill_ssdt = ssdt_set_above_4g_pci,
#endif
}; };
static struct device_operations cpu_bus_ops = { static struct device_operations cpu_bus_ops = {

View File

@ -254,9 +254,6 @@ void soc_fill_gnvs(struct global_nvs *gnvs)
/* Set USB2/USB3 wake enable bitmaps. */ /* Set USB2/USB3 wake enable bitmaps. */
gnvs->u2we = config->usb2_wake_enable_bitmap; gnvs->u2we = config->usb2_wake_enable_bitmap;
gnvs->u3we = config->usb3_wake_enable_bitmap; gnvs->u3we = config->usb3_wake_enable_bitmap;
/* Fill in Above 4GB MMIO resource */
sa_fill_gnvs(gnvs);
} }
int soc_madt_sci_irq_polarity(int sci) int soc_madt_sci_irq_polarity(int sci)

View File

@ -9,6 +9,7 @@
#include <intelblocks/gpio.h> #include <intelblocks/gpio.h>
#include <intelblocks/itss.h> #include <intelblocks/itss.h>
#include <intelblocks/pcie_rp.h> #include <intelblocks/pcie_rp.h>
#include <intelblocks/systemagent.h>
#include <intelblocks/xdci.h> #include <intelblocks/xdci.h>
#include <soc/intel/common/vbt.h> #include <soc/intel/common/vbt.h>
#include <soc/itss.h> #include <soc/itss.h>
@ -138,6 +139,7 @@ static struct device_operations pci_domain_ops = {
.scan_bus = &pci_domain_scan_bus, .scan_bus = &pci_domain_scan_bus,
#if CONFIG(HAVE_ACPI_TABLES) #if CONFIG(HAVE_ACPI_TABLES)
.acpi_name = &soc_acpi_name, .acpi_name = &soc_acpi_name,
.acpi_fill_ssdt = ssdt_set_above_4g_pci,
#endif #endif
}; };

View File

@ -176,9 +176,6 @@ void soc_fill_gnvs(struct global_nvs *gnvs)
/* Set USB2/USB3 wake enable bitmaps. */ /* Set USB2/USB3 wake enable bitmaps. */
gnvs->u2we = config->usb2_wake_enable_bitmap; gnvs->u2we = config->usb2_wake_enable_bitmap;
gnvs->u3we = config->usb3_wake_enable_bitmap; gnvs->u3we = config->usb3_wake_enable_bitmap;
/* Fill in Above 4GB MMIO resource */
sa_fill_gnvs(gnvs);
} }
static unsigned long soc_fill_dmar(unsigned long current) static unsigned long soc_fill_dmar(unsigned long current)

View File

@ -48,6 +48,9 @@ Device (MCHC)
} }
} }
External (A4GS, IntObj)
External (A4GB, IntObj)
Method (_CRS, 0, Serialized) Method (_CRS, 0, Serialized)
{ {
Name (MCRS, ResourceTemplate () Name (MCRS, ResourceTemplate ()

View File

@ -17,6 +17,7 @@
#include <intelblocks/power_limit.h> #include <intelblocks/power_limit.h>
#include <intelblocks/xdci.h> #include <intelblocks/xdci.h>
#include <intelblocks/p2sb.h> #include <intelblocks/p2sb.h>
#include <intelblocks/systemagent.h>
#include <intelpch/lockdown.h> #include <intelpch/lockdown.h>
#include <soc/intel/common/vbt.h> #include <soc/intel/common/vbt.h>
#include <soc/interrupt.h> #include <soc/interrupt.h>
@ -190,7 +191,8 @@ static struct device_operations pci_domain_ops = {
.set_resources = &pci_domain_set_resources, .set_resources = &pci_domain_set_resources,
.scan_bus = &pci_domain_scan_bus, .scan_bus = &pci_domain_scan_bus,
#if CONFIG(HAVE_ACPI_TABLES) #if CONFIG(HAVE_ACPI_TABLES)
.acpi_name = &soc_acpi_name, .acpi_name = &soc_acpi_name,
.acpi_fill_ssdt = ssdt_set_above_4g_pci,
#endif #endif
}; };

View File

@ -269,9 +269,6 @@ void soc_fill_gnvs(struct global_nvs *gnvs)
/* Set USB2/USB3 wake enable bitmaps. */ /* Set USB2/USB3 wake enable bitmaps. */
gnvs->u2we = config->usb2_wake_enable_bitmap; gnvs->u2we = config->usb2_wake_enable_bitmap;
gnvs->u3we = config->usb3_wake_enable_bitmap; gnvs->u3we = config->usb3_wake_enable_bitmap;
/* Fill in Above 4GB MMIO resource */
sa_fill_gnvs(gnvs);
} }
int soc_madt_sci_irq_polarity(int sci) int soc_madt_sci_irq_polarity(int sci)

View File

@ -10,6 +10,7 @@
#include <intelblocks/irq.h> #include <intelblocks/irq.h>
#include <intelblocks/itss.h> #include <intelblocks/itss.h>
#include <intelblocks/pcie_rp.h> #include <intelblocks/pcie_rp.h>
#include <intelblocks/systemagent.h>
#include <intelblocks/xdci.h> #include <intelblocks/xdci.h>
#include <soc/intel/common/vbt.h> #include <soc/intel/common/vbt.h>
#include <soc/itss.h> #include <soc/itss.h>
@ -180,6 +181,7 @@ static struct device_operations pci_domain_ops = {
.scan_bus = &pci_domain_scan_bus, .scan_bus = &pci_domain_scan_bus,
#if CONFIG(HAVE_ACPI_TABLES) #if CONFIG(HAVE_ACPI_TABLES)
.acpi_name = &soc_acpi_name, .acpi_name = &soc_acpi_name,
.acpi_fill_ssdt = ssdt_set_above_4g_pci,
#endif #endif
}; };