AGESA: Use common handler for ACPI tables
Change-Id: I2d6ab1026f1105f1fea97682442a169409248c39 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/20815 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
parent
6cb4ee31ed
commit
0e01c4841d
|
@ -24,7 +24,7 @@ subdirs-$(CONFIG_NORTHBRIDGE_AMD_AGESA_FAMILY15_RL) += family15rl
|
|||
subdirs-$(CONFIG_NORTHBRIDGE_AMD_AGESA_FAMILY16_KB) += family16kb
|
||||
|
||||
romstage-y += def_callouts.c agesawrapper.c eventlog.c
|
||||
ramstage-y += def_callouts.c agesawrapper.c eventlog.c
|
||||
ramstage-y += def_callouts.c agesawrapper.c eventlog.c acpi_tables.c
|
||||
|
||||
romstage-y += oem_s3.c
|
||||
ramstage-y += oem_s3.c
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* This file is part of the coreboot project.
|
||||
*
|
||||
* Copyright (C) 2011-2012 Advanced Micro Devices, Inc.
|
||||
* Copyright (C) 2016 Kyösti Mälkki
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <northbridge/amd/agesa/agesa_helper.h>
|
||||
|
||||
#include "AGESA.h"
|
||||
|
||||
/* Fields were removed from the structure and we cannot add them back
|
||||
* without new builds of the binaryPI blobs.
|
||||
*/
|
||||
#if !IS_ENABLED(CONFIG_CPU_AMD_AGESA_BINARY_PI) || \
|
||||
IS_ENABLED(CONFIG_NORTHBRIDGE_AMD_PI_00630F01) || \
|
||||
IS_ENABLED(CONFIG_NORTHBRIDGE_AMD_PI_00730F01)
|
||||
|
||||
#define HAS_ACPI_SRAT TRUE
|
||||
#define HAS_ACPI_SLIT TRUE
|
||||
#else
|
||||
#define HAS_ACPI_SRAT FALSE
|
||||
#define HAS_ACPI_SLIT FALSE
|
||||
#endif
|
||||
|
||||
/* We will reference AmdLateParams later to copy ACPI tables. */
|
||||
static AMD_LATE_PARAMS *AmdLateParams;
|
||||
|
||||
void agesawrapper_setlateinitptr(void *Late)
|
||||
{
|
||||
AmdLateParams = Late;
|
||||
}
|
||||
|
||||
void *agesawrapper_getlateinitptr(int pick)
|
||||
{
|
||||
ASSERT(AmdLateParams != NULL);
|
||||
|
||||
switch (pick) {
|
||||
case PICK_DMI:
|
||||
return AmdLateParams->DmiTable;
|
||||
case PICK_PSTATE:
|
||||
return AmdLateParams->AcpiPState;
|
||||
#if HAS_ACPI_SRAT
|
||||
case PICK_SRAT:
|
||||
return AmdLateParams->AcpiSrat;
|
||||
#endif
|
||||
#if HAS_ACPI_SLIT
|
||||
case PICK_SLIT:
|
||||
return AmdLateParams->AcpiSlit;
|
||||
#endif
|
||||
case PICK_WHEA_MCE:
|
||||
return AmdLateParams->AcpiWheaMce;
|
||||
case PICK_WHEA_CMC:
|
||||
return AmdLateParams->AcpiWheaCmc;
|
||||
case PICK_ALIB:
|
||||
return AmdLateParams->AcpiAlib;
|
||||
case PICK_IVRS:
|
||||
return AmdLateParams->AcpiIvrs;
|
||||
case PICK_CRAT:
|
||||
return AmdLateParams->AcpiCrat;
|
||||
case PICK_CDIT:
|
||||
return AmdLateParams->AcpiCdit;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
|
@ -27,8 +27,11 @@ enum {
|
|||
PICK_WHEA_CMC, /* WHEA CMV table */
|
||||
PICK_ALIB, /* SACPI SSDT table with ALIB implementation */
|
||||
PICK_IVRS, /* IOMMU ACPI IVRS(I/O Virtualization Reporting Structure) table */
|
||||
PICK_CRAT, /* Component Resource Affinity Table table */
|
||||
PICK_CDIT, /* Component Locality Distance Information table */
|
||||
};
|
||||
|
||||
void agesawrapper_setlateinitptr (void *Late);
|
||||
void *agesawrapper_getlateinitptr (int pick);
|
||||
|
||||
void amd_initcpuio(void);
|
||||
|
|
|
@ -270,13 +270,11 @@ AGESA_STATUS agesawrapper_amdS3Save(void)
|
|||
return status;
|
||||
}
|
||||
|
||||
/* We will reference AmdLateParams later to copy ACPI tables. */
|
||||
static AMD_LATE_PARAMS *AmdLateParams = NULL;
|
||||
|
||||
AGESA_STATUS agesawrapper_amdinitlate(void)
|
||||
{
|
||||
AGESA_STATUS status;
|
||||
AMD_INTERFACE_PARAMS AmdParamStruct;
|
||||
AMD_LATE_PARAMS *AmdLateParams;
|
||||
|
||||
memset(&AmdParamStruct, 0, sizeof(AMD_INTERFACE_PARAMS));
|
||||
|
||||
|
@ -298,41 +296,12 @@ AGESA_STATUS agesawrapper_amdinitlate(void)
|
|||
AGESA_EVENTLOG(status, &AmdLateParams->StdHeader);
|
||||
ASSERT(status == AGESA_SUCCESS);
|
||||
|
||||
agesawrapper_setlateinitptr(AmdLateParams);
|
||||
|
||||
/* No AmdReleaseStruct(&AmdParamStruct), we need AmdLateParams later. */
|
||||
return status;
|
||||
}
|
||||
|
||||
void *agesawrapper_getlateinitptr(int pick)
|
||||
{
|
||||
ASSERT(AmdLateParams != NULL);
|
||||
|
||||
switch (pick) {
|
||||
case PICK_DMI:
|
||||
return AmdLateParams->DmiTable;
|
||||
case PICK_PSTATE:
|
||||
return AmdLateParams->AcpiPState;
|
||||
case PICK_SRAT:
|
||||
return AmdLateParams->AcpiSrat;
|
||||
case PICK_SLIT:
|
||||
return AmdLateParams->AcpiSlit;
|
||||
case PICK_WHEA_MCE:
|
||||
return AmdLateParams->AcpiWheaMce;
|
||||
case PICK_WHEA_CMC:
|
||||
return AmdLateParams->AcpiWheaCmc;
|
||||
case PICK_ALIB:
|
||||
return AmdLateParams->AcpiAlib;
|
||||
case PICK_IVRS:
|
||||
#if IS_ENABLED(CONFIG_CPU_AMD_AGESA_FAMILY14)
|
||||
return NULL;
|
||||
#else
|
||||
return AmdLateParams->AcpiIvrs;
|
||||
#endif
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* __PRE_RAM__ */
|
||||
|
||||
AGESA_STATUS agesawrapper_amdlaterunaptask(UINT32 Func, UINTN Data, VOID * ConfigPtr)
|
||||
|
|
|
@ -23,7 +23,7 @@ romstage-y += agesawrapper.c
|
|||
ramstage-y += agesawrapper.c
|
||||
|
||||
romstage-y += ../agesa/def_callouts.c
|
||||
ramstage-y += ../agesa/def_callouts.c
|
||||
ramstage-y += ../agesa/def_callouts.c ../agesa/acpi_tables.c
|
||||
|
||||
romstage-y += ramtop.c
|
||||
ramstage-y += ramtop.c
|
||||
|
|
|
@ -28,20 +28,6 @@ void __attribute__((weak)) OemPostParams(AMD_POST_PARAMS *PostParams) {}
|
|||
|
||||
#define FILECODE UNASSIGNED_FILE_FILECODE
|
||||
|
||||
#ifndef __PRE_RAM__
|
||||
/* ACPI table pointers returned by AmdInitLate */
|
||||
static void *DmiTable = NULL;
|
||||
static void *AcpiPstate = NULL;
|
||||
static void *AcpiSrat = NULL;
|
||||
static void *AcpiSlit = NULL;
|
||||
|
||||
static void *AcpiWheaMce = NULL;
|
||||
static void *AcpiWheaCmc = NULL;
|
||||
static void *AcpiAlib = NULL;
|
||||
static void *AcpiIvrs = NULL;
|
||||
static void *AcpiCrat = NULL;
|
||||
#endif /* #ifndef __PRE_RAM__ */
|
||||
|
||||
AGESA_STATUS agesawrapper_amdinitreset(void)
|
||||
{
|
||||
AGESA_STATUS status;
|
||||
|
@ -223,34 +209,6 @@ AGESA_STATUS agesawrapper_amdinitenv(void)
|
|||
return status;
|
||||
}
|
||||
|
||||
#ifndef __PRE_RAM__
|
||||
VOID* agesawrapper_getlateinitptr (int pick)
|
||||
{
|
||||
switch (pick) {
|
||||
case PICK_DMI:
|
||||
return DmiTable;
|
||||
case PICK_PSTATE:
|
||||
return AcpiPstate;
|
||||
case PICK_SRAT:
|
||||
return AcpiSrat;
|
||||
case PICK_SLIT:
|
||||
return AcpiSlit;
|
||||
case PICK_WHEA_MCE:
|
||||
return AcpiWheaMce;
|
||||
case PICK_WHEA_CMC:
|
||||
return AcpiWheaCmc;
|
||||
case PICK_ALIB:
|
||||
return AcpiAlib;
|
||||
case PICK_IVRS:
|
||||
return AcpiIvrs;
|
||||
case PICK_CRAT:
|
||||
return AcpiCrat;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif /* #ifndef __PRE_RAM__ */
|
||||
|
||||
AGESA_STATUS agesawrapper_amdinitmid(void)
|
||||
{
|
||||
AGESA_STATUS status;
|
||||
|
@ -320,27 +278,9 @@ AGESA_STATUS agesawrapper_amdinitlate(void)
|
|||
ASSERT(Status == AGESA_SUCCESS);
|
||||
}
|
||||
|
||||
DmiTable = AmdLateParams->DmiTable;
|
||||
AcpiPstate = AmdLateParams->AcpiPState;
|
||||
#if IS_ENABLED(CONFIG_NORTHBRIDGE_AMD_PI_00630F01) || IS_ENABLED(CONFIG_NORTHBRIDGE_AMD_PI_00730F01)
|
||||
AcpiSrat = AmdLateParams->AcpiSrat;
|
||||
AcpiSlit = AmdLateParams->AcpiSlit;
|
||||
#endif
|
||||
agesawrapper_setlateinitptr(AmdLateParams);
|
||||
|
||||
AcpiWheaMce = AmdLateParams->AcpiWheaMce;
|
||||
AcpiWheaCmc = AmdLateParams->AcpiWheaCmc;
|
||||
AcpiAlib = AmdLateParams->AcpiAlib;
|
||||
AcpiIvrs = AmdLateParams->AcpiIvrs;
|
||||
AcpiCrat = AmdLateParams->AcpiCrat;
|
||||
|
||||
printk(BIOS_DEBUG, "DmiTable:%x, AcpiPstatein: %x, AcpiSrat:%x,"
|
||||
"AcpiSlit:%x, Mce:%x, Cmc:%x,"
|
||||
"Alib:%x, AcpiIvrs:%x in %s\n",
|
||||
(unsigned int)DmiTable, (unsigned int)AcpiPstate, (unsigned int)AcpiSrat,
|
||||
(unsigned int)AcpiSlit, (unsigned int)AcpiWheaMce, (unsigned int)AcpiWheaCmc,
|
||||
(unsigned int)AcpiAlib, (unsigned int)AcpiIvrs, __func__);
|
||||
|
||||
/* AmdReleaseStruct (&AmdParamStruct); */
|
||||
/* No AmdReleaseStruct(&AmdParamStruct), we need AmdLateParams later. */
|
||||
return Status;
|
||||
}
|
||||
#endif /* #ifndef __PRE_RAM__ */
|
||||
|
|
|
@ -39,6 +39,7 @@ AGESA_STATUS agesawrapper_amdinitlate(void);
|
|||
AGESA_STATUS agesawrapper_amdinitpost(void);
|
||||
AGESA_STATUS agesawrapper_amdinitmid(void);
|
||||
AGESA_STATUS agesawrapper_amdreadeventlog(UINT8 HeapStatus);
|
||||
void agesawrapper_setlateinitptr (void *Late);
|
||||
void *agesawrapper_getlateinitptr(int pick);
|
||||
AGESA_STATUS agesawrapper_amdlaterunaptask(UINT32 Func, UINTN Data, void *ConfigPtr);
|
||||
AGESA_STATUS agesawrapper_amdS3Save(void);
|
||||
|
|
Loading…
Reference in New Issue