1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 22:43:17 +02:00

Refactor unlocking of many chips with locking at register space address +2

This includes PMC Pm49*, SST 49LF00*, ST M50* and Winbond W39* families.
The erase and write test status bits of all affected chips have been reset.

Corresponding to flashrom svn r1833.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
This commit is contained in:
Carl-Daniel Hailfinger
2014-08-03 13:05:34 +00:00
committed by Stefan Tauner
parent 2a41f0a2c0
commit ef3ac8ac17
9 changed files with 248 additions and 315 deletions

View File

@ -23,45 +23,6 @@
#include "flash.h"
#include "chipdrivers.h"
static int write_lockbits_block_49lfxxxc(struct flashctx *flash,
unsigned long address,
unsigned char bits)
{
unsigned long lock = flash->virtual_registers + address + 2;
msg_cdbg("lockbits at address=0x%08lx is 0x%01x\n", lock,
chip_readb(flash, lock));
chip_writeb(flash, bits, lock);
return 0;
}
static int write_lockbits_49lfxxxc(struct flashctx *flash, unsigned char bits)
{
chipaddr registers = flash->virtual_registers;
unsigned int i, left = flash->chip->total_size * 1024;
unsigned long address;
msg_cdbg("\nbios=0x%08" PRIxPTR "\n", registers);
for (i = 0; left > 65536; i++, left -= 65536) {
write_lockbits_block_49lfxxxc(flash, i * 65536, bits);
}
address = i * 65536;
write_lockbits_block_49lfxxxc(flash, address, bits);
address += 32768;
write_lockbits_block_49lfxxxc(flash, address, bits);
address += 8192;
write_lockbits_block_49lfxxxc(flash, address, bits);
address += 8192;
write_lockbits_block_49lfxxxc(flash, address, bits);
return 0;
}
int unlock_49lfxxxc(struct flashctx *flash)
{
return write_lockbits_49lfxxxc(flash, 0);
}
int erase_sector_49lfxxxc(struct flashctx *flash, unsigned int address,
unsigned int sector_size)
{