Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2014 Google Inc. |
Lee Leahy | a608969 | 2016-01-05 16:34:58 -0800 | [diff] [blame] | 5 | * Copyright (C) 2015-2016 Intel Corporation. |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <stddef.h> |
Aaron Durbin | 932e09d | 2016-07-13 23:09:52 -0500 | [diff] [blame^] | 18 | #include <arch/acpi.h> |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 19 | #include <arch/io.h> |
| 20 | #include <arch/cbfs.h> |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 21 | #include <arch/early_variables.h> |
Duncan Laurie | 91da91f | 2015-09-04 13:47:34 -0700 | [diff] [blame] | 22 | #include <boardid.h> |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 23 | #include <console/console.h> |
| 24 | #include <cbmem.h> |
robbie zhang | 13a2e94 | 2016-02-10 11:40:11 -0800 | [diff] [blame] | 25 | #include <cpu/intel/microcode.h> |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 26 | #include <cpu/x86/mtrr.h> |
| 27 | #include <ec/google/chromeec/ec.h> |
| 28 | #include <ec/google/chromeec/ec_commands.h> |
| 29 | #include <elog.h> |
Lee Leahy | b092c9e | 2016-01-01 18:09:50 -0800 | [diff] [blame] | 30 | #include <fsp/romstage.h> |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 31 | #include <reset.h> |
Kyösti Mälkki | 65e8f64 | 2016-06-27 11:27:56 +0300 | [diff] [blame] | 32 | #include <program_loading.h> |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 33 | #include <romstage_handoff.h> |
Lee Leahy | 0be6d93 | 2015-06-26 11:15:42 -0700 | [diff] [blame] | 34 | #include <smbios.h> |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 35 | #include <soc/intel/common/mrc_cache.h> |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 36 | #include <stage_cache.h> |
| 37 | #include <timestamp.h> |
| 38 | #include <tpm.h> |
| 39 | #include <vendorcode/google/chromeos/chromeos.h> |
| 40 | |
Aaron Durbin | e6af4be | 2015-09-24 12:26:31 -0500 | [diff] [blame] | 41 | asmlinkage void *romstage_main(FSP_INFO_HEADER *fih) |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 42 | { |
| 43 | void *top_of_stack; |
| 44 | struct pei_data pei_data; |
| 45 | struct romstage_params params = { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 46 | .pei_data = &pei_data, |
Aaron Durbin | e6af4be | 2015-09-24 12:26:31 -0500 | [diff] [blame] | 47 | .chipset_context = fih, |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | post_code(0x30); |
| 51 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 52 | timestamp_add_now(TS_START_ROMSTAGE); |
| 53 | |
robbie zhang | 13a2e94 | 2016-02-10 11:40:11 -0800 | [diff] [blame] | 54 | /* Load microcode before ram init */ |
| 55 | if (IS_ENABLED(CONFIG_SUPPORT_CPU_UCODE_IN_CBFS)) |
| 56 | intel_update_microcode_from_cbfs(); |
| 57 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 58 | memset(&pei_data, 0, sizeof(pei_data)); |
| 59 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 60 | /* Display parameters */ |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 61 | printk(BIOS_SPEW, "CONFIG_MMCONF_BASE_ADDRESS: 0x%08x\n", |
| 62 | CONFIG_MMCONF_BASE_ADDRESS); |
Aaron Durbin | 929b602 | 2015-12-09 16:00:18 -0600 | [diff] [blame] | 63 | printk(BIOS_INFO, "Using FSP 1.1\n"); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 64 | |
| 65 | /* Display FSP banner */ |
Aaron Durbin | e6af4be | 2015-09-24 12:26:31 -0500 | [diff] [blame] | 66 | print_fsp_info(fih); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 67 | |
Aaron Durbin | 929b602 | 2015-12-09 16:00:18 -0600 | [diff] [blame] | 68 | /* Stash FSP version. */ |
| 69 | params.fsp_version = fsp_version(fih); |
| 70 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 71 | /* Get power state */ |
| 72 | params.power_state = fill_power_state(); |
| 73 | |
Duncan Laurie | 91da91f | 2015-09-04 13:47:34 -0700 | [diff] [blame] | 74 | /* |
| 75 | * Read and print board version. Done after SOC romstage |
| 76 | * in case PCH needs to be configured to talk to the EC. |
| 77 | */ |
| 78 | if (IS_ENABLED(CONFIG_BOARD_ID_AUTO)) |
| 79 | printk(BIOS_INFO, "MLB: board version %d\n", board_id()); |
| 80 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 81 | /* Call into mainboard. */ |
| 82 | mainboard_romstage_entry(¶ms); |
| 83 | soc_after_ram_init(¶ms); |
| 84 | post_code(0x38); |
| 85 | |
| 86 | top_of_stack = setup_stack_and_mtrrs(); |
| 87 | |
Lee Leahy | 3e5bc1f | 2015-06-24 11:17:54 -0700 | [diff] [blame] | 88 | printk(BIOS_DEBUG, "Calling FspTempRamExit API\n"); |
| 89 | timestamp_add_now(TS_FSP_TEMP_RAM_EXIT_START); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 90 | return top_of_stack; |
| 91 | } |
| 92 | |
Aaron Durbin | e6af4be | 2015-09-24 12:26:31 -0500 | [diff] [blame] | 93 | void *cache_as_ram_stage_main(FSP_INFO_HEADER *fih) |
| 94 | { |
| 95 | return romstage_main(fih); |
| 96 | } |
| 97 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 98 | /* Entry from the mainboard. */ |
| 99 | void romstage_common(struct romstage_params *params) |
| 100 | { |
| 101 | const struct mrc_saved_data *cache; |
| 102 | struct romstage_handoff *handoff; |
| 103 | struct pei_data *pei_data; |
| 104 | |
| 105 | post_code(0x32); |
| 106 | |
| 107 | timestamp_add_now(TS_BEFORE_INITRAM); |
| 108 | |
| 109 | pei_data = params->pei_data; |
| 110 | pei_data->boot_mode = params->power_state->prev_sleep_state; |
| 111 | |
| 112 | #if IS_ENABLED(CONFIG_ELOG_BOOT_COUNT) |
Aaron Durbin | 932e09d | 2016-07-13 23:09:52 -0500 | [diff] [blame^] | 113 | if (params->power_state->prev_sleep_state != ACPI_S3) |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 114 | boot_count_increment(); |
| 115 | #endif |
| 116 | |
| 117 | /* Perform remaining SOC initialization */ |
| 118 | soc_pre_ram_init(params); |
| 119 | post_code(0x33); |
| 120 | |
| 121 | /* Check recovery and MRC cache */ |
| 122 | params->pei_data->saved_data_size = 0; |
| 123 | params->pei_data->saved_data = NULL; |
| 124 | if (!params->pei_data->disable_saved_data) { |
| 125 | if (recovery_mode_enabled()) { |
| 126 | /* Recovery mode does not use MRC cache */ |
| 127 | printk(BIOS_DEBUG, |
| 128 | "Recovery mode: not using MRC cache.\n"); |
Lee Leahy | a608969 | 2016-01-05 16:34:58 -0800 | [diff] [blame] | 129 | } else if (IS_ENABLED(CONFIG_CACHE_MRC_SETTINGS) |
| 130 | && (!mrc_cache_get_current_with_version(&cache, |
| 131 | params->fsp_version))) { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 132 | /* MRC cache found */ |
| 133 | params->pei_data->saved_data_size = cache->size; |
| 134 | params->pei_data->saved_data = &cache->data[0]; |
Aaron Durbin | 932e09d | 2016-07-13 23:09:52 -0500 | [diff] [blame^] | 135 | } else if (params->pei_data->boot_mode == ACPI_S3) { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 136 | /* Waking from S3 and no cache. */ |
| 137 | printk(BIOS_DEBUG, |
| 138 | "No MRC cache found in S3 resume path.\n"); |
| 139 | post_code(POST_RESUME_FAILURE); |
| 140 | hard_reset(); |
| 141 | } else { |
| 142 | printk(BIOS_DEBUG, "No MRC cache found.\n"); |
| 143 | mainboard_check_ec_image(params); |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | /* Initialize RAM */ |
| 148 | raminit(params); |
| 149 | timestamp_add_now(TS_AFTER_INITRAM); |
| 150 | |
| 151 | /* Save MRC output */ |
Lee Leahy | a608969 | 2016-01-05 16:34:58 -0800 | [diff] [blame] | 152 | if (IS_ENABLED(CONFIG_CACHE_MRC_SETTINGS)) { |
| 153 | printk(BIOS_DEBUG, "MRC data at %p %d bytes\n", |
| 154 | pei_data->data_to_save, pei_data->data_to_save_size); |
Aaron Durbin | 932e09d | 2016-07-13 23:09:52 -0500 | [diff] [blame^] | 155 | if ((params->pei_data->boot_mode != ACPI_S3) |
Lee Leahy | a608969 | 2016-01-05 16:34:58 -0800 | [diff] [blame] | 156 | && (params->pei_data->data_to_save_size != 0) |
| 157 | && (params->pei_data->data_to_save != NULL)) |
| 158 | mrc_cache_stash_data_with_version( |
| 159 | params->pei_data->data_to_save, |
| 160 | params->pei_data->data_to_save_size, |
| 161 | params->fsp_version); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 162 | } |
| 163 | |
| 164 | /* Save DIMM information */ |
| 165 | mainboard_save_dimm_info(params); |
| 166 | |
| 167 | /* Create romstage handof information */ |
| 168 | handoff = romstage_handoff_find_or_add(); |
| 169 | if (handoff != NULL) |
| 170 | handoff->s3_resume = (params->power_state->prev_sleep_state == |
Aaron Durbin | 932e09d | 2016-07-13 23:09:52 -0500 | [diff] [blame^] | 171 | ACPI_S3); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 172 | else { |
| 173 | printk(BIOS_DEBUG, "Romstage handoff structure not added!\n"); |
| 174 | hard_reset(); |
| 175 | } |
| 176 | |
Duncan Laurie | fe4983e | 2016-03-14 09:29:09 -0700 | [diff] [blame] | 177 | /* |
| 178 | * Initialize the TPM, unless the TPM was already initialized |
| 179 | * in verstage and used to verify romstage. |
| 180 | */ |
| 181 | if (IS_ENABLED(CONFIG_LPC_TPM) && |
| 182 | !IS_ENABLED(CONFIG_RESUME_PATH_SAME_AS_BOOT) && |
| 183 | !IS_ENABLED(CONFIG_VBOOT_STARTS_IN_BOOTBLOCK)) |
| 184 | init_tpm(params->power_state->prev_sleep_state == |
Aaron Durbin | 932e09d | 2016-07-13 23:09:52 -0500 | [diff] [blame^] | 185 | ACPI_S3); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 186 | } |
| 187 | |
Aaron Durbin | e6af4be | 2015-09-24 12:26:31 -0500 | [diff] [blame] | 188 | void after_cache_as_ram_stage(void) |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 189 | { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 190 | /* Load the ramstage. */ |
Kyösti Mälkki | 65e8f64 | 2016-06-27 11:27:56 +0300 | [diff] [blame] | 191 | run_ramstage(); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 192 | die("ERROR - Failed to load ramstage!"); |
| 193 | } |
| 194 | |
| 195 | /* Initialize the power state */ |
| 196 | __attribute__((weak)) struct chipset_power_state *fill_power_state(void) |
| 197 | { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 198 | return NULL; |
| 199 | } |
| 200 | |
| 201 | __attribute__((weak)) void mainboard_check_ec_image( |
| 202 | struct romstage_params *params) |
| 203 | { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 204 | #if IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC) |
| 205 | struct pei_data *pei_data; |
| 206 | |
| 207 | pei_data = params->pei_data; |
Aaron Durbin | 932e09d | 2016-07-13 23:09:52 -0500 | [diff] [blame^] | 208 | if (params->pei_data->boot_mode == ACPI_S0) { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 209 | /* Ensure EC is running RO firmware. */ |
| 210 | google_chromeec_check_ec_image(EC_IMAGE_RO); |
| 211 | } |
| 212 | #endif |
| 213 | } |
| 214 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 215 | /* Board initialization before and after RAM is enabled */ |
| 216 | __attribute__((weak)) void mainboard_romstage_entry( |
| 217 | struct romstage_params *params) |
| 218 | { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 219 | post_code(0x31); |
| 220 | |
| 221 | /* Initliaze memory */ |
| 222 | romstage_common(params); |
| 223 | } |
| 224 | |
| 225 | /* Save the DIMM information for SMBIOS table 17 */ |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 226 | __attribute__((weak)) void mainboard_save_dimm_info( |
| 227 | struct romstage_params *params) |
| 228 | { |
| 229 | int channel; |
| 230 | CHANNEL_INFO *channel_info; |
| 231 | int dimm; |
| 232 | DIMM_INFO *dimm_info; |
| 233 | int dimm_max; |
| 234 | void *hob_list_ptr; |
| 235 | EFI_HOB_GUID_TYPE *hob_ptr; |
| 236 | int index; |
| 237 | struct memory_info *mem_info; |
| 238 | FSP_SMBIOS_MEMORY_INFO *memory_info_hob; |
| 239 | const EFI_GUID memory_info_hob_guid = FSP_SMBIOS_MEMORY_INFO_GUID; |
| 240 | |
| 241 | /* Locate the memory info HOB, presence validated by raminit */ |
| 242 | hob_list_ptr = fsp_get_hob_list(); |
| 243 | hob_ptr = get_next_guid_hob(&memory_info_hob_guid, hob_list_ptr); |
| 244 | memory_info_hob = (FSP_SMBIOS_MEMORY_INFO *)(hob_ptr + 1); |
| 245 | |
| 246 | /* Display the data in the FSP_SMBIOS_MEMORY_INFO HOB */ |
| 247 | if (IS_ENABLED(CONFIG_DISPLAY_HOBS)) { |
| 248 | printk(BIOS_DEBUG, "FSP_SMBIOS_MEMORY_INFO HOB\n"); |
| 249 | printk(BIOS_DEBUG, " 0x%02x: Revision\n", |
| 250 | memory_info_hob->Revision); |
| 251 | printk(BIOS_DEBUG, " 0x%02x: MemoryType\n", |
| 252 | memory_info_hob->MemoryType); |
Lee Leahy | 0be6d93 | 2015-06-26 11:15:42 -0700 | [diff] [blame] | 253 | printk(BIOS_DEBUG, " %d: MemoryFrequencyInMHz\n", |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 254 | memory_info_hob->MemoryFrequencyInMHz); |
Lee Leahy | 0be6d93 | 2015-06-26 11:15:42 -0700 | [diff] [blame] | 255 | printk(BIOS_DEBUG, " %d: DataWidth in bits\n", |
| 256 | memory_info_hob->DataWidth); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 257 | printk(BIOS_DEBUG, " 0x%02x: ErrorCorrectionType\n", |
| 258 | memory_info_hob->ErrorCorrectionType); |
| 259 | printk(BIOS_DEBUG, " 0x%02x: ChannelCount\n", |
| 260 | memory_info_hob->ChannelCount); |
| 261 | for (channel = 0; channel < memory_info_hob->ChannelCount; |
| 262 | channel++) { |
| 263 | channel_info = &memory_info_hob->ChannelInfo[channel]; |
| 264 | printk(BIOS_DEBUG, " Channel %d\n", channel); |
| 265 | printk(BIOS_DEBUG, " 0x%02x: ChannelId\n", |
| 266 | channel_info->ChannelId); |
| 267 | printk(BIOS_DEBUG, " 0x%02x: DimmCount\n", |
| 268 | channel_info->DimmCount); |
| 269 | for (dimm = 0; dimm < channel_info->DimmCount; |
| 270 | dimm++) { |
| 271 | dimm_info = &channel_info->DimmInfo[dimm]; |
| 272 | printk(BIOS_DEBUG, " DIMM %d\n", dimm); |
| 273 | printk(BIOS_DEBUG, " 0x%02x: DimmId\n", |
| 274 | dimm_info->DimmId); |
Lee Leahy | 0be6d93 | 2015-06-26 11:15:42 -0700 | [diff] [blame] | 275 | printk(BIOS_DEBUG, " %d: SizeInMb\n", |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 276 | dimm_info->SizeInMb); |
| 277 | } |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | /* |
| 282 | * Allocate CBMEM area for DIMM information used to populate SMBIOS |
| 283 | * table 17 |
| 284 | */ |
| 285 | mem_info = cbmem_add(CBMEM_ID_MEMINFO, sizeof(*mem_info)); |
| 286 | printk(BIOS_DEBUG, "CBMEM entry for DIMM info: 0x%p\n", mem_info); |
| 287 | if (mem_info == NULL) |
| 288 | return; |
| 289 | memset(mem_info, 0, sizeof(*mem_info)); |
| 290 | |
| 291 | /* Describe the first N DIMMs in the system */ |
| 292 | index = 0; |
| 293 | dimm_max = ARRAY_SIZE(mem_info->dimm); |
| 294 | for (channel = 0; channel < memory_info_hob->ChannelCount; channel++) { |
| 295 | if (index >= dimm_max) |
| 296 | break; |
| 297 | channel_info = &memory_info_hob->ChannelInfo[channel]; |
| 298 | for (dimm = 0; dimm < channel_info->DimmCount; dimm++) { |
| 299 | if (index >= dimm_max) |
| 300 | break; |
| 301 | dimm_info = &channel_info->DimmInfo[dimm]; |
| 302 | |
| 303 | /* Populate the DIMM information */ |
| 304 | if (dimm_info->SizeInMb) { |
| 305 | mem_info->dimm[index].dimm_size = |
| 306 | dimm_info->SizeInMb; |
| 307 | mem_info->dimm[index].ddr_type = |
| 308 | memory_info_hob->MemoryType; |
| 309 | mem_info->dimm[index].ddr_frequency = |
| 310 | memory_info_hob->MemoryFrequencyInMHz; |
| 311 | mem_info->dimm[index].channel_num = |
| 312 | channel_info->ChannelId; |
| 313 | mem_info->dimm[index].dimm_num = |
| 314 | dimm_info->DimmId; |
Lee Leahy | 0be6d93 | 2015-06-26 11:15:42 -0700 | [diff] [blame] | 315 | switch (memory_info_hob->DataWidth) { |
| 316 | default: |
| 317 | case 8: |
| 318 | mem_info->dimm[index].bus_width = |
| 319 | MEMORY_BUS_WIDTH_8; |
| 320 | break; |
| 321 | |
| 322 | case 16: |
| 323 | mem_info->dimm[index].bus_width = |
| 324 | MEMORY_BUS_WIDTH_16; |
| 325 | break; |
| 326 | |
| 327 | case 32: |
| 328 | mem_info->dimm[index].bus_width = |
| 329 | MEMORY_BUS_WIDTH_32; |
| 330 | break; |
| 331 | |
| 332 | case 64: |
| 333 | mem_info->dimm[index].bus_width = |
| 334 | MEMORY_BUS_WIDTH_64; |
| 335 | break; |
| 336 | |
| 337 | case 128: |
| 338 | mem_info->dimm[index].bus_width = |
| 339 | MEMORY_BUS_WIDTH_128; |
| 340 | break; |
| 341 | } |
Duncan Laurie | 46a2c77 | 2015-07-20 16:48:55 -0700 | [diff] [blame] | 342 | |
| 343 | /* Add any mainboard specific information */ |
| 344 | mainboard_add_dimm_info(params, mem_info, |
| 345 | channel, dimm, index); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 346 | index++; |
| 347 | } |
| 348 | } |
| 349 | } |
| 350 | mem_info->dimm_cnt = index; |
| 351 | printk(BIOS_DEBUG, "%d DIMMs found\n", mem_info->dimm_cnt); |
| 352 | } |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 353 | |
Duncan Laurie | 46a2c77 | 2015-07-20 16:48:55 -0700 | [diff] [blame] | 354 | /* Add any mainboard specific information */ |
| 355 | __attribute__((weak)) void mainboard_add_dimm_info( |
| 356 | struct romstage_params *params, |
| 357 | struct memory_info *mem_info, |
| 358 | int channel, int dimm, int index) |
| 359 | { |
Duncan Laurie | 46a2c77 | 2015-07-20 16:48:55 -0700 | [diff] [blame] | 360 | } |
| 361 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 362 | /* Get the memory configuration data */ |
Lee Leahy | d52f258 | 2016-05-31 18:12:53 -0700 | [diff] [blame] | 363 | __attribute__((weak)) int mrc_cache_get_current_with_version( |
| 364 | const struct mrc_saved_data **cache, uint32_t version) |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 365 | { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 366 | return -1; |
| 367 | } |
| 368 | |
| 369 | /* Save the memory configuration data */ |
Lee Leahy | d52f258 | 2016-05-31 18:12:53 -0700 | [diff] [blame] | 370 | __attribute__((weak)) int mrc_cache_stash_data_with_version(const void *data, |
| 371 | size_t size, uint32_t version) |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 372 | { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 373 | return -1; |
| 374 | } |
| 375 | |
| 376 | /* Transition RAM from off or self-refresh to active */ |
| 377 | __attribute__((weak)) void raminit(struct romstage_params *params) |
| 378 | { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 379 | post_code(0x34); |
| 380 | die("ERROR - No RAM initialization specified!\n"); |
| 381 | } |
| 382 | |
| 383 | void ramstage_cache_invalid(void) |
| 384 | { |
| 385 | if (IS_ENABLED(CONFIG_RESET_ON_INVALID_RAMSTAGE_CACHE)) |
| 386 | /* Perform cold reset on invalid ramstage cache. */ |
| 387 | hard_reset(); |
| 388 | } |
| 389 | |
| 390 | /* Display the memory configuration */ |
| 391 | __attribute__((weak)) void report_memory_config(void) |
| 392 | { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 393 | } |
| 394 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 395 | /* Choose top of stack and setup MTRRs */ |
| 396 | __attribute__((weak)) void *setup_stack_and_mtrrs(void) |
| 397 | { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 398 | die("ERROR - Must specify top of stack!\n"); |
| 399 | return NULL; |
| 400 | } |
| 401 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 402 | /* SOC initialization after RAM is enabled */ |
| 403 | __attribute__((weak)) void soc_after_ram_init(struct romstage_params *params) |
| 404 | { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 405 | } |
| 406 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 407 | /* SOC initialization before RAM is enabled */ |
| 408 | __attribute__((weak)) void soc_pre_ram_init(struct romstage_params *params) |
| 409 | { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 410 | } |