2 * This file is part of the coreboot project.
4 * Copyright (C) 2011 Advanced Micro Devices, Inc.
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.
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.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 /*----------------------------------------------------------------------------------------
21 * M O D U L E S U S E D
22 *----------------------------------------------------------------------------------------
27 #include "agesawrapper.h"
28 #include "BiosCallOuts.h"
29 #include "cpuRegisters.h"
30 #include "cpuCacheInit.h"
31 #include "cpuApicUtilities.h"
32 #include "cpuEarlyInit.h"
33 #include "cpuLateInit.h"
34 #include "Dispatcher.h"
35 #include "cpuCacheInit.h"
37 #include "platform_oem.h"
39 #include "heapManager.h"
40 #include <cpuFamilyTranslation.h> /* CPU_SPECIFIC_SERVICES */
42 #define FILECODE UNASSIGNED_FILE_FILECODE
44 /*----------------------------------------------------------------------------------------
45 * D E F I N I T I O N S A N D M A C R O S
46 *----------------------------------------------------------------------------------------
49 /* ACPI table pointers returned by AmdInitLate */
50 VOID *DmiTable = NULL;
51 VOID *AcpiPstate = NULL;
52 VOID *AcpiSrat = NULL;
53 VOID *AcpiSlit = NULL;
55 VOID *AcpiWheaMce = NULL;
56 VOID *AcpiWheaCmc = NULL;
57 //VOID *AcpiAlib = NULL;
60 /*----------------------------------------------------------------------------------------
61 * T Y P E D E F S A N D S T R U C T U R E S
62 *----------------------------------------------------------------------------------------
65 /*----------------------------------------------------------------------------------------
66 * P R O T O T Y P E S O F L O C A L F U N C T I O N S
67 *----------------------------------------------------------------------------------------
70 /*----------------------------------------------------------------------------------------
71 * E X P O R T E D F U N C T I O N S
72 *----------------------------------------------------------------------------------------
75 /*---------------------------------------------------------------------------------------
76 * L O C A L F U N C T I O N S
77 *---------------------------------------------------------------------------------------
80 static UINT32 agesawrapper_amdinitcpuio(VOID)
85 AMD_CONFIG_PARAMS StdHeader;
91 /* get the number of coherent nodes in the system */
92 PciAddress.AddressValue = MAKE_SBDFO(0, 0, CONFIG_CDB, FUNC_0, 0x60);
93 LibAmdPciRead(AccessWidth32, PciAddress, &PciData, &StdHeader);
94 nodes = ((PciData >> 4) & 7) + 1; //NodeCnt[2:0]
96 /* Find out the Link ID of Node0 that connects to the
97 * Southbridge (system IO hub). e.g. family10 MCM Processor,
98 * sbLink is Processor0 Link2, internal Node0 Link3
100 PciAddress.AddressValue = MAKE_SBDFO(0, 0, CONFIG_CDB, FUNC_0, 0x64);
101 LibAmdPciRead(AccessWidth32, PciAddress, &PciData, &StdHeader);
102 sblink = (PciData >> 8) & 3; //assume ganged
104 /* Enable MMIO on AMD CPU Address Map Controller for all nodes */
105 for (node = 0; node < nodes; node++) {
106 /* clear all MMIO Mapped Base/Limit Registers */
107 for (i = 0; i < 8; i++) {
108 PciData = 0x00000000;
109 PciAddress.AddressValue = MAKE_SBDFO(0, 0, CONFIG_CDB + node, FUNC_1, 0x80 + i*8);
110 LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);
111 PciAddress.AddressValue = MAKE_SBDFO(0, 0, CONFIG_CDB + node, FUNC_1, 0x84 + i*8);
112 LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);
115 /* clear all IO Space Base/Limit Registers */
116 for (i = 0; i < 4; i++) {
117 PciData = 0x00000000;
118 PciAddress.AddressValue = MAKE_SBDFO(0, 0, CONFIG_CDB + node, FUNC_1, 0xC4 + i*8);
119 LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);
120 PciAddress.AddressValue = MAKE_SBDFO(0, 0, CONFIG_CDB + node, FUNC_1, 0xC0 + i*8);
121 LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);
124 /* Set VGA Ram MMIO 0000A0000-0000BFFFF to Node0 sbLink */
125 PciAddress.AddressValue = MAKE_SBDFO(0, 0, CONFIG_CDB + node, FUNC_1, 0x84);
126 PciData = 0x00000B00;
127 PciData |= sblink << 4;
128 LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);
129 PciAddress.AddressValue = MAKE_SBDFO(0, 0, CONFIG_CDB + node, FUNC_1, 0x80);
130 PciData = 0x00000A03;
131 LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);
133 /* Set F0000000-FFFFFFFF to Node0 sbLink. */
134 PciAddress.AddressValue = MAKE_SBDFO(0, 0, CONFIG_CDB + node, FUNC_1, 0x8C);
135 PciData = 0x00FFFF00;
136 PciData |= sblink << 4;
137 LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);
138 PciData = 0x00F00000 | 0x03;
139 PciAddress.AddressValue = MAKE_SBDFO(0, 0, CONFIG_CDB + node, FUNC_1, 0x88);
140 LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);
142 /* Set MMCONF space to Node0 sbLink with NP set.
143 * default E0000000-EFFFFFFF
144 * Just have all mmio set to non-posted,
145 * coreboot not implemente the range by range setting yet.
147 PciAddress.AddressValue = MAKE_SBDFO(0, 0, CONFIG_CDB + node, FUNC_1, 0xBC);
148 PciData = CONFIG_MMCONF_BASE_ADDRESS + (CONFIG_MMCONF_BUS_NUMBER * 0x100000);//1MB each bus
149 PciData = (PciData >> 8) & 0xFFFFFF00;
150 PciData |= 0x80; //NP
151 PciData |= sblink << 4;
152 LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);
153 PciAddress.AddressValue = MAKE_SBDFO(0, 0, CONFIG_CDB + node, FUNC_1, 0xB8);
154 PciData = (PCIE_BASE_ADDRESS >> 8) | 0x03;
155 LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);
158 /* Start to set IO 0x9000-0xEFFF to Node0 sbLink with ISA&VGA set. */
159 PciAddress.AddressValue = MAKE_SBDFO(0, 0, CONFIG_CDB + node, FUNC_1, 0xC4);
160 PciData = 0x0000E000;
161 PciData |= sblink << 4;
162 LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);
163 PciAddress.AddressValue = MAKE_SBDFO(0, 0, CONFIG_CDB + node, FUNC_1, 0xC0);
164 PciData = 0x00009033;
165 LibAmdPciWrite(AccessWidth32, PciAddress, &PciData, &StdHeader);
168 Status = AGESA_SUCCESS;
169 return (UINT32)Status;
172 UINT32 agesawrapper_amdinitmmio(VOID)
176 AMD_CONFIG_PARAMS StdHeader;
179 * Set the MMIO Configuration Base Address and Bus Range onto
180 * MMIO configuration base Address MSR register.
182 MsrReg = CONFIG_MMCONF_BASE_ADDRESS | (LibAmdBitScanReverse(CONFIG_MMCONF_BUS_NUMBER) << 2) | 1;
183 LibAmdMsrWrite(0xC0010058, &MsrReg, &StdHeader);
186 * Set the NB_CFG MSR register. Enable CF8 extended configuration cycles.
188 LibAmdMsrRead(0xC001001F, &MsrReg, &StdHeader);
189 MsrReg = MsrReg | (1ULL << 46);
190 LibAmdMsrWrite(0xC001001F, &MsrReg, &StdHeader);
192 /* Set ROM cache onto WP to decrease post time */
193 MsrReg = (0x0100000000ull - CONFIG_ROM_SIZE) | 5;
194 LibAmdMsrWrite (0x20C, &MsrReg, &StdHeader);
195 MsrReg = (0x1000000000ull - CONFIG_ROM_SIZE) | 0x800;
196 LibAmdMsrWrite(0x20D, &MsrReg, &StdHeader);
198 Status = AGESA_SUCCESS;
199 return (UINT32)Status;
202 UINT32 agesawrapper_amdinitreset(VOID)
204 AGESA_STATUS status = AGESA_SUCCESS;
205 AMD_INTERFACE_PARAMS AmdParamStruct;
206 AMD_RESET_PARAMS AmdResetParams;
208 LibAmdMemFill(&AmdParamStruct,
210 sizeof(AMD_INTERFACE_PARAMS),
211 &(AmdParamStruct.StdHeader));
213 LibAmdMemFill(&AmdResetParams,
215 sizeof(AMD_RESET_PARAMS),
216 &(AmdResetParams.StdHeader));
218 AmdParamStruct.AgesaFunctionName = AMD_INIT_RESET;
219 AmdParamStruct.AllocationMethod = ByHost;
220 AmdParamStruct.NewStructSize = sizeof(AMD_RESET_PARAMS);
221 AmdParamStruct.NewStructPtr = &AmdResetParams;
222 AmdParamStruct.StdHeader.AltImageBasePtr = 0;
223 AmdParamStruct.StdHeader.CalloutPtr = NULL;
224 AmdParamStruct.StdHeader.Func = 0;
225 AmdParamStruct.StdHeader.ImageBasePtr = 0;
226 AmdCreateStruct(&AmdParamStruct);
227 AmdResetParams.HtConfig.Depth = 0;
229 //MARG34PI disabled AGESA_ENTRY_INIT_RESET by default
230 //but we need to call AmdCreateStruct to call HeapManagerInit, or the event log not work
231 #if (defined AGESA_ENTRY_INIT_RESET) && (AGESA_ENTRY_INIT_RESET == TRUE)
232 status = AmdInitReset((AMD_RESET_PARAMS *)AmdParamStruct.NewStructPtr);
234 if (status != AGESA_SUCCESS)
235 agesawrapper_amdreadeventlog(AmdParamStruct.StdHeader.HeapStatus);
236 AmdReleaseStruct(&AmdParamStruct);
238 return (UINT32)status;
241 UINT32 agesawrapper_amdinitearly(VOID)
244 AMD_INTERFACE_PARAMS AmdParamStruct;
245 AMD_EARLY_PARAMS *AmdEarlyParamsPtr;
247 CPU_SPECIFIC_SERVICES *FamilySpecificServices;
249 LibAmdMemFill(&AmdParamStruct,
251 sizeof(AMD_INTERFACE_PARAMS),
252 &(AmdParamStruct.StdHeader));
254 AmdParamStruct.AgesaFunctionName = AMD_INIT_EARLY;
255 AmdParamStruct.AllocationMethod = PreMemHeap;
256 AmdParamStruct.StdHeader.AltImageBasePtr = 0;
257 AmdParamStruct.StdHeader.CalloutPtr = (CALLOUT_ENTRY) &GetBiosCallout;
258 AmdParamStruct.StdHeader.Func = 0;
259 AmdParamStruct.StdHeader.ImageBasePtr = 0;
260 AmdCreateStruct(&AmdParamStruct);
262 AmdEarlyParamsPtr = (AMD_EARLY_PARAMS *)AmdParamStruct.NewStructPtr;
263 OemCustomizeInitEarly(AmdEarlyParamsPtr);
265 status = AmdInitEarly((AMD_EARLY_PARAMS *)AmdParamStruct.NewStructPtr);
266 if (status != AGESA_SUCCESS)
267 agesawrapper_amdreadeventlog(AmdParamStruct.StdHeader.HeapStatus);
269 GetCpuServicesOfCurrentCore(&FamilySpecificServices, &AmdParamStruct.StdHeader);
270 FamilySpecificServices->GetTscRate(FamilySpecificServices, &TscRateInMhz, &AmdParamStruct.StdHeader);
271 printk(BIOS_DEBUG, "BSP Frequency: %luMHz\n", TscRateInMhz);
273 AmdReleaseStruct(&AmdParamStruct);
274 return (UINT32)status;
277 UINT32 agesawrapper_amdinitpost(VOID)
282 AMD_INTERFACE_PARAMS AmdParamStruct;
283 BIOS_HEAP_MANAGER *BiosManagerPtr;
285 CPU_SPECIFIC_SERVICES *FamilySpecificServices;
287 LibAmdMemFill(&AmdParamStruct,
289 sizeof(AMD_INTERFACE_PARAMS),
290 &(AmdParamStruct.StdHeader));
292 AmdParamStruct.AgesaFunctionName = AMD_INIT_POST;
293 AmdParamStruct.AllocationMethod = PreMemHeap;
294 AmdParamStruct.StdHeader.AltImageBasePtr = 0;
295 AmdParamStruct.StdHeader.CalloutPtr = (CALLOUT_ENTRY) &GetBiosCallout;
296 AmdParamStruct.StdHeader.Func = 0;
297 AmdParamStruct.StdHeader.ImageBasePtr = 0;
299 AmdCreateStruct(&AmdParamStruct);
300 status = AmdInitPost((AMD_POST_PARAMS *)AmdParamStruct.NewStructPtr);
301 if (status != AGESA_SUCCESS)
302 agesawrapper_amdreadeventlog(AmdParamStruct.StdHeader.HeapStatus);
303 AmdReleaseStruct(&AmdParamStruct);
305 /* Initialize heap space */
306 BiosManagerPtr = (BIOS_HEAP_MANAGER *)BIOS_HEAP_START_ADDRESS;
308 HeadPtr = (UINT32 *) ((UINT8 *) BiosManagerPtr + sizeof(BIOS_HEAP_MANAGER));
309 for (i = 0; i < ((BIOS_HEAP_SIZE/4) - (sizeof(BIOS_HEAP_MANAGER)/4)); i++) {
310 *HeadPtr = 0x00000000;
313 BiosManagerPtr->StartOfAllocatedNodes = 0;
314 BiosManagerPtr->StartOfFreedNodes = 0;
316 GetCpuServicesOfCurrentCore (&FamilySpecificServices, &AmdParamStruct.StdHeader);
317 FamilySpecificServices->GetTscRate (FamilySpecificServices, &TscRateInMhz, &AmdParamStruct.StdHeader);
318 printk(BIOS_DEBUG, "BSP Frequency: %luMHz\n", TscRateInMhz);
320 return (UINT32)status;
323 UINT32 agesawrapper_amdinitenv(VOID)
326 AMD_INTERFACE_PARAMS AmdParamStruct;
328 LibAmdMemFill(&AmdParamStruct,
330 sizeof(AMD_INTERFACE_PARAMS),
331 &(AmdParamStruct.StdHeader));
333 AmdParamStruct.AgesaFunctionName = AMD_INIT_ENV;
334 AmdParamStruct.AllocationMethod = PostMemDram;
335 AmdParamStruct.StdHeader.AltImageBasePtr = 0;
336 AmdParamStruct.StdHeader.CalloutPtr = (CALLOUT_ENTRY) &GetBiosCallout;
337 AmdParamStruct.StdHeader.Func = 0;
338 AmdParamStruct.StdHeader.ImageBasePtr = 0;
339 AmdCreateStruct(&AmdParamStruct);
340 status = AmdInitEnv((AMD_ENV_PARAMS *)AmdParamStruct.NewStructPtr);
341 if (status != AGESA_SUCCESS)
342 agesawrapper_amdreadeventlog(AmdParamStruct.StdHeader.HeapStatus);
344 AmdReleaseStruct(&AmdParamStruct);
345 return (UINT32)status;
348 VOID * agesawrapper_getlateinitptr(int pick)
377 UINT32 agesawrapper_amdinitmid(VOID)
380 AMD_INTERFACE_PARAMS AmdParamStruct;
382 /* Enable MMIO on AMD CPU Address Map Controller */
383 agesawrapper_amdinitcpuio();
385 LibAmdMemFill(&AmdParamStruct,
387 sizeof(AMD_INTERFACE_PARAMS),
388 &(AmdParamStruct.StdHeader));
390 AmdParamStruct.AgesaFunctionName = AMD_INIT_MID;
391 AmdParamStruct.AllocationMethod = PostMemDram;
392 AmdParamStruct.StdHeader.AltImageBasePtr = 0;
393 AmdParamStruct.StdHeader.CalloutPtr = (CALLOUT_ENTRY) &GetBiosCallout;
394 AmdParamStruct.StdHeader.Func = 0;
395 AmdParamStruct.StdHeader.ImageBasePtr = 0;
397 AmdCreateStruct(&AmdParamStruct);
398 status = AmdInitMid((AMD_MID_PARAMS *)AmdParamStruct.NewStructPtr);
399 if (status != AGESA_SUCCESS)
400 agesawrapper_amdreadeventlog(AmdParamStruct.StdHeader.HeapStatus);
401 AmdReleaseStruct(&AmdParamStruct);
403 return (UINT32)status;
406 UINT32 agesawrapper_amdinitlate(VOID)
409 AMD_LATE_PARAMS AmdLateParams;
411 LibAmdMemFill(&AmdLateParams,
413 sizeof(AMD_LATE_PARAMS),
414 &(AmdLateParams.StdHeader));
416 AmdLateParams.StdHeader.AltImageBasePtr = 0;
417 AmdLateParams.StdHeader.CalloutPtr = (CALLOUT_ENTRY) &GetBiosCallout;
418 AmdLateParams.StdHeader.Func = 0;
419 AmdLateParams.StdHeader.ImageBasePtr = 0;
420 AmdLateParams.StdHeader.HeapStatus = HEAP_SYSTEM_MEM;
422 Status = AmdInitLate(&AmdLateParams);
423 if (Status != AGESA_SUCCESS) {
424 agesawrapper_amdreadeventlog(AmdLateParams.StdHeader.HeapStatus);
425 ASSERT(Status == AGESA_SUCCESS);
428 DmiTable = AmdLateParams.DmiTable;
429 AcpiPstate = AmdLateParams.AcpiPState;
430 AcpiSrat = AmdLateParams.AcpiSrat;
431 AcpiSlit = AmdLateParams.AcpiSlit;
433 AcpiWheaMce = AmdLateParams.AcpiWheaMce;
434 AcpiWheaCmc = AmdLateParams.AcpiWheaCmc;
435 //AcpiAlib = AmdLateParams.AcpiAlib;
437 return (UINT32)Status;
441 * @param[in] UINTN ApicIdOfCore,
442 * @param[in] AP_EXE_PARAMS *LaunchApParams
444 UINT32 agesawrapper_amdlaterunaptask(UINT32 Data, VOID *ConfigPtr)
447 AMD_LATE_PARAMS AmdLateParams;
449 LibAmdMemFill(&AmdLateParams,
451 sizeof(AMD_LATE_PARAMS),
452 &(AmdLateParams.StdHeader));
454 AmdLateParams.StdHeader.AltImageBasePtr = 0;
455 AmdLateParams.StdHeader.CalloutPtr = (CALLOUT_ENTRY) &GetBiosCallout;
456 AmdLateParams.StdHeader.Func = 0;
457 AmdLateParams.StdHeader.ImageBasePtr = 0;
458 AmdLateParams.StdHeader.HeapStatus = HEAP_TEMP_MEM;
460 printk(BIOS_DEBUG, "AmdLateRunApTask on Core: %x\n", (uint32_t)Data);
461 Status = AmdLateRunApTask((AP_EXE_PARAMS *)ConfigPtr);
462 if (Status != AGESA_SUCCESS) {
463 agesawrapper_amdreadeventlog(AmdLateParams.StdHeader.HeapStatus);
464 ASSERT(Status <= AGESA_UNSUPPORTED);
467 DmiTable = AmdLateParams.DmiTable;
468 AcpiPstate = AmdLateParams.AcpiPState;
469 AcpiSrat = AmdLateParams.AcpiSrat;
470 AcpiSlit = AmdLateParams.AcpiSlit;
472 AcpiWheaMce = AmdLateParams.AcpiWheaMce;
473 AcpiWheaCmc = AmdLateParams.AcpiWheaCmc;
474 // AcpiAlib = AmdLateParams.AcpiAlib;
476 return (UINT32)Status;
482 static void agesa_bound_check(EVENT_PARAMS *event)
484 switch (event->EventInfo) {
485 case CPU_ERROR_HEAP_IS_FULL:
486 printk(BIOS_DEBUG, "Heap allocation for specified buffer handle failed as heap is full\n");
489 case CPU_ERROR_HEAP_BUFFER_HANDLE_IS_ALREADY_USED:
490 printk(BIOS_DEBUG, "Allocation incomplete as buffer has previously been allocated\n");
493 case CPU_ERROR_HEAP_BUFFER_HANDLE_IS_NOT_PRESENT:
494 printk(BIOS_DEBUG, "Unable to locate buffer handle or deallocate heap as buffer handle cannot be located\n");
497 case CPU_ERROR_HEAP_BUFFER_IS_NOT_PRESENT:
498 printk(BIOS_DEBUG, "Unable to locate pointer to the heap buffer\n");
509 static void agesa_alert(EVENT_PARAMS *event)
511 switch (event->EventInfo) {
512 case MEM_ALERT_USER_TMG_MODE_OVERRULED:
513 printk(BIOS_DEBUG, "Socket %lx Dct %lx Channel %lx "
514 "TIMING_MODE_SPECIFIC is requested but can not be applied to current configurations.\n",
520 case MEM_ALERT_ORG_MISMATCH_DIMM:
521 printk(BIOS_DEBUG, "Socket %lx Dct %lx Channel %lx "
522 "DIMM organization miss-match\n",
528 case MEM_ALERT_BK_INT_DIS:
529 printk(BIOS_DEBUG, "Socket %lx Dct %lx Channel %lx "
530 "Bank interleaving disable for internal issue\n",
536 case CPU_EVENT_BIST_ERROR:
537 printk(BIOS_DEBUG, "BIST error: %lx reported on Socket %lx Core %lx\n",
543 case HT_EVENT_HW_SYNCFLOOD:
544 printk(BIOS_DEBUG, "HT_EVENT_DATA_HW_SYNCFLOOD error on Socket %lx Link %lx\n",
549 case HT_EVENT_HW_HTCRC:
550 printk(BIOS_DEBUG, "HT_EVENT_HW_HTCRC error on Socket %lx Link %lx Lanemask:%lx\n",
564 static void agesa_warning(EVENT_PARAMS *event)
567 if (event->EventInfo == CPU_EVENT_STACK_REENTRY) {
569 "The stack has already been enabled and this is a
570 redundant invocation of AMD_ENABLE_STACK. There is no event logged and
571 no data values. The event sub-class is returned along with the status code\n");
576 switch (event->EventInfo >> 24) {
578 printk(BIOS_DEBUG, "Memory: Socket %lx Dct %lx Channel%lx ",
585 printk(BIOS_DEBUG, "Processor: ");
589 printk(BIOS_DEBUG, "Hyper Transport: ");
596 switch (event->EventInfo) {
597 case MEM_WARNING_UNSUPPORTED_QRDIMM:
598 printk(BIOS_DEBUG, "QR DIMMs detected but not supported\n");
601 case MEM_WARNING_UNSUPPORTED_UDIMM:
602 printk(BIOS_DEBUG, "Unbuffered DIMMs detected but not supported\n");
605 case MEM_WARNING_UNSUPPORTED_SODIMM:
606 printk(BIOS_DEBUG, "SO-DIMMs detected but not supported");
609 case MEM_WARNING_UNSUPPORTED_X4DIMM:
610 printk(BIOS_DEBUG, "x4 DIMMs detected but not supported");
613 case MEM_WARNING_UNSUPPORTED_RDIMM:
614 printk(BIOS_DEBUG, "Registered DIMMs detected but not supported");
618 case MEM_WARNING_UNSUPPORTED_LRDIMM:
619 printk(BIOS_DEBUG, "Load Reduced DIMMs detected but not supported");
623 case MEM_WARNING_NO_SPDTRC_FOUND:
624 printk(BIOS_DEBUG, "NO_SPDTRC_FOUND");
627 case MEM_WARNING_EMP_NOT_SUPPORTED:
628 printk(BIOS_DEBUG, "Processor is not capable for EMP");//
631 case MEM_WARNING_EMP_CONFLICT:
632 printk(BIOS_DEBUG, "EMP cannot be enabled if channel interleaving bank interleaving, or bank swizzle is enabled\n");//
635 case MEM_WARNING_EMP_NOT_ENABLED:
636 printk(BIOS_DEBUG, "Memory size is not power of two\n");//
639 case MEM_WARNING_PERFORMANCE_ENABLED_BATTERY_LIFE_PREFERRED:
640 printk(BIOS_DEBUG, "MEM_WARNING_PERFORMANCE_ENABLED_BATTERY_LIFE_PREFERRED\n");
643 case MEM_WARNING_NODE_INTERLEAVING_NOT_ENABLED:
644 printk(BIOS_DEBUG, "MEM_WARNING_NODE_INTERLEAVING_NOT_ENABLED\n");
647 case MEM_WARNING_CHANNEL_INTERLEAVING_NOT_ENABLED:
648 printk(BIOS_DEBUG, "MEM_WARNING_CHANNEL_INTERLEAVING_NOT_ENABLED\n");
651 case MEM_WARNING_BANK_INTERLEAVING_NOT_ENABLED:
652 printk(BIOS_DEBUG, "MEM_WARNING_BANK_INTERLEAVING_NOT_ENABLED\n");
655 case MEM_WARNING_VOLTAGE_1_35_NOT_SUPPORTED:
656 printk(BIOS_DEBUG, "MEM_WARNING_VOLTAGE_1_35_NOT_SUPPORTED\n");
660 case MEM_WARNING_INITIAL_DDR3VOLT_NONZERO:
661 printk(BIOS_DEBUG, "MEM_WARNING_INITIAL_DDR3VOLT_NONZERO\n");
664 case MEM_WARNING_NO_COMMONLY_SUPPORTED_VDDIO:
665 printk(BIOS_DEBUG, "MEM_WARNING_NO_COMMONLY_SUPPORTED_VDDIO\n");
669 case CPU_EVENT_EXECUTION_CACHE_ALLOCATION_ERROR:
670 printk(BIOS_DEBUG, "Allocation rule number that has been violated:");
671 if ((event->EventInfo & 0x000000FF) == 0x01) {
672 printk(BIOS_DEBUG, "AGESA_CACHE_SIZE_REDUCED\n");
673 } else if ((event->EventInfo & 0x000000FF) == 0x02) {
674 printk(BIOS_DEBUG, "AGESA_CACHE_REGIONS_ACROSS_1MB\n");
675 } else if ((event->EventInfo & 0x000000FF) == 0x03) {
676 printk(BIOS_DEBUG, "AGESA_CACHE_REGIONS_ACROSS_4GB\n");
678 printk(BIOS_DEBUG, "cache region index:%lx, start:%lx size:%lx\n",
684 case CPU_WARNING_ADJUSTED_LEVELING_MODE:
685 printk(BIOS_DEBUG, "CPU_WARNING_ADJUSTED_LEVELING_MODE "
686 "requested: %lx, actual level:%lx\n",
691 case CPU_EVENT_PM_PSTATE_OVERCURRENT:
692 printk(BIOS_DEBUG, "CPU_EVENT_PM_PSTATE_OVERCURRENT "
693 "Socket: %lx, Pstate:%lx\n",
698 case CPU_WARNING_NONOPTIMAL_HT_ASSIST_CFG:
699 printk(BIOS_DEBUG, "CPU_WARNING_NONOPTIMAL_HT_ASSIST_CFG\n");
703 case CPU_EVENT_UNKNOWN_PROCESSOR_REVISION:
704 printk(BIOS_DEBUG, "CPU_EVENT_UNKNOWN_PROCESSOR_REVISION, socket: %lx, cpuid:%lx\n",
710 case HT_EVENT_OPT_REQUIRED_CAP_RETRY:
711 printk(BIOS_DEBUG, "HT_EVENT_OPT_REQUIRED_CAP_RETRY, Socket %lx Link %lx Depth %lx\n",
717 case HT_EVENT_OPT_REQUIRED_CAP_GEN3:
718 printk(BIOS_DEBUG, "HT_EVENT_OPT_REQUIRED_CAP_GEN3, Socket %lx Link %lx Depth %lx\n",
724 case HT_EVENT_OPT_UNUSED_LINKS:
725 printk(BIOS_DEBUG, "HT_EVENT_OPT_UNUSED_LINKS, SocketA%lx LinkA%lx SocketB%lx LinkB%lx\n",
732 case HT_EVENT_OPT_LINK_PAIR_EXCEED:
733 printk(BIOS_DEBUG, "HT_EVENT_OPT_LINK_PAIR_EXCEED, SocketA%lx MasterLink%lx SocketB%lx AltLink%lx\n",
747 static void agesa_error(EVENT_PARAMS *event)
750 switch (event->EventInfo >> 24) {
752 printk(BIOS_DEBUG, "Memory: Socket %lx Dct %lx Channel%lx ",
759 printk(BIOS_DEBUG, "Processor: ");
763 printk(BIOS_DEBUG, "Hyper Transport: ");
770 switch (event->EventInfo) {
771 case MEM_ERROR_NO_DQS_POS_RD_WINDOW:
772 printk(BIOS_DEBUG, "No DQS Position window for RD DQS\n");
775 case MEM_ERROR_SMALL_DQS_POS_RD_WINDOW:
776 printk(BIOS_DEBUG, "Small DQS Position window for RD DQS\n");
779 case MEM_ERROR_NO_DQS_POS_WR_WINDOW:
780 printk(BIOS_DEBUG, "No DQS Position window for WR DQS\n");
783 case MEM_ERROR_SMALL_DQS_POS_WR_WINDOW:
784 printk(BIOS_DEBUG, "Small DQS Position window for WR DQS\n");
787 case MEM_ERROR_ECC_DIS:
788 printk(BIOS_DEBUG, "ECC has been disabled as a result of an internal issue\n");
791 case MEM_ERROR_DIMM_SPARING_NOT_ENABLED:
792 printk(BIOS_DEBUG, "DIMM sparing has not been enabled for an internal issues\n");
795 case MEM_ERROR_RCVR_EN_VALUE_TOO_LARGE:
796 printk(BIOS_DEBUG, "Receive Enable value is too large\n");
798 case MEM_ERROR_RCVR_EN_NO_PASSING_WINDOW:
799 printk(BIOS_DEBUG, "There is no DQS receiver enable window\n");
802 case MEM_ERROR_DRAM_ENABLED_TIME_OUT:
803 printk(BIOS_DEBUG, "Time out when polling DramEnabled bit\n");
806 case MEM_ERROR_DCT_ACCESS_DONE_TIME_OUT:
807 printk(BIOS_DEBUG, "Time out when polling DctAccessDone bit\n");
810 case MEM_ERROR_SEND_CTRL_WORD_TIME_OUT:
811 printk(BIOS_DEBUG, "Time out when polling SendCtrlWord bit\n");
814 case MEM_ERROR_PREF_DRAM_TRAIN_MODE_TIME_OUT:
815 printk(BIOS_DEBUG, "Time out when polling PrefDramTrainMode bit\n");
818 case MEM_ERROR_ENTER_SELF_REF_TIME_OUT:
819 printk(BIOS_DEBUG, "Time out when polling EnterSelfRef bit\n");
822 case MEM_ERROR_FREQ_CHG_IN_PROG_TIME_OUT:
823 printk(BIOS_DEBUG, "Time out when polling FreqChgInProg bit\n");
826 case MEM_ERROR_EXIT_SELF_REF_TIME_OUT:
827 printk(BIOS_DEBUG, "Time out when polling ExitSelfRef bit\n");
830 case MEM_ERROR_SEND_MRS_CMD_TIME_OUT:
831 printk(BIOS_DEBUG, "Time out when polling SendMrsCmd bit\n");
834 case MEM_ERROR_SEND_ZQ_CMD_TIME_OUT:
835 printk(BIOS_DEBUG, "Time out when polling SendZQCmd bit\n");
838 case MEM_ERROR_DCT_EXTRA_ACCESS_DONE_TIME_OUT:
839 printk(BIOS_DEBUG, "Time out when polling DctExtraAccessDone bit\n");
842 case MEM_ERROR_MEM_CLR_BUSY_TIME_OUT:
843 printk(BIOS_DEBUG, "Time out when polling MemClrBusy bit\n");
846 case MEM_ERROR_MEM_CLEARED_TIME_OUT:
847 printk(BIOS_DEBUG, "Time out when polling MemCleared bit\n");
850 case MEM_ERROR_FLUSH_WR_TIME_OUT:
851 printk(BIOS_DEBUG, "Time out when polling FlushWr bit\n");
854 case MEM_ERROR_MAX_LAT_NO_WINDOW:
855 printk(BIOS_DEBUG, "Fail to find pass during Max Rd Latency training\n");
858 case MEM_ERROR_PARALLEL_TRAINING_LAUNCH_FAIL:
859 printk(BIOS_DEBUG, "Fail to launch training code on an AP\n");
862 case MEM_ERROR_PARALLEL_TRAINING_TIME_OUT:
863 printk(BIOS_DEBUG, "Fail to finish parallel training\n");
866 case MEM_ERROR_NO_ADDRESS_MAPPING:
867 printk(BIOS_DEBUG, "No address mapping found for a dimm\n");
870 case MEM_ERROR_RCVR_EN_NO_PASSING_WINDOW_EQUAL_LIMIT:
871 printk(BIOS_DEBUG, "There is no DQS receiver enable window and the value is equal to the largest value\n");
874 case MEM_ERROR_RCVR_EN_VALUE_TOO_LARGE_LIMIT_LESS_ONE:
875 printk(BIOS_DEBUG, "Receive Enable value is too large and is 1 less than limit\n");
878 case MEM_ERROR_CHECKSUM_NV_SPDCHK_RESTRT_ERROR:
879 printk(BIOS_DEBUG, "SPD Checksum error for NV_SPDCHK_RESTRT\n");
882 case MEM_ERROR_NO_CHIPSELECT:
883 printk(BIOS_DEBUG, "No chipselects found\n");
886 case MEM_ERROR_UNSUPPORTED_333MHZ_UDIMM:
887 printk(BIOS_DEBUG, "Unbuffered dimm is not supported at 333MHz\n");
890 case MEM_ERROR_WL_PRE_OUT_OF_RANGE:
891 printk(BIOS_DEBUG, "Returned PRE value during write levelizzation was out of range\n");
894 case CPU_ERROR_BRANDID_HEAP_NOT_AVAILABLE:
895 printk(BIOS_DEBUG, "No heap is allocated for BrandId structure\n");
898 case CPU_ERROR_MICRO_CODE_PATCH_IS_NOT_LOADED:
899 printk(BIOS_DEBUG, "Unable to load micro code patch\n");
902 case CPU_ERROR_PSTATE_HEAP_NOT_AVAILABLE:
903 printk(BIOS_DEBUG, "No heap is allocated for the Pstate structure\n");
907 case CPU_ERROR_PM_NB_PSTATE_MISMATCH:
908 printk(BIOS_DEBUG, "NB P-state indicated by Index was disabled due to mismatch between processors\n");
912 case CPU_EVENT_EXECUTION_CACHE_ALLOCATION_ERROR:
913 printk(BIOS_DEBUG, "Allocation rule number that has been violated:");
914 if ((event->EventInfo & 0x000000FF) == 0x04) {
915 printk(BIOS_DEBUG, "AGESA_REGION_NOT_ALIGNED_ON_BOUNDARY\n");
916 } else if ((event->EventInfo & 0x000000FF) == 0x05) {
917 printk(BIOS_DEBUG, "AGESA_START_ADDRESS_LESS_D0000\n");
918 } else if ((event->EventInfo & 0x000000FF) == 0x06) {
919 printk(BIOS_DEBUG, "AGESA_THREE_CACHE_REGIONS_ABOVE_1MB\n");
920 } else if ((event->EventInfo & 0x000000FF) == 0x07) {
921 printk(BIOS_DEBUG, "AGESA_DEALLOCATE_CACHE_REGIONS\n");
923 printk(BIOS_DEBUG, "cache region index:%lx, start:%lx size:%lx\n",
929 case HT_EVENT_COH_NO_TOPOLOGY:
930 printk(BIOS_DEBUG, "no Matching Topology was found during coherent initializatio TotalHtNodes: %lx\n",
934 case HT_EVENT_NCOH_BUID_EXCEED:
935 printk(BIOS_DEBUG, "there is a limit of 32 unit IDs per chain Socket%lx Link%lx Depth%lx"
936 "Current BUID: %lx, Unit Count: %lx\n",
940 event->DataParam4 >> 16,
941 event->DataParam4 & 0x0000FFFF);
944 case HT_EVENT_NCOH_BUS_MAX_EXCEED:
945 printk(BIOS_DEBUG, "maximum auto bus limit exceeded, Socket %lx Link %lx Bus %lx\n",
951 case HT_EVENT_NCOH_CFG_MAP_EXCEED:
952 printk(BIOS_DEBUG, "there is a limit of four non-coherent chains, Socket %lx Link %lx\n",
957 case HT_EVENT_NCOH_DEVICE_FAILED:
958 printk(BIOS_DEBUG, "after assigning an IO Device an ID, it does not respond at the new ID"
959 "Socket %lx Link %lx Depth %lx DeviceID %lx\n",
971 static void agesa_critical(EVENT_PARAMS *event)
973 switch (event->EventInfo) {
974 case MEM_ERROR_HEAP_ALLOCATE_FOR_DMI_TABLE_DDR3:
975 printk(BIOS_DEBUG, "Socket: %lx, Heap allocation error for DMI table for DDR3\n",
979 case MEM_ERROR_HEAP_ALLOCATE_FOR_DMI_TABLE_DDR2:
980 printk(BIOS_DEBUG, "Socket: %lx, Heap allocation error for DMI table for DDR2\n",
984 case MEM_ERROR_UNSUPPORTED_DIMM_CONFIG:
985 printk(BIOS_DEBUG, "Socket: %lx, Dimm population is not supported\n",
989 case HT_EVENT_COH_PROCESSOR_TYPE_MIX:
990 printk(BIOS_DEBUG, "Socket %lx Link %lx TotalSockets %lx, HT_EVENT_COH_PROCESSOR_TYPE_MIX \n",
996 case HT_EVENT_COH_MPCAP_MISMATCH:
997 printk(BIOS_DEBUG, "Socket %lx Link %lx MpCap %lx TotalSockets %lx, HT_EVENT_COH_MPCAP_MISMATCH\n",
1010 static void agesa_fatal(EVENT_PARAMS *event)
1013 switch (event->EventInfo >> 24) {
1015 printk(BIOS_DEBUG, "Memory: Socket %lx Dct %lx Channel%lx ",
1022 printk(BIOS_DEBUG, "Processor: ");
1026 printk(BIOS_DEBUG, "Hyper Transport: ");
1033 switch (event->EventInfo) {
1034 case MEM_ERROR_MINIMUM_MODE:
1035 printk(BIOS_DEBUG, "Running in minimum mode\n");
1038 case MEM_ERROR_MODULE_TYPE_MISMATCH_DIMM:
1039 printk(BIOS_DEBUG, "DIMM modules are missmatched\n");
1042 case MEM_ERROR_NO_DIMM_FOUND_ON_SYSTEM:
1043 printk(BIOS_DEBUG, "No DIMMs have been foun\n");
1046 case MEM_ERROR_MISMATCH_DIMM_CLOCKS:
1047 printk(BIOS_DEBUG, "DIMM clocks miss-matched\n");
1050 case MEM_ERROR_NO_CYC_TIME:
1051 printk(BIOS_DEBUG, "No cycle time found\n");
1053 case MEM_ERROR_HEAP_ALLOCATE_DYN_STORING_OF_TRAINED_TIMINGS:
1054 printk(BIOS_DEBUG, "Heap allocation error with dynamic storing of trained timings\n");
1057 case MEM_ERROR_HEAP_ALLOCATE_FOR_DCT_STRUCT_AND_CH_DEF_STRUCTs:
1058 printk(BIOS_DEBUG, "Heap allocation error for DCT_STRUCT and CH_DEF_STRUCT\n");
1061 case MEM_ERROR_HEAP_ALLOCATE_FOR_REMOTE_TRAINING_ENV:
1062 printk(BIOS_DEBUG, "Heap allocation error with REMOTE_TRAINING_ENV\n");
1065 case MEM_ERROR_HEAP_ALLOCATE_FOR_SPD:
1066 printk(BIOS_DEBUG, "Heap allocation error for SPD data\n");
1069 case MEM_ERROR_HEAP_ALLOCATE_FOR_RECEIVED_DATA:
1070 printk(BIOS_DEBUG, "Heap allocation error for RECEIVED_DATA during parallel training\n");
1073 case MEM_ERROR_HEAP_ALLOCATE_FOR_S3_SPECIAL_CASE_REGISTERS:
1074 printk(BIOS_DEBUG, "Heap allocation error for S3 \"SPECIAL_CASE_REGISTER\"\n");
1077 case MEM_ERROR_HEAP_ALLOCATE_FOR_TRAINING_DATA:
1078 printk(BIOS_DEBUG, "Heap allocation error for Training Data\n");
1081 case MEM_ERROR_HEAP_ALLOCATE_FOR_IDENTIFY_DIMM_MEM_NB_BLOCK:
1082 printk(BIOS_DEBUG, "Heap allocation error for DIMM Identify \"MEM_NB_BLOCK\"\n");
1085 case MEM_ERROR_NO_CONSTRUCTOR_FOR_IDENTIFY_DIMM:
1086 printk(BIOS_DEBUG, "No Constructor for DIMM Identify\n");
1089 case MEM_ERROR_VDDIO_UNSUPPORTED:
1090 printk(BIOS_DEBUG, "VDDIO of the dimms on the board is not supported\n");
1093 case CPU_EVENT_PM_ALL_PSTATE_OVERCURRENT:
1094 printk(BIOS_DEBUG, "Socket: %lx, All PStates exceeded the motherboard current limit on specified socket\n",
1105 * Interprte the agesa event log to an user readable string
1107 static void interpret_agesa_eventlog(EVENT_PARAMS *event)
1109 switch (event->EventClass) {
1110 case AGESA_BOUNDS_CHK:
1111 agesa_bound_check(event);
1119 agesa_warning(event);
1126 case AGESA_CRITICAL:
1127 agesa_critical(event);
1140 * @param HeapStatus -the current HeapStatus
1142 UINT32 agesawrapper_amdreadeventlog(UINT8 HeapStatus)
1144 AGESA_STATUS Status;
1145 EVENT_PARAMS AmdEventParams;
1147 LibAmdMemFill(&AmdEventParams,
1149 sizeof(EVENT_PARAMS),
1150 &(AmdEventParams.StdHeader));
1152 AmdEventParams.StdHeader.AltImageBasePtr = 0;
1153 AmdEventParams.StdHeader.CalloutPtr = NULL;
1154 AmdEventParams.StdHeader.Func = 0;
1155 AmdEventParams.StdHeader.ImageBasePtr = 0;
1156 /* I have to know the current HeapStatus to Locate the EventLogHeapPointer */
1157 AmdEventParams.StdHeader.HeapStatus = HeapStatus;
1158 Status = AmdReadEventLog(&AmdEventParams);
1159 while (AmdEventParams.EventClass != 0) {
1160 printk(BIOS_DEBUG,"\nEventLog: EventClass = %lx, EventInfo = %lx.\n",AmdEventParams.EventClass,AmdEventParams.EventInfo);
1161 printk(BIOS_DEBUG," Param1 = %lx, Param2 = %lx.\n",AmdEventParams.DataParam1,AmdEventParams.DataParam2);
1162 printk(BIOS_DEBUG," Param3 = %lx, Param4 = %lx.\n",AmdEventParams.DataParam3,AmdEventParams.DataParam4);
1163 interpret_agesa_eventlog(&AmdEventParams);
1164 Status = AmdReadEventLog(&AmdEventParams);
1167 return (UINT32)Status;