d2bef3868ef1878eeb99d80e2dcf4a63cb0dd383
[coreboot.git] / src / northbridge / amd / amdmct / amddefs.h
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2007-2008 Advanced Micro Devices, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18  */
19
20 /* FIXME: this file should be moved to include/cpu/amd/amddefs.h */
21
22 /* Public Revisions - USE THESE VERSIONS TO MAKE COMPARE WITH CPULOGICALID RETURN VALUE*/
23 #define AMD_SAFEMODE    0x80000000      /* Unknown future revision - SAFE MODE */
24 #define AMD_NPT_F0      0x00000001      /* F0 stepping */
25 #define AMD_NPT_F1      0x00000002      /* F1 stepping */
26 #define AMD_NPT_F2C     0x00000004
27 #define AMD_NPT_F2D     0x00000008
28 #define AMD_NPT_F2E     0x00000010      /* F2 stepping E */
29 #define AMD_NPT_F2G     0x00000020      /* F2 stepping G */
30 #define AMD_NPT_F2J     0x00000040
31 #define AMD_NPT_F2K     0x00000080
32 #define AMD_NPT_F3L     0x00000100      /* F3 Stepping */
33 #define AMD_NPT_G0A     0x00000200      /* G0 stepping */
34 #define AMD_NPT_G1B     0x00000400      /* G1 stepping */
35 #define AMD_DR_A0A      0x00010000      /* Barcelona A0 */
36 #define AMD_DR_A1B      0x00020000      /* Barcelona A1 */
37 #define AMD_DR_A2       0x00040000      /* Barcelona A2 */
38 #define AMD_DR_B0       0x00080000      /* Barcelona B0 */
39 #define AMD_DR_B1       0x00100000      /* Barcelona B1 */
40 #define AMD_DR_B2       0x00200000      /* Barcelona B2 */
41 #define AMD_DR_BA       0x00400000      /* Barcelona BA */
42 #define AMD_DR_B3       0x00800000      /* Barcelona B3 */
43 #define AMD_RB_C2       0x01000000      /* Shanghai C2 */
44 #define AMD_DA_C2       0x02000000      /* XXXX C2 */
45 #define AMD_HY_D0       0x04000000      /* Istanbul D0 */
46 #define AMD_RB_C3       0x08000000      /* ??? C3 */
47 #define AMD_DA_C3       0x10000000      /* XXXX C3 */
48 #define AMD_HY_D1       0x20000000      /* Istanbul D1 */
49 #define AMD_PH_E0       0x40000000      /* Phenom II X4 X6 */
50
51 /*
52  * Groups - Create as many as you wish, from the above public values
53  */
54 #define AMD_NPT_F2      (AMD_NPT_F2C | AMD_NPT_F2D | AMD_NPT_F2E | AMD_NPT_F2G | AMD_NPT_F2J | AMD_NPT_F2K)
55 #define AMD_NPT_F3      (AMD_NPT_F3L)
56 #define AMD_NPT_Fx      (AMD_NPT_F0 | AMD_NPT_F1 | AMD_NPT_F2 | AMD_NPT_F3)
57 #define AMD_NPT_Gx      (AMD_NPT_G0A | AMD_NPT_G1B)
58 #define AMD_NPT_ALL     (AMD_NPT_Fx | AMD_NPT_Gx)
59 #define AMD_FINEDELAY   (AMD_NPT_F0 | AMD_NPT_F1 | AMD_NPT_F2)
60 #define AMD_GT_F0       (AMD_NPT_ALL AND NOT AMD_NPT_F0)
61 #define AMD_DR_Ax       (AMD_DR_A0A + AMD_DR_A1B + AMD_DR_A2)
62 #define AMD_DR_Bx       (AMD_DR_B0 | AMD_DR_B1 | AMD_DR_B2 | AMD_DR_B3 | AMD_DR_BA)
63 #define AMD_DR_LT_B2    (AMD_DR_B0 | AMD_DR_B1 | AMD_DR_BA)
64 #define AMD_DR_LT_B3    (AMD_DR_B0 | AMD_DR_B1 | AMD_DR_B2 | AMD_DR_BA)
65 #define AMD_DR_GT_B0    (AMD_DR_ALL & ~(AMD_DR_B0))
66 #define AMD_DR_GT_Bx    (AMD_DR_ALL & ~(AMD_DR_Ax | AMD_DR_Bx))
67 #define AMD_DR_ALL      (AMD_DR_Bx)
68 #define AMD_FAM10_ALL   (AMD_DR_ALL | AMD_RB_C2 | AMD_HY_D0 | AMD_DA_C3 | AMD_DA_C2 | AMD_RB_C3 | AMD_HY_D1 | AMD_PH_E0)
69 #define AMD_FAM10_LT_D  (AMD_FAM10_ALL & ~(AMD_HY_D0))
70 #define AMD_FAM10_GT_B0 (AMD_FAM10_ALL & ~(AMD_DR_B0))
71 #define AMD_DA_Cx       (AMD_DA_C2 | AMD_DA_C3)
72 #define AMD_DR_Cx       (AMD_RB_C2 | AMD_RB_C3 | AMD_DA_Cx)
73 #define AMD_FAM10_C3       (AMD_RB_C3 | AMD_DA_C3)
74 #define AMD_DR_Dx       (AMD_HY_D0 | AMD_HY_D1)
75 #define AMD_DRBH_Cx     (AMD_DR_Cx | AMD_HY_D0 )
76 #define AMD_DRBA23_RBC2 (AMD_DR_BA | AMD_DR_B2 | AMD_DR_B3 | AMD_RB_C2 )
77 #define AMD_DR_DAC2_OR_C3       (AMD_DA_C2 | AMD_DA_C3 | AMD_RB_C3)
78
79 /*
80  *  Public Platforms - USE THESE VERSIONS TO MAKE COMPARE WITH CPUPLATFORMTYPE RETURN VALUE
81  */
82 #define AMD_PTYPE_DSK   0x001   /* Desktop/DTR/UP */
83 #define AMD_PTYPE_MOB   0x002   /* Mobile/Cool-n-quiet */
84 #define AMD_PTYPE_SVR   0x004   /* Workstation/Server/Multicore DT */
85 #define AMD_PTYPE_UC    0x008   /* Single Core */
86 #define AMD_PTYPE_DC    0x010   /* Dual Core */
87 #define AMD_PTYPE_MC    0x020   /* Multi Core (>2) */
88 #define AMD_PTYPE_UMA   0x040   /* UMA required */
89
90         /*
91          * Groups - Create as many as you wish, from the above public values
92          */
93 #define AMD_PTYPE_ALL   0xFFFFFFFF      /* A mask for all */
94
95
96 /*
97  * CPU PCI HT PHY REGISTER, LINK TYPES - PRIVATE
98  */
99 #define HTPHY_LINKTYPE_HT3              0x00000001
100 #define HTPHY_LINKTYPE_HT1              0x00000002
101 #define HTPHY_LINKTYPE_COHERENT 0x00000004
102 #define HTPHY_LINKTYPE_NONCOHERENT      0x00000008
103 #define HTPHY_LINKTYPE_CONNECTED        (HTPHY_LINKTYPE_COHERENT | HTPHY_LINKTYPE_NONCOHERENT)
104 #define HTPHY_LINKTYPE_GANGED           0x00000010
105 #define HTPHY_LINKTYPE_UNGANGED 0x00000020
106 #define HTPHY_LINKTYPE_ALL              0x7FFFFFFF
107
108
109 /*
110  * CPU HT PHY REGISTERS, FIELDS, AND MASKS
111  */
112 #define HTPHY_OFFSET_MASK               0xE00001FF
113 #define HTPHY_WRITE_CMD         0x40000000
114 #define HTPHY_IS_COMPLETE_MASK          0x80000000
115 #define HTPHY_DIRECT_MAP                0x20000000
116 #define HTPHY_DIRECT_OFFSET_MASK        0xE000FFFF
117
118
119 /*
120  * Various AMD MSRs
121  */
122 #define CPUID_EXT_PM            0x80000007
123 #define CPUID_MODEL             1
124 #define MCG_CAP         0x00000179
125         #define MCG_CTL_P       8
126 #define MC0_CTL         0x00000400
127 #define MC0_STA         MC0_CTL + 1
128 #define FS_Base         0xC0000100
129 #define SYSCFG                  0xC0010010
130 #define HWCR                    0xC0010015
131 #define NB_CFG                  0xC001001F
132 #define FidVidStatus            0xC0010042
133 #define MC4_CTL_MASK            0xC0010048
134 #define OSVW_ID_Length          0xC0010140
135 #define OSVW_Status             0xC0010141
136 #define CPUIDFEATURES           0xC0011004
137 #define LS_CFG                  0xC0011020
138 #define DC_CFG                  0xC0011022
139 #define BU_CFG                  0xC0011023
140 #define BU_CFG2         0xC001102A
141
142 /*
143  * Processor package types 
144  */
145 #define AMD_PKGTYPE_FrX_1207 0
146 #define AMD_PKGTYPE_AM3_2r2 1
147 #define AMD_PKGTYPE_S1gX 2
148 #define AMD_PKGTYPE_G34 3
149 #define AMD_PKGTYPE_ASB2 4
150 #define AMD_PKGTYPE_C32 5