Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

pxe_api.h 51KB

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