2020-04-04 18:50:57 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2019-04-22 22:55:16 +02:00
|
|
|
|
2021-01-29 16:13:06 +01:00
|
|
|
#include <acpi/acpi.h>
|
2020-04-16 07:52:35 +02:00
|
|
|
#include <console/console.h>
|
2019-04-22 22:55:16 +02:00
|
|
|
#include <device/device.h>
|
|
|
|
#include <device/pci.h>
|
|
|
|
#include <drivers/i2c/designware/dw_i2c.h>
|
|
|
|
#include <soc/acpi.h>
|
|
|
|
#include <soc/cpu.h>
|
2020-05-12 00:26:35 +02:00
|
|
|
#include <soc/data_fabric.h>
|
2020-06-04 01:22:20 +02:00
|
|
|
#include <soc/iomap.h>
|
2019-04-22 22:55:16 +02:00
|
|
|
#include <soc/pci_devs.h>
|
|
|
|
#include <soc/southbridge.h>
|
|
|
|
#include "chip.h"
|
2020-01-21 07:05:31 +01:00
|
|
|
#include <fsp/api.h>
|
2019-04-22 22:55:16 +02:00
|
|
|
|
|
|
|
/* Supplied by i2c.c */
|
2019-06-11 20:18:20 +02:00
|
|
|
extern struct device_operations picasso_i2c_mmio_ops;
|
2020-06-04 01:50:32 +02:00
|
|
|
/* Supplied by uart.c */
|
|
|
|
extern struct device_operations picasso_uart_mmio_ops;
|
2019-04-22 22:55:16 +02:00
|
|
|
|
|
|
|
struct device_operations cpu_bus_ops = {
|
2020-04-05 14:05:24 +02:00
|
|
|
.read_resources = noop_read_resources,
|
|
|
|
.set_resources = noop_set_resources,
|
2020-05-31 08:21:07 +02:00
|
|
|
.init = mp_cpu_bus_init,
|
2020-03-31 17:34:52 +02:00
|
|
|
.acpi_fill_ssdt = generate_cpu_entries,
|
2019-04-22 22:55:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
const char *soc_acpi_name(const struct device *dev)
|
|
|
|
{
|
|
|
|
if (dev->path.type == DEVICE_PATH_DOMAIN)
|
|
|
|
return "PCI0";
|
|
|
|
|
|
|
|
if (dev->path.type != DEVICE_PATH_PCI)
|
|
|
|
return NULL;
|
|
|
|
|
2020-04-16 07:52:35 +02:00
|
|
|
if (dev->bus->dev->path.type == DEVICE_PATH_DOMAIN) {
|
|
|
|
switch (dev->path.pci.devfn) {
|
|
|
|
case GNB_DEVFN:
|
|
|
|
return "GNB";
|
|
|
|
case IOMMU_DEVFN:
|
|
|
|
return "IOMM";
|
|
|
|
case LPC_DEVFN:
|
|
|
|
return "LPCB";
|
|
|
|
case SMBUS_DEVFN:
|
|
|
|
return "SBUS";
|
|
|
|
default:
|
|
|
|
printk(BIOS_WARNING, "Unknown root PCI device: dev: %d, fn: %d\n",
|
|
|
|
PCI_SLOT(dev->path.pci.devfn), PCI_FUNC(dev->path.pci.devfn));
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
printk(BIOS_WARNING, "Unknown PCI device: dev: %d, fn: %d\n",
|
|
|
|
PCI_SLOT(dev->path.pci.devfn), PCI_FUNC(dev->path.pci.devfn));
|
|
|
|
return NULL;
|
2019-04-22 22:55:16 +02:00
|
|
|
};
|
|
|
|
|
2020-12-05 01:29:38 +01:00
|
|
|
static struct device_operations pci_domain_ops = {
|
2019-04-22 22:55:16 +02:00
|
|
|
.read_resources = pci_domain_read_resources,
|
2020-05-05 00:41:22 +02:00
|
|
|
.set_resources = pci_domain_set_resources,
|
2019-04-22 22:55:16 +02:00
|
|
|
.scan_bus = pci_domain_scan_bus,
|
|
|
|
.acpi_name = soc_acpi_name,
|
|
|
|
};
|
|
|
|
|
2020-06-04 01:22:20 +02:00
|
|
|
static void set_mmio_dev_ops(struct device *dev)
|
|
|
|
{
|
|
|
|
switch (dev->path.mmio.addr) {
|
|
|
|
case APU_I2C2_BASE:
|
|
|
|
case APU_I2C3_BASE:
|
|
|
|
case APU_I2C4_BASE:
|
|
|
|
dev->ops = &picasso_i2c_mmio_ops;
|
|
|
|
break;
|
2020-06-04 01:50:32 +02:00
|
|
|
case APU_UART0_BASE:
|
|
|
|
case APU_UART1_BASE:
|
|
|
|
case APU_UART2_BASE:
|
|
|
|
case APU_UART3_BASE:
|
|
|
|
dev->ops = &picasso_uart_mmio_ops;
|
|
|
|
break;
|
2020-06-04 01:22:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-22 22:55:16 +02:00
|
|
|
static void enable_dev(struct device *dev)
|
|
|
|
{
|
|
|
|
/* Set the operations if it is a special bus type */
|
2021-01-26 18:05:21 +01:00
|
|
|
switch (dev->path.type) {
|
|
|
|
case DEVICE_PATH_DOMAIN:
|
2019-04-22 22:55:16 +02:00
|
|
|
dev->ops = &pci_domain_ops;
|
2021-01-26 18:05:21 +01:00
|
|
|
break;
|
|
|
|
case DEVICE_PATH_CPU_CLUSTER:
|
2019-04-22 22:55:16 +02:00
|
|
|
dev->ops = &cpu_bus_ops;
|
2021-01-26 18:05:21 +01:00
|
|
|
break;
|
|
|
|
case DEVICE_PATH_MMIO:
|
2020-06-04 01:22:20 +02:00
|
|
|
set_mmio_dev_ops(dev);
|
2021-01-26 18:05:21 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2020-05-20 00:13:06 +02:00
|
|
|
}
|
2019-04-22 22:55:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void soc_init(void *chip_info)
|
|
|
|
{
|
soc/amd/picasso: Install AGESA ACPI tables
AGESA FSP provides additional ACPI tables that are required.
BUG=b:133337564, b:153675915
TEST=Boot trembyle to OS and dump ACPI tables.
ACPI: added table 2/32, length now 44
ACPI: * MCFG
ACPI: added table 3/32, length now 48
ACPI: * TPM2
TPM2 log created at 0xcc513000
ACPI: added table 4/32, length now 52
ACPI: * MADT
ACPI: added table 5/32, length now 56
current = cc635af0
Searching for AGESA FSP ACPI Tables
ACPI: * SSDT (AGESA).
ACPI: added table 6/32, length now 60
ACPI: * CRAT (AGESA).
ACPI: added table 7/32, length now 64
ACPI: * ALIB (AGESA).
ACPI: added table 8/32, length now 68
ACPI: * IVRS (AGESA).
ACPI: added table 9/32, length now 72
ACPI: * HPET
ACPI: added table 10/32, length now 76
Copying initialized VBIOS image from 0x000c0000
ACPI: * VFCT at cc63ca30
ACPI: added table 11/32, length now 80
ACPI: done.
ACPI tables: 102048 bytes.
[ 0.042326] ACPI: Early table checksum verification disabled
[ 0.048621] ACPI: RSDP 0x00000000000F0000 000024 (v02 COREv4)
[ 0.055011] ACPI: XSDT 0x00000000CC6310E0 00007C (v01 COREv4 COREBOOT 00000000 CORE 20200110)
[ 0.064506] ACPI: FACP 0x00000000CC634850 000114 (v06 COREv4 COREBOOT 00000000 CORE 20200110)
[ 0.073998] ACPI: DSDT 0x00000000CC631280 0035CF (v02 COREv4 COREBOOT 00010001 INTL 20200110)
[ 0.083488] ACPI: FACS 0x00000000CC631240 000040
[ 0.088623] ACPI: SSDT 0x00000000CC634970 00103D (v02 COREv4 COREBOOT 0000002A CORE 20200110)
[ 0.098114] ACPI: MCFG 0x00000000CC6359B0 00003C (v01 COREv4 COREBOOT 00000000 CORE 20200110)
[ 0.107606] ACPI: TPM2 0x00000000CC6359F0 00004C (v04 COREv4 COREBOOT 00000000 CORE 20200110)
[ 0.117100] ACPI: APIC 0x00000000CC635A40 0000A6 (v03 COREv4 COREBOOT 00000000 CORE 20200110)
[ 0.126592] ACPI: SSDT 0x00000000CC635AF0 00119C (v01 AMD AMD CPU 00000001 AMD 00000001)
[ 0.136082] ACPI: CRAT 0x00000000CC636C90 000810 (v01 AMD AMD CRAT 00000001 AMD 00000001)
[ 0.145573] ACPI: SSDT 0x00000000CC6374A0 005419 (v02 AMD AmdTable 00000002 MSFT 02000002)
[ 0.155064] ACPI: IVRS 0x00000000CC63C8C0 000126 (v02 AMD AMD IVRS 00000001 AMD 00000000)
[ 0.164556] ACPI: HPET 0x00000000CC63C9F0 000038 (v01 COREv4 COREBOOT 00000000 CORE 20200110)
[ 0.174047] ACPI: VFCT 0x00000000CC63CA30 00D469 (v01 COREv4 COREBOOT 00000000 CORE 20200110)
Signed-off-by: Matt Papageorge <matt.papageorge@amd.corp-partner.google.com>
Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: Ic1e87c0f7a7c736592dd8c5c6765ef9a37ed7a40
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41804
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2019-11-14 00:00:12 +01:00
|
|
|
default_dev_ops_root.write_acpi_tables = agesa_write_acpi_tables;
|
|
|
|
|
2020-01-21 07:05:31 +01:00
|
|
|
fsp_silicon_init(acpi_is_wakeup_s3());
|
|
|
|
|
2020-05-12 00:26:35 +02:00
|
|
|
data_fabric_set_mmio_np();
|
2021-01-28 23:19:40 +01:00
|
|
|
fch_init(chip_info);
|
2019-04-22 22:55:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void soc_final(void *chip_info)
|
|
|
|
{
|
2021-01-28 23:19:40 +01:00
|
|
|
fch_final(chip_info);
|
2019-04-22 22:55:16 +02:00
|
|
|
}
|
|
|
|
|
2019-06-11 20:18:20 +02:00
|
|
|
struct chip_operations soc_amd_picasso_ops = {
|
|
|
|
CHIP_NAME("AMD Picasso SOC")
|
2019-04-22 22:55:16 +02:00
|
|
|
.enable_dev = enable_dev,
|
|
|
|
.init = soc_init,
|
|
|
|
.final = soc_final
|
|
|
|
};
|