blob: d487147409d2dead6cc397914c87550153383eb6 [file] [log] [blame]
Frank Vibrans2b4c8312011-02-14 18:30:54 +00001/* $NoKeywords:$ */
2/**
3 * @file
4 *
5 * Initialize GFX configuration data structure.
6 *
7 *
8 *
9 * @xrefitem bom "File Content Label" "Release Content"
10 * @e project: AGESA
11 * @e sub-project: GNB
12 * @e \$Revision: 39255 $ @e \$Date: 2010-10-08 11:27:41 -0700 (Fri, 08 Oct 2010) $
13 *
14 */
15/*
16 *****************************************************************************
17 *
18 * Copyright (c) 2011, Advanced Micro Devices, Inc.
19 * All rights reserved.
Edward O'Callaghan1542a6f2014-07-06 19:24:06 +100020 *
Frank Vibrans2b4c8312011-02-14 18:30:54 +000021 * 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'Callaghan1542a6f2014-07-06 19:24:06 +100028 * * 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 Vibrans2b4c8312011-02-14 18:30:54 +000030 * from this software without specific prior written permission.
Edward O'Callaghan1542a6f2014-07-06 19:24:06 +100031 *
Frank Vibrans2b4c8312011-02-14 18:30:54 +000032 * 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'Callaghan1542a6f2014-07-06 19:24:06 +100042 *
Frank Vibrans2b4c8312011-02-14 18:30:54 +000043 * ***************************************************************************
44 *
45 */
46
47/*----------------------------------------------------------------------------------------
48 * M O D U L E S U S E D
49 *----------------------------------------------------------------------------------------
50 */
51#include "AGESA.h"
52#include "amdlib.h"
53#include "Ids.h"
54#include "heapManager.h"
55#include "Gnb.h"
56#include "GnbGfx.h"
57#include GNB_MODULE_DEFINITIONS (GnbCommonLib)
58#include "GfxConfigPost.h"
59#include "OptionGnb.h"
60#include "Filecode.h"
61#define FILECODE PROC_GNB_MODULES_GNBGFXCONFIG_GFXCONFIGPOST_FILECODE
62/*----------------------------------------------------------------------------------------
63 * D E F I N I T I O N S A N D M A C R O S
64 *----------------------------------------------------------------------------------------
65 */
66
67extern BUILD_OPT_CFG UserOptions;
68extern GNB_BUILD_OPTIONS GnbBuildOptions;
69
70/*----------------------------------------------------------------------------------------
71 * T Y P E D E F S A N D S T R U C T U R E S
72 *----------------------------------------------------------------------------------------
73 */
74
75
76/*----------------------------------------------------------------------------------------
77 * 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
78 *----------------------------------------------------------------------------------------
79 */
efdesign9884cbce22011-08-04 12:09:17 -060080AGESA_STATUS
81GfxConfigPostInterface (
82 IN AMD_CONFIG_PARAMS *StdHeader
83 );
Frank Vibrans2b4c8312011-02-14 18:30:54 +000084
85
86/*----------------------------------------------------------------------------------------*/
87/**
88 * Allocate UMA configuration data
89 *
90 *
91 *
92 * @param[in] StdHeader Standard configuration header
93 * @param[in,out] Gfx Pointer to GFX configuration
94 * @param[in] PlatformConfig Platform configuration
95 * @retval AGESA_STATUS Always succeeds
96 */
97
98AGESA_STATUS
99GfxConfigPostInterface (
100 IN AMD_CONFIG_PARAMS *StdHeader
101 )
102{
103 GFX_PLATFORM_CONFIG *Gfx;
104 AMD_POST_PARAMS *PostParamsPtr;
105 AGESA_STATUS Status;
106 PostParamsPtr = (AMD_POST_PARAMS *)StdHeader;
107 Status = AGESA_SUCCESS;
108 IDS_HDT_CONSOLE (GNB_TRACE, "GfxConfigPostInterface Enter\n");
109 Gfx = GnbAllocateHeapBuffer (AMD_GFX_PLATFORM_CONFIG_HANDLE, sizeof (GFX_PLATFORM_CONFIG), StdHeader);
110 ASSERT (Gfx != NULL);
111 if (Gfx != NULL) {
112 LibAmdMemFill (Gfx, 0x00, sizeof (GFX_PLATFORM_CONFIG), StdHeader);
113 if (GnbBuildOptions.IgfxModeAsPcieEp) {
114 Gfx->GfxControllerMode = GfxControllerPcieEndpointMode;
115 Gfx->GfxPciAddress.AddressValue = MAKE_SBDFO (0, 0, 1, 0, 0);
116 } else {
117 Gfx->GfxControllerMode = GfxControllerLegacyBridgeMode;
118 Gfx->GfxPciAddress.AddressValue = MAKE_SBDFO (0, 1, 5, 0, 0);
119 }
efdesign9884cbce22011-08-04 12:09:17 -0600120 Gfx->StdHeader = StdHeader;
Frank Vibrans2b4c8312011-02-14 18:30:54 +0000121 Gfx->GnbHdAudio = PostParamsPtr->PlatformConfig.GnbHdAudio;
122 Gfx->AbmSupport = PostParamsPtr->PlatformConfig.AbmSupport;
123 Gfx->DynamicRefreshRate = PostParamsPtr->PlatformConfig.DynamicRefreshRate;
124 Gfx->LcdBackLightControl = PostParamsPtr->PlatformConfig.LcdBackLightControl;
125 Gfx->ForceGfxMode = GfxEnableAuto;
126 Gfx->AmdPlatformType = UserOptions.CfgAmdPlatformType;
127 Gfx->GmcClockGating = OptionEnabled;
128 Gfx->GmcPowerGating = GnbBuildOptions.GmcPowerGateStutterOnly ? GmcPowerGatingStutterOnly : GmcPowerGatingWidthStutter;
129 Gfx->UmaSteering = Garlic;
130 GNB_DEBUG_CODE (
131 GfxConfigDebugDump (Gfx);
132 );
133 } else {
134 Status = AGESA_ERROR;
135 }
136 IDS_OPTION_HOOK (IDS_GNB_PLATFORMCFG_OVERRIDE, Gfx, StdHeader);
137 IDS_HDT_CONSOLE (GNB_TRACE, "GfxConfigPostInterface Exit [0x%x]\n", Status);
138 return Status;
139}
140
141
142/*----------------------------------------------------------------------------------------*/
143/**
144 * Debug dump
145 *
146 *
147 *
148 * @param[in] Gfx Pointer to GFX configuration
149 */
150
151VOID
152GfxConfigDebugDump (
153 IN GFX_PLATFORM_CONFIG *Gfx
154 )
155{
156 IDS_HDT_CONSOLE (GFX_MISC, "<-------------- GFX Config Start ------------->\n");
157 IDS_HDT_CONSOLE (GFX_MISC, " HD Audio - %s\n", (Gfx->GnbHdAudio == 0) ? "Disabled" : "Enabled");
158 IDS_HDT_CONSOLE (GFX_MISC, " DynamicRefreshRate - 0x%x\n", Gfx->DynamicRefreshRate);
159 IDS_HDT_CONSOLE (GFX_MISC, " LcdBackLightControl - 0x%x\n", Gfx->LcdBackLightControl);
160 IDS_HDT_CONSOLE (GFX_MISC, " AbmSupport - %s\n", (Gfx->AbmSupport == 0) ? "Disabled" : "Enabled");
161 IDS_HDT_CONSOLE (GFX_MISC, " GmcClockGating - %s\n", (Gfx->GmcClockGating == 0) ? "Disabled" : "Enabled");
162 IDS_HDT_CONSOLE (GFX_MISC, " GmcPowerGating - %s\n",
163 (Gfx->GmcPowerGating == GmcPowerGatingDisabled) ? "Disabled" : (
164 (Gfx->GmcPowerGating == GmcPowerGatingStutterOnly) ? "GmcPowerGatingStutterOnly" : (
165 (Gfx->GmcPowerGating == GmcPowerGatingWidthStutter) ? "GmcPowerGatingWidthStutter" : "Unknown"))
166 );
167 IDS_HDT_CONSOLE (GFX_MISC, " UmaSteering - %s\n",
168 (Gfx->UmaSteering == Onion) ? "Onion" : (
169 (Gfx->UmaSteering == Garlic) ? "Garlic" : "Unknown")
170 );
171 IDS_HDT_CONSOLE (GFX_MISC, " ForceGfxMode - %s\n",
172 (Gfx->ForceGfxMode == GfxEnableAuto) ? "Auto" : (
173 (Gfx->ForceGfxMode == GfxEnableForcePrimary) ? "Force Primary" : (
174 (Gfx->ForceGfxMode == GfxEnableForceSecondary) ? "Force Secondary" : "Unknown"))
175 );
176 IDS_HDT_CONSOLE (GFX_MISC, " UmaMode - %s\n", (Gfx->UmaInfo.UmaMode == UMA_NONE) ? "No UMA" : "UMA");
177 if (Gfx->UmaInfo.UmaMode != UMA_NONE) {
178 IDS_HDT_CONSOLE (GFX_MISC, " UmaBase - 0x%x\n", Gfx->UmaInfo.UmaBase);
179 IDS_HDT_CONSOLE (GFX_MISC, " UmaSize - 0x%x\n", Gfx->UmaInfo.UmaSize);
180 IDS_HDT_CONSOLE (GFX_MISC, " UmaAttributes - 0x%x\n", Gfx->UmaInfo.UmaAttributes);
181 }
182 IDS_HDT_CONSOLE (GFX_MISC, "<-------------- GFX Config End --------------->\n");
183
184}