summaryrefslogtreecommitdiff
path: root/com32/gplinclude
diff options
context:
space:
mode:
authorErwan Velu <erwan.velu@free.fr>2009-03-12 22:40:38 +0100
committerErwan Velu <erwan.velu@free.fr>2009-03-12 22:40:38 +0100
commitbe15fb5e6fe184eb1bb725f229e157a7d1967986 (patch)
tree0e03c26bfcec2384b6eb46d4784938a1ef42a4bc /com32/gplinclude
parente2b00cb9768811ad45526d11bcc5be5e7722b5ba (diff)
downloadsyslinux-be15fb5e6fe184eb1bb725f229e157a7d1967986.tar.gz
Moving dmi & cpuid stuff to gpl subdirs
Fixing copyrights Moving dmi includes to gplinclude/dmi Moving dmi code to gpllib/dmi/ Moving cpuid includes to gplinclude/ Moving cpuid code to gpllib/ Fixing Makefiles accordingly
Diffstat (limited to 'com32/gplinclude')
-rw-r--r--com32/gplinclude/cpuid.h215
-rw-r--r--com32/gplinclude/dmi/dmi.h88
-rw-r--r--com32/gplinclude/dmi/dmi_base_board.h53
-rw-r--r--com32/gplinclude/dmi/dmi_battery.h57
-rw-r--r--com32/gplinclude/dmi/dmi_bios.h107
-rw-r--r--com32/gplinclude/dmi/dmi_chassis.h50
-rw-r--r--com32/gplinclude/dmi/dmi_memory.h61
-rw-r--r--com32/gplinclude/dmi/dmi_processor.h111
-rw-r--r--com32/gplinclude/dmi/dmi_system.h38
9 files changed, 780 insertions, 0 deletions
diff --git a/com32/gplinclude/cpuid.h b/com32/gplinclude/cpuid.h
new file mode 100644
index 00000000..e0ae72af
--- /dev/null
+++ b/com32/gplinclude/cpuid.h
@@ -0,0 +1,215 @@
+/*
+ * Portions of this file taken from the Linux kernel,
+ * Copyright 1991-2009 Linus Torvalds and contributors
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ *
+*/
+
+#ifndef _CPUID_H
+#define _CPUID_H
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <cpufeature.h>
+#include <sys/cpu.h>
+#include <klibc/compiler.h>
+
+#define PAGE_SIZE 4096
+
+#define CPU_MODEL_SIZE 48
+#define CPU_VENDOR_SIZE 48
+
+typedef struct {
+ bool fpu; /* Onboard FPU */
+ bool vme; /* Virtual Mode Extensions */
+ bool de; /* Debugging Extensions */
+ bool pse; /* Page Size Extensions */
+ bool tsc; /* Time Stamp Counter */
+ bool msr; /* Model-Specific Registers, RDMSR, WRMSR */
+ bool pae; /* Physical Address Extensions */
+ bool mce; /* Machine Check Architecture */
+ bool cx8; /* CMPXCHG8 instruction */
+ bool apic;/* Onboard APIC */
+ bool sep; /* SYSENTER/SYSEXIT */
+ bool mtrr;/* Memory Type Range Registers */
+ bool pge; /* Page Global Enable */
+ bool mca; /* Machine Check Architecture */
+ bool cmov;/* CMOV instruction (FCMOVCC and FCOMI too if FPU present) */
+ bool pat; /* Page Attribute Table */
+ bool pse_36; /* 36-bit PSEs */
+ bool psn; /* Processor serial number */
+ bool clflsh; /* Supports the CLFLUSH instruction */
+ bool dts; /* Debug Trace Store */
+ bool acpi;/* ACPI via MSR */
+ bool mmx; /* Multimedia Extensions */
+ bool fxsr;/* FXSAVE and FXRSTOR instructions (fast save and restore */
+ /* of FPU context), and CR4.OSFXSR available */
+ bool sse; /* Streaming SIMD Extensions */
+ bool sse2;/* Streaming SIMD Extensions 2*/
+ bool ss; /* CPU self snoop */
+ bool htt; /* Hyper-Threading */
+ bool acc; /* Automatic clock control */
+ bool syscall; /* SYSCALL/SYSRET */
+ bool mp; /* MP Capable. */
+ bool nx; /* Execute Disable */
+ bool mmxext; /* AMD MMX extensions */
+ bool lm; /* Long Mode (x86-64) */
+ bool nowext;/* AMD 3DNow! extensions */
+ bool now; /* 3DNow! */
+ bool smp; /* A smp configuration has been found*/
+} s_cpu_flags;
+
+typedef struct {
+ char vendor[CPU_VENDOR_SIZE];
+ uint8_t vendor_id;
+ uint8_t family;
+ char model[CPU_MODEL_SIZE];
+ uint8_t model_id;
+ uint8_t stepping;
+ s_cpu_flags flags;
+} s_cpu;
+
+/**********************************************************************************/
+/**********************************************************************************/
+/* From this point this is some internal stuff mainly taken from the linux kernel */
+/**********************************************************************************/
+/**********************************************************************************/
+
+/*
+ * EFLAGS bits
+ */
+#define X86_EFLAGS_CF 0x00000001 /* Carry Flag */
+#define X86_EFLAGS_PF 0x00000004 /* Parity Flag */
+#define X86_EFLAGS_AF 0x00000010 /* Auxillary carry Flag */
+#define X86_EFLAGS_ZF 0x00000040 /* Zero Flag */
+#define X86_EFLAGS_SF 0x00000080 /* Sign Flag */
+#define X86_EFLAGS_TF 0x00000100 /* Trap Flag */
+#define X86_EFLAGS_IF 0x00000200 /* Interrupt Flag */
+#define X86_EFLAGS_DF 0x00000400 /* Direction Flag */
+#define X86_EFLAGS_OF 0x00000800 /* Overflow Flag */
+#define X86_EFLAGS_IOPL 0x00003000 /* IOPL mask */
+#define X86_EFLAGS_NT 0x00004000 /* Nested Task */
+#define X86_EFLAGS_RF 0x00010000 /* Resume Flag */
+#define X86_EFLAGS_VM 0x00020000 /* Virtual Mode */
+#define X86_EFLAGS_AC 0x00040000 /* Alignment Check */
+#define X86_EFLAGS_VIF 0x00080000 /* Virtual Interrupt Flag */
+#define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */
+#define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */
+
+#define X86_VENDOR_INTEL 0
+#define X86_VENDOR_CYRIX 1
+#define X86_VENDOR_AMD 2
+#define X86_VENDOR_UMC 3
+#define X86_VENDOR_NEXGEN 4
+#define X86_VENDOR_CENTAUR 5
+#define X86_VENDOR_RISE 6
+#define X86_VENDOR_TRANSMETA 7
+#define X86_VENDOR_NSC 8
+#define X86_VENDOR_NUM 9
+#define X86_VENDOR_UNKNOWN 0xff
+
+static inline __purefunc bool test_bit(int nr, const uint32_t *addr)
+{
+ return ((1UL << (nr & 31)) & (addr[nr >> 5])) != 0;
+}
+
+#define cpu_has(c, bit) test_bit(bit, (c)->x86_capability)
+
+/*
+ * CPU type and hardware bug flags. Kept separately for each CPU.
+ * Members of this structure are referenced in head.S, so think twice
+ * before touching them. [mj]
+ */
+
+struct cpuinfo_x86 {
+ uint8_t x86; /* CPU family */
+ uint8_t x86_vendor; /* CPU vendor */
+ uint8_t x86_model;
+ uint8_t x86_mask;
+ char wp_works_ok; /* It doesn't on 386's */
+ char hlt_works_ok; /* Problems on some 486Dx4's and old 386's */
+ char hard_math;
+ char rfu;
+ int cpuid_level; /* Maximum supported CPUID level, -1=no CPUID */
+ uint32_t x86_capability[NCAPINTS];
+ char x86_vendor_id[16];
+ char x86_model_id[64];
+ int x86_cache_size; /* in KB, if available */
+ int x86_cache_alignment; /* in bytes */
+ char fdiv_bug;
+ char f00f_bug;
+ char coma_bug;
+ char pad0;
+ int x86_power;
+ unsigned long loops_per_jiffy;
+#ifdef CONFIG_SMP
+ cpumask_t llc_shared_map; /* cpus sharing the last level cache */
+#endif
+ unsigned char x86_max_cores; /* cpuid returned max cores value */
+ unsigned char booted_cores; /* number of cores as seen by OS */
+ unsigned char apicid;
+ unsigned char x86_clflush_size;
+
+} __attribute__((__packed__));
+#endif
+
+struct cpu_model_info {
+ int vendor;
+ int family;
+ char *model_names[16];
+};
+
+/* attempt to consolidate cpu attributes */
+struct cpu_dev {
+ char * c_vendor;
+
+ /* some have two possibilities for cpuid string */
+ char * c_ident[2];
+
+ struct cpu_model_info c_models[4];
+
+ void (*c_init)(struct cpuinfo_x86 * c);
+ void (*c_identify)(struct cpuinfo_x86 * c);
+ unsigned int (*c_size_cache)(struct cpuinfo_x86 * c, unsigned int size);
+};
+
+/*
+ * Structure definitions for SMP machines following the
+ * Intel Multiprocessing Specification 1.1 and 1.4.
+ */
+
+/*
+ * This tag identifies where the SMP configuration
+ * information is.
+ */
+
+#define SMP_MAGIC_IDENT (('_'<<24)|('P'<<16)|('M'<<8)|'_')
+
+struct intel_mp_floating
+{
+ char mpf_signature[4]; /* "_MP_" */
+ uint32_t mpf_physptr; /* Configuration table address */
+ uint8_t mpf_length; /* Our length (paragraphs) */
+ uint8_t mpf_specification; /* Specification version */
+ uint8_t mpf_checksum; /* Checksum (makes sum 0) */
+ uint8_t mpf_feature1; /* Standard or configuration ? */
+ uint8_t mpf_feature2; /* Bit7 set for IMCR|PIC */
+ uint8_t mpf_feature3; /* Unused (0) */
+ uint8_t mpf_feature4; /* Unused (0) */
+ uint8_t mpf_feature5; /* Unused (0) */
+};
+
+
+extern void get_cpu_vendor(struct cpuinfo_x86 *c);
+extern void detect_cpu(s_cpu *cpu);
diff --git a/com32/gplinclude/dmi/dmi.h b/com32/gplinclude/dmi/dmi.h
new file mode 100644
index 00000000..924ed420
--- /dev/null
+++ b/com32/gplinclude/dmi/dmi.h
@@ -0,0 +1,88 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2006 Erwan Velu - All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+ * Boston MA 02111-1307, USA; either version 2 of the License, or
+ * (at your option) any later version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+#ifndef DMI_H
+#define DMI_H
+#include <inttypes.h>
+#define MAX_DMI_MEMORY_ITEMS 32
+
+#define PAGE_SIZE 4096
+
+/*typedef struct {
+ uint32_t l;
+ uint32_t h;
+} uint64_t;*/
+
+extern const char *out_of_spec;
+extern const char *bad_index;
+
+#define WORD(x) (uint16_t)(*(const uint16_t *)(x))
+#define DWORD(x) (uint32_t)(*(const uint32_t *)(x))
+#define QWORD(x) (*(const uint64_t *)(x))
+
+enum {DMI_TABLE_PRESENT = 100, ENODMITABLE};
+
+#include "dmi_bios.h"
+#include "dmi_system.h"
+#include "dmi_base_board.h"
+#include "dmi_chassis.h"
+#include "dmi_processor.h"
+#include "dmi_memory.h"
+#include "dmi_battery.h"
+
+extern char display_line;
+#define moreprintf(...) do { display_line++; if (display_line == 24) { char tempbuf[10]; display_line=0; printf("Press enter to continue"); fgets(tempbuf, sizeof tempbuf, stdin);} printf ( __VA_ARGS__); } while (0);
+
+typedef struct {
+uint16_t num;
+uint16_t len;
+uint16_t ver;
+uint32_t base;
+uint16_t major_version;
+uint16_t minor_version;
+} dmi_table;
+
+
+
+struct dmi_header
+{
+ uint8_t type;
+ uint8_t length;
+ uint16_t handle;
+ uint8_t *data;
+};
+
+typedef struct {
+ s_bios bios;
+ s_system system;
+ s_base_board base_board;
+ s_chassis chassis;
+ s_processor processor;
+ s_battery battery;
+ s_memory memory[MAX_DMI_MEMORY_ITEMS];
+ int memory_count;
+ dmi_table dmitable;
+} s_dmi;
+
+void to_dmi_header(struct dmi_header *h, uint8_t *data);
+void dmi_bios_runtime_size(uint32_t code, s_dmi *dmi);
+const char *dmi_string(struct dmi_header *dm, uint8_t s);
+int dmi_checksum(uint8_t *buf);
+void parse_dmitable(s_dmi *dmi);
+void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi *dmi);
+int dmi_iterate(s_dmi *dmi);
+
+/* dmi_utils.c */
+void display_bios_characteristics(s_dmi *dmi);
+void display_base_board_features(s_dmi *dmi);
+void display_processor_flags(s_dmi *dmi);
+#endif
diff --git a/com32/gplinclude/dmi/dmi_base_board.h b/com32/gplinclude/dmi/dmi_base_board.h
new file mode 100644
index 00000000..5b92b848
--- /dev/null
+++ b/com32/gplinclude/dmi/dmi_base_board.h
@@ -0,0 +1,53 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2006 Erwan Velu - All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+ * Boston MA 02111-1307, USA; either version 2 of the License, or
+ * (at your option) any later version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+#ifndef DMI_BASE_BOARD_H
+#define DMI_BASE_BOARD_H
+
+#include "stdbool.h"
+#define BASE_BOARD_MANUFACTURER_SIZE 32
+#define BASE_BOARD_PRODUCT_NAME_SIZE 32
+#define BASE_BOARD_VERSION_SIZE 16
+#define BASE_BOARD_SERIAL_SIZE 32
+#define BASE_BOARD_ASSET_TAG_SIZE 32
+#define BASE_BOARD_LOCATION_SIZE 32
+#define BASE_BOARD_FEATURES_SIZE 32
+#define BASE_BOARD_TYPE_SIZE 32
+
+#define BASE_BOARD_NB_ELEMENTS 5
+
+extern const char *base_board_features_strings[];
+
+/* this struct have BASE_BOARD_NB_ELEMENTS */
+/* each bool is associated to the relevant message above */
+typedef struct {
+bool hosting;
+bool board_needs_daughter;
+bool removable;
+bool replaceable;
+bool hot_swappable;
+} __attribute__((__packed__)) s_base_board_features;
+
+typedef struct {
+char manufacturer[BASE_BOARD_MANUFACTURER_SIZE];
+char product_name[BASE_BOARD_PRODUCT_NAME_SIZE];
+char version[BASE_BOARD_VERSION_SIZE];
+char serial[BASE_BOARD_SERIAL_SIZE];
+char asset_tag[BASE_BOARD_ASSET_TAG_SIZE];
+char location[BASE_BOARD_LOCATION_SIZE];
+char type[BASE_BOARD_TYPE_SIZE];
+s_base_board_features features;
+/* The filled field have to be set to true when the dmitable implement that item */
+bool filled;
+} s_base_board;
+
+#endif
diff --git a/com32/gplinclude/dmi/dmi_battery.h b/com32/gplinclude/dmi/dmi_battery.h
new file mode 100644
index 00000000..72c19693
--- /dev/null
+++ b/com32/gplinclude/dmi/dmi_battery.h
@@ -0,0 +1,57 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2009 Erwan Velu - All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+ * Boston MA 02111-1307, USA; either version 2 of the License, or
+ * (at your option) any later version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+#ifndef DMI_BATTERY_H
+#define DMI_BATTERY_H
+
+#include <stdbool.h>
+#include <inttypes.h>
+
+#define BATTERY_LOCATION_SIZE 255
+#define BATTERY_MANUFACTURER_SIZE 255
+#define BATTERY_MANUFACTURE_DATE_SIZE 255
+#define BATTERY_SERIAL_SIZE 255
+#define BATTERY_DEVICE_NAME_SIZE 255
+#define BATTERY_CHEMISTRY_SIZE 32
+#define BATTERY_CAPACITY_SIZE 16
+#define BATTERY_DESIGN_VOLTAGE_SIZE 16
+#define BATTERY_SBDS_SIZE 255
+#define BATTERY_MAXIMUM_ERROR_SIZE 32
+#define BATTERY_SBDS_SERIAL_SIZE 32
+#define BATTERY_SBDS_MANUFACTURE_DATE_SIZE 255
+#define BATTERY_SBDS_CHEMISTRY_SIZE 16
+#define BATTERY_OEM_INFO_SIZE 255
+
+typedef struct {
+char location[BATTERY_LOCATION_SIZE];
+char manufacturer[BATTERY_MANUFACTURER_SIZE];
+char manufacture_date[BATTERY_MANUFACTURE_DATE_SIZE];
+char serial[BATTERY_SERIAL_SIZE];
+char name[BATTERY_DEVICE_NAME_SIZE];
+char chemistry[BATTERY_CHEMISTRY_SIZE];
+char design_capacity[BATTERY_CAPACITY_SIZE];
+char design_voltage[BATTERY_DESIGN_VOLTAGE_SIZE];
+char sbds[BATTERY_SBDS_SIZE];
+char sbds_serial[BATTERY_SBDS_SERIAL_SIZE];
+char maximum_error[BATTERY_MAXIMUM_ERROR_SIZE];
+char sbds_manufacture_date[BATTERY_SBDS_MANUFACTURE_DATE_SIZE];
+char sbds_chemistry[BATTERY_SBDS_CHEMISTRY_SIZE];
+char oem_info[BATTERY_OEM_INFO_SIZE];
+/* The filled field have to be set to true when the dmitable implement that item */
+bool filled;
+} s_battery;
+
+const char *dmi_battery_chemistry(uint8_t code);
+void dmi_battery_capacity(uint16_t code, uint8_t multiplier,char *capacity);
+void dmi_battery_voltage(uint16_t code, char *voltage);
+void dmi_battery_maximum_error(uint8_t code, char *error);
+#endif
diff --git a/com32/gplinclude/dmi/dmi_bios.h b/com32/gplinclude/dmi/dmi_bios.h
new file mode 100644
index 00000000..546bbefc
--- /dev/null
+++ b/com32/gplinclude/dmi/dmi_bios.h
@@ -0,0 +1,107 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2006 Erwan Velu - All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+ * Boston MA 02111-1307, USA; either version 2 of the License, or
+ * (at your option) any later version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+#ifndef DMI_BIOS_H
+#define DMI_BIOS_H
+
+#include "stdbool.h"
+#define BIOS_VENDOR_SIZE 32
+#define BIOS_VERSION_SIZE 32
+#define BIOS_RELEASE_SIZE 16
+#define BIOS_RUNTIME_SIZE_UNIT_SIZE 16
+#define BIOS_ROM_UNIT_SIZE 16
+#define BIOS_BIOS_REVISION_SIZE 16
+#define BIOS_FIRMWARE_REVISION_SIZE 16
+
+#define BIOS_CHAR_NB_ELEMENTS 28
+#define BIOS_CHAR_X1_NB_ELEMENTS 8
+#define BIOS_CHAR_X2_NB_ELEMENTS 3
+
+extern const char *bios_charac_strings[];
+
+/* this struct has BIOS_CHAR_NB_ELEMENTS */
+/* each bool is associated with the relevant message above */
+typedef struct {
+bool bios_characteristics_not_supported;
+bool isa;
+bool mca;
+bool eisa;
+bool pci;
+bool pc_card;
+bool pnp;
+bool apm;
+bool bios_upgreadable;
+bool bios_shadowing;
+bool vlb;
+bool escd;
+bool boot_from_cd;
+bool selectable_boot;
+bool bios_rom_socketed;
+bool edd;
+bool japanese_floppy_nec_9800_1_2MB;
+bool japanese_floppy_toshiba_1_2MB;
+bool floppy_5_25_360KB;
+bool floppy_5_25_1_2MB;
+bool floppy_3_5_720KB;
+bool floppy_3_5_2_88MB;
+bool print_screen;
+bool keyboard_8042_support;
+bool serial_support;
+bool printer_support;
+bool cga_mono_support;
+bool nec_pc_98;
+} __attribute__((__packed__)) s_characteristics;
+
+extern const char *bios_charac_x1_strings[];
+
+/* this struct has BIOS_CHAR_X1_NB_ELEMENTS */
+/* each bool is associated with the relevant message above */
+typedef struct {
+bool acpi;
+bool usb_legacy;
+bool agp;
+bool i2o_boot;
+bool ls_120_boot;
+bool zip_drive_boot;
+bool ieee_1394_boot;
+bool smart_battery;
+} __attribute__((__packed__)) s_characteristics_x1;
+
+extern const char *bios_charac_x2_strings[];
+
+/* this struct has BIOS_CHAR_X2_NB_ELEMENTS */
+/* each bool is associated with the relevant message above */
+typedef struct {
+bool bios_boot_specification;
+bool bios_network_boot_by_keypress;
+bool target_content_distribution;
+} __attribute__((__packed__)) s_characteristics_x2;
+
+typedef struct {
+char vendor[BIOS_VENDOR_SIZE];
+char version[BIOS_VERSION_SIZE];
+char release_date[BIOS_RELEASE_SIZE];
+uint16_t address;
+uint16_t runtime_size;
+char runtime_size_unit[BIOS_RUNTIME_SIZE_UNIT_SIZE];
+uint16_t rom_size;
+char rom_size_unit[BIOS_ROM_UNIT_SIZE];
+s_characteristics characteristics;
+s_characteristics_x1 characteristics_x1;
+s_characteristics_x2 characteristics_x2;
+char bios_revision [BIOS_BIOS_REVISION_SIZE];
+char firmware_revision [BIOS_FIRMWARE_REVISION_SIZE];
+/* The filled field have to be set to true when the dmitable implement that item */
+bool filled;
+} s_bios;
+
+#endif
diff --git a/com32/gplinclude/dmi/dmi_chassis.h b/com32/gplinclude/dmi/dmi_chassis.h
new file mode 100644
index 00000000..96711ed4
--- /dev/null
+++ b/com32/gplinclude/dmi/dmi_chassis.h
@@ -0,0 +1,50 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2006 Erwan Velu - All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+ * Boston MA 02111-1307, USA; either version 2 of the License, or
+ * (at your option) any later version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+#ifndef DMI_CHASSIS_H
+#define DMI_CHASSIS_H
+
+#define CHASSIS_MANUFACTURER_SIZE 32
+#define CHASSIS_TYPE_SIZE 16
+#define CHASSIS_LOCK_SIZE 16
+#define CHASSIS_VERSION_SIZE 16
+#define CHASSIS_SERIAL_SIZE 32
+#define CHASSIS_ASSET_TAG_SIZE 32
+#define CHASSIS_BOOT_UP_STATE_SIZE 32
+#define CHASSIS_POWER_SUPPLY_STATE_SIZE 32
+#define CHASSIS_THERMAL_STATE_SIZE 32
+#define CHASSIS_SECURITY_STATUS_SIZE 32
+#define CHASSIS_OEM_INFORMATION_SIZE 32
+
+typedef struct {
+char manufacturer[CHASSIS_MANUFACTURER_SIZE];
+char type[CHASSIS_TYPE_SIZE];
+char lock[CHASSIS_LOCK_SIZE];
+char version[CHASSIS_VERSION_SIZE];
+char serial[CHASSIS_SERIAL_SIZE];
+char asset_tag[CHASSIS_ASSET_TAG_SIZE];
+char boot_up_state[CHASSIS_BOOT_UP_STATE_SIZE];
+char power_supply_state[CHASSIS_POWER_SUPPLY_STATE_SIZE];
+char thermal_state[CHASSIS_THERMAL_STATE_SIZE];
+char security_status[CHASSIS_SECURITY_STATUS_SIZE];
+char oem_information[CHASSIS_OEM_INFORMATION_SIZE];
+uint16_t height;
+uint16_t nb_power_cords;
+/* The filled field have to be set to true when the dmitable implement that item */
+bool filled;
+} s_chassis;
+
+const char *dmi_chassis_type(uint8_t code);
+const char *dmi_chassis_lock(uint8_t code);
+const char *dmi_chassis_state(uint8_t code);
+const char *dmi_chassis_security_status(uint8_t code);
+#endif
diff --git a/com32/gplinclude/dmi/dmi_memory.h b/com32/gplinclude/dmi/dmi_memory.h
new file mode 100644
index 00000000..2b744b5c
--- /dev/null
+++ b/com32/gplinclude/dmi/dmi_memory.h
@@ -0,0 +1,61 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2009 Erwan Velu - All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+ * Boston MA 02111-1307, USA; either version 2 of the License, or
+ * (at your option) any later version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+#ifndef DMI_MEMORY_H
+#define DMI_MEMORY_H
+
+#define MEMORY_MANUFACTURER_SIZE 32
+#define MEMORY_ERROR_SIZE 16
+#define MEMORY_TOTAL_WIDTH_SIZE 16
+#define MEMORY_DATA_WIDTH_SIZE 16
+#define MEMORY_SIZE_SIZE 32
+#define MEMORY_FORM_FACTOR_SIZE 32
+#define MEMORY_DEVICE_SET_SIZE 32
+#define MEMORY_DEVICE_LOCATOR_SIZE 32
+#define MEMORY_BANK_LOCATOR_SIZE 32
+#define MEMORY_TYPE_SIZE 32
+#define MEMORY_TYPE_DETAIL_SIZE 16
+#define MEMORY_SPEED_SIZE 16
+#define MEMORY_SERIAL_SIZE 16
+#define MEMORY_ASSET_TAG_SIZE 16
+#define MEMORY_PART_NUMBER_SIZE 16
+
+typedef struct {
+char manufacturer[MEMORY_MANUFACTURER_SIZE];
+char error[MEMORY_ERROR_SIZE];
+char total_width[MEMORY_TOTAL_WIDTH_SIZE];
+char data_width[MEMORY_DATA_WIDTH_SIZE];
+char size[MEMORY_SIZE_SIZE];
+char form_factor[MEMORY_FORM_FACTOR_SIZE];
+char device_set[MEMORY_DEVICE_SET_SIZE];
+char device_locator[MEMORY_DEVICE_LOCATOR_SIZE];
+char bank_locator[MEMORY_BANK_LOCATOR_SIZE];
+char type[MEMORY_TYPE_SIZE];
+char type_detail[MEMORY_TYPE_DETAIL_SIZE];
+char speed[MEMORY_SPEED_SIZE];
+char serial[MEMORY_SERIAL_SIZE];
+char asset_tag[MEMORY_ASSET_TAG_SIZE];
+char part_number[MEMORY_PART_NUMBER_SIZE];
+/* The filled field have to be set to true when the dmitable implement that item */
+bool filled;
+} s_memory;
+
+void dmi_memory_array_error_handle(uint16_t code,char *array);
+void dmi_memory_device_width(uint16_t code, char *width);
+void dmi_memory_device_size(uint16_t code, char *size);
+const char *dmi_memory_device_form_factor(uint8_t code);
+void dmi_memory_device_set(uint8_t code, char *set);
+const char *dmi_memory_device_type(uint8_t code);
+void dmi_memory_device_type_detail(uint16_t code,char *type_detail);
+void dmi_memory_device_speed(uint16_t code, char *speed);
+
+#endif
diff --git a/com32/gplinclude/dmi/dmi_processor.h b/com32/gplinclude/dmi/dmi_processor.h
new file mode 100644
index 00000000..79ee43d4
--- /dev/null
+++ b/com32/gplinclude/dmi/dmi_processor.h
@@ -0,0 +1,111 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2006 Erwan Velu - All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+ * Boston MA 02111-1307, USA; either version 2 of the License, or
+ * (at your option) any later version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+#ifndef DMI_PROCESSOR_H
+#define DMI_PROCESSOR_H
+
+#include "stdbool.h"
+#include "string.h"
+#define PROCESSOR_SOCKET_DESIGNATION_SIZE 32
+#define PROCESSOR_TYPE_SIZE 32
+#define PROCESSOR_FAMILY_SIZE 32
+#define PROCESSOR_MANUFACTURER_SIZE 64
+#define PROCESSOR_VERSION_SIZE 32
+#define PROCESSOR_VOLTAGE_SIZE 16
+#define PROCESSOR_STATUS_SIZE 16
+#define PROCESSOR_UPGRADE_SIZE 16
+#define PROCESSOR_CACHE_SIZE 16
+#define PROCESSOR_SERIAL_SIZE 32
+#define PROCESSOR_ASSET_TAG_SIZE 32
+#define PROCESSOR_PART_NUMBER_SIZE 32
+#define PROCESSOR_ID_SIZE 32
+
+#define PROCESSOR_FLAGS_ELEMENTS 32
+/* Intel AP-485 revision 28, table 5 */
+extern const char *cpu_flags_strings[PROCESSOR_FLAGS_ELEMENTS];
+
+/* this struct have PROCESSOR_FLAGS_ELEMENTS */
+/* each bool is associated to the relevant message above */
+typedef struct {
+bool fpu;
+bool vme;
+bool de;
+bool pse;
+bool tsc;
+bool msr;
+bool pae;
+bool mce;
+bool cx8;
+bool apic;
+bool null_10;
+bool sep;
+bool mtrr;
+bool pge;
+bool mca;
+bool cmov;
+bool pat;
+bool pse_36;
+bool psn;
+bool clfsh;
+bool null_20;
+bool ds;
+bool acpi;
+bool mmx;
+bool fxsr;
+bool sse;
+bool sse2;
+bool ss;
+bool htt;
+bool tm;
+bool null_30;
+bool pbe;
+} __attribute__((__packed__)) s_dmi_cpu_flags;
+
+typedef struct {
+uint8_t type;
+uint8_t family;
+uint8_t model;
+uint8_t stepping;
+uint8_t minor_stepping;
+} __attribute__((__packed__)) s_signature;
+
+typedef struct {
+char socket_designation[PROCESSOR_SOCKET_DESIGNATION_SIZE];
+char type[PROCESSOR_TYPE_SIZE];
+char family[PROCESSOR_FAMILY_SIZE];
+char manufacturer[PROCESSOR_MANUFACTURER_SIZE];
+char version[PROCESSOR_VERSION_SIZE];
+float voltage;
+uint16_t external_clock;
+uint16_t max_speed;
+uint16_t current_speed;
+char status[PROCESSOR_STATUS_SIZE];
+char upgrade[PROCESSOR_UPGRADE_SIZE];
+char cache1[PROCESSOR_CACHE_SIZE];
+char cache2[PROCESSOR_CACHE_SIZE];
+char cache3[PROCESSOR_CACHE_SIZE];
+char serial[PROCESSOR_SERIAL_SIZE];
+char asset_tag[PROCESSOR_ASSET_TAG_SIZE];
+char part_number[PROCESSOR_PART_NUMBER_SIZE];
+char id[PROCESSOR_ID_SIZE];
+s_dmi_cpu_flags cpu_flags;
+s_signature signature;
+/* The filled field have to be set to true when the dmitable implement that item */
+bool filled;
+} s_processor;
+
+const char *dmi_processor_type(uint8_t code);
+const char *dmi_processor_family(uint8_t code, char *manufacturer);
+const char *dmi_processor_status(uint8_t code);
+const char *dmi_processor_upgrade(uint8_t code);
+void dmi_processor_cache(uint16_t code, const char *level, uint16_t ver, char *cache);
+#endif
diff --git a/com32/gplinclude/dmi/dmi_system.h b/com32/gplinclude/dmi/dmi_system.h
new file mode 100644
index 00000000..5a461d5f
--- /dev/null
+++ b/com32/gplinclude/dmi/dmi_system.h
@@ -0,0 +1,38 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2006 Erwan Velu - All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+ * Boston MA 02111-1307, USA; either version 2 of the License, or
+ * (at your option) any later version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+#ifndef DMI_SYSTEM_H
+#define DMI_SYSTEM_H
+
+#define SYSTEM_MANUFACTURER_SIZE 32
+#define SYSTEM_PRODUCT_NAME_SIZE 32
+#define SYSTEM_VERSION_SIZE 16
+#define SYSTEM_SERIAL_SIZE 32
+#define SYSTEM_UUID_SIZE 40
+#define SYSTEM_WAKEUP_TYPE_SIZE 32
+#define SYSTEM_SKU_NUMBER_SIZE 32
+#define SYSTEM_FAMILY_SIZE 32
+
+typedef struct {
+char manufacturer[SYSTEM_MANUFACTURER_SIZE];
+char product_name[SYSTEM_PRODUCT_NAME_SIZE];
+char version[SYSTEM_VERSION_SIZE];
+char serial[SYSTEM_SERIAL_SIZE];
+char uuid[SYSTEM_UUID_SIZE];
+char wakeup_type[SYSTEM_WAKEUP_TYPE_SIZE];
+char sku_number[SYSTEM_SKU_NUMBER_SIZE];
+char family[SYSTEM_FAMILY_SIZE];
+/* The filled field have to be set to true when the dmitable implement that item */
+bool filled;
+} s_system;
+
+#endif