[coreboot] [PATCH] flashrom: Add lock bit handling to SST FWH chips
Uwe Hermann
uwe at hermann-uwe.de
Mon May 11 15:53:53 CEST 2009
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 at gmx.net>
Acked-by: Uwe Hermann <uwe at hermann-uwe.de>
As noted above, I've tested this on my hardware.
> +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.
Uwe.
--
http://www.hermann-uwe.de | http://www.holsham-traders.de
http://www.crazy-hacks.org | http://www.unmaintained-free-software.org
More information about the coreboot
mailing list