Marc Jones | 8ae8c88 | 2007-12-19 01:32:08 +0000 | [diff] [blame] | 1 | /* |
Stefan Reinauer | 7e61e45 | 2008-01-18 10:35:56 +0000 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
Marc Jones | 8ae8c88 | 2007-12-19 01:32:08 +0000 | [diff] [blame] | 3 | * |
Marc Jones | da4ce6b | 2008-04-22 22:11:31 +0000 | [diff] [blame] | 4 | * Copyright (C) 2007-2008 Advanced Micro Devices, Inc. |
Timothy Pearson | 4530df4 | 2015-08-02 21:23:02 -0500 | [diff] [blame] | 5 | * Copyright (C) 2015 Timothy Pearson <tpearson@raptorengineeringinc.com>, Raptor Engineering |
Marc Jones | 8ae8c88 | 2007-12-19 01:32:08 +0000 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Marc Jones | 8ae8c88 | 2007-12-19 01:32:08 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
Marc Jones | da4ce6b | 2008-04-22 22:11:31 +0000 | [diff] [blame] | 17 | /* FIXME: this file should be moved to include/cpu/amd/amddefs.h */ |
| 18 | |
Marc Jones | 8ae8c88 | 2007-12-19 01:32:08 +0000 | [diff] [blame] | 19 | /* Public Revisions - USE THESE VERSIONS TO MAKE COMPARE WITH CPULOGICALID RETURN VALUE*/ |
Timothy Pearson | 730a043 | 2015-10-16 13:51:51 -0500 | [diff] [blame] | 20 | #define AMD_SAFEMODE 0x8000000000000000 /* Unknown future revision - SAFE MODE */ |
| 21 | #define AMD_NPT_F0 0x0000000000000001 /* F0 stepping */ |
| 22 | #define AMD_NPT_F1 0x0000000000000002 /* F1 stepping */ |
| 23 | #define AMD_NPT_F2C 0x0000000000000004 |
| 24 | #define AMD_NPT_F2D 0x0000000000000008 |
| 25 | #define AMD_NPT_F2E 0x0000000000000010 /* F2 stepping E */ |
| 26 | #define AMD_NPT_F2G 0x0000000000000020 /* F2 stepping G */ |
| 27 | #define AMD_NPT_F2J 0x0000000000000040 |
| 28 | #define AMD_NPT_F2K 0x0000000000000080 |
| 29 | #define AMD_NPT_F3L 0x0000000000000100 /* F3 Stepping */ |
| 30 | #define AMD_NPT_G0A 0x0000000000000200 /* G0 stepping */ |
| 31 | #define AMD_NPT_G1B 0x0000000000000400 /* G1 stepping */ |
| 32 | #define AMD_DR_A0A 0x0000000000010000 /* Barcelona A0 */ |
| 33 | #define AMD_DR_A1B 0x0000000000020000 /* Barcelona A1 */ |
| 34 | #define AMD_DR_A2 0x0000000000040000 /* Barcelona A2 */ |
| 35 | #define AMD_DR_B0 0x0000000000080000 /* Barcelona B0 */ |
| 36 | #define AMD_DR_B1 0x0000000000100000 /* Barcelona B1 */ |
| 37 | #define AMD_DR_B2 0x0000000000200000 /* Barcelona B2 */ |
| 38 | #define AMD_DR_BA 0x0000000000400000 /* Barcelona BA */ |
| 39 | #define AMD_DR_B3 0x0000000000800000 /* Barcelona B3 */ |
| 40 | #define AMD_RB_C2 0x0000000001000000 /* Shanghai C2 */ |
| 41 | #define AMD_DA_C2 0x0000000002000000 /* XXXX C2 */ |
| 42 | #define AMD_HY_D0 0x0000000004000000 /* Istanbul D0 */ |
| 43 | #define AMD_RB_C3 0x0000000008000000 /* ??? C3 */ |
| 44 | #define AMD_DA_C3 0x0000000010000000 /* XXXX C3 */ |
| 45 | #define AMD_HY_D1 0x0000000020000000 /* Istanbul D1 */ |
| 46 | #define AMD_PH_E0 0x0000000040000000 /* Phenom II X4 X6 */ |
| 47 | #define AMD_OR_B2 0x0000000080000000 /* Interlagos */ |
| 48 | #define AMD_OR_C0 0x0000000100000000 /* Abu Dhabi */ |
Marc Jones | 8ae8c88 | 2007-12-19 01:32:08 +0000 | [diff] [blame] | 49 | |
| 50 | /* |
Marc Jones | da4ce6b | 2008-04-22 22:11:31 +0000 | [diff] [blame] | 51 | * Groups - Create as many as you wish, from the above public values |
| 52 | */ |
Timothy Pearson | 83abd81 | 2015-06-08 19:35:06 -0500 | [diff] [blame] | 53 | #define AMD_NPT_F2 (AMD_NPT_F2C | AMD_NPT_F2D | AMD_NPT_F2E | AMD_NPT_F2G | AMD_NPT_F2J | AMD_NPT_F2K) |
| 54 | #define AMD_NPT_F3 (AMD_NPT_F3L) |
| 55 | #define AMD_NPT_Fx (AMD_NPT_F0 | AMD_NPT_F1 | AMD_NPT_F2 | AMD_NPT_F3) |
| 56 | #define AMD_NPT_Gx (AMD_NPT_G0A | AMD_NPT_G1B) |
| 57 | #define AMD_NPT_ALL (AMD_NPT_Fx | AMD_NPT_Gx) |
| 58 | #define AMD_FINEDELAY (AMD_NPT_F0 | AMD_NPT_F1 | AMD_NPT_F2) |
| 59 | #define AMD_GT_F0 (AMD_NPT_ALL AND NOT AMD_NPT_F0) |
| 60 | #define AMD_DR_Ax (AMD_DR_A0A + AMD_DR_A1B + AMD_DR_A2) |
| 61 | #define AMD_DR_Bx (AMD_DR_B0 | AMD_DR_B1 | AMD_DR_B2 | AMD_DR_B3 | AMD_DR_BA) |
| 62 | #define AMD_DR_Cx (AMD_RB_C2 | AMD_RB_C3 | AMD_DA_Cx) |
| 63 | #define AMD_DR_Dx (AMD_HY_D0 | AMD_HY_D1) |
| 64 | #define AMD_DR_Ex (AMD_PH_E0) |
| 65 | #define AMD_DR_LT_B2 (AMD_DR_B0 | AMD_DR_B1 | AMD_DR_BA) |
| 66 | #define AMD_DR_LT_B3 (AMD_DR_B0 | AMD_DR_B1 | AMD_DR_B2 | AMD_DR_BA) |
| 67 | #define AMD_DR_GT_B0 (AMD_DR_ALL & ~(AMD_DR_B0)) |
| 68 | #define AMD_DR_GT_Bx (AMD_DR_ALL & ~(AMD_DR_Ax | AMD_DR_Bx)) |
| 69 | #define AMD_DR_GT_D0 ((AMD_DR_Dx & ~(AMD_HY_D0)) | AMD_DR_Ex) |
| 70 | #define AMD_DR_ALL (AMD_DR_Bx) |
| 71 | #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) |
| 72 | #define AMD_FAM10_LT_D (AMD_FAM10_ALL & ~(AMD_HY_D0)) |
| 73 | #define AMD_FAM10_GT_B0 (AMD_FAM10_ALL & ~(AMD_DR_B0)) |
| 74 | #define AMD_FAM10_REV_D (AMD_HY_D0 | AMD_HY_D1) |
| 75 | #define AMD_DA_Cx (AMD_DA_C2 | AMD_DA_C3) |
| 76 | #define AMD_FAM10_C3 (AMD_RB_C3 | AMD_DA_C3) |
| 77 | #define AMD_DRBH_Cx (AMD_DR_Cx | AMD_HY_D0 ) |
| 78 | #define AMD_DRBA23_RBC2 (AMD_DR_BA | AMD_DR_B2 | AMD_DR_B3 | AMD_RB_C2 ) |
Zheng Bao | 2ca2f17 | 2011-03-28 04:29:14 +0000 | [diff] [blame] | 79 | #define AMD_DR_DAC2_OR_C3 (AMD_DA_C2 | AMD_DA_C3 | AMD_RB_C3) |
Timothy Pearson | 83abd81 | 2015-06-08 19:35:06 -0500 | [diff] [blame] | 80 | #define AMD_FAM15_ALL (AMD_OR_B2 | AMD_OR_C0) |
Marc Jones | da4ce6b | 2008-04-22 22:11:31 +0000 | [diff] [blame] | 81 | |
| 82 | /* |
| 83 | * Public Platforms - USE THESE VERSIONS TO MAKE COMPARE WITH CPUPLATFORMTYPE RETURN VALUE |
| 84 | */ |
| 85 | #define AMD_PTYPE_DSK 0x001 /* Desktop/DTR/UP */ |
| 86 | #define AMD_PTYPE_MOB 0x002 /* Mobile/Cool-n-quiet */ |
| 87 | #define AMD_PTYPE_SVR 0x004 /* Workstation/Server/Multicore DT */ |
| 88 | #define AMD_PTYPE_UC 0x008 /* Single Core */ |
| 89 | #define AMD_PTYPE_DC 0x010 /* Dual Core */ |
| 90 | #define AMD_PTYPE_MC 0x020 /* Multi Core (>2) */ |
| 91 | #define AMD_PTYPE_UMA 0x040 /* UMA required */ |
| 92 | |
Timothy Pearson | 83abd81 | 2015-06-08 19:35:06 -0500 | [diff] [blame] | 93 | /* |
| 94 | * Groups - Create as many as you wish, from the above public values |
| 95 | */ |
Marc Jones | da4ce6b | 2008-04-22 22:11:31 +0000 | [diff] [blame] | 96 | #define AMD_PTYPE_ALL 0xFFFFFFFF /* A mask for all */ |
Marc Jones | 8ae8c88 | 2007-12-19 01:32:08 +0000 | [diff] [blame] | 97 | |
| 98 | |
Marc Jones | da4ce6b | 2008-04-22 22:11:31 +0000 | [diff] [blame] | 99 | /* |
| 100 | * CPU PCI HT PHY REGISTER, LINK TYPES - PRIVATE |
| 101 | */ |
| 102 | #define HTPHY_LINKTYPE_HT3 0x00000001 |
| 103 | #define HTPHY_LINKTYPE_HT1 0x00000002 |
Timothy Pearson | 83abd81 | 2015-06-08 19:35:06 -0500 | [diff] [blame] | 104 | #define HTPHY_LINKTYPE_COHERENT 0x00000004 |
Marc Jones | da4ce6b | 2008-04-22 22:11:31 +0000 | [diff] [blame] | 105 | #define HTPHY_LINKTYPE_NONCOHERENT 0x00000008 |
| 106 | #define HTPHY_LINKTYPE_CONNECTED (HTPHY_LINKTYPE_COHERENT | HTPHY_LINKTYPE_NONCOHERENT) |
| 107 | #define HTPHY_LINKTYPE_GANGED 0x00000010 |
Timothy Pearson | 83abd81 | 2015-06-08 19:35:06 -0500 | [diff] [blame] | 108 | #define HTPHY_LINKTYPE_UNGANGED 0x00000020 |
Marc Jones | da4ce6b | 2008-04-22 22:11:31 +0000 | [diff] [blame] | 109 | #define HTPHY_LINKTYPE_ALL 0x7FFFFFFF |
| 110 | |
| 111 | |
| 112 | /* |
| 113 | * CPU HT PHY REGISTERS, FIELDS, AND MASKS |
| 114 | */ |
Timothy Pearson | 4530df4 | 2015-08-02 21:23:02 -0500 | [diff] [blame] | 115 | #define HTPHY_OFFSET_MASK 0xE000FFFF |
Timothy Pearson | 83abd81 | 2015-06-08 19:35:06 -0500 | [diff] [blame] | 116 | #define HTPHY_WRITE_CMD 0x40000000 |
Marc Jones | da4ce6b | 2008-04-22 22:11:31 +0000 | [diff] [blame] | 117 | #define HTPHY_IS_COMPLETE_MASK 0x80000000 |
| 118 | #define HTPHY_DIRECT_MAP 0x20000000 |
| 119 | #define HTPHY_DIRECT_OFFSET_MASK 0xE000FFFF |
| 120 | |
| 121 | |
| 122 | /* |
| 123 | * Various AMD MSRs |
| 124 | */ |
Marc Jones | 8ae8c88 | 2007-12-19 01:32:08 +0000 | [diff] [blame] | 125 | #define CPUID_EXT_PM 0x80000007 |
Marc Jones | 8ae8c88 | 2007-12-19 01:32:08 +0000 | [diff] [blame] | 126 | #define CPUID_MODEL 1 |
Timothy Pearson | 730a043 | 2015-10-16 13:51:51 -0500 | [diff] [blame] | 127 | #define MCG_CAP 0x00000179 |
Marc Jones | da4ce6b | 2008-04-22 22:11:31 +0000 | [diff] [blame] | 128 | #define MCG_CTL_P 8 |
Timothy Pearson | 730a043 | 2015-10-16 13:51:51 -0500 | [diff] [blame] | 129 | #define MC0_CTL 0x00000400 |
| 130 | #define MC0_STA (MC0_CTL + 1) |
| 131 | #define MC4_MISC0 0x00000413 |
| 132 | #define MC4_MISC1 0xC0000408 |
| 133 | #define MC4_MISC2 0xC0000409 |
| 134 | #define FS_Base 0xC0000100 |
Marc Jones | da4ce6b | 2008-04-22 22:11:31 +0000 | [diff] [blame] | 135 | #define SYSCFG 0xC0010010 |
| 136 | #define HWCR 0xC0010015 |
| 137 | #define NB_CFG 0xC001001F |
| 138 | #define FidVidStatus 0xC0010042 |
Timothy Pearson | 730a043 | 2015-10-16 13:51:51 -0500 | [diff] [blame] | 139 | #define MC1_CTL_MASK 0xC0010045 |
Marc Jones | da4ce6b | 2008-04-22 22:11:31 +0000 | [diff] [blame] | 140 | #define MC4_CTL_MASK 0xC0010048 |
| 141 | #define OSVW_ID_Length 0xC0010140 |
| 142 | #define OSVW_Status 0xC0010141 |
| 143 | #define CPUIDFEATURES 0xC0011004 |
| 144 | #define LS_CFG 0xC0011020 |
Timothy Pearson | 730a043 | 2015-10-16 13:51:51 -0500 | [diff] [blame] | 145 | #define IC_CFG 0xC0011021 |
Marc Jones | da4ce6b | 2008-04-22 22:11:31 +0000 | [diff] [blame] | 146 | #define DC_CFG 0xC0011022 |
Marc Jones | 8ae8c88 | 2007-12-19 01:32:08 +0000 | [diff] [blame] | 147 | #define BU_CFG 0xC0011023 |
Timothy Pearson | 730a043 | 2015-10-16 13:51:51 -0500 | [diff] [blame] | 148 | #define FP_CFG 0xC0011028 |
| 149 | #define DE_CFG 0xC0011029 |
| 150 | #define BU_CFG2 0xC001102A |
| 151 | #define BU_CFG3 0xC001102B |
| 152 | #define EX_CFG 0xC001102C |
| 153 | #define LS_CFG2 0xC001102D |
| 154 | #define IBS_OP_DATA3 0xC0011037 |
Xavi Drudis Ferran | adb23a5 | 2011-02-28 00:10:37 +0000 | [diff] [blame] | 155 | |
| 156 | /* |
Stefan Reinauer | 5ff7c13 | 2011-10-31 12:56:45 -0700 | [diff] [blame] | 157 | * Processor package types |
Xavi Drudis Ferran | adb23a5 | 2011-02-28 00:10:37 +0000 | [diff] [blame] | 158 | */ |
| 159 | #define AMD_PKGTYPE_FrX_1207 0 |
| 160 | #define AMD_PKGTYPE_AM3_2r2 1 |
| 161 | #define AMD_PKGTYPE_S1gX 2 |
| 162 | #define AMD_PKGTYPE_G34 3 |
| 163 | #define AMD_PKGTYPE_ASB2 4 |
Timothy Pearson | 4530df4 | 2015-08-02 21:23:02 -0500 | [diff] [blame] | 164 | #define AMD_PKGTYPE_C32 5 |