hdt: Adding IPMI detection
authorErwan Velu <erwan.velu@free.fr>
Sun, 22 Mar 2009 08:24:23 +0000 (09:24 +0100)
committerErwan Velu <erwan.velu@free.fr>
Sun, 22 Mar 2009 08:24:23 +0000 (09:24 +0100)
Impact: HDT can now reports if an IPMI base board exists

By using DMI, it's now possible to detect IPMI base boards
Bump to 0.2.6

com32/hdt/hdt-cli-dmi.c
com32/hdt/hdt-cli.c
com32/hdt/hdt-cli.h
com32/hdt/hdt-menu-dmi.c
com32/hdt/hdt-menu.c
com32/hdt/hdt-menu.h
com32/hdt/hdt.h

index 4ec242d..a7ea872 100644 (file)
@@ -79,6 +79,12 @@ static void show_dmi_modules(int argc, char** argv,
       sizeof(CLI_DMI_SYSTEM) - 1);
     strncat(available_dmi_commands, " ", 1);
   }
+  if (hardware->dmi.ipmi.filled == true) {
+    strncat(available_dmi_commands, CLI_DMI_IPMI,
+      sizeof(CLI_DMI_IPMI) - 1);
+    strncat(available_dmi_commands, " ", 1);
+  }
+
   printf("Available DMI modules: %s\n", available_dmi_commands);
 }
 
@@ -215,6 +221,32 @@ static void show_dmi_chassis(int argc, char** argv,
         hardware->dmi.chassis.nb_power_cords);
 }
 
+static void show_dmi_ipmi(int argc, char** argv,
+                             struct s_hardware *hardware)
+{
+  if (hardware->dmi.ipmi.filled == false) {
+    printf("IPMI module not available\n");
+    return;
+  }
+  clear_screen();
+  more_printf("IPMI\n");
+  more_printf(" Interface Type     : %s\n",
+        hardware->dmi.ipmi.interface_type);
+  more_printf(" Specification Ver. : %u.%u\n",
+       hardware->dmi.ipmi.major_specification_version,
+       hardware->dmi.ipmi.minor_specification_version);
+  more_printf(" I2C Slave Address  : 0x%02x\n",
+       hardware->dmi.ipmi.I2C_slave_address);
+  more_printf(" Nv Storage Address : %u\n",
+        hardware->dmi.ipmi.nv_address);
+  uint32_t high = hardware->dmi.ipmi.base_address >> 32;
+  uint32_t low  = hardware->dmi.ipmi.base_address & 0xFFFF;
+  more_printf(" Base Address       : %08X%08X\n",
+       high,(low & ~1));
+  more_printf(" IRQ                : %d\n",
+        hardware->dmi.ipmi.irq);
+}
+
 static void show_dmi_battery(int argc, char** argv,
                              struct s_hardware *hardware)
 {
@@ -468,6 +500,10 @@ struct commands_module list_dmi_show_modules[] = {
     .exec = show_dmi_system,
   },
   {
+    .name = CLI_DMI_IPMI,
+    .exec = show_dmi_ipmi,
+  },
+  {
     .name = CLI_DMI_LIST,
     .exec = show_dmi_modules,
   },
index adfbf94..9ff6d90 100644 (file)
@@ -625,6 +625,11 @@ static void main_show_summary(struct s_hardware *hardware)
                int argc = 2;
                char *argv[2] = { "0", "0" };
                show_dmi_memory_modules(argc, argv, hardware);
+               if (hardware->dmi.ipmi.filled==true) {
+                       more_printf("IPMI baseboard v%u.%u present\n",
+                         hardware->dmi.ipmi.major_specification_version,
+                         hardware->dmi.ipmi.minor_specification_version);
+               }
        }
        main_show_pci(hardware);
 
index 05fb143..34ff66e 100644 (file)
@@ -113,7 +113,8 @@ int do_exit(struct s_cli *cli);
 #define CLI_DMI_PROCESSOR "cpu"
 #define CLI_DMI_SYSTEM "system"
 #define CLI_DMI_LIST CLI_SHOW_LIST
-#define CLI_DMI_MAX_MODULES 9
+#define CLI_DMI_IPMI "ipmi"
+#define CLI_DMI_MAX_MODULES 10
 void main_show_dmi(struct s_hardware *hardware);
 void handle_dmi_commands(char *cli_line, struct s_hardware *hardware);
 void show_dmi_memory_modules(int argc, char** argv, struct s_hardware *hardware);
index 7919301..78c1c5e 100644 (file)
@@ -386,6 +386,65 @@ void compute_memory(struct s_hdt_menu *menu, s_dmi * dmi)
   add_item("Run Test", "Run Test", OPT_RUN, "memtest", 0);
 }
 
