Changeset 3791

Show
Ignore:
Timestamp:
12/03/08 22:39:56 (5 weeks ago)
Author:
stuge
Message:

flashrom: Fix bug in r3790

If flashbase was set before probe_flash() it would only ever be used once, for
the very first flash chip probe.

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

Files:
1 modified

Legend:

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

    r3790 r3791  
    106106        volatile uint8_t *bios; 
    107107        struct flashchip *flash; 
    108         unsigned long size; 
     108        unsigned long base, size; 
    109109 
    110110        for (flash = first_flash; flash && flash->name; flash++) { 
     
    134134                        size = getpagesize(); 
    135135                } 
    136                 if (!flashbase) 
    137                         flashbase = (0xffffffff - size + 1); 
    138  
     136 
     137                base = flashbase ? flashbase : (0xffffffff - size + 1); 
    139138                bios = mmap(0, size, PROT_WRITE | PROT_READ, MAP_SHARED, 
    140                             fd_mem, (off_t) flashbase); 
     139                            fd_mem, (off_t) base); 
    141140                if (bios == MAP_FAILED) { 
    142141                        perror("Can't mmap memory using " MEM_DEV); 
     
    163162 
    164163        printf("Found chip \"%s %s\" (%d KB) at physical address 0x%lx.\n", 
    165                flash->vendor, flash->name, flash->total_size, flashbase); 
     164               flash->vendor, flash->name, flash->total_size, base); 
     165        flashbase = base; 
    166166        return flash; 
    167167}