Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 1 | /* $NoKeywords:$ */ |
| 2 | /** |
| 3 | * @file |
| 4 | * |
| 5 | * Northbridge utility routines. |
| 6 | * |
| 7 | * These routines are needed for support of more than one feature area. |
| 8 | * Collect them in this file so build options don't remove them. |
| 9 | * |
| 10 | * @xrefitem bom "File Content Label" "Release Content" |
| 11 | * @e project: AGESA |
| 12 | * @e sub-project: HyperTransport |
efdesign98 | 0bcfff7 | 2011-09-14 15:52:09 -0600 | [diff] [blame] | 13 | * @e \$Revision: 34897 $ @e \$Date: 2010-07-14 10:07:10 +0800 (Wed, 14 Jul 2010) $ |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 14 | * |
| 15 | */ |
| 16 | /* |
| 17 | ***************************************************************************** |
| 18 | * |
| 19 | * Copyright (c) 2011, Advanced Micro Devices, Inc. |
| 20 | * All rights reserved. |
Edward O'Callaghan | 1542a6f | 2014-07-06 19:24:06 +1000 | [diff] [blame] | 21 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 22 | * Redistribution and use in source and binary forms, with or without |
| 23 | * modification, are permitted provided that the following conditions are met: |
| 24 | * * Redistributions of source code must retain the above copyright |
| 25 | * notice, this list of conditions and the following disclaimer. |
| 26 | * * Redistributions in binary form must reproduce the above copyright |
| 27 | * notice, this list of conditions and the following disclaimer in the |
| 28 | * documentation and/or other materials provided with the distribution. |
Edward O'Callaghan | 1542a6f | 2014-07-06 19:24:06 +1000 | [diff] [blame] | 29 | * * Neither the name of Advanced Micro Devices, Inc. nor the names of |
| 30 | * its contributors may be used to endorse or promote products derived |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 31 | * from this software without specific prior written permission. |
Edward O'Callaghan | 1542a6f | 2014-07-06 19:24:06 +1000 | [diff] [blame] | 32 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 33 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 34 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 35 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 36 | * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY |
| 37 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 38 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 39 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 40 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 41 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 42 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Edward O'Callaghan | 1542a6f | 2014-07-06 19:24:06 +1000 | [diff] [blame] | 43 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 44 | * *************************************************************************** |
| 45 | * |
| 46 | */ |
| 47 | |
| 48 | /* |
| 49 | *---------------------------------------------------------------------------- |
| 50 | * MODULES USED |
| 51 | * |
| 52 | *---------------------------------------------------------------------------- |
| 53 | */ |
| 54 | |
| 55 | |
| 56 | |
| 57 | #include "AGESA.h" |
| 58 | #include "amdlib.h" |
| 59 | #include "Ids.h" |
| 60 | #include "Topology.h" |
| 61 | #include "htFeat.h" |
| 62 | #include "htNb.h" |
| 63 | #include "htNbHardwareFam10.h" |
| 64 | #include "htNbUtilitiesFam14.h" |
| 65 | #include "Filecode.h" |
| 66 | #define FILECODE PROC_HT_FAM14_HTNBUTILITIESFAM14_FILECODE |
| 67 | /*---------------------------------------------------------------------------- |
| 68 | * DEFINITIONS AND MACROS |
| 69 | * |
| 70 | *---------------------------------------------------------------------------- |
| 71 | */ |
| 72 | |
| 73 | /*----------------------------------------------------------------------------------------*/ |
| 74 | /** |
| 75 | * Return the number of cores (1 based count) on Node. |
| 76 | * |
| 77 | * @HtNbMethod{::F_GET_NUM_CORES_ON_NODE} |
| 78 | * |
| 79 | * @param[in] Node the Node that will be examined |
| 80 | * @param[in] Nb this northbridge |
| 81 | * |
| 82 | * @return the number of cores |
| 83 | */ |
| 84 | UINT8 |
| 85 | Fam14GetNumCoresOnNode ( |
| 86 | IN UINT8 Node, |
| 87 | IN NORTHBRIDGE *Nb |
| 88 | ) |
| 89 | { |
| 90 | UINT32 Cores; |
| 91 | PCI_ADDR Reg; |
| 92 | |
| 93 | ASSERT ((Node < MAX_NODES)); |
| 94 | // Read CmpCap |
| 95 | Reg.AddressValue = MAKE_SBDFO (MakePciSegmentFromNode (Node), |
| 96 | MakePciBusFromNode (Node), |
| 97 | MakePciDeviceFromNode (Node), |
| 98 | CPU_NB_FUNC_03, |
| 99 | REG_NB_CAPABILITY_3XE8); |
| 100 | |
| 101 | LibAmdPciReadBits (Reg, 13, 12, &Cores, Nb->ConfigHandle); |
| 102 | |
| 103 | return (UINT8) (Cores + 1); |
| 104 | } |
| 105 | |
| 106 | /*----------------------------------------------------------------------------------------*/ |
| 107 | /** |
| 108 | * Get the Count (1 based) of Nodes in the system. |
| 109 | * |
| 110 | * @HtNbMethod{::F_GET_NODE_COUNT} |
| 111 | * |
| 112 | * This is intended to support AP Core HT init, since the Discovery State data is not |
| 113 | * available (State->NodesDiscovered), there needs to be this way to find the number |
| 114 | * of Nodes, which is just one. |
| 115 | * |
| 116 | * @param[in] Nb this northbridge |
| 117 | * |
| 118 | * @return The number of nodes |
| 119 | */ |
| 120 | UINT8 |
| 121 | Fam14GetNodeCount ( |
| 122 | IN NORTHBRIDGE *Nb |
| 123 | ) |
| 124 | { |
| 125 | ASSERT (Nb != NULL); |
| 126 | return (1); |
| 127 | } |
| 128 | |
efdesign98 | 0bcfff7 | 2011-09-14 15:52:09 -0600 | [diff] [blame] | 129 | AP_MAIL_INFO |
| 130 | Fam14RetrieveMailbox ( |
| 131 | IN UINT8 Node, |
| 132 | IN NORTHBRIDGE *Nb |
| 133 | ) |
| 134 | { |
| 135 | AP_MAIL_INFO NodeApMailBox; |
| 136 | ASSERT (Nb != NULL); |
| 137 | NodeApMailBox.Info = 0; |
| 138 | return NodeApMailBox; |
| 139 | } |