Changeset 1397


Ignore:
Timestamp:
07/28/11 10:13:25 (10 months ago)
Author:
uwe
Message:

Random whitespace and coding-style fixes.

Also, indentation fixes, e.g. due to conversion to msg_*, use ARRAY_SIZE
where possible, wrap overly long line, etc.

Compile-tested. There should be no functional changes.

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

Location:
trunk
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/82802ab.c

    r1353 r1397  
    3030#include "chipdrivers.h" 
    3131 
    32 // I need that Berkeley bit-map printer 
    3332void print_status_82802ab(uint8_t status) 
    3433{ 
     
    4544{ 
    4645        chipaddr bios = flash->virtual_memory; 
    47         uint8_t id1, id2; 
    48         uint8_t flashcontent1, flashcontent2; 
     46        uint8_t id1, id2, flashcontent1, flashcontent2; 
    4947        int shifted = (flash->feature_bits & FEATURE_ADDR_SHIFTED) != 0; 
    5048 
     
    7068                msg_cdbg(", id1 parity violation"); 
    7169 
    72         /* Read the product ID location again. We should now see normal flash contents. */ 
     70        /* 
     71         * Read the product ID location again. We should now see normal 
     72         * flash contents. 
     73         */ 
    7374        flashcontent1 = chip_readb(bios + (0x00 << shifted)); 
    7475        flashcontent2 = chip_readb(bios + (0x01 << shifted)); 
     
    113114 
    114115        for (i = 0; i < flash->total_size * 1024; i+= flash->page_size) 
    115         { 
    116116                chip_writeb(0, flash->virtual_registers + i + 2); 
    117         } 
    118  
    119         return 0; 
    120 } 
    121  
    122 int erase_block_82802ab(struct flashchip *flash, unsigned int page, unsigned int pagesize) 
     117 
     118        return 0; 
     119} 
     120 
     121int erase_block_82802ab(struct flashchip *flash, unsigned int page, 
     122                        unsigned int pagesize) 
    123123{ 
    124124        chipaddr bios = flash->virtual_memory; 
     
    179179                can_unlock = 1; 
    180180        } 
    181          
     181 
    182182        /* Read block lock-bits */ 
    183183        for (i = 0; i < flash->total_size * 1024; i+= (64 * 1024)) { 
  • trunk/a25.c

    r1316 r1397  
    3232 
    3333        msg_cdbg("Chip status register: Status Register Write Disable " 
    34                      "(SRWD) is %sset\n", (status & (1 << 7)) ? "" : "not "); 
     34                 "(SRWD) is %sset\n", (status & (1 << 7)) ? "" : "not "); 
    3535        spi_prettyprint_status_register_bit(status, 6); 
    3636        spi_prettyprint_status_register_bit(status, 5); 
     
    4949 
    5050        msg_cdbg("Chip status register: Status Register Write Disable " 
    51                      "(SRWD) is %sset\n", (status & (1 << 7)) ? "" : "not "); 
     51                 "(SRWD) is %sset\n", (status & (1 << 7)) ? "" : "not "); 
    5252        spi_prettyprint_status_register_bit(status, 6); 
    5353        spi_prettyprint_status_register_bit(status, 5); 
     
    6565 
    6666        msg_cdbg("Chip status register: Status Register Write Disable " 
    67                      "(SRWD) is %sset\n", (status & (1 << 7)) ? "" : "not "); 
     67                 "(SRWD) is %sset\n", (status & (1 << 7)) ? "" : "not "); 
    6868        msg_cdbg("Chip status register: Sector Protect Size (SEC) " 
    6969                 "is %i KB\n", (status & (1 << 6)) ? 4 : 64); 
     
    8484 
    8585        msg_cdbg("Chip status register: Status Register Write Disable " 
    86                      "(SRWD) is %sset\n", (status & (1 << 7)) ? "" : "not "); 
     86                 "(SRWD) is %sset\n", (status & (1 << 7)) ? "" : "not "); 
    8787        msg_cdbg("Chip status register: Sector Protect Size (SEC) " 
    8888                 "is %i KB\n", (status & (1 << 6)) ? 4 : 64); 
  • trunk/bitbang_spi.c

    r1299 r1397  
    6969 
    7070static const struct spi_programmer spi_programmer_bitbang = { 
    71         .type = SPI_CONTROLLER_BITBANG, 
    72         .max_data_read = MAX_DATA_READ_UNLIMITED, 
    73         .max_data_write = MAX_DATA_WRITE_UNLIMITED, 
    74         .command = bitbang_spi_send_command, 
    75         .multicommand = default_spi_send_multicommand, 
    76         .read = default_spi_read, 
    77         .write_256 = default_spi_write_256, 
     71        .type           = SPI_CONTROLLER_BITBANG, 
     72        .max_data_read  = MAX_DATA_READ_UNLIMITED, 
     73        .max_data_write = MAX_DATA_WRITE_UNLIMITED, 
     74        .command        = bitbang_spi_send_command, 
     75        .multicommand   = default_spi_send_multicommand, 
     76        .read           = default_spi_read, 
     77        .write_256      = default_spi_write_256, 
    7878}; 
    7979 
  • trunk/board_enable.c

    r1396 r1397  
    180180        UNIMPLEMENTED_PORT, 
    181181        {w83627hf_port2_mux, 0x08, 0, 0xF0}, 
    182         UNIMPLEMENTED_PORT 
     182        UNIMPLEMENTED_PORT, 
    183183}; 
    184184 
     
    191191        {0x2A, 0x01, 0x01}, 
    192192        {0x2A, 0x01, 0x01}, 
    193         {0x2A, 0x01, 0x01} 
     193        {0x2A, 0x01, 0x01}, 
    194194}; 
    195195 
     
    200200        UNIMPLEMENTED_PORT, 
    201201        UNIMPLEMENTED_PORT, 
    202         UNIMPLEMENTED_PORT 
     202        UNIMPLEMENTED_PORT, 
    203203}; 
    204204 
     
    211211        {0x2D, 0x20, 0x20},     /* or suspend LED */ 
    212212        {0x2D, 0x40, 0x40},     /* or panel switch input */ 
    213         {0x2D, 0x80, 0x80}      /* or panel switch output */ 
     213        {0x2D, 0x80, 0x80},     /* or panel switch output */ 
    214214}; 
    215215 
     
    219219        UNIMPLEMENTED_PORT,     /* GPIO3 */ 
    220220        {w83627thf_port4_mux, 0x09, 1, 0xF4}, 
    221         UNIMPLEMENTED_PORT      /* GPIO5 */ 
     221        UNIMPLEMENTED_PORT,     /* GPIO5 */ 
    222222}; 
    223223 
     
    562562        id = sio_read(0x2E, 0x20); 
    563563        if (id != chipid) { 
    564                 msg_perr("PC8736x: unexpected ID %02x (expected %02x)\n", id, chipid); 
     564                msg_perr("PC8736x: unexpected ID %02x (expected %02x)\n", 
     565                         id, chipid); 
    565566                return -1; 
    566567        } 
     
    812813        struct pci_dev *dev; 
    813814 
    814         dev = pci_dev_find(0x10DE, 0x0050);     /* NVIDIA CK804 ISA Bridge. */ 
     815        dev = pci_dev_find(0x10DE, 0x0050);     /* NVIDIA CK804 ISA bridge. */ 
    815816        if (!dev) { 
    816817                msg_perr("\nERROR: NVIDIA nForce4 ISA bridge not found.\n"); 
     
    818819        } 
    819820 
    820         /* one of those bits seems to be connected to TBL#, but -ENOINFO. */ 
     821        /* One of those bits seems to be connected to TBL#, but -ENOINFO. */ 
    821822        pci_write_byte(dev, 0x92, 0); 
    822823 
     
    852853{ 
    853854        struct pci_dev *dev; 
    854         uint16_t base; 
    855         uint16_t devclass; 
     855        uint16_t base, devclass; 
    856856        uint8_t tmp; 
    857857 
     
    861861        } 
    862862 
    863         /* First, check the ISA Bridge */ 
     863        /* First, check the ISA bridge */ 
    864864        dev = pci_dev_find_vendorclass(0x10DE, 0x0601); 
    865865        switch (dev->device_id) { 
     
    10931093/* 
    10941094 * Suited for: 
    1095  *  - Asus A8AE-LE (Codename AmberineM; used in Compaq Presario 061) 
     1095 *  - ASUS A8AE-LE (Codename AmberineM; used in Compaq Presario 061) 
    10961096 * Datasheet(s) used: 
    10971097 *  - AMD document 43009 "AMD SB700/710/750 Register Reference Guide" rev. 1.00 
     
    11021102        uint32_t reg; 
    11031103 
    1104         dev = pci_dev_find(0x1002, 0x4372); /* AMD SMBus Controller */ 
     1104        dev = pci_dev_find(0x1002, 0x4372); /* AMD SMBus controller */ 
    11051105        if (!dev) { 
    11061106                msg_perr("\nERROR: AMD SMBus Controller (0x4372) not found.\n"); 
     
    11291129        uint32_t tmp, base; 
    11301130 
    1131         static const uint32_t nonmuxed_gpos  = 0x58000101; /* GPPO {0,8,27,28,30} are always available */ 
     1131        /* GPPO {0,8,27,28,30} are always available */ 
     1132        static const uint32_t nonmuxed_gpos  = 0x58000101; 
    11321133 
    11331134        static const struct {unsigned int reg, mask, value; } piix4_gpo[] = { 
    1134           {0}, 
    1135           {0xB0, 0x0001, 0x0000},        /* GPO1... */ 
    1136           {0xB0, 0x0001, 0x0000}, 
    1137           {0xB0, 0x0001, 0x0000}, 
    1138           {0xB0, 0x0001, 0x0000}, 
    1139           {0xB0, 0x0001, 0x0000}, 
    1140           {0xB0, 0x0001, 0x0000}, 
    1141           {0xB0, 0x0001, 0x0000},        /* ...GPO7: GENCFG bit 0 */ 
    1142           {0}, 
    1143           {0xB0, 0x0100, 0x0000},        /* GPO9:  GENCFG bit 8 */ 
    1144           {0xB0, 0x0200, 0x0000},        /* GPO10: GENCFG bit 9 */ 
    1145           {0xB0, 0x0400, 0x0000},        /* GPO11: GENCFG bit 10 */ 
    1146           {0x4E, 0x0100, 0x0000},        /* GPO12... */ 
    1147           {0x4E, 0x0100, 0x0000}, 
    1148           {0x4E, 0x0100, 0x0000},        /* ...GPO14: XBCS bit 8 */ 
    1149           {0xB2, 0x0002, 0x0002},        /* GPO15... */ 
    1150           {0xB2, 0x0002, 0x0002},        /* ...GPO16: GENCFG bit 17 */ 
    1151           {0xB2, 0x0004, 0x0004},        /* GPO17: GENCFG bit 18 */ 
    1152           {0xB2, 0x0008, 0x0008},        /* GPO18: GENCFG bit 19 */ 
    1153           {0xB2, 0x0010, 0x0010},        /* GPO19: GENCFG bit 20 */ 
    1154           {0xB2, 0x0020, 0x0020},        /* GPO20: GENCFG bit 21 */ 
    1155           {0xB2, 0x0040, 0x0040},        /* GPO21: GENCFG bit 22 */ 
    1156           {0xB2, 0x1000, 0x1000},        /* GPO22... */ 
    1157           {0xB2, 0x1000, 0x1000},        /* ...GPO23: GENCFG bit 28 */ 
    1158           {0xB2, 0x2000, 0x2000},        /* GPO24: GENCFG bit 29 */ 
    1159           {0xB2, 0x4000, 0x4000},        /* GPO25: GENCFG bit 30 */ 
    1160           {0xB2, 0x8000, 0x8000},        /* GPO26: GENCFG bit 31 */ 
    1161           {0}, 
    1162           {0}, 
    1163           {0x4E, 0x0100, 0x0000},        /* ...GPO29: XBCS bit 8 */ 
    1164           {0} 
     1135                {0}, 
     1136                {0xB0, 0x0001, 0x0000},        /* GPO1... */ 
     1137                {0xB0, 0x0001, 0x0000}, 
     1138                {0xB0, 0x0001, 0x0000}, 
     1139                {0xB0, 0x0001, 0x0000}, 
     1140                {0xB0, 0x0001, 0x0000}, 
     1141                {0xB0, 0x0001, 0x0000}, 
     1142                {0xB0, 0x0001, 0x0000},        /* ...GPO7: GENCFG bit 0 */ 
     1143                {0}, 
     1144                {0xB0, 0x0100, 0x0000},        /* GPO9:  GENCFG bit 8 */ 
     1145                {0xB0, 0x0200, 0x0000},        /* GPO10: GENCFG bit 9 */ 
     1146                {0xB0, 0x0400, 0x0000},        /* GPO11: GENCFG bit 10 */ 
     1147                {0x4E, 0x0100, 0x0000},        /* GPO12... */ 
     1148                {0x4E, 0x0100, 0x0000}, 
     1149                {0x4E, 0x0100, 0x0000},        /* ...GPO14: XBCS bit 8 */ 
     1150                {0xB2, 0x0002, 0x0002},        /* GPO15... */ 
     1151                {0xB2, 0x0002, 0x0002},        /* ...GPO16: GENCFG bit 17 */ 
     1152                {0xB2, 0x0004, 0x0004},        /* GPO17: GENCFG bit 18 */ 
     1153                {0xB2, 0x0008, 0x0008},        /* GPO18: GENCFG bit 19 */ 
     1154                {0xB2, 0x0010, 0x0010},        /* GPO19: GENCFG bit 20 */ 
     1155                {0xB2, 0x0020, 0x0020},        /* GPO20: GENCFG bit 21 */ 
     1156                {0xB2, 0x0040, 0x0040},        /* GPO21: GENCFG bit 22 */ 
     1157                {0xB2, 0x1000, 0x1000},        /* GPO22... */ 
     1158                {0xB2, 0x1000, 0x1000},        /* ...GPO23: GENCFG bit 28 */ 
     1159                {0xB2, 0x2000, 0x2000},        /* GPO24: GENCFG bit 29 */ 
     1160                {0xB2, 0x4000, 0x4000},        /* GPO25: GENCFG bit 30 */ 
     1161                {0xB2, 0x8000, 0x8000},        /* GPO26: GENCFG bit 31 */ 
     1162                {0}, 
     1163                {0}, 
     1164                {0x4E, 0x0100, 0x0000},        /* ...GPO29: XBCS bit 8 */ 
     1165                {0} 
    11651166        }; 
    1166  
    11671167 
    11681168        dev = pci_dev_find(0x8086, 0x7110);     /* Intel PIIX4 ISA bridge */ 
     
    11781178        } 
    11791179 
    1180         if ( (((1 << gpo) & nonmuxed_gpos) == 0) && 
    1181              (pci_read_word(dev, piix4_gpo[gpo].reg) & piix4_gpo[gpo].mask) != piix4_gpo[gpo].value ) { 
    1182           msg_perr("\nERROR: PIIX4 GPO%d not programmed for output.\n", gpo); 
    1183           return -1; 
     1180        if ((((1 << gpo) & nonmuxed_gpos) == 0) && 
     1181             (pci_read_word(dev, piix4_gpo[gpo].reg) 
     1182             & piix4_gpo[gpo].mask) != piix4_gpo[gpo].value) { 
     1183                msg_perr("\nERROR: PIIX4 GPO%d not programmed for output.\n", 
     1184                         gpo); 
     1185                return -1; 
    11841186        } 
    11851187 
     
    13161318                device_class = pci_read_word(dev, PCI_CLASS_DEVICE); 
    13171319                if ((dev->vendor_id == 0x8086) && 
    1318                     (device_class == 0x0601)) { /* ISA Bridge */ 
     1320                    (device_class == 0x0601)) { /* ISA bridge */ 
    13191321                        /* Is this device in our list? */ 
    13201322                        for (i = 0; intel_ich_gpio_table[i].id; i++) 
     
    13281330 
    13291331        if (!dev) { 
    1330                 msg_perr("\nERROR: No Known Intel LPC Bridge found.\n"); 
     1332                msg_perr("\nERROR: No known Intel LPC bridge found.\n"); 
    13311333                return -1; 
    13321334        } 
     
    13481350 
    13491351        if (!allowed) { 
    1350                 msg_perr("\nERROR: This Intel LPC Bridge does not allow" 
    1351                         " setting GPIO%02d\n", gpio); 
    1352                 return -1; 
    1353         } 
    1354  
    1355         msg_pdbg("\nIntel ICH LPC Bridge: %sing GPIO%02d.\n", 
    1356               raise ? "Rais" : "Dropp", gpio); 
     1352                msg_perr("\nERROR: This Intel LPC bridge does not allow" 
     1353                         " setting GPIO%02d\n", gpio); 
     1354                return -1; 
     1355        } 
     1356 
     1357        msg_pdbg("\nIntel ICH LPC bridge: %sing GPIO%02d.\n", 
     1358                raise ? "Rais" : "Dropp", gpio); 
    13571359 
    13581360        if (gpio < 32) { 
     
    13721374                        tmp = INL(base); 
    13731375                        if (!(tmp & (1 << gpio))) { 
    1374                                 msg_perr("\nERROR: This Intel LPC Bridge" 
     1376                                msg_perr("\nERROR: This Intel LPC bridge" 
    13751377                                        " does not allow setting GPIO%02d\n", 
    13761378                                        gpio); 
     
    14041406                        tmp = INL(base + 30); 
    14051407                        if (!(tmp & (1 << gpio))) { 
    1406                                 msg_perr("\nERROR: This Intel LPC Bridge" 
     1408                                msg_perr("\nERROR: This Intel LPC bridge" 
    14071409                                        " does not allow setting GPIO%02d\n", 
    14081410                                        gpio + 32); 
     
    14331435                tmp = INL(base + 40); 
    14341436                if (!(tmp & (1 << gpio))) { 
    1435                         msg_perr("\nERROR: This Intel LPC Bridge does " 
     1437                        msg_perr("\nERROR: This Intel LPC bridge does " 
    14361438                                "not allow setting GPIO%02d\n", gpio + 64); 
    14371439                        return -1; 
     
    16081610        int ret; 
    16091611 
    1610         /* vendor BIOS ends up in LDN6... maybe the board enable is wrong, 
     1612        /* Vendor BIOS ends up in LDN6... maybe the board enable is wrong, 
    16111613         * or perhaps it's not needed at all? 
    1612          * the regs it tries to touch are 0xF0, 0xF1, 0xF2 which means if it 
    1613          * were in the right LDN, it would have to be GPIO1 or GPIO3 
     1614         * The regs it tries to touch are 0xF0, 0xF1, 0xF2 which means if it 
     1615         * were in the right LDN, it would have to be GPIO1 or GPIO3. 
    16141616         */ 
    16151617/* 
     
    16601662{ 
    16611663        struct pci_dev *dev; 
    1662         uint32_t base; 
    1663         uint32_t tmp; 
    1664  
    1665         /* VT82C686 Power management */ 
     1664        uint32_t base, tmp; 
     1665 
     1666        /* VT82C686 power management */ 
    16661667        dev = pci_dev_find(0x1106, 0x3057); 
    16671668        if (!dev) { 
     
    16711672 
    16721673        msg_pdbg("\nVIA Apollo ACPI: %sing GPIO%02d.\n", 
    1673               raise ? "Rais" : "Dropp", gpio); 
    1674  
    1675         /* select GPO function on multiplexed pins */ 
     1674                raise ? "Rais" : "Dropp", gpio); 
     1675 
     1676        /* Select GPO function on multiplexed pins. */ 
    16761677        tmp = pci_read_byte(dev, 0x54); 
    1677         switch(gpio) 
    1678         { 
    1679                 case 0: 
    1680                         tmp &= ~0x03; 
    1681                         break; 
    1682                 case 1: 
    1683                         tmp |= 0x04; 
    1684                         break; 
    1685                 case 2: 
    1686                         tmp |= 0x08; 
    1687                         break; 
    1688                 case 3: 
    1689                         tmp |= 0x10; 
    1690                         break; 
     1678        switch (gpio) { 
     1679        case 0: 
     1680                tmp &= ~0x03; 
     1681                break; 
     1682        case 1: 
     1683                tmp |= 0x04; 
     1684                break; 
     1685        case 2: 
     1686                tmp |= 0x08; 
     1687                break; 
     1688        case 3: 
     1689                tmp |= 0x10; 
     1690                break; 
    16911691        } 
    16921692        pci_write_byte(dev, 0x54, tmp); 
     
    18811881        if ((port > 4) || /* also catches unsigned -1 */ 
    18821882            ((port < 4) && (line > 7)) || ((port == 4) && (line > 5))) { 
    1883             msg_perr("\nERROR: Unsupported IT8712F GPIO line %02d.\n", line); 
    1884             return -1; 
     1883                msg_perr("\nERROR: Unsupported IT8712F GPIO line %02d.\n", line); 
     1884                return -1; 
    18851885        } 
    18861886 
     
    19071907        } 
    19081908 
    1909         /* set GPIO. */ 
     1909        /* Set GPIO. */ 
    19101910        tmp = INB(base + port); 
    19111911        if (raise) 
     
    20922092 * Require main PCI IDs to match too as extra safety. 
    20932093 */ 
    2094 static const struct board_pciid_enable *board_match_coreboot_name(const char *vendor, 
    2095                                                             const char *part) 
     2094static const struct board_pciid_enable *board_match_coreboot_name( 
     2095                                        const char *vendor, const char *part) 
    20962096{ 
    20972097        const struct board_pciid_enable *board = board_pciid_enables; 
     
    21202120                        msg_pinfo("AMBIGUOUS BOARD NAME: %s\n", part); 
    21212121                        msg_pinfo("At least vendors '%s' and '%s' match.\n", 
    2122                                partmatch->lb_vendor, board->lb_vendor); 
     2122                                  partmatch->lb_vendor, board->lb_vendor); 
    21232123                        msg_perr("Please use the full -m vendor:part syntax.\n"); 
    21242124                        return NULL; 
     
    21362136                 */ 
    21372137                msg_perr("\nUnknown vendor:board from -m option: %s:%s\n\n", 
    2138                       vendor, part); 
     2138                        vendor, part); 
    21392139        } 
    21402140        return NULL; 
     
    21452145 * Second set of IDs can be main only or missing completely. 
    21462146 */ 
    2147 const static struct board_pciid_enable *board_match_pci_card_ids(enum board_match_phase phase) 
     2147const static struct board_pciid_enable *board_match_pci_card_ids( 
     2148                                                enum board_match_phase phase) 
    21482149{ 
    21492150        const struct board_pciid_enable *board = board_pciid_enables; 
     
    21782179                        if (!has_dmi_support) { 
    21792180                                msg_perr("WARNING: Can't autodetect %s %s," 
    2180                                       " DMI info unavailable.\n", 
    2181                                       board->vendor_name, board->board_name); 
     2181                                        " DMI info unavailable.\n", 
     2182                                        board->vendor_name, board->board_name); 
    21822183                                continue; 
    21832184                        } else { 
     
    22032204        if (!force_boardenable) { 
    22042205                msg_pinfo("WARNING: Your mainboard is %s %s, but the mainboard-specific\n" 
    2205                        "code has not been tested, and thus will not be executed by default.\n" 
    2206                        "Depending on your hardware environment, erasing, writing or even probing\n" 
    2207                        "can fail without running the board specific code.\n\n" 
    2208                        "Please see the man page (section PROGRAMMER SPECIFIC INFO, subsection\n" 
    2209                        "\"internal programmer\") for details.\n", 
    2210                        board->vendor_name, board->board_name); 
     2206                          "code has not been tested, and thus will not be executed by default.\n" 
     2207                          "Depending on your hardware environment, erasing, writing or even probing\n" 
     2208                          "can fail without running the board specific code.\n\n" 
     2209                          "Please see the man page (section PROGRAMMER SPECIFIC INFO, subsection\n" 
     2210                          "\"internal programmer\") for details.\n", 
     2211                          board->vendor_name, board->board_name); 
    22112212                return 1; 
    22122213        } 
  • trunk/buspirate_spi.c

    r1367 r1397  
    5151#endif 
    5252 
    53 static int buspirate_sendrecv(unsigned char *buf, unsigned int writecnt, unsigned int readcnt) 
     53static int buspirate_sendrecv(unsigned char *buf, unsigned int writecnt, 
     54                              unsigned int readcnt) 
    5455{ 
    5556        int i, ret = 0; 
     
    9192 
    9293static const struct spi_programmer spi_programmer_buspirate = { 
    93         .type = SPI_CONTROLLER_BUSPIRATE, 
    94         .max_data_read = 12, 
    95         .max_data_write = 12, 
    96         .command = buspirate_spi_send_command, 
    97         .multicommand = default_spi_send_multicommand, 
    98         .read = default_spi_read, 
    99         .write_256 = default_spi_write_256, 
     94        .type           = SPI_CONTROLLER_BUSPIRATE, 
     95        .max_data_read  = 12, 
     96        .max_data_write = 12, 
     97        .command        = buspirate_spi_send_command, 
     98        .multicommand   = default_spi_send_multicommand, 
     99        .read           = default_spi_read, 
     100        .write_256      = default_spi_write_256, 
    100101}; 
    101102 
     
    109110        {"4M",          0x6}, 
    110111        {"8M",          0x7}, 
    111         {NULL,          0x0} 
     112        {NULL,          0x0}, 
    112113}; 
    113114 
     
    150151{ 
    151152        unsigned char buf[512]; 
    152         int ret = 0; 
    153         int i; 
     153        int ret = 0, i, spispeed = 0x7; 
    154154        char *dev = NULL; 
    155155        char *speed = NULL; 
    156         int spispeed = 0x7; 
    157156 
    158157        dev = extract_programmer_param("dev"); 
  • trunk/chipset_enable.c

    r1396 r1397  
    7878        newer = pci_read_byte(dev, 0x40); 
    7979        if (newer != new) { 
    80                 msg_pinfo("tried to set register 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x40, new, name); 
     80                msg_pinfo("tried to set register 0x%x to 0x%x on %s " 
     81                          "failed (WARNING ONLY)\n", 0x40, new, name); 
    8182                msg_pinfo("Stuck at 0x%x\n", newer); 
    8283                return -1; 
     
    8889{ 
    8990        struct pci_dev *sbdev; 
    90          
     91 
    9192        sbdev = pci_dev_find_vendorclass(vendor, 0x0601); 
    9293        if (!sbdev) 
     
    9899        if (sbdev) 
    99100                msg_pdbg("Found southbridge %04x:%04x at %02x:%02x:%01x\n", 
    100                              sbdev->vendor_id, sbdev->device_id, 
    101                              sbdev->bus, sbdev->dev, sbdev->func); 
     101                         sbdev->vendor_id, sbdev->device_id, 
     102                         sbdev->bus, sbdev->dev, sbdev->func); 
    102103        return sbdev; 
    103104} 
     
    166167        newer = pci_read_byte(sbdev, 0x45); 
    167168        if (newer != new) { 
    168                 msg_pinfo("tried to set register 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x45, new, name); 
     169                msg_pinfo("tried to set register 0x%x to 0x%x on %s failed " 
     170                          "(WARNING ONLY)\n", 0x45, new, name); 
    169171                msg_pinfo("Stuck at 0x%x\n", newer); 
    170172                ret = -1; 
     
    192194        newer = pci_read_byte(sbdev, 0x45); 
    193195        if (newer != new) { 
    194                 msg_pinfo("tried to set register 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x45, new, name); 
     196                msg_pinfo("tried to set register 0x%x to 0x%x on %s failed " 
     197                          "(WARNING ONLY)\n", 0x45, new, name); 
    195198                msg_pinfo("Stuck at 0x%x\n", newer); 
    196199                ret = -1; 
     
    239242 
    240243        if (pci_read_word(dev, xbcs) != new) { 
    241                 msg_pinfo("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", xbcs, new, name); 
     244                msg_pinfo("tried to set 0x%x to 0x%x on %s failed " 
     245                          "(WARNING ONLY)\n", xbcs, new, name); 
    242246                return -1; 
    243247        } 
     
    262266 
    263267        msg_pdbg("\nBIOS Lock Enable: %sabled, ", 
    264                      (old & (1 << 1)) ? "en" : "dis"); 
     268                 (old & (1 << 1)) ? "en" : "dis"); 
    265269        msg_pdbg("BIOS Write Enable: %sabled, ", 
    266                      (old & (1 << 0)) ? "en" : "dis"); 
     270                 (old & (1 << 0)) ? "en" : "dis"); 
    267271        msg_pdbg("BIOS_CNTL is 0x%x\n", old); 
    268272 
     
    272276         * 1 = BIOS region SMM protection is enabled. 
    273277         * The BIOS Region is not writable unless all processors are in SMM." 
    274          * In earlier chipsets this bit is reserved. */ 
    275         if (old & (1 << 5)) { 
     278         * In earlier chipsets this bit is reserved. 
     279         */ 
     280        if (old & (1 << 5)) 
    276281                msg_pinfo("WARNING: BIOS region SMM protection is enabled!\n"); 
    277         } 
    278282 
    279283        new = old | 1; 
     
    284288 
    285289        if (pci_read_byte(dev, bios_cntl) != new) { 
    286                 msg_pinfo("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", bios_cntl, new, name); 
     290                msg_pinfo("tried to set 0x%x to 0x%x on %s failed " 
     291                          "(WARNING ONLY)\n", bios_cntl, new, name); 
    287292                return -1; 
    288293        } 
     
    305310{ 
    306311        uint32_t fwh_conf; 
    307         int i; 
    308312        char *idsel = NULL; 
    309         int tmp; 
    310         int max_decode_fwh_idsel = 0; 
    311         int max_decode_fwh_decode = 0; 
     313        int i, tmp, max_decode_fwh_idsel = 0, max_decode_fwh_decode = 0; 
    312314        int contiguous = 1; 
    313315 
    314316        idsel = extract_programmer_param("fwh_idsel"); 
    315317        if (idsel && strlen(idsel)) { 
    316                 uint64_t fwh_idsel_old; 
    317                 uint64_t fwh_idsel; 
     318                uint64_t fwh_idsel_old, fwh_idsel; 
    318319                errno = 0; 
    319320                /* Base 16, nothing else makes sense. */ 
     
    359360                tmp = (fwh_conf >> (i * 4)) & 0xf; 
    360361                msg_pdbg("\n0x%08x/0x%08x FWH IDSEL: 0x%x", 
    361                              (0x1ff8 + i) * 0x80000, 
    362                              (0x1ff0 + i) * 0x80000, 
    363                              tmp); 
     362                         (0x1ff8 + i) * 0x80000, 
     363                         (0x1ff0 + i) * 0x80000, 
     364                         tmp); 
    364365                if ((tmp == 0) && contiguous) { 
    365366                        max_decode_fwh_idsel = (8 - i) * 0x80000; 
     
    373374                tmp = (fwh_conf >> (i * 4)) & 0xf; 
    374375                msg_pdbg("\n0x%08x/0x%08x FWH IDSEL: 0x%x", 
    375                              (0xff4 + i) * 0x100000, 
    376                              (0xff0 + i) * 0x100000, 
    377                              tmp); 
     376                         (0xff4 + i) * 0x100000, 
     377                         (0xff0 + i) * 0x100000, 
     378                         tmp); 
    378379                if ((tmp == 0) && contiguous) { 
    379380                        max_decode_fwh_idsel = (8 - i) * 0x100000; 
     
    388389                tmp = (fwh_conf >> (i + 0x8)) & 0x1; 
    389390                msg_pdbg("\n0x%08x/0x%08x FWH decode %sabled", 
    390                              (0x1ff8 + i) * 0x80000, 
    391                              (0x1ff0 + i) * 0x80000, 
    392                              tmp ? "en" : "dis"); 
     391                         (0x1ff8 + i) * 0x80000, 
     392                         (0x1ff0 + i) * 0x80000, 
     393                         tmp ? "en" : "dis"); 
    393394                if ((tmp == 1) && contiguous) { 
    394395                        max_decode_fwh_decode = (8 - i) * 0x80000; 
     
    400401                tmp = (fwh_conf >> i) & 0x1; 
    401402                msg_pdbg("\n0x%08x/0x%08x FWH decode %sabled", 
    402                              (0xff4 + i) * 0x100000, 
    403                              (0xff0 + i) * 0x100000, 
    404                              tmp ? "en" : "dis"); 
     403                         (0xff4 + i) * 0x100000, 
     404                         (0xff0 + i) * 0x100000, 
     405                         tmp ? "en" : "dis"); 
    405406                if ((tmp == 1) && contiguous) { 
    406407                        max_decode_fwh_decode = (8 - i) * 0x100000; 
     
    421422static int enable_flash_poulsbo(struct pci_dev *dev, const char *name) 
    422423{ 
    423        uint16_t old, new; 
    424        int err; 
    425  
    426        if ((err = enable_flash_ich(dev, name, 0xd8)) != 0) 
    427                return err; 
    428  
    429        old = pci_read_byte(dev, 0xd9); 
    430        msg_pdbg("BIOS Prefetch Enable: %sabled, ", 
    431                     (old & 1) ? "en" : "dis"); 
    432        new = old & ~1; 
    433  
    434        if (new != old) 
    435                rpci_write_byte(dev, 0xd9, new); 
     424        uint16_t old, new; 
     425        int err; 
     426 
     427        if ((err = enable_flash_ich(dev, name, 0xd8)) != 0) 
     428                return err; 
     429 
     430        old = pci_read_byte(dev, 0xd9); 
     431        msg_pdbg("BIOS Prefetch Enable: %sabled, ", 
     432                (old & 1) ? "en" : "dis"); 
     433        new = old & ~1; 
     434 
     435        if (new != old) 
     436                rpci_write_byte(dev, 0xd9, new); 
    436437 
    437438        buses_supported = BUS_FWH; 
    438        return 0; 
    439 } 
    440  
     439        return 0; 
     440} 
    441441 
    442442#define ICH_STRAP_RSVD 0x00 
     
    458458        uint32_t tmp, gcs; 
    459459        void *rcrb; 
    460         //TODO: These names are incorrect for EP80579. For that, the solution would look like the commented line 
    461         //static const char *straps_names[] = {"SPI", "reserved", "reserved", "LPC" }; 
     460 
     461        /* 
     462         * TODO: These names are incorrect for EP80579. For that, the solution 
     463         * would look like the commented line below. 
     464         */ 
     465        // static const char *straps_names[] = {"SPI", "reserved", "reserved", "LPC" }; 
    462466        static const char *straps_names[] = { "reserved", "SPI", "PCI", "LPC" }; 
    463467 
     
    475479        msg_pdbg("GCS = 0x%x: ", gcs); 
    476480        msg_pdbg("BIOS Interface Lock-Down: %sabled, ", 
    477                      (gcs & 0x1) ? "en" : "dis"); 
     481                 (gcs & 0x1) ? "en" : "dis"); 
    478482        bbs = (gcs >> 10) & 0x3; 
    479483        msg_pdbg("BOOT BIOS Straps: 0x%x (%s)\n", bbs, straps_names[bbs]); 
     
    481485        buc = mmio_readb(rcrb + 0x3414); 
    482486        msg_pdbg("Top Swap : %s\n", 
    483                      (buc & 1) ? "enabled (A16 inverted)" : "not enabled"); 
     487                 (buc & 1) ? "enabled (A16 inverted)" : "not enabled"); 
    484488 
    485489        /* It seems the ICH7 does not support SPI and LPC chips at the same 
     
    490494        buses_supported = BUS_FWH; 
    491495        if (ich_generation == 7) { 
    492                 if(bbs == ICH_STRAP_LPC) { 
     496                if (bbs == ICH_STRAP_LPC) { 
    493497                        /* No further SPI initialization required */ 
    494498                        return ret; 
    495                 } 
    496                 else 
     499                } else { 
    497500                        /* Disable LPC/FWH if strapped to PCI or SPI */ 
    498501                        buses_supported = 0; 
    499         } 
    500  
    501         /* this adds BUS_SPI */ 
     502                } 
     503        } 
     504 
     505        /* This adds BUS_SPI */ 
    502506        if (ich_init_spi(dev, tmp, rcrb, ich_generation) != 0) { 
    503                 if (!ret) 
    504                         ret = ERROR_NONFATAL; 
    505         } 
     507                if (!ret) 
     508                        ret = ERROR_NONFATAL; 
     509        } 
    506510 
    507511        return ret; 
     
    533537 
    534538        val = pci_read_byte(dev, 0x71); 
    535         if (val & 0x40) 
    536         { 
     539        if (val & 0x40) { 
    537540                msg_pdbg("Disabling byte merging\n"); 
    538541                val &= ~0x40; 
     
    546549        uint8_t val; 
    547550 
    548         /* enable ROM decode range (1MB) FFC00000 - FFFFFFFF */ 
     551        /* Enable ROM decode range (1MB) FFC00000 - FFFFFFFF. */ 
    549552        rpci_write_byte(dev, 0x41, 0x7f); 
    550553 
     
    556559        if (pci_read_byte(dev, 0x40) != val) { 
    557560                msg_pinfo("\nWARNING: Failed to enable flash write on \"%s\"\n", 
    558                        name); 
     561                          name); 
    559562                return -1; 
    560563        } 
    561564 
    562565        if (dev->device_id == 0x3227) { /* VT8237R */ 
    563             /* All memory cycles, not just ROM ones, go to LPC. */ 
    564             val = pci_read_byte(dev, 0x59); 
    565             val &= ~0x80; 
    566             rpci_write_byte(dev, 0x59, val); 
     566                /* All memory cycles, not just ROM ones, go to LPC. */ 
     567                val = pci_read_byte(dev, 0x59); 
     568                val &= ~0x80; 
     569                rpci_write_byte(dev, 0x59, val); 
    567570        } 
    568571 
     
    672675 
    673676        if (new != 0xee) { 
    674                 msg_pinfo("tried to set register 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x52, new, name); 
     677                msg_pinfo("tried to set register 0x%x to 0x%x on %s failed " 
     678                          "(WARNING ONLY)\n", 0x52, new, name); 
    675679                return -1; 
    676680        } 
     
    690694                rpci_write_byte(dev, 0x43, new); 
    691695                if (pci_read_byte(dev, 0x43) != new) { 
    692                         msg_pinfo("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x43, new, name); 
     696                        msg_pinfo("tried to set 0x%x to 0x%x on %s failed " 
     697                                  "(WARNING ONLY)\n", 0x43, new, name); 
    693698                } 
    694699        } 
     
    702707 
    703708        if (pci_read_byte(dev, 0x40) != new) { 
    704                 msg_pinfo("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x40, new, name); 
     709                msg_pinfo("tried to set 0x%x to 0x%x on %s failed " 
     710                          "(WARNING ONLY)\n", 0x40, new, name); 
    705711                return -1; 
    706712        } 
     
    722728                        continue; 
    723729                msg_pinfo("SB600 %s%sprotected from 0x%08x to 0x%08x\n", 
    724                         (prot & 0x1) ? "write " : "", 
    725                         (prot & 0x2) ? "read " : "", 
    726                         (prot & 0xfffff800), 
    727                         (prot & 0xfffff800) + (((prot & 0x7fc) << 8) | 0x3ff)); 
     730                          (prot & 0x1) ? "write " : "", 
     731                          (prot & 0x2) ? "read " : "", 
     732                          (prot & 0xfffff800), 
     733                          (prot & 0xfffff800) + (((prot & 0x7fc) << 8) | 0x3ff)); 
    728734                prot &= 0xfffffffc; 
    729735                rpci_write_byte(dev, reg, prot); 
     
    731737                if (prot & 0x3) 
    732738                        msg_perr("SB600 %s%sunprotect failed from 0x%08x to 0x%08x\n", 
    733                                 (prot & 0x1) ? "write " : "", 
    734                                 (prot & 0x2) ? "read " : "", 
    735                                 (prot & 0xfffff800), 
    736                                 (prot & 0xfffff800) + (((prot & 0x7fc) << 8) | 0x3ff)); 
     739                                 (prot & 0x1) ? "write " : "", 
     740                                 (prot & 0x2) ? "read " : "", 
     741                                 (prot & 0xfffff800), 
     742                                 (prot & 0xfffff800) + (((prot & 0x7fc) << 8) | 0x3ff)); 
    737743        } 
    738744 
     
    801807                rpci_write_byte(dev, 0x88, new); 
    802808                if (pci_read_byte(dev, 0x88) != new) { 
    803                         msg_pinfo("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x88, new, name); 
     809                        msg_pinfo("tried to set 0x%x to 0x%x on %s failed " 
     810                                  "(WARNING ONLY)\n", 0x88, new, name); 
    804811                } 
    805812        } 
     
    812819 
    813820        if (pci_read_byte(dev, 0x6d) != new) { 
    814                 msg_pinfo("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x6d, new, name); 
     821                msg_pinfo("tried to set 0x%x to 0x%x on %s failed " 
     822                          "(WARNING ONLY)\n", 0x6d, new, name); 
    815823                return -1; 
    816824        } 
     
    895903 
    896904        if (pci_read_byte(dev, 0x6d) != new) { 
    897                 msg_pinfo("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x6d, new, name); 
     905                msg_pinfo("tried to set 0x%x to 0x%x on %s failed " 
     906                          "(WARNING ONLY)\n", 0x6d, new, name); 
    898907                return -1; 
    899908        } 
     
    909918static int enable_flash_mcp6x_7x(struct pci_dev *dev, const char *name) 
    910919{ 
    911         int ret = 0; 
    912         int want_spi = 0; 
     920        int ret = 0, want_spi = 0; 
    913921        uint8_t val; 
    914922 
     
    953961#endif 
    954962 
    955         if (mcp6x_spi_init(want_spi)) { 
     963        if (mcp6x_spi_init(want_spi)) 
    956964                ret = 1; 
    957         } 
     965 
    958966out_msg: 
    959967        msg_pinfo("Please send the output of \"flashrom -V\" to " 
     
    10211029                } 
    10221030        } else { 
    1023                 msg_pinfo("AMD Elan SC520 detected, but no BOOTCS. Assuming flash at 4G\n"); 
     1031                msg_pinfo("AMD Elan SC520 detected, but no BOOTCS. " 
     1032                          "Assuming flash at 4G\n"); 
    10241033        } 
    10251034 
     
    12701279                } else if (ret < 0) 
    12711280                        msg_pinfo("FAILED!\n"); 
    1272                 else if(ret == 0) 
     1281                else if (ret == 0) 
    12731282                        msg_pinfo("OK.\n"); 
    1274                 else if(ret == ERROR_NONFATAL) 
     1283                else if (ret == ERROR_NONFATAL) 
    12751284                        msg_pinfo("PROBLEMS, continuing anyway\n"); 
    12761285        } 
  • trunk/cli_classic.c

    r1386 r1397  
    104104        struct flashchip flashes[3]; 
    105105        struct flashchip *fill_flash; 
    106         int startchip = 0; 
    107         int chipcount = 0; 
    108106        const char *name; 
    109         int namelen; 
    110         int opt; 
    111         int option_index = 0; 
    112         int force = 0; 
     107        int startchip = 0, chipcount = 0, namelen, opt, option_index = 0; 
    113108        int read_it = 0, write_it = 0, erase_it = 0, verify_it = 0; 
    114         int dont_verify_it = 0, list_supported = 0; 
     109        int dont_verify_it = 0, list_supported = 0, force = 0; 
    115110#if CONFIG_PRINT_WIKI == 1 
    116111        int list_supported_wiki = 0; 
    117112#endif 
    118         int operation_specified = 0; 
    119         int i; 
    120         int ret = 0; 
     113        int operation_specified = 0, i, ret = 0; 
    121114 
    122115        static const char optstring[] = "r:Rw:v:nVEfc:m:l:i:p:Lzh"; 
    123116        static const struct option long_options[] = { 
    124                 {"read", 1, NULL, 'r'}, 
    125                 {"write", 1, NULL, 'w'}, 
    126                 {"erase", 0, NULL, 'E'}, 
    127                 {"verify", 1, NULL, 'v'}, 
    128                 {"noverify", 0, NULL, 'n'}, 
    129                 {"chip", 1, NULL, 'c'}, 
    130                 {"mainboard", 1, NULL, 'm'}, 
    131                 {"verbose", 0, NULL, 'V'}, 
    132                 {"force", 0, NULL, 'f'}, 
    133                 {"layout", 1, NULL, 'l'}, 
    134                 {"image", 1, NULL, 'i'}, 
    135                 {"list-supported", 0, NULL, 'L'}, 
    136                 {"list-supported-wiki", 0, NULL, 'z'}, 
    137                 {"programmer", 1, NULL, 'p'}, 
    138                 {"help", 0, NULL, 'h'}, 
    139                 {"version", 0, NULL, 'R'}, 
    140                 {NULL, 0, NULL, 0} 
     117                {"read",                1, NULL, 'r'}, 
     118                {"write",               1, NULL, 'w'}, 
     119                {"erase",               0, NULL, 'E'}, 
     120                {"verify",              1, NULL, 'v'}, 
     121                {"noverify",            0, NULL, 'n'}, 
     122                {"chip",                1, NULL, 'c'}, 
     123                {"mainboard",           1, NULL, 'm'}, 
     124                {"verbose",             0, NULL, 'V'}, 
     125                {"force",               0, NULL, 'f'}, 
     126                {"layout",              1, NULL, 'l'}, 
     127                {"image",               1, NULL, 'i'}, 
     128                {"list-supported",      0, NULL, 'L'}, 
     129                {"list-supported-wiki", 0, NULL, 'z'}, 
     130                {"programmer",          1, NULL, 'p'}, 
     131                {"help",                0, NULL, 'h'}, 
     132                {"version",             0, NULL, 'R'}, 
     133                {NULL,                  0, NULL, 0}, 
    141134        }; 
    142135 
    143136        char *filename = NULL; 
    144  
    145137        char *tempstr = NULL; 
    146138        char *pparam = NULL; 
     
    356348                                chip_to_probe); 
    357349                        printf("Run flashrom -L to view the hardware supported " 
    358                                 "in this flashrom version.\n"); 
     350                               "in this flashrom version.\n"); 
    359351                        exit(1); 
    360352                } 
     
    385377                for (i = 1; i < chipcount; i++) 
    386378                        printf(", \"%s\"", flashes[i].name); 
    387                 printf("\nPlease specify which chip to use with the -c <chipname> option.\n"); 
     379                printf("\nPlease specify which chip to use with the " 
     380                       "-c <chipname> option.\n"); 
    388381                ret = 1; 
    389382                goto out_shutdown; 
     
    391384                printf("No EEPROM/flash device found.\n"); 
    392385                if (!force || !chip_to_probe) { 
    393                         printf("Note: flashrom can never write if the flash chip isn't found automatically.\n"); 
     386                        printf("Note: flashrom can never write if the flash " 
     387                               "chip isn't found automatically.\n"); 
    394388                } 
    395389                if (force && read_it && chip_to_probe) { 
    396                         printf("Force read (-f -r -c) requested, pretending the chip is there:\n"); 
     390                        printf("Force read (-f -r -c) requested, pretending " 
     391                               "the chip is there:\n"); 
    397392                        startchip = probe_flash(0, &flashes[0], 1); 
    398393                        if (startchip == -1) { 
    399                                 printf("Probing for flash chip '%s' failed.\n", chip_to_probe); 
     394                                printf("Probing for flash chip '%s' failed.\n", 
     395                                       chip_to_probe); 
    400396                                ret = 1; 
    401397                                goto out_shutdown; 
    402398                        } 
    403                         printf("Please note that forced reads most likely contain garbage.\n"); 
     399                        printf("Please note that forced reads most likely " 
     400                               "contain garbage.\n"); 
    404401                        return read_flash_to_file(&flashes[0], filename); 
    405402                } 
  • trunk/dediprog.c

    r1338 r1397  
    7272{ 
    7373        int ret, target_leds; 
    74          
     74 
    7575        if (leds < 0 || leds > 7) 
    7676                leds = 0; // Bogus value, enable all LEDs 
     
    9393        } 
    9494 
    95         ret = usb_control_msg(dediprog_handle, 0x42, 0x07, 0x09, target_leds, NULL, 0x0, DEFAULT_TIMEOUT); 
     95        ret = usb_control_msg(dediprog_handle, 0x42, 0x07, 0x09, target_leds, 
     96                              NULL, 0x0, DEFAULT_TIMEOUT); 
    9697        if (ret != 0x0) { 
    97                 msg_perr("Command Set LED 0x%x failed (%s)!\n", leds, usb_strerror()); 
     98                msg_perr("Command Set LED 0x%x failed (%s)!\n", 
     99                         leds, usb_strerror()); 
    98100                return 1; 
    99101        } 
     
    130132                 millivolt % 1000); 
    131133 
    132         ret = usb_control_msg(dediprog_handle, 0x42, 0x9, voltage_selector, 0xff, NULL, 0x0, DEFAULT_TIMEOUT); 
     134        ret = usb_control_msg(dediprog_handle, 0x42, 0x9, voltage_selector, 
     135                              0xff, NULL, 0x0, DEFAULT_TIMEOUT); 
    133136        if (ret != 0x0) { 
    134                 msg_perr("Command Set SPI Voltage 0x%x failed!\n", voltage_selector); 
     137                msg_perr("Command Set SPI Voltage 0x%x failed!\n", 
     138                         voltage_selector); 
    135139                return 1; 
    136140        } 
     
    187191        msg_pdbg("Setting SPI speed to %u kHz\n", khz); 
    188192 
    189         ret = usb_control_msg(dediprog_handle, 0x42, 0x61, speed, 0xff, NULL, 0x0, DEFAULT_TIMEOUT); 
     193        ret = usb_control_msg(dediprog_handle, 0x42, 0x61, speed, 0xff, NULL, 
     194                              0x0, DEFAULT_TIMEOUT); 
    190195        if (ret != 0x0) { 
    191196                msg_perr("Command Set SPI Speed 0x%x failed!\n", speed); 
     
    249254} 
    250255 
    251 static int dediprog_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len) 
     256static int dediprog_spi_read(struct flashchip *flash, uint8_t *buf, int start, 
     257                             int len) 
    252258{ 
    253259        int ret; 
     
    294300} 
    295301 
    296 static int dediprog_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len) 
     302static int dediprog_spi_write_256(struct flashchip *flash, uint8_t *buf, 
     303                                  int start, int len) 
    297304{ 
    298305        int ret; 
     
    328335        } 
    329336         
    330         ret = usb_control_msg(dediprog_handle, 0x42, 0x1, 0xff, readcnt ? 0x1 : 0x0, (char *)writearr, writecnt, DEFAULT_TIMEOUT); 
     337        ret = usb_control_msg(dediprog_handle, 0x42, 0x1, 0xff, 
     338                              readcnt ? 0x1 : 0x0, (char *)writearr, writecnt, 
     339                              DEFAULT_TIMEOUT); 
    331340        if (ret != writecnt) { 
    332341                msg_perr("Send SPI failed, expected %i, got %i %s!\n", 
     
    337346                return 0; 
    338347        memset(readarr, 0, readcnt); 
    339         ret = usb_control_msg(dediprog_handle, 0xc2, 0x01, 0xbb8, 0x0000, (char *)readarr, readcnt, DEFAULT_TIMEOUT); 
     348        ret = usb_control_msg(dediprog_handle, 0xc2, 0x01, 0xbb8, 0x0000, 
     349                             (char *)readarr, readcnt, DEFAULT_TIMEOUT); 
    340350        if (ret != readcnt) { 
    341351                msg_perr("Receive SPI failed, expected %i, got %i %s!\n", 
     
    354364        /* Command Prepare Receive Device String. */ 
    355365        memset(buf, 0, sizeof(buf)); 
    356         ret = usb_control_msg(dediprog_handle, 0xc3, 0x7, 0x0, 0xef03, buf, 0x1, DEFAULT_TIMEOUT); 
     366        ret = usb_control_msg(dediprog_handle, 0xc3, 0x7, 0x0, 0xef03, buf, 
     367                              0x1, DEFAULT_TIMEOUT); 
    357368        /* The char casting is needed to stop gcc complaining about an always true comparison. */ 
    358369        if ((ret != 0x1) || (buf[0] != (char)0xff)) { 
     
    363374        /* Command Receive Device String. */ 
    364375        memset(buf, 0, sizeof(buf)); 
    365         ret = usb_control_msg(dediprog_handle, 0xc2, 0x8, 0xff, 0xff, buf, 0x10, DEFAULT_TIMEOUT); 
     376        ret = usb_control_msg(dediprog_handle, 0xc2, 0x8, 0xff, 0xff, buf, 
     377                              0x10, DEFAULT_TIMEOUT); 
    366378        if (ret != 0x10) { 
    367379                msg_perr("Incomplete/failed Command Receive Device String!\n"); 
     
    398410 
    399411        memset(buf, 0, sizeof(buf)); 
    400         ret = usb_control_msg(dediprog_handle, 0xc3, 0xb, 0x0, 0x0, buf, 0x1, DEFAULT_TIMEOUT); 
     412        ret = usb_control_msg(dediprog_handle, 0xc3, 0xb, 0x0, 0x0, buf, 
     413                              0x1, DEFAULT_TIMEOUT); 
    401414        if (ret < 0) { 
    402415                msg_perr("Command A failed (%s)!\n", usb_strerror()); 
     
    421434 
    422435        memset(buf, 0, sizeof(buf)); 
    423         ret = usb_control_msg(dediprog_handle, 0xc3, 0x7, 0x0, 0xef00, buf, 0x3, DEFAULT_TIMEOUT); 
     436        ret = usb_control_msg(dediprog_handle, 0xc3, 0x7, 0x0, 0xef00, buf, 
     437                              0x3, DEFAULT_TIMEOUT); 
    424438        if (ret < 0) { 
    425439                msg_perr("Command B failed (%s)!\n", usb_strerror()); 
     
    445459        int ret; 
    446460 
    447         ret = usb_control_msg(dediprog_handle, 0x42, 0x4, 0x0, 0x0, NULL, 0x0, DEFAULT_TIMEOUT); 
     461        ret = usb_control_msg(dediprog_handle, 0x42, 0x4, 0x0, 0x0, NULL, 
     462                              0x0, DEFAULT_TIMEOUT); 
    448463        if (ret != 0x0) { 
    449464                msg_perr("Command C failed (%s)!\n", usb_strerror()); 
     
    465480 
    466481        memset(buf, 0, sizeof(buf)); 
    467         ret = usb_control_msg(dediprog_handle, 0xc2, 0x11, 0xff, 0xff, buf, 0x1, timeout); 
     482        ret = usb_control_msg(dediprog_handle, 0xc2, 0x11, 0xff, 0xff, buf, 
     483                              0x1, timeout); 
    468484        /* This check is most probably wrong. Command F always causes a timeout 
    469485         * in the logs, so we should check for timeout instead of checking for 
     
    481497{ 
    482498        char *tmp = NULL; 
    483         int i; 
    484         int millivolt; 
    485         int fraction = 0; 
     499        int i, millivolt, fraction = 0; 
    486500 
    487501        if (!voltage || !strlen(voltage)) { 
     
    528542 
    529543static const struct spi_programmer spi_programmer_dediprog = { 
    530         .type = SPI_CONTROLLER_DEDIPROG, 
    531         .max_data_read = MAX_DATA_UNSPECIFIED, 
    532         .max_data_write = MAX_DATA_UNSPECIFIED, 
    533         .command = dediprog_spi_send_command, 
    534         .multicommand = default_spi_send_multicommand, 
    535         .read = dediprog_spi_read, 
    536         .write_256 = dediprog_spi_write_256, 
     544        .type           = SPI_CONTROLLER_DEDIPROG, 
     545        .max_data_read  = MAX_DATA_UNSPECIFIED, 
     546        .max_data_write = MAX_DATA_UNSPECIFIED, 
     547        .command        = dediprog_spi_send_command, 
     548        .multicommand   = default_spi_send_multicommand, 
     549        .read           = dediprog_spi_read, 
     550        .write_256      = dediprog_spi_write_256, 
    537551}; 
    538552 
     
    561575        struct usb_device *dev; 
    562576        char *voltage; 
    563         int millivolt = 3500; 
    564         int ret; 
     577        int millivolt = 3500, ret; 
    565578 
    566579        msg_pspew("%s\n", __func__); 
     
    570583                millivolt = parse_voltage(voltage); 
    571584                free(voltage); 
    572                 if (millivolt < 0) { 
     585                if (millivolt < 0) 
    573586                        return 1; 
    574                 } 
    575587                msg_pinfo("Setting voltage to %i mV\n", millivolt); 
    576588        } 
     
    586598        } 
    587599        msg_pdbg("Found USB device (%04x:%04x).\n", 
    588                  dev->descriptor.idVendor, 
    589                  dev->descriptor.idProduct); 
     600                 dev->descriptor.idVendor, dev->descriptor.idProduct); 
    590601        dediprog_handle = usb_open(dev); 
    591602        ret = usb_set_configuration(dediprog_handle, 1); 
     
    667678        msg_pdbg("Sending RDID\n"); 
    668679        buf[0] = JEDEC_RDID; 
    669         if (dediprog_spi_send_command(JEDEC_RDID_OUTSIZE, JEDEC_RDID_INSIZE, (unsigned char *)buf, (unsigned char *)buf)) 
     680        if (dediprog_spi_send_command(JEDEC_RDID_OUTSIZE, JEDEC_RDID_INSIZE, 
     681                                (unsigned char *)buf, (unsigned char *)buf)) 
    670682                return 1; 
    671683        msg_pdbg("Receiving response: "); 
  • trunk/dmi.c

    r1390 r1397  
    108108 
    109109        /* Kill lines starting with '#', as recent dmidecode versions 
    110            have the quirk to emit a "# SMBIOS implementations newer..." 
    111            message even on "-s" if the SMBIOS declares a 
    112            newer-than-supported version number, while it *should* only print 
    113            the requested string. */ 
     110         * have the quirk to emit a "# SMBIOS implementations newer..." 
     111         * message even on "-s" if the SMBIOS declares a 
     112         * newer-than-supported version number, while it *should* only print 
     113         * the requested string. 
     114         */ 
    114115        do { 
    115116                if (!fgets(answerbuf, DMI_MAX_ANSWER_LEN, dmidecode_pipe)) { 
    116                         if(ferror(dmidecode_pipe)) { 
     117                        if (ferror(dmidecode_pipe)) { 
    117118                                msg_perr("DMI pipe read error\n"); 
    118119                                pclose(dmidecode_pipe); 
     
    122123                        } 
    123124                } 
    124         } while(answerbuf[0] == '#'); 
     125        } while (answerbuf[0] == '#'); 
    125126 
    126127        /* Toss all output above DMI_MAX_ANSWER_LEN away to prevent 
     
    130131        if (pclose(dmidecode_pipe) != 0) { 
    131132                msg_pinfo("dmidecode execution unsuccessful - continuing " 
    132                         "without DMI info\n"); 
     133                          "without DMI info\n"); 
    133134                return NULL; 
    134135        } 
    135136 
    136137        /* Chomp trailing newline. */ 
    137         if (answerbuf[0] != 0 && 
    138             answerbuf[strlen(answerbuf) - 1] == '\n') 
     138        if (answerbuf[0] != 0 && answerbuf[strlen(answerbuf) - 1] == '\n') 
    139139                answerbuf[strlen(answerbuf) - 1] = 0; 
    140140        msg_pdbg("DMI string %s: \"%s\"\n", string_name, answerbuf); 
     
    197197static int dmi_compare(const char *value, const char *pattern) 
    198198{ 
    199         int anchored = 0; 
    200         int patternlen; 
     199        int anchored = 0, patternlen; 
    201200 
    202201        msg_pspew("matching %s against %s\n", value, pattern); 
  • trunk/drkaiser.c

    r1396 r1397  
    5959        /* Write magic register to enable flash write. */ 
    6060        rpci_write_word(pcidev_dev, PCI_MAGIC_DRKAISER_ADDR, 
    61                        PCI_MAGIC_DRKAISER_VALUE); 
     61                        PCI_MAGIC_DRKAISER_VALUE); 
    6262 
    6363        /* Map 128kB flash memory window. */ 
  • trunk/dummyflasher.c

    r1396 r1397  
    6363static int dummy_spi_send_command(unsigned int writecnt, unsigned int readcnt, 
    6464                      const unsigned char *writearr, unsigned char *readarr); 
    65 static int dummy_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len); 
     65static int dummy_spi_write_256(struct flashchip *flash, uint8_t *buf, 
     66                               int start, int len); 
    6667 
    6768static const struct spi_programmer spi_programmer_dummyflasher = { 
    68         .type = SPI_CONTROLLER_DUMMY, 
    69         .max_data_read = MAX_DATA_READ_UNLIMITED, 
    70         .max_data_write = MAX_DATA_UNSPECIFIED, 
    71         .command = dummy_spi_send_command, 
    72         .multicommand = default_spi_send_multicommand, 
    73         .read = default_spi_read, 
    74         .write_256 = dummy_spi_write_256, 
     69        .type           = SPI_CONTROLLER_DUMMY, 
     70        .max_data_read  = MAX_DATA_READ_UNLIMITED, 
     71        .max_data_write = MAX_DATA_UNSPECIFIED, 
     72        .command        = dummy_spi_send_command, 
     73        .multicommand   = default_spi_send_multicommand, 
     74        .read           = default_spi_read, 
     75        .write_256      = dummy_spi_write_256, 
    7576}; 
    7677 
     
    521522#endif 
    522523        msg_pspew(" reading %u bytes:", readcnt); 
    523         for (i = 0; i < readcnt; i++) { 
     524        for (i = 0; i < readcnt; i++) 
    524525                msg_pspew(" 0x%02x", readarr[i]); 
    525         } 
    526526        msg_pspew("\n"); 
    527527        return 0; 
    528528} 
    529529 
    530 static int dummy_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len) 
     530static int dummy_spi_write_256(struct flashchip *flash, uint8_t *buf, 
     531                               int start, int len) 
    531532{ 
    532533        return spi_write_chunked(flash, buf, start, len, 
  • trunk/flashrom.c

    r1396 r1397  
    183183        { 
    184184                /* This programmer works for Realtek RTL8139 and SMC 1211. */ 
    185                 .name                   = "nicrealtek", 
    186                 //.name                   = "nicsmc1211", 
    187                 .init                   = nicrealtek_init, 
    188                 .map_flash_region       = fallback_map, 
    189                 .unmap_flash_region     = fallback_unmap, 
    190                 .chip_readb             = nicrealtek_chip_readb, 
    191                 .chip_readw             = fallback_chip_readw, 
    192                 .chip_readl             = fallback_chip_readl, 
    193                 .chip_readn             = fallback_chip_readn, 
    194                 .chip_writeb            = nicrealtek_chip_writeb, 
    195                 .chip_writew            = fallback_chip_writew, 
    196                 .chip_writel            = fallback_chip_writel, 
    197                 .chip_writen            = fallback_chip_writen, 
    198                 .delay                  = internal_delay, 
     185                .name                   = "nicrealtek", 
     186                //.name                 = "nicsmc1211", 
     187                .init                   = nicrealtek_init, 
     188                .map_flash_region       = fallback_map, 
     189                .unmap_flash_region     = fallback_unmap, 
     190                .chip_readb             = nicrealtek_chip_readb, 
     191                .chip_readw             = fallback_chip_readw, 
     192                .chip_readl             = fallback_chip_readl, 
     193                .chip_readn             = fallback_chip_readn, 
     194                .chip_writeb            = nicrealtek_chip_writeb, 
     195                .chip_writew            = fallback_chip_writew, 
     196                .chip_writel            = fallback_chip_writel, 
     197                .chip_writen            = fallback_chip_writen, 
     198                .delay                  = internal_delay, 
    199199        }, 
    200200#endif 
     
    202202#if CONFIG_NICNATSEMI == 1 
    203203        { 
    204                 .name                   = "nicnatsemi", 
    205                 .init                   = nicnatsemi_init, 
    206                 .map_flash_region       = fallback_map, 
    207                 .unmap_flash_region     = fallback_unmap, 
    208                 .chip_readb             = nicnatsemi_chip_readb, 
    209                 .chip_readw             = fallback_chip_readw, 
    210                 .chip_readl             = fallback_chip_readl, 
    211                 .chip_readn             = fallback_chip_readn, 
    212                 .chip_writeb            = nicnatsemi_chip_writeb, 
    213                 .chip_writew            = fallback_chip_writew, 
    214                 .chip_writel            = fallback_chip_writel, 
    215                 .chip_writen            = fallback_chip_writen, 
    216                 .delay                  = internal_delay, 
     204                .name                   = "nicnatsemi", 
     205                .init                   = nicnatsemi_init, 
     206                .map_flash_region       = fallback_map, 
     207                .unmap_flash_region     = fallback_unmap, 
     208                .chip_readb             = nicnatsemi_chip_readb, 
     209                .chip_readw             = fallback_chip_readw, 
     210                .chip_readl             = fallback_chip_readl, 
     211                .chip_readn             = fallback_chip_readn, 
     212                .chip_writeb            = nicnatsemi_chip_writeb, 
     213                .chip_writew            = fallback_chip_writew, 
     214                .chip_writel            = fallback_chip_writel, 
     215                .chip_writen            = fallback_chip_writen, 
     216                .delay                  = internal_delay, 
    217217        }, 
    218218#endif 
     
    400400#if CONFIG_NICINTEL_SPI == 1 
    401401        { 
    402                 .name = "nicintel_spi", 
    403                 .init = nicintel_spi_init, 
    404                 .map_flash_region = fallback_map, 
    405                 .unmap_flash_region = fallback_unmap, 
    406                 .chip_readb = noop_chip_readb, 
    407                 .chip_readw = fallback_chip_readw, 
    408                 .chip_readl = fallback_chip_readl, 
    409                 .chip_readn = fallback_chip_readn, 
    410                 .chip_writeb = noop_chip_writeb, 
    411                 .chip_writew = fallback_chip_writew, 
    412                 .chip_writel = fallback_chip_writel, 
    413                 .chip_writen = fallback_chip_writen, 
    414                 .delay = internal_delay, 
     402                .name                   = "nicintel_spi", 
     403                .init                   = nicintel_spi_init, 
     404                .map_flash_region       = fallback_map, 
     405                .unmap_flash_region     = fallback_unmap, 
     406                .chip_readb             = noop_chip_readb, 
     407                .chip_readw             = fallback_chip_readw, 
     408                .chip_readl             = fallback_chip_readl, 
     409                .chip_readn             = fallback_chip_readn, 
     410                .chip_writeb            = noop_chip_writeb, 
     411                .chip_writew            = fallback_chip_writew, 
     412                .chip_writel            = fallback_chip_writel, 
     413                .chip_writen            = fallback_chip_writen, 
     414                .delay                  = internal_delay, 
    415415        }, 
    416416#endif 
     
    418418#if CONFIG_OGP_SPI == 1 
    419419        { 
    420                 .name = "ogp_spi", 
    421                 .init = ogp_spi_init, 
    422                 .map_flash_region = fallback_map, 
    423                 .unmap_flash_region = fallback_unmap, 
    424                 .chip_readb = noop_chip_readb, 
    425                 .chip_readw = fallback_chip_readw, 
    426                 .chip_readl = fallback_chip_readl, 
    427                 .chip_readn = fallback_chip_readn, 
    428                 .chip_writeb = noop_chip_writeb, 
    429                 .chip_writew = fallback_chip_writew, 
    430                 .chip_writel = fallback_chip_writel, 
    431                 .chip_writen = fallback_chip_writen, 
    432                 .delay = internal_delay, 
     420                .name                   = "ogp_spi", 
     421                .init                   = ogp_spi_init, 
     422                .map_flash_region       = fallback_map, 
     423                .unmap_flash_region     = fallback_unmap, 
     424                .chip_readb             = noop_chip_readb, 
     425                .chip_readw             = fallback_chip_readw, 
     426                .chip_readl             = fallback_chip_readl, 
     427                .chip_readn             = fallback_chip_readn, 
     428                .chip_writeb            = noop_chip_writeb, 
     429                .chip_writew            = fallback_chip_writew, 
     430                .chip_writel            = fallback_chip_writel, 
     431                .chip_writen            = fallback_chip_writen, 
     432                .delay                  = internal_delay, 
    433433        }, 
    434434#endif 
     
    504504                .lpc            = 0xffffffff, 
    505505                .fwh            = 0xffffffff, 
    506                 .spi            = 0xffffffff 
     506                .spi            = 0xffffffff, 
    507507        }; 
    508508        buses_supported = BUS_NONE; 
     
    601601        /* Flash registers live 4 MByte below the flash. */ 
    602602        /* FIXME: This is incorrect for nonstandard flashbase. */ 
    603         flash->virtual_registers = (chipaddr)programmer_map_flash_region("flash chip registers", (0xFFFFFFFF - 0x400000 - size + 1), size); 
     603        flash->virtual_registers = (chipaddr)programmer_map_flash_region( 
     604            "flash chip registers", (0xFFFFFFFF - 0x400000 - size + 1), size); 
    604605} 
    605606 
     
    607608{ 
    608609        chip_readn(buf, flash->virtual_memory + start, len); 
    609                  
     610 
    610611        return 0; 
    611612} 
     
    686687                param_pos = strstr(param_pos, needle); 
    687688        } while (1); 
    688          
     689 
    689690        if (param_pos) { 
    690691                /* Get the string after needle and '='. */ 
     
    744745/* 
    745746 * @cmpbuf      buffer to compare against, cmpbuf[0] is expected to match the 
    746                 flash content at location start 
     747 *              flash content at location start 
    747748 * @start       offset to the base address of the flash chip 
    748749 * @len         length of the verified area 
     
    750751 * @return      0 for success, -1 for failure 
    751752 */ 
    752 int verify_range(struct flashchip *flash, uint8_t *cmpbuf, int start, int len, const char *message) 
    753 { 
    754         int i, ret = 0; 
     753int verify_range(struct flashchip *flash, uint8_t *cmpbuf, int start, int len, 
     754                 const char *message) 
     755{ 
     756        int i, ret = 0, failcount = 0; 
    755757        uint8_t *readbuf = malloc(len); 
    756         int failcount = 0; 
    757758 
    758759        if (!len) 
     
    777778        if (!message) 
    778779                message = "VERIFY"; 
    779          
     780 
    780781        ret = flash->read(flash, readbuf, start, len); 
    781782        if (ret) { 
     
    797798        if (failcount) { 
    798799                msg_cerr(" failed byte count from 0x%08x-0x%08x: 0x%x\n", 
    799                         start, start + len - 1, failcount); 
     800                         start, start + len - 1, failcount); 
    800801                ret = -1; 
    801802        } 
     
    832833int need_erase(uint8_t *have, uint8_t *want, int len, enum write_granularity gran) 
    833834{ 
    834         int result = 0; 
    835         int i, j, limit; 
     835        int result = 0, i, j, limit; 
    836836 
    837837        switch (gran) { 
     
    899899                          int *first_start, enum write_granularity gran) 
    900900{ 
    901         int need_write = 0, rel_start = 0, first_len = 0; 
    902         int i, limit, stride; 
     901        int need_write = 0, rel_start = 0, first_len = 0, i, limit, stride; 
    903902 
    904903        switch (gran) { 
     
    10811080{ 
    10821081        int limitexceeded = 0; 
    1083         if ((buses & BUS_PARALLEL) && 
    1084             (max_rom_decode.parallel < size)) { 
     1082 
     1083        if ((buses & BUS_PARALLEL) && (max_rom_decode.parallel < size)) { 
    10851084                limitexceeded++; 
    10861085                msg_pdbg("Chip size %u kB is bigger than supported " 
    1087                              "size %u kB of chipset/board/programmer " 
    1088                              "for %s interface, " 
    1089                              "probe/read/erase/write may fail. ", size / 1024, 
    1090                              max_rom_decode.parallel / 1024, "Parallel"); 
     1086                         "size %u kB of chipset/board/programmer " 
     1087                         "for %s interface, " 
     1088                         "probe/read/erase/write may fail. ", size / 1024, 
     1089                         max_rom_decode.parallel / 1024, "Parallel"); 
    10911090        } 
    10921091        if ((buses & BUS_LPC) && (max_rom_decode.lpc < size)) { 
    10931092                limitexceeded++; 
    10941093                msg_pdbg("Chip size %u kB is bigger than supported " 
    1095                              "size %u kB of chipset/board/programmer " 
    1096                              "for %s interface, " 
    1097                              "probe/read/erase/write may fail. ", size / 1024, 
    1098                              max_rom_decode.lpc / 1024, "LPC"); 
     1094                         "size %u kB of chipset/board/programmer " 
     1095                         "for %s interface, " 
     1096                         "probe/read/erase/write may fail. ", size / 1024, 
     1097                         max_rom_decode.lpc / 1024, "LPC"); 
    10991098        } 
    11001099        if ((buses & BUS_FWH) && (max_rom_decode.fwh < size)) { 
    11011100                limitexceeded++; 
    11021101                msg_pdbg("Chip size %u kB is bigger than supported " 
    1103                              "size %u kB of chipset/board/programmer " 
    1104                              "for %s interface, " 
    1105                              "probe/read/erase/write may fail. ", size / 1024, 
    1106                              max_rom_decode.fwh / 1024, "FWH"); 
     1102                         "size %u kB of chipset/board/programmer " 
     1103                         "for %s interface, " 
     1104                         "probe/read/erase/write may fail. ", size / 1024, 
     1105                         max_rom_decode.fwh / 1024, "FWH"); 
    11071106        } 
    11081107        if ((buses & BUS_SPI) && (max_rom_decode.spi < size)) { 
    11091108                limitexceeded++; 
    11101109                msg_pdbg("Chip size %u kB is bigger than supported " 
    1111                              "size %u kB of chipset/board/programmer " 
    1112                              "for %s interface, " 
    1113                              "probe/read/erase/write may fail. ", size / 1024, 
    1114                              max_rom_decode.spi / 1024, "SPI"); 
     1110                         "size %u kB of chipset/board/programmer " 
     1111                         "for %s interface, " 
     1112                         "probe/read/erase/write may fail. ", size / 1024, 
     1113                         max_rom_decode.spi / 1024, "SPI"); 
    11151114        } 
    11161115        if (!limitexceeded) 
     
    11221121                /* FIXME: This message is designed towards CLI users. */ 
    11231122                msg_pdbg("There is at least one common chip/programmer " 
    1124                              "interface which can support a chip of this size. " 
    1125                              "You can try --force at your own risk.\n"); 
     1123                         "interface which can support a chip of this size. " 
     1124                         "You can try --force at your own risk.\n"); 
    11261125        return 1; 
    11271126} 
     
    12331232} 
    12341233 
    1235 int read_buf_from_file(unsigned char *buf, unsigned long size, const char *filename) 
     1234int read_buf_from_file(unsigned char *buf, unsigned long size, 
     1235                       const char *filename) 
    12361236{ 
    12371237        unsigned long numbytes; 
     
    12661266} 
    12671267 
    1268 int write_buf_to_file(unsigned char *buf, unsigned long size, const char *filename) 
     1268int write_buf_to_file(unsigned char *buf, unsigned long size, 
     1269                      const char *filename) 
    12691270{ 
    12701271        unsigned long numbytes; 
     
    13261327static int selfcheck_eraseblocks(const struct flashchip *flash) 
    13271328{ 
    1328         int i, j, k; 
    1329         int ret = 0; 
     1329        int i, j, k, ret = 0; 
    13301330 
    13311331        for (k = 0; k < NUM_ERASEFUNCTIONS; k++) { 
     
    13581358                if (!done && eraser.block_erase) 
    13591359                        msg_gspew("Strange: Empty eraseblock definition with " 
    1360                                 "non-empty erase function. Not an error.\n"); 
     1360                                  "non-empty erase function. Not an error.\n"); 
    13611361                if (!done) 
    13621362                        continue; 
     
    13971397                                                        unsigned int len)) 
    13981398{ 
    1399         int starthere = 0; 
    1400         int lenhere = 0; 
    1401         int ret = 0; 
    1402         int skip = 1; 
    1403         int writecount = 0; 
     1399        int starthere = 0, lenhere = 0, ret = 0, skip = 1, writecount = 0; 
    14041400        enum write_granularity gran = write_gran_256bytes; /* FIXME */ 
    14051401 
     
    14561452{ 
    14571453        int i, j; 
    1458         unsigned int start = 0; 
    1459         unsigned int len; 
     1454        unsigned int start = 0, len; 
    14601455        struct block_eraser eraser = flash->block_erasers[erasefunction]; 
     1456 
    14611457        for (i = 0; i < NUM_ERASEREGIONS; i++) { 
    14621458                /* count==0 for all automatically initialized array 
     
    15051501} 
    15061502 
    1507 int erase_and_write_flash(struct flashchip *flash, uint8_t *oldcontents, uint8_t *newcontents) 
     1503int erase_and_write_flash(struct flashchip *flash, uint8_t *oldcontents, 
     1504                          uint8_t *newcontents) 
    15081505{ 
    15091506        int k, ret = 1; 
     
    15921589} 
    15931590 
    1594 /* The way to go if you want a delimited list of programmers*/ 
     1591/* The way to go if you want a delimited list of programmers */ 
    15951592void list_programmers(const char *delim) 
    15961593{ 
     
    16071604{ 
    16081605        const char *pname; 
    1609         int pnamelen; 
    1610         int remaining = 0; 
    1611         int firstline = 1; 
     1606        int pnamelen, remaining = 0, firstline = 1, i; 
    16121607        enum programmer p; 
    1613         int i; 
    16141608 
    16151609        for (p = 0; p < PROGRAMMER_INVALID; p++) { 
     
    16981692{ 
    16991693        msg_ginfo("flashrom is free software, get the source code at " 
    1700                     "http://www.flashrom.org\n"); 
     1694                  "http://www.flashrom.org\n"); 
    17011695        msg_ginfo("\n"); 
    17021696} 
     
    17441738                ret = 1; 
    17451739        } 
    1746 #endif // CONFIG_INTERNAL == 1 
     1740#endif 
    17471741        return ret; 
    17481742} 
  • trunk/ft2232_spi.c

    r1377 r1397  
    142142 
    143143static const struct spi_programmer spi_programmer_ft2232 = { 
    144         .type = SPI_CONTROLLER_FT2232, 
    145         .max_data_read = 64 * 1024, 
    146         .max_data_write = 256, 
    147         .command = ft2232_spi_send_command, 
    148         .multicommand = default_spi_send_multicommand, 
    149         .read = default_spi_read, 
    150         .write_256 = default_spi_write_256, 
     144        .type           = SPI_CONTROLLER_FT2232, 
     145        .max_data_read  = 64 * 1024, 
     146        .max_data_write = 256, 
     147        .command        = ft2232_spi_send_command, 
     148        .multicommand   = default_spi_send_multicommand, 
     149        .read           = default_spi_read, 
     150        .write_256      = default_spi_write_256, 
    151151}; 
    152152 
     
    247247        } 
    248248 
    249         if (ftdi_usb_reset(ftdic) < 0) { 
     249        if (ftdi_usb_reset(ftdic) < 0) 
    250250                msg_perr("Unable to reset FTDI device\n"); 
    251         } 
    252  
    253         if (ftdi_set_latency_timer(ftdic, 2) < 0) { 
     251 
     252        if (ftdi_set_latency_timer(ftdic, 2) < 0) 
    254253                msg_perr("Unable to set latency timer\n"); 
    255         } 
    256  
    257         if (ftdi_write_data_set_chunksize(ftdic, 256)) { 
     254 
     255        if (ftdi_write_data_set_chunksize(ftdic, 256)) 
    258256                msg_perr("Unable to set chunk size\n"); 
    259         } 
    260  
    261         if (ftdi_set_bitmode(ftdic, 0x00, BITMODE_BITBANG_SPI) < 0) { 
     257 
     258        if (ftdi_set_bitmode(ftdic, 0x00, BITMODE_BITBANG_SPI) < 0) 
    262259                msg_perr("Unable to set bitmode to SPI\n"); 
    263         } 
    264260 
    265261        if (clock_5x) { 
     
    286282 
    287283        msg_pdbg("MPSSE clock: %f MHz divisor: %d " 
    288                  "SPI clock: %f MHz\n", 
    289                  mpsse_clk, DIVIDE_BY, 
     284                 "SPI clock: %f MHz\n", mpsse_clk, DIVIDE_BY, 
    290285                 (double)(mpsse_clk / (((DIVIDE_BY - 1) + 1) * 2))); 
    291286 
     
    329324        static unsigned char *buf = NULL; 
    330325        /* failed is special. We use bitwise ops, but it is essentially bool. */ 
    331         int i = 0, ret = 0, failed = 0; 
    332         int bufsize; 
     326        int i = 0, ret = 0, failed = 0, bufsize; 
    333327        static int oldbufsize = 0; 
    334328 
     
    380374                /* We can't abort here, we still have to deassert CS#. */ 
    381375                if (ret) 
    382                         msg_perr("send_buf failed before read: %i\n", 
    383                                 ret); 
     376                        msg_perr("send_buf failed before read: %i\n", ret); 
    384377                i = 0; 
    385378                if (ret == 0) { 
  • trunk/gfxnvidia.c

    r1396 r1397  
    8686        nvidia_bar = physmap("NVIDIA", io_base_addr, GFXNVIDIA_MEMMAP_SIZE); 
    8787 
    88         /* must be done before rpci calls */ 
     88        /* Must be done before rpci calls. */ 
    8989        if (register_shutdown(gfxnvidia_shutdown, NULL)) 
    9090                return 1; 
  • trunk/hwaccess.h

    r1282 r1397  
    221221  #define INL  inportl 
    222222 
    223 #else  
     223#else 
    224224 
    225225  #define OUTB outb 
  • trunk/ichspi.c

    r1396 r1397  
    363363        int a; 
    364364 
    365         for (a = 0; a < sizeof(POSSIBLE_OPCODES)/sizeof(POSSIBLE_OPCODES[0]); a++) { 
     365        for (a = 0; a < ARRAY_SIZE(POSSIBLE_OPCODES); a++) { 
    366366                if (POSSIBLE_OPCODES[a].opcode == opcode) 
    367367                        return POSSIBLE_OPCODES[a].spi_type; 
  • trunk/it85spi.c

    r1396 r1397  
    9191 *          1 -- timeout reached. 
    9292 */ 
    93 static int wait_for( 
    94                 const unsigned int mask, 
    95                 const unsigned int expected_value, 
    96                 const int timeout,  /* in usec */ 
    97                 const char* error_message, 
    98                 const char* function_name, 
    99                 const int lineno 
    100 ) { 
     93static int wait_for(const unsigned int mask, const unsigned int expected_value, 
     94                const int timeout /* in usec */, const char *error_message, 
     95                const char *function_name, const int lineno) 
     96{ 
    10197        int time_passed; 
    10298 
     
    113109} 
    114110 
    115 /* IT8502 employs a scratch ram when flash is being updated. Call the following 
     111/* IT8502 employs a scratch RAM when flash is being updated. Call the following 
    116112 * two functions before/after flash erase/program. */ 
    117 void it85xx_enter_scratch_rom() 
    118 { 
    119         int ret; 
    120         int tries; 
     113void it85xx_enter_scratch_rom(void) 
     114{ 
     115        int ret, tries; 
    121116 
    122117        msg_pdbg("%s():%d was called ...\n", __FUNCTION__, __LINE__); 
    123         if (it85xx_scratch_rom_reenter > 0) return; 
     118        if (it85xx_scratch_rom_reenter > 0) 
     119                return; 
    124120 
    125121#if 0 
     
    128124         *        we find out the root cause. */ 
    129125        ret = system("stop powerd >&2"); 
    130         if (ret) { 
     126        if (ret) 
    131127                msg_perr("Cannot stop powerd.\n"); 
    132         } 
    133128#endif 
    134129 
     
    174169} 
    175170 
    176 void it85xx_exit_scratch_rom() 
     171void it85xx_exit_scratch_rom(void) 
    177172{ 
    178173#if 0 
     
    182177 
    183178        msg_pdbg("%s():%d was called ...\n", __FUNCTION__, __LINE__); 
    184         if (it85xx_scratch_rom_reenter <= 0) return; 
     179        if (it85xx_scratch_rom_reenter <= 0) 
     180                return; 
    185181 
    186182        for (tries = 0; tries < MAX_TRY; ++tries) { 
     
    221217         *        we find out the root cause. */ 
    222218        ret = system("start powerd >&2"); 
    223         if (ret) { 
     219        if (ret) 
    224220                msg_perr("Cannot start powerd again.\n"); 
    225         } 
    226221#endif 
    227222} 
     
    246241 
    247242#ifdef LPC_IO 
    248         /* Get LPCPNP of SHM. That's big-endian */ 
     243        /* Get LPCPNP of SHM. That's big-endian. */ 
    249244        sio_write(s.port, LDNSEL, 0x0F); /* Set LDN to SHM (0x0F) */ 
    250245        shm_io_base = (sio_read(s.port, SHM_IO_BAR0) << 8) + 
     
    256251         * register for indirect access. */ 
    257252        base = 0xFFFFF000; 
    258         ce_high = ((unsigned char*)base) + 0xE00;  /* 0xFFFFFE00 */ 
    259         ce_low = ((unsigned char*)base) + 0xD00;  /* 0xFFFFFD00 */ 
     253        ce_high = ((unsigned char *)base) + 0xE00;  /* 0xFFFFFE00 */ 
     254        ce_low = ((unsigned char *)base) + 0xD00;  /* 0xFFFFFD00 */ 
    260255 
    261256        /* pre-set indirect-access registers since in most of cases they are 
     
    270265        msg_pdbg("%s():%d base=0x%08x\n", __func__, __LINE__, 
    271266                 (unsigned int)base); 
    272         ce_high = (unsigned char*)(base + 0xE00);  /* 0xFFFFFE00 */ 
    273         ce_low = (unsigned char*)(base + 0xD00);  /* 0xFFFFFD00 */ 
     267        ce_high = (unsigned char *)(base + 0xE00);  /* 0xFFFFFE00 */ 
     268        ce_low = (unsigned char *)(base + 0xD00);  /* 0xFFFFFD00 */ 
    274269#endif 
    275270 
     
    281276 
    282277static const struct spi_programmer spi_programmer_it85xx = { 
    283         .type = SPI_CONTROLLER_IT85XX, 
    284         .max_data_read = 64, 
    285         .max_data_write = 64, 
    286         .command = it85xx_spi_send_command, 
    287         .multicommand = default_spi_send_multicommand, 
    288         .read = default_spi_read, 
    289         .write_256 = default_spi_write_256, 
     278        .type           = SPI_CONTROLLER_IT85XX, 
     279        .max_data_read  = 64, 
     280        .max_data_write = 64, 
     281        .command        = it85xx_spi_send_command, 
     282        .multicommand   = default_spi_send_multicommand, 
     283        .read           = default_spi_read, 
     284        .write_256      = default_spi_write_256, 
    290285}; 
    291286 
     
    306301                        msg_pdbg("Overriding chipset SPI with IT85 FWH|SPI.\n"); 
    307302                /* Really leave FWH enabled? */ 
    308                 /* Set this as spi controller. */ 
     303                /* Set this as SPI controller. */ 
    309304                register_spi_programmer(&spi_programmer_it85xx); 
    310305        } 
     
    325320 
    326321        it85xx_enter_scratch_rom(); 
    327         /* exit scratch rom ONLY when programmer shuts down. Otherwise, the 
     322        /* exit scratch ROM ONLY when programmer shuts down. Otherwise, the 
    328323         * temporary flash state may halt EC. */ 
    329324 
  • trunk/it87spi.c

    r1396 r1397  
    9494                        msg_pdbg("Found ITE EC, ID 0x%04hx," 
    9595                                 "Rev 0x%02x on port 0x%x.\n", 
    96                                  s.model, 
    97                                  sio_read(s.port, CHIP_VER_REG), 
     96                                 s.model, sio_read(s.port, CHIP_VER_REG), 
    9897                                 s.port); 
    9998                        register_superio(s); 
     
    107106static int it8716f_spi_send_command(unsigned int writecnt, unsigned int readcnt, 
    108107                        const unsigned char *writearr, unsigned char *readarr); 
    109 static int it8716f_spi_chip_read(struct flashchip *flash, uint8_t *buf, int start, int len); 
    110 static int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf, int start, int len); 
     108static int it8716f_spi_chip_read(struct flashchip *flash, uint8_t *buf, 
     109                                 int start, int len); 
     110static int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf, 
     111                                      int start, int len); 
    111112 
    112113static const struct spi_programmer spi_programmer_it87xx = { 
    113         .type = SPI_CONTROLLER_IT87XX, 
    114         .max_data_read = MAX_DATA_UNSPECIFIED, 
    115         .max_data_write = MAX_DATA_UNSPECIFIED, 
    116         .command = it8716f_spi_send_command, 
    117         .multicommand = default_spi_send_multicommand, 
    118         .read = it8716f_spi_chip_read, 
    119         .write_256 = it8716f_spi_chip_write_256, 
     114        .type           = SPI_CONTROLLER_IT87XX, 
     115        .max_data_read  = MAX_DATA_UNSPECIFIED, 
     116        .max_data_write = MAX_DATA_UNSPECIFIED, 
     117        .command        = it8716f_spi_send_command, 
     118        .multicommand   = default_spi_send_multicommand, 
     119        .read           = it8716f_spi_chip_read, 
     120        .write_256      = it8716f_spi_chip_write_256, 
    120121}; 
    121122 
     
    203204int init_superio_ite(void) 
    204205{ 
    205         int i; 
    206         int ret = 0; 
     206        int i, ret = 0; 
    207207 
    208208        for (i = 0; i < superio_count; i++) { 
     
    260260        if (readcnt > 3) { 
    261261                msg_pinfo("%s called with unsupported readcnt %i.\n", 
    262                        __func__, readcnt); 
     262                          __func__, readcnt); 
    263263                return SPI_INVALID_LENGTH; 
    264264        } 
     
    290290        default: 
    291291                msg_pinfo("%s called with unsupported writecnt %i.\n", 
    292                        __func__, writecnt); 
     292                          __func__, writecnt); 
    293293                return SPI_INVALID_LENGTH; 
    294294        } 
     
    314314 
    315315/* Page size is usually 256 bytes */ 
    316 static int it8716f_spi_page_program(struct flashchip *flash, uint8_t *buf, int start) 
    317 { 
    318         int i; 
    319         int result; 
     316static int it8716f_spi_page_program(struct flashchip *flash, uint8_t *buf, 
     317                                    int start) 
     318{ 
     319        int i, result; 
    320320        chipaddr bios = flash->virtual_memory; 
    321321 
     
    326326        OUTB(0x06, it8716f_flashport + 1); 
    327327        OUTB(((2 + (fast_spi ? 1 : 0)) << 4), it8716f_flashport); 
    328         for (i = 0; i < flash->page_size; i++) { 
     328        for (i = 0; i < flash->page_size; i++) 
    329329                chip_writeb(buf[i], bios + start + i); 
    330         } 
    331330        OUTB(0, it8716f_flashport); 
    332331        /* Wait until the Write-In-Progress bit is cleared. 
     
    342341 * Need to read this big flash using firmware cycles 3 byte at a time. 
    343342 */ 
    344 static int it8716f_spi_chip_read(struct flashchip *flash, uint8_t *buf, int start, int len) 
     343static int it8716f_spi_chip_read(struct flashchip *flash, uint8_t *buf, 
     344                                 int start, int len) 
    345345{ 
    346346        fast_spi = 0; 
     
    359359} 
    360360 
    361 static int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf, int start, int len) 
     361static int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf, 
     362                                      int start, int len) 
    362363{ 
    363364        /* 
  • trunk/pcidev.c

    r1370 r1397  
    248248        for (i = 0; devs[i].vendor_name != NULL; i++) { 
    249249                msg_pinfo("%s %s [%04x:%04x]%s\n", devs[i].vendor_name, 
    250                        devs[i].device_name, devs[i].vendor_id, 
    251                        devs[i].device_id, 
    252                        (devs[i].status == NT) ? " (untested)" : ""); 
     250                          devs[i].device_name, devs[i].vendor_id, 
     251                          devs[i].device_id, 
     252                          (devs[i].status == NT) ? " (untested)" : ""); 
    253253        } 
    254254} 
  • trunk/physmap.c

    r1282 r1397  
    4444static void *map_first_meg(unsigned long phys_addr, size_t len) 
    4545{ 
    46  
    47         if (realmem_map) { 
     46        if (realmem_map) 
    4847                return realmem_map + phys_addr; 
    49         } 
    5048 
    5149        realmem_map = valloc(1024 * 1024); 
    5250 
    53         if (!realmem_map) { 
     51        if (!realmem_map) 
    5452                return ERROR_PTR; 
    55         } 
    5653 
    5754        if (__djgpp_map_physical_memory(realmem_map, (1024 * 1024), 0)) { 
     
    6966        __dpmi_meminfo mi; 
    7067 
    71         /* enable 4GB limit on DS descriptor */ 
    72         if (!__djgpp_nearptr_enable()) { 
     68        /* Enable 4GB limit on DS descriptor. */ 
     69        if (!__djgpp_nearptr_enable()) 
    7370                return ERROR_PTR; 
    74         } 
    7571 
    7672        if ((phys_addr + len - 1) < (1024 * 1024)) { 
    77         /* we need to use another method to map first 1MB */ 
     73                /* We need to use another method to map first 1MB. */ 
    7874                return map_first_meg(phys_addr, len); 
    7975        } 
     
    8177        mi.address = phys_addr; 
    8278        mi.size = len; 
    83         ret =  __dpmi_physical_address_mapping (&mi); 
    84  
    85         if (ret != 0) { 
     79        ret = __dpmi_physical_address_mapping (&mi); 
     80 
     81        if (ret != 0) 
    8682                return ERROR_PTR; 
    87         } 
    8883 
    8984        return (void *) mi.address + __djgpp_conventional_base; 
     
    10095         * do this for us on exit. 
    10196         */ 
    102         if ((virt_addr >= realmem_map) && ((virt_addr + len) <= (realmem_map + (1024 * 1024)))) { 
     97        if ((virt_addr >= realmem_map) && 
     98            ((virt_addr + len) <= (realmem_map + (1024 * 1024)))) { 
    10399                return; 
    104100        } 
     
    115111void *sys_physmap(unsigned long phys_addr, size_t len) 
    116112{ 
    117         return (void*)phys_to_virt(phys_addr); 
     113        return (void *)phys_to_virt(phys_addr); 
    118114} 
    119115 
     
    196192                /* Open the memory device CACHED. */ 
    197193                if (-1 == (fd_mem_cached = open(MEM_DEV, O_RDWR))) { 
    198                         msg_perr("Critical error: open(" MEM_DEV "): %s", strerror(errno)); 
     194                        msg_perr("Critical error: open(" MEM_DEV "): %s", 
     195                                 strerror(errno)); 
    199196                        exit(2); 
    200197                } 
     
    222219#define PHYSMAP_RO      1 
    223220 
    224 static void *physmap_common(const char *descr, unsigned long phys_addr, size_t len, int mayfail, int readonly) 
     221static void *physmap_common(const char *descr, unsigned long phys_addr, 
     222                            size_t len, int mayfail, int readonly) 
    225223{ 
    226224        void *virt_addr; 
     
    228226        if (len == 0) { 
    229227                msg_pspew("Not mapping %s, zero size at 0x%08lx.\n", 
    230                              descr, phys_addr); 
     228                          descr, phys_addr); 
    231229                return ERROR_PTR; 
    232230        } 
    233                  
     231 
    234232        if ((getpagesize() - 1) & len) { 
    235233                msg_perr("Mapping %s at 0x%08lx, unaligned size 0x%lx.\n", 
    236                         descr, phys_addr, (unsigned long)len); 
     234                         descr, phys_addr, (unsigned long)len); 
    237235        } 
    238236 
    239237        if ((getpagesize() - 1) & phys_addr) { 
    240238                msg_perr("Mapping %s, 0x%lx bytes at unaligned 0x%08lx.\n", 
    241                         descr, (unsigned long)len, phys_addr); 
    242         } 
    243  
    244         if (readonly) { 
     239                         descr, (unsigned long)len, phys_addr); 
     240        } 
     241 
     242        if (readonly) 
    245243                virt_addr = sys_physmap_ro_cached(phys_addr, len); 
    246         } else { 
     244        else 
    247245                virt_addr = sys_physmap_rw_uncached(phys_addr, len); 
    248         } 
    249246 
    250247        if (ERROR_PTR == virt_addr) { 
    251248                if (NULL == descr) 
    252249                        descr = "memory"; 
    253                 msg_perr("Error accessing %s, 0x%lx bytes at 0x%08lx\n", descr, (unsigned long)len, phys_addr); 
     250                msg_perr("Error accessing %s, 0x%lx bytes at 0x%08lx\n", descr, 
     251                         (unsigned long)len, phys_addr); 
    254252                perror(MEM_DEV " mmap failed"); 
    255253#ifdef __linux__ 
     
    263261#elif defined (__OpenBSD__) 
    264262                msg_perr("Please set securelevel=-1 in /etc/rc.securelevel " 
    265                            "and reboot, or reboot into \n"); 
    266                 msg_perr("single user mode.\n"); 
     263                         "and reboot, or reboot into\n" 
     264                         "single user mode.\n"); 
    267265#endif 
    268266                if (!mayfail) 
     
    275273void *physmap(const char *descr, unsigned long phys_addr, size_t len) 
    276274{ 
    277         return physmap_common(descr, phys_addr, len, PHYSMAP_NOFAIL, PHYSMAP_RW); 
     275        return physmap_common(descr, phys_addr, len, PHYSMAP_NOFAIL, 
     276                              PHYSMAP_RW); 
    278277} 
    279278 
    280279void *physmap_try_ro(const char *descr, unsigned long phys_addr, size_t len) 
    281280{ 
    282         return physmap_common(descr, phys_addr, len, PHYSMAP_MAYFAIL, PHYSMAP_RO); 
     281        return physmap_common(descr, phys_addr, len, PHYSMAP_MAYFAIL, 
     282                              PHYSMAP_RO); 
    283283} 
    284284 
     
    289289 * Reading and writing to MSRs, however requires instructions rdmsr/wrmsr, 
    290290 * which are ring0 privileged instructions so only the kernel can do the 
    291  * read/write.  This function, therefore, requires that the msr kernel module 
     291 * read/write. This function, therefore, requires that the msr kernel module 
    292292 * be loaded to access these instructions from user space using device 
    293293 * /dev/cpu/0/msr. 
     
    310310                msr.lo = buf[0]; 
    311311                msr.hi = buf[1]; 
    312  
    313312                return msr; 
    314313        } 
     
    342341        } 
    343342 
    344         /* some MSRs must not be written */ 
     343        /* Some MSRs must not be written. */ 
    345344        if (errno == EIO) 
    346345                return -1; 
     
    380379        close(fd_msr); 
    381380 
    382         /* Clear MSR file descriptor */ 
     381        /* Clear MSR file descriptor. */ 
    383382        fd_msr = -1; 
    384383} 
     
    463462        close(fd_msr); 
    464463 
    465         /* Clear MSR file descriptor */ 
     464        /* Clear MSR file descriptor. */ 
    466465        fd_msr = -1; 
    467466} 
Note: See TracChangeset for help on using the changeset viewer.