Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 1 | /** |
| 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'Callaghan | ef5981b | 2014-07-06 19:20:52 +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 | ef5981b | 2014-07-06 19:20:52 +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 | ef5981b | 2014-07-06 19:20:52 +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 | ef5981b | 2014-07-06 19:20:52 +1000 | [diff] [blame] | 42 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 43 | * *************************************************************************** |
| 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 | |
| 64 | VOID saveConfigPointer (IN AMDSBCFG* pConfig); |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 65 | |
| 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 | */ |
| 84 | AGESA_STATUS |
| 85 | AmdSbDispatcher ( |
| 86 | IN VOID *pConfig |
| 87 | ) |
| 88 | { |
| 89 | AGESA_STATUS Status; |
| 90 | |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 91 | UINT64 tdValue; |
| 92 | tdValue = 0x32314130384253ULL; |
| 93 | |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 94 | Status = AGESA_UNSUPPORTED; |
| 95 | |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 96 | saveConfigPointer (pConfig); |
| 97 | |
| 98 | if ( ((AMD_CONFIG_PARAMS*)pConfig)->Func == SB_POWERON_INIT ) { |
| 99 | sbPowerOnInit ((AMDSBCFG*) pConfig); |
| 100 | } |
| 101 | |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 102 | 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'Callaghan | 48b6b97 | 2014-11-09 12:06:19 +1100 | [diff] [blame] | 135 | sbECfancontrolservice((AMDSBCFG*)pConfig); |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 136 | } |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 137 | return Status; |
| 138 | } |
| 139 | |
| 140 | /** |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 141 | * saveConfigPointer - Verify Southbridge CIMx module |
| 142 | * |
| 143 | * |
| 144 | * @param[in] pConfig Southbridge configuration structure pointer. |
| 145 | * |
| 146 | */ |
| 147 | VOID |
| 148 | saveConfigPointer ( |
| 149 | IN AMDSBCFG* pConfig |
| 150 | ) |
| 151 | { |
| 152 | UINT8 dbReg; |
| 153 | UINT8 i; |
| 154 | UINT32 ddValue; |
| 155 | |
Stefan Reinauer | df3b8e6 | 2015-06-17 16:05:05 -0700 | [diff] [blame] | 156 | ddValue = (UINT32) (UINTN)pConfig; // Needs to live below 4G |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 157 | 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 | } |