Cosmetic changes and coding style fixes by running 'indent', with some
authorUwe Hermann <uwe@hermann-uwe.de>
Thu, 20 Mar 2008 01:11:28 +0000 (01:11 +0000)
committerUwe Hermann <uwe@hermann-uwe.de>
Thu, 20 Mar 2008 01:11:28 +0000 (01:11 +0000)
manual fixups afterwards (trivial).

No functionality changes, compile-tested.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3174 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

payloads/coreinfo/Makefile
payloads/coreinfo/coreboot_module.c
payloads/coreinfo/coreinfo.c
payloads/coreinfo/coreinfo.h
payloads/coreinfo/cpuinfo_module.c
payloads/coreinfo/pci_module.c

index 44317bd0b4a6c03fe360032f40d9f4492bd64c4c..e11278da5a49d06c3f04e72f809fef1191179b20 100644 (file)
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 ##
 
-CC=gcc
+CC = gcc
 CROSS_CFLAGS = -m32
 
 INCLUDES = -I../libpayload/include 
 INCLUDES += -I$(shell $(CC) $(CROSS_CFLAGS) -print-search-dirs | head -n 1 | cut -d' ' -f2)include
 
-LIBPAYLOAD=../libpayload/libpayload.a
-LIBGCC:=$(shell $(CC) $(CROSS_CFLAGS) -print-libgcc-file-name)
+LIBPAYLOAD = ../libpayload/libpayload.a
+LIBGCC := $(shell $(CC) $(CROSS_CFLAGS) -print-libgcc-file-name)
 CFLAGS := -Werror -fno-stack-protector -nostdinc $(INCLUDES)
 
 MODULES = cpuinfo_module.o cpuid.o pci_module.o coreboot_module.o
@@ -34,12 +34,12 @@ TARGET  = coreinfo.elf
 all: $(TARGET)
 
 clean:
-       @ rm -f $(TARGET) $(MODULES) $(OBJECTS)
+       @rm -f $(TARGET) $(MODULES) $(OBJECTS)
 
 $(TARGET): $(OBJECTS) $(MODULES)
-       #ld --verbose -T ../libpayload/libpayload.ldscript -o $@ $(OBJECTS) --whole-archive $(LIBPAYLOAD) --no-whole-archive $(LIBGCC)
+       @#ld --verbose -T ../libpayload/libpayload.ldscript -o $@ $(OBJECTS) --whole-archive $(LIBPAYLOAD) --no-whole-archive $(LIBGCC)
        ld -T ../libpayload/libpayload.ldscript -o $@ $(OBJECTS) $(MODULES) ../libpayload/i386/head.o $(LIBPAYLOAD) $(LIBGCC)
-       @ strip $@
+       @strip $@
 
 .S.o:
        $(AS) --32 -o $@ $<
index 324eb948bfc8f6e29cb254af6559523ab0818614..906833eab3a7c4e0435df56cf6cd92e5415eb33f 100644 (file)
@@ -32,14 +32,14 @@ static struct {
        char part[32];
 
        char strings[10][64];
-       
+
        struct cb_serial serial;
        struct cb_console console;
 } cb_info;
 
 static int tables_good = 0;
 
-int coreboot_module_redraw(WINDOW *win) 
+int coreboot_module_redraw(WINDOW *win)
 {
        int row = 2;
        int i;
@@ -50,13 +50,13 @@ int coreboot_module_redraw(WINDOW *win)
                mvwprintw(win, row++, 2, "No Coreboot tables were found");
                return 0;
        }
-               
+
        mvwprintw(win, row++, 2, "Vendor: %s", cb_info.vendor);
        mvwprintw(win, row++, 2, "Part: %s", cb_info.part);
 
