Author: uwe Date: 2007-04-01 21:44:21 +0200 (Sun, 01 Apr 2007) New Revision: 2577
Modified: trunk/LinuxBIOSv2/util/flashrom/82802ab.h trunk/LinuxBIOSv2/util/flashrom/am29f040b.c trunk/LinuxBIOSv2/util/flashrom/flash.h trunk/LinuxBIOSv2/util/flashrom/jedec.h trunk/LinuxBIOSv2/util/flashrom/layout.h trunk/LinuxBIOSv2/util/flashrom/msys_doc.h trunk/LinuxBIOSv2/util/flashrom/mx29f002.c trunk/LinuxBIOSv2/util/flashrom/pm49fl004.c trunk/LinuxBIOSv2/util/flashrom/sharplhf00l04.h trunk/LinuxBIOSv2/util/flashrom/sst39sf020.c trunk/LinuxBIOSv2/util/flashrom/sst49lf040.c trunk/LinuxBIOSv2/util/flashrom/sst_fwhub.c trunk/LinuxBIOSv2/util/flashrom/udelay.c trunk/LinuxBIOSv2/util/flashrom/w49f002u.c Log: Coding style fixes (trivial).
Signed-off-by: Uwe Hermann uwe@hermann-uwe.de Acked-by: Uwe Hermann uwe@hermann-uwe.de
Modified: trunk/LinuxBIOSv2/util/flashrom/82802ab.h =================================================================== --- trunk/LinuxBIOSv2/util/flashrom/82802ab.h 2007-04-01 17:24:03 UTC (rev 2576) +++ trunk/LinuxBIOSv2/util/flashrom/82802ab.h 2007-04-01 19:44:21 UTC (rev 2577) @@ -21,7 +21,8 @@ } }
-extern __inline__ void data_polling_82802ab(volatile uint8_t *dst, uint8_t data) +extern __inline__ void data_polling_82802ab(volatile uint8_t *dst, + uint8_t data) { unsigned int i = 0; uint8_t tmp; @@ -38,9 +39,9 @@
extern __inline__ void protect_82802ab(volatile uint8_t *bios) { - *(volatile uint8_t *) (bios + 0x5555) = 0xAA; - *(volatile uint8_t *) (bios + 0x2AAA) = 0x55; - *(volatile uint8_t *) (bios + 0x5555) = 0xA0; + *(volatile uint8_t *)(bios + 0x5555) = 0xAA; + *(volatile uint8_t *)(bios + 0x2AAA) = 0x55; + *(volatile uint8_t *)(bios + 0x5555) = 0xA0;
usleep(200); }
Modified: trunk/LinuxBIOSv2/util/flashrom/am29f040b.c =================================================================== --- trunk/LinuxBIOSv2/util/flashrom/am29f040b.c 2007-04-01 17:24:03 UTC (rev 2576) +++ trunk/LinuxBIOSv2/util/flashrom/am29f040b.c 2007-04-01 19:44:21 UTC (rev 2577) @@ -54,9 +54,9 @@ int i;
for (i = 0; i < page_size; i++) { - if( (i & 0xfff) == 0xfff ) - printf("0x%08lx", (unsigned long) dst - - (unsigned long) bios); + if ((i & 0xfff) == 0xfff) + printf("0x%08lx", (unsigned long)dst - + (unsigned long)bios);
*(bios + 0x555) = 0xAA; *(bios + 0x2AA) = 0x55; @@ -66,7 +66,7 @@ /* wait for Toggle bit ready */ toggle_ready_jedec(bios);
- if( (i & 0xfff) == 0xfff ) + if ((i & 0xfff) == 0xfff) printf("\b\b\b\b\b\b\b\b\b\b"); }
@@ -116,8 +116,8 @@ int write_29f040b(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;
printf("Programming page ");
Modified: trunk/LinuxBIOSv2/util/flashrom/flash.h =================================================================== --- trunk/LinuxBIOSv2/util/flashrom/flash.h 2007-04-01 17:24:03 UTC (rev 2576) +++ trunk/LinuxBIOSv2/util/flashrom/flash.h 2007-04-01 19:44:21 UTC (rev 2577) @@ -21,7 +21,6 @@ * */
- #ifndef __FLASH_H__ #define __FLASH_H__ 1
@@ -41,10 +40,10 @@ int total_size; int page_size;
- int (*probe) (struct flashchip * flash); - int (*erase) (struct flashchip * flash); - int (*write) (struct flashchip * flash, uint8_t *buf); - int (*read) (struct flashchip * flash, uint8_t *buf); + int (*probe) (struct flashchip *flash); + int (*erase) (struct flashchip *flash); + int (*write) (struct flashchip *flash, uint8_t *buf); + int (*read) (struct flashchip *flash, uint8_t *buf);
int fd_mem; volatile uint8_t *virt_addr_2; @@ -52,73 +51,73 @@
extern struct flashchip flashchips[];
-#define AMD_ID 0x01 -#define AM_29F040B 0xA4 -#define AM_29F016D 0xAD +#define AMD_ID 0x01 +#define AM_29F040B 0xA4 +#define AM_29F016D 0xAD
-#define ASD_ID 0x25 -#define ASD_AE49F2008 0x52 +#define ASD_ID 0x25 +#define ASD_AE49F2008 0x52
-#define ATMEL_ID 0x1F /* Winbond Manufacture ID code */ -#define AT_29C040A 0xA4 /* Winbond w29c020c device code */ +#define ATMEL_ID 0x1F /* Winbond Manufacture ID code */ +#define AT_29C040A 0xA4 /* Winbond w29c020c device code */
-#define MX_ID 0xC2 -#define MX_29F002 0xB0 +#define MX_ID 0xC2 +#define MX_29F002 0xB0
-#define SHARP_ID 0xB0 -#define SHARP_LHF00L04 0xCF +#define SHARP_ID 0xB0 +#define SHARP_LHF00L04 0xCF
-#define SST_ID 0xBF /* SST Manufacturer ID code */ -#define SST_29EE020A 0x10 /* SST 29EE020 device */ -#define SST_28SF040 0x04 /* SST 29EE040 device */ -#define SST_39SF010 0xB5 /* SST 39SF010A device */ -#define SST_39SF020 0xB6 /* SST 39SF020A device */ -#define SST_39SF040 0xB7 /* SST 39SF040 device */ -#define SST_39VF020 0xD6 /* SST 39VF020 device */ -#define SST_49LF040B 0x50 /* SST 49LF040B device */ -#define SST_49LF040 0x51 /* SST 49LF040 device */ -#define SST_49LF020A 0x52 /* SST 49LF020A device */ -#define SST_49LF080A 0x5B /* SST 48LF080A device */ -#define SST_49LF002A 0x57 /* SST 49LF002A device */ -#define SST_49LF003A 0x1B /* SST 49LF003A device */ -#define SST_49LF004A 0x60 /* SST 49LF004A device */ -#define SST_49LF008A 0x5A /* SST 49LF008A device */ -#define SST_49LF004C 0x54 /* SST 49LF004C device */ -#define SST_49LF008C 0x59 /* SST 49LF008C device */ -#define SST_49LF016C 0x5C /* SST 49LF016C device */ -#define SST_49LF160C 0x4C /* SST 49LF160C device */ +#define SST_ID 0xBF /* SST Manufacturer ID code */ +#define SST_29EE020A 0x10 /* SST 29EE020 device */ +#define SST_28SF040 0x04 /* SST 29EE040 device */ +#define SST_39SF010 0xB5 /* SST 39SF010A device */ +#define SST_39SF020 0xB6 /* SST 39SF020A device */ +#define SST_39SF040 0xB7 /* SST 39SF040 device */ +#define SST_39VF020 0xD6 /* SST 39VF020 device */ +#define SST_49LF040B 0x50 /* SST 49LF040B device */ +#define SST_49LF040 0x51 /* SST 49LF040 device */ +#define SST_49LF020A 0x52 /* SST 49LF020A device */ +#define SST_49LF080A 0x5B /* SST 48LF080A device */ +#define SST_49LF002A 0x57 /* SST 49LF002A device */ +#define SST_49LF003A 0x1B /* SST 49LF003A device */ +#define SST_49LF004A 0x60 /* SST 49LF004A device */ +#define SST_49LF008A 0x5A /* SST 49LF008A device */ +#define SST_49LF004C 0x54 /* SST 49LF004C device */ +#define SST_49LF008C 0x59 /* SST 49LF008C device */ +#define SST_49LF016C 0x5C /* SST 49LF016C device */ +#define SST_49LF160C 0x4C /* SST 49LF160C device */
-#define PMC_ID 0x9D /* PMC Manufacturer ID code */ -#define PMC_49FL002 0x6D /* PMC 49FL002 device code */ -#define PMC_49FL004 0x6E /* PMC 49FL004 device code */ +#define PMC_ID 0x9D /* PMC Manufacturer ID code */ +#define PMC_49FL002 0x6D /* PMC 49FL002 device code */ +#define PMC_49FL004 0x6E /* PMC 49FL004 device code */
-#define WINBOND_ID 0xDA /* Winbond Manufacture ID code */ -#define W_29C011 0xC1 /* Winbond w29c011 device code */ -#define W_29C020C 0x45 /* Winbond w29c020c device code */ -#define W_39V040A 0x3D /* Winbond w39v040a device code */ -#define W_39V040B 0x54 /* Winbond w39v040b device code */ -#define W_39V080A 0xD0 /* Winbond w39v080a device code */ -#define W_49F002U 0x0B /* Winbond w49F002u device code */ -#define W_49V002A 0xB0 /* Winbond W49V002A device code */ -#define W_49V002FA 0x32 /* Winbond W49V002FA device code */ +#define WINBOND_ID 0xDA /* Winbond Manufacture ID code */ +#define W_29C011 0xC1 /* Winbond w29c011 device code */ +#define W_29C020C 0x45 /* Winbond w29c020c device code */ +#define W_39V040A 0x3D /* Winbond w39v040a device code */ +#define W_39V040B 0x54 /* Winbond w39v040b device code */ +#define W_39V080A 0xD0 /* Winbond w39v080a device code */ +#define W_49F002U 0x0B /* Winbond w49F002u device code */ +#define W_49V002A 0xB0 /* Winbond W49V002A device code */ +#define W_49V002FA 0x32 /* Winbond W49V002FA device code */
-#define ST_ID 0x20 -#define ST_M29F040B 0xE2 -#define ST_M29F400BT 0xD5 +#define ST_ID 0x20 +#define ST_M29F040B 0xE2 +#define ST_M29F400BT 0xD5
-#define EMST_ID 0x8c /* EMST - Elite Flash Storage Inc. Manufacturer ID code */ -#define EMST_F49B002UA 0x00 /* EMST F49B002UA device code */ +#define EMST_ID 0x8c /* EMST - Elite Flash Storage Inc. Manufacturer ID code */ +#define EMST_F49B002UA 0x00 /* EMST F49B002UA device code */
-#define MSYSTEMS_ID 0x156f -#define MSYSTEMS_MD2200 0xdb /* ? */ -#define MSYSTEMS_MD2800 0x30 /* hmm -- both 0x30 */ -#define MSYSTEMS_MD2802 0x30 /* hmm -- both 0x30 */ +#define MSYSTEMS_ID 0x156f +#define MSYSTEMS_MD2200 0xdb /* ? */ +#define MSYSTEMS_MD2800 0x30 /* hmm -- both 0x30 */ +#define MSYSTEMS_MD2802 0x30 /* hmm -- both 0x30 */
-#define SYNCMOS_ID 0x40 /* SyncMOS ID */ -#define S29C51001T 0x01 /* SyncMOS S29C51001T/B */ -#define S29C51002T 0x02 /* SyncMOS S29C51002T/B */ -#define S29C51004T 0x03 /* SyncMOS S29C51004T/B */ -#define S29C31004T 0x63 /* SyncMOS S29C31004T */ +#define SYNCMOS_ID 0x40 /* SyncMOS ID */ +#define S29C51001T 0x01 /* SyncMOS S29C51001T/B */ +#define S29C51002T 0x02 /* SyncMOS S29C51002T/B */ +#define S29C51004T 0x03 /* SyncMOS S29C51004T/B */ +#define S29C31004T 0x63 /* SyncMOS S29C31004T */
/* function prototypes from udelay.h */
Modified: trunk/LinuxBIOSv2/util/flashrom/jedec.h =================================================================== --- trunk/LinuxBIOSv2/util/flashrom/jedec.h 2007-04-01 17:24:03 UTC (rev 2576) +++ trunk/LinuxBIOSv2/util/flashrom/jedec.h 2007-04-01 19:44:21 UTC (rev 2577) @@ -9,8 +9,7 @@ extern int erase_sector_jedec(volatile uint8_t *bios, unsigned int page); extern int erase_block_jedec(volatile uint8_t *bios, unsigned int page); extern int write_sector_jedec(volatile uint8_t *bios, uint8_t *src, - volatile uint8_t *dst, - unsigned int page_size); + volatile uint8_t *dst, unsigned int page_size);
extern __inline__ void toggle_ready_jedec(volatile uint8_t *dst) { @@ -45,21 +44,21 @@
extern __inline__ void unprotect_jedec(volatile uint8_t *bios) { - *(volatile uint8_t *) (bios + 0x5555) = 0xAA; - *(volatile uint8_t *) (bios + 0x2AAA) = 0x55; - *(volatile uint8_t *) (bios + 0x5555) = 0x80; - *(volatile uint8_t *) (bios + 0x5555) = 0xAA; - *(volatile uint8_t *) (bios + 0x2AAA) = 0x55; - *(volatile uint8_t *) (bios + 0x5555) = 0x20; + *(volatile uint8_t *)(bios + 0x5555) = 0xAA; + *(volatile uint8_t *)(bios + 0x2AAA) = 0x55; + *(volatile uint8_t *)(bios + 0x5555) = 0x80; + *(volatile uint8_t *)(bios + 0x5555) = 0xAA; + *(volatile uint8_t *)(bios + 0x2AAA) = 0x55; + *(volatile uint8_t *)(bios + 0x5555) = 0x20;
usleep(200); }
extern __inline__ void protect_jedec(volatile uint8_t *bios) { - *(volatile uint8_t *) (bios + 0x5555) = 0xAA; - *(volatile uint8_t *) (bios + 0x2AAA) = 0x55; - *(volatile uint8_t *) (bios + 0x5555) = 0xA0; + *(volatile uint8_t *)(bios + 0x5555) = 0xAA; + *(volatile uint8_t *)(bios + 0x2AAA) = 0x55; + *(volatile uint8_t *)(bios + 0x5555) = 0xA0;
usleep(200); }
Modified: trunk/LinuxBIOSv2/util/flashrom/layout.h =================================================================== --- trunk/LinuxBIOSv2/util/flashrom/layout.h 2007-04-01 17:24:03 UTC (rev 2576) +++ trunk/LinuxBIOSv2/util/flashrom/layout.h 2007-04-01 19:44:21 UTC (rev 2577) @@ -6,5 +6,4 @@ int find_romentry(char *name); int handle_romentries(uint8_t *buffer, uint8_t *content);
- #endif /* !__LAYOUT_H__ */
Modified: trunk/LinuxBIOSv2/util/flashrom/msys_doc.h =================================================================== --- trunk/LinuxBIOSv2/util/flashrom/msys_doc.h 2007-04-01 17:24:03 UTC (rev 2576) +++ trunk/LinuxBIOSv2/util/flashrom/msys_doc.h 2007-04-01 19:44:21 UTC (rev 2577) @@ -19,13 +19,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
- - #ifndef __MSYS_DOC_H__ #define __MSYS_DOC_H__ 1
- - /* idea from include/linux/mtd/doc2000.h */ /* registers with __ should not be read/written directly */ #define MSYSTEMS_DOC_R__ChipID 0x1000 @@ -66,8 +62,6 @@ #define MSYSTEMS_DOC_R_CDSNIO_BASE 0x0800 #define MSYSTEMS_DOC_W_CDSNIO_BASE 0x0800
- - #define doc_read(base,reg) \ (*(volatile uint8_t *)(base + MSYSTEMS_DOC_R_##reg))
@@ -98,13 +92,9 @@ #define doc_toggle(base) /* 0, 1, 0, 1, 0, 1, ... if a doc is present */ \ ( (doc_read(base, ECCConfiguration) & 0x04) >> 2 )
- - extern int probe_md2802(struct flashchip *flash); extern int read_md2802(struct flashchip *flash, uint8_t *buf); extern int erase_md2802(struct flashchip *flash); extern int write_md2802(struct flashchip *flash, uint8_t *buf);
- - #endif /* !__MSYS_DOC_H__ */
Modified: trunk/LinuxBIOSv2/util/flashrom/mx29f002.c =================================================================== --- trunk/LinuxBIOSv2/util/flashrom/mx29f002.c 2007-04-01 17:24:03 UTC (rev 2576) +++ trunk/LinuxBIOSv2/util/flashrom/mx29f002.c 2007-04-01 19:44:21 UTC (rev 2577) @@ -40,8 +40,8 @@ *(bios + 0x2AAA) = 0x55; *(bios + 0x5555) = 0x90;
- id1 = *(volatile uint8_t *) bios; - id2 = *(volatile uint8_t *) (bios + 0x01); + id1 = *(volatile uint8_t *)bios; + id2 = *(volatile uint8_t *)(bios + 0x01);
*bios = 0xF0;
@@ -101,7 +101,7 @@ for (i = 0; i < total_size; i++) { /* write to the sector */ if ((i & 0xfff) == 0) - printf("address: 0x%08lx", (unsigned long) i); + printf("address: 0x%08lx", (unsigned long)i); *(bios + 0x5555) = 0xAA; *(bios + 0x2AAA) = 0x55; *(bios + 0x5555) = 0xA0;
Modified: trunk/LinuxBIOSv2/util/flashrom/pm49fl004.c =================================================================== --- trunk/LinuxBIOSv2/util/flashrom/pm49fl004.c 2007-04-01 17:24:03 UTC (rev 2576) +++ trunk/LinuxBIOSv2/util/flashrom/pm49fl004.c 2007-04-01 19:44:21 UTC (rev 2577) @@ -32,15 +32,15 @@ int write_49fl004(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; - + printf("Programming Page: "); for (i = 0; i < total_size / page_size; i++) { - if( (i>=exclude_start_page) && (i<exclude_end_page)) + if ((i >= exclude_start_page) && (i < exclude_end_page)) continue; - + /* erase the page before programming */ erase_block_jedec(bios, i * page_size);
Modified: trunk/LinuxBIOSv2/util/flashrom/sharplhf00l04.h =================================================================== --- trunk/LinuxBIOSv2/util/flashrom/sharplhf00l04.h 2007-04-01 17:24:03 UTC (rev 2576) +++ trunk/LinuxBIOSv2/util/flashrom/sharplhf00l04.h 2007-04-01 19:44:21 UTC (rev 2577) @@ -20,7 +20,8 @@ } }
-extern __inline__ void data_polling_lhf00l04(volatile uint8_t *dst, uint8_t data) +extern __inline__ void data_polling_lhf00l04(volatile uint8_t *dst, + uint8_t data) { unsigned int i = 0; uint8_t tmp; @@ -37,9 +38,9 @@
extern __inline__ void protect_lhf00l04(volatile uint8_t *bios) { - *(volatile uint8_t *) (bios + 0x5555) = 0xAA; - *(volatile uint8_t *) (bios + 0x2AAA) = 0x55; - *(volatile uint8_t *) (bios + 0x5555) = 0xA0; + *(volatile uint8_t *)(bios + 0x5555) = 0xAA; + *(volatile uint8_t *)(bios + 0x2AAA) = 0x55; + *(volatile uint8_t *)(bios + 0x5555) = 0xA0;
usleep(200); }
Modified: trunk/LinuxBIOSv2/util/flashrom/sst39sf020.c =================================================================== --- trunk/LinuxBIOSv2/util/flashrom/sst39sf020.c 2007-04-01 17:24:03 UTC (rev 2576) +++ trunk/LinuxBIOSv2/util/flashrom/sst39sf020.c 2007-04-01 19:44:21 UTC (rev 2577) @@ -50,8 +50,8 @@ int write_39sf020(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;
erase_chip_jedec(flash);
Modified: trunk/LinuxBIOSv2/util/flashrom/sst49lf040.c =================================================================== --- trunk/LinuxBIOSv2/util/flashrom/sst49lf040.c 2007-04-01 17:24:03 UTC (rev 2576) +++ trunk/LinuxBIOSv2/util/flashrom/sst49lf040.c 2007-04-01 19:44:21 UTC (rev 2577) @@ -31,16 +31,16 @@
int erase_49lf040(struct flashchip *flash) { - int i; - int total_size = flash->total_size * 1024; - int page_size = flash->page_size; - volatile uint8_t *bios = flash->virt_addr; + int i; + int total_size = flash->total_size * 1024; + int page_size = flash->page_size; + volatile uint8_t *bios = flash->virt_addr;
- for (i = 0; i < total_size / page_size; i++) { + for (i = 0; i < total_size / page_size; i++) { /* Chip erase only works in parallel programming mode * for the 49lf040. Use sector-erase instead */ erase_sector_jedec(bios, i * page_size); - } + } return 0; }
@@ -60,7 +60,7 @@
/* write to the sector */ printf("%04d at address: 0x%08x ", i, i * page_size); - + write_sector_jedec(bios, buf + i * page_size, bios + i * page_size, page_size);
Modified: trunk/LinuxBIOSv2/util/flashrom/sst_fwhub.c =================================================================== --- trunk/LinuxBIOSv2/util/flashrom/sst_fwhub.c 2007-04-01 17:24:03 UTC (rev 2576) +++ trunk/LinuxBIOSv2/util/flashrom/sst_fwhub.c 2007-04-01 19:44:21 UTC (rev 2577) @@ -90,15 +90,15 @@ int write_sst_fwhub(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;
// FIXME: We want block wide erase instead of ironing the whole chip erase_sst_fwhub(flash); - + // dumb check if erase was successful. - for (i=0; i < total_size; i++) { + for (i = 0; i < total_size; i++) { if (bios[i] != 0xff) { printf("ERASE FAILED\n"); return -1;
Modified: trunk/LinuxBIOSv2/util/flashrom/udelay.c =================================================================== --- trunk/LinuxBIOSv2/util/flashrom/udelay.c 2007-04-01 17:24:03 UTC (rev 2576) +++ trunk/LinuxBIOSv2/util/flashrom/udelay.c 2007-04-01 19:44:21 UTC (rev 2577) @@ -8,7 +8,7 @@ void myusec_delay(int time) { volatile unsigned long i; - for (i = 0; i < time * micro; i++); + for (i = 0; i < time * micro; i++) ; }
void myusec_calibrate_delay() @@ -34,5 +34,5 @@ // compute one microsecond. That will be count / time micro = count / timeusec;
- printf_debug("%ldM loops per second\n", (unsigned long) micro); + printf_debug("%ldM loops per second\n", (unsigned long)micro); }
Modified: trunk/LinuxBIOSv2/util/flashrom/w49f002u.c =================================================================== --- trunk/LinuxBIOSv2/util/flashrom/w49f002u.c 2007-04-01 17:24:03 UTC (rev 2576) +++ trunk/LinuxBIOSv2/util/flashrom/w49f002u.c 2007-04-01 19:44:21 UTC (rev 2577) @@ -34,8 +34,8 @@ int write_49f002(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;
erase_chip_jedec(flash);