diff --git a/82802ab.c b/82802ab.c index 1316939..d09ab20 100644 --- a/82802ab.c +++ b/82802ab.c @@ -195,13 +195,47 @@ int write_82802ab(struct flashchip *flash, uint8_t *buf) /* erase block by block and write block by block; this is the most secure way */ if (erase_block_82802ab(flash, i * page_size, page_size)) { fprintf(stderr, "ERASE FAILED!\n"); return -1; } write_page_82802ab(bios, buf + i * page_size, bios + i * page_size, page_size); } printf("\n"); free(tmpbuf); return 0; } + +int unlock_28f004s5(struct flashrom *flash) +{ + chipaddr bios = flash->virtual_memory; + uint8_t mcfg, bcfg; + + // clear status register + chip_writeb(0x50, bios); + + // enter read identifier codes + chip_writeb(0x90, bios); + + // read master lock config + mcfg = chip_readb(bios + 3); + + // exit read identifier code + chip_writeb(0xFF, bios); + + // unlock: clear block lock-bits, if needed + if (mcfg==0) { + chip_writeb(0x60, bios); + chip_writeb(0xD0, bios); + } + + chip_writeb(0x90, bios); + for (i = 0; i < flash->total_size * 1024; i+= flash->page_size) { + // read block lock config + bcfg = chip_readb(bios + i + 2); + msg_cdbg("block at %06x is %slocked!\n", i, bcfg ? "" : "un"); + } + chip_writeb(0xFF, bios); + + return 0; +} diff --git a/flashchips.c b/flashchips.c index 86c766b..70d84bf 100644 --- a/flashchips.c +++ b/flashchips.c @@ -2358,38 +2358,37 @@ struct flashchip flashchips[] = { }, .write = NULL, .read = read_memmapped, }, { .vendor = "Intel", .name = "28F004S5", .bustype = CHIP_BUSTYPE_PARALLEL, .manufacture_id = INTEL_ID, .model_id = E_28F004S5, .total_size = 512, .page_size = 256, - .feature_bits = FEATURE_REGISTERMAP, .tested = TEST_UNTESTED, .probe = probe_82802ab, .probe_timing = TIMING_ZERO, /* Datasheet has no timing info specified */ .block_erasers = { { .eraseblocks = { {64 * 1024, 8} }, .block_erase = erase_block_82802ab, }, }, - .unlock = unlock_82802ab, + .unlock = unlock_28f004s5, .write = write_82802ab, .read = read_memmapped, }, { .vendor = "Intel", .name = "82802AB", .bustype = CHIP_BUSTYPE_FWH, .manufacture_id = INTEL_ID, .model_id = I_82802AB, .total_size = 512, .page_size = 64 * 1024, .feature_bits = FEATURE_REGISTERMAP,