Marc Jones | 2d79f16 | 2017-05-22 21:35:16 -0600 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2015-2016 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. |
| 14 | */ |
| 15 | |
Marshall Dawson | 3f6c400 | 2017-09-25 10:11:50 -0600 | [diff] [blame] | 16 | #include <chip.h> |
Richard Spiegel | 0ad74ac | 2017-12-08 16:53:29 -0700 | [diff] [blame] | 17 | #include <amdblocks/agesawrapper.h> |
chris wang | 76118a7 | 2018-10-18 18:52:58 +0800 | [diff] [blame^] | 18 | #include <boardid.h> |
Marc Jones | 2d79f16 | 2017-05-22 21:35:16 -0600 | [diff] [blame] | 19 | |
Marshall Dawson | 3f6c400 | 2017-09-25 10:11:50 -0600 | [diff] [blame] | 20 | #define DIMMS_PER_CHANNEL 1 |
| 21 | #if DIMMS_PER_CHANNEL > MAX_DIMMS_PER_CH |
| 22 | #error "Too many DIMM sockets defined for the mainboard" |
| 23 | #endif |
| 24 | |
Marc Jones | 2d79f16 | 2017-05-22 21:35:16 -0600 | [diff] [blame] | 25 | static const PSO_ENTRY DDR4PlatformMemoryConfiguration[] = { |
| 26 | DRAM_TECHNOLOGY(ANY_SOCKET, DDR4_TECHNOLOGY), |
Marshall Dawson | 3f6c400 | 2017-09-25 10:11:50 -0600 | [diff] [blame] | 27 | NUMBER_OF_DIMMS_SUPPORTED(ANY_SOCKET, ANY_CHANNEL, DIMMS_PER_CHANNEL), |
| 28 | NUMBER_OF_CHANNELS_SUPPORTED(ANY_SOCKET, MAX_DRAM_CH), |
Marc Jones | 2d79f16 | 2017-05-22 21:35:16 -0600 | [diff] [blame] | 29 | MOTHER_BOARD_LAYERS(LAYERS_6), |
| 30 | MEMCLK_DIS_MAP(ANY_SOCKET, ANY_CHANNEL, |
| 31 | 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00), |
| 32 | CKE_TRI_MAP(ANY_SOCKET, ANY_CHANNEL, 0xff, 0xff, 0xff, 0xff), |
| 33 | ODT_TRI_MAP(ANY_SOCKET, ANY_CHANNEL, 0xff, 0xff, 0xff, 0xff), |
| 34 | CS_TRI_MAP(ANY_SOCKET, ANY_CHANNEL, |
| 35 | 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00), |
| 36 | PSO_END |
| 37 | }; |
chris wang | 76118a7 | 2018-10-18 18:52:58 +0800 | [diff] [blame^] | 38 | /* TODO: Remove when no longer needed */ |
| 39 | static const PSO_ENTRY DDR4LiaraMemoryConfiguration[] = { |
| 40 | DRAM_TECHNOLOGY(ANY_SOCKET, DDR4_TECHNOLOGY), |
| 41 | NUMBER_OF_DIMMS_SUPPORTED(ANY_SOCKET, ANY_CHANNEL, DIMMS_PER_CHANNEL), |
| 42 | NUMBER_OF_CHANNELS_SUPPORTED(ANY_SOCKET, MAX_DRAM_CH), |
| 43 | MOTHER_BOARD_LAYERS(LAYERS_6), |
| 44 | MEMCLK_DIS_MAP(ANY_SOCKET, ANY_CHANNEL, |
| 45 | 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00), |
| 46 | CKE_TRI_MAP(ANY_SOCKET, ANY_CHANNEL, 0xff, 0xff, 0xff, 0xff), |
| 47 | ODT_TRI_MAP(ANY_SOCKET, ANY_CHANNEL, 0xff, 0xff, 0xff, 0xff), |
| 48 | CS_TRI_MAP(ANY_SOCKET, ANY_CHANNEL, |
| 49 | 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00), |
| 50 | TBLDRV_CONFIG_TO_OVERRIDE(DIMMS_PER_CHANNEL, ANY_SPEED, VOLT_ANY_, |
| 51 | ANY_), |
| 52 | TBLDRV_CONFIG_ENTRY_SLOWACCMODE(1), |
| 53 | PSO_END |
| 54 | }; |
Marc Jones | 2d79f16 | 2017-05-22 21:35:16 -0600 | [diff] [blame] | 55 | |
| 56 | void OemPostParams(AMD_POST_PARAMS *PostParams) |
| 57 | { |
chris wang | 76118a7 | 2018-10-18 18:52:58 +0800 | [diff] [blame^] | 58 | if ((IS_ENABLED(CONFIG_BOARD_GOOGLE_LIARA)) && (board_id() <= 4)) |
| 59 | PostParams->MemConfig.PlatformMemoryConfiguration = |
| 60 | (PSO_ENTRY *)DDR4LiaraMemoryConfiguration; |
| 61 | else |
| 62 | PostParams->MemConfig.PlatformMemoryConfiguration = |
| 63 | (PSO_ENTRY *)DDR4PlatformMemoryConfiguration; |
Richard Spiegel | 9b3da9f | 2018-02-16 14:33:59 -0700 | [diff] [blame] | 64 | /* |
| 65 | * Bank interleaving is enabled by default in AGESA. However, from AMD's |
| 66 | * explanation, bank interleaving is really chip select interleave, |
| 67 | * requiring 2 chip select arriving to the DIMM (rank interleaving). As |
| 68 | * both kahlee and grunt are hardware limited to a single chip select |
| 69 | * arriving at the DIMM, interleave will not work. This causes AGESA to |
| 70 | * throw a warning. To avoid the warning, interleaving needs to be |
| 71 | * disabled. |
| 72 | */ |
| 73 | PostParams->MemConfig.EnableBankIntlv = FALSE; |
Marc Jones | 2d79f16 | 2017-05-22 21:35:16 -0600 | [diff] [blame] | 74 | } |
Richard Spiegel | 5d3707b | 2018-07-27 12:44:22 -0700 | [diff] [blame] | 75 | |
| 76 | void set_board_env_params(GNB_ENV_CONFIGURATION *params) |
| 77 | { |
| 78 | params->EDPv1_4VSMode = EDP_VS_HIGH_VDIFF_MODE; |
| 79 | } |