From c7dc7cc196a4bd5ba1cfafc87b193b89ae01a470 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Wed, 9 May 2007 10:17:44 +0000 Subject: Fix coding style of flashrom by running indent on all files: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs *.[ch] Some minor fixups were required, and maybe a few more cosmetic changeѕ are needed. Signed-off-by: Uwe Hermann Acked-by: Uwe Hermann git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2643 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- util/flashrom/sst49lfxxxc.c | 47 +++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 25 deletions(-) (limited to 'util/flashrom/sst49lfxxxc.c') diff --git a/util/flashrom/sst49lfxxxc.c b/util/flashrom/sst49lfxxxc.c index 522cb9b7c3..52f865a225 100644 --- a/util/flashrom/sst49lfxxxc.c +++ b/util/flashrom/sst49lfxxxc.c @@ -50,9 +50,8 @@ #define STATUS_ESS (1 << 6) #define STATUS_WSMS (1 << 7) - static __inline__ int write_lockbits_49lfxxxc(volatile uint8_t *bios, int size, - unsigned char bits) + unsigned char bits) { int i, left = size; unsigned long address; @@ -63,24 +62,23 @@ static __inline__ int write_lockbits_49lfxxxc(volatile uint8_t *bios, int size, *(bios + (i * 65536) + 2) = bits; } address = i * 65536; - //printf("lockbits at address=0x%08lx is 0x%01x\n", (unsigned long)0xFFc00000 - size + address + 2, *(bios + address + 2) ); + //printf("lockbits at address=0x%08lx is 0x%01x\n", (unsigned long)0xFFc00000 - size + address + 2, *(bios + address + 2) ); *(bios + address + 2) = bits; address += 32768; - //printf("lockbits at address=0x%08lx is 0x%01x\n", (unsigned long)0xFFc00000 - size + address + 2, *(bios + address + 2) ); + //printf("lockbits at address=0x%08lx is 0x%01x\n", (unsigned long)0xFFc00000 - size + address + 2, *(bios + address + 2) ); *(bios + address + 2) = bits; address += 8192; - //printf("lockbits at address=0x%08lx is 0x%01x\n", (unsigned long)0xFFc00000 - size + address + 2, *(bios + address + 2) ); + //printf("lockbits at address=0x%08lx is 0x%01x\n", (unsigned long)0xFFc00000 - size + address + 2, *(bios + address + 2) ); *(bios + address + 2) = bits; address += 8192; - //printf("lockbits at address=0x%08lx is 0x%01x\n", (unsigned long)0xFFc00000 - size + address + 2, *(bios + address + 2) ); + //printf("lockbits at address=0x%08lx is 0x%01x\n", (unsigned long)0xFFc00000 - size + address + 2, *(bios + address + 2) ); *(bios + address + 2) = bits; - return (0); } static __inline__ int erase_sector_49lfxxxc(volatile uint8_t *bios, - unsigned long address) + unsigned long address) { unsigned char status; @@ -88,21 +86,21 @@ static __inline__ int erase_sector_49lfxxxc(volatile uint8_t *bios, *(bios + address) = ERASE; do { - status = *bios; + status = *bios; if (status & (STATUS_ESS | STATUS_BPS)) { - printf("sector erase FAILED at address=0x%08lx status=0x%01x\n", (unsigned long)bios + address, status); + printf("sector erase FAILED at address=0x%08lx status=0x%01x\n", (unsigned long)bios + address, status); *bios = CLEAR_STATUS; - return(-1); + return (-1); } - } while (!(status & STATUS_WSMS)); + } while (!(status & STATUS_WSMS)); return (0); } static __inline__ int write_sector_49lfxxxc(volatile uint8_t *bios, - uint8_t *src, - volatile uint8_t *dst, - unsigned int page_size) + uint8_t *src, + volatile uint8_t *dst, + unsigned int page_size) { int i; unsigned char status; @@ -122,9 +120,9 @@ static __inline__ int write_sector_49lfxxxc(volatile uint8_t *bios, do { status = *bios; if (status & (STATUS_ESS | STATUS_BPS)) { - printf("sector write FAILED at address=0x%08lx status=0x%01x\n", (unsigned long)dst, status); + printf("sector write FAILED at address=0x%08lx status=0x%01x\n", (unsigned long)dst, status); *bios = CLEAR_STATUS; - return(-1); + return (-1); } } while (!(status & STATUS_WSMS)); } @@ -141,8 +139,8 @@ int probe_49lfxxxc(struct flashchip *flash) *bios = RESET; *bios = READ_ID; - id1 = *(volatile uint8_t *) bios; - id2 = *(volatile uint8_t *) (bios + 0x01); + id1 = *(volatile uint8_t *)bios; + id2 = *(volatile uint8_t *)(bios + 0x01); *bios = RESET; @@ -170,8 +168,8 @@ int erase_49lfxxxc(struct flashchip *flash) write_lockbits_49lfxxxc(bios2, total_size, 0); for (i = 0; i < total_size; i += flash->page_size) - if (erase_sector_49lfxxxc(bios, i) != 0 ) - return (-1); + if (erase_sector_49lfxxxc(bios, i) != 0) + return (-1); *bios = RESET; return (0); @@ -180,11 +178,10 @@ int erase_49lfxxxc(struct flashchip *flash) int write_49lfxxxc(struct flashchip *flash, uint8_t *buf) { int i; - int total_size = flash->total_size * 1024, page_size = - flash->page_size; + int total_size = flash->total_size * 1024; + int page_size = flash->page_size; volatile uint8_t *bios = flash->virt_addr; - write_lockbits_49lfxxxc(flash->virt_addr_2, total_size, 0); printf("Programming Page: "); for (i = 0; i < total_size / page_size; i++) { @@ -194,7 +191,7 @@ int write_49lfxxxc(struct flashchip *flash, uint8_t *buf) /* write to the sector */ printf("%04d at address: 0x%08x", i, i * page_size); write_sector_49lfxxxc(bios, buf + i * page_size, - bios + i * page_size, page_size); + bios + i * page_size, page_size); 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"); } printf("\n"); -- cgit v1.2.3