+/* Compute Main IPMI menu */
+void compute_ipmi(struct s_my_menu *menu, s_dmi * dmi)
+{
+  char buffer[SUBMENULEN + 1];
+  char statbuffer[STATLEN + 1];
+  menu->menu = add_menu(" IPMI ", -1);
+  menu->items_count = 0;
+  set_menu_pos(SUBMENU_Y, SUBMENU_X);
+
+  snprintf(buffer, sizeof buffer, "Interface Type  : %s",
+     dmi->ipmi.interface_type);
+  snprintf(statbuffer, sizeof statbuffer, "Interface Type: %s",
+     dmi->ipmi.interface_type);
+  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+  menu->items_count++;
+
+  snprintf(buffer, sizeof buffer, "Spec. Version   : %u.%u",
+      dmi->ipmi.major_specification_version,
+      dmi->ipmi.minor_specification_version);
+  snprintf(statbuffer, sizeof statbuffer, "Specification Version: %u.u",
+      dmi->ipmi.major_specification_version,
+      dmi->ipmi.minor_specification_version);
+  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+  menu->items_count++;
+
+  snprintf(buffer, sizeof buffer, "I2C Slave @     : 0x%02x",
+     dmi->ipmi.I2C_slave_address);
+  snprintf(statbuffer, sizeof statbuffer, "I2C Slave Address: 0x%02x",
+     dmi->ipmi.I2C_slave_address);
+  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+  menu->items_count++;
+
+  snprintf(buffer, sizeof buffer, "NV Storage @    : %u",
+     dmi->ipmi.nv_address);
+  snprintf(statbuffer, sizeof statbuffer, "NV Storage Address: %u",
+     dmi->ipmi.nv_address);
+  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+  menu->items_count++;
+
+  uint32_t high = dmi->ipmi.base_address >> 32;
+  uint32_t low  = dmi->ipmi.base_address & 0xFFFF;
+
+  snprintf(buffer, sizeof buffer, "Base Address    : %08X%08X",
+     high,(low & ~1));
+  snprintf(statbuffer, sizeof statbuffer, "Base Address : %08X%08X",
+     high,(low & ~1));
+  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+  menu->items_count++;
+
+  snprintf(buffer, sizeof buffer, "IRQ             : %d",
+     dmi->ipmi.irq);
+  snprintf(statbuffer, sizeof statbuffer, "IRQ : %d",
+     dmi->ipmi.irq);
+  add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+  menu->items_count++;
+
+  printf("MENU: IPMI menu done (%d items)\n", menu->items_count);
+}
+
 /* Compute Main Battery menu */
 void compute_battery(struct s_my_menu *menu, s_dmi * dmi)
 {
index a0196c2..4f1b42f 100644 (file)
@@ -128,6 +128,8 @@ void compute_submenus(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware)
 
   /* Compute this menu if a DMI table exists */
   if (hardware->is_dmi_valid) {
+    if (hardware->dmi.ipmi.filled == true)
+      compute_ipmi(&hdt_menu->ipmi_menu, &hardware->dmi);
     if (hardware->dmi.base_board.filled == true)
       compute_motherboard(&(hdt_menu->mobo_menu),
               &(hardware->dmi));
@@ -152,6 +154,7 @@ void compute_submenus(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware)
 
   compute_processor(&(hdt_menu->cpu_menu), hardware);
   compute_disks(hdt_menu, hardware->disk_info);
+
 #ifdef WITH_PCI
   compute_PCI(hdt_menu, hardware);
   compute_PXE(&(hdt_menu->pxe_menu), hardware);
@@ -232,6 +235,11 @@ void compute_main_menu(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware)
          hdt_menu->battery_menu.menu);
       hdt_menu->main_menu.items_count++;
     }
+    if (hardware->dmi.ipmi.filled == true) {
+      add_item("I<P>MI", "IPMI Menu", OPT_SUBMENU, NULL,
+         hdt_menu->ipmi_menu.menu);
+      hdt_menu->main_menu.items_count++;
+    }
   }
 
   if (hardware->is_pxe_valid == true) {
index fbb21e2..577072e 100644 (file)
@@ -60,6 +60,7 @@ struct s_hdt_menu {
   struct s_my_menu mobo_menu;
   struct s_my_menu chassis_menu;
   struct s_my_menu bios_menu;
+  struct s_my_menu ipmi_menu;
   struct s_my_menu system_menu;
   struct s_my_menu pci_menu;
   struct s_my_menu pci_sub_menu[MAX_PCI_SUB_MENU];
@@ -100,6 +101,7 @@ void compute_system(struct s_my_menu *menu, s_dmi * dmi);
 void compute_chassis(struct s_my_menu *menu, s_dmi * dmi);
 void compute_bios(struct s_my_menu *menu, s_dmi * dmi);
 void compute_memory(struct s_hdt_menu *menu, s_dmi * dmi);
+void compute_ipmi(struct s_my_menu *menu, s_dmi * dmi);
 
 // Processor Stuff
 void compute_processor(struct s_my_menu *menu, struct s_hardware *hardware);
index a3a5877..6097f6a 100644 (file)
@@ -32,7 +32,7 @@
 #define PRODUCT_NAME "Hardware Detection Tool"
 #define AUTHOR "Erwan Velu"
 #define CONTACT "erwan(dot)velu(point)free(dot)fr"
-#define VERSION "0.2.5"
+#define VERSION "0.2.6"
 #define NB_CONTRIBUTORS 2
 #define CONTRIBUTORS {"Pierre-Alexandre Meyer", "Sebastien Gonzalve"}