You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pxe_api.h 50KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818
  1. #ifndef PXE_API_H
  2. #define PXE_API_H
  3. /*
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 2 of the
  7. * License, or any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. *
  18. * As an alternative, at your option, you may use this file under the
  19. * following terms, known as the "MIT license":
  20. *
  21. * Copyright (c) 2005-2009 Michael Brown <mbrown@fensystems.co.uk>
  22. *
  23. * Permission is hereby granted, free of charge, to any person
  24. * obtaining a copy of this software and associated documentation
  25. * files (the "Software"), to deal in the Software without
  26. * restriction, including without limitation the rights to use, copy,
  27. * modify, merge, publish, distribute, sublicense, and/or sell copies
  28. * of the Software, and to permit persons to whom the Software is
  29. * furnished to do so, subject to the following conditions:
  30. *
  31. * The above copyright notice and this permission notice shall be
  32. * included in all copies or substantial portions of the Software.
  33. *
  34. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  35. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  36. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  37. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  38. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  39. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  40. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  41. * SOFTWARE.
  42. */
  43. /** @file
  44. *
  45. * Preboot eXecution Environment (PXE) API
  46. *
  47. */
  48. FILE_LICENCE ( GPL2_OR_LATER );
  49. #include "pxe_types.h"
  50. /** @addtogroup pxe Preboot eXecution Environment (PXE) API
  51. * @{
  52. */
  53. /** @defgroup pxe_api_call PXE entry points
  54. *
  55. * PXE entry points and calling conventions
  56. *
  57. * @{
  58. */
  59. /** The PXENV+ structure */
  60. struct s_PXENV {
  61. /** Signature
  62. *
  63. * Contains the bytes 'P', 'X', 'E', 'N', 'V', '+'.
  64. */
  65. UINT8_t Signature[6];
  66. /** PXE API version
  67. *
  68. * MSB is major version number, LSB is minor version number.
  69. * If the API version number is 0x0201 or greater, the !PXE
  70. * structure pointed to by #PXEPtr should be used instead of
  71. * this data structure.
  72. */
  73. UINT16_t Version;
  74. UINT8_t Length; /**< Length of this structure */
  75. /** Checksum
  76. *
  77. * The byte checksum of this structure (using the length in
  78. * #Length) must be zero.
  79. */
  80. UINT8_t Checksum;
  81. SEGOFF16_t RMEntry; /**< Real-mode PXENV+ entry point */
  82. /** Protected-mode PXENV+ entry point offset
  83. *
  84. * PXE 2.1 deprecates this entry point. For protected-mode
  85. * API calls, use the !PXE structure pointed to by #PXEPtr
  86. * instead.
  87. */
  88. UINT32_t PMOffset;
  89. /** Protected-mode PXENV+ entry point segment selector
  90. *
  91. * PXE 2.1 deprecates this entry point. For protected-mode
  92. * API calls, use the !PXE structure pointed to by #PXEPtr
  93. * instead.
  94. */
  95. SEGSEL_t PMSelector;
  96. SEGSEL_t StackSeg; /**< Stack segment selector */
  97. UINT16_t StackSize; /**< Stack segment size */
  98. SEGSEL_t BC_CodeSeg; /**< Base-code code segment selector */
  99. UINT16_t BC_CodeSize; /**< Base-code code segment size */
  100. SEGSEL_t BC_DataSeg; /**< Base-code data segment selector */
  101. UINT16_t BC_DataSize; /**< Base-code data segment size */
  102. SEGSEL_t UNDIDataSeg; /**< UNDI data segment selector */
  103. UINT16_t UNDIDataSize; /**< UNDI data segment size */
  104. SEGSEL_t UNDICodeSeg; /**< UNDI code segment selector */
  105. UINT16_t UNDICodeSize; /**< UNDI code segment size */
  106. /** Address of the !PXE structure
  107. *
  108. * This field is present only if #Version is 0x0201 or
  109. * greater. If present, it points to a struct s_PXE.
  110. */
  111. SEGOFF16_t PXEPtr;
  112. } __attribute__ (( packed ));
  113. typedef struct s_PXENV PXENV_t;
  114. /** The !PXE structure */
  115. struct s_PXE {
  116. /** Signature
  117. *
  118. * Contains the bytes '!', 'P', 'X', 'E'.
  119. */
  120. UINT8_t Signature[4];
  121. UINT8_t StructLength; /**< Length of this structure */
  122. /** Checksum
  123. *
  124. * The byte checksum of this structure (using the length in
  125. * #StructLength) must be zero.
  126. */
  127. UINT8_t StructCksum;
  128. /** Revision of this structure
  129. *
  130. * For PXE version 2.1, this field must be zero.
  131. */
  132. UINT8_t StructRev;
  133. UINT8_t reserved_1; /**< Must be zero */
  134. /** Address of the UNDI ROM ID structure
  135. *
  136. * This is a pointer to a struct s_UNDI_ROM_ID.
  137. */
  138. SEGOFF16_t UNDIROMID;
  139. /** Address of the Base Code ROM ID structure
  140. *
  141. * This is a pointer to a struct s_BC_ROM_ID.
  142. */
  143. SEGOFF16_t BaseROMID;
  144. /** 16-bit !PXE entry point
  145. *
  146. * This is the entry point for either real mode, or protected
  147. * mode with a 16-bit stack segment.
  148. */
  149. SEGOFF16_t EntryPointSP;
  150. /** 32-bit !PXE entry point
  151. *
  152. * This is the entry point for protected mode with a 32-bit
  153. * stack segment.
  154. */
  155. SEGOFF16_t EntryPointESP;
  156. /** Status call-out function
  157. *
  158. * @v 0 (if in a time-out loop)
  159. * @v n Number of a received TFTP packet
  160. * @ret 0 Continue operation
  161. * @ret 1 Cancel operation
  162. *
  163. * This function will be called whenever the PXE stack is in
  164. * protected mode, is waiting for an event (e.g. a DHCP reply)
  165. * and wishes to allow the user to cancel the operation.
  166. * Parameters are passed in register %ax; the return value
  167. * must also be placed in register %ax. All other registers
  168. * and flags @b must be preserved.
  169. *
  170. * In real mode, an internal function (that checks for a
  171. * keypress) will be used.
  172. *
  173. * If this field is set to -1, no status call-out function
  174. * will be used and consequently the user will not be allowed
  175. * to interrupt operations.
  176. *
  177. * @note The PXE specification version 2.1 defines the
  178. * StatusCallout field, mentions it 11 times, but nowhere
  179. * defines what it actually does or how it gets called.
  180. * Fortunately, the WfM specification version 1.1a deigns to
  181. * inform us of such petty details.
  182. */
  183. SEGOFF16_t StatusCallout;
  184. UINT8_t reserved_2; /**< Must be zero */
  185. /** Number of segment descriptors
  186. *
  187. * If this number is greater than 7, the remaining descriptors
  188. * follow immediately after #BC_CodeWrite.
  189. */
  190. UINT8_t SegDescCnt;
  191. /** First protected-mode selector
  192. *
  193. * This is the segment selector value for the first segment
  194. * assigned to PXE. Protected-mode selectors must be
  195. * consecutive, according to the PXE 2.1 specification, though
  196. * no reason is given. Each #SEGDESC_t includes a field for
  197. * the segment selector, so this information is entirely
  198. * redundant.
  199. */
  200. SEGSEL_t FirstSelector;
  201. /** Stack segment descriptor */
  202. SEGDESC_t Stack;
  203. /** UNDI data segment descriptor */
  204. SEGDESC_t UNDIData;
  205. /** UNDI code segment descriptor */
  206. SEGDESC_t UNDICode;
  207. /** UNDI writable code segment descriptor */
  208. SEGDESC_t UNDICodeWrite;
  209. /** Base-code data segment descriptor */
  210. SEGDESC_t BC_Data;
  211. /** Base-code code segment descriptor */
  212. SEGDESC_t BC_Code;
  213. /** Base-code writable code segment descriptor */
  214. SEGDESC_t BC_CodeWrite;
  215. } __attribute__ (( packed ));
  216. typedef struct s_PXE PXE_t;
  217. /** @} */ /* pxe_api_call */
  218. /** @defgroup pxe_preboot_api PXE Preboot API
  219. *
  220. * General high-level functions: #PXENV_UNLOAD_STACK, #PXENV_START_UNDI etc.
  221. *
  222. * @{
  223. */
  224. /** @defgroup pxenv_unload_stack PXENV_UNLOAD_STACK
  225. *
  226. * UNLOAD BASE CODE STACK
  227. *
  228. * @{
  229. */
  230. /** PXE API function code for pxenv_unload_stack() */
  231. #define PXENV_UNLOAD_STACK 0x0070
  232. /** Parameter block for pxenv_unload_stack() */
  233. struct s_PXENV_UNLOAD_STACK {
  234. PXENV_STATUS_t Status; /**< PXE status code */
  235. UINT8_t reserved[10]; /**< Must be zero */
  236. } __attribute__ (( packed ));
  237. typedef struct s_PXENV_UNLOAD_STACK PXENV_UNLOAD_STACK_t;
  238. /** @} */ /* pxenv_unload_stack */
  239. /** @defgroup pxenv_get_cached_info PXENV_GET_CACHED_INFO
  240. *
  241. * GET CACHED INFO
  242. *
  243. * @{
  244. */
  245. /** PXE API function code for pxenv_get_cached_info() */
  246. #define PXENV_GET_CACHED_INFO 0x0071
  247. /** The client's DHCPDISCOVER packet */
  248. #define PXENV_PACKET_TYPE_DHCP_DISCOVER 1
  249. /** The DHCP server's DHCPACK packet */
  250. #define PXENV_PACKET_TYPE_DHCP_ACK 2
  251. /** The Boot Server's Discover Reply packet
  252. *
  253. * This packet contains DHCP option 60 set to "PXEClient", a valid
  254. * boot file name, and may or may not contain MTFTP options.
  255. */
  256. #define PXENV_PACKET_TYPE_CACHED_REPLY 3
  257. /** Parameter block for pxenv_get_cached_info() */
  258. struct s_PXENV_GET_CACHED_INFO {
  259. PXENV_STATUS_t Status; /**< PXE status code */
  260. /** Packet type.
  261. *
  262. * Valid values are #PXENV_PACKET_TYPE_DHCP_DISCOVER,
  263. * #PXENV_PACKET_TYPE_DHCP_ACK or #PXENV_PACKET_TYPE_CACHED_REPLY
  264. */
  265. UINT16_t PacketType;
  266. UINT16_t BufferSize; /**< Buffer size */
  267. SEGOFF16_t Buffer; /**< Buffer address */
  268. UINT16_t BufferLimit; /**< Maximum buffer size */
  269. } __attribute__ (( packed ));
  270. typedef struct s_PXENV_GET_CACHED_INFO PXENV_GET_CACHED_INFO_t;
  271. #define BOOTP_REQ 1 /**< A BOOTP request packet */
  272. #define BOOTP_REP 2 /**< A BOOTP reply packet */
  273. /** DHCP broadcast flag
  274. *
  275. * Request a broadcast response (DHCPOFFER or DHCPACK) from the DHCP
  276. * server.
  277. */
  278. #define BOOTP_BCAST 0x8000
  279. #define VM_RFC1048 0x63825363L /**< DHCP magic cookie */
  280. /** Maximum length of DHCP options */
  281. #define BOOTP_DHCPVEND 1024
  282. /** Format of buffer filled in by pxenv_get_cached_info()
  283. *
  284. * This somewhat convoluted data structure simply describes the layout
  285. * of a DHCP packet. Refer to RFC2131 section 2 for a full
  286. * description.
  287. */
  288. struct bootph {
  289. /** Message opcode.
  290. *
  291. * Valid values are #BOOTP_REQ and #BOOTP_REP.
  292. */
  293. UINT8_t opcode;
  294. /** NIC hardware type.
  295. *
  296. * Valid values are as for s_PXENV_UNDI_GET_INFORMATION::HwType.
  297. */
  298. UINT8_t Hardware;
  299. UINT8_t Hardlen; /**< MAC address length */
  300. /** Gateway hops
  301. *
  302. * Zero in packets sent by the client. May be non-zero in
  303. * replies from the DHCP server, if the reply comes via a DHCP
  304. * relay agent.
  305. */
  306. UINT8_t Gatehops;
  307. UINT32_t ident; /**< DHCP transaction id (xid) */
  308. /** Elapsed time
  309. *
  310. * Number of seconds since the client began the DHCP
  311. * transaction.
  312. */
  313. UINT16_t seconds;
  314. /** Flags
  315. *
  316. * This is the bitwise-OR of any of the following values:
  317. * #BOOTP_BCAST.
  318. */
  319. UINT16_t Flags;
  320. /** Client IP address
  321. *
  322. * Set only if the client already has an IP address.
  323. */
  324. IP4_t cip;
  325. /** Your IP address
  326. *
  327. * This is the IP address that the server assigns to the
  328. * client.
  329. */
  330. IP4_t yip;
  331. /** Server IP address
  332. *
  333. * This is the IP address of the BOOTP/DHCP server.
  334. */
  335. IP4_t sip;
  336. /** Gateway IP address
  337. *
  338. * This is the IP address of the BOOTP/DHCP relay agent, if
  339. * any. It is @b not (necessarily) the address of the default
  340. * gateway for routing purposes.
  341. */
  342. IP4_t gip;
  343. MAC_ADDR_t CAddr; /**< Client MAC address */
  344. UINT8_t Sname[64]; /**< Server host name */
  345. UINT8_t bootfile[128]; /**< Boot file name */
  346. /** DHCP options
  347. *
  348. * Don't ask. Just laugh. Then burn a copy of the PXE
  349. * specification and send Intel an e-mail asking them if
  350. * they've figured out what a "union" does in C yet.
  351. */
  352. union bootph_vendor {
  353. UINT8_t d[BOOTP_DHCPVEND]; /**< DHCP options */
  354. /** DHCP options */
  355. struct bootph_vendor_v {
  356. /** DHCP magic cookie
  357. *
  358. * Should have the value #VM_RFC1048.
  359. */
  360. UINT8_t magic[4];
  361. UINT32_t flags; /**< BOOTP flags/opcodes */
  362. /** "End of BOOTP vendor extensions"
  363. *
  364. * Abandon hope, all ye who consider the
  365. * purpose of this field.
  366. */
  367. UINT8_t pad[56];
  368. } v;
  369. } vendor;
  370. } __attribute__ (( packed ));
  371. typedef struct bootph BOOTPLAYER_t;
  372. /** @} */ /* pxenv_get_cached_info */
  373. /** @defgroup pxenv_restart_tftp PXENV_RESTART_TFTP
  374. *
  375. * RESTART TFTP
  376. *
  377. * @{
  378. */
  379. /** PXE API function code for pxenv_restart_tftp() */
  380. #define PXENV_RESTART_TFTP 0x0073
  381. /** Parameter block for pxenv_restart_tftp() */
  382. struct s_PXENV_TFTP_READ_FILE;
  383. typedef struct s_PXENV_RESTART_TFTP PXENV_RESTART_TFTP_t;
  384. /** @} */ /* pxenv_restart_tftp */
  385. /** @defgroup pxenv_start_undi PXENV_START_UNDI
  386. *
  387. * START UNDI
  388. *
  389. * @{
  390. */
  391. /** PXE API function code for pxenv_start_undi() */
  392. #define PXENV_START_UNDI 0x0000
  393. /** Parameter block for pxenv_start_undi() */
  394. struct s_PXENV_START_UNDI {
  395. PXENV_STATUS_t Status; /**< PXE status code */
  396. /** %ax register as passed to the Option ROM initialisation routine.
  397. *
  398. * For a PCI device, this should contain the bus:dev:fn value
  399. * that uniquely identifies the PCI device in the system. For
  400. * a non-PCI device, this field is not defined.
  401. */
  402. UINT16_t AX;
  403. /** %bx register as passed to the Option ROM initialisation routine.
  404. *
  405. * For an ISAPnP device, this should contain the Card Select
  406. * Number assigned to the ISAPnP card. For non-ISAPnP
  407. * devices, this should contain 0xffff.
  408. */
  409. UINT16_t BX;
  410. /** %dx register as passed to the Option ROM initialisation routine.
  411. *
  412. * For an ISAPnP device, this should contain the ISAPnP Read
  413. * Port address as currently set in all ISAPnP cards. If
  414. * there are no ISAPnP cards, this should contain 0xffff. (If
  415. * this is a non-ISAPnP device, but there are ISAPnP cards in
  416. * the system, this value is not well defined.)
  417. */
  418. UINT16_t DX;
  419. /** %di register as passed to the Option ROM initialisation routine.
  420. *
  421. * This contains the #OFF16_t portion of a struct #s_SEGOFF16
  422. * that points to the System BIOS Plug and Play Installation
  423. * Check Structure. (Refer to section 4.4 of the Plug and
  424. * Play BIOS specification for a description of this
  425. * structure.)
  426. *
  427. * @note The PXE specification defines the type of this field
  428. * as #UINT16_t. For x86, #OFF16_t and #UINT16_t are
  429. * equivalent anyway; for other architectures #OFF16_t makes
  430. * more sense.
  431. */
  432. OFF16_t DI;
  433. /** %es register as passed to the Option ROM initialisation routine.
  434. *
  435. * This contains the #SEGSEL_t portion of a struct #s_SEGOFF16
  436. * that points to the System BIOS Plug and Play Installation
  437. * Check Structure. (Refer to section 4.4 of the Plug and
  438. * Play BIOS specification for a description of this
  439. * structure.)
  440. *
  441. * @note The PXE specification defines the type of this field
  442. * as #UINT16_t. For x86, #SEGSEL_t and #UINT16_t are
  443. * equivalent anyway; for other architectures #SEGSEL_t makes
  444. * more sense.
  445. */
  446. SEGSEL_t ES;
  447. } __attribute__ (( packed ));
  448. typedef struct s_PXENV_START_UNDI PXENV_START_UNDI_t;
  449. /** @} */ /* pxenv_start_undi */
  450. /** @defgroup pxenv_stop_undi PXENV_STOP_UNDI
  451. *
  452. * STOP UNDI
  453. *
  454. * @{
  455. */
  456. /** PXE API function code for pxenv_stop_undi() */
  457. #define PXENV_STOP_UNDI 0x0015
  458. /** Parameter block for pxenv_stop_undi() */
  459. struct s_PXENV_STOP_UNDI {
  460. PXENV_STATUS_t Status; /**< PXE status code */
  461. } __attribute__ (( packed ));
  462. typedef struct s_PXENV_STOP_UNDI PXENV_STOP_UNDI_t;
  463. /** @} */ /* pxenv_stop_undi */
  464. /** @defgroup pxenv_start_base PXENV_START_BASE
  465. *
  466. * START BASE
  467. *
  468. * @{
  469. */
  470. /** PXE API function code for pxenv_start_base() */
  471. #define PXENV_START_BASE 0x0075
  472. /** Parameter block for pxenv_start_base() */
  473. struct s_PXENV_START_BASE {
  474. PXENV_STATUS_t Status; /**< PXE status code */
  475. } __attribute__ (( packed ));
  476. typedef struct s_PXENV_START_BASE PXENV_START_BASE_t;
  477. /** @} */ /* pxenv_start_base */
  478. /** @defgroup pxenv_stop_base PXENV_STOP_BASE
  479. *
  480. * STOP BASE
  481. *
  482. * @{
  483. */
  484. /** PXE API function code for pxenv_stop_base() */
  485. #define PXENV_STOP_BASE 0x0076
  486. /** Parameter block for pxenv_stop_base() */
  487. struct s_PXENV_STOP_BASE {
  488. PXENV_STATUS_t Status; /**< PXE status code */
  489. } __attribute__ (( packed ));
  490. typedef struct s_PXENV_STOP_BASE PXENV_STOP_BASE_t;
  491. /** @} */ /* pxenv_stop_base */
  492. /** @} */ /* pxe_preboot_api */
  493. /** @defgroup pxe_tftp_api PXE TFTP API
  494. *
  495. * Download files via TFTP or MTFTP
  496. *
  497. * @{
  498. */
  499. /** @defgroup pxenv_tftp_open PXENV_TFTP_OPEN
  500. *
  501. * TFTP OPEN
  502. *
  503. * @{
  504. */
  505. /** PXE API function code for pxenv_tftp_open() */
  506. #define PXENV_TFTP_OPEN 0x0020
  507. /** Parameter block for pxenv_tftp_open() */
  508. struct s_PXENV_TFTP_OPEN {
  509. PXENV_STATUS_t Status; /**< PXE status code */
  510. IP4_t ServerIPAddress; /**< TFTP server IP address */
  511. IP4_t GatewayIPAddress; /**< Relay agent IP address */
  512. UINT8_t FileName[128]; /**< File name */
  513. UDP_PORT_t TFTPPort; /**< TFTP server UDP port */
  514. /** Requested size of TFTP packets
  515. *
  516. * This is the TFTP "blksize" option. This must be at least
  517. * 512, since servers that do not support TFTP options cannot
  518. * negotiate blocksizes smaller than this.
  519. */
  520. UINT16_t PacketSize;
  521. } __attribute__ (( packed ));
  522. typedef struct s_PXENV_TFTP_OPEN PXENV_TFTP_OPEN_t;
  523. /** @} */ /* pxenv_tftp_open */
  524. /** @defgroup pxenv_tftp_close PXENV_TFTP_CLOSE
  525. *
  526. * TFTP CLOSE
  527. *
  528. * @{
  529. */
  530. /** PXE API function code for pxenv_tftp_close() */
  531. #define PXENV_TFTP_CLOSE 0x0021
  532. /** Parameter block for pxenv_tftp_close() */
  533. struct s_PXENV_TFTP_CLOSE {
  534. PXENV_STATUS_t Status; /**< PXE status code */
  535. } __attribute__ (( packed ));
  536. typedef struct s_PXENV_TFTP_CLOSE PXENV_TFTP_CLOSE_t;
  537. /** @} */ /* pxenv_tftp_close */
  538. /** @defgroup pxenv_tftp_read PXENV_TFTP_READ
  539. *
  540. * TFTP READ
  541. *
  542. * @{
  543. */
  544. /** PXE API function code for pxenv_tftp_read() */
  545. #define PXENV_TFTP_READ 0x0022
  546. /** Parameter block for pxenv_tftp_read() */
  547. struct s_PXENV_TFTP_READ {
  548. PXENV_STATUS_t Status; /**< PXE status code */
  549. UINT16_t PacketNumber; /**< TFTP packet number */
  550. UINT16_t BufferSize; /**< Size of data buffer */
  551. SEGOFF16_t Buffer; /**< Address of data buffer */
  552. } __attribute__ (( packed ));
  553. typedef struct s_PXENV_TFTP_READ PXENV_TFTP_READ_t;
  554. /** @} */ /* pxenv_tftp_read */
  555. /** @defgroup pxenv_tftp_read_file PXENV_TFTP_READ_FILE
  556. *
  557. * TFTP/MTFTP READ FILE
  558. *
  559. * @{
  560. */
  561. /** PXE API function code for pxenv_tftp_read_file() */
  562. #define PXENV_TFTP_READ_FILE 0x0023
  563. /** Parameter block for pxenv_tftp_read_file() */
  564. struct s_PXENV_TFTP_READ_FILE {
  565. PXENV_STATUS_t Status; /**< PXE status code */
  566. UINT8_t FileName[128]; /**< File name */
  567. UINT32_t BufferSize; /**< Size of data buffer */
  568. ADDR32_t Buffer; /**< Address of data buffer */
  569. IP4_t ServerIPAddress; /**< TFTP server IP address */
  570. IP4_t GatewayIPAddress; /**< Relay agent IP address */
  571. /** File multicast IP address */
  572. IP4_t McastIPAddress;
  573. /** Client multicast listening port */
  574. UDP_PORT_t TFTPClntPort;
  575. /** Server multicast listening port */
  576. UDP_PORT_t TFTPSrvPort;
  577. /** TFTP open timeout.
  578. *
  579. * This is the timeout for receiving the first DATA or ACK
  580. * packets during the MTFTP Listen phase.
  581. */
  582. UINT16_t TFTPOpenTimeOut;
  583. /** TFTP reopen timeout.
  584. *
  585. * This is the timeout for receiving an ACK packet while in
  586. * the MTFTP Listen phase (when at least one ACK packet has
  587. * already been seen).
  588. */
  589. UINT16_t TFTPReopenDelay;
  590. } __attribute__ (( packed ));
  591. typedef struct s_PXENV_TFTP_READ_FILE PXENV_TFTP_READ_FILE_t;
  592. /** @} */ /* pxenv_tftp_read_file */
  593. /** @defgroup pxenv_tftp_get_fsize PXENV_TFTP_GET_FSIZE
  594. *
  595. * TFTP GET FILE SIZE
  596. *
  597. * @{
  598. */
  599. /** PXE API function code for pxenv_tftp_get_fsize() */
  600. #define PXENV_TFTP_GET_FSIZE 0x0025
  601. /** Parameter block for pxenv_tftp_get_fsize() */
  602. struct s_PXENV_TFTP_GET_FSIZE {
  603. PXENV_STATUS_t Status; /**< PXE status code */
  604. IP4_t ServerIPAddress; /**< TFTP server IP address */
  605. IP4_t GatewayIPAddress; /**< Relay agent IP address */
  606. UINT8_t FileName[128]; /**< File name */
  607. UINT32_t FileSize; /**< Size of the file */
  608. } __attribute__ (( packed ));
  609. typedef struct s_PXENV_TFTP_GET_FSIZE PXENV_TFTP_GET_FSIZE_t;
  610. /** @} */ /* pxenv_tftp_get_fsize */
  611. /** @} */ /* pxe_tftp_api */
  612. /** @defgroup pxe_udp_api PXE UDP API
  613. *
  614. * Transmit and receive UDP packets
  615. *
  616. * @{
  617. */
  618. /** @defgroup pxenv_udp_open PXENV_UDP_OPEN
  619. *
  620. * UDP OPEN
  621. *
  622. * @{
  623. */
  624. /** PXE API function code for pxenv_udp_open() */
  625. #define PXENV_UDP_OPEN 0x0030
  626. /** Parameter block for pxenv_udp_open() */
  627. struct s_PXENV_UDP_OPEN {
  628. PXENV_STATUS_t Status; /**< PXE status code */
  629. IP4_t src_ip; /**< IP address of this station */
  630. } __attribute__ (( packed ));
  631. typedef struct s_PXENV_UDP_OPEN PXENV_UDP_OPEN_t;
  632. /** @} */ /* pxenv_udp_open */
  633. /** @defgroup pxenv_udp_close PXENV_UDP_CLOSE
  634. *
  635. * UDP CLOSE
  636. *
  637. * @{
  638. */
  639. /** PXE API function code for pxenv_udp_close() */
  640. #define PXENV_UDP_CLOSE 0x0031
  641. /** Parameter block for pxenv_udp_close() */
  642. struct s_PXENV_UDP_CLOSE {
  643. PXENV_STATUS_t Status; /**< PXE status code */
  644. } __attribute__ (( packed ));
  645. typedef struct s_PXENV_UDP_CLOSE PXENV_UDP_CLOSE_t;
  646. /** @} */ /* pxenv_udp_close */
  647. /** @defgroup pxenv_udp_write PXENV_UDP_WRITE
  648. *
  649. * UDP WRITE
  650. *
  651. * @{
  652. */
  653. /** PXE API function code for pxenv_udp_write() */
  654. #define PXENV_UDP_WRITE 0x0033
  655. /** Parameter block for pxenv_udp_write() */
  656. struct s_PXENV_UDP_WRITE {
  657. PXENV_STATUS_t Status; /**< PXE status code */
  658. IP4_t ip; /**< Destination IP address */
  659. IP4_t gw; /**< Relay agent IP address */
  660. UDP_PORT_t src_port; /**< Source UDP port */
  661. UDP_PORT_t dst_port; /**< Destination UDP port */
  662. UINT16_t buffer_size; /**< UDP payload buffer size */
  663. SEGOFF16_t buffer; /**< UDP payload buffer address */
  664. } __attribute__ (( packed ));
  665. typedef struct s_PXENV_UDP_WRITE PXENV_UDP_WRITE_t;
  666. /** @} */ /* pxenv_udp_write */
  667. /** @defgroup pxenv_udp_read PXENV_UDP_READ
  668. *
  669. * UDP READ
  670. *
  671. * @{
  672. */
  673. /** PXE API function code for pxenv_udp_read() */
  674. #define PXENV_UDP_READ 0x0032
  675. /** Parameter block for pxenv_udp_read() */
  676. struct s_PXENV_UDP_READ {
  677. PXENV_STATUS_t Status; /**< PXE status code */
  678. IP4_t src_ip; /**< Source IP address */
  679. IP4_t dest_ip; /**< Destination IP address */
  680. UDP_PORT_t s_port; /**< Source UDP port */
  681. UDP_PORT_t d_port; /**< Destination UDP port */
  682. UINT16_t buffer_size; /**< UDP payload buffer size */
  683. SEGOFF16_t buffer; /**< UDP payload buffer address */
  684. } __attribute__ (( packed ));
  685. typedef struct s_PXENV_UDP_READ PXENV_UDP_READ_t;
  686. /** @} */ /* pxenv_udp_read */
  687. /** @} */ /* pxe_udp_api */
  688. /** @defgroup pxe_undi_api PXE UNDI API
  689. *
  690. * Direct control of the network interface card
  691. *
  692. * @{
  693. */
  694. /** @defgroup pxenv_undi_startup PXENV_UNDI_STARTUP
  695. *
  696. * UNDI STARTUP
  697. *
  698. * @{
  699. */
  700. /** PXE API function code for pxenv_undi_startup() */
  701. #define PXENV_UNDI_STARTUP 0x0001
  702. #define PXENV_BUS_ISA 0 /**< ISA bus type */
  703. #define PXENV_BUS_EISA 1 /**< EISA bus type */
  704. #define PXENV_BUS_MCA 2 /**< MCA bus type */
  705. #define PXENV_BUS_PCI 3 /**< PCI bus type */
  706. #define PXENV_BUS_VESA 4 /**< VESA bus type */
  707. #define PXENV_BUS_PCMCIA 5 /**< PCMCIA bus type */
  708. /** Parameter block for pxenv_undi_startup() */
  709. struct s_PXENV_UNDI_STARTUP {
  710. PXENV_STATUS_t Status; /**< PXE status code */
  711. } __attribute__ (( packed ));
  712. typedef struct s_PXENV_UNDI_STARTUP PXENV_UNDI_STARTUP_t;
  713. /** @} */ /* pxenv_undi_startup */
  714. /** @defgroup pxenv_undi_cleanup PXENV_UNDI_CLEANUP
  715. *
  716. * UNDI CLEANUP
  717. *
  718. * @{
  719. */
  720. /** PXE API function code for pxenv_undi_cleanup() */
  721. #define PXENV_UNDI_CLEANUP 0x0002
  722. /** Parameter block for pxenv_undi_cleanup() */
  723. struct s_PXENV_UNDI_CLEANUP {
  724. PXENV_STATUS_t Status; /**< PXE status code */
  725. } __attribute__ (( packed ));
  726. typedef struct s_PXENV_UNDI_CLEANUP PXENV_UNDI_CLEANUP_t;
  727. /** @} */ /* pxenv_undi_cleanup */
  728. /** @defgroup pxenv_undi_initialize PXENV_UNDI_INITIALIZE
  729. *
  730. * UNDI INITIALIZE
  731. *
  732. * @{
  733. */
  734. /** PXE API function code for pxenv_undi_initialize() */
  735. #define PXENV_UNDI_INITIALIZE 0x0003
  736. /** Parameter block for pxenv_undi_initialize() */
  737. struct s_PXENV_UNDI_INITIALIZE {
  738. PXENV_STATUS_t Status; /**< PXE status code */
  739. /** NDIS 2.0 configuration information, or NULL
  740. *
  741. * This is a pointer to the data structure returned by the
  742. * NDIS 2.0 GetProtocolManagerInfo() API call. The data
  743. * structure is documented, in a rather haphazard way, in
  744. * section 4-17 of the NDIS 2.0 specification.
  745. */
  746. ADDR32_t ProtocolIni;
  747. UINT8_t reserved[8]; /**< Must be zero */
  748. } __attribute__ (( packed ));
  749. typedef struct s_PXENV_UNDI_INITIALIZE PXENV_UNDI_INITIALIZE_t;
  750. /** @} */ /* pxenv_undi_initialize */
  751. /** @defgroup pxenv_undi_reset_adapter PXENV_UNDI_RESET_ADAPTER
  752. *
  753. * UNDI RESET ADAPTER
  754. *
  755. * @{
  756. */
  757. /** PXE API function code for pxenv_undi_reset_adapter() */
  758. #define PXENV_UNDI_RESET_ADAPTER 0x0004
  759. /** Maximum number of multicast MAC addresses */
  760. #define MAXNUM_MCADDR 8
  761. /** List of multicast MAC addresses */
  762. struct s_PXENV_UNDI_MCAST_ADDRESS {
  763. /** Number of multicast MAC addresses */
  764. UINT16_t MCastAddrCount;
  765. /** List of up to #MAXNUM_MCADDR multicast MAC addresses */
  766. MAC_ADDR_t McastAddr[MAXNUM_MCADDR];
  767. } __attribute__ (( packed ));
  768. typedef struct s_PXENV_UNDI_MCAST_ADDRESS PXENV_UNDI_MCAST_ADDRESS_t;
  769. /** Parameter block for pxenv_undi_reset_adapter() */
  770. struct s_PXENV_UNDI_RESET {
  771. PXENV_STATUS_t Status; /**< PXE status code */
  772. /** Multicast MAC addresses */
  773. struct s_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf;
  774. } __attribute__ (( packed ));
  775. typedef struct s_PXENV_UNDI_RESET PXENV_UNDI_RESET_t;
  776. /** @} */ /* pxenv_undi_reset_adapter */
  777. /** @defgroup pxenv_undi_shutdown PXENV_UNDI_SHUTDOWN
  778. *
  779. * UNDI SHUTDOWN
  780. *
  781. * @{
  782. */
  783. /** PXE API function code for pxenv_undi_shutdown() */
  784. #define PXENV_UNDI_SHUTDOWN 0x0005
  785. /** Parameter block for pxenv_undi_shutdown() */
  786. struct s_PXENV_UNDI_SHUTDOWN {
  787. PXENV_STATUS_t Status; /**< PXE status code */
  788. } __attribute__ (( packed ));
  789. typedef struct s_PXENV_UNDI_SHUTDOWN PXENV_UNDI_SHUTDOWN_t;
  790. /** @} */ /* pxenv_undi_shutdown */
  791. /** @defgroup pxenv_undi_open PXENV_UNDI_OPEN
  792. *
  793. * UNDI OPEN
  794. *
  795. * @{
  796. */
  797. /** PXE API function code for pxenv_undi_open() */
  798. #define PXENV_UNDI_OPEN 0x0006
  799. /** Accept "directed" packets
  800. *
  801. * These are packets addresses to either this adapter's MAC address or
  802. * to any of the configured multicast MAC addresses (see
  803. * #s_PXENV_UNDI_MCAST_ADDRESS).
  804. */
  805. #define FLTR_DIRECTED 0x0001
  806. /** Accept broadcast packets */
  807. #define FLTR_BRDCST 0x0002
  808. /** Accept all packets; listen in promiscuous mode */
  809. #define FLTR_PRMSCS 0x0004
  810. /** Accept source-routed packets */
  811. #define FLTR_SRC_RTG 0x0008
  812. /** Parameter block for pxenv_undi_open() */
  813. struct s_PXENV_UNDI_OPEN {
  814. PXENV_STATUS_t Status; /**< PXE status code */
  815. /** Open flags as defined in NDIS 2.0
  816. *
  817. * This is the OpenOptions field as passed to the NDIS 2.0
  818. * OpenAdapter() API call. It is defined to be "adapter
  819. * specific", though 0 is guaranteed to be a valid value.
  820. */
  821. UINT16_t OpenFlag;
  822. /** Receive packet filter
  823. *
  824. * This is the bitwise-OR of any of the following flags:
  825. * #FLTR_DIRECTED, #FLTR_BRDCST, #FLTR_PRMSCS and
  826. * #FLTR_SRC_RTG.
  827. */
  828. UINT16_t PktFilter;
  829. /** Multicast MAC addresses */
  830. struct s_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf;
  831. } __attribute__ (( packed ));
  832. typedef struct s_PXENV_UNDI_OPEN PXENV_UNDI_OPEN_t;
  833. /** @} */ /* pxenv_undi_open */
  834. /** @defgroup pxenv_undi_close PXENV_UNDI_CLOSE
  835. *
  836. * UNDI CLOSE
  837. *
  838. * @{
  839. */
  840. /** PXE API function code for pxenv_undi_close() */
  841. #define PXENV_UNDI_CLOSE 0x0007
  842. /** Parameter block for pxenv_undi_close() */
  843. struct s_PXENV_UNDI_CLOSE {
  844. PXENV_STATUS_t Status; /**< PXE status code */
  845. } __attribute__ (( packed ));
  846. typedef struct s_PXENV_UNDI_CLOSE PXENV_UNDI_CLOSE_t;
  847. /** @} */ /* pxenv_undi_close */
  848. /** @defgroup pxenv_undi_transmit PXENV_UNDI_TRANSMIT
  849. *
  850. * UNDI TRANSMIT PACKET
  851. *
  852. * @{
  853. */
  854. /** PXE API function code for pxenv_undi_transmit() */
  855. #define PXENV_UNDI_TRANSMIT 0x0008
  856. #define P_UNKNOWN 0 /**< Media header already filled in */
  857. #define P_IP 1 /**< IP protocol */
  858. #define P_ARP 2 /**< ARP protocol */
  859. #define P_RARP 3 /**< RARP protocol */
  860. #define P_OTHER 4 /**< Other protocol */
  861. #define XMT_DESTADDR 0x0000 /**< Unicast packet */
  862. #define XMT_BROADCAST 0x0001 /**< Broadcast packet */
  863. /** Maximum number of data blocks in a transmit buffer descriptor */
  864. #define MAX_DATA_BLKS 8
  865. /** A transmit buffer descriptor, as pointed to by s_PXENV_UNDI_TRANSMIT::TBD
  866. */
  867. struct s_PXENV_UNDI_TBD {
  868. UINT16_t ImmedLength; /**< Length of the transmit buffer */
  869. SEGOFF16_t Xmit; /**< Address of the transmit buffer */
  870. UINT16_t DataBlkCount;
  871. /** Array of up to #MAX_DATA_BLKS additional transmit buffers */
  872. struct DataBlk {
  873. /** Always 1
  874. *
  875. * A value of 0 would indicate that #TDDataPtr were an
  876. * #ADDR32_t rather than a #SEGOFF16_t. The PXE
  877. * specification version 2.1 explicitly states that
  878. * this is not supported; #TDDataPtr will always be a
  879. * #SEGOFF16_t.
  880. */
  881. UINT8_t TDPtrType;
  882. UINT8_t TDRsvdByte; /**< Must be zero */
  883. UINT16_t TDDataLen; /**< Length of this transmit buffer */
  884. SEGOFF16_t TDDataPtr; /**< Address of this transmit buffer */
  885. } DataBlock[MAX_DATA_BLKS];
  886. } __attribute__ (( packed ));
  887. typedef struct s_PXENV_UNDI_TBD PXENV_UNDI_TBD_t;
  888. /** Parameter block for pxenv_undi_transmit() */
  889. struct s_PXENV_UNDI_TRANSMIT {
  890. PXENV_STATUS_t Status; /**< PXE status code */
  891. /** Protocol
  892. *
  893. * Valid values are #P_UNKNOWN, #P_IP, #P_ARP or #P_RARP. If
  894. * the caller has already filled in the media header, this
  895. * field must be set to #P_UNKNOWN.
  896. */
  897. UINT8_t Protocol;
  898. /** Unicast/broadcast flag
  899. *
  900. * Valid values are #XMT_DESTADDR or #XMT_BROADCAST.
  901. */
  902. UINT8_t XmitFlag;
  903. SEGOFF16_t DestAddr; /**< Destination MAC address */
  904. /** Address of the Transmit Buffer Descriptor
  905. *
  906. * This is a pointer to a struct s_PXENV_UNDI_TBD.
  907. */
  908. SEGOFF16_t TBD;
  909. UINT32_t Reserved[2]; /**< Must be zero */
  910. } __attribute__ (( packed ));
  911. typedef struct s_PXENV_UNDI_TRANSMIT PXENV_UNDI_TRANSMIT_t;
  912. /** @} */ /* pxenv_undi_transmit */
  913. /** @defgroup pxenv_undi_set_mcast_address PXENV_UNDI_SET_MCAST_ADDRESS
  914. *
  915. * UNDI SET MULTICAST ADDRESS
  916. *
  917. * @{
  918. */
  919. /** PXE API function code for pxenv_undi_set_mcast_address() */
  920. #define PXENV_UNDI_SET_MCAST_ADDRESS 0x0009
  921. /** Parameter block for pxenv_undi_set_mcast_address() */
  922. struct s_PXENV_UNDI_SET_MCAST_ADDRESS {
  923. PXENV_STATUS_t Status; /**< PXE status code */
  924. /** List of multicast addresses */
  925. struct s_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf;
  926. } __attribute__ (( packed ));
  927. typedef struct s_PXENV_UNDI_SET_MCAST_ADDRESS PXENV_UNDI_SET_MCAST_ADDRESS_t;
  928. /** @} */ /* pxenv_undi_set_mcast_address */
  929. /** @defgroup pxenv_undi_set_station_address PXENV_UNDI_SET_STATION_ADDRESS
  930. *
  931. * UNDI SET STATION ADDRESS
  932. *
  933. * @{
  934. */
  935. /** PXE API function code for pxenv_undi_set_station_address() */
  936. #define PXENV_UNDI_SET_STATION_ADDRESS 0x000a
  937. /** Parameter block for pxenv_undi_set_station_address() */
  938. struct s_PXENV_UNDI_SET_STATION_ADDRESS {
  939. PXENV_STATUS_t Status; /**< PXE status code */
  940. MAC_ADDR_t StationAddress; /**< Station MAC address */
  941. } __attribute__ (( packed ));
  942. typedef struct s_PXENV_UNDI_SET_STATION_ADDRESS PXENV_UNDI_SET_STATION_ADDRESS_t;
  943. /** @} */ /* pxenv_undi_set_station_address */
  944. /** @defgroup pxenv_undi_set_packet_filter PXENV_UNDI_SET_PACKET_FILTER
  945. *
  946. * UNDI SET PACKET FILTER
  947. *
  948. * @{
  949. */
  950. /** PXE API function code for pxenv_undi_set_packet_filter() */
  951. #define PXENV_UNDI_SET_PACKET_FILTER 0x000b
  952. /** Parameter block for pxenv_undi_set_packet_filter() */
  953. struct s_PXENV_UNDI_SET_PACKET_FILTER {
  954. PXENV_STATUS_t Status; /**< PXE status code */
  955. /** Receive packet filter
  956. *
  957. * This field takes the same values as
  958. * s_PXENV_UNDI_OPEN::PktFilter.
  959. *
  960. * @note Yes, this field is a different size to
  961. * s_PXENV_UNDI_OPEN::PktFilter. Blame "the managers at Intel
  962. * who apparently let a consultant come up with the spec
  963. * without any kind of adult supervision" (quote from hpa).
  964. */
  965. UINT8_t filter;
  966. } __attribute__ (( packed ));
  967. typedef struct s_PXENV_UNDI_SET_PACKET_FILTER PXENV_UNDI_SET_PACKET_FILTER_t;
  968. /** @} */ /* pxenv_undi_set_packet_filter */
  969. /** @defgroup pxenv_undi_get_information PXENV_UNDI_GET_INFORMATION
  970. *
  971. * UNDI GET INFORMATION
  972. *
  973. * @{
  974. */
  975. /** PXE API function code for pxenv_undi_get_information() */
  976. #define PXENV_UNDI_GET_INFORMATION 0x000c
  977. #define ETHER_TYPE 1 /**< Ethernet (10Mb) */
  978. #define EXP_ETHER_TYPE 2 /**< Experimental Ethernet (3Mb) */
  979. #define AX25_TYPE 3 /**< Amateur Radio AX.25 */
  980. #define TOKEN_RING_TYPE 4 /**< Proteon ProNET Token Ring */
  981. #define CHAOS_TYPE 5 /**< Chaos */
  982. #define IEEE_TYPE 6 /**< IEEE 802 Networks */
  983. #define ARCNET_TYPE 7 /**< ARCNET */
  984. /** Parameter block for pxenv_undi_get_information() */
  985. struct s_PXENV_UNDI_GET_INFORMATION {
  986. PXENV_STATUS_t Status; /**< PXE status code */
  987. UINT16_t BaseIo; /**< I/O base address */
  988. UINT16_t IntNumber; /**< IRQ number */
  989. UINT16_t MaxTranUnit; /**< Adapter MTU */
  990. /** Hardware type
  991. *
  992. * Valid values are defined in RFC1010 ("Assigned numbers"),
  993. * and are #ETHER_TYPE, #EXP_ETHER_TYPE, #AX25_TYPE,
  994. * #TOKEN_RING_TYPE, #CHAOS_TYPE, #IEEE_TYPE or #ARCNET_TYPE.
  995. */
  996. UINT16_t HwType;
  997. UINT16_t HwAddrLen; /**< MAC address length */
  998. MAC_ADDR_t CurrentNodeAddress; /**< Current MAC address */
  999. MAC_ADDR_t PermNodeAddress; /**< Permanent (EEPROM) MAC address */
  1000. SEGSEL_t ROMAddress; /**< Real-mode ROM segment address */
  1001. UINT16_t RxBufCt; /**< Receive queue length */
  1002. UINT16_t TxBufCt; /**< Transmit queue length */
  1003. } __attribute__ (( packed ));
  1004. typedef struct s_PXENV_UNDI_GET_INFORMATION PXENV_UNDI_GET_INFORMATION_t;
  1005. /** @} */ /* pxenv_undi_get_information */
  1006. /** @defgroup pxenv_undi_get_statistics PXENV_UNDI_GET_STATISTICS
  1007. *
  1008. * UNDI GET STATISTICS
  1009. *
  1010. * @{
  1011. */
  1012. /** PXE API function code for pxenv_undi_get_statistics() */
  1013. #define PXENV_UNDI_GET_STATISTICS 0x000d
  1014. /** Parameter block for pxenv_undi_get_statistics() */
  1015. struct s_PXENV_UNDI_GET_STATISTICS {
  1016. PXENV_STATUS_t Status; /**< PXE status code */
  1017. UINT32_t XmtGoodFrames; /**< Successful transmission count */
  1018. UINT32_t RcvGoodFrames; /**< Successful reception count */
  1019. UINT32_t RcvCRCErrors; /**< Receive CRC error count */
  1020. UINT32_t RcvResourceErrors; /**< Receive queue overflow count */
  1021. } __attribute__ (( packed ));
  1022. typedef struct s_PXENV_UNDI_GET_STATISTICS PXENV_UNDI_GET_STATISTICS_t;
  1023. /** @} */ /* pxenv_undi_get_statistics */
  1024. /** @defgroup pxenv_undi_clear_statistics PXENV_UNDI_CLEAR_STATISTICS
  1025. *
  1026. * UNDI CLEAR STATISTICS
  1027. *
  1028. * @{
  1029. */
  1030. /** PXE API function code for pxenv_undi_clear_statistics() */
  1031. #define PXENV_UNDI_CLEAR_STATISTICS 0x000e
  1032. /** Parameter block for pxenv_undi_clear_statistics() */
  1033. struct s_PXENV_UNDI_CLEAR_STATISTICS {
  1034. PXENV_STATUS_t Status; /**< PXE status code */
  1035. } __attribute__ (( packed ));
  1036. typedef struct s_PXENV_UNDI_CLEAR_STATISTICS PXENV_UNDI_CLEAR_STATISTICS_t;
  1037. /** @} */ /* pxenv_undi_clear_statistics */
  1038. /** @defgroup pxenv_undi_initiate_diags PXENV_UNDI_INITIATE_DIAGS
  1039. *
  1040. * UNDI INITIATE DIAGS
  1041. *
  1042. * @{
  1043. */
  1044. /** PXE API function code for pxenv_undi_initiate_diags() */
  1045. #define PXENV_UNDI_INITIATE_DIAGS 0x000f
  1046. /** Parameter block for pxenv_undi_initiate_diags() */
  1047. struct s_PXENV_UNDI_INITIATE_DIAGS {
  1048. PXENV_STATUS_t Status; /**< PXE status code */
  1049. } __attribute__ (( packed ));
  1050. typedef struct s_PXENV_UNDI_INITIATE_DIAGS PXENV_UNDI_INITIATE_DIAGS_t;
  1051. /** @} */ /* pxenv_undi_initiate_diags */
  1052. /** @defgroup pxenv_undi_force_interrupt PXENV_UNDI_FORCE_INTERRUPT
  1053. *
  1054. * UNDI FORCE INTERRUPT
  1055. *
  1056. * @{
  1057. */
  1058. /** PXE API function code for pxenv_undi_force_interrupt() */
  1059. #define PXENV_UNDI_FORCE_INTERRUPT 0x0010
  1060. /** Parameter block for pxenv_undi_force_interrupt() */
  1061. struct s_PXENV_UNDI_FORCE_INTERRUPT {
  1062. PXENV_STATUS_t Status; /**< PXE status code */
  1063. } __attribute__ (( packed ));
  1064. typedef struct s_PXENV_UNDI_FORCE_INTERRUPT PXENV_UNDI_FORCE_INTERRUPT_t;
  1065. /** @} */ /* pxenv_undi_force_interrupt */
  1066. /** @defgroup pxenv_undi_get_mcast_address PXENV_UNDI_GET_MCAST_ADDRESS
  1067. *
  1068. * UNDI GET MULTICAST ADDRESS
  1069. *
  1070. * @{
  1071. */
  1072. /** PXE API function code for pxenv_undi_get_mcast_address() */
  1073. #define PXENV_UNDI_GET_MCAST_ADDRESS 0x0011
  1074. /** Parameter block for pxenv_undi_get_mcast_address() */
  1075. struct s_PXENV_UNDI_GET_MCAST_ADDRESS {
  1076. PXENV_STATUS_t Status; /**< PXE status code */
  1077. IP4_t InetAddr; /**< Multicast IP address */
  1078. MAC_ADDR_t MediaAddr; /**< Multicast MAC address */
  1079. } __attribute__ (( packed ));
  1080. typedef struct s_PXENV_UNDI_GET_MCAST_ADDRESS PXENV_UNDI_GET_MCAST_ADDRESS_t;
  1081. /** @} */ /* pxenv_undi_get_mcast_address */
  1082. /** @defgroup pxenv_undi_get_nic_type PXENV_UNDI_GET_NIC_TYPE
  1083. *
  1084. * UNDI GET NIC TYPE
  1085. *
  1086. * @{
  1087. */
  1088. /** PXE API function code for pxenv_undi_get_nic_type() */
  1089. #define PXENV_UNDI_GET_NIC_TYPE 0x0012
  1090. #define PCI_NIC 2 /**< PCI network card */
  1091. #define PnP_NIC 3 /**< ISAPnP network card */
  1092. #define CardBus_NIC 4 /**< CardBus network card */
  1093. /** Information for a PCI or equivalent NIC */
  1094. struct pci_nic_info {
  1095. UINT16_t Vendor_ID; /**< PCI vendor ID */
  1096. UINT16_t Dev_ID; /**< PCI device ID */
  1097. UINT8_t Base_Class; /**< PCI base class */
  1098. UINT8_t Sub_Class; /**< PCI sub class */
  1099. UINT8_t Prog_Intf; /**< PCI programming interface */
  1100. UINT8_t Rev; /**< PCI revision */
  1101. UINT16_t BusDevFunc; /**< PCI bus:dev:fn address */
  1102. UINT16_t SubVendor_ID; /**< PCI subvendor ID */
  1103. UINT16_t SubDevice_ID; /**< PCI subdevice ID */
  1104. } __attribute__ (( packed ));
  1105. /** Information for an ISAPnP or equivalent NIC */
  1106. struct pnp_nic_info {
  1107. UINT32_t EISA_Dev_ID; /**< EISA device ID */
  1108. UINT8_t Base_Class; /**< Base class */
  1109. UINT8_t Sub_Class; /**< Sub class */
  1110. UINT8_t Prog_Intf; /**< Programming interface */
  1111. /** Card Select Number assigned to card */
  1112. UINT16_t CardSelNum;
  1113. } __attribute__ (( packed ));
  1114. /** Parameter block for pxenv_undi_get_nic_type() */
  1115. struct s_PXENV_UNDI_GET_NIC_TYPE {
  1116. PXENV_STATUS_t Status; /**< PXE status code */
  1117. /** NIC type
  1118. *
  1119. * Valid values are #PCI_NIC, #PnP_NIC or #CardBus_NIC.
  1120. */
  1121. UINT8_t NicType;
  1122. /** NIC information */
  1123. union nic_type_info {
  1124. /** NIC information (if #NicType==#PCI_NIC) */
  1125. struct pci_nic_info pci;
  1126. /** NIC information (if #NicType==#CardBus_NIC) */
  1127. struct pci_nic_info cardbus;
  1128. /** NIC information (if #NicType==#PnP_NIC) */
  1129. struct pnp_nic_info pnp;
  1130. } info;
  1131. } __attribute__ (( packed ));
  1132. typedef struct s_PXENV_UNDI_GET_NIC_TYPE PXENV_UNDI_GET_NIC_TYPE_t;
  1133. /** @} */ /* pxenv_undi_get_nic_type */
  1134. /** @defgroup pxenv_undi_get_iface_info PXENV_UNDI_GET_IFACE_INFO
  1135. *
  1136. * UNDI GET IFACE INFO
  1137. *
  1138. * @{
  1139. */
  1140. /** PXE API function code for pxenv_undi_get_iface_info() */
  1141. #define PXENV_UNDI_GET_IFACE_INFO 0x0013
  1142. /** Broadcast supported */
  1143. #define SUPPORTED_BROADCAST 0x0001
  1144. /** Multicast supported */
  1145. #define SUPPORTED_MULTICAST 0x0002
  1146. /** Functional/group addressing supported */
  1147. #define SUPPORTED_GROUP 0x0004
  1148. /** Promiscuous mode supported */
  1149. #define SUPPORTED_PROMISCUOUS 0x0008
  1150. /** Software settable station address */
  1151. #define SUPPORTED_SET_STATION_ADDRESS 0x0010
  1152. /** InitiateDiagnostics supported */
  1153. #define SUPPORTED_DIAGNOSTICS 0x0040
  1154. /** Reset MAC supported */
  1155. #define SUPPORTED_RESET 0x0400
  1156. /** Open / Close Adapter supported */
  1157. #define SUPPORTED_OPEN_CLOSE 0x0800
  1158. /** Interrupt Request supported */
  1159. #define SUPPORTED_IRQ 0x1000
  1160. /** Parameter block for pxenv_undi_get_iface_info() */
  1161. struct s_PXENV_UNDI_GET_IFACE_INFO {
  1162. PXENV_STATUS_t Status; /**< PXE status code */
  1163. /** Interface type
  1164. *
  1165. * This is defined in the NDIS 2.0 specification to be one of
  1166. * the strings "802.3", "802.4", "802.5", "802.6", "DIX",
  1167. * "DIX+802.3", "APPLETALK", "ARCNET", "FDDI", "SDLC", "BSC",
  1168. * "HDLC", or "ISDN".
  1169. *
  1170. * "Normal" Ethernet, for various historical reasons, is
  1171. * "DIX+802.3".
  1172. */
  1173. UINT8_t IfaceType[16];
  1174. UINT32_t LinkSpeed; /**< Link speed, in bits per second */
  1175. /** Service flags
  1176. *
  1177. * These are the "service flags" defined in the "MAC
  1178. * Service-Specific Characteristics" table in the NDIS 2.0
  1179. * specification. Almost all of them are irrelevant to PXE.
  1180. */
  1181. UINT32_t ServiceFlags;
  1182. UINT32_t Reserved[4]; /**< Must be zero */
  1183. } __attribute__ (( packed ));
  1184. typedef struct s_PXENV_UNDI_GET_IFACE_INFO PXENV_UNDI_GET_IFACE_INFO_t;
  1185. /** @} */ /* pxenv_undi_get_iface_info */
  1186. /** @defgroup pxenv_undi_get_state PXENV_UNDI_GET_STATE
  1187. *
  1188. * UNDI GET STATE
  1189. *
  1190. * @{
  1191. */
  1192. /** PXE API function code for pxenv_undi_get_state() */
  1193. #define PXENV_UNDI_GET_STATE 0x0015
  1194. /** pxenv_start_undi() has been called */
  1195. #define PXE_UNDI_GET_STATE_STARTED 1
  1196. /** pxenv_undi_initialize() has been called */
  1197. #define PXE_UNDI_GET_STATE_INITIALIZED 2
  1198. /** pxenv_undi_open() has been called */
  1199. #define PXE_UNDI_GET_STATE_OPENED 3
  1200. /** Parameter block for pxenv_undi_get_state() */
  1201. struct s_PXENV_UNDI_GET_STATE {
  1202. PXENV_STATUS_t Status; /**< PXE status code */
  1203. /** Current state of the UNDI driver
  1204. *
  1205. * Valid values are #PXE_UNDI_GET_STATE_STARTED,
  1206. * #PXE_UNDI_GET_STATE_INITIALIZED or
  1207. * #PXE_UNDI_GET_STATE_OPENED.
  1208. */
  1209. UINT8_t UNDIstate;
  1210. } __attribute__ (( packed ));
  1211. typedef struct s_PXENV_UNDI_GET_STATE PXENV_UNDI_GET_STATE_t;
  1212. /** @} */ /* pxenv_undi_get_state */
  1213. /** @defgroup pxenv_undi_isr PXENV_UNDI_ISR
  1214. *
  1215. * UNDI ISR
  1216. *
  1217. * @{
  1218. */
  1219. /** PXE API function code for pxenv_undi_isr() */
  1220. #define PXENV_UNDI_ISR 0x0014
  1221. /** Determine whether or not this is our interrupt */
  1222. #define PXENV_UNDI_ISR_IN_START 1
  1223. /** Start processing interrupt */
  1224. #define PXENV_UNDI_ISR_IN_PROCESS 2
  1225. /** Continue processing interrupt */
  1226. #define PXENV_UNDI_ISR_IN_GET_NEXT 3
  1227. /** This interrupt was ours */
  1228. #define PXENV_UNDI_ISR_OUT_OURS 0
  1229. /** This interrupt was not ours */
  1230. #define PXENV_UNDI_ISR_OUT_NOT_OURS 1
  1231. /** Finished processing interrupt */
  1232. #define PXENV_UNDI_ISR_OUT_DONE 0
  1233. /** A packet transmission has completed */
  1234. #define PXENV_UNDI_ISR_OUT_TRANSMIT 2
  1235. /** A packet has been received */
  1236. #define PXENV_UNDI_ISR_OUT_RECEIVE 3
  1237. /** We are already in the middle of processing an interrupt */
  1238. #define PXENV_UNDI_ISR_OUT_BUSY 4
  1239. /** Unicast packet (or packet captured in promiscuous mode) */
  1240. #define P_DIRECTED 0
  1241. /** Broadcast packet */
  1242. #define P_BROADCAST 1
  1243. /** Multicast packet */
  1244. #define P_MULTICAST 2
  1245. /** Parameter block for pxenv_undi_isr() */
  1246. struct s_PXENV_UNDI_ISR {
  1247. PXENV_STATUS_t Status; /**< PXE status code */
  1248. /** Function flag
  1249. *
  1250. * Valid values are #PXENV_UNDI_ISR_IN_START,
  1251. * #PXENV_UNDI_ISR_IN_PROCESS, #PXENV_UNDI_ISR_IN_GET_NEXT,
  1252. * #PXENV_UNDI_ISR_OUT_OURS, #PXENV_UNDI_ISR_OUT_NOT_OURS,
  1253. * #PXENV_UNDI_ISR_OUT_DONE, #PXENV_UNDI_ISR_OUT_TRANSMIT,
  1254. * #PXENV_UNDI_ISR_OUT_RECEIVE or #PXENV_UNDI_ISR_OUT_BUSY.
  1255. */
  1256. UINT16_t FuncFlag;
  1257. UINT16_t BufferLength; /**< Data buffer length */
  1258. UINT16_t FrameLength; /**< Total frame length */
  1259. UINT16_t FrameHeaderLength; /**< Frame header length */
  1260. SEGOFF16_t Frame; /**< Data buffer address */
  1261. /** Protocol type
  1262. *
  1263. * Valid values are #P_IP, #P_ARP, #P_RARP or #P_OTHER.
  1264. */
  1265. UINT8_t ProtType;
  1266. /** Packet type
  1267. *
  1268. * Valid values are #P_DIRECTED, #P_BROADCAST or #P_MULTICAST.
  1269. */
  1270. UINT8_t PktType;
  1271. } __attribute__ (( packed ));
  1272. typedef struct s_PXENV_UNDI_ISR PXENV_UNDI_ISR_t;
  1273. /** @} */ /* pxenv_undi_isr */
  1274. /** @} */ /* pxe_undi_api */
  1275. /** @defgroup pxe_file_api PXE FILE API
  1276. *
  1277. * POSIX-like file operations
  1278. *
  1279. * @{
  1280. */
  1281. /** Minimum possible opcode used within PXE FILE API */
  1282. #define PXENV_FILE_MIN 0x00e0
  1283. /** Minimum possible opcode used within PXE FILE API */
  1284. #define PXENV_FILE_MAX 0x00ef
  1285. /** @defgroup pxenv_file_open PXENV_FILE_OPEN
  1286. *
  1287. * FILE OPEN
  1288. *
  1289. * @{
  1290. */
  1291. /** PXE API function code for pxenv_file_open() */
  1292. #define PXENV_FILE_OPEN 0x00e0
  1293. /** Parameter block for pxenv_file_open() */
  1294. struct s_PXENV_FILE_OPEN {
  1295. PXENV_STATUS_t Status; /**< PXE status code */
  1296. UINT16_t FileHandle; /**< File handle */
  1297. SEGOFF16_t FileName; /**< File URL */
  1298. UINT32_t Reserved; /**< Reserved */
  1299. } __attribute__ (( packed ));
  1300. typedef struct s_PXENV_FILE_OPEN PXENV_FILE_OPEN_t;
  1301. /** @} */ /* pxenv_file_open */
  1302. /** @defgroup pxenv_file_close PXENV_FILE_CLOSE
  1303. *
  1304. * FILE CLOSE
  1305. *
  1306. * @{
  1307. */
  1308. /** PXE API function code for pxenv_file_close() */
  1309. #define PXENV_FILE_CLOSE 0x00e1
  1310. /** Parameter block for pxenv_file_close() */
  1311. struct s_PXENV_FILE_CLOSE {
  1312. PXENV_STATUS_t Status; /**< PXE status code */
  1313. UINT16_t FileHandle; /**< File handle */
  1314. } __attribute__ (( packed ));
  1315. typedef struct s_PXENV_FILE_CLOSE PXENV_FILE_CLOSE_t;
  1316. /** @} */ /* pxenv_file_close */
  1317. /** @defgroup pxenv_file_select PXENV_FILE_SELECT
  1318. *
  1319. * FILE SELECT
  1320. *
  1321. * @{
  1322. */
  1323. /** PXE API function code for pxenv_file_select() */
  1324. #define PXENV_FILE_SELECT 0x00e2
  1325. /** File is ready for reading */
  1326. #define RDY_READ 0x0001
  1327. /** Parameter block for pxenv_file_select() */
  1328. struct s_PXENV_FILE_SELECT {
  1329. PXENV_STATUS_t Status; /**< PXE status code */
  1330. UINT16_t FileHandle; /**< File handle */
  1331. UINT16_t Ready; /**< Indication of readiness */
  1332. } __attribute__ (( packed ));
  1333. typedef struct s_PXENV_FILE_SELECT PXENV_FILE_SELECT_t;
  1334. /** @} */ /* pxenv_file_select */
  1335. /** @defgroup pxenv_file_read PXENV_FILE_READ
  1336. *
  1337. * FILE READ
  1338. *
  1339. * @{
  1340. */
  1341. /** PXE API function code for pxenv_file_read() */
  1342. #define PXENV_FILE_READ 0x00e3
  1343. /** Parameter block for pxenv_file_read() */
  1344. struct s_PXENV_FILE_READ {
  1345. PXENV_STATUS_t Status; /**< PXE status code */
  1346. UINT16_t FileHandle; /**< File handle */
  1347. UINT16_t BufferSize; /**< Data buffer size */
  1348. SEGOFF16_t Buffer; /**< Data buffer */
  1349. } __attribute__ (( packed ));
  1350. typedef struct s_PXENV_FILE_READ PXENV_FILE_READ_t;
  1351. /** @} */ /* pxenv_file_read */
  1352. /** @defgroup pxenv_get_file_size PXENV_GET_FILE_SIZE
  1353. *
  1354. * GET FILE SIZE
  1355. *
  1356. * @{
  1357. */
  1358. /** PXE API function code for pxenv_get_file_size() */
  1359. #define PXENV_GET_FILE_SIZE 0x00e4
  1360. /** Parameter block for pxenv_get_file_size() */
  1361. struct s_PXENV_GET_FILE_SIZE {
  1362. PXENV_STATUS_t Status; /**< PXE status code */
  1363. UINT16_t FileHandle; /**< File handle */
  1364. UINT32_t FileSize; /**< File size */
  1365. } __attribute__ (( packed ));
  1366. typedef struct s_PXENV_GET_FILE_SIZE PXENV_GET_FILE_SIZE_t;
  1367. /** @} */ /* pxenv_get_file_size */
  1368. /** @defgroup pxenv_file_exec PXENV_FILE_EXEC
  1369. *
  1370. * FILE EXEC
  1371. *
  1372. * @{
  1373. */
  1374. /** PXE API function code for pxenv_file_exec() */
  1375. #define PXENV_FILE_EXEC 0x00e5
  1376. /** Parameter block for pxenv_file_exec() */
  1377. struct s_PXENV_FILE_EXEC {
  1378. PXENV_STATUS_t Status; /**< PXE status code */
  1379. SEGOFF16_t Command; /**< Command to execute */
  1380. } __attribute__ (( packed ));
  1381. typedef struct s_PXENV_FILE_EXEC PXENV_FILE_EXEC_t;
  1382. /** @} */ /* pxenv_file_exec */
  1383. /** @defgroup pxenv_file_api_check PXENV_FILE_API_CHECK
  1384. *
  1385. * FILE API CHECK
  1386. *
  1387. * @{
  1388. */
  1389. /** PXE API function code for pxenv_file_api_check() */
  1390. #define PXENV_FILE_API_CHECK 0x00e6
  1391. /** Parameter block for pxenv_file_api_check() */
  1392. struct s_PXENV_FILE_API_CHECK {
  1393. PXENV_STATUS_t Status; /**< PXE status code */
  1394. UINT16_t Size; /**< Size of structure */
  1395. UINT32_t Magic; /**< Magic number */
  1396. UINT32_t Provider; /**< Implementation identifier */
  1397. UINT32_t APIMask; /**< Supported API functions */
  1398. UINT32_t Flags; /**< Reserved for the future */
  1399. } __attribute__ (( packed ));
  1400. typedef struct s_PXENV_FILE_API_CHECK PXENV_FILE_API_CHECK_t;
  1401. /** @} */ /* pxenv_file_api_check */
  1402. /** @defgroup pxenv_file_exit_hook PXENV_FILE_EXIT_HOOK
  1403. *
  1404. * FILE EXIT HOOK
  1405. *
  1406. * @{
  1407. */
  1408. /** PXE API function code for pxenv_file_exit_hook() */
  1409. #define PXENV_FILE_EXIT_HOOK 0x00e7
  1410. /** Parameter block for pxenv_file_exit_hook() */
  1411. struct s_PXENV_FILE_EXIT_HOOK {
  1412. PXENV_STATUS_t Status; /**< PXE status code */
  1413. SEGOFF16_t Hook; /**< SEG16:OFF16 to jump to */
  1414. } __attribute__ (( packed ));
  1415. typedef struct s_PXENV_FILE_EXIT_HOOK PXENV_FILE_EXIT_HOOK_t;
  1416. /** @} */ /* pxenv_file_exit_hook */
  1417. /** @defgroup pxenv_file_cmdline PXENV_FILE_CMDLINE
  1418. *
  1419. * FILE CMDLINE
  1420. *
  1421. * @{
  1422. */
  1423. /** PXE API function code for pxenv_file_cmdline() */
  1424. #define PXENV_FILE_CMDLINE 0x00e8
  1425. /** Parameter block for pxenv_file_cmdline() */
  1426. struct s_PXENV_FILE_CMDLINE {
  1427. PXENV_STATUS_t Status; /**< PXE status code */
  1428. UINT16_t BufferSize; /**< Data buffer size */
  1429. SEGOFF16_t Buffer; /**< Data buffer */
  1430. } __attribute__ (( packed ));
  1431. typedef struct s_PXENV_FILE_CMDLINE PXENV_FILE_CMDLINE_t;
  1432. /** @} */ /* pxe_file_cmdline */
  1433. /** @} */ /* pxe_file_api */
  1434. /** @defgroup pxe_loader_api PXE Loader API
  1435. *
  1436. * The UNDI ROM loader API
  1437. *
  1438. * @{
  1439. */
  1440. /** Parameter block for undi_loader() */
  1441. struct s_UNDI_LOADER {
  1442. /** PXE status code */
  1443. PXENV_STATUS_t Status;
  1444. /** %ax register as for PXENV_START_UNDI */
  1445. UINT16_t AX;
  1446. /** %bx register as for PXENV_START_UNDI */
  1447. UINT16_t BX;
  1448. /** %dx register as for PXENV_START_UNDI */
  1449. UINT16_t DX;
  1450. /** %di register as for PXENV_START_UNDI */
  1451. OFF16_t DI;
  1452. /** %es register as for PXENV_START_UNDI */
  1453. SEGSEL_t ES;
  1454. /** UNDI data segment
  1455. *
  1456. * @note The PXE specification defines the type of this field
  1457. * as #UINT16_t. For x86, #SEGSEL_t and #UINT16_t are
  1458. * equivalent anyway; for other architectures #SEGSEL_t makes
  1459. * more sense.
  1460. */
  1461. SEGSEL_t UNDI_DS;
  1462. /** UNDI code segment
  1463. *
  1464. * @note The PXE specification defines the type of this field
  1465. * as #UINT16_t. For x86, #SEGSEL_t and #UINT16_t are
  1466. * equivalent anyway; for other architectures #SEGSEL_t makes
  1467. * more sense.
  1468. */
  1469. SEGSEL_t UNDI_CS;
  1470. /** Address of the !PXE structure (a struct s_PXE) */
  1471. SEGOFF16_t PXEptr;
  1472. /** Address of the PXENV+ structure (a struct s_PXENV) */
  1473. SEGOFF16_t PXENVptr;
  1474. } __attribute__ (( packed ));
  1475. typedef struct s_UNDI_LOADER UNDI_LOADER_t;
  1476. /** @} */ /* pxe_loader_api */
  1477. /** @} */ /* pxe */
  1478. /** @page pxe_notes Etherboot PXE implementation notes
  1479. @section pxe_routing IP routing
  1480. Several PXE API calls (e.g. pxenv_tftp_open() and pxenv_udp_write())
  1481. allow for the caller to specify a "relay agent IP address", often in a
  1482. field called "gateway" or similar. The PXE specification states that
  1483. "The IP layer should provide space for a minimum of four routing
  1484. entries obtained from the default router and static route DHCP option
  1485. tags in the DHCPACK message, plus any non-zero giaddr field from the
  1486. DHCPOFFER message(s) accepted by the client".
  1487. The DHCP static route option ("option static-routes" in dhcpd.conf)
  1488. works only for classed IP routing (i.e. it provides no way to specify
  1489. a subnet mask). Since virtually everything now uses classless IP
  1490. routing, the DHCP static route option is almost totally useless, and
  1491. is (according to the dhcp-options man page) not implemented by any of
  1492. the popular DHCP clients.
  1493. This leaves the caller-specified "relay agent IP address", the giaddr
  1494. field from the DHCPOFFER message(s) and the default gateway(s)
  1495. provided via the routers option ("option routers" in dhcpd.conf) in
  1496. the DHCPACK message. Each of these is a default gateway address.
  1497. It's a fair bet that the routers option should take priority over the
  1498. giaddr field, since the routers option has to be explicitly specified
  1499. by the DHCP server operator. Similarly, it's fair to assume that the
  1500. caller-specified "relay agent IP address", if present, should take
  1501. priority over any other routing table entries.
  1502. @bug Etherboot currently ignores all potential sources of routing
  1503. information other than the first router provided to it by a DHCP
  1504. routers option.
  1505. @section pxe_x86_modes x86 processor mode restrictions
  1506. On the x86 platform, different PXE API calls have different
  1507. restrictions on the processor modes (real or protected) that can be
  1508. used. See the individual API call descriptions for the restrictions
  1509. that apply to any particular call.
  1510. @subsection pxe_x86_pmode16 Real mode, or protected-mode with 16-bit stack
  1511. The PXE specification states that the API function can be called in
  1512. protected mode only if the s_PXE::StatusCallout field is set to a
  1513. non-zero value, and that the API function cannot be called with a
  1514. 32-bit stack segment.
  1515. Etherboot does not enforce either of these restrictions; they seem (as
  1516. with so much of the PXE specification) to be artifacts of the Intel
  1517. implementation.
  1518. */
  1519. #endif /* PXE_API_H */