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.

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