blob: 1c86c5810a87ed29102b8f9a6d0809ba3aad2129 [file] [log] [blame]
Frank Vibrans2b4c8312011-02-14 18:30:54 +00001/**
2 * @file
3 *
4 * Function dispatcher.
5 *
6 *
7 *
8 * @xrefitem bom "File Content Label" "Release Content"
9 * @e project: CIMx-SB
10 * @e sub-project:
11 * @e \$Revision:$ @e \$Date:$
12 *
13 */
14
15/*
16 *****************************************************************************
17 *
18 * Copyright (c) 2011, Advanced Micro Devices, Inc.
19 * All rights reserved.
Edward O'Callaghanef5981b2014-07-06 19:20:52 +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'Callaghanef5981b2014-07-06 19:20:52 +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'Callaghanef5981b2014-07-06 19:20:52 +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'Callaghanef5981b2014-07-06 19:20:52 +100042 *
Frank Vibrans2b4c8312011-02-14 18:30:54 +000043 * ***************************************************************************
44 *
45 */
46/*----------------------------------------------------------------------------------------
47 * M O D U L E S U S E D
48 *----------------------------------------------------------------------------------------
49 */
50
51#include "SBPLATFORM.h"
52#include "cbtypes.h"
53
54/*----------------------------------------------------------------------------------------
55 * 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
56 *----------------------------------------------------------------------------------------
57*/
58
59
60//
61// Declaration of local functions
62//
63
64VOID saveConfigPointer (IN AMDSBCFG* pConfig);
Frank Vibrans2b4c8312011-02-14 18:30:54 +000065
66/*----------------------------------------------------------------------------------------
67 * T Y P E D E F S A N D S T R U C T U R E S
68 *----------------------------------------------------------------------------------------
69 */
70
71/*----------------------------------------------------------------------------------------
72 * E X P O R T E D F U N C T I O N S
73 *----------------------------------------------------------------------------------------
74 */
75
76/**
77 * AmdSbDispatcher - Dispatch Southbridge function
78 *
79 *
80 *
81 * @param[in] pConfig Southbridge configuration structure pointer.
82 *
83 */
84AGESA_STATUS
85AmdSbDispatcher (
86 IN VOID *pConfig
87 )
88{
89 AGESA_STATUS Status;
90
Frank Vibrans2b4c8312011-02-14 18:30:54 +000091 UINT64 tdValue;
92 tdValue = 0x32314130384253ULL;
93
Frank Vibrans2b4c8312011-02-14 18:30:54 +000094 Status = AGESA_UNSUPPORTED;
95
Frank Vibrans2b4c8312011-02-14 18:30:54 +000096 saveConfigPointer (pConfig);
97
98 if ( ((AMD_CONFIG_PARAMS*)pConfig)->Func == SB_POWERON_INIT ) {
99 sbPowerOnInit ((AMDSBCFG*) pConfig);
100 }
101
Frank Vibrans2b4c8312011-02-14 18:30:54 +0000102 if ( ((AMD_CONFIG_PARAMS*)pConfig)->Func == SB_BEFORE_PCI_INIT ) {
103 sbBeforePciInit ((AMDSBCFG*)pConfig);
104 }
105
106 if ( ((AMD_CONFIG_PARAMS*)pConfig)->Func == SB_AFTER_PCI_INIT ) {
107 sbAfterPciInit ((AMDSBCFG*)pConfig);
108 }
109
110 if ( ((AMD_CONFIG_PARAMS*)pConfig)->Func == SB_MID_POST_INIT ) {
111 sbMidPostInit ((AMDSBCFG*)pConfig);
112 }
113
114 if ( ((AMD_CONFIG_PARAMS*)pConfig)->Func == SB_LATE_POST_INIT ) {
115 sbLatePost ((AMDSBCFG*)pConfig);
116 }
117
118 if ( ((AMD_CONFIG_PARAMS*)pConfig)->Func == SB_BEFORE_PCI_RESTORE_INIT ) {
119 sbBeforePciRestoreInit ((AMDSBCFG*)pConfig);
120 }
121
122 if ( ((AMD_CONFIG_PARAMS*)pConfig)->Func == SB_AFTER_PCI_RESTORE_INIT ) {
123 sbAfterPciRestoreInit ((AMDSBCFG*)pConfig);
124 }
125
126 if ( ((AMD_CONFIG_PARAMS*)pConfig)->Func == SB_SMM_SERVICE ) {
127 sbSmmService ((AMDSBCFG*)pConfig);
128 }
129
130 if ( ((AMD_CONFIG_PARAMS*)pConfig)->Func == SB_SMM_ACPION ) {
131 sbSmmAcpiOn ((AMDSBCFG*)pConfig);
132 }
133
134 if ( ((AMD_CONFIG_PARAMS*)pConfig)->Func == SB_EC_FANCONTROL ) {
Edward O'Callaghan48b6b972014-11-09 12:06:19 +1100135 sbECfancontrolservice((AMDSBCFG*)pConfig);
Frank Vibrans2b4c8312011-02-14 18:30:54 +0000136 }
Frank Vibrans2b4c8312011-02-14 18:30:54 +0000137 return Status;
138}
139
140/**
Frank Vibrans2b4c8312011-02-14 18:30:54 +0000141 * saveConfigPointer - Verify Southbridge CIMx module
142 *
143 *
144 * @param[in] pConfig Southbridge configuration structure pointer.
145 *
146 */
147VOID
148saveConfigPointer (
149 IN AMDSBCFG* pConfig
150 )
151{
152 UINT8 dbReg;
153 UINT8 i;
154 UINT32 ddValue;
155
Stefan Reinauerdf3b8e62015-06-17 16:05:05 -0700156 ddValue = (UINT32) (UINTN)pConfig; // Needs to live below 4G
Frank Vibrans2b4c8312011-02-14 18:30:54 +0000157 dbReg = SB_ECMOS_REG08;
158
159 for ( i = 0; i <= 3; i++ ) {
160 WriteIO (SB_IOMAP_REG72, AccWidthUint8, &dbReg);
161 WriteIO (SB_IOMAP_REG73, AccWidthUint8, (UINT8*)&ddValue);
162 ddValue = (ddValue >> 8);
163 dbReg++;
164 }
165}