aboutsummaryrefslogtreecommitdiffstats
path: root/com32/hdt/hdt-common.c
diff options
context:
space:
mode:
authorErwan Velu <erwan.velu@free.fr>2009-02-24 22:47:10 +0100
committerH. Peter Anvin <hpa@zytor.com>2009-02-25 20:58:45 -0800
commit502f3945957eda4f312704fa70a0e2fc53bbd6af (patch)
treed7a30bc476d4889dbf039944e52cbca0f053e93f /com32/hdt/hdt-common.c
parentdddc947144848663029d46efaa81d8235c948f3f (diff)
downloadsyslinux-elf-502f3945957eda4f312704fa70a0e2fc53bbd6af.tar.gz
syslinux-elf-502f3945957eda4f312704fa70a0e2fc53bbd6af.tar.xz
syslinux-elf-502f3945957eda4f312704fa70a0e2fc53bbd6af.zip
hdt: Basic pxe implementation
Diffstat (limited to 'com32/hdt/hdt-common.c')
-rw-r--r--com32/hdt/hdt-common.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c
index 19ddbadf..d71f215a 100644
--- a/com32/hdt/hdt-common.c
+++ b/com32/hdt/hdt-common.c
@@ -30,6 +30,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include "syslinux/config.h"
void init_hardware(struct s_hardware *hardware) {
hardware->pci_ids_return_code=0;
@@ -38,14 +39,17 @@ void init_hardware(struct s_hardware *hardware) {
hardware->pci_detection=false;
hardware->disk_detection=false;
hardware->dmi_detection=false;
+ hardware->pxe_detection=false;
hardware->nb_pci_devices=0;
hardware->is_dmi_valid=false;
+ hardware->is_pxe_valid=false;
hardware->pci_domain=NULL;
/* Cleaning structures */
memset(hardware->disk_info,0,sizeof(hardware->disk_info));
- memset(&hardware->dmi,0,sizeof(hardware->dmi));
- memset(&hardware->cpu,0,sizeof(hardware->cpu));
+ 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));
}
/* Detecting if a DMI table exist
@@ -73,6 +77,30 @@ void detect_disks(struct s_hardware *hardware) {
}
}
+int detect_pxe(struct s_hardware *hardware) {
+ void *dhcpdata;
+ size_t dhcplen;
+ const struct syslinux_version *sv;
+
+ hardware->pxe_detection=true;
+ memset(&hardware->gnt,0, sizeof(t_PXENV_UNDI_GET_NIC_TYPE));
+
+ 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");
+
+ if (!pxe_get_cached_info(PXENV_PACKET_TYPE_DHCP_ACK, &dhcpdata, &dhcplen)) {
+ if (!pxe_get_nic_type(&hardware->gnt)) {
+ hardware->is_pxe_valid=true;
+ }
+ }
+ return 0;
+}
+
void detect_pci(struct s_hardware *hardware) {
hardware->pci_detection=true;
printf("PCI: Detecting Devices\n");