aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErwan Velu <erwan.velu@free.fr>2009-03-14 16:34:01 +0100
committerErwan Velu <erwan.velu@free.fr>2009-03-14 16:34:01 +0100
commitffa85dba09a2f1c62a3293d6acc3c924e502da6d (patch)
tree48ecacfcf0bc767e2aa26d1f188333672755358d
parent1a9619d092c3bd1e6427716e0600abd89883019b (diff)
downloadsyslinux.git-ffa85dba09a2f1c62a3293d6acc3c924e502da6d.tar.gz
syslinux.git-ffa85dba09a2f1c62a3293d6acc3c924e502da6d.tar.xz
syslinux.git-ffa85dba09a2f1c62a3293d6acc3c924e502da6d.zip
hdt: Adding vesa detection
Bump to version 0.2.4 VESA BIOS is now detected. vendor/product/revision & available modes are displayed cli now have a "vesa>" context with provides both "list" & "modes" command. The menu mode features a new VESA entry and display the same info.
-rw-r--r--com32/hdt/Makefile4
-rw-r--r--com32/hdt/hdt-cli.c18
-rw-r--r--com32/hdt/hdt-cli.h7
-rw-r--r--com32/hdt/hdt-common.c71
-rw-r--r--com32/hdt/hdt-common.h30
-rw-r--r--com32/hdt/hdt-menu.c8
-rw-r--r--com32/hdt/hdt-menu.h6
-rw-r--r--com32/hdt/hdt.h2
8 files changed, 137 insertions, 9 deletions
diff --git a/com32/hdt/Makefile b/com32/hdt/Makefile
index 58715071..17e58b30 100644
--- a/com32/hdt/Makefile
+++ b/com32/hdt/Makefile
@@ -49,8 +49,8 @@ hdt.elf: hdt.o hdt-ata.o hdt-menu.o hdt-menu-pci.o hdt-menu-kernel.o \
hdt-menu-syslinux.o hdt-menu-about.o \
hdt-cli.o hdt-common.o hdt-cli-pci.o hdt-cli-dmi.o \
hdt-cli-cpu.o hdt-cli-pxe.o hdt-cli-kernel.o \
- hdt-cli-syslinux.o \
- hdt-menu-pxe.o hdt-menu-summary.o\
+ hdt-cli-syslinux.o hdt-cli-vesa.o\
+ hdt-menu-pxe.o hdt-menu-summary.o hdt-menu-vesa.o\
$(LIBS)
$(LD) $(LDFLAGS) -o $@ $^
diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c
index 3f714858..ea5dc55e 100644
--- a/com32/hdt/hdt-cli.c
+++ b/com32/hdt/hdt-cli.c
@@ -64,6 +64,11 @@ void set_mode(struct s_cli_mode *cli_mode, cli_mode_t mode, struct s_hardware *h
snprintf(cli_mode->prompt, sizeof(cli_mode->prompt), "%s> ", CLI_SYSLINUX);
break;
+ case VESA_MODE:
+ cli_mode->mode=mode;
+ snprintf(cli_mode->prompt, sizeof(cli_mode->prompt), "%s> ", CLI_VESA);
+ break;
+
case PCI_MODE:
cli_mode->mode=mode;
snprintf(cli_mode->prompt,sizeof(cli_mode->prompt),"%s> ", CLI_PCI);
@@ -158,6 +163,10 @@ void start_cli_mode(struct s_hardware *hardware, int argc, char *argv[]) {
set_mode(&cli_mode,SYSLINUX_MODE,hardware);
continue;
}
+ if ( !strncmp(cli_line, CLI_VESA, sizeof(CLI_VESA) - 1) ) {
+ set_mode(&cli_mode,VESA_MODE,hardware);
+ continue;
+ }
/* All commands before that line are common for all cli modes
* the following will be specific for every mode */
switch(cli_mode.mode) {
@@ -166,6 +175,7 @@ void start_cli_mode(struct s_hardware *hardware, int argc, char *argv[]) {
case HDT_MODE: handle_hdt_commands(cli_line,&cli_mode, hardware); break;
case CPU_MODE: handle_cpu_commands(cli_line,&cli_mode, hardware); break;
case PXE_MODE: handle_pxe_commands(cli_line,&cli_mode, hardware); break;
+ case VESA_MODE: handle_vesa_commands(cli_line,&cli_mode, hardware); break;
case SYSLINUX_MODE: handle_syslinux_commands(cli_line,&cli_mode, hardware); break;
case KERNEL_MODE: handle_kernel_commands(cli_line,&cli_mode, hardware); break;
case EXIT_MODE: break; /* should not happend */
@@ -181,6 +191,7 @@ int do_exit(struct s_cli_mode *cli_mode) {
case SYSLINUX_MODE:
case PCI_MODE:
case DMI_MODE:
+ case VESA_MODE:
case CPU_MODE: return HDT_MODE;
case EXIT_MODE: return EXIT_MODE; /* should not happend */
}
@@ -190,15 +201,16 @@ return HDT_MODE;
void show_cli_help(struct s_cli_mode *cli_mode) {
switch (cli_mode->mode) {
case HDT_MODE:
- printf("Available commands are : %s %s %s %s %s %s %s %s %s %s\n",
+ printf("Available commands are : %s %s %s %s %s %s %s %s %s %s %s\n",
CLI_CLEAR, CLI_EXIT,CLI_HELP,CLI_SHOW, CLI_PCI,
- CLI_DMI, CLI_PXE, CLI_KERNEL, CLI_CPU, CLI_SYSLINUX);
+ CLI_DMI, CLI_PXE, CLI_KERNEL, CLI_CPU, CLI_SYSLINUX, CLI_VESA);
break;
case SYSLINUX_MODE:
case KERNEL_MODE:
case PXE_MODE:
case CPU_MODE:
case PCI_MODE:
+ case VESA_MODE:
case DMI_MODE:
printf("Available commands are : %s %s %s %s\n",
CLI_CLEAR, CLI_EXIT, CLI_HELP, CLI_SHOW);
@@ -238,6 +250,7 @@ void show_main_help(struct s_hardware *hardware) {
more_printf(" %s\n",CLI_CPU);
more_printf(" %s\n",CLI_KERNEL);
more_printf(" %s\n",CLI_SYSLINUX);
+ more_printf(" %s\n",CLI_VESA);
if (hardware->sv->filesystem == SYSLINUX_FS_PXELINUX)
more_printf(" %s\n",CLI_PXE);
}
@@ -250,5 +263,6 @@ void main_show(char *item, struct s_hardware *hardware, struct s_cli_mode *cli_m
if (!strncmp(item,CLI_PXE, sizeof (CLI_PXE))) { main_show_pxe(hardware,cli_mode); return; }
if (!strncmp(item,CLI_SYSLINUX, sizeof (CLI_SYSLINUX))) { main_show_syslinux(hardware,cli_mode); return; }
if (!strncmp(item,CLI_KERNEL, sizeof (CLI_KERNEL))) { main_show_kernel(hardware,cli_mode); return; }
+ if (!strncmp(item,CLI_VESA, sizeof (CLI_VESA))) { main_show_vesa(hardware); return; }
show_main_help(hardware);
}
diff --git a/com32/hdt/hdt-cli.h b/com32/hdt/hdt-cli.h
index b8768e98..7960d119 100644
--- a/com32/hdt/hdt-cli.h
+++ b/com32/hdt/hdt-cli.h
@@ -40,12 +40,14 @@
#define CLI_PXE "pxe"
#define CLI_KERNEL "kernel"
#define CLI_SYSLINUX "syslinux"
+#define CLI_VESA "vesa"
#define CLI_SUMMARY "summary"
#define CLI_COMMANDS "commands"
#define CLI_DMI "dmi"
#define CLI_CPU "cpu"
#define CLI_SHOW_LIST "list"
#define CLI_IRQ "irq"
+#define CLI_MODES "modes"
typedef enum {
EXIT_MODE,
@@ -56,6 +58,7 @@ typedef enum {
PXE_MODE,
KERNEL_MODE,
SYSLINUX_MODE,
+ VESA_MODE,
} cli_mode_t;
struct s_cli_mode {
@@ -114,4 +117,8 @@ void handle_kernel_commands(char *cli_line, struct s_cli_mode *cli_mode, struct
//SYSLINUX STUFF
void main_show_syslinux(struct s_hardware *hardware,struct s_cli_mode *cli_mode);
void handle_syslinux_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware);
+
+//VESA STUFF
+void main_show_vesa(struct s_hardware *hardware);
+void handle_vesa_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware);
#endif
diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c
index 43e6d360..455820a9 100644
--- a/com32/hdt/hdt-common.c
+++ b/com32/hdt/hdt-common.c
@@ -31,6 +31,7 @@
#include <string.h>
#include <stdio.h>
#include "syslinux/config.h"
+#include "../lib/sys/vesa/vesa.h"
void detect_parameters(int argc, char *argv[], struct s_hardware *hardware) {
for (int i = 1; i < argc; i++) {
@@ -57,11 +58,14 @@ void detect_syslinux(struct s_hardware *hardware) {
void init_hardware(struct s_hardware *hardware) {
hardware->pci_ids_return_code=0;
hardware->modules_pcimap_return_code=0;
+
hardware->cpu_detection=false;
hardware->pci_detection=false;
hardware->disk_detection=false;
hardware->dmi_detection=false;
hardware->pxe_detection=false;
+ hardware->vesa_detection=false;
+
hardware->nb_pci_devices=0;
hardware->is_dmi_valid=false;
hardware->is_pxe_valid=false;
@@ -72,9 +76,12 @@ void init_hardware(struct s_hardware *hardware) {
memset(&hardware->dmi,0,sizeof(s_dmi));
memset(&hardware->cpu,0,sizeof(s_cpu));
memset(&hardware->pxe,0,sizeof(struct s_pxe));
+ memset(&hardware->vesa,0,sizeof(struct s_vesa));
memset(hardware->syslinux_fs,0,sizeof hardware->syslinux_fs);
memset(hardware->pciids_path,0,sizeof hardware->pciids_path);
memset(hardware->modules_pcimap_path,0,sizeof hardware->modules_pcimap_path);
+
+ /* Setting default values*/
strcat(hardware->pciids_path,"pci.ids");
strcat(hardware->modules_pcimap_path,"modules.pcimap");
}
@@ -94,6 +101,70 @@ int detect_dmi(struct s_hardware *hardware) {
return 0;
}
+/* Detection vesa stuff*/
+int detect_vesa(struct s_hardware *hardware) {
+ static com32sys_t rm;
+ struct vesa_general_info *gi;
+ struct vesa_mode_info *mi;
+ uint16_t mode, *mode_ptr;
+ char *oem_ptr;
+
+ if (hardware->vesa_detection == true) return -1;
+
+ hardware->vesa_detection=true;
+ hardware->is_vesa_valid=false;
+
+ /* Allocate space in the bounce buffer for these structures */
+ gi = &((struct vesa_info *)__com32.cs_bounce)->gi;
+ mi = &((struct vesa_info *)__com32.cs_bounce)->mi;
+
+ gi->signature = VBE2_MAGIC; /* Get VBE2 extended data */
+ rm.eax.w[0] = 0x4F00; /* Get SVGA general information */
+ rm.edi.w[0] = OFFS(gi);
+ rm.es = SEG(gi);
+ __intcall(0x10, &rm, &rm);
+
+ if ( rm.eax.w[0] != 0x004F ) {
+ return -1;
+ };
+
+ mode_ptr = GET_PTR(gi->video_mode_ptr);
+ oem_ptr = GET_PTR(gi->oem_vendor_name_ptr);
+ strncpy(hardware->vesa.vendor,oem_ptr,sizeof(hardware->vesa.vendor));
+ oem_ptr = GET_PTR(gi->oem_product_name_ptr);
+ strncpy(hardware->vesa.product,oem_ptr,sizeof(hardware->vesa.product));
+ oem_ptr = GET_PTR(gi->oem_product_rev_ptr);
+ strncpy(hardware->vesa.product_revision,oem_ptr,sizeof(hardware->vesa.product_revision));
+
+ hardware->vesa.major_version=(gi->version >> 8) & 0xff;
+ hardware->vesa.minor_version=gi->version & 0xff;
+ hardware->vesa.total_memory=gi->total_memory;
+ hardware->vesa.software_rev=gi->oem_software_rev;
+
+ hardware->vesa.vmi_count=0;
+
+ while ((mode = *mode_ptr++) != 0xFFFF) {
+
+ rm.eax.w[0] = 0x4F01; /* Get SVGA mode information */
+ rm.ecx.w[0] = mode;
+ rm.edi.w[0] = OFFS(mi);
+ rm.es = SEG(mi);
+ __intcall(0x10, &rm, &rm);
+
+ /* Must be a supported mode */
+ if ( rm.eax.w[0] != 0x004f )
+ continue;
+
+ /* Saving detected values*/
+ memcpy(&hardware->vesa.vmi[hardware->vesa.vmi_count].mi,mi, sizeof(struct vesa_mode_info));
+ hardware->vesa.vmi[hardware->vesa.vmi_count].mode=mode;
+
+ hardware->vesa.vmi_count++;
+ }
+ hardware->is_vesa_valid=true;
+ return 0;
+}
+
/* Try to detects disk from port 0x80 to 0xff*/
void detect_disks(struct s_hardware *hardware) {
hardware->disk_detection=true;
diff --git a/com32/hdt/hdt-common.h b/com32/hdt/hdt-common.h
index 1b27b588..0ecd5f40 100644
--- a/com32/hdt/hdt-common.h
+++ b/com32/hdt/hdt-common.h
@@ -34,10 +34,12 @@
#include "dmi/dmi.h"
#include <syslinux/pxe.h>
#include "hdt-ata.h"
+#include "../lib/sys/vesa/vesa.h"
/* This two values are used for switching for the menu to the CLI mode*/
#define HDT_SWITCH_TO_CLI "hdt_switch_to_cli"
#define HDT_RETURN_TO_CLI 100
+#define MAX_VESA_MODES 255
extern int display_line_nb;
@@ -72,7 +74,23 @@ struct s_pxe {
pxe_bootp_t dhcpdata; /* The dhcp answer */
struct pci_device *pci_device; /* The matching pci device */
uint8_t pci_device_pos; /* It position in our pci sorted list*/
+};
+
+struct s_vesa_mode_info {
+ struct vesa_mode_info mi;
+ uint16_t mode;
+};
+struct s_vesa {
+ uint8_t major_version;
+ uint8_t minor_version;
+ struct s_vesa_mode_info vmi[MAX_VESA_MODES];
+ uint8_t vmi_count;
+ uint16_t total_memory;
+ char vendor[256];
+ char product[256];
+ char product_revision[256];
+ uint16_t software_rev;
};
struct s_hardware {
@@ -81,23 +99,26 @@ struct s_hardware {
struct pci_domain *pci_domain; /* PCI Devices */
struct diskinfo disk_info[256]; /* Disk Information*/
struct s_pxe pxe;
+ struct s_vesa vesa;
int pci_ids_return_code;
int modules_pcimap_return_code;
int nb_pci_devices;
bool is_dmi_valid;
bool is_pxe_valid;
+ bool is_vesa_valid;
bool dmi_detection; /* Does the dmi stuff have been already detected */
bool pci_detection; /* Does the pci stuff have been already detected */
bool cpu_detection; /* Does the cpu stuff have been already detected */
bool disk_detection; /* Does the disk stuff have been already detected */
bool pxe_detection; /* Does the pxe stuff have been already detected*/
+ bool vesa_detection;/* Does the vesa sutff have been already detected*/
- char syslinux_fs[22];
- struct syslinux_version *sv;
- char modules_pcimap_path[255];
- char pciids_path[255];
+ char syslinux_fs[22];
+ const struct syslinux_version *sv;
+ char modules_pcimap_path[255];
+ char pciids_path[255];
};
char *find_argument(const char **argv, const char *argument);
@@ -110,4 +131,5 @@ void init_hardware(struct s_hardware *hardware);
void clear_screen(void);
void detect_syslinux(struct s_hardware *hardware);
void detect_parameters(int argc, char *argv[], struct s_hardware *hardware);
+int detect_vesa(struct s_hardware *hardware);
#endif
diff --git a/com32/hdt/hdt-menu.c b/com32/hdt/hdt-menu.c
index 0853f09e..ea67c7d2 100644
--- a/com32/hdt/hdt-menu.c
+++ b/com32/hdt/hdt-menu.c
@@ -145,6 +145,7 @@ void compute_submenus(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware)
#endif
compute_summarymenu(&(hdt_menu->summary_menu),hardware);
compute_syslinuxmenu(&(hdt_menu->syslinux_menu),hardware);
+ compute_VESA(hdt_menu,hardware);
compute_aboutmenu(&(hdt_menu->about_menu));
}
@@ -211,6 +212,11 @@ if (hardware->is_dmi_valid) {
hdt_menu->main_menu.items_count++;
}
+ if (hardware->is_vesa_valid == true) {
+ add_item("<V>ESA","VESA Information Menu",OPT_SUBMENU,NULL,hdt_menu->vesa_menu.menu);
+ hdt_menu->main_menu.items_count++;
+ }
+
add_item("","",OPT_SEP,"",0);
#ifdef WITH_PCI
if (hardware->modules_pcimap_return_code != -ENOMODULESPCIMAP) {
@@ -250,4 +256,6 @@ void detect_hardware(struct s_hardware *hardware) {
detect_pci(hardware);
printf("PCI: %d Devices Found\n",hardware->nb_pci_devices);
#endif
+ printf("VESA: Detecting\n");
+ detect_vesa(hardware);
}
diff --git a/com32/hdt/hdt-menu.h b/com32/hdt/hdt-menu.h
index db94057a..e8417617 100644
--- a/com32/hdt/hdt-menu.h
+++ b/com32/hdt/hdt-menu.h
@@ -72,6 +72,9 @@ struct s_hdt_menu {
struct s_my_menu about_menu;
struct s_my_menu summary_menu;
struct s_my_menu pxe_menu;
+ struct s_my_menu vesa_menu;
+ struct s_my_menu vesa_card_menu;
+ struct s_my_menu vesa_modes_menu;
int total_menu_count; // sum of all menus we have
};
@@ -113,6 +116,9 @@ void compute_summarymenu(struct s_my_menu *menu, struct s_hardware *hardware);
//PXE menu
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);
+
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, struct s_hardware *hardware);
diff --git a/com32/hdt/hdt.h b/com32/hdt/hdt.h
index b8563ab5..8b0a7ef2 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.3"
+#define VERSION "0.2.4"
#define ATTR_PACKED __attribute__((packed))