AGESA: Add OemCustomize hooks structure

We should potentially provide an OEM platform hook to manipulate parameters
around any entry point to AGESA. Use structure for such ops to avoid weak
functions and lots of empty function stubs.

Change-Id: I99bf7de8a1e2f183399d2216520a45d0c24fd64c
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/7824
Tested-by: build bot (Jenkins)
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
This commit is contained in:
Kyösti Mälkki 2014-12-16 07:34:58 +02:00
parent 1ef67e166a
commit 6e74b2cbac
24 changed files with 171 additions and 85 deletions

View File

@ -19,6 +19,7 @@
#include "AGESA.h"
#include "amdlib.h"
#include <northbridge/amd/agesa/agesawrapper.h>
#include <northbridge/amd/agesa/BiosCallOuts.h>
#include "Ids.h"
#include "OptionsIds.h"
@ -115,3 +116,15 @@ static AGESA_STATUS board_ReadSpd (UINT32 Func, UINT32 Data, VOID *ConfigPtr)
return Status;
}
static AGESA_STATUS OemInitPost(AMD_POST_PARAMS *InitPost)
{
InitPost->MemConfig.UmaMode = UMA_AUTO;
InitPost->MemConfig.BottomIo = 0xE0;
InitPost->MemConfig.UmaSize = 0xE0-0xC0;
return AGESA_SUCCESS;
}
const struct OEM_HOOK OemCustomize = {
.InitPost = OemInitPost,
};

View File

