選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

pxe_api.h 51KB

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