Changeset 560 for trunk/flashrom.c
- Timestamp:
- Jun 1, 2009 4:08:58 AM (4 years ago)
- File:
-
- 1 edited
-
trunk/flashrom.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/flashrom.c
r559 r560 175 175 } 176 176 177 char *strcat_realloc(char *dest, const char *src) 178 { 179 dest = realloc(dest, strlen(dest) + strlen(src) + 1); 180 if (!dest) 181 return NULL; 182 strcat(dest, src); 183 return dest; 184 } 185 186 /* Return a string corresponding to the bustype parameter. 187 * Memory is obtained with malloc() and can be freed with free(). 188 */ 189 char *flashbuses_to_text(enum chipbustype bustype) 190 { 191 char *ret = calloc(1, 1); 192 if (bustype == CHIP_BUSTYPE_UNKNOWN) { 193 ret = strcat_realloc(ret, "Unknown,"); 194 /* FIXME: Once all chipsets and flash chips have been updated, NONSPI 195 * will cease to exist and should be eliminated here as well. 196 */ 197 } else if (bustype == CHIP_BUSTYPE_NONSPI) { 198 ret = strcat_realloc(ret, "Non-SPI,"); 199 } else { 200 if (bustype & CHIP_BUSTYPE_PARALLEL) 201 ret = strcat_realloc(ret, "Parallel,"); 202 if (bustype & CHIP_BUSTYPE_LPC) 203 ret = strcat_realloc(ret, "LPC,"); 204 if (bustype & CHIP_BUSTYPE_FWH) 205 ret = strcat_realloc(ret, "FWH,"); 206 if (bustype & CHIP_BUSTYPE_SPI) 207 ret = strcat_realloc(ret, "SPI,"); 208 if (bustype == CHIP_BUSTYPE_NONE) 209 ret = strcat_realloc(ret, "None,"); 210 } 211 /* Kill last comma. */ 212 ret[strlen(ret) - 1] = '\0'; 213 ret = realloc(ret, strlen(ret) + 1); 214 return ret; 215 } 216 177 217 struct flashchip *probe_flash(struct flashchip *first_flash, int force) 178 218 { 179 219 struct flashchip *flash; 180 220 unsigned long base = 0, size; 221 char *tmp; 181 222 182 223 for (flash = first_flash; flash && flash->name; flash++) { … … 187 228 if (!flash->probe && !force) { 188 229 printf_debug("failed! flashrom has no probe function for this flash chip.\n"); 230 continue; 231 } 232 if (!(buses_supported & flash->bustype)) { 233 tmp = flashbuses_to_text(buses_supported); 234 printf_debug("skipped. Host bus type %s ", tmp); 235 free(tmp); 236 tmp = flashbuses_to_text(flash->bustype); 237 printf_debug("and chip bus type %s are incompatible.\n", tmp); 238 free(tmp); 189 239 continue; 190 240 }
Note: See TracChangeset
for help on using the changeset viewer.
