[syslinux:master] hdt: Dumping pxe structures
syslinux-bot for Erwan Velu
erwanaliasr1 at gmail.com
Mon Apr 25 15:28:11 PDT 2011
Commit-ID: bd97eeacd2e533a7c1c36d62f863930816d9df6b
Gitweb: http://syslinux.zytor.com/commit/bd97eeacd2e533a7c1c36d62f863930816d9df6b
Author: Erwan Velu <erwanaliasr1 at gmail.com>
AuthorDate: Mon, 21 Mar 2011 23:05:28 +0100
Committer: Erwan Velu <erwanaliasr1 at gmail.com>
CommitDate: Mon, 21 Mar 2011 23:05:28 +0100
hdt: Dumping pxe structures
If pxe is detected, let's dump the structures.
---
com32/hdt/{hdt-dump-cpu.c => hdt-dump-pxe.c} | 54 +++++++++++++++++--------
com32/hdt/hdt-dump.c | 1 +
com32/hdt/hdt-dump.h | 1 +
3 files changed, 39 insertions(+), 17 deletions(-)
diff --git a/com32/hdt/hdt-dump-cpu.c b/com32/hdt/hdt-dump-pxe.c
similarity index 51%
copy from com32/hdt/hdt-dump-cpu.c
copy to com32/hdt/hdt-dump-pxe.c
index dc58a6f..2192184 100644
--- a/com32/hdt/hdt-dump-cpu.c
+++ b/com32/hdt/hdt-dump-pxe.c
@@ -28,26 +28,46 @@
#include "hdt-common.h"
#include "hdt-dump.h"
+#include <sys/gpxe.h>
-void dump_cpu(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item) {
+void dump_pxe(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item) {
+ if (hardware->is_pxe_valid == false) return;
*item = zzjson_create_object(config, NULL); /* empty object */
- add_hs(cpu.vendor);
- add_hs(cpu.model);
- add_hi(cpu.vendor_id);
- add_hi(cpu.family);
- add_hi(cpu.model_id);
- add_hi(cpu.stepping);
- add_hi(cpu.num_cores);
- add_hi(cpu.l1_data_cache_size);
- add_hi(cpu.l1_instruction_cache_size);
- add_hi(cpu.l2_cache_size);
- size_t i;
- for (i = 0; i < cpu_flags_count; i++) {
- char temp[128]={0};
- snprintf(temp,sizeof(temp),"cpu.flags.%s",cpu_flags_names[i]);
- add_b(temp,get_cpu_flag_value_from_name(&hardware->cpu,cpu_flags_names[i]));
+ char buffer[32] = {0};
+ snprintf(buffer,sizeof(buffer),"0x%x",hardware->pxe.vendor_id);
+ add_s("pxe.vendor_id",buffer);
+ snprintf(buffer,sizeof(buffer),"0x%x",hardware->pxe.product_id);
+ add_s("pxe.product_id",buffer);
+ snprintf(buffer,sizeof(buffer),"0x%x",hardware->pxe.subvendor_id);
+ add_s("pxe.subvendor_id",buffer);
+ snprintf(buffer,sizeof(buffer),"0x%x",hardware->pxe.subproduct_id);
+ add_s("pxe.subproduct_id",buffer);
+
+ if (hardware->pci_ids_return_code == -ENOPCIIDS || (hardware->pxe.pci_device == NULL)) {
+ add_s("Manufacturer_name","no_pci_ids_file or no device found");
+ add_s("Product_name","no_pci_ids_file or no device found");
+ } else {
+ add_s("Manufacturer_name", hardware->pxe.pci_device->dev_info->vendor_name);
+ add_s("Product_name", hardware->pxe.pci_device->dev_info->product_name);
}
- flush("cpu",config,item);
+ add_hi(pxe.rev);
+ add_hi(pxe.pci_bus);
+ add_hi(pxe.pci_dev);
+ add_hi(pxe.pci_func);
+ add_hi(pxe.base_class);
+ add_hi(pxe.sub_class);
+ add_hi(pxe.prog_intf);
+ add_hi(pxe.nictype);
+ add_hs(pxe.mac_addr);
+ char ip[16] = {0};
+ snprintf(ip,sizeof(ip), "%d.%d.%d.%d",
+ hardware->pxe.ip_addr[0],
+ hardware->pxe.ip_addr[1],
+ hardware->pxe.ip_addr[2],
+ hardware->pxe.ip_addr[3]);
+ add_s("pxe.ipaddr",ip);
+ add_b("gpxe_detected",is_gpxe());
+ flush("pxe",config,item);
}
diff --git a/com32/hdt/hdt-dump.c b/com32/hdt/hdt-dump.c
index 9647eba..324fd81 100644
--- a/com32/hdt/hdt-dump.c
+++ b/com32/hdt/hdt-dump.c
@@ -119,6 +119,7 @@ void dump(struct s_hardware *hardware)
cpio_init(upload,(const char **)arg);
dump_cpu(hardware, &config, &json);
+ dump_pxe(hardware, &config, &json);
/* We close & flush the file to send */
cpio_close(upload);
diff --git a/com32/hdt/hdt-dump.h b/com32/hdt/hdt-dump.h
index 2f9dd6f..933d543 100644
--- a/com32/hdt/hdt-dump.h
+++ b/com32/hdt/hdt-dump.h
@@ -49,3 +49,4 @@ int dumpprintf(FILE *p, const char *format, ...);
void flush (char *filename, ZZJSON_CONFIG *config, ZZJSON ** item);
void dump_cpu(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item);
+void dump_pxe(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item);
More information about the Syslinux-commits
mailing list