Cosmetic changes to make the flashrom output more consistent (trivial).
Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Uwe Hermann <uwe@hermann-uwe.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2846 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
ae1ab3edec
commit
5982a0641b
|
@ -506,7 +506,7 @@ int chipset_flash_enable(void)
|
||||||
if (ret)
|
if (ret)
|
||||||
printf("Failed!\n");
|
printf("Failed!\n");
|
||||||
else
|
else
|
||||||
printf("OK.\n");
|
printf("OK\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -40,21 +40,21 @@ int show_id(uint8_t *bios, int size)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*walk) == 0 || ((*walk) & 0x3ff) != 0) {
|
if ((*walk) == 0 || ((*walk) & 0x3ff) != 0) {
|
||||||
printf("Flash image seems to be a legacy BIOS. Disabling checks.\n");
|
printf("Flash image seems to be a legacy BIOS - disabling checks\n");
|
||||||
mainboard_vendor = def_name;
|
mainboard_vendor = def_name;
|
||||||
mainboard_part = def_name;
|
mainboard_part = def_name;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf_debug("LinuxBIOS last image size "
|
printf_debug("LinuxBIOS last image size "
|
||||||
"(not rom size) is %d bytes.\n", *walk);
|
"(not ROM size) is %d bytes\n", *walk);
|
||||||
|
|
||||||
walk--;
|
walk--;
|
||||||
mainboard_part = strdup((const char *)(bios + size - *walk));
|
mainboard_part = strdup((const char *)(bios + size - *walk));
|
||||||
walk--;
|
walk--;
|
||||||
mainboard_vendor = strdup((const char *)(bios + size - *walk));
|
mainboard_vendor = strdup((const char *)(bios + size - *walk));
|
||||||
printf_debug("MANUFACTURER: %s\n", mainboard_vendor);
|
printf_debug("Manufacturer: %s\n", mainboard_vendor);
|
||||||
printf_debug("MAINBOARD ID: %s\n", mainboard_part);
|
printf_debug("Mainboard ID: %s\n", mainboard_part);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If lb_vendor is not set, the linuxbios table was
|
* If lb_vendor is not set, the linuxbios table was
|
||||||
|
@ -74,18 +74,18 @@ int show_id(uint8_t *bios, int size)
|
||||||
if (!strcasecmp(mainboard_vendor, lb_vendor) &&
|
if (!strcasecmp(mainboard_vendor, lb_vendor) &&
|
||||||
!strcasecmp(mainboard_part, lb_part)) {
|
!strcasecmp(mainboard_part, lb_part)) {
|
||||||
printf_debug("This firmware image matches "
|
printf_debug("This firmware image matches "
|
||||||
"this motherboard.\n");
|
"this motherboard\n");
|
||||||
} else {
|
} else {
|
||||||
if (force) {
|
if (force) {
|
||||||
printf("WARNING: This firmware image does not "
|
printf("WARNING: This firmware image does not "
|
||||||
"seem to fit to this machine - forcing it.\n");
|
"seem to fit to this machine - forcing it\n");
|
||||||
} else {
|
} else {
|
||||||
printf("ERROR: Your firmware image (%s:%s) does not "
|
printf("ERROR: Your firmware image (%s:%s) does not "
|
||||||
"appear to\n be correct for the detected "
|
"appear to\n be correct for the detected "
|
||||||
"mainboard (%s:%s)\n\nOverride with --force if you "
|
"mainboard (%s:%s)\n\nOverride with --force if you "
|
||||||
"are absolutely sure that you\nare using a correct "
|
"are absolutely sure that you\nare using a correct "
|
||||||
"image for this mainboard or override\nthe detected "
|
"image for this mainboard or override\nthe detected "
|
||||||
"values with --mainboard <vendor>:<mainboard>.\n\n",
|
"values with --mainboard <vendor>:<mainboard>\n\n",
|
||||||
mainboard_vendor, mainboard_part, lb_vendor,
|
mainboard_vendor, mainboard_part, lb_vendor,
|
||||||
lb_part);
|
lb_part);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -104,7 +104,7 @@ int read_romlayout(char *name)
|
||||||
romlayout = fopen(name, "r");
|
romlayout = fopen(name, "r");
|
||||||
|
|
||||||
if (!romlayout) {
|
if (!romlayout) {
|
||||||
fprintf(stderr, "ERROR: Could not open rom layout (%s).\n",
|
fprintf(stderr, "ERROR: Could not open ROM layout (%s)\n",
|
||||||
name);
|
name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -150,11 +150,11 @@ int find_romentry(char *name)
|
||||||
for (i = 0; i < romimages; i++) {
|
for (i = 0; i < romimages; i++) {
|
||||||
if (!strcmp(rom_entries[i].name, name)) {
|
if (!strcmp(rom_entries[i].name, name)) {
|
||||||
rom_entries[i].included = 1;
|
rom_entries[i].included = 1;
|
||||||
printf("found.\n");
|
printf("found\n");
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("not found.\n");
|
printf("not found\n");
|
||||||
// Not found. Error.
|
// Not found. Error.
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -42,8 +42,7 @@ static unsigned long compute_checksum(void *addr, unsigned long length)
|
||||||
uint8_t byte[2];
|
uint8_t byte[2];
|
||||||
uint16_t word;
|
uint16_t word;
|
||||||
} value;
|
} value;
|
||||||
unsigned long sum;
|
unsigned long sum, i;
|
||||||
unsigned long i;
|
|
||||||
|
|
||||||
/* In the most straight forward way possible,
|
/* In the most straight forward way possible,
|
||||||
* compute an ip style checksum.
|
* compute an ip style checksum.
|
||||||
|
@ -53,15 +52,13 @@ static unsigned long compute_checksum(void *addr, unsigned long length)
|
||||||
for (i = 0; i < length; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
unsigned long value;
|
unsigned long value;
|
||||||
value = ptr[i];
|
value = ptr[i];
|
||||||
if (i & 1) {
|
if (i & 1)
|
||||||
value <<= 8;
|
value <<= 8;
|
||||||
}
|
|
||||||
/* Add the new value */
|
/* Add the new value */
|
||||||
sum += value;
|
sum += value;
|
||||||
/* Wrap around the carry */
|
/* Wrap around the carry */
|
||||||
if (sum > 0xFFFF) {
|
if (sum > 0xFFFF)
|
||||||
sum = (sum + (sum >> 16)) & 0xFFFF;
|
sum = (sum + (sum >> 16)) & 0xFFFF;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
value.byte[0] = sum & 0xff;
|
value.byte[0] = sum & 0xff;
|
||||||
value.byte[1] = (sum >> 8) & 0xff;
|
value.byte[1] = (sum >> 8) & 0xff;
|
||||||
|
@ -110,17 +107,17 @@ static struct lb_header *find_lb_table(void *base, unsigned long start,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (count_lb_records(head) != head->table_entries) {
|
if (count_lb_records(head) != head->table_entries) {
|
||||||
fprintf(stderr, "bad record count: %d\n",
|
fprintf(stderr, "Bad record count: %d\n",
|
||||||
head->table_entries);
|
head->table_entries);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (compute_checksum((uint8_t *) head, sizeof(*head)) != 0) {
|
if (compute_checksum((uint8_t *) head, sizeof(*head)) != 0) {
|
||||||
fprintf(stderr, "bad header checksum\n");
|
fprintf(stderr, "Bad header checksum\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (compute_checksum(recs, head->table_bytes)
|
if (compute_checksum(recs, head->table_bytes)
|
||||||
!= head->table_checksum) {
|
!= head->table_checksum) {
|
||||||
fprintf(stderr, "bad table checksum: %04x\n",
|
fprintf(stderr, "Bad table checksum: %04x\n",
|
||||||
head->table_checksum);
|
head->table_checksum);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -140,7 +137,7 @@ static void find_mainboard(struct lb_record *ptr, unsigned long addr)
|
||||||
|
|
||||||
rec = (struct lb_mainboard *)ptr;
|
rec = (struct lb_mainboard *)ptr;
|
||||||
max_size = rec->size - sizeof(*rec);
|
max_size = rec->size - sizeof(*rec);
|
||||||
printf("vendor id: %.*s part id: %.*s\n",
|
printf("Vendor ID: %.*s, part ID: %.*s\n",
|
||||||
max_size - rec->vendor_idx,
|
max_size - rec->vendor_idx,
|
||||||
rec->strings + rec->vendor_idx,
|
rec->strings + rec->vendor_idx,
|
||||||
max_size - rec->part_number_idx,
|
max_size - rec->part_number_idx,
|
||||||
|
@ -151,7 +148,7 @@ static void find_mainboard(struct lb_record *ptr, unsigned long addr)
|
||||||
rec->strings + rec->part_number_idx);
|
rec->strings + rec->part_number_idx);
|
||||||
|
|
||||||
if (lb_part) {
|
if (lb_part) {
|
||||||
printf("overwritten by command line, vendor id: %s part id: %s\n", lb_vendor, lb_part);
|
printf("Overwritten by command line, vendor ID: %s, part ID: %s\n", lb_vendor, lb_part);
|
||||||
} else {
|
} else {
|
||||||
lb_part = strdup(part);
|
lb_part = strdup(part);
|
||||||
lb_vendor = strdup(vendor);
|
lb_vendor = strdup(vendor);
|
||||||
|
@ -201,7 +198,7 @@ int linuxbios_init(void)
|
||||||
if (lb_table) {
|
if (lb_table) {
|
||||||
unsigned long addr;
|
unsigned long addr;
|
||||||
addr = ((char *)lb_table) - ((char *)low_1MB);
|
addr = ((char *)lb_table) - ((char *)low_1MB);
|
||||||
printf_debug("lb_table found at address %p\n", lb_table);
|
printf_debug("LinuxBIOS table found at address %p\n", lb_table);
|
||||||
rec = (struct lb_record *)(((char *)lb_table) + lb_table->header_bytes);
|
rec = (struct lb_record *)(((char *)lb_table) + lb_table->header_bytes);
|
||||||
last = (struct lb_record *)(((char *)rec) + lb_table->table_bytes);
|
last = (struct lb_record *)(((char *)rec) + lb_table->table_bytes);
|
||||||
printf_debug("LinuxBIOS header(%d) checksum: %04x table(%d) checksum: %04x entries: %d\n",
|
printf_debug("LinuxBIOS header(%d) checksum: %04x table(%d) checksum: %04x entries: %d\n",
|
||||||
|
@ -210,7 +207,7 @@ int linuxbios_init(void)
|
||||||
lb_table->table_entries);
|
lb_table->table_entries);
|
||||||
search_lb_records(rec, last, addr + lb_table->header_bytes);
|
search_lb_records(rec, last, addr + lb_table->header_bytes);
|
||||||
} else {
|
} else {
|
||||||
printf("No LinuxBIOS table found.\n");
|
printf("No LinuxBIOS table found\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,5 +56,5 @@ void myusec_calibrate_delay()
|
||||||
micro = count / timeusec;
|
micro = count / timeusec;
|
||||||
|
|
||||||
printf_debug("%ldM loops per second. ", (unsigned long)micro);
|
printf_debug("%ldM loops per second. ", (unsigned long)micro);
|
||||||
printf("ok\n");
|
printf("OK\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue