blob: 50f59046398c10ce240a49a1f8688f471533d5b0 [file] [log] [blame]
Jens Rottmann16644042013-03-01 17:12:56 +01001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2011 Advanced Micro Devices, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Jens Rottmann16644042013-03-01 17:12:56 +010014 */
15
Kyösti Mälkki526c2fb2014-07-10 22:16:58 +030016#include "AGESA.h"
Jens Rottmann16644042013-03-01 17:12:56 +010017#include "amdlib.h"
Kyösti Mälkki26f297e2014-05-26 11:27:54 +030018#include <northbridge/amd/agesa/BiosCallOuts.h>
Kyösti Mälkki50c96372014-10-18 07:51:03 +030019#include "SB800.h"
20#include <southbridge/amd/cimx/sb800/gpio_oem.h>
Jens Rottmann16644042013-03-01 17:12:56 +010021#include "heapManager.h"
Kyösti Mälkki6025efa2014-05-05 13:20:56 +030022#include <stdlib.h>
Jens Rottmann16644042013-03-01 17:12:56 +010023
Kyösti Mälkkif1bb19a2014-05-04 17:23:49 +030024/* Should AGESA_GNB_PCIE_SLOT_RESET use agesa_NoopSuccess?
25 *
26 * COM Express doesn't provide dedicated resets for individual lanes
27 * and it's not needed for the on-board Intel I210 GbE controller.
28 */
29
Stefan Reinauerdd132a52015-07-30 11:16:37 -070030static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINTN Data, VOID *ConfigPtr);
Kyösti Mälkkic0096012014-05-05 18:56:33 +030031
Kyösti Mälkki6025efa2014-05-05 13:20:56 +030032const BIOS_CALLOUT_STRUCT BiosCallouts[] =
Jens Rottmann16644042013-03-01 17:12:56 +010033{
Kyösti Mälkki5e19fa42014-05-04 23:13:54 +030034 {AGESA_DO_RESET, agesa_Reset },
Kyösti Mälkkia1ebbc42014-10-17 22:33:22 +030035 {AGESA_READ_SPD, agesa_ReadSpd },
Kyösti Mälkkic459f962014-05-04 17:07:45 +030036 {AGESA_READ_SPD_RECOVERY, agesa_NoopUnsupported },
Kyösti Mälkki6b4b1512014-05-05 12:05:53 +030037 {AGESA_RUNFUNC_ONAP, agesa_RunFuncOnAp },
Kyösti Mälkkif1bb19a2014-05-04 17:23:49 +030038 {AGESA_GNB_PCIE_SLOT_RESET, agesa_NoopUnsupported },
Kyösti Mälkkic0096012014-05-05 18:56:33 +030039 {AGESA_HOOKBEFORE_DRAM_INIT, board_BeforeDramInit},
Kyösti Mälkkic459f962014-05-04 17:07:45 +030040 {AGESA_HOOKBEFORE_DRAM_INIT_RECOVERY, agesa_NoopSuccess },
41 {AGESA_HOOKBEFORE_DQS_TRAINING, agesa_NoopSuccess },
42 {AGESA_HOOKBEFORE_EXIT_SELF_REF, agesa_NoopSuccess },
Jens Rottmann16644042013-03-01 17:12:56 +010043};
Kyösti Mälkki6025efa2014-05-05 13:20:56 +030044const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
Jens Rottmann16644042013-03-01 17:12:56 +010045
Jens Rottmann16644042013-03-01 17:12:56 +010046/* Call the host environment interface to provide a user hook opportunity. */
Stefan Reinauerdd132a52015-07-30 11:16:37 -070047static AGESA_STATUS board_BeforeDramInit (UINT32 Func, UINTN Data, VOID *ConfigPtr)
Jens Rottmann16644042013-03-01 17:12:56 +010048{
Jens Rottmann68c9f2b2013-03-01 17:20:42 +010049 MEM_DATA_STRUCT *MemData = ConfigPtr;
50
51 printk(BIOS_INFO, "Setting DDR3 voltage: ");
52 FCH_IOMUX(65) = 1; // GPIO65: VMEM_LV_EN# lowers VMEM from 1.5 to 1.35V
53 switch (MemData->ParameterListPtr->DDR3Voltage) {
54 case VOLT1_25: // board is not able to provide this
55 MemData->ParameterListPtr->DDR3Voltage = VOLT1_35; // sorry
56 printk(BIOS_INFO, "can't provide 1.25 V, using ");
57 // fall through
58 default: // AGESA.h says in mixed case 1.5V DIMMs get excluded
59 case VOLT1_35:
60 FCH_GPIO(65) = 0x08; // = output, disable PU, set to 0
61 printk(BIOS_INFO, "1.35 V\n");
62 break;
63 case VOLT1_5:
64 FCH_GPIO(65) = 0xC8; // = output, disable PU, set to 1
65 printk(BIOS_INFO, "1.5 V\n");
66 }
67
Jens Rottmann16644042013-03-01 17:12:56 +010068 return AGESA_SUCCESS;
69}