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> |
Aaron Durbin | 31be2c9 | 2016-12-03 22:08:20 -0600 | [diff] [blame] | 22 | #include <assert.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> |
Aaron Durbin | afe8aee | 2016-11-29 21:37:42 -0600 | [diff] [blame] | 37 | #include <string.h> |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 38 | #include <timestamp.h> |
| 39 | #include <tpm.h> |
| 40 | #include <vendorcode/google/chromeos/chromeos.h> |
| 41 | |
Aaron Durbin | e6af4be | 2015-09-24 12:26:31 -0500 | [diff] [blame] | 42 | asmlinkage void *romstage_main(FSP_INFO_HEADER *fih) |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 43 | { |
| 44 | void *top_of_stack; |
| 45 | struct pei_data pei_data; |
| 46 | struct romstage_params params = { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 47 | .pei_data = &pei_data, |
Aaron Durbin | e6af4be | 2015-09-24 12:26:31 -0500 | [diff] [blame] | 48 | .chipset_context = fih, |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 49 | }; |
| 50 | |
| 51 | post_code(0x30); |
| 52 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 53 | timestamp_add_now(TS_START_ROMSTAGE); |
| 54 | |
Elyes HAOUAS | 7753731 | 2016-07-30 15:37:26 +0200 | [diff] [blame] | 55 | /* Load microcode before RAM init */ |
robbie zhang | 13a2e94 | 2016-02-10 11:40:11 -0800 | [diff] [blame] | 56 | if (IS_ENABLED(CONFIG_SUPPORT_CPU_UCODE_IN_CBFS)) |
| 57 | intel_update_microcode_from_cbfs(); |
| 58 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 59 | memset(&pei_data, 0, sizeof(pei_data)); |
| 60 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 61 | /* Display parameters */ |
Lee Leahy | c253a92 | 2017-03-13 17:36:39 -0700 | [diff] [blame] | 62 | if (!IS_ENABLED(CONFIG_NO_MMCONF_SUPPORT)) |
| 63 | printk(BIOS_SPEW, "CONFIG_MMCONF_BASE_ADDRESS: 0x%08x\n", |
| 64 | CONFIG_MMCONF_BASE_ADDRESS); |
Aaron Durbin | 929b602 | 2015-12-09 16:00:18 -0600 | [diff] [blame] | 65 | printk(BIOS_INFO, "Using FSP 1.1\n"); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 66 | |
| 67 | /* Display FSP banner */ |
Aaron Durbin | e6af4be | 2015-09-24 12:26:31 -0500 | [diff] [blame] | 68 | print_fsp_info(fih); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 69 | |
Aaron Durbin | 929b602 | 2015-12-09 16:00:18 -0600 | [diff] [blame] | 70 | /* Stash FSP version. */ |
| 71 | params.fsp_version = fsp_version(fih); |
| 72 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 73 | /* Get power state */ |
| 74 | params.power_state = fill_power_state(); |
| 75 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 76 | /* Call into mainboard. */ |
| 77 | mainboard_romstage_entry(¶ms); |
| 78 | soc_after_ram_init(¶ms); |
| 79 | post_code(0x38); |
| 80 | |
| 81 | top_of_stack = setup_stack_and_mtrrs(); |
| 82 | |
Lee Leahy | 3e5bc1f | 2015-06-24 11:17:54 -0700 | [diff] [blame] | 83 | printk(BIOS_DEBUG, "Calling FspTempRamExit API\n"); |
| 84 | timestamp_add_now(TS_FSP_TEMP_RAM_EXIT_START); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 85 | return top_of_stack; |
| 86 | } |
| 87 | |
Aaron Durbin | e6af4be | 2015-09-24 12:26:31 -0500 | [diff] [blame] | 88 | void *cache_as_ram_stage_main(FSP_INFO_HEADER *fih) |
| 89 | { |
| 90 | return romstage_main(fih); |
| 91 | } |
| 92 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 93 | /* Entry from the mainboard. */ |
| 94 | void romstage_common(struct romstage_params *params) |
| 95 | { |
Subrata Banik | 0beac81 | 2017-07-12 15:13:53 +0530 | [diff] [blame] | 96 | bool s3wake; |
Aaron Durbin | 31be2c9 | 2016-12-03 22:08:20 -0600 | [diff] [blame] | 97 | struct region_device rdev; |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 98 | struct pei_data *pei_data; |
| 99 | |
| 100 | post_code(0x32); |
| 101 | |
| 102 | timestamp_add_now(TS_BEFORE_INITRAM); |
| 103 | |
| 104 | pei_data = params->pei_data; |
| 105 | pei_data->boot_mode = params->power_state->prev_sleep_state; |
Subrata Banik | 0beac81 | 2017-07-12 15:13:53 +0530 | [diff] [blame] | 106 | s3wake = params->power_state->prev_sleep_state == ACPI_S3; |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 107 | |
Subrata Banik | 0beac81 | 2017-07-12 15:13:53 +0530 | [diff] [blame] | 108 | if (IS_ENABLED(CONFIG_ELOG_BOOT_COUNT) && !s3wake) |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 109 | boot_count_increment(); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 110 | |
| 111 | /* Perform remaining SOC initialization */ |
| 112 | soc_pre_ram_init(params); |
| 113 | post_code(0x33); |
| 114 | |
| 115 | /* Check recovery and MRC cache */ |
| 116 | params->pei_data->saved_data_size = 0; |
| 117 | params->pei_data->saved_data = NULL; |
| 118 | if (!params->pei_data->disable_saved_data) { |
Furquan Shaikh | 0325dc6 | 2016-07-25 13:02:36 -0700 | [diff] [blame] | 119 | if (vboot_recovery_mode_enabled()) { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 120 | /* Recovery mode does not use MRC cache */ |
| 121 | printk(BIOS_DEBUG, |
| 122 | "Recovery mode: not using MRC cache.\n"); |
Lee Leahy | a608969 | 2016-01-05 16:34:58 -0800 | [diff] [blame] | 123 | } else if (IS_ENABLED(CONFIG_CACHE_MRC_SETTINGS) |
Aaron Durbin | 31be2c9 | 2016-12-03 22:08:20 -0600 | [diff] [blame] | 124 | && (!mrc_cache_get_current(MRC_TRAINING_DATA, |
| 125 | params->fsp_version, |
| 126 | &rdev))) { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 127 | /* MRC cache found */ |
Aaron Durbin | 31be2c9 | 2016-12-03 22:08:20 -0600 | [diff] [blame] | 128 | params->pei_data->saved_data_size = |
| 129 | region_device_sz(&rdev); |
| 130 | params->pei_data->saved_data = rdev_mmap_full(&rdev); |
| 131 | /* Assum boot device is memory mapped. */ |
| 132 | assert(IS_ENABLED(CONFIG_BOOT_DEVICE_MEMORY_MAPPED)); |
Aaron Durbin | 932e09d | 2016-07-13 23:09:52 -0500 | [diff] [blame] | 133 | } else if (params->pei_data->boot_mode == ACPI_S3) { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 134 | /* Waking from S3 and no cache. */ |
| 135 | printk(BIOS_DEBUG, |
| 136 | "No MRC cache found in S3 resume path.\n"); |
| 137 | post_code(POST_RESUME_FAILURE); |
| 138 | hard_reset(); |
| 139 | } else { |
| 140 | printk(BIOS_DEBUG, "No MRC cache found.\n"); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 141 | } |
| 142 | } |
| 143 | |
| 144 | /* Initialize RAM */ |
| 145 | raminit(params); |
| 146 | timestamp_add_now(TS_AFTER_INITRAM); |
| 147 | |
| 148 | /* Save MRC output */ |
Lee Leahy | a608969 | 2016-01-05 16:34:58 -0800 | [diff] [blame] | 149 | if (IS_ENABLED(CONFIG_CACHE_MRC_SETTINGS)) { |
| 150 | printk(BIOS_DEBUG, "MRC data at %p %d bytes\n", |
| 151 | pei_data->data_to_save, pei_data->data_to_save_size); |
Aaron Durbin | 932e09d | 2016-07-13 23:09:52 -0500 | [diff] [blame] | 152 | if ((params->pei_data->boot_mode != ACPI_S3) |
Lee Leahy | a608969 | 2016-01-05 16:34:58 -0800 | [diff] [blame] | 153 | && (params->pei_data->data_to_save_size != 0) |
| 154 | && (params->pei_data->data_to_save != NULL)) |
Lee Leahy | 216712a | 2017-03-17 11:23:32 -0700 | [diff] [blame] | 155 | mrc_cache_stash_data(MRC_TRAINING_DATA, |
| 156 | params->fsp_version, |
| 157 | params->pei_data->data_to_save, |
| 158 | params->pei_data->data_to_save_size); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 159 | } |
| 160 | |
| 161 | /* Save DIMM information */ |
Subrata Banik | 0beac81 | 2017-07-12 15:13:53 +0530 | [diff] [blame] | 162 | if (!s3wake) |
| 163 | mainboard_save_dimm_info(params); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 164 | |
| 165 | /* Create romstage handof information */ |
Aaron Durbin | 77e1399 | 2016-11-29 17:43:04 -0600 | [diff] [blame] | 166 | if (romstage_handoff_init( |
| 167 | params->power_state->prev_sleep_state == ACPI_S3) < 0) |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 168 | hard_reset(); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 169 | |
Duncan Laurie | fe4983e | 2016-03-14 09:29:09 -0700 | [diff] [blame] | 170 | /* |
| 171 | * Initialize the TPM, unless the TPM was already initialized |
| 172 | * in verstage and used to verify romstage. |
| 173 | */ |
| 174 | if (IS_ENABLED(CONFIG_LPC_TPM) && |
| 175 | !IS_ENABLED(CONFIG_RESUME_PATH_SAME_AS_BOOT) && |
| 176 | !IS_ENABLED(CONFIG_VBOOT_STARTS_IN_BOOTBLOCK)) |
| 177 | init_tpm(params->power_state->prev_sleep_state == |
Aaron Durbin | 932e09d | 2016-07-13 23:09:52 -0500 | [diff] [blame] | 178 | ACPI_S3); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 179 | } |
| 180 | |
Aaron Durbin | e6af4be | 2015-09-24 12:26:31 -0500 | [diff] [blame] | 181 | void after_cache_as_ram_stage(void) |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 182 | { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 183 | /* Load the ramstage. */ |
Kyösti Mälkki | 65e8f64 | 2016-06-27 11:27:56 +0300 | [diff] [blame] | 184 | run_ramstage(); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 185 | die("ERROR - Failed to load ramstage!"); |
| 186 | } |
| 187 | |
| 188 | /* Initialize the power state */ |
| 189 | __attribute__((weak)) struct chipset_power_state *fill_power_state(void) |
| 190 | { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 191 | return NULL; |
| 192 | } |
| 193 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 194 | /* Board initialization before and after RAM is enabled */ |
| 195 | __attribute__((weak)) void mainboard_romstage_entry( |
| 196 | struct romstage_params *params) |
| 197 | { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 198 | post_code(0x31); |
| 199 | |
| 200 | /* Initliaze memory */ |
| 201 | romstage_common(params); |
| 202 | } |
| 203 | |
| 204 | /* Save the DIMM information for SMBIOS table 17 */ |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 205 | __attribute__((weak)) void mainboard_save_dimm_info( |
| 206 | struct romstage_params *params) |
| 207 | { |
| 208 | int channel; |
| 209 | CHANNEL_INFO *channel_info; |
| 210 | int dimm; |
| 211 | DIMM_INFO *dimm_info; |
| 212 | int dimm_max; |
| 213 | void *hob_list_ptr; |
| 214 | EFI_HOB_GUID_TYPE *hob_ptr; |
| 215 | int index; |
| 216 | struct memory_info *mem_info; |
| 217 | FSP_SMBIOS_MEMORY_INFO *memory_info_hob; |
| 218 | const EFI_GUID memory_info_hob_guid = FSP_SMBIOS_MEMORY_INFO_GUID; |
| 219 | |
| 220 | /* Locate the memory info HOB, presence validated by raminit */ |
| 221 | hob_list_ptr = fsp_get_hob_list(); |
| 222 | hob_ptr = get_next_guid_hob(&memory_info_hob_guid, hob_list_ptr); |
| 223 | memory_info_hob = (FSP_SMBIOS_MEMORY_INFO *)(hob_ptr + 1); |
| 224 | |
| 225 | /* Display the data in the FSP_SMBIOS_MEMORY_INFO HOB */ |
| 226 | if (IS_ENABLED(CONFIG_DISPLAY_HOBS)) { |
| 227 | printk(BIOS_DEBUG, "FSP_SMBIOS_MEMORY_INFO HOB\n"); |
| 228 | printk(BIOS_DEBUG, " 0x%02x: Revision\n", |
| 229 | memory_info_hob->Revision); |
| 230 | printk(BIOS_DEBUG, " 0x%02x: MemoryType\n", |
| 231 | memory_info_hob->MemoryType); |
Lee Leahy | 0be6d93 | 2015-06-26 11:15:42 -0700 | [diff] [blame] | 232 | printk(BIOS_DEBUG, " %d: MemoryFrequencyInMHz\n", |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 233 | memory_info_hob->MemoryFrequencyInMHz); |
Lee Leahy | 0be6d93 | 2015-06-26 11:15:42 -0700 | [diff] [blame] | 234 | printk(BIOS_DEBUG, " %d: DataWidth in bits\n", |
| 235 | memory_info_hob->DataWidth); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 236 | printk(BIOS_DEBUG, " 0x%02x: ErrorCorrectionType\n", |
| 237 | memory_info_hob->ErrorCorrectionType); |
| 238 | printk(BIOS_DEBUG, " 0x%02x: ChannelCount\n", |
| 239 | memory_info_hob->ChannelCount); |
| 240 | for (channel = 0; channel < memory_info_hob->ChannelCount; |
| 241 | channel++) { |
| 242 | channel_info = &memory_info_hob->ChannelInfo[channel]; |
| 243 | printk(BIOS_DEBUG, " Channel %d\n", channel); |
| 244 | printk(BIOS_DEBUG, " 0x%02x: ChannelId\n", |
| 245 | channel_info->ChannelId); |
| 246 | printk(BIOS_DEBUG, " 0x%02x: DimmCount\n", |
| 247 | channel_info->DimmCount); |
| 248 | for (dimm = 0; dimm < channel_info->DimmCount; |
| 249 | dimm++) { |
| 250 | dimm_info = &channel_info->DimmInfo[dimm]; |
| 251 | printk(BIOS_DEBUG, " DIMM %d\n", dimm); |
| 252 | printk(BIOS_DEBUG, " 0x%02x: DimmId\n", |
| 253 | dimm_info->DimmId); |
Lee Leahy | 0be6d93 | 2015-06-26 11:15:42 -0700 | [diff] [blame] | 254 | printk(BIOS_DEBUG, " %d: SizeInMb\n", |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 255 | dimm_info->SizeInMb); |
| 256 | } |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | /* |
| 261 | * Allocate CBMEM area for DIMM information used to populate SMBIOS |
| 262 | * table 17 |
| 263 | */ |
| 264 | mem_info = cbmem_add(CBMEM_ID_MEMINFO, sizeof(*mem_info)); |
| 265 | printk(BIOS_DEBUG, "CBMEM entry for DIMM info: 0x%p\n", mem_info); |
| 266 | if (mem_info == NULL) |
| 267 | return; |
| 268 | memset(mem_info, 0, sizeof(*mem_info)); |
| 269 | |
| 270 | /* Describe the first N DIMMs in the system */ |
| 271 | index = 0; |
| 272 | dimm_max = ARRAY_SIZE(mem_info->dimm); |
| 273 | for (channel = 0; channel < memory_info_hob->ChannelCount; channel++) { |
| 274 | if (index >= dimm_max) |
| 275 | break; |
| 276 | channel_info = &memory_info_hob->ChannelInfo[channel]; |
| 277 | for (dimm = 0; dimm < channel_info->DimmCount; dimm++) { |
| 278 | if (index >= dimm_max) |
| 279 | break; |
| 280 | dimm_info = &channel_info->DimmInfo[dimm]; |
| 281 | |
| 282 | /* Populate the DIMM information */ |
| 283 | if (dimm_info->SizeInMb) { |
| 284 | mem_info->dimm[index].dimm_size = |
| 285 | dimm_info->SizeInMb; |
| 286 | mem_info->dimm[index].ddr_type = |
| 287 | memory_info_hob->MemoryType; |
| 288 | mem_info->dimm[index].ddr_frequency = |
| 289 | memory_info_hob->MemoryFrequencyInMHz; |
| 290 | mem_info->dimm[index].channel_num = |
| 291 | channel_info->ChannelId; |
| 292 | mem_info->dimm[index].dimm_num = |
| 293 | dimm_info->DimmId; |
Lee Leahy | 0be6d93 | 2015-06-26 11:15:42 -0700 | [diff] [blame] | 294 | switch (memory_info_hob->DataWidth) { |
| 295 | default: |
| 296 | case 8: |
| 297 | mem_info->dimm[index].bus_width = |
| 298 | MEMORY_BUS_WIDTH_8; |
| 299 | break; |
| 300 | |
| 301 | case 16: |
| 302 | mem_info->dimm[index].bus_width = |
| 303 | MEMORY_BUS_WIDTH_16; |
| 304 | break; |
| 305 | |
| 306 | case 32: |
| 307 | mem_info->dimm[index].bus_width = |
| 308 | MEMORY_BUS_WIDTH_32; |
| 309 | break; |
| 310 | |
| 311 | case 64: |
| 312 | mem_info->dimm[index].bus_width = |
| 313 | MEMORY_BUS_WIDTH_64; |
| 314 | break; |
| 315 | |
| 316 | case 128: |
| 317 | mem_info->dimm[index].bus_width = |
| 318 | MEMORY_BUS_WIDTH_128; |
| 319 | break; |
| 320 | } |
Duncan Laurie | 46a2c77 | 2015-07-20 16:48:55 -0700 | [diff] [blame] | 321 | |
| 322 | /* Add any mainboard specific information */ |
| 323 | mainboard_add_dimm_info(params, mem_info, |
| 324 | channel, dimm, index); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 325 | index++; |
| 326 | } |
| 327 | } |
| 328 | } |
| 329 | mem_info->dimm_cnt = index; |
| 330 | printk(BIOS_DEBUG, "%d DIMMs found\n", mem_info->dimm_cnt); |
| 331 | } |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 332 | |
Duncan Laurie | 46a2c77 | 2015-07-20 16:48:55 -0700 | [diff] [blame] | 333 | /* Add any mainboard specific information */ |
| 334 | __attribute__((weak)) void mainboard_add_dimm_info( |
| 335 | struct romstage_params *params, |
| 336 | struct memory_info *mem_info, |
| 337 | int channel, int dimm, int index) |
| 338 | { |
Duncan Laurie | 46a2c77 | 2015-07-20 16:48:55 -0700 | [diff] [blame] | 339 | } |
| 340 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 341 | /* Get the memory configuration data */ |
Aaron Durbin | 31be2c9 | 2016-12-03 22:08:20 -0600 | [diff] [blame] | 342 | __attribute__((weak)) int mrc_cache_get_current(int type, uint32_t version, |
| 343 | struct region_device *rdev) |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 344 | { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 345 | return -1; |
| 346 | } |
| 347 | |
| 348 | /* Save the memory configuration data */ |
Aaron Durbin | 31be2c9 | 2016-12-03 22:08:20 -0600 | [diff] [blame] | 349 | __attribute__((weak)) int mrc_cache_stash_data(int type, uint32_t version, |
| 350 | const void *data, size_t size) |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 351 | { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 352 | return -1; |
| 353 | } |
| 354 | |
| 355 | /* Transition RAM from off or self-refresh to active */ |
| 356 | __attribute__((weak)) void raminit(struct romstage_params *params) |
| 357 | { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 358 | post_code(0x34); |
| 359 | die("ERROR - No RAM initialization specified!\n"); |
| 360 | } |
| 361 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 362 | /* Display the memory configuration */ |
| 363 | __attribute__((weak)) void report_memory_config(void) |
| 364 | { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 365 | } |
| 366 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 367 | /* Choose top of stack and setup MTRRs */ |
| 368 | __attribute__((weak)) void *setup_stack_and_mtrrs(void) |
| 369 | { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 370 | die("ERROR - Must specify top of stack!\n"); |
| 371 | return NULL; |
| 372 | } |
| 373 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 374 | /* SOC initialization after RAM is enabled */ |
| 375 | __attribute__((weak)) void soc_after_ram_init(struct romstage_params *params) |
| 376 | { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 377 | } |
| 378 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 379 | /* SOC initialization before RAM is enabled */ |
| 380 | __attribute__((weak)) void soc_pre_ram_init(struct romstage_params *params) |
| 381 | { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 382 | } |