extlinux/main.c: space change
[syslinux.git] / memdisk / mstructs.h
blob0b0dc07d9095f2bc179f795ded7a124fa9b791f1
1 /* ----------------------------------------------------------------------- *
3 * Copyright 2001-2009 H. Peter Anvin - All Rights Reserved
4 * Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
5 * Portions copyright 2009-2010 Shao Miller
6 * [El Torito code, mBFT, "safe hook"]
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
11 * Boston MA 02111-1307, USA; either version 2 of the License, or
12 * (at your option) any later version; incorporated herein by reference.
14 * ----------------------------------------------------------------------- */
16 /* These structures are common to MEMDISK and MDISKCHK.COM */
18 #include <stdint.h>
19 #include "compiler.h"
21 struct seg_off {
22 uint16_t offset;
23 uint16_t segment;
26 typedef union {
27 struct seg_off seg_off;
28 uint32_t uint32;
29 } real_addr_t;
31 /* Forward declaration */
32 struct mBFT;
34 MEMDISK_PACKED_PREFIX
35 struct safe_hook {
36 uint8_t jump[3]; /* Max. three bytes for jump */
37 uint8_t signature[8]; /* "$INT13SF" */
38 uint8_t vendor[8]; /* "MEMDISK " */
39 real_addr_t old_hook; /* SEG:OFF for previous INT 13h hook */
40 uint32_t flags; /* "Safe hook" flags */
41 /* The next field is a MEMDISK extension to the "safe hook" structure */
42 uint32_t mbft;
43 } MEMDISK_PACKED_POSTFIX;
45 struct memdisk_header {
46 uint16_t int13_offs;
47 uint16_t int15_offs;
48 uint16_t patch_offs;
49 uint16_t total_size;
50 uint16_t iret_offs;
51 struct safe_hook safe_hook;
54 MEMDISK_PACKED_PREFIX
55 /* EDD disk parameter table */
56 struct edd_dpt {
57 uint16_t len; /* Length of table */
58 uint16_t flags; /* Information flags */
59 uint32_t c; /* Physical cylinders (count!) */
60 uint32_t h; /* Physical heads (count!) */
61 uint32_t s; /* Physical sectors/track (count!) */
62 uint64_t sectors; /* Total sectors */
63 uint16_t bytespersec; /* Bytes/sector */
64 real_addr_t dpte; /* DPTE pointer */
65 uint16_t dpikey; /* Device Path Info magic */
66 uint8_t dpilen; /* Device Path Info length */
67 uint8_t res1; /* Reserved */
68 uint16_t res2; /* Reserved */
69 uint8_t bustype[4]; /* Host bus type */
70 uint8_t inttype[8]; /* Interface type */
71 uint64_t intpath; /* Interface path */
72 uint64_t devpath[2]; /* Device path (double QuadWord!) */
73 uint8_t res3; /* Reserved */
74 uint8_t chksum; /* DPI checksum */
75 } MEMDISK_PACKED_POSTFIX;
77 /* Requirement for struct edd4_cd_pkt */
78 #include "../memdisk/eltorito.h"
80 /* Official MEMDISK Info structure ("MDI") */
81 MEMDISK_PACKED_PREFIX
82 struct mdi {
83 const uint16_t bytes;
84 const uint8_t version_minor;
85 const uint8_t version_major;
87 uint32_t diskbuf;
88 uint32_t disksize;
89 real_addr_t cmdline;
91 real_addr_t oldint13;
92 real_addr_t oldint15;
94 uint16_t olddosmem;
95 uint8_t bootloaderid;
96 uint8_t sector_shift;
98 uint16_t dpt_ptr;
99 } MEMDISK_PACKED_POSTFIX;
101 /* Requirement for struct acpi_description_header */
102 #include "../memdisk/acpi.h"
104 MEMDISK_PACKED_PREFIX
105 struct mBFT {
106 struct acpi_description_header acpi;
107 uint32_t safe_hook; /* "Safe hook" physical address */
108 struct mdi mdi;
109 } MEMDISK_PACKED_POSTFIX;
111 /* The Disk Parameter Table may be required */
112 typedef union {
113 struct hd_dpt {
114 uint16_t max_cyl; /* Max cylinder */
115 uint8_t max_head; /* Max head */
116 uint8_t junk1[5]; /* Obsolete junk, leave at zero */
117 uint8_t ctrl; /* Control byte */
118 uint8_t junk2[7]; /* More obsolete junk */
119 } hd;
120 struct fd_dpt {
121 uint8_t specify1; /* "First specify byte" */
122 uint8_t specify2; /* "Second specify byte" */
123 uint8_t delay; /* Delay until motor turn off */
124 uint8_t bps; /* Bytes/sector (02h = 512) */
126 uint8_t sectors; /* Sectors/track */
127 uint8_t isgap; /* Length of intersector gap */
128 uint8_t dlen; /* Data length (0FFh) */
129 uint8_t fgap; /* Formatting gap */
131 uint8_t ffill; /* Format fill byte */
132 uint8_t settle; /* Head settle time (ms) */
133 uint8_t mstart; /* Motor start time */
134 uint8_t maxtrack; /* Maximum track number */
136 uint8_t rate; /* Data transfer rate */
137 uint8_t cmos; /* CMOS type */
138 uint8_t pad[2];
140 uint32_t old_fd_dpt; /* Extension: pointer to old INT 1Eh */
141 } fd;
142 } dpt_t;
144 MEMDISK_PACKED_PREFIX
145 struct patch_area {
146 struct mdi mdi;
148 uint8_t driveshiftlimit; /* Do not shift drives above this region */
149 uint8_t _pad2; /* Pad to DWORD */
150 uint16_t _pad3; /* Pad to QWORD */
152 uint16_t memint1588;
154 uint16_t cylinders;
155 uint16_t heads;
156 uint32_t sectors;
158 uint32_t mem1mb;
159 uint32_t mem16mb;
161 uint8_t driveno;
162 uint8_t drivetype;
163 uint8_t drivecnt;
164 uint8_t configflags;
166 #define CONFIG_READONLY 0x01
167 #define CONFIG_RAW 0x02
168 #define CONFIG_SAFEINT 0x04
169 #define CONFIG_BIGRAW 0x08 /* MUST be 8! */
170 #define CONFIG_MODEMASK 0x0e
172 uint16_t mystack;
173 uint16_t statusptr;
175 dpt_t dpt;
176 struct edd_dpt edd_dpt;
177 struct edd4_cd_pkt cd_pkt; /* Only really in a memdisk_iso_* hook */
178 } MEMDISK_PACKED_POSTFIX;