On 05.06.2009 02:42, svn@coreboot.org wrote:
New Revision: 573
Modified: trunk/sst49lfxxxc.c Log: Actually enable the protection register debug output on SST49LF160C and similar chips if -V is supplied.
Signed-off-by: Uwe Hermann uwe@hermann-uwe.de Acked-by: Myles Watsonmylesgw@gmail.com
Modified: trunk/sst49lfxxxc.c
--- trunk/sst49lfxxxc.c 2009-06-04 19:25:54 UTC (rev 572) +++ trunk/sst49lfxxxc.c 2009-06-05 00:42:18 UTC (rev 573) @@ -38,28 +38,37 @@
for (i = 0; left > 65536; i++, left -= 65536) {
//printf("lockbits at address=0x%08lx is 0x%01x\n", (unsigned long)0xFFC00000 - size + (i * 65536) + 2, *(bios + (i * 65536) + 2) );
printf_debug("lockbits at address=%p is 0x%01x\n",
(void *)(0xffc00000 - size + (i * 65536) + 2),
chip_writeb(bits, bios + (i * 65536) + 2);chip_readb(bios + (i * 65536) + 2));
Sorry, I don't get it. Why do you use a base of
0xffc00000 - size for printing the address and bios for printing the contents?
There's flash->virtual_memory and flash->virtual_registers. Any reason you recalculate flash->virtual_registers even though it is passed in?
Regards, Carl-Daniel
Carl-Daniel Hailfinger wrote:
Any reason you recalculate
It was like that in the code already. I don't know who wrote it initially.
//Peter
On 05.06.2009 10:05, Carl-Daniel Hailfinger wrote:
On 05.06.2009 02:42, svn@coreboot.org wrote:
Revision: 573
Actually enable the protection register debug output on SST49LF160C and similar chips if -V is supplied.
Signed-off-by: Uwe Hermann uwe@hermann-uwe.de
There's flash->virtual_memory and flash->virtual_registers. Any reason you recalculate flash->virtual_registers even though it is passed in?
Use flash->virtual_registers for what they were meant for instead of recalculating them every time.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: flashrom-sst49lfxxxc_lockbits/sst49lfxxxc.c =================================================================== --- flashrom-sst49lfxxxc_lockbits/sst49lfxxxc.c (Revision 574) +++ flashrom-sst49lfxxxc_lockbits/sst49lfxxxc.c (Arbeitskopie) @@ -38,38 +38,39 @@ #define STATUS_ESS (1 << 6) #define STATUS_WSMS (1 << 7)
-static int write_lockbits_49lfxxxc(chipaddr bios, int size, unsigned char bits) +static int write_lockbits_49lfxxxc(struct flashchip *flash, unsigned char bits) { - int i, left = size; + chipaddr registers = flash->virtual_registers; + int i, left = flash->total_size * 1024; unsigned long address;
- printf_debug("\nbios=0x%08lx\n", bios); + printf_debug("\nbios=0x%08lx\n", registers); for (i = 0; left > 65536; i++, left -= 65536) { - printf_debug("lockbits at address=%p is 0x%01x\n", - (void *)(0xffc00000 - size + (i * 65536) + 2), - chip_readb(bios + (i * 65536) + 2)); - chip_writeb(bits, bios + (i * 65536) + 2); + printf_debug("lockbits at address=0x%08lx is 0x%01x\n", + registers + (i * 65536) + 2, + chip_readb(registers + (i * 65536) + 2)); + chip_writeb(bits, registers + (i * 65536) + 2); } address = i * 65536; - printf_debug("lockbits at address=%p is 0x%01x\n", - (void *)(0xffc00000 - size + address + 2), - chip_readb(bios + address + 2)); - chip_writeb(bits, bios + address + 2); + printf_debug("lockbits at address=0x%08lx is 0x%01x\n", + registers + address + 2, + chip_readb(registers + address + 2)); + chip_writeb(bits, registers + address + 2); address += 32768; - printf_debug("lockbits at address=%p is 0x%01x\n", - (void *)(0xffc00000 - size + address + 2), - chip_readb(bios + address + 2)); - chip_writeb(bits, bios + address + 2); + printf_debug("lockbits at address=0x%08lx is 0x%01x\n", + registers + address + 2, + chip_readb(registers + address + 2)); + chip_writeb(bits, registers + address + 2); address += 8192; - printf_debug("lockbits at address=%p is 0x%01x\n", - (void *)(0xffc00000 - size + address + 2), - chip_readb(bios + address + 2)); - chip_writeb(bits, bios + address + 2); + printf_debug("lockbits at address=0x%08lx is 0x%01x\n", + registers + address + 2, + chip_readb(registers + address + 2)); + chip_writeb(bits, registers + address + 2); address += 8192; - printf_debug("lockbits at address=%p is 0x%01x\n", - (void *)(0xffc00000 - size + address + 2), - chip_readb(bios + address + 2)); - chip_writeb(bits, bios + address + 2); + printf_debug("lockbits at address=0x%08lx is 0x%01x\n", + registers + address + 2, + chip_readb(registers + address + 2)); + chip_writeb(bits, registers + address + 2);
return 0; } @@ -150,11 +151,10 @@ int erase_49lfxxxc(struct flashchip *flash) { chipaddr bios = flash->virtual_memory; - chipaddr registers = flash->virtual_registers; int i; unsigned int total_size = flash->total_size * 1024;
- write_lockbits_49lfxxxc(registers, total_size, 0); + write_lockbits_49lfxxxc(flash, 0); for (i = 0; i < total_size; i += flash->page_size) if (erase_sector_49lfxxxc(bios, i) != 0) return (-1); @@ -171,7 +171,7 @@ int page_size = flash->page_size; chipaddr bios = flash->virtual_memory;
- write_lockbits_49lfxxxc(flash->virtual_registers, total_size, 0); + write_lockbits_49lfxxxc(flash, 0); printf("Programming page: "); for (i = 0; i < total_size / page_size; i++) { /* erase the page before programming */
On Fri, Jun 05, 2009 at 11:17:54AM +0200, Carl-Daniel Hailfinger wrote:
Use flash->virtual_registers for what they were meant for instead of recalculating them every time.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Acked-by: Uwe Hermann uwe@hermann-uwe.de
Uwe.
On 05.06.2009 15:25, Uwe Hermann wrote:
On Fri, Jun 05, 2009 at 11:17:54AM +0200, Carl-Daniel Hailfinger wrote:
Use flash->virtual_registers for what they were meant for instead of recalculating them every time.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Acked-by: Uwe Hermann uwe@hermann-uwe.de
Thanks, committed in r575.
Regards, Carl-Daniel