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 | |
Thomas Heijligen | 3f4d35d | 2022-01-17 15:11:43 +0100 | [diff] [blame] | 18 | #include "hwaccess_physmap.h" |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 19 | #include "ich_descriptors.h" |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 20 | |
Nico Huber | ad18631 | 2016-05-02 15:15:29 +0200 | [diff] [blame] | 21 | #ifdef ICH_DESCRIPTORS_FROM_DUMP_ONLY |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 22 | #include <stdio.h> |
Nico Huber | 305f417 | 2013-06-14 11:55:26 +0200 | [diff] [blame] | 23 | #include <string.h> |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 24 | #define print(t, ...) printf(__VA_ARGS__) |
Nico Huber | ad18631 | 2016-05-02 15:15:29 +0200 | [diff] [blame] | 25 | #endif |
| 26 | |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 27 | #define DESCRIPTOR_MODE_SIGNATURE 0x0ff0a55a |
| 28 | /* The upper map is located in the word before the 256B-long OEM section at the |
| 29 | * end of the 4kB-long flash descriptor. |
| 30 | */ |
| 31 | #define UPPER_MAP_OFFSET (4096 - 256 - 4) |
| 32 | #define getVTBA(flumap) (((flumap)->FLUMAP1 << 4) & 0x00000ff0) |
| 33 | |
Felix Singer | d68a0ec | 2022-08-19 03:23:35 +0200 | [diff] [blame] | 34 | #include <stdbool.h> |
Nico Huber | 4d440a7 | 2017-08-15 11:26:48 +0200 | [diff] [blame] | 35 | #include <sys/types.h> |
Nico Huber | ad18631 | 2016-05-02 15:15:29 +0200 | [diff] [blame] | 36 | #include <string.h> |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 37 | #include "flash.h" /* for msg_* */ |
| 38 | #include "programmer.h" |
| 39 | |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 40 | ssize_t ich_number_of_regions(const enum ich_chipset cs, const struct ich_desc_content *const cont) |
| 41 | { |
| 42 | switch (cs) { |
Nico Huber | d2d3993 | 2019-01-18 16:49:37 +0100 | [diff] [blame] | 43 | case CHIPSET_APOLLO_LAKE: |
Angel Pons | 4db0fdf | 2020-07-10 17:04:10 +0200 | [diff] [blame] | 44 | case CHIPSET_GEMINI_LAKE: |
Nico Huber | d2d3993 | 2019-01-18 16:49:37 +0100 | [diff] [blame] | 45 | return 6; |
David Hendricks | a521636 | 2017-08-08 20:02:22 -0700 | [diff] [blame] | 46 | case CHIPSET_C620_SERIES_LEWISBURG: |
Nico Huber | 42daab1 | 2024-07-16 00:27:27 +0200 | [diff] [blame] | 47 | case CHIPSET_C740_SERIES_EMMITSBURG: |
Nico Huber | 2a5dfaf | 2019-07-04 16:01:51 +0200 | [diff] [blame] | 48 | case CHIPSET_300_SERIES_CANNON_POINT: |
Michał Żygowski | 5c9f542 | 2021-06-16 15:13:54 +0200 | [diff] [blame] | 49 | case CHIPSET_500_SERIES_TIGER_POINT: |
Werner Zeh | e57d4e4 | 2022-01-03 09:44:29 +0100 | [diff] [blame] | 50 | case CHIPSET_ELKHART_LAKE: |
Nico Huber | 0ef2eb8 | 2024-07-19 21:38:17 +0200 | [diff] [blame] | 51 | case CHIPSET_SNOW_RIDGE: |
Nico Huber | 5e0d9b0 | 2024-07-19 21:44:52 +0200 | [diff] [blame] | 52 | case CHIPSET_METEOR_LAKE: |
Nico Huber | d5a61ef | 2024-11-06 23:55:44 +0100 | [diff] [blame] | 53 | case CHIPSET_LUNAR_LAKE: |
Nico Huber | 612519b | 2024-11-06 23:37:11 +0100 | [diff] [blame] | 54 | case CHIPSET_ARROW_LAKE: |
David Hendricks | a521636 | 2017-08-08 20:02:22 -0700 | [diff] [blame] | 55 | return 16; |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 56 | case CHIPSET_100_SERIES_SUNRISE_POINT: |
| 57 | return 10; |
| 58 | case CHIPSET_9_SERIES_WILDCAT_POINT_LP: |
| 59 | case CHIPSET_9_SERIES_WILDCAT_POINT: |
| 60 | case CHIPSET_8_SERIES_LYNX_POINT_LP: |
| 61 | case CHIPSET_8_SERIES_LYNX_POINT: |
| 62 | case CHIPSET_8_SERIES_WELLSBURG: |
| 63 | if (cont->NR <= 6) |
| 64 | return cont->NR + 1; |
| 65 | else |
| 66 | return -1; |
| 67 | default: |
| 68 | if (cont->NR <= 4) |
| 69 | return cont->NR + 1; |
| 70 | else |
| 71 | return -1; |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | ssize_t ich_number_of_masters(const enum ich_chipset cs, const struct ich_desc_content *const cont) |
| 76 | { |
David Hendricks | a521636 | 2017-08-08 20:02:22 -0700 | [diff] [blame] | 77 | switch (cs) { |
| 78 | case CHIPSET_C620_SERIES_LEWISBURG: |
Nico Huber | 42daab1 | 2024-07-16 00:27:27 +0200 | [diff] [blame] | 79 | case CHIPSET_C740_SERIES_EMMITSBURG: |
Nico Huber | 0ef2eb8 | 2024-07-19 21:38:17 +0200 | [diff] [blame] | 80 | case CHIPSET_SNOW_RIDGE: |
Nico Huber | 5e0d9b0 | 2024-07-19 21:44:52 +0200 | [diff] [blame] | 81 | case CHIPSET_METEOR_LAKE: |
Nico Huber | 612519b | 2024-11-06 23:37:11 +0100 | [diff] [blame] | 82 | case CHIPSET_ARROW_LAKE: |
Nico Huber | 82fe123 | 2024-07-19 17:28:47 +0200 | [diff] [blame] | 83 | return 6; |
Nico Huber | d5a61ef | 2024-11-06 23:55:44 +0100 | [diff] [blame] | 84 | case CHIPSET_LUNAR_LAKE: |
| 85 | return 7; |
Nico Huber | d2d3993 | 2019-01-18 16:49:37 +0100 | [diff] [blame] | 86 | case CHIPSET_APOLLO_LAKE: |
Angel Pons | 4db0fdf | 2020-07-10 17:04:10 +0200 | [diff] [blame] | 87 | case CHIPSET_GEMINI_LAKE: |
Werner Zeh | e57d4e4 | 2022-01-03 09:44:29 +0100 | [diff] [blame] | 88 | case CHIPSET_ELKHART_LAKE: |
Nico Huber | 82fe123 | 2024-07-19 17:28:47 +0200 | [diff] [blame] | 89 | return 2; |
David Hendricks | a521636 | 2017-08-08 20:02:22 -0700 | [diff] [blame] | 90 | default: |
Nico Huber | 82fe123 | 2024-07-19 17:28:47 +0200 | [diff] [blame] | 91 | if (cs >= SPI_ENGINE_PCH100) |
| 92 | return 5; |
David Hendricks | a521636 | 2017-08-08 20:02:22 -0700 | [diff] [blame] | 93 | if (cont->NM < MAX_NUM_MASTERS) |
| 94 | return cont->NM + 1; |
| 95 | } |
| 96 | |
| 97 | return -1; |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 98 | } |
| 99 | |
Nico Huber | 157b818 | 2024-07-19 17:48:12 +0200 | [diff] [blame] | 100 | static bool has_classic_proc_straps(const enum ich_chipset cs) |
| 101 | { |
| 102 | switch (cs) { |
| 103 | case CHIPSET_100_SERIES_SUNRISE_POINT: |
| 104 | case CHIPSET_C620_SERIES_LEWISBURG: |
Nico Huber | 42daab1 | 2024-07-16 00:27:27 +0200 | [diff] [blame] | 105 | case CHIPSET_C740_SERIES_EMMITSBURG: |
Nico Huber | 612519b | 2024-11-06 23:37:11 +0100 | [diff] [blame] | 106 | case CHIPSET_ARROW_LAKE: |
Nico Huber | 157b818 | 2024-07-19 17:48:12 +0200 | [diff] [blame] | 107 | return true; |
| 108 | default: |
| 109 | return cs < SPI_ENGINE_PCH100; |
| 110 | } |
| 111 | } |
| 112 | |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 113 | 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] | 114 | { |
| 115 | print(verbosity, "BES=0x%x, ", (reg_val & VSCC_BES) >> VSCC_BES_OFF); |
| 116 | print(verbosity, "WG=%d, ", (reg_val & VSCC_WG) >> VSCC_WG_OFF); |
| 117 | print(verbosity, "WSR=%d, ", (reg_val & VSCC_WSR) >> VSCC_WSR_OFF); |
| 118 | print(verbosity, "WEWS=%d, ", (reg_val & VSCC_WEWS) >> VSCC_WEWS_OFF); |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 119 | print(verbosity, "EO=0x%x", (reg_val & VSCC_EO) >> VSCC_EO_OFF); |
| 120 | if (print_vcl) |
| 121 | print(verbosity, ", VCL=%d", (reg_val & VSCC_VCL) >> VSCC_VCL_OFF); |
| 122 | print(verbosity, "\n"); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 123 | } |
| 124 | |
| 125 | #define getFCBA(cont) (((cont)->FLMAP0 << 4) & 0x00000ff0) |
| 126 | #define getFRBA(cont) (((cont)->FLMAP0 >> 12) & 0x00000ff0) |
| 127 | #define getFMBA(cont) (((cont)->FLMAP1 << 4) & 0x00000ff0) |
| 128 | #define getFISBA(cont) (((cont)->FLMAP1 >> 12) & 0x00000ff0) |
| 129 | #define getFMSBA(cont) (((cont)->FLMAP2 << 4) & 0x00000ff0) |
| 130 | |
Nico Huber | 67d7179 | 2017-06-17 03:10:15 +0200 | [diff] [blame] | 131 | void prettyprint_ich_chipset(enum ich_chipset cs) |
| 132 | { |
| 133 | static const char *const chipset_names[] = { |
| 134 | "Unknown ICH", "ICH8", "ICH9", "ICH10", |
| 135 | "5 series Ibex Peak", "6 series Cougar Point", "7 series Panther Point", |
Nico Huber | dfd0647 | 2024-07-14 23:45:05 +0200 | [diff] [blame] | 136 | "Baytrail", "8 series Lynx Point", "8 series Lynx Point LP", "8 series Wellsburg", |
Nico Huber | 67d7179 | 2017-06-17 03:10:15 +0200 | [diff] [blame] | 137 | "9 series Wildcat Point", "9 series Wildcat Point LP", "100 series Sunrise Point", |
Angel Pons | 4db0fdf | 2020-07-10 17:04:10 +0200 | [diff] [blame] | 138 | "C620 series Lewisburg", "300/400 series Cannon/Comet Point", |
Nico Huber | 29c23dd | 2022-12-21 15:25:09 +0000 | [diff] [blame] | 139 | "500/600 series Tiger/Alder Point", "Apollo Lake", "Gemini Lake", "Elkhart Lake", |
Nico Huber | d5a61ef | 2024-11-06 23:55:44 +0100 | [diff] [blame] | 140 | "C740 series Emmitsburg", "Snow Ridge", "Meteor Lake", "Lunar Lake", |
Nico Huber | 612519b | 2024-11-06 23:37:11 +0100 | [diff] [blame] | 141 | "800 series Arrow Lake", |
Nico Huber | 67d7179 | 2017-06-17 03:10:15 +0200 | [diff] [blame] | 142 | }; |
| 143 | if (cs < CHIPSET_ICH8 || cs - CHIPSET_ICH8 + 1 >= ARRAY_SIZE(chipset_names)) |
| 144 | cs = 0; |
| 145 | else |
| 146 | cs = cs - CHIPSET_ICH8 + 1; |
| 147 | msg_pdbg2("Assuming chipset '%s'.\n", chipset_names[cs]); |
| 148 | } |
| 149 | |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 150 | void prettyprint_ich_descriptors(enum ich_chipset cs, const struct ich_descriptors *desc) |
| 151 | { |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 152 | prettyprint_ich_descriptor_content(cs, &desc->content); |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 153 | prettyprint_ich_descriptor_component(cs, desc); |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 154 | prettyprint_ich_descriptor_region(cs, desc); |
| 155 | prettyprint_ich_descriptor_master(cs, desc); |
Nico Huber | ad18631 | 2016-05-02 15:15:29 +0200 | [diff] [blame] | 156 | #ifdef ICH_DESCRIPTORS_FROM_DUMP_ONLY |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 157 | if (cs >= CHIPSET_ICH8) { |
| 158 | prettyprint_ich_descriptor_upper_map(&desc->upper); |
| 159 | prettyprint_ich_descriptor_straps(cs, desc); |
| 160 | } |
Nico Huber | ad18631 | 2016-05-02 15:15:29 +0200 | [diff] [blame] | 161 | #endif /* ICH_DESCRIPTORS_FROM_DUMP_ONLY */ |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 162 | } |
| 163 | |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 164 | void prettyprint_ich_descriptor_content(enum ich_chipset cs, const struct ich_desc_content *cont) |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 165 | { |
| 166 | msg_pdbg2("=== Content Section ===\n"); |
| 167 | msg_pdbg2("FLVALSIG 0x%08x\n", cont->FLVALSIG); |
| 168 | msg_pdbg2("FLMAP0 0x%08x\n", cont->FLMAP0); |
| 169 | msg_pdbg2("FLMAP1 0x%08x\n", cont->FLMAP1); |
| 170 | msg_pdbg2("FLMAP2 0x%08x\n", cont->FLMAP2); |
| 171 | msg_pdbg2("\n"); |
| 172 | |
| 173 | msg_pdbg2("--- Details ---\n"); |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 174 | msg_pdbg2("NR (Number of Regions): %5zd\n", ich_number_of_regions(cs, cont)); |
| 175 | msg_pdbg2("FRBA (Flash Region Base Address): 0x%03x\n", getFRBA(cont)); |
| 176 | msg_pdbg2("NC (Number of Components): %5d\n", cont->NC + 1); |
| 177 | msg_pdbg2("FCBA (Flash Component Base Address): 0x%03x\n", getFCBA(cont)); |
Nico Huber | d2d3993 | 2019-01-18 16:49:37 +0100 | [diff] [blame] | 178 | msg_pdbg2("ISL (ICH/PCH/SoC Strap Length): %5d\n", cont->ISL); |
| 179 | msg_pdbg2("FISBA/FPSBA (Flash ICH/PCH/SoC Strap Base Addr): 0x%03x\n", getFISBA(cont)); |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 180 | msg_pdbg2("NM (Number of Masters): %5zd\n", ich_number_of_masters(cs, cont)); |
| 181 | msg_pdbg2("FMBA (Flash Master Base Address): 0x%03x\n", getFMBA(cont)); |
Nico Huber | 157b818 | 2024-07-19 17:48:12 +0200 | [diff] [blame] | 182 | if (has_classic_proc_straps(cs)) { |
| 183 | msg_pdbg2("MSL/PSL (MCH/PROC Strap Length): %5d\n", cont->MSL); |
| 184 | msg_pdbg2("FMSBA (Flash MCH/PROC Strap Base Address): 0x%03x\n", getFMSBA(cont)); |
| 185 | } |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 186 | msg_pdbg2("\n"); |
| 187 | } |
| 188 | |
Nico Huber | dfd0647 | 2024-07-14 23:45:05 +0200 | [diff] [blame] | 189 | static unsigned int get_density_index( |
| 190 | enum ich_chipset cs, const struct ich_descriptors *desc, unsigned int component) |
| 191 | { |
| 192 | if (cs < CHIPSET_HAS_NEW_COMPONENT_DENSITY) { |
| 193 | if (component == 0) |
| 194 | return desc->component.dens_old.comp1_density; |
| 195 | else |
| 196 | return desc->component.dens_old.comp2_density; |
| 197 | } else { |
| 198 | if (component == 0) |
| 199 | return desc->component.dens_new.comp1_density; |
| 200 | else |
| 201 | return desc->component.dens_new.comp2_density; |
| 202 | } |
| 203 | } |
| 204 | |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 205 | static const char *pprint_density(enum ich_chipset cs, const struct ich_descriptors *desc, uint8_t idx) |
| 206 | { |
| 207 | if (idx > 1) { |
| 208 | msg_perr("Only ICH SPI component index 0 or 1 are supported yet.\n"); |
Nico Huber | dfd0647 | 2024-07-14 23:45:05 +0200 | [diff] [blame] | 209 | return "unknown"; |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 210 | } |
Nico Huber | dfd0647 | 2024-07-14 23:45:05 +0200 | [diff] [blame] | 211 | if (cs == CHIPSET_ICH_UNKNOWN) |
| 212 | return "unknown"; |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 213 | |
| 214 | if (desc->content.NC == 0 && idx > 0) |
| 215 | return "unused"; |
| 216 | |
| 217 | static const char * const size_str[] = { |
| 218 | "512 kB", /* 0000 */ |
| 219 | "1 MB", /* 0001 */ |
| 220 | "2 MB", /* 0010 */ |
| 221 | "4 MB", /* 0011 */ |
| 222 | "8 MB", /* 0100 */ |
| 223 | "16 MB", /* 0101 */ /* Maximum up to Lynx Point (excl.) */ |
| 224 | "32 MB", /* 0110 */ |
| 225 | "64 MB", /* 0111 */ |
| 226 | }; |
Nico Huber | dfd0647 | 2024-07-14 23:45:05 +0200 | [diff] [blame] | 227 | const unsigned int max_idx = cs < CHIPSET_HAS_NEW_COMPONENT_DENSITY ? 5 : 7; |
| 228 | const unsigned int size_idx = get_density_index(cs, desc, idx); |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 229 | |
Nico Huber | dfd0647 | 2024-07-14 23:45:05 +0200 | [diff] [blame] | 230 | if (size_idx > max_idx) |
| 231 | return "reserved"; |
| 232 | |
| 233 | return size_str[size_idx]; |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 234 | } |
| 235 | |
| 236 | static const char *pprint_freq(enum ich_chipset cs, uint8_t value) |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 237 | { |
Nico Huber | 0ef2eb8 | 2024-07-19 21:38:17 +0200 | [diff] [blame] | 238 | static const char *const freq_str[][8] = { { |
Nico Huber | 129e938 | 2019-06-06 15:43:27 +0200 | [diff] [blame] | 239 | "20 MHz", |
| 240 | "33 MHz", |
| 241 | "reserved", |
| 242 | "reserved", |
| 243 | "50 MHz", /* New since Ibex Peak */ |
| 244 | "reserved", |
| 245 | "reserved", |
| 246 | "reserved" |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 247 | }, { |
Nico Huber | 129e938 | 2019-06-06 15:43:27 +0200 | [diff] [blame] | 248 | "reserved", |
| 249 | "reserved", |
| 250 | "48 MHz", |
| 251 | "reserved", |
| 252 | "30 MHz", |
| 253 | "reserved", |
| 254 | "17 MHz", |
| 255 | "reserved" |
Nico Huber | d2d3993 | 2019-01-18 16:49:37 +0100 | [diff] [blame] | 256 | }, { |
| 257 | "reserved", |
| 258 | "50 MHz", |
| 259 | "40 MHz", |
| 260 | "reserved", |
| 261 | "25 MHz", |
| 262 | "reserved", |
| 263 | "14 MHz / 17 MHz", |
| 264 | "reserved" |
Michał Żygowski | 5c9f542 | 2021-06-16 15:13:54 +0200 | [diff] [blame] | 265 | }, { |
| 266 | "100 MHz", |
| 267 | "50 MHz", |
| 268 | "reserved", |
| 269 | "33 MHz", |
| 270 | "25 MHz", |
| 271 | "reserved", |
| 272 | "14 MHz", |
| 273 | "reserved" |
Werner Zeh | e57d4e4 | 2022-01-03 09:44:29 +0100 | [diff] [blame] | 274 | }, { |
| 275 | "reserved", |
| 276 | "50 MHz", |
| 277 | "reserved", |
| 278 | "reserved", |
| 279 | "33 MHz", |
| 280 | "20 MHz", |
| 281 | "reserved", |
| 282 | "reserved", |
Nico Huber | 0ef2eb8 | 2024-07-19 21:38:17 +0200 | [diff] [blame] | 283 | }, { |
| 284 | "reserved", |
| 285 | "48 MHz", |
| 286 | "32 MHz", |
| 287 | "reserved", |
| 288 | "24 MHz", |
| 289 | "19.2 MHz", |
| 290 | "13.7 MHz", |
| 291 | "reserved", |
Michał Żygowski | 5c9f542 | 2021-06-16 15:13:54 +0200 | [diff] [blame] | 292 | }}; |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 293 | |
| 294 | switch (cs) { |
| 295 | case CHIPSET_ICH8: |
| 296 | case CHIPSET_ICH9: |
| 297 | case CHIPSET_ICH10: |
| 298 | if (value > 1) |
| 299 | return "reserved"; |
Richard Hughes | db7482b | 2018-12-19 12:04:30 +0000 | [diff] [blame] | 300 | /* Fall through. */ |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 301 | case CHIPSET_5_SERIES_IBEX_PEAK: |
| 302 | case CHIPSET_6_SERIES_COUGAR_POINT: |
| 303 | case CHIPSET_7_SERIES_PANTHER_POINT: |
| 304 | case CHIPSET_8_SERIES_LYNX_POINT: |
Duncan Laurie | 4095ed7 | 2014-08-20 15:39:32 +0000 | [diff] [blame] | 305 | case CHIPSET_BAYTRAIL: |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 306 | case CHIPSET_8_SERIES_LYNX_POINT_LP: |
| 307 | case CHIPSET_8_SERIES_WELLSBURG: |
Duncan Laurie | 823096e | 2014-08-20 15:39:38 +0000 | [diff] [blame] | 308 | case CHIPSET_9_SERIES_WILDCAT_POINT: |
Nico Huber | 5120591 | 2017-03-17 17:59:54 +0100 | [diff] [blame] | 309 | case CHIPSET_9_SERIES_WILDCAT_POINT_LP: |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 310 | return freq_str[0][value]; |
| 311 | case CHIPSET_100_SERIES_SUNRISE_POINT: |
David Hendricks | a521636 | 2017-08-08 20:02:22 -0700 | [diff] [blame] | 312 | case CHIPSET_C620_SERIES_LEWISBURG: |
Nico Huber | 2a5dfaf | 2019-07-04 16:01:51 +0200 | [diff] [blame] | 313 | case CHIPSET_300_SERIES_CANNON_POINT: |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 314 | return freq_str[1][value]; |
Nico Huber | d2d3993 | 2019-01-18 16:49:37 +0100 | [diff] [blame] | 315 | case CHIPSET_APOLLO_LAKE: |
Angel Pons | 4db0fdf | 2020-07-10 17:04:10 +0200 | [diff] [blame] | 316 | case CHIPSET_GEMINI_LAKE: |
Nico Huber | d2d3993 | 2019-01-18 16:49:37 +0100 | [diff] [blame] | 317 | return freq_str[2][value]; |
Michał Żygowski | 5c9f542 | 2021-06-16 15:13:54 +0200 | [diff] [blame] | 318 | case CHIPSET_500_SERIES_TIGER_POINT: |
Nico Huber | 42daab1 | 2024-07-16 00:27:27 +0200 | [diff] [blame] | 319 | case CHIPSET_C740_SERIES_EMMITSBURG: |
Nico Huber | 5e0d9b0 | 2024-07-19 21:44:52 +0200 | [diff] [blame] | 320 | case CHIPSET_METEOR_LAKE: |
Nico Huber | d5a61ef | 2024-11-06 23:55:44 +0100 | [diff] [blame] | 321 | case CHIPSET_LUNAR_LAKE: |
Nico Huber | 612519b | 2024-11-06 23:37:11 +0100 | [diff] [blame] | 322 | case CHIPSET_ARROW_LAKE: |
Michał Żygowski | 5c9f542 | 2021-06-16 15:13:54 +0200 | [diff] [blame] | 323 | return freq_str[3][value]; |
Werner Zeh | e57d4e4 | 2022-01-03 09:44:29 +0100 | [diff] [blame] | 324 | case CHIPSET_ELKHART_LAKE: |
| 325 | return freq_str[4][value]; |
Nico Huber | 0ef2eb8 | 2024-07-19 21:38:17 +0200 | [diff] [blame] | 326 | case CHIPSET_SNOW_RIDGE: |
| 327 | return freq_str[5][value]; |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 328 | case CHIPSET_ICH_UNKNOWN: |
| 329 | default: |
| 330 | return "unknown"; |
| 331 | } |
| 332 | } |
| 333 | |
Michał Żygowski | 5c9f542 | 2021-06-16 15:13:54 +0200 | [diff] [blame] | 334 | static void pprint_read_freq(enum ich_chipset cs, uint8_t value) |
| 335 | { |
Nico Huber | 0ef2eb8 | 2024-07-19 21:38:17 +0200 | [diff] [blame] | 336 | static const char *const freq_str[][8] = { { |
Michał Żygowski | 5c9f542 | 2021-06-16 15:13:54 +0200 | [diff] [blame] | 337 | "20 MHz", |
| 338 | "24 MHz", |
| 339 | "30 MHz", |
| 340 | "48 MHz", |
| 341 | "60 MHz", |
| 342 | "reserved", |
| 343 | "reserved", |
| 344 | "reserved" |
Nico Huber | 0ef2eb8 | 2024-07-19 21:38:17 +0200 | [diff] [blame] | 345 | }, { |
| 346 | "16 MHz", |
| 347 | "19.2 MHz", |
| 348 | "24 MHz", |
| 349 | "32 MHz", |
| 350 | "48 MHz", |
| 351 | "reserved", |
| 352 | "reserved", |
| 353 | "reserved" |
Michał Żygowski | 5c9f542 | 2021-06-16 15:13:54 +0200 | [diff] [blame] | 354 | }}; |
| 355 | |
| 356 | switch (cs) { |
| 357 | case CHIPSET_300_SERIES_CANNON_POINT: |
| 358 | msg_pdbg2("eSPI/EC Bus Clock Frequency: %s\n", freq_str[0][value]); |
| 359 | return; |
Nico Huber | 0ef2eb8 | 2024-07-19 21:38:17 +0200 | [diff] [blame] | 360 | case CHIPSET_SNOW_RIDGE: |
| 361 | msg_pdbg2("eSPI/EC Bus Clock Frequency: %s\n", freq_str[1][value]); |
| 362 | return; |
Michał Żygowski | 5c9f542 | 2021-06-16 15:13:54 +0200 | [diff] [blame] | 363 | case CHIPSET_500_SERIES_TIGER_POINT: |
Nico Huber | 5e0d9b0 | 2024-07-19 21:44:52 +0200 | [diff] [blame] | 364 | case CHIPSET_METEOR_LAKE: |
Nico Huber | d5a61ef | 2024-11-06 23:55:44 +0100 | [diff] [blame] | 365 | case CHIPSET_LUNAR_LAKE: |
Nico Huber | 612519b | 2024-11-06 23:37:11 +0100 | [diff] [blame] | 366 | case CHIPSET_ARROW_LAKE: |
Michał Żygowski | 5c9f542 | 2021-06-16 15:13:54 +0200 | [diff] [blame] | 367 | msg_pdbg2("Read Clock Frequency: %s\n", "reserved"); |
| 368 | return; |
| 369 | default: |
| 370 | msg_pdbg2("Read Clock Frequency: %s\n", pprint_freq(cs, value)); |
| 371 | return; |
| 372 | } |
| 373 | } |
| 374 | |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 375 | void prettyprint_ich_descriptor_component(enum ich_chipset cs, const struct ich_descriptors *desc) |
| 376 | { |
Nico Huber | b2ad9fd | 2024-07-14 23:18:53 +0200 | [diff] [blame] | 377 | const bool has_flill1 = cs >= SPI_ENGINE_PCH100; |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 378 | |
| 379 | msg_pdbg2("=== Component Section ===\n"); |
| 380 | msg_pdbg2("FLCOMP 0x%08x\n", desc->component.FLCOMP); |
| 381 | msg_pdbg2("FLILL 0x%08x\n", desc->component.FLILL ); |
Nico Huber | d2d3993 | 2019-01-18 16:49:37 +0100 | [diff] [blame] | 382 | if (has_flill1) |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 383 | msg_pdbg2("FLILL1 0x%08x\n", desc->component.FLILL1); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 384 | msg_pdbg2("\n"); |
| 385 | |
| 386 | msg_pdbg2("--- Details ---\n"); |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 387 | msg_pdbg2("Component 1 density: %s\n", pprint_density(cs, desc, 0)); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 388 | if (desc->content.NC) |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 389 | msg_pdbg2("Component 2 density: %s\n", pprint_density(cs, desc, 1)); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 390 | else |
| 391 | msg_pdbg2("Component 2 is not used.\n"); |
Michał Żygowski | 5c9f542 | 2021-06-16 15:13:54 +0200 | [diff] [blame] | 392 | |
| 393 | pprint_read_freq(cs, desc->component.modes.freq_read); |
| 394 | |
Tai-Hong Wu | 60dead4 | 2015-01-05 23:00:14 +0000 | [diff] [blame] | 395 | msg_pdbg2("Read ID and Status Clock Freq.: %s\n", pprint_freq(cs, desc->component.modes.freq_read_id)); |
| 396 | msg_pdbg2("Write and Erase Clock Freq.: %s\n", pprint_freq(cs, desc->component.modes.freq_write)); |
| 397 | msg_pdbg2("Fast Read is %ssupported.\n", desc->component.modes.fastread ? "" : "not "); |
| 398 | if (desc->component.modes.fastread) |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 399 | msg_pdbg2("Fast Read Clock Frequency: %s\n", |
Tai-Hong Wu | 60dead4 | 2015-01-05 23:00:14 +0000 | [diff] [blame] | 400 | pprint_freq(cs, desc->component.modes.freq_fastread)); |
Nico Huber | 3f75d44 | 2024-07-14 19:17:56 +0200 | [diff] [blame] | 401 | switch (cs) { |
| 402 | case CHIPSET_7_SERIES_PANTHER_POINT: |
| 403 | case CHIPSET_8_SERIES_LYNX_POINT: |
| 404 | case CHIPSET_BAYTRAIL: |
| 405 | case CHIPSET_8_SERIES_LYNX_POINT_LP: |
| 406 | case CHIPSET_8_SERIES_WELLSBURG: |
| 407 | case CHIPSET_9_SERIES_WILDCAT_POINT: |
| 408 | case CHIPSET_9_SERIES_WILDCAT_POINT_LP: |
| 409 | case CHIPSET_100_SERIES_SUNRISE_POINT: |
| 410 | case CHIPSET_APOLLO_LAKE: |
| 411 | case CHIPSET_C620_SERIES_LEWISBURG: |
Nico Huber | 0ef2eb8 | 2024-07-19 21:38:17 +0200 | [diff] [blame] | 412 | case CHIPSET_SNOW_RIDGE: |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 413 | msg_pdbg2("Dual Output Fast Read Support: %sabled\n", |
Werner Zeh | d3e8fd9 | 2022-01-25 07:02:49 +0100 | [diff] [blame] | 414 | desc->component.modes.dual_output ? "en" : "dis"); |
Nico Huber | 3f75d44 | 2024-07-14 19:17:56 +0200 | [diff] [blame] | 415 | break; |
| 416 | default: |
| 417 | break; |
| 418 | } |
David Hendricks | a521636 | 2017-08-08 20:02:22 -0700 | [diff] [blame] | 419 | |
Felix Singer | d68a0ec | 2022-08-19 03:23:35 +0200 | [diff] [blame] | 420 | bool has_forbidden_opcode = false; |
David Hendricks | a521636 | 2017-08-08 20:02:22 -0700 | [diff] [blame] | 421 | if (desc->component.FLILL != 0) { |
Felix Singer | d68a0ec | 2022-08-19 03:23:35 +0200 | [diff] [blame] | 422 | has_forbidden_opcode = true; |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 423 | msg_pdbg2("Invalid instruction 0: 0x%02x\n", |
| 424 | desc->component.invalid_instr0); |
| 425 | msg_pdbg2("Invalid instruction 1: 0x%02x\n", |
| 426 | desc->component.invalid_instr1); |
| 427 | msg_pdbg2("Invalid instruction 2: 0x%02x\n", |
| 428 | desc->component.invalid_instr2); |
| 429 | msg_pdbg2("Invalid instruction 3: 0x%02x\n", |
| 430 | desc->component.invalid_instr3); |
David Hendricks | a521636 | 2017-08-08 20:02:22 -0700 | [diff] [blame] | 431 | } |
Nico Huber | d2d3993 | 2019-01-18 16:49:37 +0100 | [diff] [blame] | 432 | if (has_flill1) { |
David Hendricks | a521636 | 2017-08-08 20:02:22 -0700 | [diff] [blame] | 433 | if (desc->component.FLILL1 != 0) { |
Felix Singer | d68a0ec | 2022-08-19 03:23:35 +0200 | [diff] [blame] | 434 | has_forbidden_opcode = true; |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 435 | msg_pdbg2("Invalid instruction 4: 0x%02x\n", |
| 436 | desc->component.invalid_instr4); |
| 437 | msg_pdbg2("Invalid instruction 5: 0x%02x\n", |
| 438 | desc->component.invalid_instr5); |
| 439 | msg_pdbg2("Invalid instruction 6: 0x%02x\n", |
| 440 | desc->component.invalid_instr6); |
| 441 | msg_pdbg2("Invalid instruction 7: 0x%02x\n", |
| 442 | desc->component.invalid_instr7); |
| 443 | } |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 444 | } |
David Hendricks | a521636 | 2017-08-08 20:02:22 -0700 | [diff] [blame] | 445 | if (!has_forbidden_opcode) |
| 446 | msg_pdbg2("No forbidden opcodes.\n"); |
| 447 | |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 448 | msg_pdbg2("\n"); |
| 449 | } |
| 450 | |
| 451 | static void pprint_freg(const struct ich_desc_region *reg, uint32_t i) |
| 452 | { |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 453 | static const char *const region_names[] = { |
Nico Huber | d2d3993 | 2019-01-18 16:49:37 +0100 | [diff] [blame] | 454 | "Descr.", "BIOS", "ME", "GbE", "Platf.", "DevExp", "BIOS2", "unknown", |
Nico Huber | 5e0d9b0 | 2024-07-19 21:44:52 +0200 | [diff] [blame] | 455 | "EC/BMC", "unknown", "SSE/IE", "10GbE/NIS", "OpROM", "iRC", "unknown", "PTT" |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 456 | }; |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 457 | if (i >= ARRAY_SIZE(region_names)) { |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 458 | msg_pdbg2("%s: region index too high.\n", __func__); |
| 459 | return; |
| 460 | } |
| 461 | uint32_t base = ICH_FREG_BASE(reg->FLREGs[i]); |
| 462 | uint32_t limit = ICH_FREG_LIMIT(reg->FLREGs[i]); |
Nico Huber | 0ef2eb8 | 2024-07-19 21:38:17 +0200 | [diff] [blame] | 463 | msg_pdbg2("Region %d (%-9s) ", i, region_names[i]); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 464 | if (base > limit) |
| 465 | msg_pdbg2("is unused.\n"); |
| 466 | else |
Nico Huber | 0bb3f71 | 2017-03-29 16:44:33 +0200 | [diff] [blame] | 467 | msg_pdbg2("0x%08x - 0x%08x\n", base, limit); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 468 | } |
| 469 | |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 470 | void prettyprint_ich_descriptor_region(const enum ich_chipset cs, const struct ich_descriptors *const desc) |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 471 | { |
Nico Huber | 519be66 | 2018-12-23 20:03:35 +0100 | [diff] [blame] | 472 | ssize_t i; |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 473 | const ssize_t nr = ich_number_of_regions(cs, &desc->content); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 474 | msg_pdbg2("=== Region Section ===\n"); |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 475 | if (nr < 0) { |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 476 | msg_pdbg2("%s: number of regions too high (%d).\n", __func__, |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 477 | desc->content.NR + 1); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 478 | return; |
| 479 | } |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 480 | for (i = 0; i < nr; i++) |
Nico Huber | 519be66 | 2018-12-23 20:03:35 +0100 | [diff] [blame] | 481 | msg_pdbg2("FLREG%zd 0x%08x\n", i, desc->region.FLREGs[i]); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 482 | msg_pdbg2("\n"); |
| 483 | |
| 484 | msg_pdbg2("--- Details ---\n"); |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 485 | for (i = 0; i < nr; i++) |
Nico Huber | 519be66 | 2018-12-23 20:03:35 +0100 | [diff] [blame] | 486 | pprint_freg(&desc->region, (uint32_t)i); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 487 | msg_pdbg2("\n"); |
| 488 | } |
| 489 | |
Nico Huber | b3cc2c6 | 2024-07-15 00:45:17 +0200 | [diff] [blame] | 490 | static char prettify_flag(const unsigned int mask, const unsigned int bit, const char flag) |
| 491 | { |
| 492 | return mask & (1 << bit) ? flag : ' '; |
| 493 | } |
| 494 | |
| 495 | /* Takes NULL-terminated lists of names, assumes max. 5 chars per name. */ |
| 496 | static void prettyprint_pch100_masters( |
| 497 | const struct ich_descriptors *const desc, |
| 498 | const unsigned int number_masters, const char *const masters[], |
| 499 | const unsigned int number_regions, const char *const regions[]) |
| 500 | { |
| 501 | unsigned int m, r; |
| 502 | |
| 503 | msg_pdbg2(" "); |
| 504 | for (r = 0; r < number_regions && regions[r] != NULL; ++r) |
| 505 | msg_pdbg2(" %-5s", regions[r]); |
| 506 | msg_pdbg2("\n"); |
| 507 | |
| 508 | for (m = 0; m < number_masters; ++m) { |
| 509 | const unsigned int ext_start = 12; |
| 510 | |
| 511 | if (masters[m] == NULL) |
| 512 | break; |
| 513 | |
| 514 | const struct ich_desc_master_region_access master = desc->master.mstr[m]; |
| 515 | |
| 516 | msg_pdbg2("%-5s", masters[m]); |
| 517 | for (r = 0; r < ext_start && r < number_regions && regions[r] != NULL; ++r) |
| 518 | msg_pdbg2(" %c%c ", |
| 519 | prettify_flag(master.read, r, 'r'), |
| 520 | prettify_flag(master.write, r, 'w')); |
| 521 | for (; r < number_regions && regions[r] != NULL; ++r) |
| 522 | msg_pdbg2(" %c%c ", |
| 523 | prettify_flag(master.ext_read, r - ext_start, 'r'), |
| 524 | prettify_flag(master.ext_write, r - ext_start, 'w')); |
| 525 | msg_pdbg2("\n"); |
| 526 | } |
| 527 | } |
| 528 | |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 529 | void prettyprint_ich_descriptor_master(const enum ich_chipset cs, const struct ich_descriptors *const desc) |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 530 | { |
Nico Huber | 519be66 | 2018-12-23 20:03:35 +0100 | [diff] [blame] | 531 | ssize_t i; |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 532 | const ssize_t nm = ich_number_of_masters(cs, &desc->content); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 533 | msg_pdbg2("=== Master Section ===\n"); |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 534 | if (nm < 0) { |
| 535 | msg_pdbg2("%s: number of masters too high (%d).\n", __func__, |
| 536 | desc->content.NM + 1); |
| 537 | return; |
| 538 | } |
| 539 | for (i = 0; i < nm; i++) |
Nico Huber | 519be66 | 2018-12-23 20:03:35 +0100 | [diff] [blame] | 540 | msg_pdbg2("FLMSTR%zd 0x%08x\n", i + 1, desc->master.FLMSTRs[i]); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 541 | msg_pdbg2("\n"); |
| 542 | |
| 543 | msg_pdbg2("--- Details ---\n"); |
Nico Huber | b3cc2c6 | 2024-07-15 00:45:17 +0200 | [diff] [blame] | 544 | if (cs >= SPI_ENGINE_PCH100) { |
| 545 | const ssize_t nr = ich_number_of_regions(cs, &desc->content); |
| 546 | if (nr < 0) |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 547 | return; |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 548 | |
Nico Huber | b3cc2c6 | 2024-07-15 00:45:17 +0200 | [diff] [blame] | 549 | if (cs == CHIPSET_APOLLO_LAKE || |
| 550 | cs == CHIPSET_GEMINI_LAKE || |
| 551 | cs == CHIPSET_ELKHART_LAKE) { |
| 552 | const char *const masters[] = { |
| 553 | "BIOS", "TXE", NULL |
| 554 | }; |
| 555 | const char *const regions[] = { |
| 556 | " FD", "IFWI", " TXE", " n/a", "Pltf.", "DevExp", NULL |
| 557 | }; |
| 558 | prettyprint_pch100_masters(desc, nm, masters, nr, regions); |
Nico Huber | 42daab1 | 2024-07-16 00:27:27 +0200 | [diff] [blame] | 559 | } else if (cs == CHIPSET_C620_SERIES_LEWISBURG || |
| 560 | cs == CHIPSET_C740_SERIES_EMMITSBURG) { |
Nico Huber | b3cc2c6 | 2024-07-15 00:45:17 +0200 | [diff] [blame] | 561 | const char *const masters[] = { |
| 562 | "BIOS", "ME", "GbE", "DE", "BMC", "IE", NULL |
| 563 | }; |
| 564 | const char *const regions[] = { |
| 565 | " FD ", " BIOS", " ME ", " GbE ", "Pltf.", |
David Hendricks | a521636 | 2017-08-08 20:02:22 -0700 | [diff] [blame] | 566 | " DE ", "BIOS2", " Reg7", " BMC ", " DE2 ", |
| 567 | " IE ", "10GbE", "OpROM", "Reg13", "Reg14", |
Nico Huber | b3cc2c6 | 2024-07-15 00:45:17 +0200 | [diff] [blame] | 568 | "Reg15", NULL |
| 569 | }; |
| 570 | prettyprint_pch100_masters(desc, nm, masters, nr, regions); |
Nico Huber | d5a61ef | 2024-11-06 23:55:44 +0100 | [diff] [blame] | 571 | } else if (cs == CHIPSET_LUNAR_LAKE) { |
| 572 | const char *const masters[] = { |
| 573 | "BIOS", "CSME", "GbE", "rsvd.", "EC", "PSE", "SSE", NULL |
| 574 | }; |
| 575 | const char *const regions[] = { |
| 576 | " FD ", "BIOS ", "CSME ", " GbE ", "Pltf.", |
| 577 | "Reg5 ", "Reg6 ", "Reg7 ", " EC ", "Reg9 ", |
| 578 | " PSE ", "Reg11", "Reg12", "Reg13", "Reg14", |
| 579 | "Reg15", NULL |
| 580 | }; |
| 581 | prettyprint_pch100_masters(desc, nm, masters, nr, regions); |
Nico Huber | b3cc2c6 | 2024-07-15 00:45:17 +0200 | [diff] [blame] | 582 | } else { |
| 583 | const char *const masters[] = { |
Nico Huber | 5e0d9b0 | 2024-07-19 21:44:52 +0200 | [diff] [blame] | 584 | "BIOS", "ME", "GbE", "NAC", "EC", "SSE", NULL |
Nico Huber | b3cc2c6 | 2024-07-15 00:45:17 +0200 | [diff] [blame] | 585 | }; |
| 586 | const char *const regions[] = { |
| 587 | " FD ", "BIOS ", " ME ", " GbE ", "Pltf.", |
Nico Huber | 0ef2eb8 | 2024-07-19 21:38:17 +0200 | [diff] [blame] | 588 | "Reg5 ", "BIOS2", "Reg7 ", " EC ", "Reg9 ", |
Nico Huber | 5e0d9b0 | 2024-07-19 21:44:52 +0200 | [diff] [blame] | 589 | " SSE ", " NIS ", "Reg12", " iRC ", "Reg14", |
Nico Huber | 0ef2eb8 | 2024-07-19 21:38:17 +0200 | [diff] [blame] | 590 | " PTT ", NULL |
Nico Huber | b3cc2c6 | 2024-07-15 00:45:17 +0200 | [diff] [blame] | 591 | }; |
| 592 | prettyprint_pch100_masters(desc, nm, masters, nr, regions); |
Nico Huber | d2d3993 | 2019-01-18 16:49:37 +0100 | [diff] [blame] | 593 | } |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 594 | } else { |
| 595 | const struct ich_desc_master *const mstr = &desc->master; |
| 596 | msg_pdbg2(" Descr. BIOS ME GbE Platf.\n"); |
| 597 | msg_pdbg2("BIOS %c%c %c%c %c%c %c%c %c%c\n", |
| 598 | (mstr->BIOS_descr_r) ?'r':' ', (mstr->BIOS_descr_w) ?'w':' ', |
| 599 | (mstr->BIOS_BIOS_r) ?'r':' ', (mstr->BIOS_BIOS_w) ?'w':' ', |
| 600 | (mstr->BIOS_ME_r) ?'r':' ', (mstr->BIOS_ME_w) ?'w':' ', |
| 601 | (mstr->BIOS_GbE_r) ?'r':' ', (mstr->BIOS_GbE_w) ?'w':' ', |
| 602 | (mstr->BIOS_plat_r) ?'r':' ', (mstr->BIOS_plat_w) ?'w':' '); |
| 603 | msg_pdbg2("ME %c%c %c%c %c%c %c%c %c%c\n", |
| 604 | (mstr->ME_descr_r) ?'r':' ', (mstr->ME_descr_w) ?'w':' ', |
| 605 | (mstr->ME_BIOS_r) ?'r':' ', (mstr->ME_BIOS_w) ?'w':' ', |
| 606 | (mstr->ME_ME_r) ?'r':' ', (mstr->ME_ME_w) ?'w':' ', |
| 607 | (mstr->ME_GbE_r) ?'r':' ', (mstr->ME_GbE_w) ?'w':' ', |
| 608 | (mstr->ME_plat_r) ?'r':' ', (mstr->ME_plat_w) ?'w':' '); |
| 609 | msg_pdbg2("GbE %c%c %c%c %c%c %c%c %c%c\n", |
| 610 | (mstr->GbE_descr_r) ?'r':' ', (mstr->GbE_descr_w) ?'w':' ', |
| 611 | (mstr->GbE_BIOS_r) ?'r':' ', (mstr->GbE_BIOS_w) ?'w':' ', |
| 612 | (mstr->GbE_ME_r) ?'r':' ', (mstr->GbE_ME_w) ?'w':' ', |
| 613 | (mstr->GbE_GbE_r) ?'r':' ', (mstr->GbE_GbE_w) ?'w':' ', |
| 614 | (mstr->GbE_plat_r) ?'r':' ', (mstr->GbE_plat_w) ?'w':' '); |
| 615 | } |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 616 | msg_pdbg2("\n"); |
| 617 | } |
| 618 | |
Jacob Garber | beeb8bc | 2019-06-21 15:24:17 -0600 | [diff] [blame] | 619 | static void prettyprint_ich_descriptor_straps_ich8(const struct ich_descriptors *desc) |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 620 | { |
| 621 | static const char * const str_GPIO12[4] = { |
| 622 | "GPIO12", |
| 623 | "LAN PHY Power Control Function (Native Output)", |
| 624 | "GLAN_DOCK# (Native Input)", |
| 625 | "invalid configuration", |
| 626 | }; |
| 627 | |
| 628 | msg_pdbg2("--- MCH details ---\n"); |
| 629 | msg_pdbg2("ME B is %sabled.\n", desc->north.ich8.MDB ? "dis" : "en"); |
| 630 | msg_pdbg2("\n"); |
| 631 | |
| 632 | msg_pdbg2("--- ICH details ---\n"); |
| 633 | msg_pdbg2("ME SMBus Address 1: 0x%02x\n", desc->south.ich8.ASD); |
| 634 | msg_pdbg2("ME SMBus Address 2: 0x%02x\n", desc->south.ich8.ASD2); |
| 635 | msg_pdbg2("ME SMBus Controller is connected to the %s.\n", |
| 636 | desc->south.ich8.MESM2SEL ? "SMLink pins" : "SMBus pins"); |
| 637 | msg_pdbg2("SPI CS1 is used for %s.\n", |
| 638 | desc->south.ich8.SPICS1_LANPHYPC_SEL ? |
| 639 | "LAN PHY Power Control Function" : |
| 640 | "SPI Chip Select"); |
| 641 | msg_pdbg2("GPIO12 is used as %s.\n", |
| 642 | str_GPIO12[desc->south.ich8.GPIO12_SEL]); |
| 643 | msg_pdbg2("PCIe Port 6 is used for %s.\n", |
| 644 | desc->south.ich8.GLAN_PCIE_SEL ? "integrated LAN" : "PCI Express"); |
| 645 | msg_pdbg2("%sn BMC Mode: " |
| 646 | "Intel AMT SMBus Controller 1 is connected to %s.\n", |
| 647 | desc->south.ich8.BMCMODE ? "I" : "Not i", |
| 648 | desc->south.ich8.BMCMODE ? "SMLink" : "SMBus"); |
| 649 | msg_pdbg2("TCO is in %s Mode.\n", |
| 650 | desc->south.ich8.TCOMODE ? "Advanced TCO" : "Legacy/Compatible"); |
| 651 | msg_pdbg2("ME A is %sabled.\n", |
| 652 | desc->south.ich8.ME_DISABLE ? "dis" : "en"); |
| 653 | msg_pdbg2("\n"); |
| 654 | } |
| 655 | |
| 656 | static void prettyprint_ich_descriptor_straps_56_pciecs(uint8_t conf, uint8_t off) |
| 657 | { |
| 658 | msg_pdbg2("PCI Express Port Configuration Strap %d: ", off+1); |
| 659 | |
| 660 | off *= 4; |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 661 | switch (conf){ |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 662 | case 0: |
| 663 | msg_pdbg2("4x1 Ports %d-%d (x1)", 1+off, 4+off); |
| 664 | break; |
| 665 | case 1: |
| 666 | msg_pdbg2("1x2, 2x1 Port %d (x2), Port %d (disabled), " |
| 667 | "Ports %d, %d (x1)", 1+off, 2+off, 3+off, 4+off); |
| 668 | break; |
| 669 | case 2: |
| 670 | msg_pdbg2("2x2 Port %d (x2), Port %d (x2), Ports " |
| 671 | "%d, %d (disabled)", 1+off, 3+off, 2+off, 4+off); |
| 672 | break; |
| 673 | case 3: |
| 674 | msg_pdbg2("1x4 Port %d (x4), Ports %d-%d (disabled)", |
| 675 | 1+off, 2+off, 4+off); |
| 676 | break; |
| 677 | } |
| 678 | msg_pdbg2("\n"); |
| 679 | } |
| 680 | |
Jacob Garber | beeb8bc | 2019-06-21 15:24:17 -0600 | [diff] [blame] | 681 | static void prettyprint_ich_descriptor_pchstraps45678_56(const struct ich_desc_south_strap *s) |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 682 | { |
| 683 | /* PCHSTRP4 */ |
| 684 | msg_pdbg2("Intel PHY is %s.\n", |
| 685 | (s->ibex.PHYCON == 2) ? "connected" : |
| 686 | (s->ibex.PHYCON == 0) ? "disconnected" : "reserved"); |
| 687 | msg_pdbg2("GbE MAC SMBus address is %sabled.\n", |
| 688 | s->ibex.GBEMAC_SMBUS_ADDR_EN ? "en" : "dis"); |
| 689 | msg_pdbg2("GbE MAC SMBus address: 0x%02x\n", |
| 690 | s->ibex.GBEMAC_SMBUS_ADDR); |
| 691 | msg_pdbg2("GbE PHY SMBus address: 0x%02x\n", |
| 692 | s->ibex.GBEPHY_SMBUS_ADDR); |
| 693 | |
| 694 | /* PCHSTRP5 */ |
| 695 | /* PCHSTRP6 */ |
| 696 | /* PCHSTRP7 */ |
| 697 | msg_pdbg2("Intel ME SMBus Subsystem Vendor ID: 0x%04x\n", |
| 698 | s->ibex.MESMA2UDID_VENDOR); |
| 699 | msg_pdbg2("Intel ME SMBus Subsystem Device ID: 0x%04x\n", |
| 700 | s->ibex.MESMA2UDID_VENDOR); |
| 701 | |
| 702 | /* PCHSTRP8 */ |
| 703 | } |
| 704 | |
Jacob Garber | beeb8bc | 2019-06-21 15:24:17 -0600 | [diff] [blame] | 705 | static void prettyprint_ich_descriptor_pchstraps111213_56(const struct ich_desc_south_strap *s) |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 706 | { |
| 707 | /* PCHSTRP11 */ |
| 708 | msg_pdbg2("SMLink1 GP Address is %sabled.\n", |
| 709 | s->ibex.SML1GPAEN ? "en" : "dis"); |
| 710 | msg_pdbg2("SMLink1 controller General Purpose Target address: 0x%02x\n", |
| 711 | s->ibex.SML1GPA); |
| 712 | msg_pdbg2("SMLink1 I2C Target address is %sabled.\n", |
| 713 | s->ibex.SML1I2CAEN ? "en" : "dis"); |
| 714 | msg_pdbg2("SMLink1 I2C Target address: 0x%02x\n", |
| 715 | s->ibex.SML1I2CA); |
| 716 | |
| 717 | /* PCHSTRP12 */ |
| 718 | /* PCHSTRP13 */ |
| 719 | } |
| 720 | |
Jacob Garber | beeb8bc | 2019-06-21 15:24:17 -0600 | [diff] [blame] | 721 | static void prettyprint_ich_descriptor_straps_ibex(const struct ich_desc_south_strap *s) |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 722 | { |
Stefan Tauner | 67d163d | 2013-01-15 17:37:48 +0000 | [diff] [blame] | 723 | static const uint8_t dec_t209min[4] = { |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 724 | 100, |
| 725 | 50, |
| 726 | 5, |
| 727 | 1 |
| 728 | }; |
| 729 | |
| 730 | msg_pdbg2("--- PCH ---\n"); |
| 731 | |
| 732 | /* PCHSTRP0 */ |
| 733 | msg_pdbg2("Chipset configuration Softstrap 2: %d\n", s->ibex.cs_ss2); |
| 734 | msg_pdbg2("Intel ME SMBus Select is %sabled.\n", |
| 735 | s->ibex.SMB_EN ? "en" : "dis"); |
| 736 | msg_pdbg2("SMLink0 segment is %sabled.\n", |
| 737 | s->ibex.SML0_EN ? "en" : "dis"); |
| 738 | msg_pdbg2("SMLink1 segment is %sabled.\n", |
| 739 | s->ibex.SML1_EN ? "en" : "dis"); |
| 740 | msg_pdbg2("SMLink1 Frequency: %s\n", |
| 741 | (s->ibex.SML1FRQ == 1) ? "100 kHz" : "reserved"); |
| 742 | msg_pdbg2("Intel ME SMBus Frequency: %s\n", |
| 743 | (s->ibex.SMB0FRQ == 1) ? "100 kHz" : "reserved"); |
| 744 | msg_pdbg2("SMLink0 Frequency: %s\n", |
| 745 | (s->ibex.SML0FRQ == 1) ? "100 kHz" : "reserved"); |
| 746 | msg_pdbg2("GPIO12 is used as %s.\n", s->ibex.LANPHYPC_GP12_SEL ? |
| 747 | "LAN_PHY_PWR_CTRL" : "general purpose output"); |
| 748 | msg_pdbg2("Chipset configuration Softstrap 1: %d\n", s->ibex.cs_ss1); |
| 749 | msg_pdbg2("DMI RequesterID Checks are %sabled.\n", |
| 750 | s->ibex.DMI_REQID_DIS ? "en" : "dis"); |
| 751 | msg_pdbg2("BIOS Boot-Block size (BBBS): %d kB.\n", |
| 752 | 1 << (6 + s->ibex.BBBS)); |
| 753 | |
| 754 | /* PCHSTRP1 */ |
| 755 | msg_pdbg2("Chipset configuration Softstrap 3: 0x%x\n", s->ibex.cs_ss3); |
| 756 | |
| 757 | /* PCHSTRP2 */ |
| 758 | msg_pdbg2("ME SMBus ASD address is %sabled.\n", |
| 759 | s->ibex.MESMASDEN ? "en" : "dis"); |
| 760 | msg_pdbg2("ME SMBus Controller ASD Target address: 0x%02x\n", |
| 761 | s->ibex.MESMASDA); |
| 762 | msg_pdbg2("ME SMBus I2C address is %sabled.\n", |
| 763 | s->ibex.MESMI2CEN ? "en" : "dis"); |
| 764 | msg_pdbg2("ME SMBus I2C target address: 0x%02x\n", |
| 765 | s->ibex.MESMI2CA); |
| 766 | |
| 767 | /* PCHSTRP3 */ |
| 768 | prettyprint_ich_descriptor_pchstraps45678_56(s); |
| 769 | /* PCHSTRP9 */ |
| 770 | prettyprint_ich_descriptor_straps_56_pciecs(s->ibex.PCIEPCS1, 0); |
| 771 | prettyprint_ich_descriptor_straps_56_pciecs(s->ibex.PCIEPCS1, 1); |
| 772 | msg_pdbg2("PCIe Lane Reversal 1: PCIe Lanes 0-3 are %sreserved.\n", |
| 773 | s->ibex.PCIELR1 ? "" : "not "); |
| 774 | msg_pdbg2("PCIe Lane Reversal 2: PCIe Lanes 4-7 are %sreserved.\n", |
| 775 | s->ibex.PCIELR2 ? "" : "not "); |
| 776 | msg_pdbg2("DMI Lane Reversal: DMI Lanes 0-3 are %sreserved.\n", |
| 777 | s->ibex.DMILR ? "" : "not "); |
| 778 | msg_pdbg2("Default PHY PCIe Port is %d.\n", s->ibex.PHY_PCIEPORTSEL+1); |
| 779 | msg_pdbg2("Integrated MAC/PHY communication over PCIe is %sabled.\n", |
| 780 | s->ibex.PHY_PCIE_EN ? "en" : "dis"); |
| 781 | |
| 782 | /* PCHSTRP10 */ |
| 783 | msg_pdbg2("Management Engine will boot from %sflash.\n", |
| 784 | s->ibex.ME_BOOT_FLASH ? "" : "ROM, then "); |
| 785 | msg_pdbg2("Chipset configuration Softstrap 5: %d\n", s->ibex.cs_ss5); |
| 786 | msg_pdbg2("Virtualization Engine Enable 1 is %sabled.\n", |
| 787 | s->ibex.VE_EN ? "en" : "dis"); |
| 788 | msg_pdbg2("ME Memory-attached Debug Display Device is %sabled.\n", |
| 789 | s->ibex.MMDDE ? "en" : "dis"); |
| 790 | msg_pdbg2("ME Memory-attached Debug Display Device address: 0x%02x\n", |
| 791 | s->ibex.MMADDR); |
| 792 | msg_pdbg2("Chipset configuration Softstrap 7: %d\n", s->ibex.cs_ss7); |
| 793 | msg_pdbg2("Integrated Clocking Configuration is %d.\n", |
| 794 | (s->ibex.ICC_SEL == 7) ? 0 : s->ibex.ICC_SEL); |
| 795 | msg_pdbg2("PCH Signal CL_RST1# does %sassert when Intel ME performs a " |
| 796 | "reset.\n", s->ibex.MER_CL1 ? "" : "not "); |
| 797 | |
| 798 | prettyprint_ich_descriptor_pchstraps111213_56(s); |
| 799 | |
| 800 | /* PCHSTRP14 */ |
| 801 | msg_pdbg2("Virtualization Engine Enable 2 is %sabled.\n", |
| 802 | s->ibex.VE_EN2 ? "en" : "dis"); |
| 803 | msg_pdbg2("Virtualization Engine will boot from %sflash.\n", |
| 804 | s->ibex.VE_BOOT_FLASH ? "" : "ROM, then "); |
| 805 | msg_pdbg2("Braidwood SSD functionality is %sabled.\n", |
| 806 | s->ibex.BW_SSD ? "en" : "dis"); |
| 807 | msg_pdbg2("Braidwood NVMHCI functionality is %sabled.\n", |
| 808 | s->ibex.NVMHCI_EN ? "en" : "dis"); |
| 809 | |
| 810 | /* PCHSTRP15 */ |
| 811 | msg_pdbg2("Chipset configuration Softstrap 6: %d\n", s->ibex.cs_ss6); |
| 812 | msg_pdbg2("Integrated wired LAN Solution is %sabled.\n", |
| 813 | s->ibex.IWL_EN ? "en" : "dis"); |
| 814 | msg_pdbg2("t209 min Timing: %d ms\n", |
| 815 | dec_t209min[s->ibex.t209min]); |
| 816 | msg_pdbg2("\n"); |
| 817 | } |
| 818 | |
Jacob Garber | beeb8bc | 2019-06-21 15:24:17 -0600 | [diff] [blame] | 819 | static void prettyprint_ich_descriptor_straps_cougar(const struct ich_desc_south_strap *s) |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 820 | { |
| 821 | msg_pdbg2("--- PCH ---\n"); |
| 822 | |
| 823 | /* PCHSTRP0 */ |
| 824 | msg_pdbg2("Chipset configuration Softstrap 1: %d\n", s->cougar.cs_ss1); |
| 825 | msg_pdbg2("Intel ME SMBus Select is %sabled.\n", |
| 826 | s->ibex.SMB_EN ? "en" : "dis"); |
| 827 | msg_pdbg2("SMLink0 segment is %sabled.\n", |
| 828 | s->ibex.SML0_EN ? "en" : "dis"); |
| 829 | msg_pdbg2("SMLink1 segment is %sabled.\n", |
| 830 | s->ibex.SML1_EN ? "en" : "dis"); |
| 831 | msg_pdbg2("SMLink1 Frequency: %s\n", |
| 832 | (s->ibex.SML1FRQ == 1) ? "100 kHz" : "reserved"); |
| 833 | msg_pdbg2("Intel ME SMBus Frequency: %s\n", |
| 834 | (s->ibex.SMB0FRQ == 1) ? "100 kHz" : "reserved"); |
| 835 | msg_pdbg2("SMLink0 Frequency: %s\n", |
| 836 | (s->ibex.SML0FRQ == 1) ? "100 kHz" : "reserved"); |
| 837 | msg_pdbg2("GPIO12 is used as %s.\n", s->ibex.LANPHYPC_GP12_SEL ? |
| 838 | "LAN_PHY_PWR_CTRL" : "general purpose output"); |
| 839 | msg_pdbg2("LinkSec is %sabled.\n", |
| 840 | s->cougar.LINKSEC_DIS ? "en" : "dis"); |
| 841 | msg_pdbg2("DMI RequesterID Checks are %sabled.\n", |
| 842 | s->ibex.DMI_REQID_DIS ? "en" : "dis"); |
| 843 | msg_pdbg2("BIOS Boot-Block size (BBBS): %d kB.\n", |
| 844 | 1 << (6 + s->ibex.BBBS)); |
| 845 | |
| 846 | /* PCHSTRP1 */ |
| 847 | msg_pdbg2("Chipset configuration Softstrap 3: 0x%x\n", s->ibex.cs_ss3); |
| 848 | msg_pdbg2("Chipset configuration Softstrap 2: 0x%x\n", s->ibex.cs_ss2); |
| 849 | |
| 850 | /* PCHSTRP2 */ |
| 851 | msg_pdbg2("ME SMBus ASD address is %sabled.\n", |
| 852 | s->ibex.MESMASDEN ? "en" : "dis"); |
| 853 | msg_pdbg2("ME SMBus Controller ASD Target address: 0x%02x\n", |
| 854 | s->ibex.MESMASDA); |
| 855 | msg_pdbg2("ME SMBus MCTP Address is %sabled.\n", |
| 856 | s->cougar.MESMMCTPAEN ? "en" : "dis"); |
| 857 | msg_pdbg2("ME SMBus MCTP target address: 0x%02x\n", |
| 858 | s->cougar.MESMMCTPA); |
| 859 | msg_pdbg2("ME SMBus I2C address is %sabled.\n", |
| 860 | s->ibex.MESMI2CEN ? "en" : "dis"); |
| 861 | msg_pdbg2("ME SMBus I2C target address: 0x%02x\n", |
| 862 | s->ibex.MESMI2CA); |
| 863 | |
| 864 | /* PCHSTRP3 */ |
| 865 | prettyprint_ich_descriptor_pchstraps45678_56(s); |
| 866 | /* PCHSTRP9 */ |
| 867 | prettyprint_ich_descriptor_straps_56_pciecs(s->ibex.PCIEPCS1, 0); |
| 868 | prettyprint_ich_descriptor_straps_56_pciecs(s->ibex.PCIEPCS1, 1); |
| 869 | msg_pdbg2("PCIe Lane Reversal 1: PCIe Lanes 0-3 are %sreserved.\n", |
| 870 | s->ibex.PCIELR1 ? "" : "not "); |
| 871 | msg_pdbg2("PCIe Lane Reversal 2: PCIe Lanes 4-7 are %sreserved.\n", |
| 872 | s->ibex.PCIELR2 ? "" : "not "); |
| 873 | msg_pdbg2("DMI Lane Reversal: DMI Lanes 0-3 are %sreserved.\n", |
| 874 | s->ibex.DMILR ? "" : "not "); |
| 875 | msg_pdbg2("ME Debug status writes over SMBUS are %sabled.\n", |
| 876 | s->cougar.MDSMBE_EN ? "en" : "dis"); |
| 877 | msg_pdbg2("ME Debug SMBus Emergency Mode address: 0x%02x (raw)\n", |
| 878 | s->cougar.MDSMBE_ADD); |
| 879 | msg_pdbg2("Default PHY PCIe Port is %d.\n", s->ibex.PHY_PCIEPORTSEL+1); |
| 880 | msg_pdbg2("Integrated MAC/PHY communication over PCIe is %sabled.\n", |
| 881 | s->ibex.PHY_PCIE_EN ? "en" : "dis"); |
| 882 | msg_pdbg2("PCIe ports Subtractive Decode Agent is %sabled.\n", |
| 883 | s->cougar.SUB_DECODE_EN ? "en" : "dis"); |
| 884 | msg_pdbg2("GPIO74 is used as %s.\n", s->cougar.PCHHOT_SML1ALERT_SEL ? |
| 885 | "PCHHOT#" : "SML1ALERT#"); |
| 886 | |
| 887 | /* PCHSTRP10 */ |
| 888 | msg_pdbg2("Management Engine will boot from %sflash.\n", |
| 889 | s->ibex.ME_BOOT_FLASH ? "" : "ROM, then "); |
| 890 | |
| 891 | msg_pdbg2("ME Debug SMBus Emergency Mode is %sabled.\n", |
| 892 | s->cougar.MDSMBE_EN ? "en" : "dis"); |
| 893 | msg_pdbg2("ME Debug SMBus Emergency Mode Address: 0x%02x\n", |
| 894 | s->cougar.MDSMBE_ADD); |
| 895 | |
| 896 | msg_pdbg2("Integrated Clocking Configuration used: %d\n", |
| 897 | s->cougar.ICC_SEL); |
Stefan Tauner | a1a14ec | 2012-08-13 08:45:13 +0000 | [diff] [blame] | 898 | msg_pdbg2("PCH Signal CL_RST1# does %sassert when Intel ME performs a reset.\n", |
| 899 | s->ibex.MER_CL1 ? "" : "not "); |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 900 | msg_pdbg2("ICC Profile is selected by %s.\n", |
| 901 | s->cougar.ICC_PRO_SEL ? "Softstraps" : "BIOS"); |
| 902 | msg_pdbg2("Deep SX is %ssupported on the platform.\n", |
| 903 | s->cougar.Deep_SX_EN ? "not " : ""); |
| 904 | msg_pdbg2("ME Debug LAN Emergency Mode is %sabled.\n", |
| 905 | s->cougar.ME_DBG_LAN ? "en" : "dis"); |
| 906 | |
| 907 | prettyprint_ich_descriptor_pchstraps111213_56(s); |
| 908 | |
| 909 | /* PCHSTRP14 */ |
| 910 | /* PCHSTRP15 */ |
| 911 | msg_pdbg2("Chipset configuration Softstrap 6: %d\n", s->cougar.cs_ss6); |
| 912 | msg_pdbg2("Integrated wired LAN is %sabled.\n", |
| 913 | s->cougar.IWL_EN ? "en" : "dis"); |
| 914 | msg_pdbg2("Chipset configuration Softstrap 5: %d\n", s->cougar.cs_ss5); |
| 915 | msg_pdbg2("SMLink1 provides temperature from %s.\n", |
Stefan Tauner | a1a14ec | 2012-08-13 08:45:13 +0000 | [diff] [blame] | 916 | s->cougar.SMLINK1_THERM_SEL ? "PCH only" : "the CPU, PCH and DIMMs"); |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 917 | msg_pdbg2("GPIO29 is used as %s.\n", s->cougar.SLP_LAN_GP29_SEL ? |
| 918 | "general purpose output" : "SLP_LAN#"); |
| 919 | |
| 920 | /* PCHSTRP16 */ |
| 921 | /* PCHSTRP17 */ |
| 922 | msg_pdbg2("Integrated Clock: %s Clock Mode\n", |
| 923 | s->cougar.ICML ? "Buffered Through" : "Full Integrated"); |
| 924 | msg_pdbg2("\n"); |
| 925 | } |
| 926 | |
| 927 | void prettyprint_ich_descriptor_straps(enum ich_chipset cs, const struct ich_descriptors *desc) |
| 928 | { |
Stefan Tauner | a1a14ec | 2012-08-13 08:45:13 +0000 | [diff] [blame] | 929 | unsigned int i, max_count; |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 930 | msg_pdbg2("=== Softstraps ===\n"); |
| 931 | |
Nico Huber | 157b818 | 2024-07-19 17:48:12 +0200 | [diff] [blame] | 932 | if (has_classic_proc_straps(cs)) { |
| 933 | max_count = MIN(ARRAY_SIZE(desc->north.STRPs), desc->content.MSL); |
| 934 | if (max_count < desc->content.MSL) { |
| 935 | msg_pdbg2("MSL (%u) is greater than the current maximum of %u entries.\n", |
| 936 | desc->content.MSL, max_count); |
| 937 | msg_pdbg2("Only the first %u entries will be printed.\n", max_count); |
| 938 | } |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 939 | |
Nico Huber | 157b818 | 2024-07-19 17:48:12 +0200 | [diff] [blame] | 940 | msg_pdbg2("--- North/MCH/PROC (%d entries) ---\n", max_count); |
| 941 | for (i = 0; i < max_count; i++) |
| 942 | msg_pdbg2("STRP%-2d = 0x%08x\n", i, desc->north.STRPs[i]); |
| 943 | msg_pdbg2("\n"); |
| 944 | } |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 945 | |
Nico Huber | 519be66 | 2018-12-23 20:03:35 +0100 | [diff] [blame] | 946 | max_count = MIN(ARRAY_SIZE(desc->south.STRPs), desc->content.ISL); |
Nico Huber | d7c7552 | 2017-03-29 16:31:49 +0200 | [diff] [blame] | 947 | if (max_count < desc->content.ISL) { |
Stefan Tauner | a1a14ec | 2012-08-13 08:45:13 +0000 | [diff] [blame] | 948 | msg_pdbg2("ISL (%u) is greater than the current maximum of %u entries.\n", |
| 949 | desc->content.ISL, max_count); |
| 950 | msg_pdbg2("Only the first %u entries will be printed.\n", max_count); |
Nico Huber | d7c7552 | 2017-03-29 16:31:49 +0200 | [diff] [blame] | 951 | } |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 952 | |
Stefan Tauner | a1a14ec | 2012-08-13 08:45:13 +0000 | [diff] [blame] | 953 | msg_pdbg2("--- South/ICH/PCH (%d entries) ---\n", max_count); |
| 954 | for (i = 0; i < max_count; i++) |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 955 | msg_pdbg2("STRP%-2d = 0x%08x\n", i, desc->south.STRPs[i]); |
| 956 | msg_pdbg2("\n"); |
| 957 | |
| 958 | switch (cs) { |
| 959 | case CHIPSET_ICH8: |
| 960 | if (sizeof(desc->north.ich8) / 4 != desc->content.MSL) |
| 961 | msg_pdbg2("Detailed North/MCH/PROC information is " |
| 962 | "probably not reliable, printing anyway.\n"); |
| 963 | if (sizeof(desc->south.ich8) / 4 != desc->content.ISL) |
| 964 | msg_pdbg2("Detailed South/ICH/PCH information is " |
| 965 | "probably not reliable, printing anyway.\n"); |
| 966 | prettyprint_ich_descriptor_straps_ich8(desc); |
| 967 | break; |
| 968 | case CHIPSET_5_SERIES_IBEX_PEAK: |
| 969 | /* PCH straps only. PROCSTRPs are unknown. */ |
| 970 | if (sizeof(desc->south.ibex) / 4 != desc->content.ISL) |
| 971 | msg_pdbg2("Detailed South/ICH/PCH information is " |
| 972 | "probably not reliable, printing anyway.\n"); |
| 973 | prettyprint_ich_descriptor_straps_ibex(&desc->south); |
| 974 | break; |
| 975 | case CHIPSET_6_SERIES_COUGAR_POINT: |
| 976 | /* PCH straps only. PROCSTRP0 is "reserved". */ |
| 977 | if (sizeof(desc->south.cougar) / 4 != desc->content.ISL) |
| 978 | msg_pdbg2("Detailed South/ICH/PCH information is " |
| 979 | "probably not reliable, printing anyway.\n"); |
| 980 | prettyprint_ich_descriptor_straps_cougar(&desc->south); |
| 981 | break; |
| 982 | case CHIPSET_ICH_UNKNOWN: |
| 983 | break; |
| 984 | default: |
Stefan Tauner | a1a14ec | 2012-08-13 08:45:13 +0000 | [diff] [blame] | 985 | msg_pdbg2("The meaning of the descriptor straps are unknown yet.\n\n"); |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 986 | break; |
| 987 | } |
| 988 | } |
| 989 | |
Jacob Garber | beeb8bc | 2019-06-21 15:24:17 -0600 | [diff] [blame] | 990 | static void prettyprint_rdid(uint32_t reg_val) |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 991 | { |
| 992 | uint8_t mid = reg_val & 0xFF; |
| 993 | uint16_t did = ((reg_val >> 16) & 0xFF) | (reg_val & 0xFF00); |
| 994 | msg_pdbg2("Manufacturer ID 0x%02x, Device ID 0x%04x\n", mid, did); |
| 995 | } |
| 996 | |
| 997 | void prettyprint_ich_descriptor_upper_map(const struct ich_desc_upper_map *umap) |
| 998 | { |
| 999 | int i; |
| 1000 | msg_pdbg2("=== Upper Map Section ===\n"); |
| 1001 | msg_pdbg2("FLUMAP1 0x%08x\n", umap->FLUMAP1); |
| 1002 | msg_pdbg2("\n"); |
| 1003 | |
| 1004 | msg_pdbg2("--- Details ---\n"); |
| 1005 | msg_pdbg2("VTL (length in DWORDS) = %d\n", umap->VTL); |
| 1006 | msg_pdbg2("VTBA (base address) = 0x%6.6x\n", getVTBA(umap)); |
| 1007 | msg_pdbg2("\n"); |
| 1008 | |
| 1009 | msg_pdbg2("VSCC Table: %d entries\n", umap->VTL/2); |
Stefan Tauner | a1a14ec | 2012-08-13 08:45:13 +0000 | [diff] [blame] | 1010 | for (i = 0; i < umap->VTL/2; i++) { |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 1011 | uint32_t jid = umap->vscc_table[i].JID; |
| 1012 | uint32_t vscc = umap->vscc_table[i].VSCC; |
| 1013 | msg_pdbg2(" JID%d = 0x%08x\n", i, jid); |
| 1014 | msg_pdbg2(" VSCC%d = 0x%08x\n", i, vscc); |
Martin Roth | f6c1cb1 | 2022-03-15 10:55:25 -0600 | [diff] [blame] | 1015 | msg_pdbg2(" "); /* indentation */ |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 1016 | prettyprint_rdid(jid); |
Martin Roth | f6c1cb1 | 2022-03-15 10:55:25 -0600 | [diff] [blame] | 1017 | msg_pdbg2(" "); /* indentation */ |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 1018 | prettyprint_ich_reg_vscc(vscc, 0, false); |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 1019 | } |
| 1020 | msg_pdbg2("\n"); |
| 1021 | } |
| 1022 | |
David Hendricks | 66565a7 | 2021-09-20 21:56:40 -0700 | [diff] [blame] | 1023 | static inline void warn_peculiar_desc(const char *const name) |
Nico Huber | 964007a | 2021-06-17 21:12:47 +0200 | [diff] [blame] | 1024 | { |
Nico Huber | 964007a | 2021-06-17 21:12:47 +0200 | [diff] [blame] | 1025 | msg_pwarn("Peculiar flash descriptor, assuming %s compatibility.\n", name); |
| 1026 | } |
| 1027 | |
Nico Huber | 1dc3d42 | 2017-06-17 00:09:31 +0200 | [diff] [blame] | 1028 | /* |
| 1029 | * Guesses a minimum chipset version based on the maximum number of |
Nico Huber | 3ad9aad | 2021-06-17 22:05:00 +0200 | [diff] [blame] | 1030 | * soft straps per generation and presence of the MIP base (MDTBA). |
Nico Huber | 1dc3d42 | 2017-06-17 00:09:31 +0200 | [diff] [blame] | 1031 | */ |
Nico Huber | db878fb | 2024-07-19 17:37:09 +0200 | [diff] [blame] | 1032 | static enum ich_chipset guess_ich_chipset(const struct ich_desc_content *const content, |
| 1033 | const struct ich_desc_upper_map *const upper) |
Nico Huber | 1dc3d42 | 2017-06-17 00:09:31 +0200 | [diff] [blame] | 1034 | { |
| 1035 | if (content->ICCRIBA == 0x00) { |
| 1036 | if (content->MSL == 0 && content->ISL <= 2) |
| 1037 | return CHIPSET_ICH8; |
Nico Huber | 83b01c8 | 2021-06-17 21:20:09 +0200 | [diff] [blame] | 1038 | if (content->ISL <= 2) |
Nico Huber | 1dc3d42 | 2017-06-17 00:09:31 +0200 | [diff] [blame] | 1039 | return CHIPSET_ICH9; |
Nico Huber | 83b01c8 | 2021-06-17 21:20:09 +0200 | [diff] [blame] | 1040 | if (content->ISL <= 10) |
Nico Huber | 1dc3d42 | 2017-06-17 00:09:31 +0200 | [diff] [blame] | 1041 | return CHIPSET_ICH10; |
David Hendricks | 66565a7 | 2021-09-20 21:56:40 -0700 | [diff] [blame] | 1042 | if (content->ISL <= 16) |
| 1043 | return CHIPSET_5_SERIES_IBEX_PEAK; |
Nico Huber | 83b01c8 | 2021-06-17 21:20:09 +0200 | [diff] [blame] | 1044 | if (content->FLMAP2 == 0) { |
Nico Huber | 81965f3 | 2021-06-17 23:25:35 +0200 | [diff] [blame] | 1045 | if (content->ISL == 19) |
| 1046 | return CHIPSET_APOLLO_LAKE; |
David Hendricks | 66565a7 | 2021-09-20 21:56:40 -0700 | [diff] [blame] | 1047 | if (content->ISL == 23) |
| 1048 | return CHIPSET_GEMINI_LAKE; |
| 1049 | warn_peculiar_desc("Gemini Lake"); |
Nico Huber | 81965f3 | 2021-06-17 23:25:35 +0200 | [diff] [blame] | 1050 | return CHIPSET_GEMINI_LAKE; |
Nico Huber | d2d3993 | 2019-01-18 16:49:37 +0100 | [diff] [blame] | 1051 | } |
Nico Huber | 612519b | 2024-11-06 23:37:11 +0100 | [diff] [blame] | 1052 | if (content->ISL < 0x50) { /* arbitrary choice, just say < 0x50 is old */ |
| 1053 | warn_peculiar_desc("Ibex Peak"); |
| 1054 | return CHIPSET_5_SERIES_IBEX_PEAK; |
| 1055 | } |
Nico Huber | 42daab1 | 2024-07-16 00:27:27 +0200 | [diff] [blame] | 1056 | if (content->NM == 6) { |
| 1057 | /* 0x8b is from the SPI Guide, but not yet seen in the wild. */ |
| 1058 | if (0x50 <= content->ISL && content->ISL <= 0x8b) |
| 1059 | return CHIPSET_C740_SERIES_EMMITSBURG; |
| 1060 | warn_peculiar_desc("C740 series"); |
| 1061 | return CHIPSET_C740_SERIES_EMMITSBURG; |
| 1062 | } |
Nico Huber | 612519b | 2024-11-06 23:37:11 +0100 | [diff] [blame] | 1063 | if (content->ISL == 0xb3 && content->MSL == 0x3a) |
| 1064 | return CHIPSET_ARROW_LAKE; |
| 1065 | warn_peculiar_desc("Arrow Lake"); |
| 1066 | return CHIPSET_ARROW_LAKE; |
Nico Huber | 3ad9aad | 2021-06-17 22:05:00 +0200 | [diff] [blame] | 1067 | } else if (upper->MDTBA == 0x00) { |
| 1068 | if (content->ICCRIBA < 0x31 && content->FMSBA < 0x30) { |
| 1069 | if (content->MSL == 0 && content->ISL <= 17) |
| 1070 | return CHIPSET_BAYTRAIL; |
| 1071 | if (content->MSL <= 1 && content->ISL <= 18) |
| 1072 | return CHIPSET_6_SERIES_COUGAR_POINT; |
David Hendricks | 66565a7 | 2021-09-20 21:56:40 -0700 | [diff] [blame] | 1073 | if (content->MSL <= 1 && content->ISL <= 21) |
| 1074 | return CHIPSET_8_SERIES_LYNX_POINT; |
| 1075 | warn_peculiar_desc("Lynx Point"); |
Nico Huber | 81965f3 | 2021-06-17 23:25:35 +0200 | [diff] [blame] | 1076 | return CHIPSET_8_SERIES_LYNX_POINT; |
Nico Huber | 3ad9aad | 2021-06-17 22:05:00 +0200 | [diff] [blame] | 1077 | } |
| 1078 | if (content->NM == 6) { |
David Hendricks | 66565a7 | 2021-09-20 21:56:40 -0700 | [diff] [blame] | 1079 | if (content->ICCRIBA <= 0x34) |
| 1080 | return CHIPSET_C620_SERIES_LEWISBURG; |
| 1081 | warn_peculiar_desc("C620 series"); |
Nico Huber | 2a5dfaf | 2019-07-04 16:01:51 +0200 | [diff] [blame] | 1082 | return CHIPSET_C620_SERIES_LEWISBURG; |
Nico Huber | 3ad9aad | 2021-06-17 22:05:00 +0200 | [diff] [blame] | 1083 | } |
David Hendricks | 66565a7 | 2021-09-20 21:56:40 -0700 | [diff] [blame] | 1084 | if (content->ICCRIBA == 0x31) |
| 1085 | return CHIPSET_100_SERIES_SUNRISE_POINT; |
| 1086 | warn_peculiar_desc("100 series"); |
Nico Huber | 83b01c8 | 2021-06-17 21:20:09 +0200 | [diff] [blame] | 1087 | return CHIPSET_100_SERIES_SUNRISE_POINT; |
Nico Huber | 0ef2eb8 | 2024-07-19 21:38:17 +0200 | [diff] [blame] | 1088 | } else if (content->FLMAP2 == 0xffffffff) { |
| 1089 | if (content->ISL == 0x8f) |
| 1090 | return CHIPSET_SNOW_RIDGE; |
| 1091 | warn_peculiar_desc("Snow Ridge"); |
| 1092 | return CHIPSET_SNOW_RIDGE; |
Nico Huber | 1dc3d42 | 2017-06-17 00:09:31 +0200 | [diff] [blame] | 1093 | } else { |
David Hendricks | 66565a7 | 2021-09-20 21:56:40 -0700 | [diff] [blame] | 1094 | if (content->ICCRIBA == 0x34) |
| 1095 | return CHIPSET_300_SERIES_CANNON_POINT; |
Michał Żygowski | 5c9f542 | 2021-06-16 15:13:54 +0200 | [diff] [blame] | 1096 | if (content->CSSL == 0x11) |
| 1097 | return CHIPSET_500_SERIES_TIGER_POINT; |
Nico Huber | 29c23dd | 2022-12-21 15:25:09 +0000 | [diff] [blame] | 1098 | if (content->CSSL == 0x14) /* backwards compatible Alder Point */ |
| 1099 | return CHIPSET_500_SERIES_TIGER_POINT; |
Nico Huber | 756b6b3 | 2022-12-21 17:15:13 +0000 | [diff] [blame] | 1100 | if (content->CSSL == 0x03) { |
Nico Huber | 5e0d9b0 | 2024-07-19 21:44:52 +0200 | [diff] [blame] | 1101 | if (content->CSSO == 0x58) { |
Nico Huber | 756b6b3 | 2022-12-21 17:15:13 +0000 | [diff] [blame] | 1102 | return CHIPSET_ELKHART_LAKE; |
Nico Huber | 5e0d9b0 | 2024-07-19 21:44:52 +0200 | [diff] [blame] | 1103 | } else if (content->CSSO == 0x6c) { /* backwards compatible Jasper Lake */ |
Nico Huber | 756b6b3 | 2022-12-21 17:15:13 +0000 | [diff] [blame] | 1104 | return CHIPSET_300_SERIES_CANNON_POINT; |
Nico Huber | 5e0d9b0 | 2024-07-19 21:44:52 +0200 | [diff] [blame] | 1105 | } else if (content->CSSO == 0x70) { |
Nico Huber | d5a61ef | 2024-11-06 23:55:44 +0100 | [diff] [blame] | 1106 | /* 0x7d from in SPI guide, 0x7e found in the wild */ |
| 1107 | if (content->ISL == 0x7d || content->ISL == 0x7e) |
| 1108 | return CHIPSET_LUNAR_LAKE; |
Nico Huber | 5e0d9b0 | 2024-07-19 21:44:52 +0200 | [diff] [blame] | 1109 | if (content->ISL == 0x82) |
| 1110 | return CHIPSET_METEOR_LAKE; |
| 1111 | } |
| 1112 | } |
| 1113 | if (content->ISL >= 0x82) { |
| 1114 | warn_peculiar_desc("Meteor Lake"); |
| 1115 | return CHIPSET_METEOR_LAKE; |
Nico Huber | 756b6b3 | 2022-12-21 17:15:13 +0000 | [diff] [blame] | 1116 | } |
Michał Żygowski | 5c9f542 | 2021-06-16 15:13:54 +0200 | [diff] [blame] | 1117 | msg_pwarn("Unknown flash descriptor, assuming 500 series compatibility.\n"); |
| 1118 | return CHIPSET_500_SERIES_TIGER_POINT; |
Nico Huber | 1dc3d42 | 2017-06-17 00:09:31 +0200 | [diff] [blame] | 1119 | } |
| 1120 | } |
| 1121 | |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 1122 | /* len is the length of dump in bytes */ |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 1123 | int read_ich_descriptors_from_dump(const uint32_t *const dump, const size_t len, |
| 1124 | enum ich_chipset *const cs, struct ich_descriptors *const desc) |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 1125 | { |
Nico Huber | 519be66 | 2018-12-23 20:03:35 +0100 | [diff] [blame] | 1126 | ssize_t i, max_count; |
| 1127 | size_t pch_bug_offset = 0; |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 1128 | |
| 1129 | if (dump == NULL || desc == NULL) |
| 1130 | return ICH_RET_PARAM; |
| 1131 | |
| 1132 | if (dump[0] != DESCRIPTOR_MODE_SIGNATURE) { |
| 1133 | if (dump[4] == DESCRIPTOR_MODE_SIGNATURE) |
| 1134 | pch_bug_offset = 4; |
| 1135 | else |
| 1136 | return ICH_RET_ERR; |
| 1137 | } |
| 1138 | |
| 1139 | /* map */ |
Nico Huber | 9e14aed | 2017-03-28 17:08:46 +0200 | [diff] [blame] | 1140 | if (len < (4 + pch_bug_offset) * 4) |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 1141 | return ICH_RET_OOB; |
| 1142 | desc->content.FLVALSIG = dump[0 + pch_bug_offset]; |
| 1143 | desc->content.FLMAP0 = dump[1 + pch_bug_offset]; |
| 1144 | desc->content.FLMAP1 = dump[2 + pch_bug_offset]; |
| 1145 | desc->content.FLMAP2 = dump[3 + pch_bug_offset]; |
| 1146 | |
| 1147 | /* component */ |
Nico Huber | 9e14aed | 2017-03-28 17:08:46 +0200 | [diff] [blame] | 1148 | if (len < getFCBA(&desc->content) + 3 * 4) |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 1149 | return ICH_RET_OOB; |
| 1150 | desc->component.FLCOMP = dump[(getFCBA(&desc->content) >> 2) + 0]; |
| 1151 | desc->component.FLILL = dump[(getFCBA(&desc->content) >> 2) + 1]; |
| 1152 | desc->component.FLPB = dump[(getFCBA(&desc->content) >> 2) + 2]; |
| 1153 | |
Nico Huber | 8a03c90 | 2021-06-17 21:23:29 +0200 | [diff] [blame] | 1154 | /* upper map */ |
| 1155 | desc->upper.FLUMAP1 = dump[(UPPER_MAP_OFFSET >> 2) + 0]; |
| 1156 | |
| 1157 | /* VTL is 8 bits long. Quote from the Ibex Peak SPI programming guide: |
| 1158 | * "Identifies the 1s based number of DWORDS contained in the VSCC |
| 1159 | * Table. Each SPI component entry in the table is 2 DWORDS long." So |
| 1160 | * the maximum of 255 gives us 127.5 SPI components(!?) 8 bytes each. A |
| 1161 | * check ensures that the maximum offset actually accessed is available. |
| 1162 | */ |
| 1163 | if (len < getVTBA(&desc->upper) + (desc->upper.VTL / 2 * 8)) |
| 1164 | return ICH_RET_OOB; |
| 1165 | |
| 1166 | for (i = 0; i < desc->upper.VTL/2; i++) { |
| 1167 | desc->upper.vscc_table[i].JID = dump[(getVTBA(&desc->upper) >> 2) + i * 2 + 0]; |
| 1168 | desc->upper.vscc_table[i].VSCC = dump[(getVTBA(&desc->upper) >> 2) + i * 2 + 1]; |
| 1169 | } |
| 1170 | |
Nico Huber | 67d7179 | 2017-06-17 03:10:15 +0200 | [diff] [blame] | 1171 | if (*cs == CHIPSET_ICH_UNKNOWN) { |
Nico Huber | db878fb | 2024-07-19 17:37:09 +0200 | [diff] [blame] | 1172 | *cs = guess_ich_chipset(&desc->content, &desc->upper); |
Nico Huber | 67d7179 | 2017-06-17 03:10:15 +0200 | [diff] [blame] | 1173 | prettyprint_ich_chipset(*cs); |
| 1174 | } |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 1175 | |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 1176 | /* region */ |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 1177 | const ssize_t nr = ich_number_of_regions(*cs, &desc->content); |
Nico Huber | 519be66 | 2018-12-23 20:03:35 +0100 | [diff] [blame] | 1178 | if (nr < 0 || len < getFRBA(&desc->content) + (size_t)nr * 4) |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 1179 | return ICH_RET_OOB; |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 1180 | for (i = 0; i < nr; i++) |
| 1181 | desc->region.FLREGs[i] = dump[(getFRBA(&desc->content) >> 2) + i]; |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 1182 | |
| 1183 | /* master */ |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 1184 | const ssize_t nm = ich_number_of_masters(*cs, &desc->content); |
Nico Huber | 519be66 | 2018-12-23 20:03:35 +0100 | [diff] [blame] | 1185 | if (nm < 0 || len < getFMBA(&desc->content) + (size_t)nm * 4) |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 1186 | return ICH_RET_OOB; |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 1187 | for (i = 0; i < nm; i++) |
| 1188 | desc->master.FLMSTRs[i] = dump[(getFMBA(&desc->content) >> 2) + i]; |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 1189 | |
Nico Huber | 157b818 | 2024-07-19 17:48:12 +0200 | [diff] [blame] | 1190 | if (has_classic_proc_straps(*cs)) { |
| 1191 | /* MCH/PROC (aka. North) straps */ |
| 1192 | if (len < getFMSBA(&desc->content) + desc->content.MSL * 4) |
| 1193 | return ICH_RET_OOB; |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 1194 | |
Nico Huber | 157b818 | 2024-07-19 17:48:12 +0200 | [diff] [blame] | 1195 | /* limit the range to be written */ |
| 1196 | max_count = MIN(sizeof(desc->north.STRPs) / 4, desc->content.MSL); |
| 1197 | for (i = 0; i < max_count; i++) |
| 1198 | desc->north.STRPs[i] = dump[(getFMSBA(&desc->content) >> 2) + i]; |
| 1199 | } |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 1200 | |
| 1201 | /* ICH/PCH (aka. South) straps */ |
| 1202 | if (len < getFISBA(&desc->content) + desc->content.ISL * 4) |
| 1203 | return ICH_RET_OOB; |
| 1204 | |
| 1205 | /* limit the range to be written */ |
Nico Huber | 519be66 | 2018-12-23 20:03:35 +0100 | [diff] [blame] | 1206 | max_count = MIN(sizeof(desc->south.STRPs) / 4, desc->content.ISL); |
Stefan Tauner | a1a14ec | 2012-08-13 08:45:13 +0000 | [diff] [blame] | 1207 | for (i = 0; i < max_count; i++) |
| 1208 | desc->south.STRPs[i] = dump[(getFISBA(&desc->content) >> 2) + i]; |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 1209 | |
| 1210 | return ICH_RET_OK; |
| 1211 | } |
| 1212 | |
Nico Huber | ad18631 | 2016-05-02 15:15:29 +0200 | [diff] [blame] | 1213 | #ifndef ICH_DESCRIPTORS_FROM_DUMP_ONLY |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 1214 | |
Stefan Tauner | d0c5dc2 | 2011-10-20 12:57:14 +0000 | [diff] [blame] | 1215 | /** Returns the integer representation of the component density with index |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 1216 | \em idx in bytes or -1 if the correct size can not be determined. */ |
| 1217 | int getFCBA_component_density(enum ich_chipset cs, const struct ich_descriptors *desc, uint8_t idx) |
Stefan Tauner | d0c5dc2 | 2011-10-20 12:57:14 +0000 | [diff] [blame] | 1218 | { |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 1219 | if (idx > 1) { |
Stefan Tauner | a1a14ec | 2012-08-13 08:45:13 +0000 | [diff] [blame] | 1220 | msg_perr("Only ICH SPI component index 0 or 1 are supported yet.\n"); |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 1221 | return -1; |
Stefan Tauner | d0c5dc2 | 2011-10-20 12:57:14 +0000 | [diff] [blame] | 1222 | } |
Nico Huber | dfd0647 | 2024-07-14 23:45:05 +0200 | [diff] [blame] | 1223 | if (cs == CHIPSET_ICH_UNKNOWN) { |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 1224 | msg_pwarn("Density encoding is unknown on this chipset.\n"); |
| 1225 | return -1; |
Stefan Tauner | d0c5dc2 | 2011-10-20 12:57:14 +0000 | [diff] [blame] | 1226 | } |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 1227 | |
Nico Huber | dfd0647 | 2024-07-14 23:45:05 +0200 | [diff] [blame] | 1228 | if (desc->content.NC == 0 && idx > 0) |
| 1229 | return 0; |
| 1230 | |
| 1231 | const unsigned int max_idx = cs < CHIPSET_HAS_NEW_COMPONENT_DENSITY ? 5 : 7; |
| 1232 | const unsigned int size_idx = get_density_index(cs, desc, idx); |
| 1233 | |
| 1234 | if (size_idx > max_idx) { |
Tai-Hong Wu | 60dead4 | 2015-01-05 23:00:14 +0000 | [diff] [blame] | 1235 | msg_perr("Density of ICH SPI component with index %d is invalid.\n" |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 1236 | "Encoded density is 0x%x while maximum allowed is 0x%x.\n", |
Nico Huber | dfd0647 | 2024-07-14 23:45:05 +0200 | [diff] [blame] | 1237 | idx, size_idx, max_idx); |
Stefan Tauner | 2ba9f6e | 2014-08-20 15:39:19 +0000 | [diff] [blame] | 1238 | return -1; |
| 1239 | } |
| 1240 | |
Nico Huber | dfd0647 | 2024-07-14 23:45:05 +0200 | [diff] [blame] | 1241 | return 1 << (19 + size_idx); |
Stefan Tauner | d0c5dc2 | 2011-10-20 12:57:14 +0000 | [diff] [blame] | 1242 | } |
| 1243 | |
Nico Huber | 8d49499 | 2017-06-19 12:18:33 +0200 | [diff] [blame] | 1244 | /* Only used by ichspi.c */ |
| 1245 | #if CONFIG_INTERNAL == 1 && (defined(__i386__) || defined(__x86_64__)) |
Nico Huber | d54e4f4 | 2017-03-23 23:45:47 +0100 | [diff] [blame] | 1246 | static uint32_t read_descriptor_reg(enum ich_chipset cs, uint8_t section, uint16_t offset, void *spibar) |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 1247 | { |
| 1248 | uint32_t control = 0; |
| 1249 | control |= (section << FDOC_FDSS_OFF) & FDOC_FDSS; |
| 1250 | control |= (offset << FDOC_FDSI_OFF) & FDOC_FDSI; |
Nico Huber | b2ad9fd | 2024-07-14 23:18:53 +0200 | [diff] [blame] | 1251 | |
| 1252 | if (cs >= SPI_ENGINE_PCH100) { |
Nico Huber | d54e4f4 | 2017-03-23 23:45:47 +0100 | [diff] [blame] | 1253 | mmio_le_writel(control, spibar + PCH100_REG_FDOC); |
| 1254 | return mmio_le_readl(spibar + PCH100_REG_FDOD); |
Nico Huber | b2ad9fd | 2024-07-14 23:18:53 +0200 | [diff] [blame] | 1255 | } else { |
Nico Huber | d54e4f4 | 2017-03-23 23:45:47 +0100 | [diff] [blame] | 1256 | mmio_le_writel(control, spibar + ICH9_REG_FDOC); |
| 1257 | return mmio_le_readl(spibar + ICH9_REG_FDOD); |
| 1258 | } |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 1259 | } |
| 1260 | |
Nico Huber | d54e4f4 | 2017-03-23 23:45:47 +0100 | [diff] [blame] | 1261 | int read_ich_descriptors_via_fdo(enum ich_chipset cs, void *spibar, struct ich_descriptors *desc) |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 1262 | { |
Nico Huber | 519be66 | 2018-12-23 20:03:35 +0100 | [diff] [blame] | 1263 | ssize_t i; |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 1264 | struct ich_desc_region *r = &desc->region; |
| 1265 | |
| 1266 | /* Test if bit-fields are working as expected. |
| 1267 | * FIXME: Replace this with dynamic bitfield fixup |
| 1268 | */ |
| 1269 | for (i = 0; i < 4; i++) |
| 1270 | desc->region.FLREGs[i] = 0x5A << (i * 8); |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 1271 | if (r->old_reg[0].base != 0x005A || r->old_reg[0].limit != 0x0000 || |
| 1272 | r->old_reg[1].base != 0x1A00 || r->old_reg[1].limit != 0x0000 || |
| 1273 | r->old_reg[2].base != 0x0000 || r->old_reg[2].limit != 0x005A || |
| 1274 | r->old_reg[3].base != 0x0000 || r->old_reg[3].limit != 0x1A00) { |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 1275 | msg_pdbg("The combination of compiler and CPU architecture used" |
| 1276 | "does not lay out bit-fields as expected, sorry.\n"); |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 1277 | msg_pspew("r->old_reg[0].base = 0x%04X (0x005A)\n", r->old_reg[0].base); |
| 1278 | msg_pspew("r->old_reg[0].limit = 0x%04X (0x0000)\n", r->old_reg[0].limit); |
| 1279 | msg_pspew("r->old_reg[1].base = 0x%04X (0x1A00)\n", r->old_reg[1].base); |
| 1280 | msg_pspew("r->old_reg[1].limit = 0x%04X (0x0000)\n", r->old_reg[1].limit); |
| 1281 | msg_pspew("r->old_reg[2].base = 0x%04X (0x0000)\n", r->old_reg[2].base); |
| 1282 | msg_pspew("r->old_reg[2].limit = 0x%04X (0x005A)\n", r->old_reg[2].limit); |
| 1283 | msg_pspew("r->old_reg[3].base = 0x%04X (0x0000)\n", r->old_reg[3].base); |
| 1284 | msg_pspew("r->old_reg[3].limit = 0x%04X (0x1A00)\n", r->old_reg[3].limit); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 1285 | return ICH_RET_ERR; |
| 1286 | } |
| 1287 | |
Stefan Tauner | a1a14ec | 2012-08-13 08:45:13 +0000 | [diff] [blame] | 1288 | msg_pdbg2("Reading flash descriptors mapped by the chipset via FDOC/FDOD..."); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 1289 | /* content section */ |
Nico Huber | d54e4f4 | 2017-03-23 23:45:47 +0100 | [diff] [blame] | 1290 | desc->content.FLVALSIG = read_descriptor_reg(cs, 0, 0, spibar); |
| 1291 | desc->content.FLMAP0 = read_descriptor_reg(cs, 0, 1, spibar); |
| 1292 | desc->content.FLMAP1 = read_descriptor_reg(cs, 0, 2, spibar); |
| 1293 | desc->content.FLMAP2 = read_descriptor_reg(cs, 0, 3, spibar); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 1294 | |
| 1295 | /* component section */ |
Nico Huber | d54e4f4 | 2017-03-23 23:45:47 +0100 | [diff] [blame] | 1296 | desc->component.FLCOMP = read_descriptor_reg(cs, 1, 0, spibar); |
| 1297 | desc->component.FLILL = read_descriptor_reg(cs, 1, 1, spibar); |
| 1298 | desc->component.FLPB = read_descriptor_reg(cs, 1, 2, spibar); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 1299 | |
| 1300 | /* region section */ |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 1301 | const ssize_t nr = ich_number_of_regions(cs, &desc->content); |
| 1302 | if (nr < 0) { |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 1303 | msg_pdbg2("%s: number of regions too high (%d) - failed\n", |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 1304 | __func__, desc->content.NR + 1); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 1305 | return ICH_RET_ERR; |
| 1306 | } |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 1307 | for (i = 0; i < nr; i++) |
Nico Huber | d54e4f4 | 2017-03-23 23:45:47 +0100 | [diff] [blame] | 1308 | desc->region.FLREGs[i] = read_descriptor_reg(cs, 2, i, spibar); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 1309 | |
| 1310 | /* master section */ |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 1311 | const ssize_t nm = ich_number_of_masters(cs, &desc->content); |
| 1312 | if (nm < 0) { |
| 1313 | msg_pdbg2("%s: number of masters too high (%d) - failed\n", |
| 1314 | __func__, desc->content.NM + 1); |
| 1315 | return ICH_RET_ERR; |
| 1316 | } |
| 1317 | for (i = 0; i < nm; i++) |
| 1318 | desc->master.FLMSTRs[i] = read_descriptor_reg(cs, 3, i, spibar); |
Stefan Tauner | 1e14639 | 2011-09-15 23:52:55 +0000 | [diff] [blame] | 1319 | |
| 1320 | /* Accessing the strap section via FDOC/D is only possible on ICH8 and |
| 1321 | * reading the upper map is impossible on all chipsets, so don't bother. |
| 1322 | */ |
| 1323 | |
| 1324 | msg_pdbg2(" done.\n"); |
| 1325 | return ICH_RET_OK; |
| 1326 | } |
Nico Huber | 8d49499 | 2017-06-19 12:18:33 +0200 | [diff] [blame] | 1327 | #endif |
Nico Huber | 305f417 | 2013-06-14 11:55:26 +0200 | [diff] [blame] | 1328 | |
| 1329 | /** |
| 1330 | * @brief Read a layout from the dump of an Intel ICH descriptor. |
| 1331 | * |
| 1332 | * @param layout Pointer where to store the layout. |
| 1333 | * @param dump The descriptor dump to read from. |
| 1334 | * @param len The length of the descriptor dump. |
| 1335 | * |
| 1336 | * @return 0 on success, |
Nico Huber | 70461a9 | 2019-06-15 14:56:19 +0200 | [diff] [blame] | 1337 | * 1 if the descriptor couldn't be parsed, |
| 1338 | * 2 when out of memory. |
Nico Huber | 305f417 | 2013-06-14 11:55:26 +0200 | [diff] [blame] | 1339 | */ |
Nico Huber | 5bd990c | 2019-06-16 19:46:46 +0200 | [diff] [blame] | 1340 | int layout_from_ich_descriptors( |
Nico Huber | c3b02dc | 2023-08-12 01:13:45 +0200 | [diff] [blame] | 1341 | struct flashprog_layout **const layout, |
Nico Huber | 5bd990c | 2019-06-16 19:46:46 +0200 | [diff] [blame] | 1342 | const void *const dump, const size_t len) |
Nico Huber | 305f417 | 2013-06-14 11:55:26 +0200 | [diff] [blame] | 1343 | { |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 1344 | static const char *const regions[] = { |
David Hendricks | a521636 | 2017-08-08 20:02:22 -0700 | [diff] [blame] | 1345 | "fd", "bios", "me", "gbe", "pd", "reg5", "bios2", "reg7", "ec", "reg9", "ie", |
| 1346 | "10gbe", "reg12", "reg13", "reg14", "reg15" |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 1347 | }; |
Nico Huber | 305f417 | 2013-06-14 11:55:26 +0200 | [diff] [blame] | 1348 | |
| 1349 | struct ich_descriptors desc; |
Nico Huber | fa62294 | 2017-03-24 17:25:37 +0100 | [diff] [blame] | 1350 | enum ich_chipset cs = CHIPSET_ICH_UNKNOWN; |
| 1351 | if (read_ich_descriptors_from_dump(dump, len, &cs, &desc)) |
Nico Huber | 305f417 | 2013-06-14 11:55:26 +0200 | [diff] [blame] | 1352 | return 1; |
| 1353 | |
Nico Huber | c3b02dc | 2023-08-12 01:13:45 +0200 | [diff] [blame] | 1354 | if (flashprog_layout_new(layout)) |
Nico Huber | 5bd990c | 2019-06-16 19:46:46 +0200 | [diff] [blame] | 1355 | return 2; |
Nico Huber | 305f417 | 2013-06-14 11:55:26 +0200 | [diff] [blame] | 1356 | |
Nico Huber | 92e0b62 | 2019-06-15 15:55:11 +0200 | [diff] [blame] | 1357 | ssize_t i; |
Nico Huber | 519be66 | 2018-12-23 20:03:35 +0100 | [diff] [blame] | 1358 | const ssize_t nr = MIN(ich_number_of_regions(cs, &desc.content), (ssize_t)ARRAY_SIZE(regions)); |
Nico Huber | 92e0b62 | 2019-06-15 15:55:11 +0200 | [diff] [blame] | 1359 | for (i = 0; i < nr; ++i) { |
Nico Huber | 305f417 | 2013-06-14 11:55:26 +0200 | [diff] [blame] | 1360 | const chipoff_t base = ICH_FREG_BASE(desc.region.FLREGs[i]); |
Nico Huber | 0bb3f71 | 2017-03-29 16:44:33 +0200 | [diff] [blame] | 1361 | const chipoff_t limit = ICH_FREG_LIMIT(desc.region.FLREGs[i]); |
Nico Huber | 305f417 | 2013-06-14 11:55:26 +0200 | [diff] [blame] | 1362 | if (limit <= base) |
| 1363 | continue; |
Nico Huber | c3b02dc | 2023-08-12 01:13:45 +0200 | [diff] [blame] | 1364 | if (flashprog_layout_add_region(*layout, base, limit, regions[i])) { |
| 1365 | flashprog_layout_release(*layout); |
Nico Huber | 5bd990c | 2019-06-16 19:46:46 +0200 | [diff] [blame] | 1366 | *layout = NULL; |
Nico Huber | 70461a9 | 2019-06-15 14:56:19 +0200 | [diff] [blame] | 1367 | return 2; |
Nico Huber | 5bd990c | 2019-06-16 19:46:46 +0200 | [diff] [blame] | 1368 | } |
Nico Huber | 305f417 | 2013-06-14 11:55:26 +0200 | [diff] [blame] | 1369 | } |
Nico Huber | 305f417 | 2013-06-14 11:55:26 +0200 | [diff] [blame] | 1370 | return 0; |
| 1371 | } |
| 1372 | |
Nico Huber | ad18631 | 2016-05-02 15:15:29 +0200 | [diff] [blame] | 1373 | #endif /* ICH_DESCRIPTORS_FROM_DUMP_ONLY */ |