Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the flashrom project. |
| 3 | * |
| 4 | * Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de> |
| 5 | * Copyright (C) 2009 Carl-Daniel Hailfinger |
Stefan Tauner | 4a03865 | 2013-07-17 09:28:00 +0000 | [diff] [blame] | 6 | * Copyright (C) 2011-2013 Stefan Tauner |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 17 | */ |
| 18 | |
Carl-Daniel Hailfinger | 831e8f4 | 2010-05-30 22:24:40 +0000 | [diff] [blame] | 19 | #include <stdio.h> |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 20 | #include <string.h> |
| 21 | #include <stdlib.h> |
Nico Huber | 519be66 | 2018-12-23 20:03:35 +0100 | [diff] [blame] | 22 | #include <stddef.h> |
Edward O'Callaghan | 3b64d81 | 2022-08-12 13:07:51 +1000 | [diff] [blame] | 23 | #if HAVE_UTSNAME == 1 |
| 24 | #include <sys/utsname.h> |
| 25 | #endif |
| 26 | #if IS_WINDOWS |
| 27 | #include <windows.h> |
| 28 | #undef min |
| 29 | #undef max |
| 30 | #endif |
| 31 | |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 32 | #include "flash.h" |
Carl-Daniel Hailfinger | 5b997c3 | 2010-07-27 22:41:39 +0000 | [diff] [blame] | 33 | #include "programmer.h" |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 34 | |
Edward O'Callaghan | 3b64d81 | 2022-08-12 13:07:51 +1000 | [diff] [blame] | 35 | static void print_sysinfo(void) |
| 36 | { |
| 37 | #if IS_WINDOWS |
| 38 | SYSTEM_INFO si = { 0 }; |
| 39 | OSVERSIONINFOEX osvi = { 0 }; |
| 40 | |
| 41 | msg_ginfo(" on Windows"); |
| 42 | /* Tell Windows which version of the structure we want. */ |
| 43 | osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); |
| 44 | if (GetVersionEx((OSVERSIONINFO*) &osvi)) |
Thomas Heijligen | 78ed668 | 2022-08-08 21:55:07 +0200 | [diff] [blame] | 45 | msg_ginfo(" %lu.%lu", (unsigned long)osvi.dwMajorVersion, |
| 46 | (unsigned long)osvi.dwMinorVersion); |
Edward O'Callaghan | 3b64d81 | 2022-08-12 13:07:51 +1000 | [diff] [blame] | 47 | else |
| 48 | msg_ginfo(" unknown version"); |
| 49 | GetSystemInfo(&si); |
| 50 | switch (si.wProcessorArchitecture) { |
| 51 | case PROCESSOR_ARCHITECTURE_AMD64: |
| 52 | msg_ginfo(" (x86_64)"); |
| 53 | break; |
| 54 | case PROCESSOR_ARCHITECTURE_INTEL: |
| 55 | msg_ginfo(" (x86)"); |
| 56 | break; |
| 57 | default: |
| 58 | msg_ginfo(" (unknown arch)"); |
| 59 | break; |
| 60 | } |
| 61 | #elif HAVE_UTSNAME == 1 |
| 62 | struct utsname osinfo; |
| 63 | |
| 64 | uname(&osinfo); |
| 65 | msg_ginfo(" on %s %s (%s)", osinfo.sysname, osinfo.release, |
| 66 | osinfo.machine); |
| 67 | #else |
| 68 | msg_ginfo(" on unknown machine"); |
| 69 | #endif |
| 70 | } |
| 71 | |
| 72 | void print_buildinfo(void) |
| 73 | { |
| 74 | msg_gdbg("flashrom was built with"); |
| 75 | #ifdef __clang__ |
| 76 | msg_gdbg(" LLVM Clang"); |
| 77 | #ifdef __clang_version__ |
| 78 | msg_gdbg(" %s,", __clang_version__); |
| 79 | #else |
| 80 | msg_gdbg(" unknown version (before r102686),"); |
| 81 | #endif |
| 82 | #elif defined(__GNUC__) |
| 83 | msg_gdbg(" GCC"); |
| 84 | #ifdef __VERSION__ |
| 85 | msg_gdbg(" %s,", __VERSION__); |
| 86 | #else |
| 87 | msg_gdbg(" unknown version,"); |
| 88 | #endif |
| 89 | #else |
| 90 | msg_gdbg(" unknown compiler,"); |
| 91 | #endif |
| 92 | #if defined (__FLASHROM_LITTLE_ENDIAN__) |
| 93 | msg_gdbg(" little endian"); |
| 94 | #elif defined (__FLASHROM_BIG_ENDIAN__) |
| 95 | msg_gdbg(" big endian"); |
| 96 | #else |
| 97 | #error Endianness could not be determined |
| 98 | #endif |
| 99 | msg_gdbg("\n"); |
| 100 | } |
| 101 | |
| 102 | void print_version(void) |
| 103 | { |
| 104 | msg_ginfo("flashrom-stable %s", flashrom_version); |
| 105 | print_sysinfo(); |
| 106 | msg_ginfo("\n"); |
| 107 | } |
| 108 | |
| 109 | void print_banner(void) |
| 110 | { |
| 111 | msg_ginfo("flashrom is free software, get the source code at " |
| 112 | "https://flashrom.org\n"); |
| 113 | msg_ginfo("\n"); |
| 114 | } |
| 115 | |
Stefan Tauner | 1181ee2 | 2014-06-01 02:13:23 +0000 | [diff] [blame] | 116 | static const char *test_state_to_text(enum test_state test_state) |
| 117 | { |
| 118 | switch (test_state) { |
| 119 | case OK: return "OK"; |
| 120 | case BAD: return "Not working"; |
| 121 | case NA: return "N/A"; |
| 122 | case DEP: return "Config-dependent"; |
| 123 | case NT: |
| 124 | default: return "Untested"; |
| 125 | } |
| 126 | } |
| 127 | |
Niklas Söderlund | ede2fa4 | 2012-10-23 13:06:46 +0000 | [diff] [blame] | 128 | static int print_supported_chips(void) |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 129 | { |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 130 | const char *delim = "/"; |
| 131 | const int mintoklen = 5; |
| 132 | const int border = 2; |
| 133 | int i, chipcount = 0; |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 134 | int maxvendorlen = strlen("Vendor") + 1; |
| 135 | int maxchiplen = strlen("Device") + 1; |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 136 | int maxtypelen = strlen("Type") + 1; |
Carl-Daniel Hailfinger | 5a7cb84 | 2012-08-25 01:17:58 +0000 | [diff] [blame] | 137 | const struct flashchip *chip; |
Stefan Tauner | 0015549 | 2011-06-26 20:45:35 +0000 | [diff] [blame] | 138 | char *s; |
Stefan Tauner | 4a03865 | 2013-07-17 09:28:00 +0000 | [diff] [blame] | 139 | char *ven, *dev; |
| 140 | char *tmpven, *tmpdev, *tmpven_save, *tmpdev_save; |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 141 | int tmpvenlen, tmpdevlen, curvenlen, curdevlen; |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 142 | |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 143 | /* calculate maximum column widths and by iterating over all chips */ |
Carl-Daniel Hailfinger | 5a7cb84 | 2012-08-25 01:17:58 +0000 | [diff] [blame] | 144 | for (chip = flashchips; chip->name != NULL; chip++) { |
Stefan Tauner | 035492a | 2012-02-03 22:32:09 +0000 | [diff] [blame] | 145 | /* Ignore generic entries. */ |
Carl-Daniel Hailfinger | 5a7cb84 | 2012-08-25 01:17:58 +0000 | [diff] [blame] | 146 | if (!strncmp(chip->vendor, "Unknown", 7) || |
| 147 | !strncmp(chip->vendor, "Programmer", 10) || |
| 148 | !strncmp(chip->name, "unknown", 7)) |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 149 | continue; |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 150 | chipcount++; |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 151 | |
| 152 | /* Find maximum vendor length (respecting line splitting). */ |
Carl-Daniel Hailfinger | 5a7cb84 | 2012-08-25 01:17:58 +0000 | [diff] [blame] | 153 | tmpven = (char *)chip->vendor; |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 154 | do { |
| 155 | /* and take minimum token lengths into account */ |
| 156 | tmpvenlen = 0; |
| 157 | do { |
| 158 | tmpvenlen += strcspn(tmpven, delim); |
| 159 | /* skip to the address after the first token */ |
| 160 | tmpven += tmpvenlen; |
| 161 | if (tmpven[0] == '\0') |
| 162 | break; |
| 163 | tmpven++; |
| 164 | } while (tmpvenlen < mintoklen); |
| 165 | maxvendorlen = max(maxvendorlen, tmpvenlen); |
| 166 | if (tmpven[0] == '\0') |
| 167 | break; |
| 168 | } while (1); |
| 169 | |
| 170 | /* same for device name */ |
Carl-Daniel Hailfinger | 5a7cb84 | 2012-08-25 01:17:58 +0000 | [diff] [blame] | 171 | tmpdev = (char *)chip->name; |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 172 | do { |
| 173 | tmpdevlen = 0; |
| 174 | do { |
| 175 | tmpdevlen += strcspn(tmpdev, delim); |
| 176 | tmpdev += tmpdevlen; |
| 177 | if (tmpdev[0] == '\0') |
| 178 | break; |
| 179 | tmpdev++; |
| 180 | } while (tmpdevlen < mintoklen); |
| 181 | maxchiplen = max(maxchiplen, tmpdevlen); |
| 182 | if (tmpdev[0] == '\0') |
| 183 | break; |
| 184 | } while (1); |
| 185 | |
Carl-Daniel Hailfinger | 5a7cb84 | 2012-08-25 01:17:58 +0000 | [diff] [blame] | 186 | s = flashbuses_to_text(chip->bustype); |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 187 | maxtypelen = max(maxtypelen, strlen(s)); |
| 188 | free(s); |
Carl-Daniel Hailfinger | f753342 | 2010-07-17 23:21:12 +0000 | [diff] [blame] | 189 | } |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 190 | maxvendorlen += border; |
| 191 | maxchiplen += border; |
| 192 | maxtypelen += border; |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 193 | |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 194 | msg_ginfo("Supported flash chips (total: %d):\n\n", chipcount); |
| 195 | msg_ginfo("Vendor"); |
Carl-Daniel Hailfinger | f753342 | 2010-07-17 23:21:12 +0000 | [diff] [blame] | 196 | for (i = strlen("Vendor"); i < maxvendorlen; i++) |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 197 | msg_ginfo(" "); |
| 198 | msg_ginfo("Device"); |
Carl-Daniel Hailfinger | f753342 | 2010-07-17 23:21:12 +0000 | [diff] [blame] | 199 | for (i = strlen("Device"); i < maxchiplen; i++) |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 200 | msg_ginfo(" "); |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 201 | |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 202 | msg_ginfo("Test"); |
| 203 | for (i = 0; i < border; i++) |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 204 | msg_ginfo(" "); |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 205 | msg_ginfo("Known"); |
| 206 | for (i = 0; i < border; i++) |
| 207 | msg_ginfo(" "); |
Stefan Tauner | 0554ca5 | 2013-07-25 22:54:25 +0000 | [diff] [blame] | 208 | msg_ginfo(" Size "); |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 209 | for (i = 0; i < border; i++) |
| 210 | msg_ginfo(" "); |
| 211 | |
| 212 | msg_ginfo("Type"); |
| 213 | for (i = strlen("Type"); i < maxtypelen; i++) |
| 214 | msg_ginfo(" "); |
| 215 | msg_gdbg("Voltage"); |
| 216 | msg_ginfo("\n"); |
| 217 | |
| 218 | for (i = 0; i < maxvendorlen + maxchiplen; i++) |
| 219 | msg_ginfo(" "); |
| 220 | msg_ginfo("OK "); |
| 221 | for (i = 0; i < border; i++) |
| 222 | msg_ginfo(" "); |
| 223 | msg_ginfo("Broken"); |
| 224 | for (i = 0; i < border; i++) |
| 225 | msg_ginfo(" "); |
Stefan Tauner | 0554ca5 | 2013-07-25 22:54:25 +0000 | [diff] [blame] | 226 | msg_ginfo("[kB] "); |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 227 | for (i = 0; i < border + maxtypelen; i++) |
| 228 | msg_ginfo(" "); |
| 229 | msg_gdbg("range [V]"); |
| 230 | msg_ginfo("\n\n"); |
Stefan Tauner | 5c316f9 | 2015-02-08 21:57:52 +0000 | [diff] [blame] | 231 | msg_ginfo("(P = PROBE, R = READ, E = ERASE, W = WRITE, - = N/A)\n\n"); |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 232 | |
Carl-Daniel Hailfinger | 5a7cb84 | 2012-08-25 01:17:58 +0000 | [diff] [blame] | 233 | for (chip = flashchips; chip->name != NULL; chip++) { |
Stefan Tauner | 035492a | 2012-02-03 22:32:09 +0000 | [diff] [blame] | 234 | /* Don't print generic entries. */ |
Carl-Daniel Hailfinger | 5a7cb84 | 2012-08-25 01:17:58 +0000 | [diff] [blame] | 235 | if (!strncmp(chip->vendor, "Unknown", 7) || |
| 236 | !strncmp(chip->vendor, "Programmer", 10) || |
| 237 | !strncmp(chip->name, "unknown", 7)) |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 238 | continue; |
| 239 | |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 240 | /* support for multiline vendor names: |
| 241 | * - make a copy of the original vendor name |
| 242 | * - use strok to put the first token in tmpven |
| 243 | * - keep track of the length of all tokens on the current line |
| 244 | * for ' '-padding in curvenlen |
| 245 | * - check if additional tokens should be printed on the current |
| 246 | * line |
| 247 | * - after all other values are printed print the surplus tokens |
| 248 | * on fresh lines |
| 249 | */ |
Stefan Tauner | 4a03865 | 2013-07-17 09:28:00 +0000 | [diff] [blame] | 250 | ven = malloc(strlen(chip->vendor) + 1); |
| 251 | if (ven == NULL) { |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 252 | msg_gerr("Out of memory!\n"); |
Niklas Söderlund | ede2fa4 | 2012-10-23 13:06:46 +0000 | [diff] [blame] | 253 | return 1; |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 254 | } |
Stefan Tauner | 4a03865 | 2013-07-17 09:28:00 +0000 | [diff] [blame] | 255 | strcpy(ven, chip->vendor); |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 256 | |
Stefan Tauner | 4a03865 | 2013-07-17 09:28:00 +0000 | [diff] [blame] | 257 | tmpven = strtok_r(ven, delim, &tmpven_save); |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 258 | msg_ginfo("%s", tmpven); |
| 259 | curvenlen = strlen(tmpven); |
Stefan Tauner | 4a03865 | 2013-07-17 09:28:00 +0000 | [diff] [blame] | 260 | while ((tmpven = strtok_r(NULL, delim, &tmpven_save)) != NULL) { |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 261 | msg_ginfo("%s", delim); |
| 262 | curvenlen++; |
| 263 | tmpvenlen = strlen(tmpven); |
| 264 | if (tmpvenlen >= mintoklen) |
| 265 | break; /* big enough to be on its own line */ |
| 266 | msg_ginfo("%s", tmpven); |
| 267 | curvenlen += tmpvenlen; |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 268 | } |
| 269 | |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 270 | for (i = curvenlen; i < maxvendorlen; i++) |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 271 | msg_ginfo(" "); |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 272 | |
| 273 | /* support for multiline device names as above */ |
Stefan Tauner | 4a03865 | 2013-07-17 09:28:00 +0000 | [diff] [blame] | 274 | dev = malloc(strlen(chip->name) + 1); |
| 275 | if (dev == NULL) { |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 276 | msg_gerr("Out of memory!\n"); |
Jacob Garber | 4a7970b | 2019-08-12 14:31:46 -0600 | [diff] [blame] | 277 | free(ven); |
Niklas Söderlund | ede2fa4 | 2012-10-23 13:06:46 +0000 | [diff] [blame] | 278 | return 1; |
Carl-Daniel Hailfinger | f753342 | 2010-07-17 23:21:12 +0000 | [diff] [blame] | 279 | } |
Stefan Tauner | 4a03865 | 2013-07-17 09:28:00 +0000 | [diff] [blame] | 280 | strcpy(dev, chip->name); |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 281 | |
Stefan Tauner | 4a03865 | 2013-07-17 09:28:00 +0000 | [diff] [blame] | 282 | tmpdev = strtok_r(dev, delim, &tmpdev_save); |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 283 | msg_ginfo("%s", tmpdev); |
| 284 | curdevlen = strlen(tmpdev); |
Stefan Tauner | 4a03865 | 2013-07-17 09:28:00 +0000 | [diff] [blame] | 285 | while ((tmpdev = strtok_r(NULL, delim, &tmpdev_save)) != NULL) { |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 286 | msg_ginfo("%s", delim); |
| 287 | curdevlen++; |
| 288 | tmpdevlen = strlen(tmpdev); |
| 289 | if (tmpdevlen >= mintoklen) |
| 290 | break; /* big enough to be on its own line */ |
| 291 | msg_ginfo("%s", tmpdev); |
| 292 | curdevlen += tmpdevlen; |
| 293 | } |
| 294 | |
| 295 | for (i = curdevlen; i < maxchiplen; i++) |
| 296 | msg_ginfo(" "); |
| 297 | |
Stefan Tauner | 6455dff | 2014-05-26 00:36:24 +0000 | [diff] [blame] | 298 | if (chip->tested.probe == OK) |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 299 | msg_ginfo("P"); |
Stefan Tauner | 6455dff | 2014-05-26 00:36:24 +0000 | [diff] [blame] | 300 | else if (chip->tested.probe == NA) |
| 301 | msg_ginfo("-"); |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 302 | else |
| 303 | msg_ginfo(" "); |
Stefan Tauner | 6455dff | 2014-05-26 00:36:24 +0000 | [diff] [blame] | 304 | if (chip->tested.read == OK) |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 305 | msg_ginfo("R"); |
Stefan Tauner | 6455dff | 2014-05-26 00:36:24 +0000 | [diff] [blame] | 306 | else if (chip->tested.read == NA) |
| 307 | msg_ginfo("-"); |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 308 | else |
| 309 | msg_ginfo(" "); |
Stefan Tauner | 6455dff | 2014-05-26 00:36:24 +0000 | [diff] [blame] | 310 | if (chip->tested.erase == OK) |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 311 | msg_ginfo("E"); |
Stefan Tauner | 6455dff | 2014-05-26 00:36:24 +0000 | [diff] [blame] | 312 | else if (chip->tested.erase == NA) |
| 313 | msg_ginfo("-"); |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 314 | else |
| 315 | msg_ginfo(" "); |
Stefan Tauner | 6455dff | 2014-05-26 00:36:24 +0000 | [diff] [blame] | 316 | if (chip->tested.write == OK) |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 317 | msg_ginfo("W"); |
Stefan Tauner | 6455dff | 2014-05-26 00:36:24 +0000 | [diff] [blame] | 318 | else if (chip->tested.write == NA) |
| 319 | msg_ginfo("-"); |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 320 | else |
| 321 | msg_ginfo(" "); |
| 322 | for (i = 0; i < border; i++) |
| 323 | msg_ginfo(" "); |
| 324 | |
Stefan Tauner | 6455dff | 2014-05-26 00:36:24 +0000 | [diff] [blame] | 325 | if (chip->tested.probe == BAD) |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 326 | msg_ginfo("P"); |
| 327 | else |
| 328 | msg_ginfo(" "); |
Stefan Tauner | 6455dff | 2014-05-26 00:36:24 +0000 | [diff] [blame] | 329 | if (chip->tested.read == BAD) |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 330 | msg_ginfo("R"); |
| 331 | else |
| 332 | msg_ginfo(" "); |
Stefan Tauner | 6455dff | 2014-05-26 00:36:24 +0000 | [diff] [blame] | 333 | if (chip->tested.erase == BAD) |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 334 | msg_ginfo("E"); |
| 335 | else |
| 336 | msg_ginfo(" "); |
Stefan Tauner | 6455dff | 2014-05-26 00:36:24 +0000 | [diff] [blame] | 337 | if (chip->tested.write == BAD) |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 338 | msg_ginfo("W"); |
| 339 | else |
| 340 | msg_ginfo(" "); |
| 341 | for (i = 0; i < border + 1; i++) |
| 342 | msg_ginfo(" "); |
| 343 | |
Stefan Tauner | 0554ca5 | 2013-07-25 22:54:25 +0000 | [diff] [blame] | 344 | msg_ginfo("%6d", chip->total_size); |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 345 | for (i = 0; i < border; i++) |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 346 | msg_ginfo(" "); |
Stefan Tauner | 0015549 | 2011-06-26 20:45:35 +0000 | [diff] [blame] | 347 | |
Carl-Daniel Hailfinger | 5a7cb84 | 2012-08-25 01:17:58 +0000 | [diff] [blame] | 348 | s = flashbuses_to_text(chip->bustype); |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 349 | msg_ginfo("%s", s); |
| 350 | for (i = strlen(s); i < maxtypelen; i++) |
| 351 | msg_ginfo(" "); |
Stefan Tauner | 0015549 | 2011-06-26 20:45:35 +0000 | [diff] [blame] | 352 | free(s); |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 353 | |
Carl-Daniel Hailfinger | 5a7cb84 | 2012-08-25 01:17:58 +0000 | [diff] [blame] | 354 | if (chip->voltage.min == 0 && chip->voltage.max == 0) |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 355 | msg_gdbg("no info"); |
| 356 | else |
| 357 | msg_gdbg("%0.02f;%0.02f", |
Carl-Daniel Hailfinger | 5a7cb84 | 2012-08-25 01:17:58 +0000 | [diff] [blame] | 358 | chip->voltage.min/(double)1000, |
| 359 | chip->voltage.max/(double)1000); |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 360 | |
| 361 | /* print surplus vendor and device name tokens */ |
| 362 | while (tmpven != NULL || tmpdev != NULL) { |
| 363 | msg_ginfo("\n"); |
| 364 | if (tmpven != NULL){ |
| 365 | msg_ginfo("%s", tmpven); |
| 366 | curvenlen = strlen(tmpven); |
Stefan Tauner | 4a03865 | 2013-07-17 09:28:00 +0000 | [diff] [blame] | 367 | while ((tmpven = strtok_r(NULL, delim, &tmpven_save)) != NULL) { |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 368 | msg_ginfo("%s", delim); |
| 369 | curvenlen++; |
| 370 | tmpvenlen = strlen(tmpven); |
| 371 | /* big enough to be on its own line */ |
| 372 | if (tmpvenlen >= mintoklen) |
| 373 | break; |
| 374 | msg_ginfo("%s", tmpven); |
| 375 | curvenlen += tmpvenlen; |
| 376 | } |
| 377 | } else |
| 378 | curvenlen = 0; |
| 379 | |
| 380 | for (i = curvenlen; i < maxvendorlen; i++) |
| 381 | msg_ginfo(" "); |
| 382 | |
| 383 | if (tmpdev != NULL){ |
| 384 | msg_ginfo("%s", tmpdev); |
| 385 | curdevlen = strlen(tmpdev); |
Stefan Tauner | 4a03865 | 2013-07-17 09:28:00 +0000 | [diff] [blame] | 386 | while ((tmpdev = strtok_r(NULL, delim, &tmpdev_save)) != NULL) { |
Stefan Tauner | 29e5d31 | 2011-09-12 22:55:01 +0000 | [diff] [blame] | 387 | msg_ginfo("%s", delim); |
| 388 | curdevlen++; |
| 389 | tmpdevlen = strlen(tmpdev); |
| 390 | /* big enough to be on its own line */ |
| 391 | if (tmpdevlen >= mintoklen) |
| 392 | break; |
| 393 | msg_ginfo("%s", tmpdev); |
| 394 | curdevlen += tmpdevlen; |
| 395 | } |
| 396 | } |
| 397 | } |
| 398 | msg_ginfo("\n"); |
Stefan Tauner | 4a03865 | 2013-07-17 09:28:00 +0000 | [diff] [blame] | 399 | free(ven); |
| 400 | free(dev); |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 401 | } |
Niklas Söderlund | ede2fa4 | 2012-10-23 13:06:46 +0000 | [diff] [blame] | 402 | |
| 403 | return 0; |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 404 | } |
| 405 | |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 406 | #if CONFIG_INTERNAL == 1 |
Carl-Daniel Hailfinger | ad3cc55 | 2010-07-03 11:02:10 +0000 | [diff] [blame] | 407 | static void print_supported_chipsets(void) |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 408 | { |
Nico Huber | 519be66 | 2018-12-23 20:03:35 +0100 | [diff] [blame] | 409 | unsigned int i, chipsetcount = 0; |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 410 | const struct penable *c = chipset_enables; |
Nico Huber | 519be66 | 2018-12-23 20:03:35 +0100 | [diff] [blame] | 411 | size_t maxvendorlen = strlen("Vendor") + 1; |
| 412 | size_t maxchipsetlen = strlen("Chipset") + 1; |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 413 | |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 414 | for (c = chipset_enables; c->vendor_name != NULL; c++) { |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 415 | chipsetcount++; |
Nico Huber | 519be66 | 2018-12-23 20:03:35 +0100 | [diff] [blame] | 416 | maxvendorlen = MAX(maxvendorlen, strlen(c->vendor_name)); |
| 417 | maxchipsetlen = MAX(maxchipsetlen, strlen(c->device_name)); |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 418 | } |
| 419 | maxvendorlen++; |
| 420 | maxchipsetlen++; |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 421 | |
Nico Huber | 519be66 | 2018-12-23 20:03:35 +0100 | [diff] [blame] | 422 | msg_ginfo("Supported chipsets (total: %u):\n\n", chipsetcount); |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 423 | |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 424 | msg_ginfo("Vendor"); |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 425 | for (i = strlen("Vendor"); i < maxvendorlen; i++) |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 426 | msg_ginfo(" "); |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 427 | |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 428 | msg_ginfo("Chipset"); |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 429 | for (i = strlen("Chipset"); i < maxchipsetlen; i++) |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 430 | msg_ginfo(" "); |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 431 | |
Stefan Tauner | 428ba2b | 2014-06-02 00:34:58 +0000 | [diff] [blame] | 432 | msg_ginfo("PCI IDs Status\n\n"); |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 433 | |
| 434 | for (c = chipset_enables; c->vendor_name != NULL; c++) { |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 435 | msg_ginfo("%s", c->vendor_name); |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 436 | for (i = 0; i < maxvendorlen - strlen(c->vendor_name); i++) |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 437 | msg_ginfo(" "); |
| 438 | msg_ginfo("%s", c->device_name); |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 439 | for (i = 0; i < maxchipsetlen - strlen(c->device_name); i++) |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 440 | msg_ginfo(" "); |
Stefan Tauner | 428ba2b | 2014-06-02 00:34:58 +0000 | [diff] [blame] | 441 | msg_ginfo("%04x:%04x %s\n", c->vendor_id, c->device_id, |
| 442 | test_state_to_text(c->status)); |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 443 | } |
| 444 | } |
| 445 | |
Carl-Daniel Hailfinger | ad3cc55 | 2010-07-03 11:02:10 +0000 | [diff] [blame] | 446 | static void print_supported_boards_helper(const struct board_info *boards, |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 447 | const char *devicetype) |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 448 | { |
Nico Huber | 519be66 | 2018-12-23 20:03:35 +0100 | [diff] [blame] | 449 | unsigned int i; |
Stefan Tauner | 2c20b28 | 2012-07-28 19:35:26 +0000 | [diff] [blame] | 450 | unsigned int boardcount_good = 0, boardcount_bad = 0, boardcount_nt = 0; |
Carl-Daniel Hailfinger | 97d5b12 | 2011-08-31 16:19:50 +0000 | [diff] [blame] | 451 | const struct board_match *e = board_matches; |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 452 | const struct board_info *b = boards; |
Nico Huber | 519be66 | 2018-12-23 20:03:35 +0100 | [diff] [blame] | 453 | size_t maxvendorlen = strlen("Vendor") + 1; |
| 454 | size_t maxboardlen = strlen("Board") + 1; |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 455 | |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 456 | for (b = boards; b->vendor != NULL; b++) { |
| 457 | maxvendorlen = max(maxvendorlen, strlen(b->vendor)); |
| 458 | maxboardlen = max(maxboardlen, strlen(b->name)); |
Stefan Tauner | 2c20b28 | 2012-07-28 19:35:26 +0000 | [diff] [blame] | 459 | if (b->working == OK) |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 460 | boardcount_good++; |
Stefan Tauner | 2c20b28 | 2012-07-28 19:35:26 +0000 | [diff] [blame] | 461 | else if (b->working == NT) |
| 462 | boardcount_nt++; |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 463 | else |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 464 | boardcount_bad++; |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 465 | } |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 466 | maxvendorlen++; |
| 467 | maxboardlen++; |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 468 | |
Stefan Tauner | 2c20b28 | 2012-07-28 19:35:26 +0000 | [diff] [blame] | 469 | msg_ginfo("%d known %s (good: %d, untested: %d, bad: %d):\n\n", |
| 470 | boardcount_good + boardcount_nt + boardcount_bad, |
| 471 | devicetype, boardcount_good, boardcount_nt, boardcount_bad); |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 472 | |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 473 | msg_ginfo("Vendor"); |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 474 | for (i = strlen("Vendor"); i < maxvendorlen; i++) |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 475 | msg_ginfo(" "); |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 476 | |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 477 | msg_ginfo("Board"); |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 478 | for (i = strlen("Board"); i < maxboardlen; i++) |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 479 | msg_ginfo(" "); |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 480 | |
Carl-Daniel Hailfinger | 2d927fb | 2012-01-04 00:48:27 +0000 | [diff] [blame] | 481 | msg_ginfo("Status Required value for\n"); |
| 482 | for (i = 0; i < maxvendorlen + maxboardlen + strlen("Status "); i++) |
| 483 | msg_ginfo(" "); |
| 484 | msg_ginfo("-p internal:mainboard=\n"); |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 485 | |
| 486 | for (b = boards; b->vendor != NULL; b++) { |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 487 | msg_ginfo("%s", b->vendor); |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 488 | for (i = 0; i < maxvendorlen - strlen(b->vendor); i++) |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 489 | msg_ginfo(" "); |
| 490 | msg_ginfo("%s", b->name); |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 491 | for (i = 0; i < maxboardlen - strlen(b->name); i++) |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 492 | msg_ginfo(" "); |
Stefan Reinauer | f94d9ce | 2014-04-26 16:11:07 +0000 | [diff] [blame] | 493 | |
Nico Huber | 5d068dd | 2019-11-17 13:39:46 +0100 | [diff] [blame] | 494 | switch (b->working) { |
| 495 | case OK: msg_ginfo("OK "); break; |
| 496 | case NT: msg_ginfo("NT "); break; |
| 497 | case DEP: msg_ginfo("DEP "); break; |
| 498 | case NA: msg_ginfo("N/A "); break; |
| 499 | case BAD: |
| 500 | default: msg_ginfo("BAD "); break; |
| 501 | } |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 502 | |
Carl-Daniel Hailfinger | 97d5b12 | 2011-08-31 16:19:50 +0000 | [diff] [blame] | 503 | for (e = board_matches; e->vendor_name != NULL; e++) { |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 504 | if (strcmp(e->vendor_name, b->vendor) |
| 505 | || strcmp(e->board_name, b->name)) |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 506 | continue; |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 507 | if (e->lb_vendor == NULL) |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 508 | msg_ginfo("(autodetected)"); |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 509 | else |
Carl-Daniel Hailfinger | 2d927fb | 2012-01-04 00:48:27 +0000 | [diff] [blame] | 510 | msg_ginfo("%s:%s", e->lb_vendor, |
Stefan Tauner | 7bcacb1 | 2011-05-26 01:35:19 +0000 | [diff] [blame] | 511 | e->lb_part); |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 512 | } |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 513 | msg_ginfo("\n"); |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 514 | } |
Uwe Hermann | ba290d1 | 2009-06-17 12:07:12 +0000 | [diff] [blame] | 515 | } |
Carl-Daniel Hailfinger | 66ef4e5 | 2009-12-13 22:28:00 +0000 | [diff] [blame] | 516 | #endif |
Uwe Hermann | d0e347d | 2009-10-06 13:00:00 +0000 | [diff] [blame] | 517 | |
Thomas Heijligen | 633d6db | 2021-03-31 19:09:44 +0200 | [diff] [blame] | 518 | static void print_supported_devs(const struct programmer_entry *const prog, const char *const type) |
Stefan Tauner | af358d6 | 2012-12-27 18:40:26 +0000 | [diff] [blame] | 519 | { |
Thomas Heijligen | 633d6db | 2021-03-31 19:09:44 +0200 | [diff] [blame] | 520 | const struct dev_entry *const devs = prog->devs.dev; |
| 521 | msg_ginfo("\nSupported %s devices for the %s programmer:\n", type, prog->name); |
Stefan Tauner | 1181ee2 | 2014-06-01 02:13:23 +0000 | [diff] [blame] | 522 | unsigned int maxvendorlen = strlen("Vendor") + 1; |
| 523 | unsigned int maxdevlen = strlen("Device") + 1; |
| 524 | |
| 525 | unsigned int i; |
Stefan Tauner | af358d6 | 2012-12-27 18:40:26 +0000 | [diff] [blame] | 526 | for (i = 0; devs[i].vendor_name != NULL; i++) { |
Stefan Tauner | 1181ee2 | 2014-06-01 02:13:23 +0000 | [diff] [blame] | 527 | maxvendorlen = max(maxvendorlen, strlen(devs[i].vendor_name)); |
| 528 | maxdevlen = max(maxdevlen, strlen(devs[i].device_name)); |
| 529 | } |
| 530 | maxvendorlen++; |
| 531 | maxdevlen++; |
| 532 | |
| 533 | msg_ginfo("Vendor"); |
| 534 | for (i = strlen("Vendor"); i < maxvendorlen; i++) |
| 535 | msg_ginfo(" "); |
| 536 | |
| 537 | msg_ginfo("Device"); |
| 538 | for (i = strlen("Device"); i < maxdevlen; i++) |
| 539 | msg_ginfo(" "); |
| 540 | |
| 541 | msg_ginfo(" %s IDs Status\n", type); |
| 542 | |
| 543 | for (i = 0; devs[i].vendor_name != NULL; i++) { |
| 544 | msg_ginfo("%s", devs[i].vendor_name); |
| 545 | unsigned int j; |
| 546 | for (j = strlen(devs[i].vendor_name); j < maxvendorlen; j++) |
| 547 | msg_ginfo(" "); |
| 548 | msg_ginfo("%s", devs[i].device_name); |
| 549 | for (j = strlen(devs[i].device_name); j < maxdevlen; j++) |
| 550 | msg_ginfo(" "); |
| 551 | |
| 552 | msg_pinfo(" %04x:%04x %s\n", devs[i].vendor_id, devs[i].device_id, |
| 553 | test_state_to_text(devs[i].status)); |
Stefan Tauner | af358d6 | 2012-12-27 18:40:26 +0000 | [diff] [blame] | 554 | } |
| 555 | } |
| 556 | |
Niklas Söderlund | ede2fa4 | 2012-10-23 13:06:46 +0000 | [diff] [blame] | 557 | int print_supported(void) |
Carl-Daniel Hailfinger | f529205 | 2009-11-17 09:57:34 +0000 | [diff] [blame] | 558 | { |
Stefan Tauner | af358d6 | 2012-12-27 18:40:26 +0000 | [diff] [blame] | 559 | unsigned int i; |
Niklas Söderlund | ede2fa4 | 2012-10-23 13:06:46 +0000 | [diff] [blame] | 560 | if (print_supported_chips()) |
| 561 | return 1; |
Carl-Daniel Hailfinger | a73fb49 | 2010-10-06 23:48:34 +0000 | [diff] [blame] | 562 | |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 563 | msg_ginfo("\nSupported programmers:\n"); |
Carl-Daniel Hailfinger | a73fb49 | 2010-10-06 23:48:34 +0000 | [diff] [blame] | 564 | list_programmers_linebreak(0, 80, 0); |
Stefan Tauner | b226cb1 | 2012-11-24 18:59:39 +0000 | [diff] [blame] | 565 | msg_ginfo("\n"); |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 566 | #if CONFIG_INTERNAL == 1 |
Thomas Heijligen | 79088ab | 2021-06-01 13:57:42 +0200 | [diff] [blame] | 567 | msg_ginfo("\nSupported devices for the internal programmer:\n\n"); |
Carl-Daniel Hailfinger | a73fb49 | 2010-10-06 23:48:34 +0000 | [diff] [blame] | 568 | print_supported_chipsets(); |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 569 | msg_ginfo("\n"); |
Stefan Tauner | 74dc73f | 2015-03-01 22:04:38 +0000 | [diff] [blame] | 570 | print_supported_boards_helper(boards_known, "mainboards"); |
Stefan Tauner | 1258936 | 2011-06-25 17:36:25 +0000 | [diff] [blame] | 571 | msg_ginfo("\n"); |
Stefan Tauner | 74dc73f | 2015-03-01 22:04:38 +0000 | [diff] [blame] | 572 | print_supported_boards_helper(laptops_known, "mobile devices"); |
Carl-Daniel Hailfinger | 66ef4e5 | 2009-12-13 22:28:00 +0000 | [diff] [blame] | 573 | #endif |
Thomas Heijligen | d45cb59 | 2021-05-19 14:12:18 +0200 | [diff] [blame] | 574 | for (i = 0; i < programmer_table_size; i++) { |
Thomas Heijligen | 633d6db | 2021-03-31 19:09:44 +0200 | [diff] [blame] | 575 | const struct programmer_entry *const prog = programmer_table[i]; |
| 576 | switch (prog->type) { |
Stefan Tauner | af358d6 | 2012-12-27 18:40:26 +0000 | [diff] [blame] | 577 | case USB: |
Stefan Tauner | 4b24a2d | 2012-12-27 18:40:36 +0000 | [diff] [blame] | 578 | print_supported_devs(prog, "USB"); |
Stefan Tauner | af358d6 | 2012-12-27 18:40:26 +0000 | [diff] [blame] | 579 | break; |
Stefan Tauner | af358d6 | 2012-12-27 18:40:26 +0000 | [diff] [blame] | 580 | case PCI: |
Stefan Tauner | 4b24a2d | 2012-12-27 18:40:36 +0000 | [diff] [blame] | 581 | print_supported_devs(prog, "PCI"); |
Stefan Tauner | af358d6 | 2012-12-27 18:40:26 +0000 | [diff] [blame] | 582 | break; |
Stefan Tauner | af358d6 | 2012-12-27 18:40:26 +0000 | [diff] [blame] | 583 | case OTHER: |
Thomas Heijligen | 633d6db | 2021-03-31 19:09:44 +0200 | [diff] [blame] | 584 | if (prog->devs.note != NULL) { |
| 585 | msg_ginfo("\nSupported devices for the %s programmer:\n", prog->name); |
| 586 | msg_ginfo("%s", prog->devs.note); |
Stefan Tauner | 4b24a2d | 2012-12-27 18:40:36 +0000 | [diff] [blame] | 587 | } |
Stefan Tauner | af358d6 | 2012-12-27 18:40:26 +0000 | [diff] [blame] | 588 | break; |
| 589 | default: |
Nico Huber | ac90af6 | 2022-12-18 00:22:47 +0000 | [diff] [blame] | 590 | msg_gerr("\n%s: %s: Uninitialized programmer type!\n" |
| 591 | "Please report a bug at flashrom-stable@flashrom.org\n", |
| 592 | __func__, prog->name); |
Stefan Tauner | af358d6 | 2012-12-27 18:40:26 +0000 | [diff] [blame] | 593 | break; |
| 594 | } |
| 595 | } |
Niklas Söderlund | ede2fa4 | 2012-10-23 13:06:46 +0000 | [diff] [blame] | 596 | return 0; |
Carl-Daniel Hailfinger | f529205 | 2009-11-17 09:57:34 +0000 | [diff] [blame] | 597 | } |