OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the flashrom project. | 2 * This file is part of the flashrom project. |
3 * | 3 * |
4 * Copyright (C) 2000 Silicon Integrated System Corporation | 4 * Copyright (C) 2000 Silicon Integrated System Corporation |
5 * Copyright (C) 2004 Tyan Corp <yhlu@tyan.com> | 5 * Copyright (C) 2004 Tyan Corp <yhlu@tyan.com> |
6 * Copyright (C) 2005-2008 coresystems GmbH | 6 * Copyright (C) 2005-2008 coresystems GmbH |
7 * Copyright (C) 2008,2009,2010 Carl-Daniel Hailfinger | 7 * Copyright (C) 2008,2009,2010 Carl-Daniel Hailfinger |
8 * | 8 * |
9 * This program is free software; you can redistribute it and/or modify | 9 * This program is free software; you can redistribute it and/or modify |
10 * it under the terms of the GNU General Public License as published by | 10 * it under the terms of the GNU General Public License as published by |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 if (!flashes[i]) | 367 if (!flashes[i]) |
368 for (i++; i < ARRAY_SIZE(flashes); i++) | 368 for (i++; i < ARRAY_SIZE(flashes); i++) |
369 flashes[i] = NULL; | 369 flashes[i] = NULL; |
370 } | 370 } |
371 | 371 |
372 if (flashes[1]) { | 372 if (flashes[1]) { |
373 printf("Multiple flash chips were detected:"); | 373 printf("Multiple flash chips were detected:"); |
374 for (i = 0; i < ARRAY_SIZE(flashes) && flashes[i]; i++) | 374 for (i = 0; i < ARRAY_SIZE(flashes) && flashes[i]; i++) |
375 printf(" %s", flashes[i]->name); | 375 printf(" %s", flashes[i]->name); |
376 printf("\nPlease specify which chip to use with the -c <chipname
> option.\n"); | 376 printf("\nPlease specify which chip to use with the -c <chipname
> option.\n"); |
377 » » programmer_shutdown(); | 377 » » flashrom_shutdown(); |
378 exit(1); | 378 exit(1); |
379 } else if (!flashes[0]) { | 379 } else if (!flashes[0]) { |
380 printf("No EEPROM/flash device found.\n"); | 380 printf("No EEPROM/flash device found.\n"); |
381 if (!force || !chip_to_probe) { | 381 if (!force || !chip_to_probe) { |
382 printf("Note: flashrom can never write if the flash chip
isn't found automatically.\n"); | 382 printf("Note: flashrom can never write if the flash chip
isn't found automatically.\n"); |
383 } | 383 } |
384 if (force && read_it && chip_to_probe) { | 384 if (force && read_it && chip_to_probe) { |
385 printf("Force read (-f -r -c) requested, pretending the
chip is there:\n"); | 385 printf("Force read (-f -r -c) requested, pretending the
chip is there:\n"); |
386 flashes[0] = probe_flash(flashchips, 1); | 386 flashes[0] = probe_flash(flashchips, 1); |
387 if (!flashes[0]) { | 387 if (!flashes[0]) { |
388 printf("Probing for flash chip '%s' failed.\n",
chip_to_probe); | 388 printf("Probing for flash chip '%s' failed.\n",
chip_to_probe); |
389 » » » » programmer_shutdown(); | 389 » » » » flashrom_shutdown(); |
390 exit(1); | 390 exit(1); |
391 } | 391 } |
392 printf("Please note that forced reads most likely contai
n garbage.\n"); | 392 printf("Please note that forced reads most likely contai
n garbage.\n"); |
393 return read_flash_to_file(flashes[0], filename); | 393 return read_flash_to_file(flashes[0], filename); |
394 } | 394 } |
395 // FIXME: flash writes stay enabled! | 395 // FIXME: flash writes stay enabled! |
396 » » programmer_shutdown(); | 396 » » flashrom_shutdown(); |
397 exit(1); | 397 exit(1); |
398 } | 398 } |
399 | 399 |
400 flash = flashes[0]; | 400 flash = flashes[0]; |
401 | 401 |
402 check_chip_supported(flash); | 402 check_chip_supported(flash); |
403 | 403 |
404 size = flash->total_size * 1024; | 404 size = flash->total_size * 1024; |
405 if (check_max_decode((buses_supported & flash->bustype), size) && | 405 if (check_max_decode((buses_supported & flash->bustype), size) && |
406 (!force)) { | 406 (!force)) { |
407 fprintf(stderr, "Chip is too big for this programmer " | 407 fprintf(stderr, "Chip is too big for this programmer " |
408 "(-V gives details). Use --force to override.\n"); | 408 "(-V gives details). Use --force to override.\n"); |
409 » » programmer_shutdown(); | 409 » » flashrom_shutdown(); |
410 return 1; | 410 return 1; |
411 } | 411 } |
412 | 412 |
413 if (!(read_it | write_it | verify_it | erase_it)) { | 413 if (!(read_it | write_it | verify_it | erase_it)) { |
414 printf("No operations were specified.\n"); | 414 printf("No operations were specified.\n"); |
415 // FIXME: flash writes stay enabled! | 415 // FIXME: flash writes stay enabled! |
416 » » programmer_shutdown(); | 416 » » flashrom_shutdown(); |
417 exit(0); | 417 exit(0); |
418 } | 418 } |
419 | 419 |
420 if (!filename && !erase_it) { | 420 if (!filename && !erase_it) { |
421 printf("Error: No filename specified.\n"); | 421 printf("Error: No filename specified.\n"); |
422 // FIXME: flash writes stay enabled! | 422 // FIXME: flash writes stay enabled! |
423 » » programmer_shutdown(); | 423 » » flashrom_shutdown(); |
424 exit(1); | 424 exit(1); |
425 } | 425 } |
426 | 426 |
427 /* Always verify write operations unless -n is used. */ | 427 /* Always verify write operations unless -n is used. */ |
428 if (write_it && !dont_verify_it) | 428 if (write_it && !dont_verify_it) |
429 verify_it = 1; | 429 verify_it = 1; |
430 | 430 |
431 /* FIXME: We should issue an unconditional chip reset here. This can be | 431 /* FIXME: We should issue an unconditional chip reset here. This can be |
432 * done once we have a .reset function in struct flashchip. | 432 * done once we have a .reset function in struct flashchip. |
433 * Give the chip time to settle. | 433 * Give the chip time to settle. |
434 */ | 434 */ |
435 programmer_delay(100000); | 435 programmer_delay(100000); |
436 return doit(flash, force, filename, read_it, write_it, erase_it, verify_
it); | 436 return doit(flash, force, filename, read_it, write_it, erase_it, verify_
it); |
437 } | 437 } |
OLD | NEW |