Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the flashrom project. |
| 3 | * |
| 4 | * Copyright (c) 2010 Matthias Wenzel <bios at mazzoo dot de> |
| 5 | * Copyright (c) 2011 Stefan Tauner |
| 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; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 16 | */ |
| 17 | |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 18 | #ifndef __ICH_DESCRIPTORS_H__ |
| 19 | #define __ICH_DESCRIPTORS_H__ 1 |
| 20 | |
Nico Huber | 4d440a7 | 2017-08-15 11:26:48 +0200 | [diff] [blame] | 21 | #include <sys/types.h> |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 22 | #include <stdint.h> |
Stefan Tauner | a8d838d | 2011-11-06 23:51:09 +0000 | [diff] [blame] | 23 | #include "programmer.h" /* for enum ich_chipset */ |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 24 | |
| 25 | /* FIXME: Replace with generic return codes */ |
| 26 | #define ICH_RET_OK 0 |
| 27 | #define ICH_RET_ERR -1 |
| 28 | #define ICH_RET_WARN -2 |
| 29 | #define ICH_RET_PARAM -3 |
| 30 | #define ICH_RET_OOB -4 |
| 31 | |
| 32 | #define ICH9_REG_FDOC 0xB0 /* 32 Bits Flash Descriptor Observability Control */ |
Nico Huber | d54e4f4 | 2017-03-23 23:45:47 +0100 | [diff] [blame] | 33 | #define PCH100_REG_FDOC 0xB4 /* New offset from Sunrise Point on */ |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 34 | /* 0-1: reserved */ |
| 35 | #define FDOC_FDSI_OFF 2 /* 2-11: Flash Descriptor Section Index */ |
| 36 | #define FDOC_FDSI (0x3f << FDOC_FDSI_OFF) |
| 37 | #define FDOC_FDSS_OFF 12 /* 12-14: Flash Descriptor Section Select */ |
| 38 | #define FDOC_FDSS (0x3 << FDOC_FDSS_OFF) |
| 39 | /* 15-31: reserved */ |
| 40 | |
| 41 | #define ICH9_REG_FDOD 0xB4 /* 32 Bits Flash Descriptor Observability Data */ |
Nico Huber | d54e4f4 | 2017-03-23 23:45:47 +0100 | [diff] [blame] | 42 | #define PCH100_REG_FDOD 0xB8 /* New offset from Sunrise Point on */ |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 43 | |
| 44 | /* Field locations and semantics for LVSCC, UVSCC and related words in the flash |
| 45 | * descriptor are equal therefore they all share the same macros below. */ |
| 46 | #define VSCC_BES_OFF 0 /* 0-1: Block/Sector Erase Size */ |
| 47 | #define VSCC_BES (0x3 << VSCC_BES_OFF) |
| 48 | #define VSCC_WG_OFF 2 /* 2: Write Granularity */ |
| 49 | #define VSCC_WG (0x1 << VSCC_WG_OFF) |
| 50 | #define VSCC_WSR_OFF 3 /* 3: Write Status Required */ |
| 51 | #define VSCC_WSR (0x1 << VSCC_WSR_OFF) |
| 52 | #define VSCC_WEWS_OFF 4 /* 4: Write Enable on Write Status */ |
| 53 | #define VSCC_WEWS (0x1 << VSCC_WEWS_OFF) |
| 54 | /* 5-7: reserved */ |
| 55 | #define VSCC_EO_OFF 8 /* 8-15: Erase Opcode */ |
| 56 | #define VSCC_EO (0xff << VSCC_EO_OFF) |
| 57 | /* 16-22: reserved */ |
| 58 | #define VSCC_VCL_OFF 23 /* 23: Vendor Component Lock */ |
| 59 | #define VSCC_VCL (0x1 << VSCC_VCL_OFF) |
| 60 | /* 24-31: reserved */ |
| 61 | |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 62 | #define ICH_FREG_BASE(flreg) (((flreg) << 12) & 0x07fff000) |
| 63 | #define ICH_FREG_LIMIT(flreg) ((((flreg) >> 4) & 0x07fff000) | 0x00000fff) |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 64 | |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 65 | void prettyprint_ich_reg_vscc(uint32_t reg_val, int verbosity, bool print_vcl); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 66 | |
| 67 | struct ich_desc_content { |
| 68 | uint32_t FLVALSIG; /* 0x00 */ |
| 69 | union { /* 0x04 */ |
| 70 | uint32_t FLMAP0; |
| 71 | struct { |
| 72 | uint32_t FCBA :8, /* Flash Component Base Address */ |
| 73 | NC :2, /* Number Of Components */ |
| 74 | :6, |
| 75 | FRBA :8, /* Flash Region Base Address */ |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 76 | NR :3, /* Number Of Regions (reserved from Skylake on) */ |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 77 | :5; |
| 78 | }; |
| 79 | }; |
| 80 | union { /* 0x08 */ |
| 81 | uint32_t FLMAP1; |
| 82 | struct { |
| 83 | uint32_t FMBA :8, /* Flash Master Base Address */ |
| 84 | NM :3, /* Number Of Masters */ |
| 85 | :5, |
| 86 | FISBA :8, /* Flash ICH Strap Base Address */ |
| 87 | ISL :8; /* ICH Strap Length */ |
| 88 | }; |
| 89 | }; |
| 90 | union { /* 0x0c */ |
| 91 | uint32_t FLMAP2; |
| 92 | struct { |
Nico Huber | 1dc3d42 | 2017-06-17 00:09:31 +0200 | [diff] [blame] | 93 | uint32_t FMSBA :8, /* Flash (G)MCH Strap Base Addr. */ |
| 94 | MSL :8, /* MCH Strap Length */ |
| 95 | ICCRIBA :8, /* ICC Reg. Init Base Addr. (new since Sandy Bridge) */ |
| 96 | RIL :8; /* Register Init Length (new since Hawell) */ |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 97 | }; |
| 98 | }; |
| 99 | }; |
| 100 | |
| 101 | struct ich_desc_component { |
| 102 | union { /* 0x00 */ |
| 103 | uint32_t FLCOMP; /* Flash Components Register */ |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 104 | /* FLCOMP encoding on various generations: |
| 105 | * |
| 106 | * Chipset/Generation max_speed dual_output density |
Elyes HAOUAS | ac01baa | 2018-05-28 16:52:21 +0200 | [diff] [blame] | 107 | * [MHz] bits max. bits |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 108 | * ICH8: 33 N/A 5 0:2, 3:5 |
| 109 | * ICH9: 33 N/A 5 0:2, 3:5 |
| 110 | * ICH10: 33 N/A 5 0:2, 3:5 |
| 111 | * Ibex Peak/5: 50 N/A 5 0:2, 3:5 |
| 112 | * Cougar Point/6: 50 30 5 0:2, 3:5 |
| 113 | * Patsburg: 50 30 5 0:2, 3:5 |
| 114 | * Panther Point/7 50 30 5 0:2, 3:5 |
| 115 | * Lynx Point/8: 50 30 7 0:3, 4:7 |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 116 | * Wildcat Point/9: 50 30 (multi I/O) 7 0:3, 4:7 |
| 117 | * Sunrise Point/100: 48 30 7 0:3, 4:7 |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 118 | */ |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 119 | struct { |
Duncan Laurie | 823096e | 2014-08-20 15:39:38 +0000 | [diff] [blame] | 120 | uint32_t :17, |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 121 | freq_read :3, |
| 122 | fastread :1, |
| 123 | freq_fastread :3, |
| 124 | freq_write :3, |
| 125 | freq_read_id :3, |
Tai-Hong Wu | 60dead4 | 2015-01-05 23:00:14 +0000 | [diff] [blame] | 126 | dual_output :1, /* new since Cougar Point/6 */ |
| 127 | :1; |
| 128 | } modes; |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 129 | struct { |
| 130 | uint32_t comp1_density :3, |
| 131 | comp2_density :3, |
Tai-Hong Wu | 60dead4 | 2015-01-05 23:00:14 +0000 | [diff] [blame] | 132 | :26; |
| 133 | } dens_old; |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 134 | struct { |
| 135 | uint32_t comp1_density :4, /* new since Lynx Point/8 */ |
| 136 | comp2_density :4, |
Tai-Hong Wu | 60dead4 | 2015-01-05 23:00:14 +0000 | [diff] [blame] | 137 | :24; |
| 138 | } dens_new; |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 139 | }; |
| 140 | union { /* 0x04 */ |
| 141 | uint32_t FLILL; /* Flash Invalid Instructions Register */ |
| 142 | struct { |
| 143 | uint32_t invalid_instr0 :8, |
| 144 | invalid_instr1 :8, |
| 145 | invalid_instr2 :8, |
| 146 | invalid_instr3 :8; |
| 147 | }; |
| 148 | }; |
| 149 | union { /* 0x08 */ |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 150 | uint32_t FLPB; /* Flash Partition Boundary Register, until Panther Point/7 */ |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 151 | struct { |
| 152 | uint32_t FPBA :13, /* Flash Partition Boundary Addr */ |
| 153 | :19; |
| 154 | }; |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 155 | uint32_t FLILL1; /* Flash Invalid Instructions Register, new since Sunrise Point/100 */ |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 156 | struct { |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 157 | uint32_t invalid_instr4 :8, |
| 158 | invalid_instr5 :8, |
| 159 | invalid_instr6 :8, |
| 160 | invalid_instr7 :8; |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 161 | }; |
| 162 | }; |
| 163 | }; |
| 164 | |
David Hendricks | 8e76230 | 2017-08-09 22:21:31 -0700 | [diff] [blame] | 165 | #define MAX_NUM_FLREGS 16 |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 166 | struct ich_desc_region { |
| 167 | /* |
| 168 | * Number of entries and width differ on various generations: |
| 169 | * |
| 170 | * Chipset/Generation #FLREGs width (bits) |
| 171 | * ICH8 .. Panther Point/7 5 13 |
| 172 | * Lynx Point/8 .. Wildcat Point/9 7 15 |
| 173 | * Sunrise Point/100 .. 10 15 |
David Hendricks | 8e76230 | 2017-08-09 22:21:31 -0700 | [diff] [blame] | 174 | * Lewisburg/100 .. 16 15 |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 175 | */ |
| 176 | union { |
| 177 | uint32_t FLREGs[MAX_NUM_FLREGS]; /* Flash Descriptor Regions */ |
| 178 | |
| 179 | /* only used for bit-field check */ |
| 180 | struct { |
| 181 | uint32_t base :13, |
| 182 | :3, |
| 183 | limit :13, |
| 184 | :3; |
| 185 | } old_reg[MAX_NUM_FLREGS]; |
| 186 | }; |
| 187 | }; |
| 188 | |
David Hendricks | 8e76230 | 2017-08-09 22:21:31 -0700 | [diff] [blame] | 189 | #define MAX_NUM_MASTERS 6 /* 5 prior to C620/Lewisburg PCH */ |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 190 | struct ich_desc_master { |
| 191 | union { |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 192 | uint32_t FLMSTRs[MAX_NUM_MASTERS]; /* Flash Masters */ |
| 193 | /* For pre-Skylake platforms */ |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 194 | struct { |
| 195 | uint32_t BIOS_req_ID :16, |
| 196 | BIOS_descr_r :1, |
| 197 | BIOS_BIOS_r :1, |
| 198 | BIOS_ME_r :1, |
| 199 | BIOS_GbE_r :1, |
| 200 | BIOS_plat_r :1, |
| 201 | :3, |
| 202 | BIOS_descr_w :1, |
| 203 | BIOS_BIOS_w :1, |
| 204 | BIOS_ME_w :1, |
| 205 | BIOS_GbE_w :1, |
| 206 | BIOS_plat_w :1, |
| 207 | :3; |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 208 | uint32_t ME_req_ID :16, |
| 209 | ME_descr_r :1, |
| 210 | ME_BIOS_r :1, |
| 211 | ME_ME_r :1, |
| 212 | ME_GbE_r :1, |
| 213 | ME_plat_r :1, |
| 214 | :3, |
| 215 | ME_descr_w :1, |
| 216 | ME_BIOS_w :1, |
| 217 | ME_ME_w :1, |
| 218 | ME_GbE_w :1, |
| 219 | ME_plat_w :1, |
| 220 | :3; |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 221 | uint32_t GbE_req_ID :16, |
| 222 | GbE_descr_r :1, |
| 223 | GbE_BIOS_r :1, |
| 224 | GbE_ME_r :1, |
| 225 | GbE_GbE_r :1, |
| 226 | GbE_plat_r :1, |
| 227 | :3, |
| 228 | GbE_descr_w :1, |
| 229 | GbE_BIOS_w :1, |
| 230 | GbE_ME_w :1, |
| 231 | GbE_GbE_w :1, |
| 232 | GbE_plat_w :1, |
| 233 | :3; |
| 234 | }; |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 235 | /* From Skylake on */ |
| 236 | struct { |
| 237 | uint32_t :8, |
| 238 | read :12, |
| 239 | write :12; |
| 240 | } mstr[MAX_NUM_MASTERS]; |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 241 | }; |
| 242 | }; |
| 243 | |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 244 | struct ich_desc_north_strap { |
| 245 | union { |
| 246 | uint32_t STRPs[1]; /* current maximum: ich8 */ |
| 247 | struct { /* ich8 */ |
| 248 | struct { /* STRP2 (in the datasheet) */ |
| 249 | uint32_t MDB :1, |
| 250 | :31; |
| 251 | }; |
| 252 | } ich8; |
| 253 | }; |
| 254 | }; |
| 255 | |
| 256 | struct ich_desc_south_strap { |
| 257 | union { |
Stefan Tauner | d94d25d | 2012-07-28 03:17:15 +0000 | [diff] [blame] | 258 | uint32_t STRPs[18]; /* current maximum: cougar point */ |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 259 | struct { /* ich8 */ |
| 260 | struct { /* STRP1 */ |
| 261 | uint32_t ME_DISABLE :1, |
| 262 | :6, |
| 263 | TCOMODE :1, |
| 264 | ASD :7, |
| 265 | BMCMODE :1, |
| 266 | :3, |
| 267 | GLAN_PCIE_SEL :1, |
| 268 | GPIO12_SEL :2, |
| 269 | SPICS1_LANPHYPC_SEL :1, |
| 270 | MESM2SEL :1, |
| 271 | :1, |
| 272 | ASD2 :7; |
| 273 | }; |
| 274 | } ich8; |
| 275 | struct { /* ibex peak */ |
| 276 | struct { /* STRP0 */ |
| 277 | uint32_t :1, |
| 278 | cs_ss2 :1, |
| 279 | :5, |
| 280 | SMB_EN :1, |
| 281 | SML0_EN :1, |
| 282 | SML1_EN :1, |
| 283 | SML1FRQ :2, |
| 284 | SMB0FRQ :2, |
| 285 | SML0FRQ :2, |
| 286 | :4, |
| 287 | LANPHYPC_GP12_SEL :1, |
| 288 | cs_ss1 :1, |
| 289 | :2, |
| 290 | DMI_REQID_DIS :1, |
| 291 | :4, |
| 292 | BBBS :2, |
| 293 | :1; |
| 294 | }; |
| 295 | struct { /* STRP1 */ |
| 296 | uint32_t cs_ss3 :4, |
| 297 | :28; |
| 298 | }; |
| 299 | struct { /* STRP2 */ |
| 300 | uint32_t :8, |
| 301 | MESMASDEN :1, |
| 302 | MESMASDA :7, |
| 303 | :8, |
| 304 | MESMI2CEN :1, |
| 305 | MESMI2CA :7; |
| 306 | }; |
| 307 | struct { /* STRP3 */ |
| 308 | uint32_t :32; |
| 309 | }; |
| 310 | struct { /* STRP4 */ |
| 311 | uint32_t PHYCON :2, |
| 312 | :6, |
| 313 | GBEMAC_SMBUS_ADDR_EN :1, |
| 314 | GBEMAC_SMBUS_ADDR :7, |
| 315 | :1, |
| 316 | GBEPHY_SMBUS_ADDR :7, |
| 317 | :8; |
| 318 | }; |
| 319 | struct { /* STRP5 */ |
| 320 | uint32_t :32; |
| 321 | }; |
| 322 | struct { /* STRP6 */ |
| 323 | uint32_t :32; |
| 324 | }; |
| 325 | struct { /* STRP7 */ |
| 326 | uint32_t MESMA2UDID_VENDOR :16, |
| 327 | MESMA2UDID_DEVICE :16; |
| 328 | }; |
| 329 | struct { /* STRP8 */ |
| 330 | uint32_t :32; |
| 331 | }; |
| 332 | struct { /* STRP9 */ |
| 333 | uint32_t PCIEPCS1 :2, |
| 334 | PCIEPCS2 :2, |
| 335 | PCIELR1 :1, |
| 336 | PCIELR2 :1, |
| 337 | DMILR :1, |
| 338 | :1, |
| 339 | PHY_PCIEPORTSEL :3, |
| 340 | PHY_PCIE_EN :1, |
| 341 | :20; |
| 342 | }; |
| 343 | struct { /* STRP10 */ |
| 344 | uint32_t :1, |
| 345 | ME_BOOT_FLASH :1, |
| 346 | cs_ss5 :1, |
| 347 | VE_EN :1, |
| 348 | :4, |
| 349 | MMDDE :1, |
| 350 | MMADDR :7, |
| 351 | cs_ss7 :1, |
| 352 | :1, |
| 353 | ICC_SEL :3, |
| 354 | MER_CL1 :1, |
| 355 | :10; |
| 356 | }; |
| 357 | struct { /* STRP11 */ |
| 358 | uint32_t SML1GPAEN :1, |
| 359 | SML1GPA :7, |
| 360 | :16, |
| 361 | SML1I2CAEN :1, |
| 362 | SML1I2CA :7; |
| 363 | }; |
| 364 | struct { /* STRP12 */ |
| 365 | uint32_t :32; |
| 366 | }; |
| 367 | struct { /* STRP13 */ |
| 368 | uint32_t :32; |
| 369 | }; |
| 370 | struct { /* STRP14 */ |
| 371 | uint32_t :8, |
| 372 | VE_EN2 :1, |
| 373 | :5, |
| 374 | VE_BOOT_FLASH :1, |
| 375 | :1, |
| 376 | BW_SSD :1, |
| 377 | NVMHCI_EN :1, |
| 378 | :14; |
| 379 | }; |
| 380 | struct { /* STRP15 */ |
| 381 | uint32_t :3, |
| 382 | cs_ss6 :2, |
| 383 | :1, |
| 384 | IWL_EN :1, |
| 385 | :1, |
| 386 | t209min :2, |
| 387 | :22; |
| 388 | }; |
| 389 | } ibex; |
| 390 | struct { /* cougar point */ |
| 391 | struct { /* STRP0 */ |
| 392 | uint32_t :1, |
| 393 | cs_ss1 :1, |
| 394 | :5, |
| 395 | SMB_EN :1, |
| 396 | SML0_EN :1, |
| 397 | SML1_EN :1, |
| 398 | SML1FRQ :2, |
| 399 | SMB0FRQ :2, |
| 400 | SML0FRQ :2, |
| 401 | :4, |
| 402 | LANPHYPC_GP12_SEL :1, |
| 403 | LINKSEC_DIS :1, |
| 404 | :2, |
| 405 | DMI_REQID_DIS :1, |
| 406 | :4, |
| 407 | BBBS :2, |
| 408 | :1; |
| 409 | }; |
| 410 | struct { /* STRP1 */ |
| 411 | uint32_t cs_ss3 :4, |
| 412 | :4, |
| 413 | cs_ss2 :1, |
| 414 | :28; |
| 415 | }; |
| 416 | struct { /* STRP2 */ |
| 417 | uint32_t :8, |
| 418 | MESMASDEN :1, |
| 419 | MESMASDA :7, |
| 420 | MESMMCTPAEN :1, |
| 421 | MESMMCTPA :7, |
| 422 | MESMI2CEN :1, |
| 423 | MESMI2CA :7; |
| 424 | }; |
| 425 | struct { /* STRP3 */ |
| 426 | uint32_t :32; |
| 427 | }; |
| 428 | struct { /* STRP4 */ |
| 429 | uint32_t PHYCON :2, |
| 430 | :6, |
| 431 | GBEMAC_SMBUS_ADDR_EN :1, |
| 432 | GBEMAC_SMBUS_ADDR :7, |
| 433 | :1, |
| 434 | GBEPHY_SMBUS_ADDR :7, |
| 435 | :8; |
| 436 | }; |
| 437 | struct { /* STRP5 */ |
| 438 | uint32_t :32; |
| 439 | }; |
| 440 | struct { /* STRP6 */ |
| 441 | uint32_t :32; |
| 442 | }; |
| 443 | struct { /* STRP7 */ |
| 444 | uint32_t MESMA2UDID_VENDOR :16, |
| 445 | MESMA2UDID_DEVICE :16; |
| 446 | }; |
| 447 | struct { /* STRP8 */ |
| 448 | uint32_t :32; |
| 449 | }; |
| 450 | struct { /* STRP9 */ |
| 451 | uint32_t PCIEPCS1 :2, |
| 452 | PCIEPCS2 :2, |
| 453 | PCIELR1 :1, |
| 454 | PCIELR2 :1, |
| 455 | DMILR :1, |
| 456 | cs_ss4 :1, |
| 457 | PHY_PCIEPORTSEL :3, |
| 458 | PHY_PCIE_EN :1, |
| 459 | :2, |
| 460 | SUB_DECODE_EN :1, |
| 461 | :7, |
| 462 | PCHHOT_SML1ALERT_SEL :1, |
| 463 | :9; |
| 464 | }; |
| 465 | struct { /* STRP10 */ |
| 466 | uint32_t :1, |
| 467 | ME_BOOT_FLASH :1, |
| 468 | :6, |
| 469 | MDSMBE_EN :1, |
| 470 | MDSMBE_ADD :7, |
| 471 | :2, |
| 472 | ICC_SEL :3, |
| 473 | MER_CL1 :1, |
| 474 | ICC_PRO_SEL :1, |
| 475 | Deep_SX_EN :1, |
| 476 | ME_DBG_LAN :1, |
| 477 | :7; |
| 478 | }; |
| 479 | struct { /* STRP11 */ |
| 480 | uint32_t SML1GPAEN :1, |
| 481 | SML1GPA :7, |
| 482 | :16, |
| 483 | SML1I2CAEN :1, |
| 484 | SML1I2CA :7; |
| 485 | }; |
| 486 | struct { /* STRP12 */ |
| 487 | uint32_t :32; |
| 488 | }; |
| 489 | struct { /* STRP13 */ |
| 490 | uint32_t :32; |
| 491 | }; |
| 492 | struct { /* STRP14 */ |
| 493 | uint32_t :32; |
| 494 | }; |
| 495 | struct { /* STRP15 */ |
| 496 | uint32_t cs_ss6 :6, |
| 497 | IWL_EN :1, |
| 498 | cs_ss5 :2, |
| 499 | :4, |
| 500 | SMLINK1_THERM_SEL :1, |
| 501 | SLP_LAN_GP29_SEL :1, |
| 502 | :16; |
| 503 | }; |
| 504 | struct { /* STRP16 */ |
| 505 | uint32_t :32; |
| 506 | }; |
| 507 | struct { /* STRP17 */ |
| 508 | uint32_t ICML :1, |
| 509 | cs_ss7 :1, |
| 510 | :30; |
| 511 | }; |
| 512 | } cougar; |
| 513 | }; |
| 514 | }; |
| 515 | |
| 516 | struct ich_desc_upper_map { |
| 517 | union { |
| 518 | uint32_t FLUMAP1; /* Flash Upper Map 1 */ |
| 519 | struct { |
| 520 | uint32_t VTBA :8, /* ME VSCC Table Base Address */ |
| 521 | VTL :8, /* ME VSCC Table Length */ |
| 522 | :16; |
| 523 | }; |
| 524 | }; |
| 525 | struct { |
| 526 | union { /* JEDEC-ID Register */ |
| 527 | uint32_t JID; |
| 528 | struct { |
| 529 | uint32_t vid :8, /* Vendor ID */ |
| 530 | cid0 :8, /* Component ID 0 */ |
| 531 | cid1 :8, /* Component ID 1 */ |
| 532 | :8; |
| 533 | }; |
| 534 | }; |
| 535 | union { /* Vendor Specific Component Capabilities */ |
| 536 | uint32_t VSCC; |
| 537 | struct { |
| 538 | uint32_t ubes :2, /* Upper Block/Sector Erase Size */ |
| 539 | uwg :1, /* Upper Write Granularity */ |
| 540 | uwsr :1, /* Upper Write Status Required */ |
| 541 | uwews :1, /* Upper Write Enable on Write Status */ |
| 542 | :3, |
| 543 | ueo :8, /* Upper Erase Opcode */ |
| 544 | lbes :2, /* Lower Block/Sector Erase Size */ |
| 545 | lwg :1, /* Lower Write Granularity */ |
| 546 | lwsr :1, /* Lower Write Status Required */ |
| 547 | lwews :1, /* Lower Write Enable on Write Status */ |
| 548 | :3, |
| 549 | leo :16; /* Lower Erase Opcode */ |
| 550 | }; |
| 551 | }; |
| 552 | } vscc_table[128]; |
| 553 | }; |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 554 | |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 555 | struct ich_descriptors { |
| 556 | struct ich_desc_content content; |
| 557 | struct ich_desc_component component; |
| 558 | struct ich_desc_region region; |
| 559 | struct ich_desc_master master; |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 560 | struct ich_desc_north_strap north; |
| 561 | struct ich_desc_south_strap south; |
| 562 | struct ich_desc_upper_map upper; |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 563 | }; |
| 564 | |
David Hendricks | 0eb00d4 | 2017-09-01 20:02:36 -0700 | [diff] [blame] | 565 | struct ich_layout { |
| 566 | struct flashrom_layout base; |
David Hendricks | 7a8305f | 2017-09-01 20:16:58 -0700 | [diff] [blame] | 567 | struct romentry entries[MAX_NUM_FLREGS]; |
David Hendricks | 0eb00d4 | 2017-09-01 20:02:36 -0700 | [diff] [blame] | 568 | }; |
| 569 | |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 570 | ssize_t ich_number_of_regions(enum ich_chipset cs, const struct ich_desc_content *content); |
| 571 | ssize_t ich_number_of_masters(enum ich_chipset cs, const struct ich_desc_content *content); |
| 572 | |
Nico Huber | 67d7179 | 2017-06-17 03:10:15 +0200 | [diff] [blame] | 573 | void prettyprint_ich_chipset(enum ich_chipset cs); |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 574 | void prettyprint_ich_descriptors(enum ich_chipset cs, const struct ich_descriptors *desc); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 575 | |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 576 | void prettyprint_ich_descriptor_content(enum ich_chipset cs, const struct ich_desc_content *content); |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 577 | void prettyprint_ich_descriptor_component(enum ich_chipset cs, const struct ich_descriptors *desc); |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 578 | void prettyprint_ich_descriptor_region(enum ich_chipset cs, const struct ich_descriptors *desc); |
| 579 | void prettyprint_ich_descriptor_master(enum ich_chipset cs, const struct ich_descriptors *desc); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 580 | |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 581 | void prettyprint_ich_descriptor_upper_map(const struct ich_desc_upper_map *umap); |
| 582 | void prettyprint_ich_descriptor_straps(enum ich_chipset cs, const struct ich_descriptors *desc); |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 583 | int read_ich_descriptors_from_dump(const uint32_t *dump, size_t len, enum ich_chipset *cs, struct ich_descriptors *desc); |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 584 | |
Nico Huber | d54e4f4 | 2017-03-23 23:45:47 +0100 | [diff] [blame] | 585 | int read_ich_descriptors_via_fdo(enum ich_chipset cs, void *spibar, struct ich_descriptors *desc); |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 586 | int getFCBA_component_density(enum ich_chipset cs, const struct ich_descriptors *desc, uint8_t idx); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 587 | |
Nico Huber | 305f417 | 2013-06-14 11:55:26 +0200 | [diff] [blame] | 588 | int layout_from_ich_descriptors(struct ich_layout *, const void *dump, size_t len); |
| 589 | |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 590 | #endif /* __ICH_DESCRIPTORS_H__ */ |