Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 1 | /* $NoKeywords:$ */ |
| 2 | /** |
| 3 | * @file |
| 4 | * |
| 5 | * PCIe ALIB |
| 6 | * |
| 7 | * |
| 8 | * |
| 9 | * @xrefitem bom "File Content Label" "Release Content" |
| 10 | * @e project: AGESA |
| 11 | * @e sub-project: GNB |
efdesign98 | 84cbce2 | 2011-08-04 12:09:17 -0600 | [diff] [blame] | 12 | * @e \$Revision: 46946 $ @e \$Date: 2011-02-11 11:53:30 -0700 (Fri, 11 Feb 2011) $ |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 13 | * |
| 14 | */ |
| 15 | /* |
| 16 | ***************************************************************************** |
| 17 | * |
| 18 | * Copyright (c) 2011, Advanced Micro Devices, Inc. |
| 19 | * All rights reserved. |
Edward O'Callaghan | 1542a6f | 2014-07-06 19:24:06 +1000 | [diff] [blame] | 20 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 21 | * Redistribution and use in source and binary forms, with or without |
| 22 | * modification, are permitted provided that the following conditions are met: |
| 23 | * * Redistributions of source code must retain the above copyright |
| 24 | * notice, this list of conditions and the following disclaimer. |
| 25 | * * Redistributions in binary form must reproduce the above copyright |
| 26 | * notice, this list of conditions and the following disclaimer in the |
| 27 | * documentation and/or other materials provided with the distribution. |
Edward O'Callaghan | 1542a6f | 2014-07-06 19:24:06 +1000 | [diff] [blame] | 28 | * * Neither the name of Advanced Micro Devices, Inc. nor the names of |
| 29 | * its contributors may be used to endorse or promote products derived |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 30 | * from this software without specific prior written permission. |
Edward O'Callaghan | 1542a6f | 2014-07-06 19:24:06 +1000 | [diff] [blame] | 31 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 33 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 35 | * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY |
| 36 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 37 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 38 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 39 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 40 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 41 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Edward O'Callaghan | 1542a6f | 2014-07-06 19:24:06 +1000 | [diff] [blame] | 42 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 43 | * *************************************************************************** |
| 44 | * |
| 45 | */ |
| 46 | |
| 47 | /*---------------------------------------------------------------------------------------- |
| 48 | * M O D U L E S U S E D |
| 49 | *---------------------------------------------------------------------------------------- |
| 50 | */ |
| 51 | #include "AGESA.h" |
| 52 | #include "Ids.h" |
efdesign98 | 84cbce2 | 2011-08-04 12:09:17 -0600 | [diff] [blame] | 53 | #include "heapManager.h" |
| 54 | #include "Gnb.h" |
| 55 | //#include "GnbPcieFamServices.h" |
| 56 | #include "GnbFuseTable.h" |
| 57 | #include "GnbRegistersON.h" |
| 58 | #include "cpuLateInit.h" |
| 59 | #include GNB_MODULE_DEFINITIONS (GnbCommonLib) |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 60 | #include "F14PcieAlibSsdt.h" |
| 61 | #include "Filecode.h" |
| 62 | #define FILECODE PROC_GNB_PCIE_FAMILY_0X14_F14PCIEALIB_FILECODE |
| 63 | /*---------------------------------------------------------------------------------------- |
| 64 | * D E F I N I T I O N S A N D M A C R O S |
| 65 | *---------------------------------------------------------------------------------------- |
| 66 | */ |
| 67 | |
| 68 | /*---------------------------------------------------------------------------------------- |
| 69 | * T Y P E D E F S A N D S T R U C T U R E S |
| 70 | *---------------------------------------------------------------------------------------- |
| 71 | */ |
| 72 | |
| 73 | |
| 74 | |
| 75 | /*---------------------------------------------------------------------------------------- |
| 76 | * 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 |
| 77 | *---------------------------------------------------------------------------------------- |
| 78 | */ |
efdesign98 | 84cbce2 | 2011-08-04 12:09:17 -0600 | [diff] [blame] | 79 | AGESA_STATUS |
| 80 | PcieFmAlibBuildAcpiTable ( |
| 81 | IN VOID *AlibSsdtPtr, |
| 82 | IN AMD_CONFIG_PARAMS *StdHeader |
| 83 | ); |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 84 | |
efdesign98 | 84cbce2 | 2011-08-04 12:09:17 -0600 | [diff] [blame] | 85 | /*----------------------------------------------------------------------------------------*/ |
| 86 | /** |
| 87 | * Build ALIB ACPI table |
| 88 | * |
| 89 | * |
| 90 | * |
| 91 | * @param[in,out] AlibSsdtPtr Pointer to ALIB SSDT table |
| 92 | * @param[in] StdHeader Standard Configuration Header |
| 93 | * @retval AGESA_SUCCESS |
| 94 | * @retval AGESA_FATAL |
| 95 | */ |
| 96 | |
| 97 | AGESA_STATUS |
| 98 | PcieFmAlibBuildAcpiTable ( |
| 99 | IN VOID *AlibSsdtPtr, |
| 100 | IN AMD_CONFIG_PARAMS *StdHeader |
| 101 | ) |
| 102 | { |
| 103 | AGESA_STATUS AgesaStatus; |
| 104 | D18F4x15C_STRUCT D18F4x15C; |
| 105 | PP_FUSE_ARRAY *PpFuseArray; |
| 106 | UINT32 AmlObjName; |
| 107 | VOID *AmlObjPtr; |
| 108 | |
| 109 | IDS_HDT_CONSOLE (GNB_TRACE, "PcieFmAlibBuildAcpiTable Enter\n"); |
| 110 | AgesaStatus = AGESA_SUCCESS; |
| 111 | // Set voltage configuration |
| 112 | PpFuseArray = GnbLocateHeapBuffer (AMD_PP_FUSE_TABLE_HANDLE, StdHeader); |
| 113 | ASSERT (PpFuseArray != NULL); |
| 114 | if (PpFuseArray != NULL) { |
| 115 | GnbLibPciRead ( |
| 116 | MAKE_SBDFO (0, 0, 0x18, 0x4, D18F4x15C_ADDRESS), |
| 117 | AccessWidth32, |
| 118 | &D18F4x15C.Value, |
| 119 | StdHeader |
| 120 | ); |
| 121 | if (D18F4x15C.Field.BoostSrc != 0 || PpFuseArray->GpuBoostCap != 0) { |
| 122 | // AmlObjName = 'B0DA'; |
efdesign98 | 0bcfff7 | 2011-09-14 15:52:09 -0600 | [diff] [blame] | 123 | AmlObjName = Int32FromChar ('A', 'D', '0', 'B'); |
efdesign98 | 84cbce2 | 2011-08-04 12:09:17 -0600 | [diff] [blame] | 124 | AmlObjPtr = GnbLibFind (AlibSsdtPtr, ((ACPI_TABLE_HEADER*) &AlibSsdt[0])->TableLength, (UINT8*) &AmlObjName, sizeof (AmlObjName)); |
| 125 | ASSERT (AmlObjPtr != NULL); |
| 126 | if (AmlObjPtr != NULL) { |
| 127 | *(UINT8*)((UINT8*) AmlObjPtr + 5) = 1; |
| 128 | } else { |
| 129 | AgesaStatus = AGESA_FATAL; |
| 130 | } |
| 131 | } |
| 132 | } else { |
| 133 | AgesaStatus = AGESA_FATAL; |
| 134 | } |
Edward O'Callaghan | 1542a6f | 2014-07-06 19:24:06 +1000 | [diff] [blame] | 135 | |
efdesign98 | 84cbce2 | 2011-08-04 12:09:17 -0600 | [diff] [blame] | 136 | IDS_HDT_CONSOLE (GNB_TRACE, "PcieFmAlibBuildAcpiTable Exit[0x%x]\n", AgesaStatus); |
| 137 | return AgesaStatus; |
| 138 | } |