mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-28 07:23:43 +02:00
Various coding style and cosmetic changes
- Fix coding-style, whitespace, and indentation in a few places. - Consistently use the same spelling ("Super I/O") everywhere. Corresponding to flashrom svn r933. - Make some flashrom stdout output look a bit nicer. Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
This commit is contained in:
parent
645c6df21a
commit
439597032e
@ -79,7 +79,7 @@ static int enable_flash_decode_superio(void)
|
|||||||
break;
|
break;
|
||||||
case SUPERIO_VENDOR_ITE:
|
case SUPERIO_VENDOR_ITE:
|
||||||
enter_conf_mode_ite(superio.port);
|
enter_conf_mode_ite(superio.port);
|
||||||
/* Enable flash mapping. Works for most old ITE style SuperI/O. */
|
/* Enable flash mapping. Works for most old ITE style Super I/O. */
|
||||||
tmp = sio_read(superio.port, 0x24);
|
tmp = sio_read(superio.port, 0x24);
|
||||||
tmp |= 0xfc;
|
tmp |= 0xfc;
|
||||||
sio_write(superio.port, 0x24, tmp);
|
sio_write(superio.port, 0x24, tmp);
|
||||||
@ -87,7 +87,7 @@ static int enable_flash_decode_superio(void)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf_debug("Unhandled SuperI/O type!\n");
|
printf_debug("Unhandled Super I/O type!\n");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -226,7 +226,7 @@ static int it8705f_write_enable(uint8_t port, const char *name)
|
|||||||
* - GIGABYTE GA-7VT600: VIA KT600 + VT8237 + IT8705
|
* - GIGABYTE GA-7VT600: VIA KT600 + VT8237 + IT8705
|
||||||
* - Shuttle AK38N: VIA KT333CF + VIA VT8235 + ITE IT8705F
|
* - Shuttle AK38N: VIA KT333CF + VIA VT8235 + ITE IT8705F
|
||||||
*
|
*
|
||||||
* SIS950 superio probably requires the same flash write enable.
|
* The SIS950 Super I/O probably requires the same flash write enable.
|
||||||
*/
|
*/
|
||||||
static int it8705f_write_enable_2e(const char *name)
|
static int it8705f_write_enable_2e(const char *name)
|
||||||
{
|
{
|
||||||
@ -239,36 +239,32 @@ static int pc87360_gpio_set(uint8_t gpio, int raise)
|
|||||||
int gpio_bank = gpio / 8;
|
int gpio_bank = gpio / 8;
|
||||||
int gpio_pin = gpio % 8;
|
int gpio_pin = gpio % 8;
|
||||||
uint16_t baseport;
|
uint16_t baseport;
|
||||||
uint8_t id;
|
uint8_t id, val;
|
||||||
uint8_t val;
|
|
||||||
|
|
||||||
if (gpio_bank > 4)
|
if (gpio_bank > 4) {
|
||||||
{
|
|
||||||
fprintf(stderr, "PC87360: Invalid GPIO %d\n", gpio);
|
fprintf(stderr, "PC87360: Invalid GPIO %d\n", gpio);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
id = sio_read(0x2E, 0x20);
|
id = sio_read(0x2E, 0x20);
|
||||||
if (id != 0xE1)
|
if (id != 0xE1) {
|
||||||
{
|
|
||||||
fprintf(stderr, "PC87360: unexpected ID %02x\n", id);
|
fprintf(stderr, "PC87360: unexpected ID %02x\n", id);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sio_write(0x2E, 0x07, 0x07); /* select GPIO device */
|
sio_write(0x2E, 0x07, 0x07); /* Select GPIO device */
|
||||||
baseport = (sio_read(0x2E, 0x60) << 8) | sio_read(0x2E, 0x61);
|
baseport = (sio_read(0x2E, 0x60) << 8) | sio_read(0x2E, 0x61);
|
||||||
if((baseport & 0xFFF0) == 0xFFF0 || baseport == 0)
|
if ((baseport & 0xFFF0) == 0xFFF0 || baseport == 0) {
|
||||||
{
|
|
||||||
fprintf (stderr, "PC87360: invalid GPIO base address %04x\n",
|
fprintf (stderr, "PC87360: invalid GPIO base address %04x\n",
|
||||||
baseport);
|
baseport);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
sio_mask (0x2E, 0x30, 0x01, 0x01); /* Enable logical device */
|
sio_mask (0x2E, 0x30, 0x01, 0x01); /* Enable logical device */
|
||||||
sio_write(0x2E, 0xF0, gpio_bank*16 + gpio_pin);
|
sio_write(0x2E, 0xF0, gpio_bank * 16 + gpio_pin);
|
||||||
sio_mask (0x2E, 0xF1, 0x01, 0x01); /* Make pin output */
|
sio_mask (0x2E, 0xF1, 0x01, 0x01); /* Make pin output */
|
||||||
|
|
||||||
val = INB(baseport + bankbase[gpio_bank]);
|
val = INB(baseport + bankbase[gpio_bank]);
|
||||||
if(raise)
|
if (raise)
|
||||||
val |= 1 << gpio_pin;
|
val |= 1 << gpio_pin;
|
||||||
else
|
else
|
||||||
val &= ~(1 << gpio_pin);
|
val &= ~(1 << gpio_pin);
|
||||||
@ -1028,8 +1024,7 @@ static int board_soyo_sy_7vca(const char *name)
|
|||||||
static int board_msi_651ml(const char *name)
|
static int board_msi_651ml(const char *name)
|
||||||
{
|
{
|
||||||
struct pci_dev *dev;
|
struct pci_dev *dev;
|
||||||
uint16_t base;
|
uint16_t base, temp;
|
||||||
uint16_t temp;
|
|
||||||
|
|
||||||
dev = pci_dev_find(0x1039, 0x0962);
|
dev = pci_dev_find(0x1039, 0x0962);
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
@ -1133,7 +1128,7 @@ static int board_asus_a7v8x(const char *name)
|
|||||||
w836xx_ext_leave(0x2E);
|
w836xx_ext_leave(0x2E);
|
||||||
|
|
||||||
if (id != 0x8701) {
|
if (id != 0x8701) {
|
||||||
fprintf(stderr, "\nERROR: IT8703F SuperIO not found.\n");
|
fprintf(stderr, "\nERROR: IT8703F Super I/O not found.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1144,7 +1139,7 @@ static int board_asus_a7v8x(const char *name)
|
|||||||
w836xx_ext_leave(0x2E);
|
w836xx_ext_leave(0x2E);
|
||||||
|
|
||||||
if (!base) {
|
if (!base) {
|
||||||
fprintf(stderr, "\nERROR: Failed to read IT8703F SuperIO GPIO"
|
fprintf(stderr, "\nERROR: Failed to read IT8703F Super I/O GPIO"
|
||||||
" Base.\n");
|
" Base.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1161,8 +1156,7 @@ static int board_asus_a7v8x(const char *name)
|
|||||||
* General routine for raising/dropping GPIO lines on the ITE IT8712F.
|
* General routine for raising/dropping GPIO lines on the ITE IT8712F.
|
||||||
* There is only some limited checking on the port numbers.
|
* There is only some limited checking on the port numbers.
|
||||||
*/
|
*/
|
||||||
static int
|
static int it8712f_gpio_set(unsigned int line, int raise)
|
||||||
it8712f_gpio_set(unsigned int line, int raise)
|
|
||||||
{
|
{
|
||||||
unsigned int port;
|
unsigned int port;
|
||||||
uint16_t id, base;
|
uint16_t id, base;
|
||||||
@ -1186,7 +1180,7 @@ it8712f_gpio_set(unsigned int line, int raise)
|
|||||||
exit_conf_mode_ite(0x2E);
|
exit_conf_mode_ite(0x2E);
|
||||||
|
|
||||||
if (id != 0x8712) {
|
if (id != 0x8712) {
|
||||||
fprintf(stderr, "\nERROR: IT8712F SuperIO not found.\n");
|
fprintf(stderr, "\nERROR: IT8712F Super I/O not found.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1197,7 +1191,7 @@ it8712f_gpio_set(unsigned int line, int raise)
|
|||||||
exit_conf_mode_ite(0x2E);
|
exit_conf_mode_ite(0x2E);
|
||||||
|
|
||||||
if (!base) {
|
if (!base) {
|
||||||
fprintf(stderr, "\nERROR: Failed to read IT8712F SuperIO GPIO"
|
fprintf(stderr, "\nERROR: Failed to read IT8712F Super I/O GPIO"
|
||||||
" Base.\n");
|
" Base.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1446,20 +1440,19 @@ int board_flash_enable(const char *vendor, const char *part)
|
|||||||
board = board_match_pci_card_ids();
|
board = board_match_pci_card_ids();
|
||||||
|
|
||||||
if (board && board->status == NT) {
|
if (board && board->status == NT) {
|
||||||
if (!force_boardenable)
|
if (!force_boardenable) {
|
||||||
{
|
|
||||||
printf("WARNING: Your mainboard is %s %s, but the mainboard-specific\n"
|
printf("WARNING: Your mainboard is %s %s, but the mainboard-specific\n"
|
||||||
"code has not been tested, and thus will not not be executed by default.\n"
|
"code has not been tested, and thus will not not be executed by default.\n"
|
||||||
"Depending on your hardware environment, erasing, writing or even probing\n"
|
"Depending on your hardware environment, erasing, writing or even probing\n"
|
||||||
"can fail without running the board specific code.\n\n"
|
"can fail without running the board specific code.\n\n"
|
||||||
"Please see the man page (section PROGRAMMER SPECIFIC INFO, subsection\n"
|
"Please see the man page (section PROGRAMMER SPECIFIC INFO, subsection\n"
|
||||||
"\"internal programmer\") for details\n",
|
"\"internal programmer\") for details.\n",
|
||||||
board->vendor_name, board->board_name);
|
board->vendor_name, board->board_name);
|
||||||
board = NULL;
|
board = NULL;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
printf("NOTE: Running an untested board enable procedure.\n"
|
printf("NOTE: Running an untested board enable procedure.\n"
|
||||||
"Please report success/failure to flashrom@flashrom.org\n");
|
"Please report success/failure to flashrom@flashrom.org.\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (board) {
|
if (board) {
|
||||||
|
10
cli_output.c
10
cli_output.c
@ -28,15 +28,16 @@ int print(int type, const char *fmt, ...)
|
|||||||
int ret;
|
int ret;
|
||||||
FILE *output_type;
|
FILE *output_type;
|
||||||
|
|
||||||
switch (type)
|
switch (type) {
|
||||||
{
|
|
||||||
case MSG_ERROR:
|
case MSG_ERROR:
|
||||||
output_type = stderr;
|
output_type = stderr;
|
||||||
break;
|
break;
|
||||||
case MSG_BARF:
|
case MSG_BARF:
|
||||||
if (verbose < 2) return 0;
|
if (verbose < 2)
|
||||||
|
return 0;
|
||||||
case MSG_DEBUG:
|
case MSG_DEBUG:
|
||||||
if (verbose < 1) return 0;
|
if (verbose < 1)
|
||||||
|
return 0;
|
||||||
case MSG_INFO:
|
case MSG_INFO:
|
||||||
default:
|
default:
|
||||||
output_type = stdout;
|
output_type = stdout;
|
||||||
@ -48,4 +49,3 @@ int print(int type, const char *fmt, ...)
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
30
dmi.c
30
dmi.c
@ -31,18 +31,20 @@ enum dmi_strings {
|
|||||||
DMI_BB_MANUFACTURER,
|
DMI_BB_MANUFACTURER,
|
||||||
DMI_BB_PRODUCT,
|
DMI_BB_PRODUCT,
|
||||||
DMI_BB_VERSION,
|
DMI_BB_VERSION,
|
||||||
DMI_ID_INVALID /* This must always be the last entry */
|
DMI_ID_INVALID, /* This must always be the last entry! */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The short_id for baseboard starts with "m" as in mainboard to leave
|
/*
|
||||||
"b" available for BIOS */
|
* The short_id for baseboard starts with "m" as in mainboard to leave
|
||||||
|
* "b" available for BIOS.
|
||||||
|
*/
|
||||||
const char *dmidecode_names[DMI_ID_INVALID] = {
|
const char *dmidecode_names[DMI_ID_INVALID] = {
|
||||||
"system-manufacturer",
|
"system-manufacturer",
|
||||||
"system-product-name",
|
"system-product-name",
|
||||||
"system-version",
|
"system-version",
|
||||||
"baseboard-manufacturer",
|
"baseboard-manufacturer",
|
||||||
"baseboard-product-name",
|
"baseboard-product-name",
|
||||||
"baseboard-version"
|
"baseboard-version",
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DMI_COMMAND_LEN_MAX 260
|
#define DMI_COMMAND_LEN_MAX 260
|
||||||
@ -51,7 +53,7 @@ const char *dmidecode_command = "dmidecode";
|
|||||||
int has_dmi_support = 0;
|
int has_dmi_support = 0;
|
||||||
char *dmistrings[DMI_ID_INVALID];
|
char *dmistrings[DMI_ID_INVALID];
|
||||||
|
|
||||||
/* strings longer than 4096 in DMI are just insane */
|
/* Strings longer than 4096 in DMI are just insane. */
|
||||||
#define DMI_MAX_ANSWER_LEN 4096
|
#define DMI_MAX_ANSWER_LEN 4096
|
||||||
|
|
||||||
static char *get_dmi_string(const char *string_name)
|
static char *get_dmi_string(const char *string_name)
|
||||||
@ -59,7 +61,8 @@ static char *get_dmi_string(const char *string_name)
|
|||||||
FILE *dmidecode_pipe;
|
FILE *dmidecode_pipe;
|
||||||
char *result;
|
char *result;
|
||||||
char answerbuf[DMI_MAX_ANSWER_LEN];
|
char answerbuf[DMI_MAX_ANSWER_LEN];
|
||||||
char commandline[DMI_COMMAND_LEN_MAX+40];
|
char commandline[DMI_COMMAND_LEN_MAX + 40];
|
||||||
|
|
||||||
snprintf(commandline, sizeof(commandline),
|
snprintf(commandline, sizeof(commandline),
|
||||||
"%s -s %s", dmidecode_command, string_name);
|
"%s -s %s", dmidecode_command, string_name);
|
||||||
dmidecode_pipe = popen(commandline, "r");
|
dmidecode_pipe = popen(commandline, "r");
|
||||||
@ -82,7 +85,7 @@ static char *get_dmi_string(const char *string_name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* chomp trailing newline */
|
/* Chomp trailing newline. */
|
||||||
if (answerbuf[0] != 0 &&
|
if (answerbuf[0] != 0 &&
|
||||||
answerbuf[strlen(answerbuf) - 1] == '\n')
|
answerbuf[strlen(answerbuf) - 1] == '\n')
|
||||||
answerbuf[strlen(answerbuf) - 1] = 0;
|
answerbuf[strlen(answerbuf) - 1] = 0;
|
||||||
@ -99,6 +102,7 @@ void dmi_init(void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *chassis_type;
|
char *chassis_type;
|
||||||
|
|
||||||
has_dmi_support = 1;
|
has_dmi_support = 1;
|
||||||
for (i = 0; i < DMI_ID_INVALID; i++) {
|
for (i = 0; i < DMI_ID_INVALID; i++) {
|
||||||
dmistrings[i] = get_dmi_string(dmidecode_names[i]);
|
dmistrings[i] = get_dmi_string(dmidecode_names[i]);
|
||||||
@ -131,8 +135,9 @@ static int dmi_compare(const char *value, const char *pattern)
|
|||||||
{
|
{
|
||||||
int anchored = 0;
|
int anchored = 0;
|
||||||
int patternlen;
|
int patternlen;
|
||||||
|
|
||||||
printf_debug("matching %s against %s\n", value, pattern);
|
printf_debug("matching %s against %s\n", value, pattern);
|
||||||
/* The empty string is part of all strings */
|
/* The empty string is part of all strings! */
|
||||||
if (pattern[0] == 0)
|
if (pattern[0] == 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -145,11 +150,11 @@ static int dmi_compare(const char *value, const char *pattern)
|
|||||||
if (pattern[patternlen - 1] == '$') {
|
if (pattern[patternlen - 1] == '$') {
|
||||||
int valuelen = strlen(value);
|
int valuelen = strlen(value);
|
||||||
patternlen--;
|
patternlen--;
|
||||||
if(patternlen > valuelen)
|
if (patternlen > valuelen)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* full string match: require same length */
|
/* full string match: require same length */
|
||||||
if(anchored && (valuelen != patternlen))
|
if (anchored && (valuelen != patternlen))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* start character to make ends match */
|
/* start character to make ends match */
|
||||||
@ -166,11 +171,12 @@ static int dmi_compare(const char *value, const char *pattern)
|
|||||||
int dmi_match(const char *pattern)
|
int dmi_match(const char *pattern)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!has_dmi_support)
|
if (!has_dmi_support)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (i = 0;i < DMI_ID_INVALID; i++)
|
for (i = 0; i < DMI_ID_INVALID; i++)
|
||||||
if(dmi_compare(dmistrings[i], pattern))
|
if (dmi_compare(dmistrings[i], pattern))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -664,7 +664,7 @@ int need_erase(uint8_t *have, uint8_t *want, int len, enum write_granularity gra
|
|||||||
case write_gran_256bytes:
|
case write_gran_256bytes:
|
||||||
for (j = 0; j < len / 256; j++) {
|
for (j = 0; j < len / 256; j++) {
|
||||||
limit = min (256, len - j * 256);
|
limit = min (256, len - j * 256);
|
||||||
/* Are have and want identical? */
|
/* Are 'have' and 'want' identical? */
|
||||||
if (!memcmp(have + j * 256, want + j * 256, limit))
|
if (!memcmp(have + j * 256, want + j * 256, limit))
|
||||||
continue;
|
continue;
|
||||||
/* have needs to be in erased state. */
|
/* have needs to be in erased state. */
|
||||||
@ -1028,7 +1028,7 @@ int selfcheck_eraseblocks(struct flashchip *flash)
|
|||||||
* layouts. That would imply "magic" erase functions. The
|
* layouts. That would imply "magic" erase functions. The
|
||||||
* easiest way to check this is with function pointers.
|
* easiest way to check this is with function pointers.
|
||||||
*/
|
*/
|
||||||
for (j = k + 1; j < NUM_ERASEFUNCTIONS; j++)
|
for (j = k + 1; j < NUM_ERASEFUNCTIONS; j++) {
|
||||||
if (eraser.block_erase ==
|
if (eraser.block_erase ==
|
||||||
flash->block_erasers[j].block_erase) {
|
flash->block_erasers[j].block_erase) {
|
||||||
msg_gerr("ERROR: Flash chip %s erase function "
|
msg_gerr("ERROR: Flash chip %s erase function "
|
||||||
@ -1037,6 +1037,7 @@ int selfcheck_eraseblocks(struct flashchip *flash)
|
|||||||
flash->name, k, j);
|
flash->name, k, j);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1198,7 +1199,7 @@ void check_chip_supported(struct flashchip *flash)
|
|||||||
"this flash part. Please include the flashrom\noutput "
|
"this flash part. Please include the flashrom\noutput "
|
||||||
"with the additional -V option for all operations you "
|
"with the additional -V option for all operations you "
|
||||||
"tested (-V, -rV,\n-wV, -EV), and mention which "
|
"tested (-V, -rV,\n-wV, -EV), and mention which "
|
||||||
"mainboard or programmer you tested. Thanks for your "
|
"mainboard or programmer you tested.\nThanks for your "
|
||||||
"help!\n===\n");
|
"help!\n===\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
23
hwaccess.h
23
hwaccess.h
@ -15,8 +15,9 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*/
|
||||||
*
|
|
||||||
|
/*
|
||||||
* Header file for hardware access and OS abstraction. Included from flash.h.
|
* Header file for hardware access and OS abstraction. Included from flash.h.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -89,42 +90,36 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
static inline void
|
static inline void outb(uint8_t value, uint16_t port)
|
||||||
outb(uint8_t value, uint16_t port)
|
|
||||||
{
|
{
|
||||||
asm volatile ("outb %b0,%w1": :"a" (value), "Nd" (port));
|
asm volatile ("outb %b0,%w1": :"a" (value), "Nd" (port));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint8_t
|
static inline uint8_t inb(uint16_t port)
|
||||||
inb(uint16_t port)
|
|
||||||
{
|
{
|
||||||
uint8_t value;
|
uint8_t value;
|
||||||
asm volatile ("inb %w1,%0":"=a" (value):"Nd" (port));
|
asm volatile ("inb %w1,%0":"=a" (value):"Nd" (port));
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void outw(uint16_t value, uint16_t port)
|
||||||
outw(uint16_t value, uint16_t port)
|
|
||||||
{
|
{
|
||||||
asm volatile ("outw %w0,%w1": :"a" (value), "Nd" (port));
|
asm volatile ("outw %w0,%w1": :"a" (value), "Nd" (port));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint16_t
|
static inline uint16_t inw(uint16_t port)
|
||||||
inw(uint16_t port)
|
|
||||||
{
|
{
|
||||||
uint16_t value;
|
uint16_t value;
|
||||||
asm volatile ("inw %w1,%0":"=a" (value):"Nd" (port));
|
asm volatile ("inw %w1,%0":"=a" (value):"Nd" (port));
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void outl(uint32_t value, uint16_t port)
|
||||||
outl(uint32_t value, uint16_t port)
|
|
||||||
{
|
{
|
||||||
asm volatile ("outl %0,%w1": :"a" (value), "Nd" (port));
|
asm volatile ("outl %0,%w1": :"a" (value), "Nd" (port));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t
|
static inline uint32_t inl(uint16_t port)
|
||||||
inl(uint16_t port)
|
|
||||||
{
|
{
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
asm volatile ("inl %1,%0":"=a" (value):"Nd" (port));
|
asm volatile ("inl %1,%0":"=a" (value):"Nd" (port));
|
||||||
|
11
internal.c
11
internal.c
@ -105,7 +105,8 @@ int force_boardenable = 0;
|
|||||||
void probe_superio(void)
|
void probe_superio(void)
|
||||||
{
|
{
|
||||||
superio = probe_superio_ite();
|
superio = probe_superio_ite();
|
||||||
#if 0 /* Winbond SuperI/O code is not yet available. */
|
#if 0
|
||||||
|
/* Winbond Super I/O code is not yet available. */
|
||||||
if (superio.vendor == SUPERIO_VENDOR_NONE)
|
if (superio.vendor == SUPERIO_VENDOR_NONE)
|
||||||
superio = probe_superio_winbond();
|
superio = probe_superio_winbond();
|
||||||
#endif
|
#endif
|
||||||
@ -150,17 +151,17 @@ int internal_init(void)
|
|||||||
coreboot_init();
|
coreboot_init();
|
||||||
dmi_init();
|
dmi_init();
|
||||||
|
|
||||||
/* Probe for the SuperI/O chip and fill global struct superio. */
|
/* Probe for the Super I/O chip and fill global struct superio. */
|
||||||
probe_superio();
|
probe_superio();
|
||||||
|
|
||||||
/* Warn if a laptop is detected */
|
/* Warn if a laptop is detected. */
|
||||||
if (is_laptop)
|
if (is_laptop)
|
||||||
printf("========================================================================\n"
|
printf("========================================================================\n"
|
||||||
"WARNING! You seem to be running flashrom on a laptop.\n"
|
"WARNING! You seem to be running flashrom on a laptop.\n"
|
||||||
"Laptops, notebooks and netbooks are difficult to support and we recommend\n"
|
"Laptops, notebooks and netbooks are difficult to support and we recommend\n"
|
||||||
"to use the vendor flashing utility. The embedded controller (EC) in these\n"
|
"to use the vendor flashing utility. The embedded controller (EC) in these\n"
|
||||||
"machines often interacts badly with flashing\n"
|
"machines often interacts badly with flashing.\n"
|
||||||
"See http://www.flashrom.org/Laptops\n"
|
"See http://www.flashrom.org/Laptops for details.\n"
|
||||||
"========================================================================\n");
|
"========================================================================\n");
|
||||||
|
|
||||||
/* try to enable it. Failure IS an option, since not all motherboards
|
/* try to enable it. Failure IS an option, since not all motherboards
|
||||||
|
@ -81,7 +81,7 @@ struct superio probe_superio_ite(void)
|
|||||||
case 0x82:
|
case 0x82:
|
||||||
case 0x86:
|
case 0x86:
|
||||||
case 0x87:
|
case 0x87:
|
||||||
msg_pinfo("Found ITE SuperI/O, id %04hx\n",
|
msg_pinfo("Found ITE Super I/O, id %04hx\n",
|
||||||
ret.model);
|
ret.model);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ int it87spi_init(void)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
get_io_perms();
|
get_io_perms();
|
||||||
/* Probe for the SuperI/O chip and fill global struct superio. */
|
/* Probe for the Super I/O chip and fill global struct superio. */
|
||||||
probe_superio();
|
probe_superio();
|
||||||
ret = it87spi_common_init();
|
ret = it87spi_common_init();
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
|
23
serial.c
23
serial.c
@ -105,13 +105,15 @@ fdtype sp_openserport(char *dev, unsigned int baud)
|
|||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
HANDLE fd;
|
HANDLE fd;
|
||||||
char* dev2 = dev;
|
char *dev2 = dev;
|
||||||
if ((strlen(dev) > 3) && (tolower(dev[0])=='c') && (tolower(dev[1])=='o') && (tolower(dev[2])=='m')) {
|
if ((strlen(dev) > 3) && (tolower(dev[0]) == 'c')
|
||||||
dev2 = malloc(strlen(dev)+5);
|
&& (tolower(dev[1]) == 'o') && (tolower(dev[2]) == 'm')) {
|
||||||
|
dev2 = malloc(strlen(dev) + 5);
|
||||||
strcpy(dev2, "\\\\.\\");
|
strcpy(dev2, "\\\\.\\");
|
||||||
strcpy(dev2+4, dev);
|
strcpy(dev2 + 4, dev);
|
||||||
}
|
}
|
||||||
fd = CreateFile(dev2, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
fd = CreateFile(dev2, GENERIC_READ | GENERIC_WRITE, 0, NULL,
|
||||||
|
OPEN_EXISTING, 0, NULL);
|
||||||
if (dev2 != dev)
|
if (dev2 != dev)
|
||||||
free(dev2);
|
free(dev2);
|
||||||
if (fd == INVALID_HANDLE_VALUE) {
|
if (fd == INVALID_HANDLE_VALUE) {
|
||||||
@ -129,9 +131,9 @@ fdtype sp_openserport(char *dev, unsigned int baud)
|
|||||||
case 115200: dcb.BaudRate = CBR_115200; break;
|
case 115200: dcb.BaudRate = CBR_115200; break;
|
||||||
default: sp_die("Error: Could not set baud rate");
|
default: sp_die("Error: Could not set baud rate");
|
||||||
}
|
}
|
||||||
dcb.ByteSize=8;
|
dcb.ByteSize = 8;
|
||||||
dcb.Parity=NOPARITY;
|
dcb.Parity = NOPARITY;
|
||||||
dcb.StopBits=ONESTOPBIT;
|
dcb.StopBits = ONESTOPBIT;
|
||||||
if (!SetCommState(fd, &dcb)) {
|
if (!SetCommState(fd, &dcb)) {
|
||||||
sp_die("Error: Could not change serial port configuration");
|
sp_die("Error: Could not change serial port configuration");
|
||||||
}
|
}
|
||||||
@ -147,9 +149,8 @@ fdtype sp_openserport(char *dev, unsigned int baud)
|
|||||||
for (i = 0;; i++) {
|
for (i = 0;; i++) {
|
||||||
if (sp_baudtable[i].baud == 0) {
|
if (sp_baudtable[i].baud == 0) {
|
||||||
close(fd);
|
close(fd);
|
||||||
msg_perr(
|
msg_perr("Error: cannot configure for baudrate %d\n",
|
||||||
"Error: cannot configure for baudrate %d\n",
|
baud);
|
||||||
baud);
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (sp_baudtable[i].baud == baud) {
|
if (sp_baudtable[i].baud == baud) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user