Cosmetic fixes
Corresponding to flashrom svn r130 and coreboot v2 svn r2748.
Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
diff --git a/82802ab.c b/82802ab.c
index 1c98f5c..2784d7a 100644
--- a/82802ab.c
+++ b/82802ab.c
@@ -77,7 +77,6 @@
uint8_t wait_82802ab(volatile uint8_t *bios)
{
-
uint8_t status;
uint8_t id1, id2;
@@ -100,9 +99,10 @@
*(volatile uint8_t *)(bios + 0x5555) = 0xAA;
*(volatile uint8_t *)(bios + 0x2AAA) = 0x55;
*(volatile uint8_t *)(bios + 0x5555) = 0xF0;
- return status;
+ return status;
}
+
int erase_82802ab_block(struct flashchip *flash, int offset)
{
volatile uint8_t *bios = flash->virtual_memory + offset;
@@ -126,8 +126,10 @@
status = wait_82802ab(flash->virtual_memory);
//print_82802ab_status(status);
printf("DONE BLOCK 0x%x\n", offset);
- return (0);
+
+ return 0;
}
+
int erase_82802ab(struct flashchip *flash)
{
int i;
@@ -138,7 +140,8 @@
for (i = 0; i < total_size; i += flash->page_size)
erase_82802ab_block(flash, i);
printf("DONE ERASE\n");
- return (0);
+
+ return 0;
}
void write_page_82802ab(volatile uint8_t *bios, uint8_t *src,
@@ -152,7 +155,6 @@
*dst++ = *src++;
wait_82802ab(bios);
}
-
}
int write_82802ab(struct flashchip *flash, uint8_t *buf)
@@ -176,5 +178,6 @@
}
printf("\n");
protect_jedec(bios);
- return (0);
+
+ return 0;
}
diff --git a/am29f040b.c b/am29f040b.c
index e7f318b..d1c1f22 100644
--- a/am29f040b.c
+++ b/am29f040b.c
@@ -41,7 +41,7 @@
/* wait for Toggle bit ready */
toggle_ready_jedec(bios + address);
- return (0);
+ return 0;
}
static __inline__ int write_sector_29f040b(volatile uint8_t *bios,
@@ -68,7 +68,7 @@
printf("\b\b\b\b\b\b\b\b\b\b");
}
- return (0);
+ return 0;
}
int probe_29f040b(struct flashchip *flash)
@@ -108,7 +108,7 @@
myusec_delay(10);
toggle_ready_jedec(bios);
- return (0);
+ return 0;
}
int write_29f040b(struct flashchip *flash, uint8_t *buf)
@@ -131,5 +131,5 @@
}
printf("\n");
- return (0);
+ return 0;
}
diff --git a/board_enable.c b/board_enable.c
index 983fd18..e9066de 100644
--- a/board_enable.c
+++ b/board_enable.c
@@ -22,7 +22,7 @@
#include "flash.h"
/*
- * Helper functions for many Winbond superIOs of the w836xx range.
+ * Helper functions for many Winbond Super I/Os of the W836xx range.
*/
#define W836_INDEX 0x2E
#define W836_DATA 0x2F
@@ -40,7 +40,7 @@
outb(0xAA, W836_INDEX);
}
-/* General functions for read/writing WB SuperIOs */
+/* General functions for reading/writing Winbond Super I/Os. */
static unsigned char wbsio_read(unsigned char index)
{
outb(index, W836_INDEX);
@@ -53,8 +53,8 @@
outb(data, W836_DATA);
}
-static void
-wbsio_mask(unsigned char index, unsigned char data, unsigned char mask)
+static void wbsio_mask(unsigned char index, unsigned char data,
+ unsigned char mask)
{
unsigned char tmp;
@@ -63,14 +63,13 @@
outb(tmp | (data & mask), W836_DATA);
}
-/*
- * WinBond w83627hf: raise GPIO24.
+/**
+ * Winbond W83627HF: Raise GPIO24.
*
* Suited for:
- * * Agami Aruma
- * * IWILL DK8-HTX
+ * - Agami Aruma
+ * - IWILL DK8-HTX
*/
-
static int w83627hf_gpio24_raise(const char *name)
{
w836xx_ext_enter();
@@ -101,12 +100,11 @@
return 0;
}
-/*
+/**
* Suited for VIAs EPIA M and MII, and maybe other CLE266 based EPIAs.
*
- * We don't need to do this when using linuxbios, GPIO15 is never lowered there.
+ * We don't need to do this when using LinuxBIOS, GPIO15 is never lowered there.
*/
-
static int board_via_epia_m(const char *name)
{
struct pci_dev *dev;
@@ -135,12 +133,11 @@
return 0;
}
-/*
+/**
* Suited for:
- * ASUS A7V8X-MX SE and A7V400-MX: AMD K7 + VIA KM400A + VT8235
- * Tyan Tomcat K7M: AMD Geode NX + VIA KM400 + VT8237.
+ * - ASUS A7V8X-MX SE and A7V400-MX: AMD K7 + VIA KM400A + VT8235
+ * - Tyan Tomcat K7M: AMD Geode NX + VIA KM400 + VT8237.
*/
-
static int board_asus_a7v8x_mx(const char *name)
{
struct pci_dev *dev;
@@ -170,14 +167,13 @@
return 0;
}
-/*
+/**
* Suited for ASUS P5A.
*
* This is rather nasty code, but there's no way to do this cleanly.
* We're basically talking to some unknown device on SMBus, my guess
* is that it is the Winbond W83781D that lives near the DIP BIOS.
*/
-
static int board_asus_p5a(const char *name)
{
uint8_t tmp;
@@ -278,16 +274,14 @@
return 0;
}
-/*
- * We use 2 sets of ids here, you're free to choose which is which. This
- * to provide a very high degree of certainty when matching a board on
- * the basis of Subsystem/card ids. As not every vendor handles
- * subsystem/card ids in a sane manner.
+/**
+ * We use 2 sets of IDs here, you're free to choose which is which. This
+ * is to provide a very high degree of certainty when matching a board on
+ * the basis of subsystem/card IDs. As not every vendor handles
+ * subsystem/card IDs in a sane manner.
*
- * Keep the second set nulled if it should be ignored.
- *
+ * Keep the second set NULLed if it should be ignored.
*/
-
struct board_pciid_enable {
/* Any device, but make it sensible, like the isa bridge. */
uint16_t first_vendor;
@@ -331,10 +325,9 @@
{0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL} /* Keep this */
};
-/*
- * Match boards on linuxbios table gathered vendor and part name.
- * Require main pci-ids to match too as extra safety.
- *
+/**
+ * Match boards on LinuxBIOS table gathered vendor and part name.
+ * Require main PCI IDs to match too as extra safety.
*/
static struct board_pciid_enable *board_match_linuxbios_name(char *vendor,
char *part)
@@ -359,9 +352,9 @@
return NULL;
}
-/*
- * Match boards on pci ids and subsystem ids.
- * Second set of ids can be main only or missing completely.
+/**
+ * Match boards on PCI IDs and subsystem IDs.
+ * Second set of IDs can be main only or missing completely.
*/
static struct board_pciid_enable *board_match_pci_card_ids(void)
{
@@ -396,9 +389,6 @@
return NULL;
}
-/*
- *
- */
int board_flash_enable(char *vendor, char *part)
{
struct board_pciid_enable *board = NULL;
diff --git a/chipset_enable.c b/chipset_enable.c
index e3b0250..3b80149 100644
--- a/chipset_enable.c
+++ b/chipset_enable.c
@@ -112,6 +112,7 @@
printf("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", xbcs, new, name);
return -1;
}
+
return 0;
}
@@ -145,6 +146,7 @@
printf("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", bios_cntl, new, name);
return -1;
}
+
return 0;
}
@@ -158,14 +160,11 @@
return enable_flash_ich(dev, name, 0xdc);
}
-/*
- *
- */
static int enable_flash_vt823x(struct pci_dev *dev, char *name)
{
uint8_t val;
- /* ROM Write enable */
+ /* ROM write enable */
val = pci_read_byte(dev, 0x40);
val |= 0x10;
pci_write_byte(dev, 0x40, val);
@@ -221,6 +220,7 @@
printf("tried to set register 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x52, new, name);
return -1;
}
+
return 0;
}
@@ -243,6 +243,7 @@
printf("Stuck at 0x%x\n", newer);
return -1;
}
+
return 0;
}
@@ -275,6 +276,7 @@
printf("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x40, new, name);
return -1;
}
+
return 0;
}
@@ -308,6 +310,7 @@
printf("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x6d, new, name);
return -1;
}
+
return 0;
}
@@ -393,7 +396,6 @@
}
return 0;
-
}
static int enable_flash_ht1000(struct pci_dev *dev, char *name)
@@ -406,7 +408,7 @@
pci_write_byte(dev, 0x41, byte);
byte = pci_read_byte(dev, 0x43);
- byte |= (1<<4);
+ byte |= (1 << 4);
pci_write_byte(dev, 0x43, byte);
return 0;
@@ -473,9 +475,6 @@
{0x1166, 0x0205, "Broadcom HT-1000", enable_flash_ht1000},
};
-/*
- *
- */
int chipset_flash_enable(void)
{
struct pci_dev *dev = 0;
diff --git a/flashchips.c b/flashchips.c
index 2b486be..0437677 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -150,5 +150,3 @@
probe_jedec, erase_chip_jedec, write_49f002},
{NULL,}
};
-
-
diff --git a/flashrom.c b/flashrom.c
index 8423523..2aef991 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -49,12 +49,8 @@
struct pci_access *pacc; /* For board and chipset_enable */
int exclude_start_page, exclude_end_page;
int force = 0, verbose = 0;
-
int fd_mem;
-/*
- *
- */
struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device)
{
struct pci_dev *temp;
@@ -71,9 +67,6 @@
return NULL;
}
-/*
- *
- */
struct pci_dev *pci_card_find(uint16_t vendor, uint16_t device,
uint16_t card_vendor, uint16_t card_device)
{
@@ -163,6 +156,7 @@
flash++;
}
+
return NULL;
}
@@ -196,6 +190,7 @@
printf("\b\b\b\b\b\b\b\b\b\b ");
printf("- VERIFIED \n");
+
return 0;
}
diff --git a/jedec.c b/jedec.c
index 0a27eda..62c9be0 100644
--- a/jedec.c
+++ b/jedec.c
@@ -135,7 +135,7 @@
/* wait for Toggle bit ready */
toggle_ready_jedec(bios);
- return (0);
+ return 0;
}
int erase_block_jedec(volatile uint8_t *bios, unsigned int block)
@@ -158,7 +158,7 @@
/* wait for Toggle bit ready */
toggle_ready_jedec(bios);
- return (0);
+ return 0;
}
int erase_chip_jedec(struct flashchip *flash)
@@ -182,7 +182,7 @@
toggle_ready_jedec(bios);
- return (0);
+ return 0;
}
int write_page_write_jedec(volatile uint8_t *bios, uint8_t *src,
@@ -229,7 +229,7 @@
fprintf(stderr, " page %d failed!\n",
(unsigned int)(d - bios) / page_size);
}
- return (!ok);
+ return !ok;
}
int write_byte_program_jedec(volatile uint8_t *bios, uint8_t *src,
@@ -259,7 +259,7 @@
if (tried >= MAX_REFLASH_TRIES)
ok = 0;
- return (!ok);
+ return !ok;
}
int write_sector_jedec(volatile uint8_t *bios, uint8_t *src,
@@ -272,7 +272,7 @@
dst++, src++;
}
- return (0);
+ return 0;
}
int write_jedec(struct flashchip *flash, uint8_t *buf)
@@ -301,5 +301,5 @@
printf("\n");
protect_jedec(bios);
- return (0);
+ return 0;
}
diff --git a/layout.c b/layout.c
index 62715bd..6f87dd6 100644
--- a/layout.c
+++ b/layout.c
@@ -134,6 +134,7 @@
}
fclose(romlayout);
+
return 0;
}
@@ -155,6 +156,7 @@
}
printf("not found.\n");
// Not found. Error.
+
return -1;
}
diff --git a/lbtable.c b/lbtable.c
index 004e61c..57cc766 100644
--- a/lbtable.c
+++ b/lbtable.c
@@ -44,6 +44,7 @@
} value;
unsigned long sum;
unsigned long i;
+
/* In the most straight forward way possible,
* compute an ip style checksum.
*/
@@ -64,6 +65,7 @@
}
value.byte[0] = sum & 0xff;
value.byte[1] = (sum >> 8) & 0xff;
+
return (~value.word) & 0xFFFF;
}
@@ -78,10 +80,12 @@
{
struct lb_record *rec;
int count;
+
count = 0;
for_each_lbrec(head, rec) {
count++;
}
+
return count;
}
@@ -89,6 +93,7 @@
unsigned long end)
{
unsigned long addr;
+
/* For now be stupid.... */
for (addr = start; addr < end; addr += 16) {
struct lb_header *head =
@@ -123,6 +128,7 @@
return head;
};
+
return 0;
}
@@ -131,6 +137,7 @@
struct lb_mainboard *rec;
int max_size;
char vendor[256], part[256];
+
rec = (struct lb_mainboard *)ptr;
max_size = rec->size - sizeof(*rec);
printf("vendor id: %.*s part id: %.*s\n",
@@ -206,5 +213,6 @@
printf("No LinuxBIOS table found.\n");
return -1;
}
+
return 0;
}
diff --git a/m29f400bt.c b/m29f400bt.c
index eb97591..f409fec 100644
--- a/m29f400bt.c
+++ b/m29f400bt.c
@@ -100,7 +100,7 @@
myusec_delay(10);
toggle_ready_jedec(bios);
- return (0);
+ return 0;
}
int block_erase_m29f400bt(volatile uint8_t *bios, volatile uint8_t *dst)
@@ -118,7 +118,7 @@
myusec_delay(10);
toggle_ready_jedec(bios);
- return (0);
+ return 0;
}
int write_m29f400bt(struct flashchip *flash, uint8_t *buf)
@@ -173,7 +173,7 @@
printf("\n");
//protect_m29f400bt (bios);
- return (0);
+ return 0;
}
int write_linuxbios_m29f400bt(struct flashchip *flash, uint8_t *buf)
@@ -215,5 +215,5 @@
printf("\n");
//protect_m29f400bt (bios);
- return (0);
+ return 0;
}
diff --git a/msys_doc.c b/msys_doc.c
index b91c73a..74301da 100644
--- a/msys_doc.c
+++ b/msys_doc.c
@@ -134,23 +134,23 @@
&& id_0x55 == 0x55 && id_0xAA == 0xaa
#endif /* !MSYSTEMS_DOC_NO_55AA_CHECKING */
) {
- return (1);
+ return 1;
}
- return (0);
-} /* int probe_md2802(struct flashchip *flash) */
+ return 0;
+}
int read_md2802(struct flashchip *flash, uint8_t *buf)
{
-
- return (0);
-} /* int read_md2802(struct flashchip *flash, uint8_t *buf) */
+ return 0;
+}
int erase_md2802(struct flashchip *flash)
{
volatile uint8_t *bios = flash->virtual_memory;
- return (1);
+ return 1;
+
*(volatile uint8_t *)(bios + 0x5555) = 0xAA;
*(volatile uint8_t *)(bios + 0x2AAA) = 0x55;
*(volatile uint8_t *)(bios + 0x5555) = 0x80;
@@ -158,7 +158,7 @@
*(volatile uint8_t *)(bios + 0x5555) = 0xAA;
*(volatile uint8_t *)(bios + 0x2AAA) = 0x55;
*(volatile uint8_t *)(bios + 0x5555) = 0x10;
-} /* int erase_md2802(struct flashchip *flash) */
+}
int write_md2802(struct flashchip *flash, uint8_t *buf)
{
@@ -192,6 +192,7 @@
0: ready
-1: timeout expired
*/
+
static int doc_wait(volatile uint8_t *bios, int timeout)
{
int i = 20;
@@ -210,8 +211,8 @@
return (-1);
}
- return (0);
-} /* static int doc_wait(volatile uint8_t *bios, int timeout) */
+ return 0;
+}
static uint8_t doc_read_docstatus(volatile uint8_t *bios)
{
@@ -219,7 +220,7 @@
doc_read_2nop(bios);
return (doc_read(bios, _DOCStatus));
-} /* static uint8_t doc_read_docstatus(volatile uint8_t *bios) */
+}
static uint8_t doc_read_chipid(volatile uint8_t *bios)
{
@@ -227,7 +228,7 @@
doc_read_2nop(bios);
return (doc_read(bios, _ChipID));
-} /* static uint8_t doc_read_chipid(volatile uint8_t *bios) */
+}
static uint8_t doc_read_cdsncontrol(volatile uint8_t *bios)
{
@@ -240,11 +241,11 @@
value = doc_read(bios, _CDSNControl);
doc_read_2nop(bios);
- return (value);
-} /* static uint8_t doc_read_chipid(volatile char *bios) */
+ return value;
+}
static void doc_write_cdsncontrol(volatile uint8_t *bios, uint8_t data)
{
doc_write(data, bios, _CDSNControl);
doc_read_4nop(bios);
-} /* static void doc_write_chipid(volatile char *bios, uint8_t data) */
+}
diff --git a/mx29f002.c b/mx29f002.c
index 31e924a..ac363ef 100644
--- a/mx29f002.c
+++ b/mx29f002.c
@@ -79,7 +79,7 @@
*(bios + 0x3bfff) = 0x30;
#endif
- return (0);
+ return 0;
}
int write_29f002(struct flashchip *flash, uint8_t *buf)
@@ -113,5 +113,5 @@
#endif
printf("\n");
- return (0);
+ return 0;
}
diff --git a/pm49fl004.c b/pm49fl004.c
index 42442cf..a2e22b9 100644
--- a/pm49fl004.c
+++ b/pm49fl004.c
@@ -51,5 +51,5 @@
}
printf("\n");
- return (0);
+ return 0;
}
diff --git a/sharplhf00l04.c b/sharplhf00l04.c
index 1c93cc6..86d8799 100644
--- a/sharplhf00l04.c
+++ b/sharplhf00l04.c
@@ -77,7 +77,6 @@
uint8_t wait_lhf00l04(volatile uint8_t *bios)
{
-
uint8_t status;
uint8_t id1, id2;
@@ -100,9 +99,10 @@
*(volatile uint8_t *)(bios + 0x5555) = 0xAA;
*(volatile uint8_t *)(bios + 0x2AAA) = 0x55;
*(volatile uint8_t *)(bios + 0x5555) = 0xF0;
- return status;
+ return status;
}
+
int erase_lhf00l04_block(struct flashchip *flash, int offset)
{
volatile uint8_t *bios = flash->virtual_memory + offset;
@@ -128,8 +128,10 @@
status = wait_lhf00l04(flash->virtual_memory);
print_lhf00l04_status(status);
printf("DONE BLOCK 0x%x\n", offset);
- return (0);
+
+ return 0;
}
+
int erase_lhf00l04(struct flashchip *flash)
{
int i;
@@ -140,7 +142,8 @@
for (i = 0; i < total_size; i += flash->page_size)
erase_lhf00l04_block(flash, i);
printf("DONE ERASE\n");
- return (0);
+
+ return 0;
}
void write_page_lhf00l04(volatile uint8_t *bios, uint8_t *src,
@@ -154,7 +157,6 @@
*dst++ = *src++;
wait_lhf00l04(bios);
}
-
}
int write_lhf00l04(struct flashchip *flash, uint8_t *buf)
@@ -178,5 +180,6 @@
}
printf("\n");
protect_jedec(bios);
- return (0);
+
+ return 0;
}
diff --git a/sst28sf040.c b/sst28sf040.c
index 80412c5..7f14f49 100644
--- a/sst28sf040.c
+++ b/sst28sf040.c
@@ -73,7 +73,7 @@
/* wait for Toggle bit ready */
toggle_ready_jedec(bios);
- return (0);
+ return 0;
}
static __inline__ int write_sector_28sf040(volatile uint8_t *bios,
@@ -98,7 +98,7 @@
toggle_ready_jedec(bios);
}
- return (0);
+ return 0;
}
int probe_28sf040(struct flashchip *flash)
@@ -137,7 +137,7 @@
myusec_delay(10);
toggle_ready_jedec(bios);
- return (0);
+ return 0;
}
int write_28sf040(struct flashchip *flash, uint8_t *buf)
@@ -164,5 +164,5 @@
protect_28sf040(bios);
- return (0);
+ return 0;
}
diff --git a/sst39sf020.c b/sst39sf020.c
index bfcead6..197d612 100644
--- a/sst39sf020.c
+++ b/sst39sf020.c
@@ -42,7 +42,7 @@
/* wait for Toggle bit ready */
toggle_ready_jedec(bios);
- return (0);
+ return 0;
}
int write_39sf020(struct flashchip *flash, uint8_t *buf)
@@ -65,5 +65,5 @@
}
printf("\n");
- return (0);
+ return 0;
}
diff --git a/sst49lf040.c b/sst49lf040.c
index 884895e..e5af545 100644
--- a/sst49lf040.c
+++ b/sst49lf040.c
@@ -24,6 +24,7 @@
* TODO: Consilidated to standard JEDEC code.
*
*/
+
#include <stdio.h>
#include "flash.h"
@@ -39,6 +40,7 @@
* for the 49lf040. Use sector-erase instead */
erase_sector_jedec(bios, i * page_size);
}
+
return 0;
}
@@ -67,5 +69,5 @@
}
printf("\n");
- return (0);
+ return 0;
}
diff --git a/sst49lfxxxc.c b/sst49lfxxxc.c
index 8480877..2ca5842 100644
--- a/sst49lfxxxc.c
+++ b/sst49lfxxxc.c
@@ -71,7 +71,7 @@
//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);
+ return 0;
}
static __inline__ int erase_sector_49lfxxxc(volatile uint8_t *bios,
@@ -91,7 +91,7 @@
}
} while (!(status & STATUS_WSMS));
- return (0);
+ return 0;
}
static __inline__ int write_sector_49lfxxxc(volatile uint8_t *bios,
@@ -124,7 +124,7 @@
} while (!(status & STATUS_WSMS));
}
- return (0);
+ return 0;
}
int probe_49lfxxxc(struct flashchip *flash)
@@ -164,7 +164,8 @@
return (-1);
*bios = RESET;
- return (0);
+
+ return 0;
}
int write_49lfxxxc(struct flashchip *flash, uint8_t *buf)
@@ -189,5 +190,6 @@
printf("\n");
*bios = RESET;
- return (0);
+
+ return 0;
}
diff --git a/sst_fwhub.c b/sst_fwhub.c
index 9e4539b..c7266e8 100644
--- a/sst_fwhub.c
+++ b/sst_fwhub.c
@@ -56,7 +56,7 @@
erase_block_jedec(flash->virtual_memory, offset);
toggle_ready_jedec(flash->virtual_memory);
- return (0);
+ return 0;
}
int erase_sst_fwhub(struct flashchip *flash)
@@ -66,7 +66,8 @@
for (i = 0; i < total_size; i += flash->page_size)
erase_sst_fwhub_block(flash, i);
- return (0);
+
+ return 0;
}
int write_sst_fwhub(struct flashchip *flash, uint8_t *buf)
@@ -95,5 +96,6 @@
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");
- return (0);
+
+ return 0;
}
diff --git a/w49f002u.c b/w49f002u.c
index 66111fd..9d4d5c1 100644
--- a/w49f002u.c
+++ b/w49f002u.c
@@ -49,5 +49,5 @@
}
printf("\n");
- return (0);
+ return 0;
}