Scott Duplichan | a649a96 | 2011-02-24 05:00:33 +0000 | [diff] [blame] | 1 | /* |
| 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. |
Scott Duplichan | a649a96 | 2011-02-24 05:00:33 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #include "AGESA.h" |
| 17 | #include "amdlib.h" |
| 18 | #include "Ids.h" |
| 19 | #include "heapManager.h" |
Kyösti Mälkki | 53052fe | 2016-04-27 09:04:11 +0300 | [diff] [blame] | 20 | #include <PlatformMemoryConfiguration.h> |
Scott Duplichan | a649a96 | 2011-02-24 05:00:33 +0000 | [diff] [blame] | 21 | #include "PlatformGnbPcieComplex.h" |
| 22 | #include "Filecode.h" |
| 23 | |
Edward O'Callaghan | 8864e1c | 2014-04-30 23:13:08 +1000 | [diff] [blame] | 24 | #include <string.h> |
Kyösti Mälkki | 34ad72c | 2014-10-21 13:43:46 +0300 | [diff] [blame] | 25 | #include <northbridge/amd/agesa/agesawrapper.h> |
Edward O'Callaghan | 8864e1c | 2014-04-30 23:13:08 +1000 | [diff] [blame] | 26 | |
Scott Duplichan | a649a96 | 2011-02-24 05:00:33 +0000 | [diff] [blame] | 27 | #define FILECODE PROC_RECOVERY_MEM_NB_ON_MRNON_FILECODE |
| 28 | |
| 29 | /*---------------------------------------------------------------------------------------*/ |
| 30 | /** |
| 31 | * OemCustomizeInitEarly |
| 32 | * |
| 33 | * Description: |
Paul Menzel | 63950f8 | 2013-02-01 23:51:40 +0100 | [diff] [blame] | 34 | * This stub function will call the host environment through the binary block |
Scott Duplichan | a649a96 | 2011-02-24 05:00:33 +0000 | [diff] [blame] | 35 | * interface (call-out port) to provide a user hook opportunity |
| 36 | * |
| 37 | * Parameters: |
Scott Duplichan | a649a96 | 2011-02-24 05:00:33 +0000 | [diff] [blame] | 38 | * @param[in] *InitEarly |
| 39 | * |
| 40 | * @retval VOID |
| 41 | * |
| 42 | **/ |
| 43 | /*---------------------------------------------------------------------------------------*/ |
Kyösti Mälkki | 6e74b2c | 2014-12-16 07:34:58 +0200 | [diff] [blame] | 44 | |
| 45 | static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly) |
Scott Duplichan | a649a96 | 2011-02-24 05:00:33 +0000 | [diff] [blame] | 46 | { |
| 47 | AGESA_STATUS Status; |
| 48 | VOID *BrazosPcieComplexListPtr; |
| 49 | VOID *BrazosPciePortPtr; |
| 50 | VOID *BrazosPcieDdiPtr; |
| 51 | |
| 52 | ALLOCATE_HEAP_PARAMS AllocHeapParams; |
| 53 | |
| 54 | PCIe_PORT_DESCRIPTOR PortList [] = { |
| 55 | // Initialize Port descriptor (PCIe port, Lanes 4, PCI Device Number 4, ...) |
| 56 | { |
Kyösti Mälkki | 9d035fa | 2015-05-23 14:27:44 +0300 | [diff] [blame] | 57 | 0, |
Kyösti Mälkki | 2e3bdcf7 | 2015-01-15 17:42:53 +0200 | [diff] [blame] | 58 | PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 4, 7), |
Paul Menzel | e988b51 | 2013-02-23 00:15:49 +0100 | [diff] [blame] | 59 | PCIE_PORT_DATA_INITIALIZER (GNB_GPP_PORT4_PORT_PRESENT, GNB_GPP_PORT4_CHANNEL_TYPE, 4, GNB_GPP_PORT4_HOTPLUG_SUPPORT, GNB_GPP_PORT4_SPEED_MODE, GNB_GPP_PORT4_SPEED_MODE, GNB_GPP_PORT4_LINK_ASPM, 0) |
Scott Duplichan | a649a96 | 2011-02-24 05:00:33 +0000 | [diff] [blame] | 60 | }, |
Scott Duplichan | a649a96 | 2011-02-24 05:00:33 +0000 | [diff] [blame] | 61 | // Initialize Port descriptor (PCIe port, Lanes 8, PCI Device Number 8, ...) |
| 62 | { |
Kyösti Mälkki | 9d035fa | 2015-05-23 14:27:44 +0300 | [diff] [blame] | 63 | DESCRIPTOR_TERMINATE_LIST, |
Scott Duplichan | a649a96 | 2011-02-24 05:00:33 +0000 | [diff] [blame] | 64 | PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 0, 3), |
| 65 | PCIE_PORT_DATA_INITIALIZER (GNB_GPP_PORT8_PORT_PRESENT, GNB_GPP_PORT8_CHANNEL_TYPE, 8, GNB_GPP_PORT8_HOTPLUG_SUPPORT, GNB_GPP_PORT8_SPEED_MODE, GNB_GPP_PORT8_SPEED_MODE, GNB_GPP_PORT8_LINK_ASPM, 0) |
Stefan Reinauer | 5ff7c13 | 2011-10-31 12:56:45 -0700 | [diff] [blame] | 66 | } |
Scott Duplichan | a649a96 | 2011-02-24 05:00:33 +0000 | [diff] [blame] | 67 | }; |
| 68 | |
| 69 | PCIe_DDI_DESCRIPTOR DdiList [] = { |
| 70 | // Initialize Ddi descriptor (DDI interface Lanes 8:11, DdA, ...) |
| 71 | { |
Kyösti Mälkki | 9d035fa | 2015-05-23 14:27:44 +0300 | [diff] [blame] | 72 | 0, |
Scott Duplichan | a649a96 | 2011-02-24 05:00:33 +0000 | [diff] [blame] | 73 | PCIE_ENGINE_DATA_INITIALIZER (PcieDdiEngine, 8, 11), |
| 74 | //PCIE_DDI_DATA_INITIALIZER (ConnectorTypeDP, Aux1, Hdp1) |
| 75 | {ConnectorTypeDP, Aux1, Hdp1} |
| 76 | }, |
| 77 | // Initialize Ddi descriptor (DDI interface Lanes 12:15, DdB, ...) |
| 78 | { |
Kyösti Mälkki | 9d035fa | 2015-05-23 14:27:44 +0300 | [diff] [blame] | 79 | DESCRIPTOR_TERMINATE_LIST, |
Scott Duplichan | a649a96 | 2011-02-24 05:00:33 +0000 | [diff] [blame] | 80 | PCIE_ENGINE_DATA_INITIALIZER (PcieDdiEngine, 12, 15), |
| 81 | //PCIE_DDI_DATA_INITIALIZER (ConnectorTypeDP, Aux2, Hdp2) |
| 82 | {ConnectorTypeDP, Aux2, Hdp2} |
| 83 | } |
| 84 | }; |
| 85 | |
| 86 | PCIe_COMPLEX_DESCRIPTOR Brazos = { |
| 87 | DESCRIPTOR_TERMINATE_LIST, |
| 88 | 0, |
| 89 | &PortList[0], |
| 90 | &DdiList[0] |
| 91 | }; |
| 92 | |
| 93 | // GNB PCIe topology Porting |
| 94 | |
| 95 | // |
| 96 | // Allocate buffer for PCIe_COMPLEX_DESCRIPTOR , PCIe_PORT_DESCRIPTOR and PCIe_DDI_DESCRIPTOR |
| 97 | // |
Paul Menzel | d189229 | 2013-05-14 10:06:47 +0200 | [diff] [blame] | 98 | AllocHeapParams.RequestedBufferSize = sizeof(Brazos) + sizeof(PortList) + sizeof(DdiList); |
Scott Duplichan | a649a96 | 2011-02-24 05:00:33 +0000 | [diff] [blame] | 99 | |
| 100 | AllocHeapParams.BufferHandle = AMD_MEM_MISC_HANDLES_START; |
| 101 | AllocHeapParams.Persist = HEAP_LOCAL_CACHE; |
| 102 | Status = HeapAllocateBuffer (&AllocHeapParams, &InitEarly->StdHeader); |
Kyösti Mälkki | 1ef67e1 | 2014-12-16 16:45:52 +0200 | [diff] [blame] | 103 | ASSERT(Status == AGESA_SUCCESS); |
Stefan Reinauer | 5ff7c13 | 2011-10-31 12:56:45 -0700 | [diff] [blame] | 104 | |
Scott Duplichan | a649a96 | 2011-02-24 05:00:33 +0000 | [diff] [blame] | 105 | BrazosPcieComplexListPtr = (PCIe_COMPLEX_DESCRIPTOR *) AllocHeapParams.BufferPtr; |
| 106 | |
Paul Menzel | d189229 | 2013-05-14 10:06:47 +0200 | [diff] [blame] | 107 | AllocHeapParams.BufferPtr += sizeof(Brazos); |
Scott Duplichan | a649a96 | 2011-02-24 05:00:33 +0000 | [diff] [blame] | 108 | BrazosPciePortPtr = (PCIe_PORT_DESCRIPTOR *)AllocHeapParams.BufferPtr; |
| 109 | |
Paul Menzel | d189229 | 2013-05-14 10:06:47 +0200 | [diff] [blame] | 110 | AllocHeapParams.BufferPtr += sizeof(PortList); |
Scott Duplichan | a649a96 | 2011-02-24 05:00:33 +0000 | [diff] [blame] | 111 | BrazosPcieDdiPtr = (PCIe_DDI_DESCRIPTOR *) AllocHeapParams.BufferPtr; |
Stefan Reinauer | 5ff7c13 | 2011-10-31 12:56:45 -0700 | [diff] [blame] | 112 | |
Edward O'Callaghan | 8864e1c | 2014-04-30 23:13:08 +1000 | [diff] [blame] | 113 | memcpy(BrazosPcieComplexListPtr, &Brazos, sizeof(Brazos)); |
| 114 | memcpy(BrazosPciePortPtr, &PortList[0], sizeof(PortList)); |
| 115 | memcpy(BrazosPcieDdiPtr, &DdiList[0], sizeof(DdiList)); |
Scott Duplichan | a649a96 | 2011-02-24 05:00:33 +0000 | [diff] [blame] | 116 | |
| 117 | |
| 118 | ((PCIe_COMPLEX_DESCRIPTOR*)BrazosPcieComplexListPtr)->PciePortList = (PCIe_PORT_DESCRIPTOR*)BrazosPciePortPtr; |
| 119 | ((PCIe_COMPLEX_DESCRIPTOR*)BrazosPcieComplexListPtr)->DdiLinkList = (PCIe_DDI_DESCRIPTOR*)BrazosPcieDdiPtr; |
| 120 | |
Stefan Reinauer | 5ff7c13 | 2011-10-31 12:56:45 -0700 | [diff] [blame] | 121 | InitEarly->GnbConfig.PcieComplexList = BrazosPcieComplexListPtr; |
| 122 | InitEarly->GnbConfig.PsppPolicy = 0; |
Kyösti Mälkki | 6e74b2c | 2014-12-16 07:34:58 +0200 | [diff] [blame] | 123 | return AGESA_SUCCESS; |
Scott Duplichan | a649a96 | 2011-02-24 05:00:33 +0000 | [diff] [blame] | 124 | } |
Kyösti Mälkki | 6e74b2c | 2014-12-16 07:34:58 +0200 | [diff] [blame] | 125 | |
Kyösti Mälkki | 53052fe | 2016-04-27 09:04:11 +0300 | [diff] [blame] | 126 | /*---------------------------------------------------------------------------------------- |
| 127 | * CUSTOMER OVERIDES MEMORY TABLE |
| 128 | *---------------------------------------------------------------------------------------- |
| 129 | */ |
| 130 | |
| 131 | /* |
| 132 | * Platform Specific Overriding Table allows IBV/OEM to pass in platform information to AGESA |
| 133 | * (e.g. MemClk routing, the number of DIMM slots per channel,...). If PlatformSpecificTable |
| 134 | * is populated, AGESA will base its settings on the data from the table. Otherwise, it will |
| 135 | * use its default conservative settings. |
| 136 | */ |
| 137 | CONST PSO_ENTRY ROMDATA DefaultPlatformMemoryConfiguration[] = { |
| 138 | NUMBER_OF_DIMMS_SUPPORTED (ANY_SOCKET, ANY_CHANNEL, 2), |
| 139 | NUMBER_OF_CHANNELS_SUPPORTED (ANY_SOCKET, 1), |
| 140 | PSO_END |
| 141 | }; |
| 142 | |
Kyösti Mälkki | 6e74b2c | 2014-12-16 07:34:58 +0200 | [diff] [blame] | 143 | const struct OEM_HOOK OemCustomize = { |
| 144 | .InitEarly = OemInitEarly, |
| 145 | }; |