soc/amd/common/fsp/fsp-acpi: factor out SSDT from HOB functionality

This function will be reused in Cezanne, so move it from the Picasso
directory to the common FSP integration code.

TEST=On Mandolin Linux finds the AMD SSDT that contains ALIB.

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I7b256de712fe60d1c021cb875aaadec1d331584b
Reviewed-on: https://review.coreboot.org/c/coreboot/+/52896
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
This commit is contained in:
Felix Held 2021-05-04 20:01:46 +02:00
parent 3cb69c2397
commit 245adcab13
4 changed files with 46 additions and 34 deletions

View File

@ -56,4 +56,7 @@ unsigned long southbridge_write_acpi_tables(const struct device *device, unsigne
unsigned long acpi_fill_madt_irqoverride(unsigned long current);
void acpi_fill_root_complex_tom(const struct device *device);
uintptr_t add_agesa_fsp_acpi_table(guid_t guid, const char *name, acpi_rsdp_t *rsdp,
uintptr_t current);
#endif /* AMD_BLOCK_ACPI_H */

View File

@ -1,4 +1,5 @@
ifeq ($(CONFIG_PLATFORM_USES_FSP2_0),y)
romstage-y += fsp_reset.c
ramstage-y += fsp_reset.c
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += fsp-acpi.c
endif # CONFIG_PLATFORM_USES_FSP2_0

View File

@ -0,0 +1,40 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpi.h>
#include <amdblocks/acpi.h>
#include <console/console.h>
#include <fsp/util.h>
#include <string.h>
#include <types.h>
struct amd_fsp_acpi_hob_info {
uint32_t table_size_in_bytes;
uint8_t total_hobs_for_table;
uint8_t sequence_number;
uint16_t reserved;
uint16_t hob_payload[0xffc8]; /* maximum payload size */
} __packed;
uintptr_t add_agesa_fsp_acpi_table(guid_t guid, const char *name, acpi_rsdp_t *rsdp,
uintptr_t current)
{
const struct amd_fsp_acpi_hob_info *data;
void *table = (void *)current;
size_t hob_size;
data = fsp_find_extension_hob_by_guid(guid.b, &hob_size);
if (!data) {
printk(BIOS_ERR, "AGESA %s ACPI table was not found.\n", name);
return current;
}
printk(BIOS_INFO, "ACPI: * %s (AGESA).\n", name);
memcpy(table, data->hob_payload, data->table_size_in_bytes);
current += data->table_size_in_bytes;
acpi_add_table(rsdp, table);
current = acpi_align_current(current);
return current;
}

View File

@ -6,12 +6,12 @@
#include <console/console.h>
#include <cpu/amd/cpuid.h>
#include <cpu/amd/msr.h>
#include <fsp/util.h>
#include <FspGuids.h>
#include <soc/acpi.h>
#include <stdint.h>
#include <device/pci_def.h>
#include <device/pci_ops.h>
#include <amdblocks/acpi.h>
#include <amdblocks/cpu.h>
#include <amdblocks/data_fabric.h>
#include <amdblocks/ioapic.h>
@ -20,38 +20,6 @@
#include <stdlib.h>
#include <arch/mmio.h>
struct amd_fsp_acpi_hob_info {
uint32_t table_size_in_bytes;
uint8_t total_hobs_for_table;
uint8_t sequence_number;
uint16_t reserved;
uint16_t hob_payload[0xffc8];
} __packed;
static uintptr_t add_agesa_acpi_table(guid_t guid, const char *name, acpi_rsdp_t *rsdp,
uintptr_t current)
{
const struct amd_fsp_acpi_hob_info *data;
void *table = (void *)current;
size_t hob_size;
data = fsp_find_extension_hob_by_guid(guid.b, &hob_size);
if (!data) {
printk(BIOS_ERR, "AGESA %s ACPI table was not found.\n", name);
return current;
}
printk(BIOS_INFO, "ACPI: * %s (AGESA).\n", name);
memcpy(table, data->hob_payload, data->table_size_in_bytes);
current += data->table_size_in_bytes;
acpi_add_table(rsdp, table);
current = acpi_align_current(current);
return current;
}
unsigned long acpi_fill_ivrs_ioapic(acpi_ivrs_t *ivrs, unsigned long current)
{
ivrs_ivhd_special_t *ivhd_ioapic = (ivrs_ivhd_special_t *)current;
@ -1033,7 +1001,7 @@ uintptr_t agesa_write_acpi_tables(const struct device *device, uintptr_t current
current += crat->header.length;
acpi_add_table(rsdp, crat);
current = add_agesa_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
/* IVRS */
current = ALIGN(current, 8);