1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 23:22:37 +02:00

More jedec standard consolidation

Corresponding to flashrom svn r18 and coreboot v2 svn r1464.
This commit is contained in:
Ollie Lho 2004-03-22 22:19:17 +00:00
parent 3a3dea7260
commit 070647d114
2 changed files with 38 additions and 32 deletions

30
jedec.c
View File

@ -139,15 +139,11 @@ void write_page_jedec(volatile char *bios, char *src, volatile char *dst,
toggle_ready_jedec(dst - 1); toggle_ready_jedec(dst - 1);
} }
int write_sector_jedec(volatile char *bios, int wirte_byte_program_jedec(volatile unsigned char *bios, unsigned char *src,
unsigned char *src, volatile unsigned char *dst)
volatile unsigned char *dst,
unsigned int page_size)
{ {
int i; volatile unsigned char *Temp;
volatile char *Temp;
for (i = 0; i < page_size; i++) {
if (*dst != 0xff) { if (*dst != 0xff) {
printf("FATAL: dst %p not erased (val 0x%x)\n", printf("FATAL: dst %p not erased (val 0x%x)\n",
dst, *dst); dst, *dst);
@ -157,7 +153,7 @@ int write_sector_jedec(volatile char *bios,
if (*src == 0xFF) { if (*src == 0xFF) {
dst++, src++; dst++, src++;
/* If the data is 0xFF, don't program it */ /* If the data is 0xFF, don't program it */
continue; return 0;
} }
/* Issue JEDEC Byte Program command */ /* Issue JEDEC Byte Program command */
Temp = bios + 0x5555; Temp = bios + 0x5555;
@ -172,6 +168,17 @@ int write_sector_jedec(volatile char *bios,
printf("BAD! dst 0x%lx val 0x%x src 0x%x\n", printf("BAD! dst 0x%lx val 0x%x src 0x%x\n",
(unsigned long) dst, *dst, *src); (unsigned long) dst, *dst, *src);
dst++, src++; dst++, src++;
return 0;
}
int write_sector_jedec(volatile unsigned char *bios, unsigned char *src,
volatile unsigned char *dst,
unsigned int page_size)
{
int i;
for (i = 0; i < page_size; i++) {
wirte_byte_program_jedec(bios, src, dst);
} }
return (0); return (0);
@ -180,8 +187,8 @@ int write_sector_jedec(volatile char *bios,
int write_jedec(struct flashchip *flash, unsigned char *buf) int write_jedec(struct flashchip *flash, unsigned char *buf)
{ {
int i; int i;
int total_size = flash->total_size * 1024, page_size = int total_size = flash->total_size * 1024;
flash->page_size; int page_size = flash->page_size;
volatile unsigned char *bios = flash->virt_addr; volatile unsigned char *bios = flash->virt_addr;
erase_chip_jedec(flash); erase_chip_jedec(flash);
@ -194,8 +201,7 @@ int write_jedec(struct flashchip *flash, unsigned char *buf)
printf("%04d at address: 0x%08x", i, i * page_size); printf("%04d at address: 0x%08x", i, i * page_size);
write_page_jedec(bios, buf + i * page_size, write_page_jedec(bios, buf + i * page_size,
bios + i * page_size, page_size); bios + i * page_size, page_size);
printf printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
} }
printf("\n"); printf("\n");
protect_jedec(bios); protect_jedec(bios);

View File

@ -5,7 +5,7 @@ extern int probe_jedec(struct flashchip *flash);
extern int erase_chip_jedec(struct flashchip *flash); extern int erase_chip_jedec(struct flashchip *flash);
extern int write_jedec(struct flashchip *flash, unsigned char *buf); extern int write_jedec(struct flashchip *flash, unsigned char *buf);
extern int erase_sector_jedec(volatile char *bios, unsigned int page); extern int erase_sector_jedec(volatile char *bios, unsigned int page);
extern int write_sector_jedec(volatile char *bios, extern int write_sector_jedec(volatile unsigned char *bios,
unsigned char *src, unsigned char *src,
volatile unsigned char *dst, volatile unsigned char *dst,
unsigned int page_size); unsigned int page_size);