[syslinux:master] hdt: Adding ACPI to menu mode

syslinux-bot for Erwan Velu erwanaliasr1 at gmail.com
Sun Feb 6 14:07:39 PST 2011


Commit-ID:  e0ebfa7ee90b2dfea40ddf297f47cbb0f2199a0a
Gitweb:     http://syslinux.zytor.com/commit/e0ebfa7ee90b2dfea40ddf297f47cbb0f2199a0a
Author:     Erwan Velu <erwanaliasr1 at gmail.com>
AuthorDate: Wed, 26 Jan 2011 23:41:01 +0100
Committer:  Erwan Velu <erwanaliasr1 at gmail.com>
CommitDate: Wed, 26 Jan 2011 23:41:01 +0100

hdt: Adding ACPI to menu mode

Preliminary support of the ACPI info in the menu mode.


---
 com32/hdt/hdt-menu-acpi.c |  111 +++++++++++++++++++++++++++++++++++++++++++++
 com32/hdt/hdt-menu.c      |    7 +++
 com32/hdt/hdt-menu.h      |    6 +++
 3 files changed, 124 insertions(+), 0 deletions(-)

diff --git a/com32/hdt/hdt-menu-acpi.c b/com32/hdt/hdt-menu-acpi.c
new file mode 100644
index 0000000..d4fa6aa
--- /dev/null
+++ b/com32/hdt/hdt-menu-acpi.c
@@ -0,0 +1,111 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 2009 Erwan Velu - All Rights Reserved
+ *
+ *   Permission is hereby granted, free of charge, to any person
+ *   obtaining a copy of this software and associated documentation
+ *   files (the "Software"), to deal in the Software without
+ *   restriction, including without limitation the rights to use,
+ *   copy, modify, merge, publish, distribute, sublicense, and/or
+ *   sell copies of the Software, and to permit persons to whom
+ *   the Software is furnished to do so, subject to the following
+ *   conditions:
+ *
+ *   The above copyright notice and this permission notice shall
+ *   be included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *   OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * -----------------------------------------------------------------------
+*/
+
+#include "hdt-menu.h"
+
+void compute_table(struct s_my_menu *menu, void *address, s_acpi_description_header * h) {
+    char buffer[SUBMENULEN + 1] = { 0 };
+    char statbuffer[STATLEN + 1] = { 0 };
+
+    snprintf(buffer, sizeof buffer, "%-4s v%03x %-6s %-7s %-7s %08x", 
+		    h->signature, h->revision, h->oem_id, h->oem_table_id, h->creator_id, h->creator_revision);
+    snprintf(statbuffer, sizeof statbuffer, "%-4s v%03x %-6s %-7s 0x%08x %-4s    0x%08x @ 0x%p", 
+		    h->signature, h->revision, h->oem_id, h->oem_table_id,
+		    h->oem_revision, h->creator_id, h->creator_revision, address);
+    add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+    menu->items_count++;
+
+}
+
+/* Submenu for the vesa card */
+static void compute_acpi_tables(struct s_my_menu *menu,
+			      struct s_hardware *hardware)
+{
+    menu->menu = add_menu(" ACPI Tables ", -1);
+    menu->items_count = 0;
+    set_menu_pos(SUBMENU_Y, SUBMENU_X);
+
+    char buffer[SUBMENULEN + 1] = { 0 };
+
+    snprintf(buffer, sizeof buffer, "%-4s %-4s %-6s %-7s %-7s %-8s", 
+		    "ACPI", "rev", "oem", "table_id", "creator", "creator_rev");
+    add_item(buffer, "Description", OPT_INACTIVE, NULL, 0);
+    menu->items_count++;
+
+    add_item("", "", OPT_SEP, "", 0);
+
+    if (hardware->acpi.rsdt.valid)
+        compute_table(menu,hardware->acpi.rsdt.address,
+                       &hardware->acpi.rsdt.header);
+
+    if (hardware->acpi.xsdt.valid)
+        compute_table(menu,hardware->acpi.xsdt.address,
+                       &hardware->acpi.xsdt.header);
+
+    if (hardware->acpi.fadt.valid)
+        compute_table(menu,hardware->acpi.fadt.address, &hardware->acpi.fadt.header);
+
+    if (hardware->acpi.dsdt.valid)
+        compute_table(menu,hardware->acpi.dsdt.address, &hardware->acpi.dsdt.header);
+
+    /* SSDT includes many optional tables, let's display them */
+    for (int i = 0; i < hardware->acpi.ssdt_count; i++) {
+        if ((hardware->acpi.ssdt[i] != NULL) && (hardware->acpi.ssdt[i]->valid))
+            compute_table(menu,hardware->acpi.ssdt[i]->address,
+                        &hardware->acpi.ssdt[i]->header);
+    }
+
+    if (hardware->acpi.sbst.valid)
+        compute_table(menu,hardware->acpi.sbst.address, &hardware->acpi.sbst.header);
+
+    if (hardware->acpi.ecdt.valid)
+        compute_table(menu,hardware->acpi.ecdt.address, &hardware->acpi.ecdt.header);
+
+    /* FACS isn't having the same headers, let's use a dedicated rendering */
+    if (hardware->acpi.facs.valid) {
+    }
+
+    if (hardware->acpi.madt.valid)
+        compute_table(menu,hardware->acpi.madt.address, &hardware->acpi.madt.header);
+
+}
+
+/* Main ACPI Menu*/
+int compute_ACPI(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware)
+{
+    compute_acpi_tables(&hdt_menu->acpi_tables_menu, hardware);
+    hdt_menu->acpi_menu.menu = add_menu(" ACPI ", -1);
+    hdt_menu->acpi_menu.items_count = 0;
+
+    add_item("Tables", "Tables", OPT_SUBMENU, NULL,
+	     hdt_menu->acpi_tables_menu.menu);
+    hdt_menu->acpi_menu.items_count++;
+    printf("MENU: ACPI menu done (%d items)\n",
+	   hdt_menu->acpi_menu.items_count);
+    return 0;
+}
diff --git a/com32/hdt/hdt-menu.c b/com32/hdt/hdt-menu.c
index 0fc6fb1..0fdee03 100644
--- a/com32/hdt/hdt-menu.c
+++ b/com32/hdt/hdt-menu.c
@@ -168,6 +168,7 @@ void compute_submenus(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware)
     compute_summarymenu(&(hdt_menu->summary_menu), hardware);
     compute_syslinuxmenu(&(hdt_menu->syslinux_menu), hardware);
     compute_VESA(hdt_menu, hardware);