-       mvwprintw(win, row++, 2, "Version: %s%s", 
-                cb_info.strings[CB_TAG_VERSION - 0x4],
-                cb_info.strings[CB_TAG_EXTRA_VERSION - 0x4]);
+       mvwprintw(win, row++, 2, "Version: %s%s",
+                 cb_info.strings[CB_TAG_VERSION - 0x4],
+                 cb_info.strings[CB_TAG_EXTRA_VERSION - 0x4]);
 
        mvwprintw(win, row++, 2, "Built: %s (%s@%s.%s)",
                  cb_info.strings[CB_TAG_BUILD - 0x4],
@@ -66,13 +66,13 @@ int coreboot_module_redraw(WINDOW *win)
 
        if (cb_info.serial.tag != 0x0) {
                mvwprintw(win, row++, 2, "Serial Port I/O base: 0x%x",
-                        cb_info.serial.ioport);
+                         cb_info.serial.ioport);
        }
 
        if (cb_info.console.tag != 0x0) {
                mvwprintw(win, row++, 2, "Default Output Console: ");
-               
-               switch(cb_info.console.type) {
+
+               switch (cb_info.console.type) {
                case CB_TAG_CONSOLE_SERIAL8250:
                        wprintw(win, "Serial Port");
                        break;
@@ -96,51 +96,48 @@ int coreboot_module_redraw(WINDOW *win)
 
        row++;
        mvwprintw(win, row++, 2, "-- Memory Map --");
-       
-       for(i = 0; i < cb_info.mem_count; i++) {
 
-               switch(cb_info.range[i].type) {
+       for (i = 0; i < cb_info.mem_count; i++) {
+               switch (cb_info.range[i].type) {
                case CB_MEM_RAM:
                        mvwprintw(win, row++, 4, "     RAM: ");
                        break;
-
                case CB_MEM_RESERVED:
                        mvwprintw(win, row++, 4, "Reserved: ");
                        break;
-
                case CB_MEM_TABLE:
                        mvwprintw(win, row++, 4, "   Table: ");
                }
 
                wprintw(win, "%16.16llx - %16.16llx",
                        UNPACK_CB64(cb_info.range[i].start),
-                       UNPACK_CB64(cb_info.range[i].start) + 
+                       UNPACK_CB64(cb_info.range[i].start) +
                        UNPACK_CB64(cb_info.range[i].size) - 1);
        }
 }
 
 static void parse_memory(unsigned char *ptr)
 {
-       struct cb_memory *mem = (struct cb_memory *) ptr;
-       
+       struct cb_memory *mem = (struct cb_memory *)ptr;
+
        int max = (MEM_RANGE_COUNT(mem) > MAX_MEMORY_COUNT)
-               ? MAX_MEMORY_COUNT : MEM_RANGE_COUNT(mem);
+           ? MAX_MEMORY_COUNT : MEM_RANGE_COUNT(mem);
        int i;
 
-       for(i = 0; i < max; i++) {
-               struct cb_memory_range *range = 
-                       (struct cb_memory_range *) MEM_RANGE_PTR(mem, i);
+       for (i = 0; i < max; i++) {
+               struct cb_memory_range *range =
+                   (struct cb_memory_range *)MEM_RANGE_PTR(mem, i);
 
                memcpy(&cb_info.range[i], range, sizeof(*range));
        }
-       
+
        cb_info.mem_count = max;
        cb_info.mem_actual = MEM_RANGE_COUNT(mem);
 }
 
-static void parse_mainboard(unsigned char *ptr)        
+static void parse_mainboard(unsigned char *ptr)
 {
-       struct cb_mainboard *mb = (struct cb_mainboard *) ptr;
+       struct cb_mainboard *mb = (struct cb_mainboard *)ptr;
 
        strncpy(cb_info.vendor, MB_VENDOR_STRING(mb), 31);
        strncpy(cb_info.part, MB_PART_STRING(mb), 31);
@@ -148,69 +145,67 @@ static void parse_mainboard(unsigned char *ptr)
 
 static void parse_strings(unsigned char *ptr)
 {
-       struct cb_string *string = (struct cb_string *) ptr;
+       struct cb_string *string = (struct cb_string *)ptr;
        int index = string->tag - CB_TAG_VERSION;
-       
+
        strncpy(cb_info.strings[index], string->string, 63);
        cb_info.strings[index][63] = 0;
 }
 
 static void parse_serial(unsigned char *ptr)
 {
-       memcpy(&cb_info.serial, (struct cb_serial *) ptr,
+       memcpy(&cb_info.serial, (struct cb_serial *)ptr,
               sizeof(struct cb_serial));
 }
 
 static void parse_console(unsigned char *ptr)
-{      
-       memcpy(&cb_info.console, (struct cb_console *) ptr,
+{
+       memcpy(&cb_info.console, (struct cb_console *)ptr,
               sizeof(struct cb_console));
 }
-       
+
 static int parse_header(void *addr, int len)
 {
        struct cb_header *header;
-       unsigned char *ptr = (unsigned char *) addr;
+       unsigned char *ptr = (unsigned char *)addr;
        int i;
 
        for (i = 0; i < len; i += 16, ptr += 16) {
-               header = (struct cb_header *) ptr;
+               header = (struct cb_header *)ptr;
 
                if (!strncmp(header->signature, "LBIO", 4))
                        break;
        }
 
-       /* We walked the entire space and didn't find anything */
+       /* We walked the entire space and didn't find anything. */
        if (i >= len)
                return -1;
 
        if (!header->table_bytes)
                return 0;
-       
-       /* FIXME: Check the checksum */
+
+       /* FIXME: Check the checksum. */
 
        if (ipchksum((uint16_t *) header, sizeof(*header)))
-         return -1;
+               return -1;
 
-       if (ipchksum((uint16_t *) (ptr + sizeof(*header)), header->table_bytes) !=
-           header->table_checksum)
-         return -1;
+       if (ipchksum((uint16_t *) (ptr + sizeof(*header)), header->table_bytes)
+           != header->table_checksum)
+               return -1;
 
-       /* Now, walk the tables */
+       /* Now, walk the tables. */
        ptr += header->header_bytes;
 
-       for(i = 0; i < header->table_entries; i++) {
-               struct cb_record *rec = (struct cb_record *) ptr;
-               
-               switch(rec->tag) {
+       for (i = 0; i < header->table_entries; i++) {
+               struct cb_record *rec = (struct cb_record *)ptr;
+
+               switch (rec->tag) {
                case CB_TAG_MEMORY:
                        parse_memory(ptr);
                        break;
-                       
                case CB_TAG_MAINBOARD:
                        parse_mainboard(ptr);
                        break;
-                       
                case CB_TAG_VERSION:
                case CB_TAG_EXTRA_VERSION:
                case CB_TAG_BUILD:
@@ -223,40 +218,34 @@ static int parse_header(void *addr, int len)
                case CB_TAG_ASSEMBLER:
                        parse_strings(ptr);
                        break;
-
                case CB_TAG_SERIAL:
                        parse_serial(ptr);
                        break;
-
                case CB_TAG_CONSOLE:
                        parse_console(ptr);
                        break;
-
                default:
                        break;
                }
 
                ptr += rec->size;
        }
-       
+
        return 1;
 }
 
 int coreboot_module_init(void)
 {
-       int ret = parse_header((void *) 0x00000, 0x1000);
+       int ret = parse_header((void *)0x00000, 0x1000);
 
        if (ret != 1)
-               ret = parse_header((void *) 0xf0000, 0x1000);
-
-       /* return error if we couldn't find it at either address */
+               ret = parse_header((void *)0xf0000, 0x1000);
 
-       tables_good =  (ret == 1) ? 0 : -1;
+       /* Return error if we couldn't find it at either address. */
+       tables_good = (ret == 1) ? 0 : -1;
        return tables_good;
 }
 
-
-
 struct coreinfo_module coreboot_module = {
        .name = "Coreboot",
        .init = coreboot_module_init,
index 6dc07397a12da814afd495000a995788bfa345b6..4a86bc256f79dc1b0aabf074e22859cc0d759c31 100644 (file)
@@ -46,22 +46,22 @@ void print_module_title(WINDOW *win, const char *title)
 
        wmove(win, 1, 1);
 
-       for(i = 0; i < 78; i++)
+       for (i = 0; i < 78; i++)
                waddch(win, '\304');
 }
 
-void print_menu(void) {
-       int i, len;
+void print_menu(void)
+{
+       int i, j, len;
        char menu[80];
        char *ptr = menu;
-       int j;
 
        wmove(stdscr, 23, 0);
 
-       for(j = 0; j < SCREEN_X; j++)
+       for (j = 0; j < SCREEN_X; j++)
                waddch(stdscr, ' ');
 
-       for(i = 0; i < MODULE_COUNT; i++)
+       for (i = 0; i < MODULE_COUNT; i++)
                ptr += sprintf(ptr, "F%d: %s ", i + 1, modules[i]->name);
 
        mvprintw(23, 0, menu);
@@ -74,7 +74,7 @@ void center(int row, const char *str)
 
        wmove(stdscr, row, 0);
 
-       for(j = 0; j < SCREEN_X; j++)
+       for (j = 0; j < SCREEN_X; j++)
                waddch(stdscr, ' ');
 
        mvprintw(row, (SCREEN_X - len) / 2, str);
@@ -87,13 +87,12 @@ void header(int row, const char *str)
        int i;
        int len = strlen(str) + 4;
 
-       for(i = 0; i < (SCREEN_X - len) / 2; i++)
+       for (i = 0; i < (SCREEN_X - len) / 2; i++)
                ptr += sprintf(ptr, "=");
 
        ptr += sprintf(ptr, "[ %s ]", str);
 
-
-       for(i = ((SCREEN_X - len) / 2) + len; i < SCREEN_X ; i++)
+       for (i = ((SCREEN_X - len) / 2) + len; i < SCREEN_X; i++)
                ptr += sprintf(ptr, "=");
 
        mvprintw(row, 0, buf);
@@ -116,11 +115,11 @@ int loop(void)
        modules[curwin]->redraw(modwin);
        refresh();
 
-       while(1) {
+       while (1) {
                key = getch();
 
                if (key == ERR)
-                 continue;
+                       continue;
 
                if (key >= KEY_F(1) && key <= KEY_F(9)) {
                        unsigned char ch = key - KEY_F(1);
@@ -156,17 +155,17 @@ int main(void)
        wattrset(stdscr, COLOR_PAIR(1) | A_BOLD);
        wattrset(modwin, COLOR_PAIR(2));
 
-       for(i = 0; i < 23; i++) {
+       for (i = 0; i < 23; i++) {
                wmove(modwin, i - 1, 0);
 
-               for(j = 0; j < SCREEN_X; j++)
+               for (j = 0; j < SCREEN_X; j++)
                        waddch(modwin, ' ');
        }
 
        refresh();
 
-       for(i = 0; i < MODULE_COUNT; i++)
+       for (i = 0; i < MODULE_COUNT; i++)
                modules[i]->init();
-       
+
        loop();
 }
index e6a649d517fddb1eafe6ab4c630de33d1bc1bf28..4995d7fa36d6a307570b582ac865695ae4c0e50b 100644 (file)
 #define COREINFO_H_
 
 #include <libpayload.h>
-
 #include <curses.h>
 
 struct coreinfo_module {
        char name[15];
-       int (*init)(void);
-       int (*redraw)(WINDOW *);
-       int (*handle)(int);
+       int (*init) (void);
+       int (*redraw) (WINDOW *);
+       int (*handle) (int);
 };
 
-extern void docpuid(int, unsigned long *, unsigned long *, unsigned long *, unsigned long *);
+extern void docpuid(int, unsigned long *, unsigned long *, unsigned long *,
+                   unsigned long *);
 
-void print_module_title(WINDOW *, const char *title);
+void print_module_title(WINDOW *win, const char *title);
 
 #endif
index a9641407c71b64e88f1015072ae8cc46b82abf52..1921526a4a269a8389cbf65b50020beea33f9de0 100644 (file)
@@ -40,13 +40,14 @@ const char *generic_cap_flags[] = {
        "fxsr", "sse", "sse2", "ss", "ht", "tm", NULL, "pbe"
 };
 
-  /* CPUID 0x00000001 ECX flags */
+/* CPUID 0x00000001 ECX flags */
 const char *intel_cap_generic_ecx_flags[] = {
        "sse3", NULL, NULL, "monitor", "ds-cpl", "vmx", NULL, "est",
        "tm2", "ssse3", "cntx-id", NULL, NULL, "cx16", "xTPR", NULL,
        NULL, NULL, "dca", NULL, NULL, NULL, NULL, NULL,
        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
 };
+
 /* CPUID 0x80000001 EDX flags */
 const char *intel_cap_extended_edx_flags[] = {
        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -54,6 +55,7 @@ const char *intel_cap_extended_edx_flags[] = {
        NULL, NULL, NULL, NULL, "xd", NULL, NULL, NULL,
        NULL, NULL, NULL, NULL, NULL, "em64t", NULL, NULL,
 };
+
 /* CPUID 0x80000001 ECX flags */
 const char *intel_cap_extended_ecx_flags[] = {
        "lahf_lm", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -96,11 +98,11 @@ void decode_flags(WINDOW *win, unsigned long reg, const char **flags, int *row)
 
        wmove(win, lrow, 2);
 
-       for(i = 0; i < 32; i++) {
+       for (i = 0; i < 32; i++) {
                if (flags[i] == NULL)
                        continue;
 
-               if (reg & (1 << i)) 
+               if (reg & (1 << i))
                        wprintw(win, "%s ", flags[i]);
 
                if (i && (i % 16) == 0) {
@@ -112,7 +114,6 @@ void decode_flags(WINDOW *win, unsigned long reg, const char **flags, int *row)
        *row = lrow;
 }
 
-
 static void get_features(WINDOW *win, int *row)
 {
        unsigned long eax, ebx, ecx, edx;
@@ -127,7 +128,7 @@ static void get_features(WINDOW *win, int *row)
 
        lrow++;
 
-       switch(vendor) {
+       switch (vendor) {
        case VENDOR_AMD:
                wmove(win, lrow++, 1);
                wprintw(win, "AMD Extended Flags: ");
@@ -136,7 +137,6 @@ static void get_features(WINDOW *win, int *row)
                decode_flags(win, edx, amd_cap_extended_edx_flags, &lrow);
                decode_flags(win, ecx, amd_cap_extended_ecx_flags, &lrow);
                break;
-
        case VENDOR_INTEL:
                wmove(win, lrow++, 1);
                wprintw(win, "Intel Extended Flags: ");
@@ -152,47 +152,44 @@ static void get_features(WINDOW *win, int *row)
 
 static void do_name(WINDOW *win, int row)
 {
-       char str[80];
+       char str[80], name[49], *p;
        unsigned long eax, ebx, ecx, edx;
        int i, t;
-       char name[49], *p;
 
        p = name;
 
-       for(i = 0x80000002; i <= 0x80000004; i++) {
+       for (i = 0x80000002; i <= 0x80000004; i++) {
                docpuid(i, &eax, &ebx, &ecx, &edx);
 
                if (eax == 0)
                        break;
 
-               for(t = 0; t < 4; t++)
+               for (t = 0; t < 4; t++)
                        *p++ = eax >> (8 * t);
-               for(t = 0; t < 4; t++)
+               for (t = 0; t < 4; t++)
                        *p++ = ebx >> (8 * t);
-               for(t = 0; t < 4; t++)
+               for (t = 0; t < 4; t++)
                        *p++ = ecx >> (8 * t);
-               for(t = 0; t < 4; t++)
+               for (t = 0; t < 4; t++)
                        *p++ = edx >> (8 * t);
        }
 
-       mvwprintw(win, row,1, "Processor: %s", name);
+       mvwprintw(win, row, 1, "Processor: %s", name);
 }
 
-int cpuinfo_module_redraw(WINDOW *win)
+int cpuinfo_module_redraw(WINDOW * win)
 {
        unsigned long eax, ebx, ecx, edx;
-
        unsigned int brand;
-       char str[80];
-       char *vstr;
+       char str[80], *vstr;
        int row = 2;
 
        print_module_title(win, "CPU Information");
 
        docpuid(0, NULL, &vendor, NULL, NULL);
 
-       switch(vendor) {
-       case  VENDOR_INTEL:
+       switch (vendor) {
+       case VENDOR_INTEL:
                vstr = "Intel";
                break;
        case VENDOR_AMD:
@@ -221,7 +218,7 @@ int cpuinfo_module_redraw(WINDOW *win)
 
        docpuid(0x00000001, &eax, &ebx, &ecx, &edx);
 
-       mvwprintw(win, row++, 1, "Family: %X",(eax >> 8) & 0x0f);
+       mvwprintw(win, row++, 1, "Family: %X", (eax >> 8) & 0x0f);
        mvwprintw(win, row++, 1, "Model: %X",
                  ((eax >> 4) & 0xf) | ((eax >> 16) & 0xf) << 4);
 
@@ -229,34 +226,30 @@ int cpuinfo_module_redraw(WINDOW *win)
 
        if (vendor == VENDOR_AMD) {
                docpuid(0x80000001, &eax, &ebx, &ecx, &edx);
-               brand = ((ebx >> 9) & 0x1F);
+               brand = ((ebx >> 9) & 0x1f);
 
-               mvwprintw(win, row++, 1,"Brand: %X", brand);
+               mvwprintw(win, row++, 1, "Brand: %X", brand);
        }
 
-       if (cpu_khz != 0) {
-               mvwprintw(win, row++, 1, "CPU Speed: %d Mhz",
-                               cpu_khz / 1000);
-       }
-       else {
+       if (cpu_khz != 0)
+               mvwprintw(win, row++, 1, "CPU Speed: %d Mhz", cpu_khz / 1000);
+       else
                mvwprintw(win, row++, 1, "CPU Speed: Error");
-       }
 
        row++;
        get_features(win, &row);
 }
 
-unsigned int getticks(void) 
+unsigned int getticks(void)
 {
        unsigned long long start, end;
 
-       /* Read the number of ticks during the period */
-
+       /* Read the number of ticks during the period. */
        start = rdtsc();
        mdelay(100);
        end = rdtsc();
 
-       return (unsigned int) ((end - start) / 100);
+       return (unsigned int)((end - start) / 100);
 }
 
 int cpuinfo_module_init(void)
index 723c51377dcb05519874d3625b88428e437869f2..af6a23eaaa1d4a061a8ff8c594b9824cee09ea9f 100644 (file)
@@ -6,12 +6,12 @@
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; version 2 of the License.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
@@ -29,7 +29,7 @@ static struct pci_devices devices[64];
 static int devices_index;
 
 #define REG_VENDOR_ID   0x00
-#define REG_HEADER_TYPE 0x0E
+#define REG_HEADER_TYPE 0x0e
 #define REG_PRIMARY_BUS 0x18
 
 #define HEADER_TYPE_NORMAL  0
@@ -37,7 +37,7 @@ static int devices_index;
 #define HEADER_TYPE_CARDBUS 2
 
 #define PCI_ADDR(_bus, _dev, _reg) \
-(0x80000000 | (_bus << 16) | (_dev << 8) | (_reg & ~3))
+       (0x80000000 | (_bus << 16) | (_dev << 8) | (_reg & ~3))
 
 /* Number of entries to show in the list */
 #define MENU_VISIBLE 16
@@ -67,8 +67,7 @@ static int partition(struct pci_devices *list, int len)
 
        swap(&list[len / 2], &list[len - 1]);
 
-       for(i = 0; i < len - 1; i++) {
-
+       for (i = 0; i < len - 1; i++) {
                if (list[i].device < val) {
                        swap(&list[i], &list[index]);
                        index++;
@@ -76,6 +75,7 @@ static int partition(struct pci_devices *list, int len)
        }
 
        swap(&list[index], &list[len - 1]);
+
        return index;
 }
 
@@ -95,15 +95,15 @@ static void quicksort(struct pci_devices *list, int len)
 static void pci_read_dword(unsigned int bus, unsigned int devfn,
                           unsigned int reg, unsigned int *val)
 {
-       outl(PCI_ADDR(bus, devfn, reg), 0xCF8);
-       *val = inl(0xCFC);
+       outl(PCI_ADDR(bus, devfn, reg), 0xcf8);
+       *val = inl(0xcfc);
 }
 
 static void pci_read_byte(unsigned int bus, unsigned int devfn,
                          unsigned int reg, unsigned char *val)
 {
-       outl(PCI_ADDR(bus, devfn, reg), 0xCF8);
-       *val = inb(0xCFC + (reg & 3));
+       outl(PCI_ADDR(bus, devfn, reg), 0xcf8);
+       *val = inb(0xcfc + (reg & 3));
 }
 
 static int show_config_space(WINDOW *win, int row, int col, int index)
@@ -112,79 +112,78 @@ static int show_config_space(WINDOW *win, int row, int col, int index)
        int bus, devfn;
        int i, x, y;
 
-       bus = (devices[index].device >> 8) & 0xFF;
-       devfn = devices[index].device & 0xFF;
+       bus = (devices[index].device >> 8) & 0xff;
+       devfn = devices[index].device & 0xff;
 
-       for(i = 0; i < 64; i+= 4)
-               pci_read_dword(bus, devfn, i, ((int *) &cspace[i]));
+       for (i = 0; i < 64; i += 4)
+               pci_read_dword(bus, devfn, i, ((int *)&cspace[i]));
 
-       for(y = 0; y < 4; y++) {
-               for(x = 0; x < 16; x++)
-                       mvwprintw(win, row + y, col + (x * 3), "%2.2X ", cspace[(y * 16) + x]);
+       for (y = 0; y < 4; y++) {
+               for (x = 0; x < 16; x++)
+                       mvwprintw(win, row + y, col + (x * 3), "%2.2X ",
+                                 cspace[(y * 16) + x]);
        }
 }
 
 int pci_module_redraw(WINDOW *win)
 {
        unsigned int bus, devfn, func;
-       int i;
-       int last;
+       int i, last;
 
        print_module_title(win, "PCI Device List");
 
        last = menu_first + MENU_VISIBLE;
 
        if (last > devices_index)
-         last = devices_index;
+               last = devices_index;
 
-       for(i = 0; i < MENU_VISIBLE; i++) {
+       for (i = 0; i < MENU_VISIBLE; i++) {
                int item = menu_first + i;
 
-               /* Draw a blank space */
-
+               /* Draw a blank space. */
                if (item >= devices_index) {
                        wattrset(win, COLOR_PAIR(2));
                        mvwprintw(win, 2 + i, 1, "                 ");
                        continue;
                }
 
-               bus = (devices[item].device >> 8) & 0xFF;
-               devfn = (devices[item].device & 0xFF) / 8;
-               func = (devices[item].device & 0xFF) % 8;
+               bus = (devices[item].device >> 8) & 0xff;
+               devfn = (devices[item].device & 0xff) / 8;
+               func = (devices[item].device & 0xff) % 8;
 
                if (item == menu_selected)
                        wattrset(win, COLOR_PAIR(3) | A_BOLD);
                else
                        wattrset(win, COLOR_PAIR(2));
 
-               mvwprintw(win, 2+i, 1, "%X:%2.2X.%2.2X %X:%X  ",
+               mvwprintw(win, 2 + i, 1, "%X:%2.2X.%2.2X %X:%X  ",
                          bus, devfn, func,
-                         devices[item].id & 0xFFFF,
-                         (devices[item].id >> 16) & 0xFFFF);
+                         devices[item].id & 0xffff,
+                         (devices[item].id >> 16) & 0xffff);
 
                wattrset(win, COLOR_PAIR(2));
 
                if (i == 0) {
                        if (item != 0)
-                               mvwprintw(win, 2+ i, 19, "\30");
+                               mvwprintw(win, 2 + i, 19, "\30");
                }
                if (i == MENU_VISIBLE - 1) {
                        if ((item + 1) < devices_index)
-                               mvwprintw(win, 2+ i, 19, "\31");
+                               mvwprintw(win, 2 + i, 19, "\31");
                }
        }
 
        wattrset(win, COLOR_PAIR(2));
 
-       for(i = 0; i < 16; i++)
+       for (i = 0; i < 16; i++)
                mvwprintw(win, 2, 26 + (i * 3), "%2.2X ", i);
 
        wmove(win, 3, 25);
 
-       for(i = 0; i < 48; i++)
+       for (i = 0; i < 48; i++)
                waddch(win, (i == 0) ? '\332' : '\304');
 
-       for(i = 0; i < 4; i++) {
+       for (i = 0; i < 4; i++) {
                mvwprintw(win, 4 + i, 23, "%2.2X", i * 16);
                wmove(win, 4 + i, 25);
                waddch(win, '\263');
@@ -201,32 +200,27 @@ static void pci_scan_bus(int bus)
        unsigned int val;
        unsigned char hdr;
 
-       for(devfn = 0; devfn < 0x100; ) {
-               for(func = 0; func < 8; func++, devfn++) {
+       for (devfn = 0; devfn < 0x100;) {
+               for (func = 0; func < 8; func++, devfn++) {
                        pci_read_dword(bus, devfn, REG_VENDOR_ID, &val);
 
-                       /* Nobody home */
-
+                       /* Nobody home. */
                        if (val == 0xffffffff || val == 0x00000000 ||
                            val == 0x0000ffff || val == 0xffff0000)
                                continue;
 
-                       /* FIXME: Remove this arbitrary limitation */
-
+                       /* FIXME: Remove this arbitrary limitation. */
                        if (devices_index >= 64)
                                return;
 
-                       devices[devices_index].device = 
-                               ((bus & 0xFF) << 8) | (devfn & 0xFF);
+                       devices[devices_index].device =
+                           ((bus & 0xff) << 8) | (devfn & 0xff);
 
                        devices[devices_index++].id = val;
 
-                       /* If this is a bridge, then follow it */
-
+                       /* If this is a bridge, then follow it. */
                        pci_read_byte(bus, devfn, REG_HEADER_TYPE, &hdr);
-
-                       hdr &= 0x7F;
-
+                       hdr &= 0x7f;
                        if (hdr == HEADER_TYPE_BRIDGE ||
                            hdr == HEADER_TYPE_CARDBUS) {
                                unsigned int busses;
@@ -234,7 +228,7 @@ static void pci_scan_bus(int bus)
                                pci_read_dword(bus, devfn, REG_PRIMARY_BUS,
                                               &busses);
 
-                               pci_scan_bus((busses >> 8) & 0xFF);
+                               pci_scan_bus((busses >> 8) & 0xff);
 
                        }
                }
@@ -247,21 +241,18 @@ int pci_module_handle(int key)
 {
        int ret = 0;
 
-       switch(key) {
+       switch (key) {
        case KEY_DOWN:
                if (menu_selected + 1 < devices_index) {
                        menu_selected++;
                        ret = 1;
                }
-
                break;
-
        case KEY_UP:
                if (menu_selected > 0) {
                        menu_selected--;
                        ret = 1;
                }
-
                break;
        }
 
@@ -276,7 +267,6 @@ int pci_module_handle(int key)
                        menu_first = 0;
        }
 
-
        return ret;
 }
 
@@ -285,7 +275,6 @@ int pci_module_init(void)
        unsigned int val;
        int bus = 0;
 
-
        pci_scan_bus(0);
 
        return 0;