From a0c0093a09f0a7115ce73abe00b8b75afab4a08c Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Thu, 27 Mar 2008 20:46:49 +0000 Subject: Various tiny fixes (trivial): - Show PCI IDs as 4-digit numbers always. - Cosmetic changes to make UI look more consistent. - Drop MODULE_COUNT #define and use ARRAY_SIZE() where needed. - Small fix to improve build system (create build/ when not there). Signed-off-by: Uwe Hermann Acked-by: Uwe Hermann git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3191 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- payloads/coreinfo/Makefile | 2 +- payloads/coreinfo/coreboot_module.c | 22 +++++++++++----------- payloads/coreinfo/coreinfo.c | 12 +++++------- payloads/coreinfo/pci_module.c | 2 +- 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/payloads/coreinfo/Makefile b/payloads/coreinfo/Makefile index c3f102e836..f22170946c 100644 --- a/payloads/coreinfo/Makefile +++ b/payloads/coreinfo/Makefile @@ -66,7 +66,7 @@ else include $(src)/.config -all: $(TARGET) +all: prepare $(TARGET) $(TARGET): $(OBJS) $(Q)printf " LD $(subst $(shell pwd)/,,$(@))\n" diff --git a/payloads/coreinfo/coreboot_module.c b/payloads/coreinfo/coreboot_module.c index 45ed38cccd..e5615b3322 100644 --- a/payloads/coreinfo/coreboot_module.c +++ b/payloads/coreinfo/coreboot_module.c @@ -47,30 +47,30 @@ int coreboot_module_redraw(WINDOW *win) print_module_title(win, "Coreboot Tables"); if (tables_good) { - mvwprintw(win, row++, 2, "No Coreboot tables were found"); + mvwprintw(win, row++, 1, "No Coreboot tables were found"); return 0; } - mvwprintw(win, row++, 2, "Vendor: %s", cb_info.vendor); - mvwprintw(win, row++, 2, "Part: %s", cb_info.part); + mvwprintw(win, row++, 1, "Vendor: %s", cb_info.vendor); + mvwprintw(win, row++, 1, "Part: %s", cb_info.part); - mvwprintw(win, row++, 2, "Version: %s%s", + mvwprintw(win, row++, 1, "Version: %s%s", cb_info.strings[CB_TAG_VERSION - 0x4], cb_info.strings[CB_TAG_EXTRA_VERSION - 0x4]); - mvwprintw(win, row++, 2, "Built: %s (%s@%s.%s)", + mvwprintw(win, row++, 1, "Built: %s (%s@%s.%s)", cb_info.strings[CB_TAG_BUILD - 0x4], cb_info.strings[CB_TAG_COMPILE_BY - 0x04], cb_info.strings[CB_TAG_COMPILE_HOST - 0x04], cb_info.strings[CB_TAG_COMPILE_DOMAIN - 0x04]); if (cb_info.serial.tag != 0x0) { - mvwprintw(win, row++, 2, "Serial Port I/O base: 0x%x", + mvwprintw(win, row++, 1, "Serial Port I/O base: 0x%x", cb_info.serial.ioport); } if (cb_info.console.tag != 0x0) { - mvwprintw(win, row++, 2, "Default Output Console: "); + mvwprintw(win, row++, 1, "Default Output Console: "); switch (cb_info.console.type) { case CB_TAG_CONSOLE_SERIAL8250: @@ -95,18 +95,18 @@ int coreboot_module_redraw(WINDOW *win) } row++; - mvwprintw(win, row++, 2, "-- Memory Map --"); + mvwprintw(win, row++, 1, "-- Memory Map --"); for (i = 0; i < cb_info.mem_count; i++) { switch (cb_info.range[i].type) { case CB_MEM_RAM: - mvwprintw(win, row++, 4, " RAM: "); + mvwprintw(win, row++, 3, " RAM: "); break; case CB_MEM_RESERVED: - mvwprintw(win, row++, 4, "Reserved: "); + mvwprintw(win, row++, 3, "Reserved: "); break; case CB_MEM_TABLE: - mvwprintw(win, row++, 4, " Table: "); + mvwprintw(win, row++, 3, " Table: "); } wprintw(win, "%16.16llx - %16.16llx", diff --git a/payloads/coreinfo/coreinfo.c b/payloads/coreinfo/coreinfo.c index c81e9b3895..09a405d83b 100644 --- a/payloads/coreinfo/coreinfo.c +++ b/payloads/coreinfo/coreinfo.c @@ -26,12 +26,10 @@ extern struct coreinfo_module cpuinfo_module; extern struct coreinfo_module pci_module; extern struct coreinfo_module coreboot_module; -#define MODULE_COUNT 3 - -struct coreinfo_module *modules[MODULE_COUNT] = { +struct coreinfo_module *modules[] = { &cpuinfo_module, &pci_module, - &coreboot_module + &coreboot_module, }; static WINDOW *modwin; @@ -61,7 +59,7 @@ static void print_menu(void) for (j = 0; j < SCREEN_X; j++) waddch(stdscr, ' '); - for (i = 0; i < MODULE_COUNT; i++) + for (i = 0; i < ARRAY_SIZE(modules); i++) ptr += sprintf(ptr, "F%d: %s ", i + 1, modules[i]->name); mvprintw(23, 0, menu); @@ -127,7 +125,7 @@ static void loop(void) if (key >= KEY_F(1) && key <= KEY_F(9)) { unsigned char ch = key - KEY_F(1); - if (ch < MODULE_COUNT) { + if (ch < ARRAY_SIZE(modules)) { curwin = ch; redraw_module(); continue; @@ -167,7 +165,7 @@ int main(void) refresh(); - for (i = 0; i < MODULE_COUNT; i++) + for (i = 0; i < ARRAY_SIZE(modules); i++) modules[i]->init(); loop(); diff --git a/payloads/coreinfo/pci_module.c b/payloads/coreinfo/pci_module.c index 5099da2f01..aa853b5988 100644 --- a/payloads/coreinfo/pci_module.c +++ b/payloads/coreinfo/pci_module.c @@ -156,7 +156,7 @@ static int pci_module_redraw(WINDOW *win) else wattrset(win, COLOR_PAIR(2)); - mvwprintw(win, 2 + i, 1, "%X:%2.2X.%2.2X %X:%X ", + mvwprintw(win, 2 + i, 1, "%X:%2.2X.%2.2X %04X:%04X ", bus, devfn, func, devices[item].id & 0xffff, (devices[item].id >> 16) & 0xffff); -- cgit v1.2.3