return (sum==0);
}
-int dmi_iterate() {
+int dmi_iterate(s_dmi *dmi) {
u8 buf[16];
char *p,*q;
p=(char *)0xF0000; /* The start address to look at the dmi table */
for (q = p; q < p + 0x10000; q += 16) {
memcpy(buf, q, 15);
if(memcmp(buf, "_DMI_", 5)==0 && dmi_checksum(buf)) {
- dmitable.num = buf[13]<<8|buf[12];
- dmitable.len = buf[7]<<8|buf[6];
- dmitable.base = buf[11]<<24|buf[10]<<16|buf[9]<<8|buf[8];
- dmitable.ver = (buf[0x06]<<8)+buf[0x07];
+ dmi->dmitable.num = buf[13]<<8|buf[12];
+ dmi->dmitable.len = buf[7]<<8|buf[6];
+ dmi->dmitable.base = buf[11]<<24|buf[10]<<16|buf[9]<<8|buf[8];
+ dmi->dmitable.ver = (buf[0x06]<<8)+buf[0x07];
/*
* DMI version 0.0 means that the real version is taken from
* the SMBIOS version, which we don't know at this point.
*/
- if(buf[14]!=0)
- printf("DMI %d.%d present.\n",buf[14]>>4, buf[14]&0x0F);
- else
- printf("DMI present.\n");
+ if(buf[14]!=0) {
+ dmi->dmitable.major_version=buf[14]>>4;
+ dmi->dmitable.minor_version=buf[14]&0x0F;
+ }
+ else {
+ dmi->dmitable.major_version=0;
+ dmi->dmitable.minor_version=0;
+
+ }
+/* printf("DMI present (version %d.%d)\n", dmitable.major_version,dmitable.minor_version);
printf("%d structures occupying %d bytes.\n",dmitable.num, dmitable.len);
- printf("DMI table at 0x%08X.\n",dmitable.base);
- return 1;
+ printf("DMI table at 0x%08X.\n",dmitable.base);*/
+ return DMI_TABLE_PRESENT;
}
}
- dmitable.base=0;
- dmitable.num=0;
- dmitable.ver=0;
- dmitable.len=0;
- return 0;
+ dmi->dmitable.base=0;
+ dmi->dmitable.num=0;
+ dmi->dmitable.ver=0;
+ dmi->dmitable.len=0;
+ return -ENODMITABLE;
}
void dmi_decode(struct dmi_header *h, u16 ver, s_dmi *dmi)
void parse_dmitable(s_dmi *dmi) {
int i=0;
u8 *data = NULL;
- u8 buf[dmitable.len];
+ u8 buf[dmi->dmitable.len];
- memcpy(buf,(int *)dmitable.base,sizeof(u8) * dmitable.len);
+ memcpy(buf,(int *)dmi->dmitable.base,sizeof(u8) * dmi->dmitable.len);
data=buf;
dmi->memory_count=0;
- while(i<dmitable.num && data+4<=buf+dmitable.len) /* 4 is the length of an SMBIOS structure header */ {
+ while(i<dmi->dmitable.num && data+4<=buf+dmi->dmitable.len) /* 4 is the length of an SMBIOS structure header */ {
u8 *next;
struct dmi_header h;
to_dmi_header(&h, data);
/* loo for the next handle */
next=data+h.length;
- while(next-buf+1<dmitable.len && (next[0]!=0 || next[1]!=0))
+ while(next-buf+1<dmi->dmitable.len && (next[0]!=0 || next[1]!=0))
next++;
next+=2;
- if(next-buf<=dmitable.len)
+ if(next-buf<=dmi->dmitable.len)
{
- dmi_decode(&h, dmitable.ver,dmi);
+ dmi_decode(&h, dmi->dmitable.ver,dmi);
}
data=next;
i++;
#define WITH_PCI 1
#define WITH_MENU_DISPLAY 1
+#define SUBMENU_Y 3
+#define SUBMENU_X 29
+
unsigned char MAIN_MENU, CPU_MENU, MOBO_MENU, CHASSIS_MENU, BIOS_MENU, SYSTEM_MENU, PCI_MENU, KERNEL_MENU;
unsigned char MEMORY_MENU, MEMORY_SUBMENU[32], DISK_MENU, DISK_SUBMENU[32], PCI_SUBMENU[128],BATTERY_MENU;
unsigned char SYSLINUX_MENU, ABOUT_MENU;
/* Detecting if a DMI table exist
* if yes, let's parse it */
int detect_dmi(s_dmi *dmi) {
- if ( ! dmi_iterate() ) {
+ if (dmi_iterate(dmi) == -ENODMITABLE ) {
printf("No DMI Structure found\n");
- return -1;
+ return -ENODMITABLE;
}
parse_dmitable(dmi);
*menu = add_menu(" Details ",-1);
menu_count++;
- set_menu_pos(7,17);
+ set_menu_pos(5,17);
snprintf(buffer,sizeof buffer,"Vendor : %s",pci_device->dev_info->vendor_name);
snprintf(statbuffer,sizeof statbuffer,"Vendor Name: %s",pci_device->dev_info->vendor_name);
char buffer[SUBMENULEN+1];
char infobar[STATLEN+1];
char kernel_modules [LINUX_KERNEL_MODULE_SIZE*MAX_KERNEL_MODULES_PER_PCI_DEVICE];
+ struct pci_device *pci_device;
*menu = add_menu(" Kernel Modules ",-1);
menu_count++;
printf("MENU: Computing Kernel menu\n");
- set_menu_pos(4,29);
- struct pci_device *pci_device;
+ set_menu_pos(SUBMENU_Y,SUBMENU_X);
if (modules_pcimap == -ENOMODULESPCIMAP) {
add_item("The modules.pcimap file is missing","Missing modules.pcimap file",OPT_INACTIVE,NULL,0);
*menu = add_menu(" Battery ",-1);
menu_count++;
printf("MENU: Computing Battery menu\n");
- set_menu_pos(4,29);
+ set_menu_pos(SUBMENU_Y,SUBMENU_X);
+
snprintf(buffer, sizeof buffer,"Vendor : %s",dmi->battery.manufacturer);
snprintf(statbuffer, sizeof statbuffer,"Vendor: %s",dmi->battery.manufacturer);
add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
printf("MENU: Computing motherboard menu\n");
*menu = add_menu(" Motherboard ",-1);
menu_count++;
- set_menu_pos(4,29);
+ set_menu_pos(SUBMENU_Y,SUBMENU_X);
snprintf(buffer,sizeof buffer,"Vendor : %s",dmi->base_board.manufacturer);
snprintf(statbuffer,sizeof statbuffer,"Vendor: %s",dmi->base_board.manufacturer);
printf("MENU: Computing system menu\n");
*menu = add_menu(" System ",-1);
menu_count++;
- set_menu_pos(4,29);
+ set_menu_pos(SUBMENU_Y,SUBMENU_X);
snprintf(buffer,sizeof buffer,"Vendor : %s",dmi->system.manufacturer);
snprintf(statbuffer,sizeof statbuffer,"Vendor: %s",dmi->system.manufacturer);
printf("MENU: Computing chassis menu\n");
*menu = add_menu(" Chassis ",-1);
menu_count++;
- set_menu_pos(4,29);
+ set_menu_pos(SUBMENU_Y,SUBMENU_X);
+
snprintf(buffer,sizeof buffer,"Vendor : %s",dmi->chassis.manufacturer);
snprintf(statbuffer,sizeof statbuffer,"Vendor: %s",dmi->chassis.manufacturer);
add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
*menu = add_menu(" BIOS ",-1);
menu_count++;
printf("MENU: Computing BIOS menu\n");
- set_menu_pos(4,29);
+ set_menu_pos(SUBMENU_Y,SUBMENU_X);
snprintf(buffer,sizeof buffer,"Vendor : %s",dmi->bios.vendor);
snprintf(statbuffer,sizeof statbuffer,"Vendor: %s",dmi->bios.vendor);
printf("MENU: Computing Processor menu\n");
*menu = add_menu(" Main Processor ",-1);
menu_count++;
+ set_menu_pos(SUBMENU_Y,SUBMENU_X);
snprintf(buffer,sizeof buffer,"Vendor : %s",cpu->vendor);
snprintf(statbuffer,sizeof statbuffer,"Vendor: %s",cpu->vendor);
detect_disks(disk_info);
printf("DMI: Detecting Table\n");
- if (detect_dmi(dmi) == 0)
+ if (detect_dmi(dmi) ==0 )
is_dmi_valid=true;
+ printf("DMI: Table found ! (version %d.%d)\n",dmi->dmitable.major_version,dmi->dmitable.minor_version);
+
#ifdef WITH_PCI
printf("PCI: Detecting Devices\n");
/* Scanning to detect pci buses and devices */
*menu = add_menu(" About ",-1);
menu_count++;
- set_menu_pos(4,29);
+ set_menu_pos(SUBMENU_Y,SUBMENU_X);
+
+ printf("MENU: About Syslinux menu\n");
snprintf(buffer, sizeof buffer, "Product : %s", PRODUCT_NAME);
snprintf(statbuffer, sizeof statbuffer, "Product : %s", PRODUCT_NAME);
char buffer[SUBMENULEN+1];
char statbuffer[STATLEN+1];
const struct syslinux_version *sv;
+
+ printf("MENU: Computing Syslinux menu\n");
+
memset(syslinux_fs,0,sizeof syslinux_fs);
memset(syslinux_fs_menu,0,sizeof syslinux_fs_menu);
snprintf(syslinux_fs_menu,sizeof syslinux_fs_menu," %s ",syslinux_fs);
*menu = add_menu(syslinux_fs_menu,-1);
menu_count++;
- set_menu_pos(4,29);
+ set_menu_pos(SUBMENU_Y,SUBMENU_X);
snprintf(buffer, sizeof buffer, "Bootloader : %s", syslinux_fs);
snprintf(statbuffer, sizeof statbuffer, "Bootloader: %s", syslinux_fs);
snprintf(statbuffer, sizeof statbuffer, "Max API: %u",sv->max_api);
add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
- snprintf(buffer, sizeof buffer, "Copyright :%s", sv->copyright_string);
- snprintf(statbuffer, sizeof statbuffer, "Copyright:%s", sv->copyright_string);
- add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
+ add_item("","",OPT_SEP,"",0);
+ snprintf(buffer, sizeof buffer, "%s", sv->copyright_string+1);
+ snprintf(statbuffer, sizeof statbuffer, "%s", sv->copyright_string+1);
+ add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
}
/* Compute Main' Submenus*/
set_item_options(-1,24);
#ifdef WITH_PCI
- add_item("PCI <D>evices","PCI Devices",OPT_SUBMENU,NULL,PCI_MENU);
+ add_item("PCI <D>evices","PCI Devices Menu",OPT_SUBMENU,NULL,PCI_MENU);
#endif
if (nb_sub_disk_menu>0)
- add_item("<D>isks","Disks",OPT_SUBMENU,NULL,DISK_MENU);
- add_item("<M>emory Modules","Memory Modules",OPT_SUBMENU,NULL,MEMORY_MENU);
- add_item("<P>rocessor","Main Processor",OPT_SUBMENU,NULL,CPU_MENU);
+ add_item("<D>isks","Disks Menu",OPT_SUBMENU,NULL,DISK_MENU);
+ add_item("<M>emory Modules","Memory Modules Menu",OPT_SUBMENU,NULL,MEMORY_MENU);
+ add_item("<P>rocessor","Main Processor Menu",OPT_SUBMENU,NULL,CPU_MENU);
if (is_dmi_valid) {
- add_item("<M>otherboard","Motherboard",OPT_SUBMENU,NULL,MOBO_MENU);
- add_item("<B>ios","Bios",OPT_SUBMENU,NULL,BIOS_MENU);
- add_item("<C>hassis","Chassis",OPT_SUBMENU,NULL,CHASSIS_MENU);
- add_item("<S>ystem","System",OPT_SUBMENU,NULL,SYSTEM_MENU);
- add_item("Ba<t>tery","Battery",OPT_SUBMENU,NULL,BATTERY_MENU);
+ add_item("M<o>therboard","Motherboard Menu",OPT_SUBMENU,NULL,MOBO_MENU);
+ add_item("<B>ios","Bios Menu",OPT_SUBMENU,NULL,BIOS_MENU);
+ add_item("<C>hassis","Chassis Menu",OPT_SUBMENU,NULL,CHASSIS_MENU);
+ add_item("<S>ystem","System Menu",OPT_SUBMENU,NULL,SYSTEM_MENU);
+ add_item("Ba<t>tery","Battery Menu",OPT_SUBMENU,NULL,BATTERY_MENU);
}
add_item("","",OPT_SEP,"",0);
#ifdef WITH_PCI
- add_item("<K>ernel Modules","Kernel Modules",OPT_SUBMENU,NULL,KERNEL_MENU);
+ add_item("<K>ernel Modules","Kernel Modules Menu",OPT_SUBMENU,NULL,KERNEL_MENU);
#endif
- add_item("<S>yslinux","Syslinux Information",OPT_SUBMENU,NULL,SYSLINUX_MENU);
+ add_item("<S>yslinux","Syslinux Information Menu",OPT_SUBMENU,NULL,SYSLINUX_MENU);
add_item("<A>bout","About Menu",OPT_SUBMENU,NULL,ABOUT_MENU);
}