Move out some hardcoded strings in coreinfo to become Kconfig variables.
[coreboot.git] / payloads / coreinfo / coreinfo.c
index f7e8d88149ed71c15fbae71ff5436fd79e8a4de1..d158b29f8e99709128f2abff506bbd2f2f531b38 100644 (file)
 #define SCREEN_Y 25
 #define SCREEN_X 80
 
+#define KEY_ESC 27
+
 extern struct coreinfo_module cpuinfo_module;
 extern struct coreinfo_module pci_module;
 extern struct coreinfo_module coreboot_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;
 
 struct coreinfo_module *system_modules[] = {
@@ -39,6 +42,9 @@ struct coreinfo_module *system_modules[] = {
 #ifdef CONFIG_MODULE_NVRAM
        &nvram_module,
 #endif
+#ifdef CONFIG_MODULE_RAMDUMP
+       &ramdump_module,
+#endif
 };
 
 struct coreinfo_module *coreboot_modules[] = {
@@ -71,7 +77,6 @@ struct coreinfo_cat {
        }
 };
 
-
 static WINDOW *modwin;
 static WINDOW *menuwin;
 
@@ -115,14 +120,14 @@ static void print_time_and_date(void)
 {
        struct tm tm;
 
-       while(nvram_updating())
+       while (nvram_updating())
                mdelay(10);
 
        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_min, tm.tm_sec);
+                 tm.tm_mon, tm.tm_mday, 1900+tm.tm_year, tm.tm_hour,
+                 tm.tm_min, tm.tm_sec);
 }
 #endif
 
@@ -178,8 +183,6 @@ static void header(int row, const char *str)
 
        ptr += sprintf(ptr, "[ %s ]", str);
 
-
-
        for (i = ((SCREEN_X - len) / 2) + len; i < SCREEN_X; i++)
                ptr += sprintf(ptr, "=");
 
@@ -201,10 +204,8 @@ static void handle_category_key(struct coreinfo_cat *cat, int key)
 {
        if (key >= 'a' && key <= 'z') {
                int index = key - 'a';
-
                if (index < cat->count) {
-
-               cat->cur = index;
+                       cat->cur = index;
                        redraw_module(cat);
                        return;
                }
@@ -220,7 +221,7 @@ static void loop(void)
 {
        int key;
 
-       center(0, "coreinfo v0.1");
+       center(0, CONFIG_PAYLOAD_INFO_NAME " " CONFIG_PAYLOAD_INFO_VERSION);
        refresh();
 
        print_menu();
@@ -256,6 +257,8 @@ static void loop(void)
                        }
                }
 
+               if (key == KEY_ESC)
+                       return;
 
                handle_category_key(&categories[curwin], key);
        }
@@ -265,9 +268,6 @@ int main(void)
 {
        int i, j;
 
-       curses_enable_serial(0);
-       curses_enable_vga(1);
-
        initscr();
 
        init_pair(1, COLOR_WHITE, COLOR_GREEN);
@@ -291,7 +291,7 @@ int main(void)
        wrefresh(modwin);
 
        for (i = 0; i < ARRAY_SIZE(categories); i++) {
-               for(j = 0; j < categories[i].count; j++)
+               for (j = 0; j < categories[i].count; j++)
                        categories[i].modules[j]->init();
 
        }
@@ -300,3 +300,7 @@ int main(void)
 
        return 0;
 }
+
+PAYLOAD_INFO(name, CONFIG_PAYLOAD_INFO_NAME);
+PAYLOAD_INFO(listname, CONFIG_PAYLOAD_INFO_LISTNAME);
+PAYLOAD_INFO(desc, CONFIG_PAYLOAD_INFO_DESC);