port_enable and port_reset must change atomically.
[coreboot.git] / payloads / coreinfo / coreinfo.c
index d158b29f8e99709128f2abff506bbd2f2f531b38..846cf77c1852aca008fbc69024b7b2eac8a3369a 100644 (file)
 extern struct coreinfo_module cpuinfo_module;
 extern struct coreinfo_module pci_module;
 extern struct coreinfo_module coreboot_module;
+extern struct coreinfo_module multiboot_module;
 extern struct coreinfo_module nvram_module;
 extern struct coreinfo_module bootlog_module;
 extern struct coreinfo_module ramdump_module;
 extern struct coreinfo_module lar_module;
+extern struct coreinfo_module cbfs_module;
 
 struct coreinfo_module *system_modules[] = {
 #ifdef CONFIG_MODULE_CPUINFO
@@ -47,15 +49,21 @@ struct coreinfo_module *system_modules[] = {
 #endif
 };
 
-struct coreinfo_module *coreboot_modules[] = {
+struct coreinfo_module *firmware_modules[] = {
 #ifdef CONFIG_MODULE_COREBOOT
        &coreboot_module,
 #endif
+#ifdef CONFIG_MODULE_MULTIBOOT
+       &multiboot_module,
+#endif
 #ifdef CONFIG_MODULE_BOOTLOG
        &bootlog_module,
 #endif
 #ifdef CONFIG_MODULE_LAR
-       &lar_module
+       &lar_module,
+#endif
+#ifdef CONFIG_MODULE_CBFS
+       &cbfs_module,
 #endif
 };
 
@@ -71,15 +79,13 @@ struct coreinfo_cat {
                .count = ARRAY_SIZE(system_modules),
        },
        {
-               .name = "Coreboot",
-               .modules = coreboot_modules,
-               .count = ARRAY_SIZE(coreboot_modules),
+               .name = "Firmware",
+               .modules = firmware_modules,
+               .count = ARRAY_SIZE(firmware_modules),
        }
 };
 
-static WINDOW *modwin;
-static WINDOW *menuwin;
-
+static WINDOW *modwin, *menuwin;
 static int curwin;
 
 void print_module_title(WINDOW *win, const char *title)
@@ -90,9 +96,8 @@ void print_module_title(WINDOW *win, const char *title)
        mvwprintw(win, 0, 1, title);
 
        wmove(win, 1, 1);
-
        for (i = 0; i < 78; i++)
-               waddch(win, '\304');
+               waddch(win, ACS_HLINE);
 }
 
 static void print_submenu(struct coreinfo_cat *cat)
@@ -110,7 +115,8 @@ static void print_submenu(struct coreinfo_cat *cat)
                return;
 
        for (i = 0; i < cat->count; i++)
-               ptr += sprintf(ptr, "[%c: %s] ", 'A' + i, cat->modules[i]->name);
+               ptr += sprintf(ptr, "[%c: %s] ", 'A' + i,
+                              cat->modules[i]->name);
 
        mvwprintw(menuwin, 0, 0, menu);
 }
@@ -126,7 +132,7 @@ static void print_time_and_date(void)
        rtc_read_clock(&tm);
 
        mvwprintw(menuwin, 0, 57, "%02d/%02d/%04d - %02d:%02d:%02d",
-                 tm.tm_mon, tm.tm_mday, 1900+tm.tm_year, tm.tm_hour,
+                 tm.tm_mon, tm.tm_mday, 1900 + tm.tm_year, tm.tm_hour,
                  tm.tm_min, tm.tm_sec);
 }
 #endif
@@ -138,7 +144,6 @@ static void print_menu(void)
        char *ptr = menu;
 
        wmove(menuwin, 1, 0);
-
        for (j = 0; j < SCREEN_X; j++)
                waddch(menuwin, ' ');
 
@@ -158,11 +163,9 @@ static void print_menu(void)
 
 static void center(int row, const char *str)
 {
-       int len = strlen(str);
-       int j;
+       int j, len = strlen(str);
 
        wmove(stdscr, row, 0);
-
        for (j = 0; j < SCREEN_X; j++)
                waddch(stdscr, ' ');
 
@@ -281,19 +284,11 @@ int main(void)
        wattrset(modwin, COLOR_PAIR(2));
        wattrset(menuwin, COLOR_PAIR(1) | A_BOLD);
 
-       for (i = 0; i < SCREEN_Y - 1; i++) {
-               wmove(modwin, i - 1, 0);
-
-               for (j = 0; j < SCREEN_X; j++)
-                       waddch(modwin, ' ');
-       }
-
-       wrefresh(modwin);
+       werase(modwin);
 
        for (i = 0; i < ARRAY_SIZE(categories); i++) {
                for (j = 0; j < categories[i].count; j++)
                        categories[i].modules[j]->init();
-
        }
 
        loop();