diff options
author | Sebastian Schmelzer | 2010-10-25 16:53:54 +0200 |
---|---|---|
committer | Sebastian Schmelzer | 2010-10-25 16:53:54 +0200 |
commit | 3050a9253437f4a4b5ad4bf3b3efdc3c660a5137 (patch) | |
tree | 91ac22153e416aac7ca20916b314b5e2ffa871b1 /contrib/syslinux-4.02/com32/gplinclude | |
download | preboot-master.tar.gz preboot-master.tar.xz preboot-master.zip |
Diffstat (limited to 'contrib/syslinux-4.02/com32/gplinclude')
26 files changed, 1647 insertions, 0 deletions
diff --git a/contrib/syslinux-4.02/com32/gplinclude/README b/contrib/syslinux-4.02/com32/gplinclude/README new file mode 100644 index 0000000..ac1bf6a --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/README @@ -0,0 +1 @@ +Put header files for LGPL or GPL library functions in this directory. diff --git a/contrib/syslinux-4.02/com32/gplinclude/cpuid.h b/contrib/syslinux-4.02/com32/gplinclude/cpuid.h new file mode 100644 index 0000000..bc9df17 --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/cpuid.h @@ -0,0 +1,269 @@ +/* ----------------------------------------------------------------------- * + * + * Copyright 2006-2009 Erwan Velu - All Rights Reserved + * + * 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 version 2 + * as published by the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston MA 02110-1301; + * incorporated herein by reference. + * + * ----------------------------------------------------------------------- */ + +#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 pbe; /* Pending Break Enable */ + 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 fxsr_opt; /* FXSAVE/FXRSTOR optimizations */ + bool gbpages; /* "pdpe1gb" GB pages */ + bool rdtscp; /* RDTSCP */ + bool lm; /* Long Mode (x86-64) */ + bool nowext; /* AMD 3DNow! extensions */ + bool now; /* 3DNow! */ + bool smp; /* A smp configuration has been found */ + bool pni; /* Streaming SIMD Extensions-3 */ + bool pclmulqd; /* PCLMULQDQ instruction */ + bool dtes64; /* 64-bit Debug Store */ + bool vmx; /* Hardware virtualization */ + bool smx; /* Safer Mode */ + bool est; /* Enhanced SpeedStep */ + bool tm2; /* Thermal Monitor 2 */ + bool sse3; /* Supplemental SSE-3 */ + bool cid; /* Context ID */ + bool fma; /* Fused multiply-add */ + bool cx16; /* CMPXCHG16B */ + bool xtpr; /* Send Task Priority Messages */ + bool pdcm; /* Performance Capabilities */ + bool dca; /* Direct Cache Access */ + bool xmm4_1; /* "sse4_1" SSE-4.1 */ + bool xmm4_2; /* "sse4_2" SSE-4.2 */ + bool x2apic; /* x2APIC */ + bool movbe; /* MOVBE instruction */ + bool popcnt; /* POPCNT instruction */ + bool aes; /* AES Instruction */ + bool xsave; /* XSAVE/XRSTOR/XSETBV/XGETBV */ + bool osxsave; /* XSAVE enabled in the OS */ + bool avx; /* Advanced Vector Extensions */ + bool hypervisor; /* Running on a hypervisor */ + bool ace2; /* Advanced Cryptography Engine v2 */ + bool ace2_en; /* ACE v2 enabled */ + bool phe; /* PadLock Hash Engine */ + bool phe_en; /* PadLock Hash Engine Enabled */ + bool pmm; /* PadLock Montgomery Multiplier */ + bool pmm_en; /* PadLock Montgomery Multiplier enabled */ + bool svm; /* Secure virtual machine */ + bool extapic; /* Extended APIC space */ + bool cr8_legacy; /* CR8 in 32-bit mode */ + bool abm; /* Advanced bit manipulation */ + bool sse4a; /* SSE4-A */ + bool misalignsse; /* Misaligned SSE mode */ + bool nowprefetch; /* 3DNow prefetch instructions */ + bool osvw; /* OS Visible Workaround */ + bool ibs; /* Instruction Based Sampling */ + bool sse5; /* SSE5 */ + bool skinit; /* SKINIT/STGI instructions */ + bool wdt; /* Watchdog Timer */ + bool ida; /* Intel Dynamic Acceleration */ + bool arat; /* Always Running APIC Timer */ + bool tpr_shadow; /* Intel TPR Shadow */ + bool vnmi; /* Intel Virtual NMI */ + bool flexpriority; /* Intel FlexPriority */ + bool ept; /* Intel Extended Page Table */ + bool vpid; /* Intel Virtual Processor ID */ +} 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; + uint8_t num_cores; + uint16_t l1_data_cache_size; + uint16_t l1_instruction_cache_size; + uint16_t l2_cache_size; + 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]; + uint16_t x86_l1_data_cache_size; /* in KB, if available */ + uint16_t x86_l1_instruction_cache_size; /* in KB, if available */ + uint16_t x86_l2_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_num_cores; /* cpuid returned the number of cores */ + unsigned char booted_cores; /* number of cores as seen by OS */ + unsigned char apicid; + unsigned char x86_clflush_size; + +} __attribute__ ((__packed__)); + +struct cpu_model_info { + int vendor; + int family; + char *model_names[16]; +}; + +/* attempt to consolidate cpu attributes */ +struct cpu_dev { + const char *c_vendor; + + /* some have two possibilities for cpuid string */ + const 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); +#endif diff --git a/contrib/syslinux-4.02/com32/gplinclude/disk/bootloaders.h b/contrib/syslinux-4.02/com32/gplinclude/disk/bootloaders.h new file mode 100644 index 0000000..56a0f4e --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/disk/bootloaders.h @@ -0,0 +1,19 @@ +/* ----------------------------------------------------------------------- * + * + * Copyright 2009 Pierre-Alexandre Meyer + * + * This file is part of Syslinux, and is made available under + * the terms of the GNU General Public License version 2. + * + * ----------------------------------------------------------------------- */ + +#ifndef __BOOTLOADERS_H_ +#define __BOOTLOADERS_H_ + +#include <stdint.h> +#include <disk/geom.h> +#include <disk/partition.h> + +int get_bootloader_string(struct driveinfo *, const struct part_entry *, + char *, const int); +#endif /* __BOOTLOADERS_H_ */ diff --git a/contrib/syslinux-4.02/com32/gplinclude/disk/common.h b/contrib/syslinux-4.02/com32/gplinclude/disk/common.h new file mode 100644 index 0000000..4e415c1 --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/disk/common.h @@ -0,0 +1,33 @@ +/* ----------------------------------------------------------------------- * + * + * Copyright 2009 Pierre-Alexandre Meyer + * + * Some parts borrowed from chain.c32: + * + * Copyright 2003-2009 H. Peter Anvin - All Rights Reserved + * Copyright 2009 Intel Corporation; author: H. Peter Anvin + * + * This file is part of Syslinux, and is made available under + * the terms of the GNU General Public License version 2. + * + * ----------------------------------------------------------------------- */ + +#ifndef _COMMON_H_ +#define _COMMON_H_ + +#include <stdint.h> + +/* For PAGE_SIZE */ +#include <cpuid.h> + +#define SECTOR 512 /* bytes/sector */ + +struct ebios_dapa { + uint16_t len; + uint16_t count; + uint16_t off; + uint16_t seg; + uint64_t lba; +}; + +#endif /* _COMMON_H_ */ diff --git a/contrib/syslinux-4.02/com32/gplinclude/disk/errno_disk.h b/contrib/syslinux-4.02/com32/gplinclude/disk/errno_disk.h new file mode 100644 index 0000000..68bd89d --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/disk/errno_disk.h @@ -0,0 +1,50 @@ +/* ----------------------------------------------------------------------- * + * + * Copyright 2009 Pierre-Alexandre Meyer + * + * This file is part of Syslinux, and is made available under + * the terms of the GNU General Public License version 2. + * + * ----------------------------------------------------------------------- */ + +#ifndef _ERRNO_DISK_H +#define _ERRNO_DISK_H + +extern int errno_disk; + +/* Prefix with ED to avoid confusion with errno */ +#define EDINV 0x01 /* Invalid function in AH or invalid parameter */ +#define EDADDR 0x02 /* Address mark not found */ +#define EDRO 0x03 /* Disk write-protected */ +#define EDNOFND 0x04 /* Sector not found/read error */ +#define EDRFAIL 0x05 /* Reset failed (hard disk) */ +#define EDCHANG 0x06 /* Disk changed (floppy) */ +#define EDFAIL 0x07 /* Drive parameter activity failed (hard disk) */ +#define EDDMA 0x08 /* DMA overrun */ +#define EDBOUND 0x09 /* Data boundary error (attempted DMA across 64K boundary or >80h sectors) */ +#define EDBADS 0x0A /* Bad sector detected (hard disk) */ +#define EDBADT 0x0B /* Bad track detected (hard disk) */ +#define EDINVM 0x0C /* Unsupported track or invalid media */ +#define EDINVS 0x0D /* Invalid number of sectors on format (PS/2 hard disk) */ +#define EDADDRM 0x0E /* Control data address mark detected (hard disk) */ +#define EDDMARG 0x0F /* DMA arbitration level out of range (hard disk) */ +#define EDCRCF 0x10 /* Uncorrectable CRC or ECC error on read */ +#define EDCRCV 0x11 /* Data ECC corrected (hard disk) */ +#define EDCTRL 0x20 /* Controller failure */ +#define EDMEDIA 0x31 /* No media in drive (IBM/MS INT 13 extensions) */ +#define EDCMOS 0x32 /* Incorrect drive type stored in CMOS (Compaq) */ +#define EDSEEKF 0x40 /* Seek failed */ +#define EDTIME 0x80 /* Timeout (not ready) */ +#define EDREADY 0xAA /* Drive not ready (hard disk) */ +#define EDNLOCK 0xB0 /* Volume not locked in drive (INT 13 extensions) */ +#define EDLOCK 0xB1 /* Volume locked in drive (INT 13 extensions) */ +#define EDREMOV 0xB2 /* Volume not removable (INT 13 extensions) */ +#define EDUSED 0xB3 /* Volume in use (INT 13 extensions) */ +#define EDCOUNT 0xB4 /* Lock count exceeded (INT 13 extensions) */ +#define EDEJF 0xB5 /* Valid eject request failed (INT 13 extensions) */ +#define EDUNKOWN 0xBB /* Undefined error (hard disk) */ +#define EDWF 0xCC /* Write fault (hard disk) */ +#define EDRF 0xE0 /* Status register error (hard disk) */ +#define EDSF 0xFF /* Sense operation failed (hard disk) */ + +#endif /* _ERRNO_DISK_H */ diff --git a/contrib/syslinux-4.02/com32/gplinclude/disk/error.h b/contrib/syslinux-4.02/com32/gplinclude/disk/error.h new file mode 100644 index 0000000..e00266f --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/disk/error.h @@ -0,0 +1,13 @@ +/* ----------------------------------------------------------------------- * + * + * Copyright 2009 Pierre-Alexandre Meyer + * + * This file is part of Syslinux, and is made available under + * the terms of the GNU General Public License version 2. + * + * ----------------------------------------------------------------------- */ + +#ifndef _ERROR_H_ +#define _ERROR_H_ +void get_error(const char *); +#endif /* _ERROR_H_ */ diff --git a/contrib/syslinux-4.02/com32/gplinclude/disk/geom.h b/contrib/syslinux-4.02/com32/gplinclude/disk/geom.h new file mode 100644 index 0000000..359c7cf --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/disk/geom.h @@ -0,0 +1,326 @@ +/* ----------------------------------------------------------------------- * + * + * Copyright 2009 Pierre-Alexandre Meyer + * + * Some parts borrowed from chain.c32: + * + * Copyright 2003-2009 H. Peter Anvin - All Rights Reserved + * Copyright 2009 Intel Corporation; author: H. Peter Anvin + * + * Some parts borrowed from Linux: + * + * Copyright (C) 2002, 2003, 2004 Dell Inc. + * by Matt Domsch <Matt_Domsch@dell.com> + * + * This file is part of Syslinux, and is made available under + * the terms of the GNU General Public License version 2. + * + * ----------------------------------------------------------------------- */ + +#ifndef _GEOM_H_ +#define _GEOM_H_ + +#include <stdint.h> + +/** + * INT 13 Extensions + * + * Note: if the size is less than 30 on call, the final DWORD will not be + * returned by a v2.x implementation; similarly for the Device Path info + **/ +struct edd_device_parameters { + uint16_t len; /* size of returned data */ + /** + * Bitfields for IBM/MS INT 13 Extensions information flags: + * Bit(s) Description (Table 00274) + * 0 DMA boundary errors handled transparently + * 1 cylinder/head/sectors-per-track information is valid + * 2 removable drive + * 3 write with verify supported + * 4 drive has change-line support (required if drive >= 80h is removable) + * 5 drive can be locked (required if drive >= 80h is removable) + * 6 CHS information set to maximum supported values, not current media + * 15-7 reserved (0) + **/ + uint16_t info; /* information flags */ + uint32_t cylinders; /* number of physical cylinders on drive */ + uint32_t heads; /* number of physical heads on drive */ + uint32_t sectors_per_track; /* number of physical sectors per track */ + uint64_t sectors; /* total number of sectors on drive */ + uint16_t bytes_per_sector; /* bytes per sector */ + /* --- v2.0+ --- */ + uint32_t dpte_pointer; /* EDD configuration parameters, FFFFh:FFFFh if not available */ + /* --- v3.0 --- */ + uint16_t device_path_information; /* signature BEDDh to indicate presence of Device Path info */ + uint8_t device_path_length; /* length of Device Path information, including signature and this byte (24h for v3.0) */ + uint8_t device_path_reserved; /* reserved (0) */ + uint16_t device_path_reserved_2; /* reserved (0) */ + uint8_t host_bus_type[4]; /* ASCIZ name of host bus ("ISA" or "PCI") */ + uint8_t interface_type[8]; /* ASCIZ name of interface type + * "ATA" + * "ATAPI" + * "SCSI" + * "USB" + * "1394" IEEE 1394 (FireWire) + * "FIBRE" Fibre Channel + */ + /** + * Format of EDD v3.0 Interface Path: + * Offset Size Description (Table 00275) + * ---ISA--- + * 00h WORD 16-bit base address + * 02h 6 BYTEs reserved (0) + * ---PCI--- + * 00h BYTE PCI bus number + * 01h BYTE PCI device number + * 02h BYTE PCI function number + * 03h 5 BYTEs reserved (0) + **/ + union { + struct { + uint16_t base_address; + uint16_t reserved1; + uint32_t reserved2; + } __attribute__ ((packed)) isa; + struct { + uint8_t bus; + uint8_t slot; + uint8_t function; + uint8_t channel; + uint32_t reserved; + } __attribute__ ((packed)) pci; + /* pcix is same as pci */ + struct { + uint64_t reserved; + } __attribute__ ((packed)) ibnd; + struct { + uint64_t reserved; + } __attribute__ ((packed)) xprs; + struct { + uint64_t reserved; + } __attribute__ ((packed)) htpt; + struct { + uint64_t reserved; + } __attribute__ ((packed)) unknown; + } interface_path; + /** + * Format of EDD v3.0 Device Path: + * Offset Size Description (Table 00276) + * ---ATA--- + * 00h BYTE flag: 00h = master, 01h = slave + * 01h 7 BYTEs reserved (0) + * ---ATAPI--- + * 00h BYTE flag: 00h = master, 01h = slave + * 01h BYTE logical unit number + * 02h 6 BYTEs reserved (0) + * ---SCSI--- + * 00h BYTE logical unit number + * 01h 7 BYTEs reserved (0) + * ---USB--- + * 00h BYTE to be determined + * 01h 7 BYTEs reserved (0) + * ---IEEE1394--- + * 00h QWORD 64-bit FireWire General Unique Identifier (GUID) + * ---FibreChannel--- + * 00h QWORD Word Wide Number (WWN) + **/ + union { + struct { + uint8_t device; + uint8_t reserved1; + uint16_t reserved2; + uint32_t reserved3; + uint64_t reserved4; + } __attribute__ ((packed)) ata; + struct { + uint8_t device; + uint8_t lun; + uint8_t reserved1; + uint8_t reserved2; + uint32_t reserved3; + uint64_t reserved4; + } __attribute__ ((packed)) atapi; + struct { + uint16_t id; + uint64_t lun; + uint16_t reserved1; + uint32_t reserved2; + } __attribute__ ((packed)) scsi; + struct { + uint64_t serial_number; + uint64_t reserved; + } __attribute__ ((packed)) usb; + struct { + uint64_t eui; + uint64_t reserved; + } __attribute__ ((packed)) i1394; + struct { + uint64_t wwid; + uint64_t lun; + } __attribute__ ((packed)) fibre; + struct { + uint64_t identity_tag; + uint64_t reserved; + } __attribute__ ((packed)) i2o; + struct { + uint32_t array_number; + uint32_t reserved1; + uint64_t reserved2; + } __attribute__ ((packed)) raid; + struct { + uint8_t device; + uint8_t reserved1; + uint16_t reserved2; + uint32_t reserved3; + uint64_t reserved4; + } __attribute__ ((packed)) sata; + struct { + uint64_t reserved1; + uint64_t reserved2; + } __attribute__ ((packed)) unknown; + } device_path; + uint8_t reserved; /* reserved (0) */ + uint8_t checksum; /* checksum of bytes 1Eh-40h (two's complement of sum, which makes + * the 8-bit sum of bytes 1Eh-41h equal 00h) */ +} __attribute__ ((packed)); + +/* + * Disk parameters + */ +struct driveinfo { + int disk; /* Disk port (0x80 - 0xff) */ + /* Legacy C/H/S */ + int cbios; /* CHS geometry is valid */ + int legacy_max_head; + int legacy_max_cylinder; + int legacy_sectors_per_track; + int legacy_max_drive; + int legacy_type; /* Drive type (AT/PS2 floppies only) */ + /* EDD support */ + int ebios; /* EBIOS supported on this disk */ + int edd_version; /* EBIOS major version */ + int edd_functionality_subset; + struct edd_device_parameters edd_params; /* EDD parameters */ +}; + +/** + * Format of Phoenix Enhanced Disk Drive Spec translated drive parameter table: + * Offset Size Description (Table 00277) + * 00h WORD number of cylinders + * 02h BYTE number of heads + * 03h BYTE A0h (signature indicating translated table) + * 04h BYTE number of physical sectors per track + * 05h WORD starting write precompensation cylinder number + * 07h BYTE reserved + * 08h BYTE control byte (see #03198 at INT 41"DISK 0") + * 09h WORD number of physical cylinders + * 0Bh BYTE number of physical heads + * 0Ch WORD cylinder number of landing zone + * 0Eh BYTE number of logical sectors per track + * 0Fh BYTE checksum + * Program: the Phoenix Enhanced Disk Drive Specification is an addition to the + * IBM/MS INT 13 extensions + * + * Format of Phoenix Enhanced Disk Drive Spec Fixed Disk Parameter Table: + * Offset Size Description (Table 00278) + * 00h WORD physical I/O port base address + * 02h WORD disk-drive control port address + * 04h BYTE drive flags (see #00279) + * 05h BYTE proprietary information + * bits 7-4 reserved (0) + * bits 3-0: Phoenix proprietary (used by BIOS) + * 06h BYTE IRQ for drive (bits 3-0; bits 7-4 reserved and must be 0) + * 07h BYTE sector count for multi-sector transfers + * 08h BYTE DMA control + * bits 7-4: DMA type (0-2) as per ATA-2 specification + * bits 3-0: DMA channel + * 09h BYTE programmed I/O control + * bits 7-4: reserved (0) + * bits 3-0: PIO type (1-4) as per ATA-2 specification + * 0Ah WORD drive options (see #00280) + * 0Ch 2 BYTEs reserved (0) + * 0Eh BYTE extension revision level (high nybble=major, low nybble=minor) + * (currently 10h for v1.0 and 11h for v1.1-3.0) + * 0Fh BYTE 2's complement checksum of bytes 00h-0Eh + * 8-bit sum of all bytes 00h-0Fh should equal 00h + * SeeAlso: #00277 + * + * Bitfields for Phoenix Enhanced Disk Drive Spec drive flags: + * Bit(s) Description (Table 00279) + * 7 reserved (1) + * 6 LBA enabled + * 5 reserved (1) + * 4 drive is slave + * 3-0 reserved (0) + * SeeAlso: #00278,#00280 + * + * Bitfields for Phoenix Enhanced Disk Drive Spec drive options: + * Bit(s) Description (Table 00280) + * 0 fast PIO enabled + * 1 fast DMA access enabled + * 2 block PIO (multi-sector transfers) enabled + * 3 CHS translation enabled + * 4 LBA translation enabled + * 5 removable media + * 6 ATAPI device (CD-ROM) + * 7 32-bit transfer mode + * ---v1.1+ --- + * 8 ATAPI device uses DRQ to signal readiness for packet command + * (must be 0 if bit 6 is 0) + * 10-9 translation type (must be 00 if bit 3 is 0) + * 00 Phoenix bit-shifting translation + * 01 LBA-assisted translation + * 10 reserved + * 11 proprietary translation + * ---v3.0--- + * 11 Ultra DMA access enabled + * 15-12 reserved + **/ + +/* + * Values for diskette drive type: + * 01h 360K + * 02h 1.2M + * 03h 720K + * 04h 1.44M + * 05h ??? + * reportedly an obscure drive type shipped on some IBM machines, + * 2.88M on some machines (at least AMI 486 BIOS) + * 06h 2.88M + * 10h ATAPI Removable Media Device + */ +enum diskette_drive_types { + DISKETTE_360K = 1, + DISKETTE_1_2M = 2, + DISKETTE_720K = 3, + DISKETTE_1_44M = 4, + DISKETTE_2_88M = 6, + DISKETTE_ATAPI = 10, +}; + +/** + * chs_to_lba - compute lba value from cylinder, head and sector number + **/ +static inline int chs_to_lba(const struct driveinfo *drive_info, + const unsigned int cylinder, + const unsigned int head, const unsigned int sector) +{ + /* Use EDD, if valid */ + if (drive_info->edd_params.sectors_per_track > 0 && + drive_info->edd_params.heads > 0) + return (sector - 1) + + (head * drive_info->edd_params.sectors_per_track) + + (cylinder * (drive_info->edd_params.heads) * + drive_info->edd_params.sectors_per_track); + else if (drive_info->cbios) + return (sector - 1) + (head * drive_info->legacy_sectors_per_track) + + (cylinder * (drive_info->legacy_max_head + 1) * + drive_info->legacy_sectors_per_track); +} + +void lba_to_chs(const struct driveinfo *drive_info, const int lba, + unsigned int *cylinder, unsigned int *head, + unsigned int *sector); +int get_drive_parameters(struct driveinfo *drive_info); + +#endif /* _GEOM_H */ diff --git a/contrib/syslinux-4.02/com32/gplinclude/disk/mbrs.h b/contrib/syslinux-4.02/com32/gplinclude/disk/mbrs.h new file mode 100644 index 0000000..ad104ff --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/disk/mbrs.h @@ -0,0 +1,18 @@ +/* ----------------------------------------------------------------------- * + * + * Copyright 2009 Pierre-Alexandre Meyer + * + * This file is part of Syslinux, and is made available under + * the terms of the GNU General Public License version 2. + * + * ----------------------------------------------------------------------- */ + +#ifndef __MBRS_H_ +#define __MBRS_H_ + +#include <stdint.h> +#include <disk/geom.h> + +void get_mbr_string(const uint32_t, void *, const int); +uint32_t get_mbr_id(const struct driveinfo *); +#endif /* __MBRS_H_ */ diff --git a/contrib/syslinux-4.02/com32/gplinclude/disk/msdos.h b/contrib/syslinux-4.02/com32/gplinclude/disk/msdos.h new file mode 100644 index 0000000..cb39dad --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/disk/msdos.h @@ -0,0 +1,19 @@ +/* ----------------------------------------------------------------------- * + * + * Copyright 2009 Pierre-Alexandre Meyer + * + * This file is part of Syslinux, and is made available under + * the terms of the GNU General Public License version 2. + * + * ----------------------------------------------------------------------- */ + +#ifndef _MSDOS_H_ +#define _MSDOS_H_ + +#include <disk/geom.h> +#include <disk/partition.h> + +typedef void (*p_callback) (struct driveinfo *, struct part_entry *, int, int); +int parse_partition_table(struct driveinfo *, p_callback); + +#endif /* _MSDOS_H_ */ diff --git a/contrib/syslinux-4.02/com32/gplinclude/disk/partition.h b/contrib/syslinux-4.02/com32/gplinclude/disk/partition.h new file mode 100644 index 0000000..5edf828 --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/disk/partition.h @@ -0,0 +1,37 @@ +/* ----------------------------------------------------------------------- * + * + * Copyright 2009 Pierre-Alexandre Meyer + * + * Some parts borrowed from chain.c32: + * + * Copyright 2003-2009 H. Peter Anvin - All Rights Reserved + * Copyright 2009 Intel Corporation; author: H. Peter Anvin + * + * This file is part of Syslinux, and is made available under + * the terms of the GNU General Public License version 2. + * + * ----------------------------------------------------------------------- */ + +#ifndef _PARTITION_H_ +#define _PARTITION_H_ + +#include <stdint.h> + +#define PARTITION_TABLES_OFFSET 0x1be + +/* A DOS partition table entry */ +struct part_entry { + uint8_t active_flag; /* 0x80 if "active" */ + uint8_t start_head; + uint8_t start_sect; + uint8_t start_cyl; + uint8_t ostype; + uint8_t end_head; + uint8_t end_sect; + uint8_t end_cyl; + uint32_t start_lba; + uint32_t length; +} __attribute__ ((packed)); + +void get_label(int label, char **buffer_label); +#endif /* _PARTITION_H_ */ diff --git a/contrib/syslinux-4.02/com32/gplinclude/disk/read.h b/contrib/syslinux-4.02/com32/gplinclude/disk/read.h new file mode 100644 index 0000000..08a9dd3 --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/disk/read.h @@ -0,0 +1,18 @@ +/* ----------------------------------------------------------------------- * + * + * Copyright 2009 Pierre-Alexandre Meyer + * + * This file is part of Syslinux, and is made available under + * the terms of the GNU General Public License version 2. + * + * ----------------------------------------------------------------------- */ + +#ifndef _READ_H_ +#define _READ_H_ + +#include <disk/geom.h> + +int read_mbr(int, void *); +int dev_read(int, void *, unsigned int, int); +int read_sectors(struct driveinfo *, void *, const unsigned int, const int); +#endif /* _READ_H */ diff --git a/contrib/syslinux-4.02/com32/gplinclude/disk/swsusp.h b/contrib/syslinux-4.02/com32/gplinclude/disk/swsusp.h new file mode 100644 index 0000000..3e9acac --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/disk/swsusp.h @@ -0,0 +1,19 @@ +#ifndef _SWSUSP_H_ +#define _SWSUSP_H_ + +#include <disk/geom.h> +#include <disk/common.h> +#include <disk/partition.h> + +#define SWSUSP_SIG "S1SUSPEND" + +struct swsusp_header { + char reserved[PAGE_SIZE - 20 - sizeof(unsigned long) - sizeof(int)]; + unsigned long image; + unsigned int flags; /* Flags to pass to the "boot" kernel */ + char orig_sig[10]; + char sig[10]; +} __attribute__ ((packed)); + +int swsusp_check(struct driveinfo *, struct part_entry *); +#endif /* _SWSUSP_H */ diff --git a/contrib/syslinux-4.02/com32/gplinclude/disk/util.h b/contrib/syslinux-4.02/com32/gplinclude/disk/util.h new file mode 100644 index 0000000..52f085a --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/disk/util.h @@ -0,0 +1,21 @@ +/* ----------------------------------------------------------------------- * + * + * Copyright 2009 Pierre-Alexandre Meyer + * + * Some parts borrowed from chain.c32: + * + * Copyright 2003-2009 H. Peter Anvin - All Rights Reserved + * Copyright 2009 Intel Corporation; author: H. Peter Anvin + * + * This file is part of Syslinux, and is made available under + * the terms of the GNU General Public License version 2. + * + * ----------------------------------------------------------------------- */ + +#ifndef _UTIL_H_ +#define _UTIL_H_ + +#include <com32.h> + +int int13_retry(const com32sys_t * inreg, com32sys_t * outreg); +#endif /* _UTIL_H_ */ diff --git a/contrib/syslinux-4.02/com32/gplinclude/disk/write.h b/contrib/syslinux-4.02/com32/gplinclude/disk/write.h new file mode 100644 index 0000000..89d26fc --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/disk/write.h @@ -0,0 +1,26 @@ +/* ----------------------------------------------------------------------- * + * + * Copyright 2009 Pierre-Alexandre Meyer + * + * Some parts borrowed from chain.c32: + * + * Copyright 2003-2009 H. Peter Anvin - All Rights Reserved + * Copyright 2009 Intel Corporation; author: H. Peter Anvin + * + * This file is part of Syslinux, and is made available under + * the terms of the GNU General Public License version 2. + * + * ----------------------------------------------------------------------- */ + +#ifndef _WRITE_H_ +#define _WRITE_H_ + +#include <disk/geom.h> + +int write_sectors(const struct driveinfo *, const unsigned int, + const void *, const int); +int write_verify_sector(struct driveinfo *drive_info, + const unsigned int, const void *); +int write_verify_sectors(struct driveinfo *, + const unsigned int, const void *, const int); +#endif diff --git a/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi.h b/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi.h new file mode 100644 index 0000000..92cd5f8 --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi.h @@ -0,0 +1,98 @@ +/* ----------------------------------------------------------------------- * + * + * 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 MAX_DMI_CACHE_ITEMS 32 +#define OEM_STRINGS_SIZE 512 +#define HARDWARE_SECURITY_SIZE 16 + +#define PAGE_SIZE 4096 + +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" +#include "dmi_ipmi.h" +#include "dmi_cache.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_module memory_module[MAX_DMI_MEMORY_ITEMS]; + s_memory memory[MAX_DMI_MEMORY_ITEMS]; + s_ipmi ipmi; + s_cache cache[MAX_DMI_CACHE_ITEMS]; + int memory_module_count; + int memory_count; + int cache_count; + dmi_table dmitable; + char oem_strings[OEM_STRINGS_SIZE]; + struct { + char power_on_passwd_status[HARDWARE_SECURITY_SIZE]; + char keyboard_passwd_status[HARDWARE_SECURITY_SIZE]; + char administrator_passwd_status[HARDWARE_SECURITY_SIZE]; + char front_panel_reset_status[HARDWARE_SECURITY_SIZE]; + bool filled; + } hardware_security; +} 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, int len); +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/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_base_board.h b/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_base_board.h new file mode 100644 index 0000000..3d5fb55 --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_base_board.h @@ -0,0 +1,58 @@ +/* ----------------------------------------------------------------------- * + * + * 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; + struct { + char type[16]; + uint8_t status; + char description[10]; + } devices_information[10]; +} s_base_board; + +#endif diff --git a/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_battery.h b/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_battery.h new file mode 100644 index 0000000..fae7acb --- /dev/null +++ b/contrib/syslinux-4.02/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/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_bios.h b/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_bios.h new file mode 100644 index 0000000..53201ac --- /dev/null +++ b/contrib/syslinux-4.02/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/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_cache.h b/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_cache.h new file mode 100644 index 0000000..cfd7114 --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_cache.h @@ -0,0 +1,47 @@ +/* ----------------------------------------------------------------------- * + * + * Copyright 2009 Pierre-Alexandre Meyer - All Rights Reserved + * + * Some part borrowed from DMI Decode: + * + * (C) 2000-2002 Alan Cox <alan@redhat.com> + * (C) 2002-2007 Jean Delvare <khali@linux-fr.org> + * + * 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_CACHE_H +#define DMI_CACHE_H + +#include <stdint.h> + +#include "stdbool.h" + +typedef struct { + char socket_designation[32]; + char configuration[32]; + char mode[32]; + char location[8]; + uint16_t installed_size; + uint16_t max_size; + char supported_sram_types[32]; + char installed_sram_types[32]; + uint16_t speed; + char error_correction_type[32]; + char system_type[16]; + char associativity[32]; +} __attribute__ ((__packed__)) s_cache; + +const char *dmi_cache_mode(uint8_t code); +const char *dmi_cache_location(uint8_t code); +uint16_t dmi_cache_size(uint16_t code); +void dmi_cache_types(uint16_t code, const char *sep, char *array); +const char *dmi_cache_ec_type(uint8_t code); +const char *dmi_cache_type(uint8_t code); +const char *dmi_cache_associativity(uint8_t code); +#endif /* DMI_CACHE_H */ diff --git a/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_chassis.h b/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_chassis.h new file mode 100644 index 0000000..88433ea --- /dev/null +++ b/contrib/syslinux-4.02/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/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_ipmi.h b/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_ipmi.h new file mode 100644 index 0000000..9110ae4 --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_ipmi.h @@ -0,0 +1,33 @@ +/* ----------------------------------------------------------------------- * + * + * Copyright 2006-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_IPMI_H +#define DMI_IPMI_H + +#define IPMI_INTERFACE_TYPE_SIZE 32 +#define IPMI_MEMORY_MODEL_SIZE 16 + +typedef struct { + char interface_type[IPMI_INTERFACE_TYPE_SIZE]; + uint8_t major_specification_version; + uint8_t minor_specification_version; + uint8_t I2C_slave_address; + uint16_t nv_address; + uint64_t base_address; + + uint8_t irq; + bool filled; +} s_ipmi; + +void dmi_ipmi_base_address(uint8_t type, const uint8_t * p, s_ipmi * ipmi); +const char *dmi_ipmi_interface_type(uint8_t code); +#endif diff --git a/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_memory.h b/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_memory.h new file mode 100644 index 0000000..4d0ad44 --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_memory.h @@ -0,0 +1,77 @@ +/* ----------------------------------------------------------------------- * + * + * 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; + +typedef struct { + char socket_designation[8]; + char bank_connections[8]; + char speed[8]; + char type[48]; + char installed_size[48]; + char enabled_size[48]; + char error_status[8]; + bool filled; +} s_memory_module; + +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, int sizeof_type_detail); +void dmi_memory_device_speed(uint16_t code, char *speed); + +void dmi_memory_module_connections(uint8_t, char *, int); +void dmi_memory_module_speed(uint8_t, char *); +void dmi_memory_module_types(uint16_t, const char *, char *, int); +void dmi_memory_module_size(uint8_t, char *, int); +void dmi_memory_module_error(uint8_t, const char *, char *); +#endif diff --git a/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_processor.h b/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_processor.h new file mode 100644 index 0000000..6107d31 --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_processor.h @@ -0,0 +1,112 @@ +/* ----------------------------------------------------------------------- * + * + * 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 64 +#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]; + uint16_t voltage_mv; + 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/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_system.h b/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_system.h new file mode 100644 index 0000000..6bb053f --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/dmi/dmi_system.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_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 + +#define SYSTEM_BOOT_STATUS_SIZE 50 +#define SYSTEM_CONFIGURATION_OPTIONS_SIZE 50 + +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; + char system_boot_status[SYSTEM_BOOT_STATUS_SIZE]; + char configuration_options[SYSTEM_CONFIGURATION_OPTIONS_SIZE]; + struct { + bool filled; + uint8_t status; + uint8_t watchdog; + char boot_option[17]; + char boot_option_on_limit[17]; + char reset_count[8]; + char reset_limit[8]; + char timer_interval[8]; + char timeout[8]; + } system_reset; +} s_system; +#endif diff --git a/contrib/syslinux-4.02/com32/gplinclude/memory.h b/contrib/syslinux-4.02/com32/gplinclude/memory.h new file mode 100644 index 0000000..fe33c18 --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/memory.h @@ -0,0 +1,53 @@ +/* ----------------------------------------------------------------------- * + * + * Copyright 2009 Pierre-Alexandre Meyer + * + * Some parts borrowed from meminfo.c32: + * + * Copyright 2003-2009 H. Peter Anvin - All Rights Reserved + * Copyright 2009 Intel Corporation; author: H. Peter Anvin + * + * Some parts borrowed from Linux: + * + * Copyright (C) 1991, 1992 Linus Torvalds + * Copyright 2007 rPath, Inc. - All Rights Reserved + * Copyright 2009 Intel Corporation; author H. Peter Anvin + * + * This file is part of Syslinux, and is made available under + * the terms of the GNU General Public License version 2. + * + * ----------------------------------------------------------------------- */ + +#ifndef _MEMORY_H_ +#define _MEMORY_H_ +#include <stdint.h> + +#define E820MAX 128 +#define E820_RAM 1 +#define E820_RESERVED 2 +#define E820_ACPI 3 /* usable as RAM once ACPI tables have been read */ +#define E820_NVS 4 + +#define RES_START 0xa0000 +#define RES_END 0x100000 + +struct e820entry { + uint64_t addr; /* start of memory segment */ + uint64_t size; /* size of memory segment */ + uint64_t type; /* type of memory segment */ +} __attribute__ ((packed)); + +const char *const e820_types[5]; + +void get_type(int, char *, int); +void detect_memory_e820(struct e820entry *desc, int size_map, int *size_found); +int detect_memory_e801(int *, int *); +int detect_memory_88(int *); + +/* The following stuff could be merge once the addr_t will be set to 64bits. + * syslinux_scan_memory can be used for that purpose */ +unsigned long memsize_e820(struct e820entry *e820, int e820_nr); +int sanitize_e820_map(struct e820entry *orig_map, struct e820entry *new_bios, + short old_nr); +unsigned long detect_memsize(void); +#endif diff --git a/contrib/syslinux-4.02/com32/gplinclude/vpd/vpd.h b/contrib/syslinux-4.02/com32/gplinclude/vpd/vpd.h new file mode 100644 index 0000000..bff77bd --- /dev/null +++ b/contrib/syslinux-4.02/com32/gplinclude/vpd/vpd.h @@ -0,0 +1,33 @@ +/* ----------------------------------------------------------------------- * + * + * 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 VPD_H +#define VPD_H +#include <inttypes.h> +#include <stdbool.h> + +enum { VPD_TABLE_PRESENT = 100, ENOVPDTABLE }; + +typedef struct { + char bios_build_id[10]; + char box_serial_number[8]; + char motherboard_serial_number[12]; + char machine_type_model[8]; + char bios_release_date[9]; + char default_flash_filename[13]; + char bios_version[255]; + char base_address[16]; + bool filled; +} s_vpd; + +int vpd_decode(s_vpd * vpd); +#endif |