amd_flash: validate the bus address before we read/write it

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1860 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Mike Frysinger 14 years ago
parent a248ce6113
commit fd72c20e60

@ -1,3 +1,8 @@
2010-09-28 Mike Frysinger <vapier@gentoo.org>
* src/flash/amd_flash.c (urj_flash_amd_detect): Move the bus address range
checks up to before we actually attempt to read/write the bus.
2010-09-27 Mike Frysinger <vapier@gentoo.org>
* data/analog/bf533/bf533: Drop brackets from ADDR and DATA signals to match

@ -101,6 +101,12 @@ urj_flash_amd_detect (urj_bus_t *bus, uint32_t adr,
return URJ_STATUS_FAIL;
}
(*cfi_array)->bus = bus;
(*cfi_array)->address = adr;
if (URJ_BUS_AREA (bus, adr, &area) != URJ_STATUS_OK)
// retain error state
return URJ_STATUS_FAIL;
URJ_BUS_WRITE (bus, adr + 0x0, 0xf0);
URJ_BUS_WRITE (bus, adr + 0x555, 0xaa);
URJ_BUS_WRITE (bus, adr + 0x2AA, 0x55);
@ -129,11 +135,6 @@ urj_flash_amd_detect (urj_bus_t *bus, uint32_t adr,
break;
}
(*cfi_array)->bus = bus;
(*cfi_array)->address = adr;
if (URJ_BUS_AREA (bus, adr, &area) != URJ_STATUS_OK)
// retain error status
return URJ_STATUS_FAIL; /* bus width detection failed */
unsigned int bw = area.width;
int ba, i;
if (bw != 8 && bw != 16 && bw != 32)

Loading…
Cancel
Save