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

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