|
@@ -1,6 +1,22 @@
|
1
|
1
|
#ifndef PXE_API_H
|
2
|
2
|
#define PXE_API_H
|
3
|
3
|
|
|
4
|
+/*
|
|
5
|
+ * This program is free software; you can redistribute it and/or
|
|
6
|
+ * modify it under the terms of the GNU General Public License as
|
|
7
|
+ * published by the Free Software Foundation; either version 2 of the
|
|
8
|
+ * License, or any later version.
|
|
9
|
+ *
|
|
10
|
+ * This program is distributed in the hope that it will be useful, but
|
|
11
|
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13
|
+ * General Public License for more details.
|
|
14
|
+ *
|
|
15
|
+ * You should have received a copy of the GNU General Public License
|
|
16
|
+ * along with this program; if not, write to the Free Software
|
|
17
|
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
18
|
+ */
|
|
19
|
+
|
4
|
20
|
/** @file
|
5
|
21
|
*
|
6
|
22
|
* Preboot eXecution Environment (PXE) API
|
|
@@ -13,6 +29,260 @@
|
13
|
29
|
* @{
|
14
|
30
|
*/
|
15
|
31
|
|
|
32
|
+/** @defgroup pxe_api_call PXE entry points
|
|
33
|
+ *
|
|
34
|
+ * PXE entry points and calling conventions
|
|
35
|
+ *
|
|
36
|
+ * @{
|
|
37
|
+ */
|
|
38
|
+
|
|
39
|
+/** The PXENV+ structure */
|
|
40
|
+struct s_PXENV {
|
|
41
|
+ /** Signature
|
|
42
|
+ *
|
|
43
|
+ * Contains the bytes 'P', 'X', 'E', 'N', 'V', '+'.
|
|
44
|
+ */
|
|
45
|
+ UINT8_t Signature[6];
|
|
46
|
+ /** PXE API version
|
|
47
|
+ *
|
|
48
|
+ * MSB is major version number, LSB is minor version number.
|
|
49
|
+ * If the API version number is 0x0201 or greater, the !PXE
|
|
50
|
+ * structure pointed to by #PXEPtr should be used instead of
|
|
51
|
+ * this data structure.
|
|
52
|
+ */
|
|
53
|
+ UINT16_t Version;
|
|
54
|
+ UINT8_t Length; /**< Length of this structure */
|
|
55
|
+ /** Checksum
|
|
56
|
+ *
|
|
57
|
+ * The byte checksum of this structure (using the length in
|
|
58
|
+ * #Length) must be zero.
|
|
59
|
+ */
|
|
60
|
+ UINT8_t Checksum;
|
|
61
|
+ SEGOFF16_t RMEntry; /**< Real-mode PXENV+ entry point */
|
|
62
|
+ /** Protected-mode PXENV+ entry point offset
|
|
63
|
+ *
|
|
64
|
+ * PXE 2.1 deprecates this entry point. For protected-mode
|
|
65
|
+ * API calls, use the !PXE structure pointed to by #PXEPtr
|
|
66
|
+ * instead.
|
|
67
|
+ */
|
|
68
|
+ UINT32_t PMOffset;
|
|
69
|
+ /** Protected-mode PXENV+ entry point segment selector
|
|
70
|
+ *
|
|
71
|
+ * PXE 2.1 deprecates this entry point. For protected-mode
|
|
72
|
+ * API calls, use the !PXE structure pointed to by #PXEPtr
|
|
73
|
+ * instead.
|
|
74
|
+ */
|
|
75
|
+ SEGSEL_t PMSelector;
|
|
76
|
+ SEGSEL_t StackSeg; /**< Stack segment selector */
|
|
77
|
+ UINT16_t StackSize; /**< Stack segment size */
|
|
78
|
+ SEGSEL_t BC_CodeSeg; /**< Base-code code segment selector */
|
|
79
|
+ UINT16_t BC_CodeSize; /**< Base-code code segment size */
|
|
80
|
+ SEGSEL_t BC_DataSeg; /**< Base-code data segment selector */
|
|
81
|
+ UINT16_t BC_DataSize; /**< Base-code data segment size */
|
|
82
|
+ SEGSEL_t UNDIDataSeg; /**< UNDI data segment selector */
|
|
83
|
+ UINT16_t UNDIDataSize; /**< UNDI data segment size */
|
|
84
|
+ SEGSEL_t UNDICodeSeg; /**< UNDI code segment selector */
|
|
85
|
+ UINT16_t UNDICodeSize; /**< UNDI code segment size */
|
|
86
|
+ /** Address of the !PXE structure
|
|
87
|
+ *
|
|
88
|
+ * This field is present only if #Version is 0x0201 or
|
|
89
|
+ * greater. If present, it points to a struct s_PXE.
|
|
90
|
+ */
|
|
91
|
+ SEGOFF16_t PXEPtr;
|
|
92
|
+} PACKED;
|
|
93
|
+
|
|
94
|
+typedef struct s_PXENV PXENV_t;
|
|
95
|
+
|
|
96
|
+/** The !PXE structure */
|
|
97
|
+struct s_PXE {
|
|
98
|
+ /** Signature
|
|
99
|
+ *
|
|
100
|
+ * Contains the bytes '!', 'P', 'X', 'E'.
|
|
101
|
+ */
|
|
102
|
+ UINT8_t Signature[4];
|
|
103
|
+ UINT8_t StructLength; /**< Length of this structure */
|
|
104
|
+ /** Checksum
|
|
105
|
+ *
|
|
106
|
+ * The byte checksum of this structure (using the length in
|
|
107
|
+ * #StructLength) must be zero.
|
|
108
|
+ */
|
|
109
|
+ UINT8_t StructCksum;
|
|
110
|
+ /** Revision of this structure
|
|
111
|
+ *
|
|
112
|
+ * For PXE version 2.1, this field must be zero.
|
|
113
|
+ */
|
|
114
|
+ UINT8_t StructRev;
|
|
115
|
+ UINT8_t reserved_1; /**< Must be zero */
|
|
116
|
+ /** Address of the UNDI ROM ID structure
|
|
117
|
+ *
|
|
118
|
+ * This is a pointer to a struct s_UNDI_ROM_ID.
|
|
119
|
+ */
|
|
120
|
+ SEGOFF16_t UNDIROMID;
|
|
121
|
+ /** Address of the Base Code ROM ID structure
|
|
122
|
+ *
|
|
123
|
+ * This is a pointer to a struct s_BC_ROM_ID.
|
|
124
|
+ */
|
|
125
|
+ SEGOFF16_t BaseROMID;
|
|
126
|
+ /** 16-bit !PXE entry point
|
|
127
|
+ *
|
|
128
|
+ * This is the entry point for either real mode, or protected
|
|
129
|
+ * mode with a 16-bit stack segment.
|
|
130
|
+ */
|
|
131
|
+ SEGOFF16_t EntryPointSP;
|
|
132
|
+ /** 32-bit !PXE entry point
|
|
133
|
+ *
|
|
134
|
+ * This is the entry point for protected mode with a 32-bit
|
|
135
|
+ * stack segment.
|
|
136
|
+ */
|
|
137
|
+ SEGOFF16_t EntryPointESP;
|
|
138
|
+ /** Status call-out function
|
|
139
|
+ *
|
|
140
|
+ * @v 0 (if in a time-out loop)
|
|
141
|
+ * @v n Number of a received TFTP packet
|
|
142
|
+ * @ret 0 Continue operation
|
|
143
|
+ * @ret 1 Cancel operation
|
|
144
|
+ *
|
|
145
|
+ * This function will be called whenever the PXE stack is in
|
|
146
|
+ * protected mode, is waiting for an event (e.g. a DHCP reply)
|
|
147
|
+ * and wishes to allow the user to cancel the operation.
|
|
148
|
+ * Parameters are passed in register %ax; the return value
|
|
149
|
+ * must also be placed in register %ax. All other registers
|
|
150
|
+ * and flags @b must be preserved.
|
|
151
|
+ *
|
|
152
|
+ * In real mode, an internal function (that checks for a
|
|
153
|
+ * keypress) will be used.
|
|
154
|
+ *
|
|
155
|
+ * If this field is set to -1, no status call-out function
|
|
156
|
+ * will be used and consequently the user will not be allowed
|
|
157
|
+ * to interrupt operations.
|
|
158
|
+ *
|
|
159
|
+ * @note The PXE specification version 2.1 defines the
|
|
160
|
+ * StatusCallout field, mentions it 11 times, but nowhere
|
|
161
|
+ * defines what it actually does or how it gets called.
|
|
162
|
+ * Fortunately, the WfM specification version 1.1a deigns to
|
|
163
|
+ * inform us of such petty details.
|
|
164
|
+ */
|
|
165
|
+ SEGOFF16_t StatusCallout;
|
|
166
|
+ UINT8_t reserved_2; /**< Must be zero */
|
|
167
|
+ /** Number of segment descriptors
|
|
168
|
+ *
|
|
169
|
+ * If this number is greater than 7, the remaining descriptors
|
|
170
|
+ * follow immediately after #BC_CodeWrite.
|
|
171
|
+ */
|
|
172
|
+ UINT8_t SegDescCnt;
|
|
173
|
+ /** First protected-mode selector
|
|
174
|
+ *
|
|
175
|
+ * This is the segment selector value for the first segment
|
|
176
|
+ * assigned to PXE. Protected-mode selectors must be
|
|
177
|
+ * consecutive, according to the PXE 2.1 specification, though
|
|
178
|
+ * no reason is given. Each #SEGDESC_t includes a field for
|
|
179
|
+ * the segment selector, so this information is entirely
|
|
180
|
+ * redundant.
|
|
181
|
+ */
|
|
182
|
+ SEGSEL_t FirstSelector;
|
|
183
|
+ /** Stack segment descriptor */
|
|
184
|
+ SEGDESC_t Stack;
|
|
185
|
+ /** UNDI data segment descriptor */
|
|
186
|
+ SEGDESC_t UNDIData;
|
|
187
|
+ /** UNDI code segment descriptor */
|
|
188
|
+ SEGDESC_t UNDICode;
|
|
189
|
+ /** UNDI writable code segment descriptor */
|
|
190
|
+ SEGDESC_t UNDICodeWrite;
|
|
191
|
+ /** Base-code data segment descriptor */
|
|
192
|
+ SEGDESC_t BC_Data;
|
|
193
|
+ /** Base-code code segment descriptor */
|
|
194
|
+ SEGDESC_t BC_Code;
|
|
195
|
+ /** Base-code writable code segment descriptor */
|
|
196
|
+ SEGDESC_t BC_CodeWrite;
|
|
197
|
+} PACKED;
|
|
198
|
+
|
|
199
|
+typedef struct s_PXE PXE_t;
|
|
200
|
+
|
|
201
|
+/** @} */ /* pxe_api_call */
|
|
202
|
+
|
|
203
|
+/** @defgroup pxe_loader_api PXE Loader API
|
|
204
|
+ *
|
|
205
|
+ * The UNDI ROM loader API
|
|
206
|
+ *
|
|
207
|
+ * @{
|
|
208
|
+ */
|
|
209
|
+
|
|
210
|
+/** The UNDI ROM ID structure */
|
|
211
|
+struct s_UNDI_ROM_ID {
|
|
212
|
+ /** Signature
|
|
213
|
+ *
|
|
214
|
+ * Contains the bytes 'U', 'N', 'D', 'I'.
|
|
215
|
+ */
|
|
216
|
+ UINT32_t Signature;
|
|
217
|
+ UINT8_t StructLength; /**< Length of this structure */
|
|
218
|
+ /** Checksum
|
|
219
|
+ *
|
|
220
|
+ * The byte checksum of this structure (using the length in
|
|
221
|
+ * #StructLength) must be zero.
|
|
222
|
+ */
|
|
223
|
+ UINT8_t StructCksum;
|
|
224
|
+ /** Revision of this structure
|
|
225
|
+ *
|
|
226
|
+ * For PXE version 2.1, this field must be zero.
|
|
227
|
+ */
|
|
228
|
+ UINT8_t StructRev;
|
|
229
|
+ /** UNDI revision
|
|
230
|
+ *
|
|
231
|
+ * UNDI revision, least significant byte first. For UNDI
|
|
232
|
+ * version 2.1.0, this field will contain { 0x00, 0x01, 0x02 }.
|
|
233
|
+ */
|
|
234
|
+ UINT8_t UNDIRev[3];
|
|
235
|
+ /** UNDI loader routine entry point
|
|
236
|
+ *
|
|
237
|
+ * This is the entry point for calling undi_loader().
|
|
238
|
+ */
|
|
239
|
+ UINT16_t UNDILoader;
|
|
240
|
+ /** Minimum required stack segment size */
|
|
241
|
+ UINT16_t StackSize;
|
|
242
|
+ /** Minimum required data segment size */
|
|
243
|
+ UINT16_t DataSize;
|
|
244
|
+ /** Minimum required code segment size */
|
|
245
|
+ UINT16_t CodeSize;
|
|
246
|
+} PACKED;
|
|
247
|
+
|
|
248
|
+typedef struct s_UNDI_ROM_ID UNDI_ROM_ID_t;
|
|
249
|
+
|
|
250
|
+/** Parameter block for undi_loader() */
|
|
251
|
+struct s_UNDI_LOADER {
|
|
252
|
+ /** struct s_UNDI_LOADER starts with a struct s_PXENV_START_UNDI */
|
|
253
|
+ union undi_loader_start_undi {
|
|
254
|
+ PXENV_STATUS_t Status; /**< PXE status code */
|
|
255
|
+ /** Parameters to pass to pxenv_start_undi() */
|
|
256
|
+ struct s_PXENV_START_UNDI start_undi;
|
|
257
|
+ } u;
|
|
258
|
+ /** UNDI data segment
|
|
259
|
+ *
|
|
260
|
+ * @note The PXE specification defines the type of this field
|
|
261
|
+ * as #UINT16_t. For x86, #SEGSEL_t and #UINT16_t are
|
|
262
|
+ * equivalent anyway; for other architectures #SEGSEL_t makes
|
|
263
|
+ * more sense.
|
|
264
|
+ */
|
|
265
|
+ SEGSEL_t undi_ds;
|
|
266
|
+ /** UNDI code segment
|
|
267
|
+ *
|
|
268
|
+ * @note The PXE specification defines the type of this field
|
|
269
|
+ * as #UINT16_t. For x86, #SEGSEL_t and #UINT16_t are
|
|
270
|
+ * equivalent anyway; for other architectures #SEGSEL_t makes
|
|
271
|
+ * more sense.
|
|
272
|
+ */
|
|
273
|
+ SEGSEL_t undi_cs;
|
|
274
|
+ /** Address of the !PXE structure (a struct s_PXE) */
|
|
275
|
+ SEGOFF16_t pxe_ptr;
|
|
276
|
+ /** Address of the PXENV+ structure (a struct s_PXENV) */
|
|
277
|
+ SEGOFF16_t pxenv_ptr;
|
|
278
|
+} PACKED;
|
|
279
|
+
|
|
280
|
+typedef struct s_UNDI_LOADER UNDI_LOADER_t;
|
|
281
|
+
|
|
282
|
+extern PXENV_EXIT_t undi_loader ( struct s_UNDI_LOADER *undi_loader );
|
|
283
|
+
|
|
284
|
+/** @} */ /* pxe_loader_api */
|
|
285
|
+
|
16
|
286
|
/** @defgroup pxe_preboot_api PXE Preboot API
|
17
|
287
|
*
|
18
|
288
|
* General high-level functions: #PXENV_UNLOAD_STACK, #PXENV_START_UNDI etc.
|
|
@@ -620,6 +890,13 @@ extern PXENV_EXIT_t pxenv_udp_read ( struct s_PXENV_UDP_READ *udp_read );
|
620
|
890
|
/** PXE API function code for pxenv_undi_startup() */
|
621
|
891
|
#define PXENV_UNDI_STARTUP 0x0001
|
622
|
892
|
|
|
893
|
+#define PXENV_BUS_ISA 0 /**< ISA bus type */
|
|
894
|
+#define PXENV_BUS_EISA 1 /**< EISA bus type */
|
|
895
|
+#define PXENV_BUS_MCA 2 /**< MCA bus type */
|
|
896
|
+#define PXENV_BUS_PCI 3 /**< PCI bus type */
|
|
897
|
+#define PXENV_BUS_VESA 4 /**< VESA bus type */
|
|
898
|
+#define PXENV_BUS_PCMCIA 5 /**< PCMCIA bus type */
|
|
899
|
+
|
623
|
900
|
/** Parameter block for pxenv_undi_startup() */
|
624
|
901
|
struct s_PXENV_UNDI_STARTUP {
|
625
|
902
|
PXENV_STATUS_t Status; /**< PXE status code */
|