Changeset 3562

Show
Ignore:
Timestamp:
09/04/08 01:10:05 (3 months ago)
Author:
stuge
Message:

flashrom: Only find "unknown .. SPI chip" if no other chip was found

This removes the false positive matches we've been seeing, and also removes
the true positive match in case there is more than one flash chip and the 2nd
or 3rd are unknown - but I think that case is uncommon enough to warrant the
improvement in the common case. Use flashrom -frc forced read if you have the
uncommon case, and/or please add the flash chip to the flashchips array.

Signed-off-by: Peter Stuge <peter@…>
Acked-by: Stefan Reinauer <stepan@…>

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/util/flashrom/flashrom.c

    r3502 r3562  
    100100} 
    101101 
    102 struct flashchip *probe_flash(struct flashchip *flash, int force) 
     102struct flashchip *probe_flash(struct flashchip *first_flash, int force) 
    103103{ 
    104104        volatile uint8_t *bios; 
     105        struct flashchip *flash; 
    105106        unsigned long flash_baseaddr = 0, size; 
    106107 
    107         for (; flash && flash->name; flash++) { 
     108        for (flash = first_flash; flash && flash->name; flash++) { 
    108109                if (chip_to_probe && strcmp(flash->name, chip_to_probe) != 0) 
    109110                        continue; 
     
    151152                        break; 
    152153 
    153                 if (flash->probe(flash) == 1) 
    154                         break; 
    155  
     154                if (flash->probe(flash) != 1) 
     155                        goto notfound; 
     156 
     157                if (first_flash == flashchips || flash->model_id != GENERIC_DEVICE_ID) 
     158                        break; 
     159 
     160notfound: 
    156161                munmap((void *)bios, size); 
    157162        }