On 11.05.2009 15:53, Uwe Hermann wrote:
On Mon, May 11, 2009 at 04:56:05AM +0200, Carl-Daniel Hailfinger wrote:
Add lock bit handling (printing, setting and checking) to SST FWH chips and abort any writes to locked sectors. Verbose mode gives you all the info. Normal mode only tells you of unlocking failed, but gives enough details to debug.
Add a comment about flash register placement to flashrom.c.
Thanks to Uwe for testing multiple iterations of this patch.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Acked-by: Uwe Hermann uwe@hermann-uwe.de
As noted above, I've tested this on my hardware.
Thanks, committed in r492.
+int clear_sst_fwhub_block_lock(struct flashchip *flash, int offset) +{
- volatile uint8_t *registers = flash->virtual_registers;
- uint8_t blockstatus;
- blockstatus = check_sst_fwhub_block_lock(flash, offset);
- if (blockstatus) {
printf_debug("Trying to clear lock for 0x%06x... ", offset)
chip_writeb(0, registers + offset + 2);
blockstatus = check_sst_fwhub_block_lock(flash, offset);
if (blockstatus) {
printf_debug("failed\n");
} else {
printf_debug("OK\n");
}
I find this nicer for short and simple if's like this one:
printf_debug("%s\n", (blockstatus) ? "failed" : "OK");
Either is fine though, if you prefer the 5-line version.
Ah yes, that was a remainder from earlier versions of the patch. Thanks for noticing. I changed it.
Regards, Carl-Daniel