@ -41,10 +41,8 @@
*
**/
/*---------------------------------------------------------------------------------------*/
VOID
OemCustomizeInitEarly (
IN OUT AMD_EARLY_PARAMS *InitEarly
)
static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
{
AGESA_STATUS Status;
VOID *BrazosPcieComplexListPtr;
@ -132,4 +130,9 @@ OemCustomizeInitEarly (
InitEarly->GnbConfig.PcieComplexList = BrazosPcieComplexListPtr;
InitEarly->GnbConfig.PsppPolicy = 0;
return AGESA_SUCCESS;
}
const struct OEM_HOOK OemCustomize = {
.InitEarly = OemInitEarly,
};

View File

@ -123,10 +123,8 @@ static const PCIe_COMPLEX_DESCRIPTOR PcieComplex = {
*
**/
/*---------------------------------------------------------------------------------------*/
VOID
OemCustomizeInitEarly (
IN OUT AMD_EARLY_PARAMS *InitEarly
)
static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
{
AGESA_STATUS Status;
PCIe_COMPLEX_DESCRIPTOR *PcieComplexListPtr;
@ -148,4 +146,9 @@ OemCustomizeInitEarly (
PcieComplexListPtr = (PCIe_COMPLEX_DESCRIPTOR *) AllocHeapParams.BufferPtr;
LibAmdMemCopy (PcieComplexListPtr, &PcieComplex, sizeof(PcieComplex), &InitEarly->StdHeader);
InitEarly->GnbConfig.PcieComplexList = PcieComplexListPtr;
return AGESA_SUCCESS;
}
const struct OEM_HOOK OemCustomize = {
.InitEarly = OemInitEarly,
};

View File

@ -160,10 +160,8 @@ static const PCIe_DDI_DESCRIPTOR DdiList [] = {
*
**/
/*---------------------------------------------------------------------------------------*/
VOID
OemCustomizeInitEarly (
IN OUT AMD_EARLY_PARAMS *InitEarly
)
static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
{
AGESA_STATUS Status;
PCIe_COMPLEX_DESCRIPTOR *PcieComplexListPtr;
@ -195,4 +193,9 @@ OemCustomizeInitEarly (
PcieComplexListPtr->DdiLinkList = DdiList;
InitEarly->GnbConfig.PcieComplexList = PcieComplexListPtr;
return AGESA_SUCCESS;
}
const struct OEM_HOOK OemCustomize = {
.InitEarly = OemInitEarly,
};

View File

@ -39,10 +39,8 @@
* @retval VOID
*
**/
VOID
OemCustomizeInitEarly (
IN OUT AMD_EARLY_PARAMS *InitEarly
)
static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
{
AGESA_STATUS Status;
VOID *BrazosPcieComplexListPtr;
@ -138,4 +136,9 @@ PCIe_COMPLEX_DESCRIPTOR Brazos = {
InitEarly->GnbConfig.PcieComplexList = BrazosPcieComplexListPtr;
InitEarly->GnbConfig.PsppPolicy = 0;
return AGESA_SUCCESS;
}
const struct OEM_HOOK OemCustomize = {
.InitEarly = OemInitEarly,
};

View File

@ -41,10 +41,8 @@
*
**/
/*---------------------------------------------------------------------------------------*/
VOID
OemCustomizeInitEarly (
IN OUT AMD_EARLY_PARAMS *InitEarly
)
static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
{
AGESA_STATUS Status;
VOID *BrazosPcieComplexListPtr;
@ -140,4 +138,9 @@ PCIe_COMPLEX_DESCRIPTOR Brazos = {
InitEarly->GnbConfig.PcieComplexList = BrazosPcieComplexListPtr;
InitEarly->GnbConfig.PsppPolicy = 0;
return AGESA_SUCCESS;
}
const struct OEM_HOOK OemCustomize = {
.InitEarly = OemInitEarly,
};

View File

@ -166,10 +166,8 @@ static const PCIe_COMPLEX_DESCRIPTOR Trinity = {
*
**/
/*---------------------------------------------------------------------------------------*/
VOID
OemCustomizeInitEarly (
IN OUT AMD_EARLY_PARAMS *InitEarly
)
static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
{
AGESA_STATUS Status;
VOID *TrinityPcieComplexListPtr;
@ -221,4 +219,9 @@ OemCustomizeInitEarly (
((PCIe_COMPLEX_DESCRIPTOR*)TrinityPcieComplexListPtr)->DdiLinkList = (PCIe_DDI_DESCRIPTOR*)TrinityPcieDdiPtr;
InitEarly->GnbConfig.PcieComplexList = TrinityPcieComplexListPtr;
return AGESA_SUCCESS;
}
const struct OEM_HOOK OemCustomize = {
.InitEarly = OemInitEarly,
};

View File

@ -108,10 +108,8 @@ static const PCIe_COMPLEX_DESCRIPTOR Llano = {
*
**/
/*---------------------------------------------------------------------------------------*/
VOID
OemCustomizeInitEarly (
IN OUT AMD_EARLY_PARAMS *InitEarly
)
static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
{
AGESA_STATUS Status;
VOID *LlanoPcieComplexListPtr;
@ -165,4 +163,9 @@ OemCustomizeInitEarly (
InitEarly->GnbConfig.PcieComplexList = LlanoPcieComplexListPtr;
InitEarly->GnbConfig.PsppPolicy = 0;
return AGESA_SUCCESS;
}
const struct OEM_HOOK OemCustomize = {
.InitEarly = OemInitEarly,
};

View File

@ -45,10 +45,8 @@
*
**/
/*---------------------------------------------------------------------------------------*/
VOID
OemCustomizeInitEarly (
IN OUT AMD_EARLY_PARAMS *InitEarly
)
static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
{
AGESA_STATUS Status;
VOID *BrazosPcieComplexListPtr;
@ -146,4 +144,9 @@ PCIe_COMPLEX_DESCRIPTOR Brazos = {
InitEarly->GnbConfig.PcieComplexList = BrazosPcieComplexListPtr;
InitEarly->GnbConfig.PsppPolicy = 0;
return AGESA_SUCCESS;
}
const struct OEM_HOOK OemCustomize = {
.InitEarly = OemInitEarly,
};

View File

@ -45,10 +45,8 @@
*
**/
/*---------------------------------------------------------------------------------------*/
VOID
OemCustomizeInitEarly (
IN OUT AMD_EARLY_PARAMS *InitEarly
)
static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
{
AGESA_STATUS Status;
VOID *BrazosPcieComplexListPtr;
@ -146,4 +144,9 @@ PCIe_COMPLEX_DESCRIPTOR Brazos = {
InitEarly->GnbConfig.PcieComplexList = BrazosPcieComplexListPtr;
InitEarly->GnbConfig.PsppPolicy = 0;
return AGESA_SUCCESS;
}
const struct OEM_HOOK OemCustomize = {
.InitEarly = OemInitEarly,
};

View File

@ -123,10 +123,8 @@ static const PCIe_COMPLEX_DESCRIPTOR PcieComplex = {
*
**/
/*---------------------------------------------------------------------------------------*/
VOID
OemCustomizeInitEarly (
IN OUT AMD_EARLY_PARAMS *InitEarly
)
static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
{
AGESA_STATUS Status;
PCIe_COMPLEX_DESCRIPTOR *PcieComplexListPtr;
@ -148,4 +146,9 @@ OemCustomizeInitEarly (
PcieComplexListPtr = (PCIe_COMPLEX_DESCRIPTOR *) AllocHeapParams.BufferPtr;
LibAmdMemCopy (PcieComplexListPtr, &PcieComplex, sizeof(PcieComplex), &InitEarly->StdHeader);
InitEarly->GnbConfig.PcieComplexList = PcieComplexListPtr;
return AGESA_SUCCESS;
}
const struct OEM_HOOK OemCustomize = {
.InitEarly = OemInitEarly,
};

View File

@ -142,10 +142,8 @@ static const PCIe_COMPLEX_DESCRIPTOR Trinity = {
*
**/
/*---------------------------------------------------------------------------------------*/
VOID
OemCustomizeInitEarly (
IN OUT AMD_EARLY_PARAMS *InitEarly
)
static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
{
AGESA_STATUS Status;
VOID *TrinityPcieComplexListPtr;
@ -196,4 +194,9 @@ OemCustomizeInitEarly (
((PCIe_COMPLEX_DESCRIPTOR*)TrinityPcieComplexListPtr)->DdiLinkList = (PCIe_DDI_DESCRIPTOR*)TrinityPcieDdiPtr;
InitEarly->GnbConfig.PcieComplexList = TrinityPcieComplexListPtr;
return AGESA_SUCCESS;
}
const struct OEM_HOOK OemCustomize = {
.InitEarly = OemInitEarly,
};

View File

@ -44,10 +44,8 @@
*
**/
/*---------------------------------------------------------------------------------------*/
VOID
OemCustomizeInitEarly (
IN OUT AMD_EARLY_PARAMS *InitEarly
)
static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
{
AGESA_STATUS Status;
VOID *BrazosPcieComplexListPtr;
@ -143,4 +141,9 @@ PCIe_COMPLEX_DESCRIPTOR Brazos = {
InitEarly->GnbConfig.PcieComplexList = BrazosPcieComplexListPtr;
InitEarly->GnbConfig.PsppPolicy = 0;
return AGESA_SUCCESS;
}
const struct OEM_HOOK OemCustomize = {
.InitEarly = OemInitEarly,
};

View File

@ -117,10 +117,8 @@ static const PCIe_COMPLEX_DESCRIPTOR PcieComplex = {
*
**/
/*---------------------------------------------------------------------------------------*/
VOID
OemCustomizeInitEarly (
IN OUT AMD_EARLY_PARAMS *InitEarly
)
static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
{
AGESA_STATUS Status;
PCIe_COMPLEX_DESCRIPTOR *PcieComplexListPtr;
@ -142,4 +140,9 @@ OemCustomizeInitEarly (
PcieComplexListPtr = (PCIe_COMPLEX_DESCRIPTOR *) AllocHeapParams.BufferPtr;
LibAmdMemCopy (PcieComplexListPtr, &PcieComplex, sizeof(PcieComplex), &InitEarly->StdHeader);
InitEarly->GnbConfig.PcieComplexList = PcieComplexListPtr;
return AGESA_SUCCESS;
}
const struct OEM_HOOK OemCustomize = {
.InitEarly = OemInitEarly,
};

View File

@ -159,10 +159,8 @@ static const PCIe_DDI_DESCRIPTOR DdiList [] = {
*
**/
/*---------------------------------------------------------------------------------------*/
VOID
OemCustomizeInitEarly (
IN OUT AMD_EARLY_PARAMS *InitEarly
)
static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
{
AGESA_STATUS Status;
PCIe_COMPLEX_DESCRIPTOR *PcieComplexListPtr;
@ -194,4 +192,9 @@ OemCustomizeInitEarly (
PcieComplexListPtr->DdiLinkList = DdiList;
InitEarly->GnbConfig.PcieComplexList = PcieComplexListPtr;
return AGESA_SUCCESS;
}
const struct OEM_HOOK OemCustomize = {
.InitEarly = OemInitEarly,
};

View File

@ -38,7 +38,8 @@
* @param[in] *InitEarly
*
**/
void OemCustomizeInitEarly (IN OUT AMD_EARLY_PARAMS *InitEarly)
static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
{
AGESA_STATUS Status;
void *BrazosPcieComplexListPtr;
@ -181,4 +182,9 @@ PCIe_COMPLEX_DESCRIPTOR Brazos = {
InitEarly->GnbConfig.PcieComplexList = BrazosPcieComplexListPtr;
InitEarly->GnbConfig.PsppPolicy = 0;
return AGESA_SUCCESS;
}
const struct OEM_HOOK OemCustomize = {
.InitEarly = OemInitEarly,
};

View File

@ -159,10 +159,8 @@ static const PCIe_DDI_DESCRIPTOR DdiList [] = {
*
**/
/*---------------------------------------------------------------------------------------*/
VOID
OemCustomizeInitEarly (
IN OUT AMD_EARLY_PARAMS *InitEarly
)
static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
{
AGESA_STATUS Status;
PCIe_COMPLEX_DESCRIPTOR *PcieComplexListPtr;
@ -194,4 +192,9 @@ OemCustomizeInitEarly (
PcieComplexListPtr->DdiLinkList = DdiList;
InitEarly->GnbConfig.PcieComplexList = PcieComplexListPtr;
return AGESA_SUCCESS;
}
const struct OEM_HOOK OemCustomize = {
.InitEarly = OemInitEarly,
};

View File

@ -45,10 +45,8 @@
*
**/
/*---------------------------------------------------------------------------------------*/
VOID
OemCustomizeInitEarly (
IN OUT AMD_EARLY_PARAMS *InitEarly
)
static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
{
AGESA_STATUS Status;
VOID *BrazosPcieComplexListPtr;
@ -144,4 +142,9 @@ PCIe_COMPLEX_DESCRIPTOR Brazos = {
InitEarly->GnbConfig.PcieComplexList = BrazosPcieComplexListPtr;
InitEarly->GnbConfig.PsppPolicy = 0;
return AGESA_SUCCESS;
}
const struct OEM_HOOK OemCustomize = {
.InitEarly = OemInitEarly,
};

View File

@ -45,10 +45,8 @@
*
**/
/*---------------------------------------------------------------------------------------*/
VOID
OemCustomizeInitEarly (
IN OUT AMD_EARLY_PARAMS *InitEarly
)
static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
{
AGESA_STATUS Status;
VOID *BrazosPcieComplexListPtr;
@ -144,4 +142,9 @@ PCIe_COMPLEX_DESCRIPTOR Brazos = {
InitEarly->GnbConfig.PcieComplexList = BrazosPcieComplexListPtr;
InitEarly->GnbConfig.PsppPolicy = 0;
return AGESA_SUCCESS;
}
const struct OEM_HOOK OemCustomize = {
.InitEarly = OemInitEarly,
};

View File

@ -19,6 +19,7 @@
#include "AGESA.h"
#include "amdlib.h"
#include <northbridge/amd/agesa/agesawrapper.h>
#include <northbridge/amd/agesa/BiosCallOuts.h>
#include "Ids.h"
#include "OptionsIds.h"
@ -109,3 +110,6 @@ static AGESA_STATUS board_ReadSpd (UINT32 Func, UINT32 Data, VOID *ConfigPtr)
return Status;
}
const struct OEM_HOOK OemCustomize = {
};

View File

@ -19,6 +19,7 @@
#include "AGESA.h"
#include "amdlib.h"
#include <northbridge/amd/agesa/agesawrapper.h>
#include <northbridge/amd/agesa/BiosCallOuts.h>
#include "Ids.h"
#include "OptionsIds.h"
@ -40,3 +41,6 @@ const BIOS_CALLOUT_STRUCT BiosCallouts[] =
{AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess },
};
const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
const struct OEM_HOOK OemCustomize = {
};

View File

@ -19,6 +19,7 @@
#include "AGESA.h"
#include "amdlib.h"
#include <northbridge/amd/agesa/agesawrapper.h>
#include <northbridge/amd/agesa/BiosCallOuts.h>
#include "Ids.h"
#include "OptionsIds.h"
@ -117,3 +118,6 @@ static AGESA_STATUS board_ReadSpd (UINT32 Func, UINT32 Data, VOID *ConfigPtr)
return Status;
}
const struct OEM_HOOK OemCustomize = {
};

View File

@ -59,7 +59,25 @@ void *agesawrapper_getlateinitptr (int pick);
AGESA_STATUS agesawrapper_fchs3earlyrestore(void);
AGESA_STATUS agesawrapper_fchs3laterestore(void);
void OemCustomizeInitEarly(AMD_EARLY_PARAMS *InitEarly);
void OemCustomizeInitPost(AMD_POST_PARAMS *InitPost);
struct OEM_HOOK
{
/* romstage */
AGESA_STATUS (*InitEarly)(AMD_EARLY_PARAMS *);
AGESA_STATUS (*InitPost)(AMD_POST_PARAMS *);
};
extern const struct OEM_HOOK OemCustomize;
static inline void OemCustomizeInitEarly(AMD_EARLY_PARAMS *EarlyParams)
{
if (OemCustomize.InitEarly)
OemCustomize.InitEarly(EarlyParams);
}
static inline void OemCustomizeInitPost(AMD_POST_PARAMS *PostParams)
{
if (OemCustomize.InitPost)
OemCustomize.InitPost(PostParams);
}
#endif /* _AGESAWRAPPER_H_ */

View File

@ -35,20 +35,6 @@
#define FILECODE UNASSIGNED_FILE_FILECODE
/* TODO: Function body should be in mainboard directory. */
void OemCustomizeInitEarly(AMD_EARLY_PARAMS *InitEarly)
{
}
void OemCustomizeInitPost(AMD_POST_PARAMS *InitPost)
{
#if IS_ENABLED(CONFIG_BOARD_AMD_DINAR)
InitPost->MemConfig.UmaMode = UMA_AUTO;
InitPost->MemConfig.BottomIo = 0xE0;
InitPost->MemConfig.UmaSize = 0xE0-0xC0;
#endif
}
AGESA_STATUS agesawrapper_amdinitreset(void)
{
AGESA_STATUS status = AGESA_SUCCESS;