Changeset 933


Ignore:
Timestamp:
03/13/10 18:28:29 (23 months ago)
Author:
uwe
Message:

Various coding style and cosmetic changes (trivial).

  • Fix coding-style, whitespace, and indentation in a few places.
  • Consistently use the same spelling ("Super I/O") everywhere.
  • Make some flashrom stdout output look a bit nicer.


Signed-off-by: Uwe Hermann <uwe@…>
Acked-by: Uwe Hermann <uwe@…>

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/board_enable.c

    r930 r933  
    8080        case SUPERIO_VENDOR_ITE: 
    8181                enter_conf_mode_ite(superio.port); 
    82                 /* Enable flash mapping. Works for most old ITE style SuperI/O. */ 
     82                /* Enable flash mapping. Works for most old ITE style Super I/O. */ 
    8383                tmp = sio_read(superio.port, 0x24); 
    8484                tmp |= 0xfc; 
     
    8888                break; 
    8989        default: 
    90                 printf_debug("Unhandled SuperI/O type!\n"); 
     90                printf_debug("Unhandled Super I/O type!\n"); 
    9191                ret = -1; 
    9292                break; 
     
    227227 *  - Shuttle AK38N: VIA KT333CF + VIA VT8235 + ITE IT8705F 
    228228 * 
    229  * SIS950 superio probably requires the same flash write enable. 
     229 * The SIS950 Super I/O probably requires the same flash write enable. 
    230230 */ 
    231231static int it8705f_write_enable_2e(const char *name) 
     
    240240        int gpio_pin = gpio % 8; 
    241241        uint16_t baseport; 
    242         uint8_t id; 
    243         uint8_t val; 
    244  
    245         if (gpio_bank > 4) 
    246         { 
     242        uint8_t id, val; 
     243 
     244        if (gpio_bank > 4) { 
    247245                fprintf(stderr, "PC87360: Invalid GPIO %d\n", gpio); 
    248246                return -1; 
     
    250248 
    251249        id = sio_read(0x2E, 0x20); 
    252         if (id != 0xE1) 
    253         { 
     250        if (id != 0xE1) { 
    254251                fprintf(stderr, "PC87360: unexpected ID %02x\n", id); 
    255252                return -1; 
    256253        } 
    257254 
    258         sio_write(0x2E, 0x07, 0x07);            /* select GPIO device */ 
     255        sio_write(0x2E, 0x07, 0x07);            /* Select GPIO device */ 
    259256        baseport = (sio_read(0x2E, 0x60) << 8) | sio_read(0x2E, 0x61); 
    260         if((baseport & 0xFFF0) == 0xFFF0 || baseport == 0) 
    261         { 
     257        if ((baseport & 0xFFF0) == 0xFFF0 || baseport == 0) { 
    262258                fprintf (stderr, "PC87360: invalid GPIO base address %04x\n", 
    263259                         baseport); 
     
    265261        } 
    266262        sio_mask (0x2E, 0x30, 0x01, 0x01);      /* Enable logical device */ 
    267         sio_write(0x2E, 0xF0, gpio_bank*16 + gpio_pin); 
     263        sio_write(0x2E, 0xF0, gpio_bank * 16 + gpio_pin); 
    268264        sio_mask (0x2E, 0xF1, 0x01, 0x01);      /* Make pin output */ 
    269265 
    270266        val = INB(baseport + bankbase[gpio_bank]); 
    271         if(raise) 
     267        if (raise) 
    272268                val |= 1 << gpio_pin; 
    273269        else 
     
    10291025{ 
    10301026        struct pci_dev *dev; 
    1031         uint16_t base; 
    1032         uint16_t temp; 
     1027        uint16_t base, temp; 
    10331028 
    10341029        dev = pci_dev_find(0x1039, 0x0962); 
     
    11341129 
    11351130        if (id != 0x8701) { 
    1136                 fprintf(stderr, "\nERROR: IT8703F SuperIO not found.\n"); 
     1131                fprintf(stderr, "\nERROR: IT8703F Super I/O not found.\n"); 
    11371132                return -1; 
    11381133        } 
     
    11451140 
    11461141        if (!base) { 
    1147                 fprintf(stderr, "\nERROR: Failed to read IT8703F SuperIO GPIO" 
     1142                fprintf(stderr, "\nERROR: Failed to read IT8703F Super I/O GPIO" 
    11481143                        " Base.\n"); 
    11491144                return -1; 
     
    11621157 * There is only some limited checking on the port numbers. 
    11631158 */ 
    1164 static int 
    1165 it8712f_gpio_set(unsigned int line, int raise) 
     1159static int it8712f_gpio_set(unsigned int line, int raise) 
    11661160{ 
    11671161        unsigned int port; 
     
    11871181 
    11881182        if (id != 0x8712) { 
    1189                 fprintf(stderr, "\nERROR: IT8712F SuperIO not found.\n"); 
     1183                fprintf(stderr, "\nERROR: IT8712F Super I/O not found.\n"); 
    11901184                return -1; 
    11911185        } 
     
    11981192 
    11991193        if (!base) { 
    1200                 fprintf(stderr, "\nERROR: Failed to read IT8712F SuperIO GPIO" 
     1194                fprintf(stderr, "\nERROR: Failed to read IT8712F Super I/O GPIO" 
    12011195                        " Base.\n"); 
    12021196                return -1; 
     
    14471441 
    14481442        if (board && board->status == NT) { 
    1449                 if (!force_boardenable) 
    1450                 { 
     1443                if (!force_boardenable) { 
    14511444                        printf("WARNING: Your mainboard is %s %s, but the mainboard-specific\n" 
    14521445                               "code has not been tested, and thus will not not be executed by default.\n" 
     
    14541447                               "can fail without running the board specific code.\n\n" 
    14551448                               "Please see the man page (section PROGRAMMER SPECIFIC INFO, subsection\n" 
    1456                                "\"internal programmer\") for details\n", 
     1449                               "\"internal programmer\") for details.\n", 
    14571450                               board->vendor_name, board->board_name); 
    14581451                        board = NULL; 
    1459                 } 
    1460                 else 
     1452                } else { 
    14611453                        printf("NOTE: Running an untested board enable procedure.\n" 
    1462                                "Please report success/failure to flashrom@flashrom.org\n"); 
     1454                               "Please report success/failure to flashrom@flashrom.org.\n"); 
     1455                } 
    14631456        } 
    14641457 
  • trunk/cli_output.c

    r836 r933  
    2828        int ret; 
    2929        FILE *output_type; 
    30          
    31         switch (type) 
    32         { 
     30 
     31        switch (type) { 
    3332        case MSG_ERROR: 
    3433                output_type = stderr; 
    3534                break; 
    3635        case MSG_BARF: 
    37                 if (verbose < 2) return 0; 
     36                if (verbose < 2) 
     37                        return 0; 
    3838        case MSG_DEBUG: 
    39                 if (verbose < 1) return 0; 
     39                if (verbose < 1) 
     40                        return 0; 
    4041        case MSG_INFO: 
    4142        default: 
     
    4344                break; 
    4445        } 
    45          
     46 
    4647        va_start(ap, fmt); 
    4748        ret = vfprintf(output_type, fmt, ap); 
     
    4950        return ret; 
    5051} 
    51  
  • trunk/dmi.c

    r916 r933  
    3232        DMI_BB_PRODUCT, 
    3333        DMI_BB_VERSION, 
    34         DMI_ID_INVALID /* This must always be the last entry */ 
     34        DMI_ID_INVALID, /* This must always be the last entry! */ 
    3535}; 
    3636 
    37 /* The short_id for baseboard starts with "m" as in mainboard to leave 
    38    "b" available for BIOS */ 
     37/* 
     38 * The short_id for baseboard starts with "m" as in mainboard to leave 
     39 * "b" available for BIOS. 
     40 */ 
    3941const char *dmidecode_names[DMI_ID_INVALID] = { 
    4042        "system-manufacturer", 
     
    4345        "baseboard-manufacturer", 
    4446        "baseboard-product-name", 
    45         "baseboard-version" 
     47        "baseboard-version", 
    4648}; 
    4749 
     
    5254char *dmistrings[DMI_ID_INVALID]; 
    5355 
    54 /* strings longer than 4096 in DMI are just insane */ 
     56/* Strings longer than 4096 in DMI are just insane. */ 
    5557#define DMI_MAX_ANSWER_LEN 4096 
    5658 
     
    6062        char *result; 
    6163        char answerbuf[DMI_MAX_ANSWER_LEN]; 
    62         char commandline[DMI_COMMAND_LEN_MAX+40]; 
     64        char commandline[DMI_COMMAND_LEN_MAX + 40]; 
     65 
    6366        snprintf(commandline, sizeof(commandline), 
    6467                 "%s -s %s", dmidecode_command, string_name); 
     
    8386        } 
    8487 
    85         /* chomp trailing newline */ 
     88        /* Chomp trailing newline. */ 
    8689        if (answerbuf[0] != 0 && 
    8790            answerbuf[strlen(answerbuf) - 1] == '\n') 
     
    100103        int i; 
    101104        char *chassis_type; 
     105 
    102106        has_dmi_support = 1; 
    103107        for (i = 0; i < DMI_ID_INVALID; i++) { 
     
    132136        int anchored = 0; 
    133137        int patternlen; 
     138 
    134139        printf_debug("matching %s against %s\n", value, pattern); 
    135         /* The empty string is part of all strings */ 
     140        /* The empty string is part of all strings! */ 
    136141        if (pattern[0] == 0) 
    137142                return 1; 
     
    146151                int valuelen = strlen(value); 
    147152                patternlen--; 
    148                 if(patternlen > valuelen) 
     153                if (patternlen > valuelen) 
    149154                        return 0; 
    150155 
    151156                /* full string match: require same length */ 
    152                 if(anchored && (valuelen != patternlen)) 
     157                if (anchored && (valuelen != patternlen)) 
    153158                        return 0; 
    154159 
     
    167172{ 
    168173        int i; 
     174 
    169175        if (!has_dmi_support) 
    170176                return 0; 
    171177 
    172         for (i = 0;i < DMI_ID_INVALID; i++) 
    173                 if(dmi_compare(dmistrings[i], pattern)) 
     178        for (i = 0; i < DMI_ID_INVALID; i++) 
     179                if (dmi_compare(dmistrings[i], pattern)) 
    174180                        return 1; 
    175181 
  • trunk/flashrom.c

    r927 r933  
    665665                for (j = 0; j < len / 256; j++) { 
    666666                        limit = min (256, len - j * 256); 
    667                         /* Are have and want identical? */ 
     667                        /* Are 'have' and 'want' identical? */ 
    668668                        if (!memcmp(have + j * 256, want + j * 256, limit)) 
    669669                                continue; 
     
    10291029                 * easiest way to check this is with function pointers. 
    10301030                 */ 
    1031                 for (j = k + 1; j < NUM_ERASEFUNCTIONS; j++) 
     1031                for (j = k + 1; j < NUM_ERASEFUNCTIONS; j++) { 
    10321032                        if (eraser.block_erase == 
    10331033                            flash->block_erasers[j].block_erase) { 
     
    10381038                                ret = 1; 
    10391039                        } 
     1040                } 
    10401041        } 
    10411042        return ret; 
     
    11991200                       "with the additional -V option for all operations you " 
    12001201                       "tested (-V, -rV,\n-wV, -EV), and mention which " 
    1201                        "mainboard or programmer you tested. Thanks for your " 
     1202                       "mainboard or programmer you tested.\nThanks for your " 
    12021203                       "help!\n===\n"); 
    12031204        } 
  • trunk/hwaccess.h

    r898 r933  
    1616 * along with this program; if not, write to the Free Software 
    1717 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA 
    18  * 
    19  * 
     18 */ 
     19 
     20/* 
    2021 * Header file for hardware access and OS abstraction. Included from flash.h. 
    2122 */ 
     
    9091  #include <stdint.h> 
    9192 
    92 static inline void 
    93 outb(uint8_t value, uint16_t port) 
     93static inline void outb(uint8_t value, uint16_t port) 
    9494{ 
    9595        asm volatile ("outb %b0,%w1": :"a" (value), "Nd" (port)); 
    9696} 
    9797 
    98 static inline uint8_t 
    99 inb(uint16_t port) 
     98static inline uint8_t inb(uint16_t port) 
    10099{ 
    101100        uint8_t value; 
     
    104103} 
    105104 
    106 static inline void 
    107 outw(uint16_t value, uint16_t port) 
     105static inline void outw(uint16_t value, uint16_t port) 
    108106{ 
    109107        asm volatile ("outw %w0,%w1": :"a" (value), "Nd" (port)); 
    110108} 
    111109 
    112 static inline uint16_t 
    113 inw(uint16_t port) 
     110static inline uint16_t inw(uint16_t port) 
    114111{ 
    115112        uint16_t value; 
     
    118115} 
    119116 
    120 static inline void 
    121 outl(uint32_t value, uint16_t port) 
     117static inline void outl(uint32_t value, uint16_t port) 
    122118{ 
    123119        asm volatile ("outl %0,%w1": :"a" (value), "Nd" (port)); 
    124120} 
    125121 
    126 static inline uint32_t 
    127 inl(uint16_t port) 
     122static inline uint32_t inl(uint16_t port) 
    128123{ 
    129124        uint32_t value; 
  • trunk/internal.c

    r919 r933  
    106106{ 
    107107        superio = probe_superio_ite(); 
    108 #if 0   /* Winbond SuperI/O code is not yet available. */ 
     108#if 0 
     109        /* Winbond Super I/O code is not yet available. */ 
    109110        if (superio.vendor == SUPERIO_VENDOR_NONE) 
    110111                superio = probe_superio_winbond(); 
     
    151152        dmi_init(); 
    152153 
    153         /* Probe for the SuperI/O chip and fill global struct superio. */ 
     154        /* Probe for the Super I/O chip and fill global struct superio. */ 
    154155        probe_superio(); 
    155156 
    156         /* Warn if a laptop is detected */ 
     157        /* Warn if a laptop is detected. */ 
    157158        if (is_laptop) 
    158159                printf("========================================================================\n" 
     
    160161                       "Laptops, notebooks and netbooks are difficult to support and we recommend\n" 
    161162                       "to use the vendor flashing utility. The embedded controller (EC) in these\n" 
    162                        "machines often interacts badly with flashing\n" 
    163                        "See http://www.flashrom.org/Laptops\n" 
     163                       "machines often interacts badly with flashing.\n" 
     164                       "See http://www.flashrom.org/Laptops for details.\n" 
    164165                       "========================================================================\n"); 
    165166 
  • trunk/it87spi.c

    r914 r933  
    8282                case 0x86: 
    8383                case 0x87: 
    84                         msg_pinfo("Found ITE SuperI/O, id %04hx\n", 
     84                        msg_pinfo("Found ITE Super I/O, id %04hx\n", 
    8585                                     ret.model); 
    8686                        return ret; 
     
    171171 
    172172        get_io_perms(); 
    173         /* Probe for the SuperI/O chip and fill global struct superio. */ 
     173        /* Probe for the Super I/O chip and fill global struct superio. */ 
    174174        probe_superio(); 
    175175        ret = it87spi_common_init(); 
  • trunk/serial.c

    r883 r933  
    106106#ifdef _WIN32 
    107107        HANDLE fd; 
    108         char* dev2 = dev; 
    109         if ((strlen(dev) > 3) && (tolower(dev[0])=='c') && (tolower(dev[1])=='o') && (tolower(dev[2])=='m')) { 
    110                 dev2 = malloc(strlen(dev)+5); 
     108        char *dev2 = dev; 
     109        if ((strlen(dev) > 3) && (tolower(dev[0]) == 'c') 
     110            && (tolower(dev[1]) == 'o') && (tolower(dev[2]) == 'm')) { 
     111                dev2 = malloc(strlen(dev) + 5); 
    111112                strcpy(dev2, "\\\\.\\"); 
    112                 strcpy(dev2+4, dev); 
    113         } 
    114         fd = CreateFile(dev2, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); 
     113                strcpy(dev2 + 4, dev); 
     114        } 
     115        fd = CreateFile(dev2, GENERIC_READ | GENERIC_WRITE, 0, NULL, 
     116                        OPEN_EXISTING, 0, NULL); 
    115117        if (dev2 != dev) 
    116118                free(dev2); 
     
    130132                default: sp_die("Error: Could not set baud rate"); 
    131133        } 
    132         dcb.ByteSize=8; 
    133         dcb.Parity=NOPARITY; 
    134         dcb.StopBits=ONESTOPBIT; 
     134        dcb.ByteSize = 8; 
     135        dcb.Parity = NOPARITY; 
     136        dcb.StopBits = ONESTOPBIT; 
    135137        if (!SetCommState(fd, &dcb)) { 
    136138                sp_die("Error: Could not change serial port configuration"); 
     
    148150                if (sp_baudtable[i].baud == 0) { 
    149151                        close(fd); 
    150                         msg_perr( 
    151                                 "Error: cannot configure for baudrate %d\n", 
    152                                 baud); 
     152                        msg_perr("Error: cannot configure for baudrate %d\n", 
     153                                 baud); 
    153154                        exit(1); 
    154155                } 
Note: See TracChangeset for help on using the changeset viewer.