mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-01 06:01:16 +02:00
Various JEDEC refactorings touching 82802ab.c, sharplhf00l04.c and stm50flw0x0x.c
Rename print_82802ab_status to print_status_82802ab add unlock_82802ab strip unlock code from erase_block_82802ab rename erase_82802ab_block to erase_block_80280ab delete sharplhf00l04.o from Makefile delete *_lhf00l04* from chipdrivers.h. add unlock_stm50flw0x0x delete wait_stm50flw0x0x delete write_page_stm50flw0x0x convert erase_stm50flw0x0x to erase_chip_stm50flw0x0x delete write_stm50flw0x0x add unlock_82802ab to two Intel chips with TEST_BAD_WRITE change the status of 82802AB, 82802AC, M50FW040, M50FW080 to TEST_OK_PR Corresponding to flashrom svn r948. 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:
27
82802ab.c
27
82802ab.c
@ -32,7 +32,7 @@
|
||||
#include "chipdrivers.h"
|
||||
|
||||
// I need that Berkeley bit-map printer
|
||||
void print_82802ab_status(uint8_t status)
|
||||
void print_status_82802ab(uint8_t status)
|
||||
{
|
||||
printf_debug("%s", status & 0x80 ? "Ready:" : "Busy:");
|
||||
printf_debug("%s", status & 0x40 ? "BE SUSPEND:" : "BE RUN/FINISH:");
|
||||
@ -92,18 +92,27 @@ uint8_t wait_82802ab(chipaddr bios)
|
||||
return status;
|
||||
}
|
||||
|
||||
int erase_82802ab_block(struct flashchip *flash, unsigned int page, unsigned int pagesize)
|
||||
int unlock_82802ab(struct flashchip *flash)
|
||||
{
|
||||
int i;
|
||||
//chipaddr wrprotect = flash->virtual_registers + page + 2;
|
||||
|
||||
for (i = 0; i < flash->total_size; i+= flash->page_size)
|
||||
{
|
||||
chip_writeb(0, flash->virtual_registers + i + 2);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int erase_block_82802ab(struct flashchip *flash, unsigned int page, unsigned int pagesize)
|
||||
{
|
||||
chipaddr bios = flash->virtual_memory;
|
||||
chipaddr wrprotect = flash->virtual_registers + page + 2;
|
||||
uint8_t status;
|
||||
|
||||
// clear status register
|
||||
chip_writeb(0x50, bios + page);
|
||||
|
||||
// clear write protect
|
||||
chip_writeb(0, wrprotect);
|
||||
|
||||
// now start it
|
||||
chip_writeb(0x20, bios + page);
|
||||
chip_writeb(0xd0, bios + page);
|
||||
@ -111,7 +120,7 @@ int erase_82802ab_block(struct flashchip *flash, unsigned int page, unsigned int
|
||||
|
||||
// now let's see what the register is
|
||||
status = wait_82802ab(bios);
|
||||
print_82802ab_status(status);
|
||||
print_status_82802ab(status);
|
||||
|
||||
if (check_erased_range(flash, page, pagesize)) {
|
||||
fprintf(stderr, "ERASE FAILED!\n");
|
||||
@ -130,7 +139,7 @@ int erase_82802ab(struct flashchip *flash)
|
||||
printf("total_size is %d; flash->page_size is %d\n",
|
||||
total_size, flash->page_size);
|
||||
for (i = 0; i < total_size; i += flash->page_size)
|
||||
if (erase_82802ab_block(flash, i, flash->page_size)) {
|
||||
if (erase_block_82802ab(flash, i, flash->page_size)) {
|
||||
fprintf(stderr, "ERASE FAILED!\n");
|
||||
return -1;
|
||||
}
|
||||
@ -184,7 +193,7 @@ 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_82802ab_block(flash, i * page_size, page_size)) {
|
||||
if (erase_block_82802ab(flash, i * page_size, page_size)) {
|
||||
fprintf(stderr, "ERASE FAILED!\n");
|
||||
return -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user