1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 15:12:36 +02:00

To access/read the lock bits, we use the same mode to read the chip id

This patch looks into the write situation for the Intel 28F001BX-{B,T}.
Looks like they're just a 82802ab page write.

Unlock_28f004s5 has been changed to read all the lock bits and if at
least one of the block lock bits are set, clear them all. If the master
lock bit is set, we can't do anything about it, so we return.

Corresponding to flashrom svn r965.

Signed-off-by: Sean Nelson <audiohacked@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:
Sean Nelson 2010-03-22 04:39:31 +00:00
parent 408e47af32
commit dee4a83e1c
2 changed files with 54 additions and 6 deletions

View File

@ -205,3 +205,52 @@ int write_82802ab(struct flashchip *flash, uint8_t *buf)
return 0; return 0;
} }
int unlock_28f004s5(struct flashrom *flash)
{
chipaddr bios = flash->virtual_memory;
uint8_t mcfg, bcfg, need_unlock = 0, can_unlock = 0;
/* Clear status register */
chip_writeb(0x50, bios);
/* Read identifier codes */
chip_writeb(0x90, bios);
/* Read master lock-bit */
mcfg = chip_readb(bios + 0x3);
msg_cinfo("master lock is ");
if (mcfg) {
msg_cdbg("locked!\n");
} else {
msg_cdbg("unlocked!\n");
can_unlock = 1;
}
/* Read block lock-bits */
for (i = 0; i < flash->total_size * 1024; i+= (64 * 1024)) {
bcfg = chip_readb(bios + i + 2); // read block lock config
msg_cdbg("block lock at %06x is %slocked!\n", i, bcfg ? "" : "un");
if (bcfg) {
need_unlock = 1;
}
}
/* Reset chip */
chip_writeb(0xFF, bios);
/* Unlock: clear block lock-bits, if needed */
if (can_unlock && need_unlock) {
chip_writeb(0x60, bios);
chip_writeb(0xD0, bios);
chip_writeb(0xFF, bios);
}
/* Error: master locked or a block is locked */
if (!can_unlock && need_unlock) {
msg_cerr("At least one block is locked and lockdown is active!\n");
return -1;
}
return 0;
}

View File

@ -2316,7 +2316,7 @@ struct flashchip flashchips[] = {
.model_id = P28F001BXB, .model_id = P28F001BXB,
.total_size = 128, .total_size = 128,
.page_size = 128 * 1024, /* 8k + 2x4k + 112k */ .page_size = 128 * 1024, /* 8k + 2x4k + 112k */
.tested = TEST_BAD_WRITE, .tested = TEST_UNTESTED,
.probe = probe_jedec, .probe = probe_jedec,
.probe_timing = TIMING_ZERO, /* Datasheet has no timing info specified */ .probe_timing = TIMING_ZERO, /* Datasheet has no timing info specified */
.block_erasers = .block_erasers =
@ -2330,7 +2330,7 @@ struct flashchip flashchips[] = {
.block_erase = erase_block_82802ab, .block_erase = erase_block_82802ab,
}, },
}, },
.write = NULL, .write = write_82802ab,
.read = read_memmapped, .read = read_memmapped,
}, },
@ -2342,7 +2342,7 @@ struct flashchip flashchips[] = {
.model_id = P28F001BXT, .model_id = P28F001BXT,
.total_size = 128, .total_size = 128,
.page_size = 128 * 1024, /* 112k + 2x4k + 8k */ .page_size = 128 * 1024, /* 112k + 2x4k + 8k */
.tested = TEST_BAD_WRITE, .tested = TEST_UNTESTED,
.probe = probe_jedec, .probe = probe_jedec,
.probe_timing = TIMING_ZERO, /* Datasheet has no timing info specified */ .probe_timing = TIMING_ZERO, /* Datasheet has no timing info specified */
.block_erasers = .block_erasers =
@ -2356,7 +2356,7 @@ struct flashchip flashchips[] = {
.block_erase = erase_block_82802ab, .block_erase = erase_block_82802ab,
}, },
}, },
.write = NULL, .write = write_82802ab,
.read = read_memmapped, .read = read_memmapped,
}, },
@ -2368,7 +2368,6 @@ struct flashchip flashchips[] = {
.model_id = E_28F004S5, .model_id = E_28F004S5,
.total_size = 512, .total_size = 512,
.page_size = 256, .page_size = 256,
.feature_bits = FEATURE_REGISTERMAP,
.tested = TEST_UNTESTED, .tested = TEST_UNTESTED,
.probe = probe_82802ab, .probe = probe_82802ab,
.probe_timing = TIMING_ZERO, /* Datasheet has no timing info specified */ .probe_timing = TIMING_ZERO, /* Datasheet has no timing info specified */
@ -2379,7 +2378,7 @@ struct flashchip flashchips[] = {
.block_erase = erase_block_82802ab, .block_erase = erase_block_82802ab,
}, },
}, },
.unlock = unlock_82802ab, .unlock = unlock_28f004s5,
.write = write_82802ab, .write = write_82802ab,
.read = read_memmapped, .read = read_memmapped,
}, },