Changeset 933
- Timestamp:
- 03/13/10 18:28:29 (23 months ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
board_enable.c (modified) (14 diffs)
-
cli_output.c (modified) (3 diffs)
-
dmi.c (modified) (9 diffs)
-
flashrom.c (modified) (4 diffs)
-
hwaccess.h (modified) (4 diffs)
-
internal.c (modified) (3 diffs)
-
it87spi.c (modified) (2 diffs)
-
serial.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/board_enable.c
r930 r933 80 80 case SUPERIO_VENDOR_ITE: 81 81 enter_conf_mode_ite(superio.port); 82 /* Enable flash mapping. Works for most old ITE style Super I/O. */82 /* Enable flash mapping. Works for most old ITE style Super I/O. */ 83 83 tmp = sio_read(superio.port, 0x24); 84 84 tmp |= 0xfc; … … 88 88 break; 89 89 default: 90 printf_debug("Unhandled Super I/O type!\n");90 printf_debug("Unhandled Super I/O type!\n"); 91 91 ret = -1; 92 92 break; … … 227 227 * - Shuttle AK38N: VIA KT333CF + VIA VT8235 + ITE IT8705F 228 228 * 229 * SIS950 superioprobably requires the same flash write enable.229 * The SIS950 Super I/O probably requires the same flash write enable. 230 230 */ 231 231 static int it8705f_write_enable_2e(const char *name) … … 240 240 int gpio_pin = gpio % 8; 241 241 uint16_t baseport; 242 uint8_t id; 243 uint8_t val; 244 245 if (gpio_bank > 4) 246 { 242 uint8_t id, val; 243 244 if (gpio_bank > 4) { 247 245 fprintf(stderr, "PC87360: Invalid GPIO %d\n", gpio); 248 246 return -1; … … 250 248 251 249 id = sio_read(0x2E, 0x20); 252 if (id != 0xE1) 253 { 250 if (id != 0xE1) { 254 251 fprintf(stderr, "PC87360: unexpected ID %02x\n", id); 255 252 return -1; 256 253 } 257 254 258 sio_write(0x2E, 0x07, 0x07); /* select GPIO device */255 sio_write(0x2E, 0x07, 0x07); /* Select GPIO device */ 259 256 baseport = (sio_read(0x2E, 0x60) << 8) | sio_read(0x2E, 0x61); 260 if((baseport & 0xFFF0) == 0xFFF0 || baseport == 0) 261 { 257 if ((baseport & 0xFFF0) == 0xFFF0 || baseport == 0) { 262 258 fprintf (stderr, "PC87360: invalid GPIO base address %04x\n", 263 259 baseport); … … 265 261 } 266 262 sio_mask (0x2E, 0x30, 0x01, 0x01); /* Enable logical device */ 267 sio_write(0x2E, 0xF0, gpio_bank *16 + gpio_pin);263 sio_write(0x2E, 0xF0, gpio_bank * 16 + gpio_pin); 268 264 sio_mask (0x2E, 0xF1, 0x01, 0x01); /* Make pin output */ 269 265 270 266 val = INB(baseport + bankbase[gpio_bank]); 271 if (raise)267 if (raise) 272 268 val |= 1 << gpio_pin; 273 269 else … … 1029 1025 { 1030 1026 struct pci_dev *dev; 1031 uint16_t base; 1032 uint16_t temp; 1027 uint16_t base, temp; 1033 1028 1034 1029 dev = pci_dev_find(0x1039, 0x0962); … … 1134 1129 1135 1130 if (id != 0x8701) { 1136 fprintf(stderr, "\nERROR: IT8703F Super IO not found.\n");1131 fprintf(stderr, "\nERROR: IT8703F Super I/O not found.\n"); 1137 1132 return -1; 1138 1133 } … … 1145 1140 1146 1141 if (!base) { 1147 fprintf(stderr, "\nERROR: Failed to read IT8703F Super IO GPIO"1142 fprintf(stderr, "\nERROR: Failed to read IT8703F Super I/O GPIO" 1148 1143 " Base.\n"); 1149 1144 return -1; … … 1162 1157 * There is only some limited checking on the port numbers. 1163 1158 */ 1164 static int 1165 it8712f_gpio_set(unsigned int line, int raise) 1159 static int it8712f_gpio_set(unsigned int line, int raise) 1166 1160 { 1167 1161 unsigned int port; … … 1187 1181 1188 1182 if (id != 0x8712) { 1189 fprintf(stderr, "\nERROR: IT8712F Super IO not found.\n");1183 fprintf(stderr, "\nERROR: IT8712F Super I/O not found.\n"); 1190 1184 return -1; 1191 1185 } … … 1198 1192 1199 1193 if (!base) { 1200 fprintf(stderr, "\nERROR: Failed to read IT8712F Super IO GPIO"1194 fprintf(stderr, "\nERROR: Failed to read IT8712F Super I/O GPIO" 1201 1195 " Base.\n"); 1202 1196 return -1; … … 1447 1441 1448 1442 if (board && board->status == NT) { 1449 if (!force_boardenable) 1450 { 1443 if (!force_boardenable) { 1451 1444 printf("WARNING: Your mainboard is %s %s, but the mainboard-specific\n" 1452 1445 "code has not been tested, and thus will not not be executed by default.\n" … … 1454 1447 "can fail without running the board specific code.\n\n" 1455 1448 "Please see the man page (section PROGRAMMER SPECIFIC INFO, subsection\n" 1456 "\"internal programmer\") for details \n",1449 "\"internal programmer\") for details.\n", 1457 1450 board->vendor_name, board->board_name); 1458 1451 board = NULL; 1459 } 1460 else 1452 } else { 1461 1453 printf("NOTE: Running an untested board enable procedure.\n" 1462 "Please report success/failure to flashrom@flashrom.org\n"); 1454 "Please report success/failure to flashrom@flashrom.org.\n"); 1455 } 1463 1456 } 1464 1457 -
trunk/cli_output.c
r836 r933 28 28 int ret; 29 29 FILE *output_type; 30 31 switch (type) 32 { 30 31 switch (type) { 33 32 case MSG_ERROR: 34 33 output_type = stderr; 35 34 break; 36 35 case MSG_BARF: 37 if (verbose < 2) return 0; 36 if (verbose < 2) 37 return 0; 38 38 case MSG_DEBUG: 39 if (verbose < 1) return 0; 39 if (verbose < 1) 40 return 0; 40 41 case MSG_INFO: 41 42 default: … … 43 44 break; 44 45 } 45 46 46 47 va_start(ap, fmt); 47 48 ret = vfprintf(output_type, fmt, ap); … … 49 50 return ret; 50 51 } 51 -
trunk/dmi.c
r916 r933 32 32 DMI_BB_PRODUCT, 33 33 DMI_BB_VERSION, 34 DMI_ID_INVALID /* This must always be the last entry*/34 DMI_ID_INVALID, /* This must always be the last entry! */ 35 35 }; 36 36 37 /* The short_id for baseboard starts with "m" as in mainboard to leave 38 "b" available for BIOS */ 37 /* 38 * The short_id for baseboard starts with "m" as in mainboard to leave 39 * "b" available for BIOS. 40 */ 39 41 const char *dmidecode_names[DMI_ID_INVALID] = { 40 42 "system-manufacturer", … … 43 45 "baseboard-manufacturer", 44 46 "baseboard-product-name", 45 "baseboard-version" 47 "baseboard-version", 46 48 }; 47 49 … … 52 54 char *dmistrings[DMI_ID_INVALID]; 53 55 54 /* strings longer than 4096 in DMI are just insane*/56 /* Strings longer than 4096 in DMI are just insane. */ 55 57 #define DMI_MAX_ANSWER_LEN 4096 56 58 … … 60 62 char *result; 61 63 char answerbuf[DMI_MAX_ANSWER_LEN]; 62 char commandline[DMI_COMMAND_LEN_MAX+40]; 64 char commandline[DMI_COMMAND_LEN_MAX + 40]; 65 63 66 snprintf(commandline, sizeof(commandline), 64 67 "%s -s %s", dmidecode_command, string_name); … … 83 86 } 84 87 85 /* chomp trailing newline*/88 /* Chomp trailing newline. */ 86 89 if (answerbuf[0] != 0 && 87 90 answerbuf[strlen(answerbuf) - 1] == '\n') … … 100 103 int i; 101 104 char *chassis_type; 105 102 106 has_dmi_support = 1; 103 107 for (i = 0; i < DMI_ID_INVALID; i++) { … … 132 136 int anchored = 0; 133 137 int patternlen; 138 134 139 printf_debug("matching %s against %s\n", value, pattern); 135 /* The empty string is part of all strings */140 /* The empty string is part of all strings! */ 136 141 if (pattern[0] == 0) 137 142 return 1; … … 146 151 int valuelen = strlen(value); 147 152 patternlen--; 148 if (patternlen > valuelen)153 if (patternlen > valuelen) 149 154 return 0; 150 155 151 156 /* full string match: require same length */ 152 if (anchored && (valuelen != patternlen))157 if (anchored && (valuelen != patternlen)) 153 158 return 0; 154 159 … … 167 172 { 168 173 int i; 174 169 175 if (!has_dmi_support) 170 176 return 0; 171 177 172 for (i = 0; i < DMI_ID_INVALID; i++)173 if (dmi_compare(dmistrings[i], pattern))178 for (i = 0; i < DMI_ID_INVALID; i++) 179 if (dmi_compare(dmistrings[i], pattern)) 174 180 return 1; 175 181 -
trunk/flashrom.c
r927 r933 665 665 for (j = 0; j < len / 256; j++) { 666 666 limit = min (256, len - j * 256); 667 /* Are have and wantidentical? */667 /* Are 'have' and 'want' identical? */ 668 668 if (!memcmp(have + j * 256, want + j * 256, limit)) 669 669 continue; … … 1029 1029 * easiest way to check this is with function pointers. 1030 1030 */ 1031 for (j = k + 1; j < NUM_ERASEFUNCTIONS; j++) 1031 for (j = k + 1; j < NUM_ERASEFUNCTIONS; j++) { 1032 1032 if (eraser.block_erase == 1033 1033 flash->block_erasers[j].block_erase) { … … 1038 1038 ret = 1; 1039 1039 } 1040 } 1040 1041 } 1041 1042 return ret; … … 1199 1200 "with the additional -V option for all operations you " 1200 1201 "tested (-V, -rV,\n-wV, -EV), and mention which " 1201 "mainboard or programmer you tested. Thanks for your "1202 "mainboard or programmer you tested.\nThanks for your " 1202 1203 "help!\n===\n"); 1203 1204 } -
trunk/hwaccess.h
r898 r933 16 16 * along with this program; if not, write to the Free Software 17 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 * 19 * 18 */ 19 20 /* 20 21 * Header file for hardware access and OS abstraction. Included from flash.h. 21 22 */ … … 90 91 #include <stdint.h> 91 92 92 static inline void 93 outb(uint8_t value, uint16_t port) 93 static inline void outb(uint8_t value, uint16_t port) 94 94 { 95 95 asm volatile ("outb %b0,%w1": :"a" (value), "Nd" (port)); 96 96 } 97 97 98 static inline uint8_t 99 inb(uint16_t port) 98 static inline uint8_t inb(uint16_t port) 100 99 { 101 100 uint8_t value; … … 104 103 } 105 104 106 static inline void 107 outw(uint16_t value, uint16_t port) 105 static inline void outw(uint16_t value, uint16_t port) 108 106 { 109 107 asm volatile ("outw %w0,%w1": :"a" (value), "Nd" (port)); 110 108 } 111 109 112 static inline uint16_t 113 inw(uint16_t port) 110 static inline uint16_t inw(uint16_t port) 114 111 { 115 112 uint16_t value; … … 118 115 } 119 116 120 static inline void 121 outl(uint32_t value, uint16_t port) 117 static inline void outl(uint32_t value, uint16_t port) 122 118 { 123 119 asm volatile ("outl %0,%w1": :"a" (value), "Nd" (port)); 124 120 } 125 121 126 static inline uint32_t 127 inl(uint16_t port) 122 static inline uint32_t inl(uint16_t port) 128 123 { 129 124 uint32_t value; -
trunk/internal.c
r919 r933 106 106 { 107 107 superio = probe_superio_ite(); 108 #if 0 /* Winbond SuperI/O code is not yet available. */ 108 #if 0 109 /* Winbond Super I/O code is not yet available. */ 109 110 if (superio.vendor == SUPERIO_VENDOR_NONE) 110 111 superio = probe_superio_winbond(); … … 151 152 dmi_init(); 152 153 153 /* Probe for the Super I/O chip and fill global struct superio. */154 /* Probe for the Super I/O chip and fill global struct superio. */ 154 155 probe_superio(); 155 156 156 /* Warn if a laptop is detected */157 /* Warn if a laptop is detected. */ 157 158 if (is_laptop) 158 159 printf("========================================================================\n" … … 160 161 "Laptops, notebooks and netbooks are difficult to support and we recommend\n" 161 162 "to use the vendor flashing utility. The embedded controller (EC) in these\n" 162 "machines often interacts badly with flashing \n"163 "See http://www.flashrom.org/Laptops \n"163 "machines often interacts badly with flashing.\n" 164 "See http://www.flashrom.org/Laptops for details.\n" 164 165 "========================================================================\n"); 165 166 -
trunk/it87spi.c
r914 r933 82 82 case 0x86: 83 83 case 0x87: 84 msg_pinfo("Found ITE Super I/O, id %04hx\n",84 msg_pinfo("Found ITE Super I/O, id %04hx\n", 85 85 ret.model); 86 86 return ret; … … 171 171 172 172 get_io_perms(); 173 /* Probe for the Super I/O chip and fill global struct superio. */173 /* Probe for the Super I/O chip and fill global struct superio. */ 174 174 probe_superio(); 175 175 ret = it87spi_common_init(); -
trunk/serial.c
r883 r933 106 106 #ifdef _WIN32 107 107 HANDLE fd; 108 char* dev2 = dev; 109 if ((strlen(dev) > 3) && (tolower(dev[0])=='c') && (tolower(dev[1])=='o') && (tolower(dev[2])=='m')) { 110 dev2 = malloc(strlen(dev)+5); 108 char *dev2 = dev; 109 if ((strlen(dev) > 3) && (tolower(dev[0]) == 'c') 110 && (tolower(dev[1]) == 'o') && (tolower(dev[2]) == 'm')) { 111 dev2 = malloc(strlen(dev) + 5); 111 112 strcpy(dev2, "\\\\.\\"); 112 strcpy(dev2+4, dev); 113 } 114 fd = CreateFile(dev2, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); 113 strcpy(dev2 + 4, dev); 114 } 115 fd = CreateFile(dev2, GENERIC_READ | GENERIC_WRITE, 0, NULL, 116 OPEN_EXISTING, 0, NULL); 115 117 if (dev2 != dev) 116 118 free(dev2); … … 130 132 default: sp_die("Error: Could not set baud rate"); 131 133 } 132 dcb.ByteSize =8;133 dcb.Parity =NOPARITY;134 dcb.StopBits =ONESTOPBIT;134 dcb.ByteSize = 8; 135 dcb.Parity = NOPARITY; 136 dcb.StopBits = ONESTOPBIT; 135 137 if (!SetCommState(fd, &dcb)) { 136 138 sp_die("Error: Could not change serial port configuration"); … … 148 150 if (sp_baudtable[i].baud == 0) { 149 151 close(fd); 150 msg_perr( 151 "Error: cannot configure for baudrate %d\n", 152 baud); 152 msg_perr("Error: cannot configure for baudrate %d\n", 153 baud); 153 154 exit(1); 154 155 }
Note: See TracChangeset
for help on using the changeset viewer.
