summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwan Velu <erwan.velu@free.fr>2009-02-25 13:58:23 +0100
committerH. Peter Anvin <hpa@zytor.com>2009-02-25 20:58:45 -0800
commite210e0a9fa67018e67233eba190537002a53b922 (patch)
treee02ec3539a465567b61108f2476ed6a83ec2fa65
parentffe6183ba3077a1004dfc2ecb43626bc9280b1e0 (diff)
downloadsyslinux-e210e0a9fa67018e67233eba190537002a53b922.tar.gz
hdt: Renaming cli-net to cli-pxe Moving hardware initialisation test directly in detect_* functions Adding basic PXE ROM detection Reworking output of show <module> for more coherency Creating a s_pxe structure to simplify data access 'show pci' command have to be more simple Implementing 'show summary' command detect_pci will try to detect the pxe environment to fill the PXE fields of every pci device Bump to 0.2.0
-rw-r--r--com32/hdt/Makefile2
-rw-r--r--com32/hdt/hdt-cli-cpu.c22
-rw-r--r--com32/hdt/hdt-cli-dmi.c13
-rw-r--r--com32/hdt/hdt-cli-pci.c68
-rw-r--r--com32/hdt/hdt-cli-pxe.c (renamed from com32/hdt/hdt-cli-net.c)42
-rw-r--r--com32/hdt/hdt-cli.c28
-rw-r--r--com32/hdt/hdt-cli.h11
-rw-r--r--com32/hdt/hdt-common.c70
-rw-r--r--com32/hdt/hdt-common.h20
-rw-r--r--com32/hdt/hdt.h2
10 files changed, 163 insertions, 115 deletions
diff --git a/com32/hdt/Makefile b/com32/hdt/Makefile
index d637f5dc..81dc0060 100644
--- a/com32/hdt/Makefile
+++ b/com32/hdt/Makefile
@@ -43,7 +43,7 @@ all: hdt.c32 $(LIB)
hdt.elf: hdt.o hdt-ata.o hdt-menu.o hdt-menu-pci.o hdt-menu-kernel.o \
hdt-menu-disk.o hdt-menu-dmi.o hdt-menu-processor.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-net.o\
+ hdt-cli.o hdt-common.o hdt-cli-pci.o hdt-cli-dmi.o hdt-cli-cpu.o hdt-cli-pxe.o\
$(com32)/modules/cpuid.o $(com32)/modules/dmi.o $(topdir)/menu/libmenu/libmenu.a $(LIB) $(C_LIBS)
$(LD) $(LDFLAGS) -o $@ $^
diff --git a/com32/hdt/hdt-cli-cpu.c b/com32/hdt/hdt-cli-cpu.c
index eb86bb57..0bed1cc8 100644
--- a/com32/hdt/hdt-cli-cpu.c
+++ b/com32/hdt/hdt-cli-cpu.c
@@ -125,21 +125,19 @@ void handle_cpu_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_h
}
void main_show_cpu(struct s_hardware *hardware,struct s_cli_mode *cli_mode) {
- if (hardware->cpu_detection==false) {
- cpu_detect(hardware);
- }
- if (hardware->dmi_detection==false) {
- detect_dmi(hardware);
- }
-
- if ((hardware->cpu.flags.lm == false) && (hardware->cpu.flags.smp==false)) {
- more_printf("CPU: %s %s @ %d MhZ : x86 32bits\n", hardware->cpu.vendor, hardware->cpu.model, hardware->dmi.processor.current_speed);
+ cpu_detect(hardware);
+ detect_dmi(hardware);
+ more_printf("CPU\n");
+ more_printf(" Manufacturer : %s \n", hardware->cpu.vendor);
+ more_printf(" Product : %s \n", hardware->cpu.model);
+ if ((hardware->cpu.flags.lm == false) && (hardware->cpu.flags.smp==false)) {
+ more_printf(" Features : %d MhZ : x86 32bits\n", hardware->dmi.processor.current_speed);
} else if ((hardware->cpu.flags.lm == false) && (hardware->cpu.flags.smp==true)) {
- more_printf("CPU: %s %s @ %d MhZ : X86 32bits SMP\n", hardware->cpu.vendor, hardware->cpu.model, hardware->dmi.processor.current_speed);
+ more_printf(" Features : %d MhZ : x86 32bits SMP\n", hardware->dmi.processor.current_speed);
} else if ((hardware->cpu.flags.lm == true) && (hardware->cpu.flags.smp==false)) {
- more_printf("CPU: %s %s @ %d MhZ : X86_64 64bits", hardware->cpu.vendor, hardware->cpu.model, hardware->dmi.processor.current_speed);
+ more_printf(" Features : %d MhZ : x86_64 64bits\n", hardware->dmi.processor.current_speed);
} else {
- more_printf("CPU: %s %s @ %d MhZ : X86_64 64bits SMP\n", hardware->cpu.vendor, hardware->cpu.model, hardware->dmi.processor.current_speed);
+ more_printf(" Features : %d MhZ : x86_64 64bits SMP\n", hardware->dmi.processor.current_speed);
}
}
diff --git a/com32/hdt/hdt-cli-dmi.c b/com32/hdt/hdt-cli-dmi.c
index 7b4ab75f..b3c486dc 100644
--- a/com32/hdt/hdt-cli-dmi.c
+++ b/com32/hdt/hdt-cli-dmi.c
@@ -57,7 +57,7 @@ void dmi_show(char *item, struct s_hardware *hardware) {
return;
}
if ( !strncmp(item, CLI_DMI_MEMORY, sizeof(CLI_DMI_MEMORY) - 1) ) {
- show_dmi_memory_modules(hardware);
+ show_dmi_memory_modules(hardware,true);
return;
}
if ( !strncmp(item, CLI_DMI_MEMORY_BANK, sizeof(CLI_DMI_MEMORY_BANK) - 1) ) {
@@ -122,7 +122,7 @@ void show_dmi_modules(struct s_hardware *hardware) {
void main_show_dmi(struct s_hardware *hardware,struct s_cli_mode *cli_mode) {
- if (hardware->dmi_detection==false) detect_dmi(hardware);
+ detect_dmi(hardware);
if (hardware->is_dmi_valid==false) {
printf("No valid DMI table found, exiting.\n");
@@ -288,7 +288,7 @@ void show_dmi_cpu(struct s_hardware *hardware) {
}
-void show_dmi_memory_modules(struct s_hardware *hardware) {
+void show_dmi_memory_modules(struct s_hardware *hardware, bool clear) {
char bank_number[10];
char available_dmi_commands[1024];
memset(available_dmi_commands,0,sizeof(available_dmi_commands));
@@ -298,7 +298,7 @@ void show_dmi_memory_modules(struct s_hardware *hardware) {
return;
}
- clear_screen();
+ if (clear) clear_screen();
more_printf("Memory Banks\n");
for (int i=0;i<hardware->dmi.memory_count;i++) {
if (hardware->dmi.memory[i].filled==true) {
@@ -307,10 +307,11 @@ void show_dmi_memory_modules(struct s_hardware *hardware) {
memset(bank_number,0,sizeof(bank_number));
snprintf(bank_number,sizeof(bank_number),"%d ",i);
strncat(available_dmi_commands,bank_number,sizeof(bank_number));
- printf("bank%d: %s %s@%s\n",i,hardware->dmi.memory[i].size, hardware->dmi.memory[i].type, hardware->dmi.memory[i].speed);
+ if (strncmp(hardware->dmi.memory[i].size,"Free",4))
+ printf(" bank %02d : %s %s@%s\n",i,hardware->dmi.memory[i].size, hardware->dmi.memory[i].type, hardware->dmi.memory[i].speed);
}
}
- printf("Type 'show bank<bank_number>' for more details.\n");
+ //printf("Type 'show bank<bank_number>' for more details.\n");
}
void show_dmi_memory_bank(struct s_hardware *hardware, const char *item) {
diff --git a/com32/hdt/hdt-cli-pci.c b/com32/hdt/hdt-cli-pci.c
index a459d71c..ac738207 100644
--- a/com32/hdt/hdt-cli-pci.c
+++ b/com32/hdt/hdt-cli-pci.c
@@ -104,7 +104,9 @@ void show_pci_device(struct s_hardware *hardware, const char *item) {
more_printf("PCI Bus : %02d\n",bus);
more_printf("PCI Slot : %02d\n",slot);
more_printf("PCI Func : %02d\n",func);
-
+ if ((hardware->pxe.pci_device != NULL) && (hardware->pxe.pci_device == pci_device)) {
+ more_printf("PXE : Current boot device\n",func);
+ }
}
void show_pci_devices(struct s_hardware *hardware) {
@@ -224,68 +226,8 @@ void main_show_pci(struct s_hardware *hardware) {
char second_line[81];
char third_line[81];
cli_detect_pci(hardware);
- clear_screen();
- more_printf("%d PCI devices detected\n",hardware->nb_pci_devices);
-
- if (hardware->pci_ids_return_code == -ENOPCIIDS) {
- nopciids=true;
- }
-
- if (hardware->modules_pcimap_return_code == -ENOMODULESPCIMAP) {
- nomodulespcimap=true;
- }
-
- /* For every detected pci device, compute its submenu */
- for_each_pci_func(pci_device, hardware->pci_domain) {
- memset(kernel_modules,0,sizeof kernel_modules);
- for (int kmod=0; kmod<pci_device->dev_info->linux_kernel_module_count;kmod++) {
- if (kmod>0) {
- strncat(kernel_modules," | ",3);
- }
- strncat(kernel_modules, pci_device->dev_info->linux_kernel_module[kmod],LINUX_KERNEL_MODULE_SIZE-1);
- }
- if (pci_device->dev_info->linux_kernel_module_count==0) strlcpy(kernel_modules,"unknown",7);
-
- if ((nopciids == false) && (nomodulespcimap == false)) {
- snprintf(first_line,sizeof(first_line),"%02d: %02x:%02x.%01x %s %s \n",
- i,__pci_bus, __pci_slot, __pci_func,pci_device->dev_info->vendor_name,
- pci_device->dev_info->product_name);
- snprintf(second_line,sizeof(second_line)," # %-25s # ID:%04x:%04x[%04x:%04x]\n",
- pci_device->dev_info->class_name,
- pci_device->vendor, pci_device->product,
- pci_device->sub_vendor, pci_device->sub_product);
- snprintf(third_line,sizeof(third_line), " # Linux Kernel Module(s): %s \n",kernel_modules);
- more_printf(first_line);
- more_printf(second_line);
- more_printf(third_line);
- more_printf("\n");
- } else if ((nopciids == true) && (nomodulespcimap == true)) {
- more_printf("%02d: %02x:%02x.%01x %04x:%04x [%04x:%04x] \n",
- i,__pci_bus, __pci_slot, __pci_func,
- pci_device->vendor, pci_device->product,
- pci_device->sub_vendor, pci_device->sub_product,kernel_modules);
-
- } else if ((nopciids == true) && (nomodulespcimap == false)) {
- more_printf("%02d: %02x:%02x.%01x %04x:%04x [%04x:%04x] Kmod:%s\n",
- i,__pci_bus, __pci_slot, __pci_func,
- pci_device->vendor, pci_device->product,
- pci_device->sub_vendor, pci_device->sub_product,kernel_modules,
- pci_device->sub_product,kernel_modules);
- } else if ((nopciids == false) && (nomodulespcimap == true)) {
- snprintf(first_line,sizeof(first_line),"%02d: %02x:%02x.%01x %s %s \n",
- i,__pci_bus, __pci_slot, __pci_func,pci_device->dev_info->vendor_name,
- pci_device->dev_info->product_name);
- snprintf(second_line,sizeof(second_line)," # %-25s # ID:%04x:%04x[%04x:%04x]\n",
- pci_device->dev_info->class_name,
- pci_device->vendor, pci_device->product,
- pci_device->sub_vendor, pci_device->sub_product);
- more_printf(first_line);
- more_printf(second_line);
- more_printf("\n");
- }
-
- i++;
- }
+ more_printf("PCI\n");
+ more_printf(" NB Devices : %d\n",hardware->nb_pci_devices);
}
diff --git a/com32/hdt/hdt-cli-net.c b/com32/hdt/hdt-cli-pxe.c
index 9e6aaf64..4353b51a 100644
--- a/com32/hdt/hdt-cli-net.c
+++ b/com32/hdt/hdt-cli-pxe.c
@@ -34,26 +34,34 @@
#include <errno.h>
#include <syslinux/pxe.h>
-void main_show_net(struct s_hardware *hardware,struct s_cli_mode *cli_mode) {
- char buffer[1024];
- memset(buffer,0,sizeof(buffer));
+void main_show_pxe(struct s_hardware *hardware,struct s_cli_mode *cli_mode) {
+ char buffer[81];
+ memset(buffer,0,sizeof(81));
- if (hardware->pxe_detection==false) detect_pxe(hardware);
+ detect_pxe(hardware);
+ more_printf("PXE\n");
if (hardware->is_pxe_valid==false) {
- more_printf("No valid PXE rom found\n");
+ more_printf(" No valid PXE ROM found\n");
return;
}
- t_PXENV_UNDI_GET_NIC_TYPE *g = &hardware->gnt;
- switch(hardware->gnt.NicType) {
- case PCI_NIC: more_printf("PCI NIC: %04x:%04x[%04x:%04X] rev(%02x) Bus(%02x:%02x.%02x) %02x.%02x %02x %02x\n",
- g->info.pci.Vendor_ID, g->info.pci.Dev_ID, g->info.pci.SubVendor_ID, g->info.pci.SubDevice_ID,
- g->info.pci.Rev, (g->info.pci.BusDevFunc >> 8) & 0xff, (g->info.pci.BusDevFunc >> 3) & 0x7,
- g->info.pci.BusDevFunc & 0x03,
- g->info.pci.Base_Class,
- g->info.pci.Sub_Class, g->info.pci.Prog_Intf);break;
- case PnP_NIC: break;
- case CardBus_NIC:break;
- }
-}
+ struct s_pxe *p = &hardware->pxe;
+ more_printf(" PCI device no: %d \n", p->pci_device_pos);
+
+ if (hardware->pci_ids_return_code == -ENOPCIIDS) {
+ snprintf(buffer,sizeof(buffer)," PCI ID : %04x:%04x[%04x:%04X] rev(%02x)\n",
+ p->vendor_id, p->product_id, p->subvendor_id, p->subproduct_id,
+ p->rev);
+ snprintf(buffer,sizeof(buffer)," PCI Bus pos. : %02x:%02x.%02x\n",
+ p->pci_bus,p->pci_dev, p->pci_func);
+
+ more_printf(buffer);
+ } else {
+ snprintf(buffer,sizeof(buffer)," Manufacturer : %s \n", p->pci_device->dev_info->vendor_name);
+ more_printf(buffer);
+ snprintf(buffer,sizeof(buffer)," Product : %s \n", p->pci_device->dev_info->product_name);
+ more_printf(buffer);
+ }
+
+}
diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c
index 2640d382..c0390a5d 100644
--- a/com32/hdt/hdt-cli.c
+++ b/com32/hdt/hdt-cli.c
@@ -141,7 +141,7 @@ void start_cli_mode(struct s_hardware *hardware, int argc, char *argv[]) {
int do_exit(struct s_cli_mode *cli_mode) {
switch (cli_mode->mode) {
case HDT_MODE: return EXIT_MODE;
- case NET_MODE:
+ case PXE_MODE:
case PCI_MODE:
case DMI_MODE:
case CPU_MODE: return HDT_MODE;
@@ -155,7 +155,7 @@ switch (cli_mode->mode) {
case HDT_MODE:
printf("Available commands are : %s %s %s %s %s %s\n",CLI_CLEAR, CLI_EXIT,CLI_HELP,CLI_SHOW, CLI_PCI, CLI_DMI);
break;
- case NET_MODE:
+ case PXE_MODE:
case CPU_MODE:
case PCI_MODE:
case DMI_MODE:
@@ -166,9 +166,31 @@ switch (cli_mode->mode) {
}
}
+void main_show_summary(struct s_hardware *hardware, struct s_cli_mode *cli_mode) {
+ detect_pci(hardware); /* pxe is detected in the pci */
+ detect_dmi(hardware);
+ cpu_detect(hardware);
+ clear_screen();
+ main_show_cpu(hardware,cli_mode);
+ if (hardware->is_dmi_valid) {
+ more_printf("System\n");
+ more_printf(" Manufacturer : %s\n",hardware->dmi.system.manufacturer);
+ more_printf(" Product Name : %s\n",hardware->dmi.system.product_name);
+ more_printf(" Serial : %s\n",hardware->dmi.system.serial);
+ more_printf("Bios\n");
+ more_printf(" Version : %s\n",hardware->dmi.bios.version);
+ more_printf(" Release : %s\n",hardware->dmi.bios.release_date);
+ show_dmi_memory_modules(hardware,false);
+ }
+ main_show_pci(hardware);
+ if (hardware->is_pxe_valid)
+ main_show_pxe(hardware,cli_mode);
+}
+
void main_show(char *item, struct s_hardware *hardware, struct s_cli_mode *cli_mode) {
+ if (!strncmp(item,CLI_SUMMARY, sizeof (CLI_SUMMARY))) main_show_summary(hardware,cli_mode);
if (!strncmp(item,CLI_PCI, sizeof (CLI_PCI))) main_show_pci(hardware);
if (!strncmp(item,CLI_DMI, sizeof (CLI_DMI))) main_show_dmi(hardware,cli_mode);
if (!strncmp(item,CLI_CPU, sizeof (CLI_CPU))) main_show_cpu(hardware,cli_mode);
- if (!strncmp(item,CLI_NET, sizeof (CLI_NET))) main_show_net(hardware,cli_mode);
+ if (!strncmp(item,CLI_PXE, sizeof (CLI_PXE))) main_show_pxe(hardware,cli_mode);
}
diff --git a/com32/hdt/hdt-cli.h b/com32/hdt/hdt-cli.h
index 5e1cbe7d..224a207e 100644
--- a/com32/hdt/hdt-cli.h
+++ b/com32/hdt/hdt-cli.h
@@ -37,7 +37,8 @@
#define CLI_SHOW "show"
#define CLI_HDT "hdt"
#define CLI_PCI "pci"
-#define CLI_NET "net"
+#define CLI_PXE "pxe"
+#define CLI_SUMMARY "summary"
#define CLI_COMMANDS "commands"
#define CLI_DMI "dmi"
#define CLI_CPU "cpu"
@@ -49,7 +50,7 @@ typedef enum {
PCI_MODE,
DMI_MODE,
CPU_MODE,
- NET_MODE,
+ PXE_MODE,
} cli_mode_t;
struct s_cli_mode {
@@ -81,7 +82,7 @@ void show_dmi_bios(struct s_hardware *hardware);
void show_dmi_chassis(struct s_hardware *hardware);
void show_dmi_cpu(struct s_hardware *hardware);
void show_dmi_modules(struct s_hardware *hardware);
-void show_dmi_memory_modules(struct s_hardware *hardware);
+void show_dmi_memory_modules(struct s_hardware *hardware,bool clearscreen);
void show_dmi_memory_bank(struct s_hardware *hardware, const char *item);
void show_dmi_battery(struct s_hardware *hardware);
@@ -97,6 +98,6 @@ void main_show_cpu(struct s_hardware *hardware,struct s_cli_mode *cli_mode);
void handle_cpu_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware);
void cpu_show(char *item, struct s_hardware *hardware);
-//NET STUFF
-void main_show_net(struct s_hardware *hardware,struct s_cli_mode *cli_mode);
+//PXE STUFF
+void main_show_pxe(struct s_hardware *hardware,struct s_cli_mode *cli_mode);
#endif
diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c
index d71f215a..47f09702 100644
--- a/com32/hdt/hdt-common.c
+++ b/com32/hdt/hdt-common.c
@@ -49,12 +49,13 @@ void init_hardware(struct s_hardware *hardware) {
memset(hardware->disk_info,0,sizeof(hardware->disk_info));
memset(&hardware->dmi,0,sizeof(s_dmi));
memset(&hardware->cpu,0,sizeof(s_cpu));
- memset(&hardware->gnt,0,sizeof(t_PXENV_UNDI_GET_NIC_TYPE));
+ memset(&hardware->pxe,0,sizeof(struct s_pxe));
}
/* Detecting if a DMI table exist
* if yes, let's parse it */
int detect_dmi(struct s_hardware *hardware) {
+ if (hardware->dmi_detection == true) return;
hardware->dmi_detection=true;
if (dmi_iterate(&hardware->dmi) == -ENODMITABLE ) {
hardware->is_dmi_valid=false;
@@ -81,27 +82,81 @@ int detect_pxe(struct s_hardware *hardware) {
void *dhcpdata;
size_t dhcplen;
const struct syslinux_version *sv;
+ t_PXENV_UNDI_GET_NIC_TYPE gnt;
+ if (hardware->pxe_detection == true) return -1;
hardware->pxe_detection=true;
- memset(&hardware->gnt,0, sizeof(t_PXENV_UNDI_GET_NIC_TYPE));
+ hardware->is_pxe_valid=false;
+ memset(&gnt,0, sizeof(t_PXENV_UNDI_GET_NIC_TYPE));
+ memset(&hardware->pxe,0, sizeof(struct s_pxe));
sv = syslinux_version();
/* This code can only work if pxelinux is loaded*/
if (sv->filesystem != SYSLINUX_FS_PXELINUX) {
- printf("No valid PXE Rom found\n");
return -1;
}
- printf("PXE: PXElinux detected, Detecting parameters\n");
+// printf("PXE: PXElinux detected\n");
if (!pxe_get_cached_info(PXENV_PACKET_TYPE_DHCP_ACK, &dhcpdata, &dhcplen)) {
- if (!pxe_get_nic_type(&hardware->gnt)) {
- hardware->is_pxe_valid=true;
+ if (!pxe_get_nic_type(&gnt)) {
+ switch(gnt.NicType) {
+ case PCI_NIC:
+ hardware->is_pxe_valid=true;
+ hardware->pxe.vendor_id=gnt.info.pci.Vendor_ID;
+ hardware->pxe.product_id=gnt.info.pci.Dev_ID;
+ hardware->pxe.subvendor_id=gnt.info.pci.SubVendor_ID;
+ hardware->pxe.subproduct_id=gnt.info.pci.SubDevice_ID,
+ hardware->pxe.rev=gnt.info.pci.Rev;
+ hardware->pxe.pci_bus= (gnt.info.pci.BusDevFunc >> 8) & 0xff;
+ hardware->pxe.pci_dev= (gnt.info.pci.BusDevFunc >> 3) & 0x7;
+ hardware->pxe.pci_func=gnt.info.pci.BusDevFunc & 0x03;
+ hardware->pxe.base_class=gnt.info.pci.Base_Class;
+ hardware->pxe.sub_class=gnt.info.pci.Sub_Class;
+ hardware->pxe.prog_intf=gnt.info.pci.Prog_Intf;
+ hardware->pxe.nictype=gnt.NicType;
+ break;
+ case CardBus_NIC:
+ hardware->is_pxe_valid=true;
+ hardware->pxe.vendor_id=gnt.info.cardbus.Vendor_ID;
+ hardware->pxe.product_id=gnt.info.cardbus.Dev_ID;
+ hardware->pxe.subvendor_id=gnt.info.cardbus.SubVendor_ID;
+ hardware->pxe.subproduct_id=gnt.info.cardbus.SubDevice_ID,
+ hardware->pxe.rev=gnt.info.cardbus.Rev;
+ hardware->pxe.pci_bus= (gnt.info.cardbus.BusDevFunc >> 8) & 0xff;
+ hardware->pxe.pci_dev= (gnt.info.cardbus.BusDevFunc >> 3) & 0x7;
+ hardware->pxe.pci_func=gnt.info.cardbus.BusDevFunc & 0x03;
+ hardware->pxe.base_class=gnt.info.cardbus.Base_Class;
+ hardware->pxe.sub_class=gnt.info.cardbus.Sub_Class;
+ hardware->pxe.prog_intf=gnt.info.cardbus.Prog_Intf;
+ hardware->pxe.nictype=gnt.NicType;
+ break;
+ case PnP_NIC:
+ default: return -1; break;
}
+ if (hardware->pci_detection==false) detect_pci(hardware);
+ hardware->pxe.pci_device=NULL;
+ hardware->pxe.pci_device_pos=0;
+ struct pci_device *pci_device;
+ int pci_number=0;
+ for_each_pci_func(pci_device, hardware->pci_domain) {
+ pci_number++;
+ if ((__pci_bus == hardware->pxe.pci_bus) &&
+ (__pci_slot == hardware->pxe.pci_dev) &&
+ (__pci_func == hardware->pxe.pci_func) &&
+ (pci_device->vendor == hardware->pxe.vendor_id) &&
+ (pci_device->product == hardware->pxe.product_id)) {
+ hardware->pxe.pci_device=pci_device;
+ hardware->pxe.pci_device_pos=pci_number;
+ // printf("PXE: PCI device %d is the current boot device\n", pci_number);
+ }
+ }
+ }
}
return 0;
}
void detect_pci(struct s_hardware *hardware) {
+ if (hardware->pci_detection == true) return;
hardware->pci_detection=true;
printf("PCI: Detecting Devices\n");
@@ -126,9 +181,12 @@ void detect_pci(struct s_hardware *hardware) {
/* Detecting which kernel module should match each device */
hardware->modules_pcimap_return_code=get_module_name_from_pci_ids(hardware->pci_domain);
+ /* we try to detect the pxe stuff to populate the PXE: field of pci devices */
+ detect_pxe(hardware);
}
void cpu_detect(struct s_hardware *hardware) {
+ if (hardware->cpu_detection == true) return;
detect_cpu(&hardware->cpu);
hardware->cpu_detection=true;
}
diff --git a/com32/hdt/hdt-common.h b/com32/hdt/hdt-common.h
index 5c3282c6..d78b45b1 100644
--- a/com32/hdt/hdt-common.h
+++ b/com32/hdt/hdt-common.h
@@ -53,12 +53,30 @@ extern int display_line_nb;
} while (0);
+struct s_pxe {
+ uint16_t vendor_id;
+ uint16_t product_id;
+ uint16_t subvendor_id;
+ uint16_t subproduct_id;
+ uint8_t rev;
+ uint8_t pci_bus;
+ uint8_t pci_dev;
+ uint8_t pci_func;
+ uint8_t base_class;
+ uint8_t sub_class;
+ uint8_t prog_intf;
+ uint8_t nictype;
+
+ struct pci_device *pci_device;
+ uint8_t pci_device_pos;
+};
+
struct s_hardware {
s_dmi dmi; /* DMI table */
s_cpu cpu; /* CPU information */
struct pci_domain *pci_domain; /* PCI Devices */
struct diskinfo disk_info[256]; /* Disk Information*/
- t_PXENV_UNDI_GET_NIC_TYPE gnt;
+ struct s_pxe pxe;
int pci_ids_return_code;
int modules_pcimap_return_code;
diff --git a/com32/hdt/hdt.h b/com32/hdt/hdt.h
index 5660e211..a9436b1f 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.1.9"
+#define VERSION "0.2.0"
#define ATTR_PACKED __attribute__((packed))