flashrom: probe_flash() cleanup for better code readability
Signed-off-by: Peter Stuge <peter@stuge.se> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3407 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
cac7286c0b
commit
f74c208256
|
@ -102,18 +102,15 @@ int map_flash_registers(struct flashchip *flash)
|
||||||
struct flashchip *probe_flash(struct flashchip *flash, int force)
|
struct flashchip *probe_flash(struct flashchip *flash, int force)
|
||||||
{
|
{
|
||||||
volatile uint8_t *bios;
|
volatile uint8_t *bios;
|
||||||
unsigned long flash_baseaddr, size;
|
unsigned long flash_baseaddr = 0, size;
|
||||||
|
|
||||||
while (flash->name != NULL) {
|
for (; flash && flash->name; flash++) {
|
||||||
if (chip_to_probe && strcmp(flash->name, chip_to_probe) != 0) {
|
if (chip_to_probe && strcmp(flash->name, chip_to_probe) != 0)
|
||||||
flash++;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
printf_debug("Probing for %s %s, %d KB: ",
|
printf_debug("Probing for %s %s, %d KB: ",
|
||||||
flash->vendor, flash->name, flash->total_size);
|
flash->vendor, flash->name, flash->total_size);
|
||||||
if (!flash->probe && !force) {
|
if (!flash->probe && !force) {
|
||||||
printf_debug("failed! flashrom has no probe function for this flash chip.\n");
|
printf_debug("failed! flashrom has no probe function for this flash chip.\n");
|
||||||
flash++;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,18 +147,21 @@ struct flashchip *probe_flash(struct flashchip *flash, int force)
|
||||||
}
|
}
|
||||||
flash->virtual_memory = bios;
|
flash->virtual_memory = bios;
|
||||||
|
|
||||||
if (force || flash->probe(flash) == 1) {
|
if (force)
|
||||||
printf("Found chip \"%s %s\" (%d KB) at physical address 0x%lx.\n",
|
break;
|
||||||
flash->vendor, flash->name, flash->total_size,
|
|
||||||
flash_baseaddr);
|
|
||||||
return flash;
|
|
||||||
}
|
|
||||||
munmap((void *)bios, size);
|
|
||||||
|
|
||||||
flash++;
|
if (flash->probe(flash) == 1)
|
||||||
|
break;
|
||||||
|
|
||||||
|
munmap((void *)bios, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
if (!flash || !flash->name)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
printf("Found chip \"%s %s\" (%d KB) at physical address 0x%lx.\n",
|
||||||
|
flash->vendor, flash->name, flash->total_size, flash_baseaddr);
|
||||||
|
return flash;
|
||||||
}
|
}
|
||||||
|
|
||||||
int verify_flash(struct flashchip *flash, uint8_t *buf)
|
int verify_flash(struct flashchip *flash, uint8_t *buf)
|
||||||
|
|
Loading…
Reference in New Issue