+    compute_ACPI(hdt_menu, hardware);
     compute_aboutmenu(&(hdt_menu->about_menu));
 }
 
@@ -262,6 +263,12 @@ void compute_main_menu(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware)
 	hdt_menu->main_menu.items_count++;
     }
 
+    if (hardware->is_acpi_valid == true) {
+	add_item("<A>CPI", "ACPI Menu", OPT_SUBMENU, NULL,
+		 hdt_menu->acpi_menu.menu);
+	hdt_menu->main_menu.items_count++;
+    }
+
     add_item("", "", OPT_SEP, "", 0);
     
     if ((hardware->modules_pcimap_return_code != -ENOMODULESPCIMAP) ||
diff --git a/com32/hdt/hdt-menu.h b/com32/hdt/hdt-menu.h
index 263b5b9..52203d9 100644
--- a/com32/hdt/hdt-menu.h
+++ b/com32/hdt/hdt-menu.h
@@ -79,6 +79,9 @@ struct s_hdt_menu {
     struct s_my_menu vesa_card_menu;
     struct s_my_menu vesa_modes_menu;
     struct s_my_menu vpd_menu;
+    struct s_my_menu acpi_menu;
+    struct s_my_menu acpi_apic_menu;
+    struct s_my_menu acpi_tables_menu;
     int total_menu_count;	// Sum of all menus we have
 };
 
@@ -126,6 +129,9 @@ void compute_PXE(struct s_my_menu *menu, struct s_hardware *hardware);
 //VESA menu
 int compute_VESA(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware);
 
+// ACPI menu
+int compute_ACPI(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware);
+
 int start_menu_mode(struct s_hardware *hardware, char *version_string);
 void setup_menu(char *version);
 void compute_main_menu(struct s_hdt_menu *hdt_menu,



More information about the Syslinux-commits mailing list