From: Erwan Velu Date: Sun, 22 Mar 2009 08:24:23 +0000 (+0100) Subject: hdt: Adding IPMI detection X-Git-Tag: syslinux-3.74-pre12~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4ed6ebda51d4de5cda5fb90334affad8eba66764;p=platform%2Fupstream%2Fsyslinux.git hdt: Adding IPMI detection 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 --- diff --git a/com32/hdt/hdt-cli-dmi.c b/com32/hdt/hdt-cli-dmi.c index 4ec242d..a7ea872 100644 --- a/com32/hdt/hdt-cli-dmi.c +++ b/com32/hdt/hdt-cli-dmi.c @@ -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, }, diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c index adfbf94..9ff6d90 100644 --- a/com32/hdt/hdt-cli.c +++ b/com32/hdt/hdt-cli.c @@ -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); diff --git a/com32/hdt/hdt-cli.h b/com32/hdt/hdt-cli.h index 05fb143..34ff66e 100644 --- a/com32/hdt/hdt-cli.h +++ b/com32/hdt/hdt-cli.h @@ -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); diff --git a/com32/hdt/hdt-menu-dmi.c b/com32/hdt/hdt-menu-dmi.c index 7919301..78c1c5e 100644 --- a/com32/hdt/hdt-menu-dmi.c +++ b/com32/hdt/hdt-menu-dmi.c @@ -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) { diff --git a/com32/hdt/hdt-menu.c b/com32/hdt/hdt-menu.c index a0196c2..4f1b42f 100644 --- a/com32/hdt/hdt-menu.c +++ b/com32/hdt/hdt-menu.c @@ -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

MI", "IPMI Menu", OPT_SUBMENU, NULL, + hdt_menu->ipmi_menu.menu); + hdt_menu->main_menu.items_count++; + } } if (hardware->is_pxe_valid == true) { diff --git a/com32/hdt/hdt-menu.h b/com32/hdt/hdt-menu.h index fbb21e2..577072e 100644 --- a/com32/hdt/hdt-menu.h +++ b/com32/hdt/hdt-menu.h @@ -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); diff --git a/com32/hdt/hdt.h b/com32/hdt/hdt.h index a3a5877..6097f6a 100644 --- a/com32/hdt/hdt.h +++ b/com32/hdt/hdt.h @@ -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"}