08df7326e6
Already done for fam15tn and fam16kb. Change-Id: I3da36bfe6fd1805867eee5aa1f017c4fda084349 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/5660 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
147 lines
3.6 KiB
C
147 lines
3.6 KiB
C
/*
|
|
* This file is part of the coreboot project.
|
|
*
|
|
* Copyright (C) 2011 Advanced Micro Devices, Inc.
|
|
*
|
|
* 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.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#include "agesawrapper.h"
|
|
#include "amdlib.h"
|
|
#include "BiosCallOuts.h"
|
|
#include "Ids.h"
|
|
#include "OptionsIds.h"
|
|
#include "heapManager.h"
|
|
#include <northbridge/amd/agesa/family15/dimmSpd.h>
|
|
|
|
STATIC BIOS_CALLOUT_STRUCT BiosCallouts[] =
|
|
{
|
|
{AGESA_ALLOCATE_BUFFER, BiosAllocateBuffer },
|
|
{AGESA_DEALLOCATE_BUFFER, BiosDeallocateBuffer },
|
|
{AGESA_DO_RESET, BiosReset },
|
|
{AGESA_LOCATE_BUFFER, BiosLocateBuffer },
|
|
{AGESA_READ_SPD, BiosReadSpd },
|
|
{AGESA_READ_SPD_RECOVERY, BiosDefaultRet },
|
|
{AGESA_RUNFUNC_ONAP, BiosRunFuncOnAp },
|
|
{AGESA_GET_IDS_INIT_DATA, BiosGetIdsInitData },
|
|
{AGESA_HOOKBEFORE_DQS_TRAINING, BiosHookBeforeDQSTraining },
|
|
{AGESA_HOOKBEFORE_DRAM_INIT, BiosHookBeforeDramInit },
|
|
{AGESA_HOOKBEFORE_EXIT_SELF_REF, BiosHookBeforeExitSelfRefresh },
|
|
};
|
|
|
|
AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr)
|
|
{
|
|
UINTN i;
|
|
AGESA_STATUS CalloutStatus;
|
|
UINTN CallOutCount = sizeof (BiosCallouts) / sizeof (BiosCallouts [0]);
|
|
|
|
for (i = 0; i < CallOutCount; i++) {
|
|
if (BiosCallouts[i].CalloutName == Func) {
|
|
break;
|
|
}
|
|
}
|
|
|
|
if(i >= CallOutCount) {
|
|
return AGESA_UNSUPPORTED;
|
|
}
|
|
|
|
CalloutStatus = BiosCallouts[i].CalloutPtr (Func, Data, ConfigPtr);
|
|
|
|
return CalloutStatus;
|
|
}
|
|
|
|
|
|
CONST IDS_NV_ITEM IdsData[] =
|
|
{
|
|
/*{
|
|
AGESA_IDS_NV_MAIN_PLL_CON,
|
|
0x1
|
|
},
|
|
{
|
|
AGESA_IDS_NV_MAIN_PLL_FID_EN,
|
|
0x1
|
|
},
|
|
{
|
|
AGESA_IDS_NV_MAIN_PLL_FID,
|
|
0x8
|
|
},
|
|
|
|
{
|
|
AGESA_IDS_NV_CUSTOM_NB_PSTATE,
|
|
},
|
|
{
|
|
AGESA_IDS_NV_CUSTOM_NB_P0_DIV_CTRL,
|
|
},
|
|
{
|
|
AGESA_IDS_NV_CUSTOM_NB_P1_DIV_CTRL,
|
|
},
|
|
{
|
|
AGESA_IDS_NV_FORCE_NB_PSTATE,
|
|
},
|
|
*/
|
|
{
|
|
0xFFFF,
|
|
0xFFFF
|
|
}
|
|
};
|
|
|
|
#define NUM_IDS_ENTRIES (sizeof (IdsData) / sizeof (IDS_NV_ITEM))
|
|
|
|
AGESA_STATUS BiosGetIdsInitData (UINT32 Func, UINT32 Data, VOID *ConfigPtr)
|
|
{
|
|
UINTN i;
|
|
IDS_NV_ITEM *IdsPtr;
|
|
|
|
IdsPtr = ((IDS_CALLOUT_STRUCT *) ConfigPtr)->IdsNvPtr;
|
|
|
|
if (Data == IDS_CALLOUT_INIT) {
|
|
for (i = 0; i < NUM_IDS_ENTRIES; i++) {
|
|
IdsPtr[i].IdsNvValue = IdsData[i].IdsNvValue;
|
|
IdsPtr[i].IdsNvId = IdsData[i].IdsNvId;
|
|
}
|
|
}
|
|
return AGESA_SUCCESS;
|
|
}
|
|
|
|
|
|
AGESA_STATUS BiosReadSpd (UINT32 Func, UINT32 Data, VOID *ConfigPtr)
|
|
{
|
|
AGESA_STATUS Status;
|
|
#ifdef __PRE_RAM__
|
|
Status = agesa_ReadSPD (Func, Data, ConfigPtr);
|
|
#else
|
|
Status = AGESA_UNSUPPORTED;
|
|
#endif
|
|
|
|
return Status;
|
|
}
|
|
|
|
/* Call the host environment interface to provide a user hook opportunity. */
|
|
AGESA_STATUS BiosHookBeforeDQSTraining (UINT32 Func, UINT32 Data, VOID *ConfigPtr)
|
|
{
|
|
return AGESA_SUCCESS;
|
|
}
|
|
|
|
/* Call the host environment interface to provide a user hook opportunity. */
|
|
AGESA_STATUS BiosHookBeforeDramInit (UINT32 Func, UINT32 Data, VOID *ConfigPtr)
|
|
{
|
|
return AGESA_SUCCESS;
|
|
}
|
|
|
|
/* Call the host environment interface to provide a user hook opportunity. */
|
|
AGESA_STATUS BiosHookBeforeExitSelfRefresh (UINT32 Func, UINT32 Data, VOID *ConfigPtr)
|
|
{
|
|
return AGESA_SUCCESS;
|
|
}
|
|
|