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 54KB

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