Source code of Windows XP (NT5)
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.

463 lines
15 KiB

  1. #ifndef _EFIPXEBC_H
  2. #define _EFIPXEBC_H
  3. /*++
  4. Copyright (c) 1998 Intel Corporation
  5. Module Name:
  6. efipxebc.h
  7. Abstract:
  8. EFI PXE Base Code Protocol
  9. Revision History
  10. --*/
  11. /*
  12. * PXE Base Code protocol
  13. */
  14. #define EFI_PXE_BASE_CODE_PROTOCOL \
  15. { 0x03c4e603, 0xac28, 0x11d3, 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
  16. INTERFACE_DECL(_EFI_PXE_BASE_CODE);
  17. #define DEFAULT_TTL 4
  18. #define DEFAULT_ToS 0
  19. /*
  20. * Address definitions
  21. */
  22. typedef union {
  23. UINT32 Addr[4];
  24. EFI_IPv4_ADDRESS v4;
  25. EFI_IPv6_ADDRESS v6;
  26. } EFI_IP_ADDRESS;
  27. typedef UINT16 EFI_PXE_BASE_CODE_UDP_PORT;
  28. /*
  29. * Packet definitions
  30. */
  31. typedef struct {
  32. UINT8 BootpOpcode;
  33. UINT8 BootpHwType;
  34. UINT8 BootpHwAddrLen;
  35. UINT8 BootpGateHops;
  36. UINT32 BootpIdent;
  37. UINT16 BootpSeconds;
  38. UINT16 BootpFlags;
  39. UINT8 BootpCiAddr[4];
  40. UINT8 BootpYiAddr[4];
  41. UINT8 BootpSiAddr[4];
  42. UINT8 BootpGiAddr[4];
  43. UINT8 BootpHwAddr[16];
  44. UINT8 BootpSrvName[64];
  45. UINT8 BootpBootFile[128];
  46. UINT32 DhcpMagik;
  47. UINT8 DhcpOptions[56];
  48. } EFI_PXE_BASE_CODE_DHCPV4_PACKET;
  49. /* TBD in EFI v1.1
  50. * typedef struct {
  51. * UINT8 reserved;
  52. * } EFI_PXE_BASE_CODE_DHCPV6_PACKET; */
  53. typedef union {
  54. UINT8 Raw[1472];
  55. EFI_PXE_BASE_CODE_DHCPV4_PACKET Dhcpv4;
  56. /* EFI_PXE_BASE_CODE_DHCPV6_PACKET Dhcpv6; */
  57. } EFI_PXE_BASE_CODE_PACKET;
  58. typedef struct {
  59. UINT8 Type;
  60. UINT8 Code;
  61. UINT16 Checksum;
  62. union {
  63. UINT32 reserved;
  64. UINT32 Mtu;
  65. UINT32 Pointer;
  66. struct {
  67. UINT16 Identifier;
  68. UINT16 Sequence;
  69. } Echo;
  70. } u;
  71. UINT8 Data[494];
  72. } EFI_PXE_BASE_CODE_ICMP_ERROR;
  73. typedef struct {
  74. UINT8 ErrorCode;
  75. CHAR8 ErrorString[127];
  76. } EFI_PXE_BASE_CODE_TFTP_ERROR;
  77. /*
  78. * IP Receive Filter definitions
  79. */
  80. #define EFI_PXE_BASE_CODE_MAX_IPCNT 8
  81. typedef struct {
  82. UINT8 Filters;
  83. UINT8 IpCnt;
  84. UINT16 reserved;
  85. EFI_IP_ADDRESS IpList[EFI_PXE_BASE_CODE_MAX_IPCNT];
  86. } EFI_PXE_BASE_CODE_IP_FILTER;
  87. #define EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP 0x0001
  88. #define EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST 0x0002
  89. #define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS 0x0004
  90. #define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST 0x0008
  91. /*
  92. * ARP Cache definitions
  93. */
  94. typedef struct {
  95. EFI_IP_ADDRESS IpAddr;
  96. EFI_MAC_ADDRESS MacAddr;
  97. } EFI_PXE_BASE_CODE_ARP_ENTRY;
  98. typedef struct {
  99. EFI_IP_ADDRESS IpAddr;
  100. EFI_IP_ADDRESS SubnetMask;
  101. EFI_IP_ADDRESS GwAddr;
  102. } EFI_PXE_BASE_CODE_ROUTE_ENTRY;
  103. /*
  104. * UDP definitions
  105. */
  106. #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP 0x0001
  107. #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT 0x0002
  108. #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP 0x0004
  109. #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT 0x0008
  110. #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_FILTER 0x0010
  111. #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_MAY_FRAGMENT 0x0020
  112. /*
  113. * Discover() definitions
  114. */
  115. #define EFI_PXE_BASE_CODE_BOOT_TYPE_BOOTSTRAP 0
  116. #define EFI_PXE_BASE_CODE_BOOT_TYPE_MS_WINNT_RIS 1
  117. #define EFI_PXE_BASE_CODE_BOOT_TYPE_INTEL_LCM 2
  118. #define EFI_PXE_BASE_CODE_BOOT_TYPE_DOSUNDI 3
  119. #define EFI_PXE_BASE_CODE_BOOT_TYPE_NEC_ESMPRO 4
  120. #define EFI_PXE_BASE_CODE_BOOT_TYPE_IBM_WSoD 5
  121. #define EFI_PXE_BASE_CODE_BOOT_TYPE_IBM_LCCM 6
  122. #define EFI_PXE_BASE_CODE_BOOT_TYPE_CA_UNICENTER_TNG 7
  123. #define EFI_PXE_BASE_CODE_BOOT_TYPE_HP_OPENVIEW 8
  124. #define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_9 9
  125. #define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_10 10
  126. #define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_11 11
  127. #define EFI_PXE_BASE_CODE_BOOT_TYPE_NOT_USED_12 12
  128. #define EFI_PXE_BASE_CODE_BOOT_TYPE_REDHAT_INSTALL 13
  129. #define EFI_PXE_BASE_CODE_BOOT_TYPE_REDHAT_BOOT 14
  130. #define EFI_PXE_BASE_CODE_BOOT_TYPE_REMBO 15
  131. #define EFI_PXE_BASE_CODE_BOOT_TYPE_BEOBOOT 16
  132. /*
  133. * 17 through 32767 are reserved
  134. * 32768 through 65279 are for vendor use
  135. * 65280 through 65534 are reserved
  136. */
  137. #define EFI_PXE_BASE_CODE_BOOT_TYPE_PXETEST 65535
  138. #define EFI_PXE_BASE_CODE_BOOT_LAYER_MASK 0x7FFF
  139. #define EFI_PXE_BASE_CODE_BOOT_LAYER_INITIAL 0x0000
  140. typedef struct {
  141. UINT16 Type;
  142. BOOLEAN AcceptAnyResponse;
  143. UINT8 Reserved;
  144. EFI_IP_ADDRESS IpAddr;
  145. } EFI_PXE_BASE_CODE_SRVLIST;
  146. typedef struct {
  147. BOOLEAN UseMCast;
  148. BOOLEAN UseBCast;
  149. BOOLEAN UseUCast;
  150. BOOLEAN MustUseList;
  151. EFI_IP_ADDRESS ServerMCastIp;
  152. UINT16 IpCnt;
  153. EFI_PXE_BASE_CODE_SRVLIST SrvList[1];
  154. } EFI_PXE_BASE_CODE_DISCOVER_INFO;
  155. /*
  156. * Mtftp() definitions
  157. */
  158. typedef enum {
  159. EFI_PXE_BASE_CODE_TFTP_FIRST,
  160. EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE,
  161. EFI_PXE_BASE_CODE_TFTP_READ_FILE,
  162. EFI_PXE_BASE_CODE_TFTP_WRITE_FILE,
  163. EFI_PXE_BASE_CODE_TFTP_READ_DIRECTORY,
  164. EFI_PXE_BASE_CODE_MTFTP_GET_FILE_SIZE,
  165. EFI_PXE_BASE_CODE_MTFTP_READ_FILE,
  166. EFI_PXE_BASE_CODE_MTFTP_READ_DIRECTORY,
  167. EFI_PXE_BASE_CODE_MTFTP_LAST
  168. } EFI_PXE_BASE_CODE_TFTP_OPCODE;
  169. typedef struct {
  170. EFI_IP_ADDRESS MCastIp;
  171. EFI_PXE_BASE_CODE_UDP_PORT CPort;
  172. EFI_PXE_BASE_CODE_UDP_PORT SPort;
  173. UINT16 ListenTimeout;
  174. UINT16 TransmitTimeout;
  175. } EFI_PXE_BASE_CODE_MTFTP_INFO;
  176. /*
  177. * PXE Base Code Mode structure
  178. */
  179. #define EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES 8
  180. #define EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES 8
  181. typedef struct {
  182. BOOLEAN Started;
  183. BOOLEAN Ipv6Available;
  184. BOOLEAN Ipv6Supported;
  185. BOOLEAN UsingIpv6;
  186. BOOLEAN BisSupported;
  187. BOOLEAN BisDetected;
  188. BOOLEAN AutoArp;
  189. BOOLEAN SendGUID;
  190. BOOLEAN DhcpDiscoverValid;
  191. BOOLEAN DhcpAckReceived;
  192. BOOLEAN ProxyOfferReceived;
  193. BOOLEAN PxeDiscoverValid;
  194. BOOLEAN PxeReplyReceived;
  195. BOOLEAN PxeBisReplyReceived;
  196. BOOLEAN IcmpErrorReceived;
  197. BOOLEAN TftpErrorReceived;
  198. BOOLEAN MakeCallbacks;
  199. UINT8 TTL;
  200. UINT8 ToS;
  201. EFI_IP_ADDRESS StationIp;
  202. EFI_IP_ADDRESS SubnetMask;
  203. EFI_PXE_BASE_CODE_PACKET DhcpDiscover;
  204. EFI_PXE_BASE_CODE_PACKET DhcpAck;
  205. EFI_PXE_BASE_CODE_PACKET ProxyOffer;
  206. EFI_PXE_BASE_CODE_PACKET PxeDiscover;
  207. EFI_PXE_BASE_CODE_PACKET PxeReply;
  208. EFI_PXE_BASE_CODE_PACKET PxeBisReply;
  209. EFI_PXE_BASE_CODE_IP_FILTER IpFilter;
  210. UINT32 ArpCacheEntries;
  211. EFI_PXE_BASE_CODE_ARP_ENTRY ArpCache[EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES];
  212. UINT32 RouteTableEntries;
  213. EFI_PXE_BASE_CODE_ROUTE_ENTRY RouteTable[EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES];
  214. EFI_PXE_BASE_CODE_ICMP_ERROR IcmpError;
  215. EFI_PXE_BASE_CODE_TFTP_ERROR TftpError;
  216. } EFI_PXE_BASE_CODE_MODE;
  217. /*
  218. * PXE Base Code Interface Function definitions
  219. */
  220. typedef
  221. EFI_STATUS
  222. (EFIAPI *EFI_PXE_BASE_CODE_START) (
  223. IN struct _EFI_PXE_BASE_CODE *This,
  224. IN BOOLEAN UseIpv6
  225. );
  226. typedef
  227. EFI_STATUS
  228. (EFIAPI *EFI_PXE_BASE_CODE_STOP) (
  229. IN struct _EFI_PXE_BASE_CODE *This
  230. );
  231. typedef
  232. EFI_STATUS
  233. (EFIAPI *EFI_PXE_BASE_CODE_DHCP) (
  234. IN struct _EFI_PXE_BASE_CODE *This,
  235. IN BOOLEAN SortOffers
  236. );
  237. typedef
  238. EFI_STATUS
  239. (EFIAPI *EFI_PXE_BASE_CODE_DISCOVER) (
  240. IN struct _EFI_PXE_BASE_CODE *This,
  241. IN UINT16 Type,
  242. IN UINT16 *Layer,
  243. IN BOOLEAN UseBis,
  244. IN OUT EFI_PXE_BASE_CODE_DISCOVER_INFO *Info OPTIONAL
  245. );
  246. typedef
  247. EFI_STATUS
  248. (EFIAPI *EFI_PXE_BASE_CODE_MTFTP) (
  249. IN struct _EFI_PXE_BASE_CODE *This,
  250. IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation,
  251. IN OUT VOID *BufferPtr OPTIONAL,
  252. IN BOOLEAN Overwrite,
  253. IN OUT UINTN *BufferSize,
  254. IN UINTN *BlockSize OPTIONAL,
  255. IN EFI_IP_ADDRESS *ServerIp,
  256. IN UINT8 *Filename,
  257. IN EFI_PXE_BASE_CODE_MTFTP_INFO *Info OPTIONAL,
  258. IN BOOLEAN DontUseBuffer
  259. );
  260. typedef
  261. EFI_STATUS
  262. (EFIAPI *EFI_PXE_BASE_CODE_UDP_WRITE) (
  263. IN struct _EFI_PXE_BASE_CODE *This,
  264. IN UINT16 OpFlags,
  265. IN EFI_IP_ADDRESS *DestIp,
  266. IN EFI_PXE_BASE_CODE_UDP_PORT *DestPort,
  267. IN EFI_IP_ADDRESS *GatewayIp, OPTIONAL
  268. IN EFI_IP_ADDRESS *SrcIp, OPTIONAL
  269. IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL
  270. IN UINTN *HeaderSize, OPTIONAL
  271. IN VOID *HeaderPtr, OPTIONAL
  272. IN UINTN *BufferSize,
  273. IN VOID *BufferPtr
  274. );
  275. typedef
  276. EFI_STATUS
  277. (EFIAPI *EFI_PXE_BASE_CODE_UDP_READ) (
  278. IN struct _EFI_PXE_BASE_CODE *This,
  279. IN UINT16 OpFlags,
  280. IN OUT EFI_IP_ADDRESS *DestIp, OPTIONAL
  281. IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPort, OPTIONAL
  282. IN OUT EFI_IP_ADDRESS *SrcIp, OPTIONAL
  283. IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL
  284. IN UINTN *HeaderSize, OPTIONAL
  285. IN VOID *HeaderPtr, OPTIONAL
  286. IN OUT UINTN *BufferSize,
  287. IN VOID *BufferPtr
  288. );
  289. typedef
  290. EFI_STATUS
  291. (EFIAPI *EFI_PXE_BASE_CODE_SET_IP_FILTER) (
  292. IN struct _EFI_PXE_BASE_CODE *This,
  293. IN EFI_PXE_BASE_CODE_IP_FILTER *NewFilter
  294. );
  295. typedef
  296. EFI_STATUS
  297. (EFIAPI *EFI_PXE_BASE_CODE_ARP) (
  298. IN struct _EFI_PXE_BASE_CODE *This,
  299. IN EFI_IP_ADDRESS *IpAddr,
  300. IN EFI_MAC_ADDRESS *MacAddr OPTIONAL
  301. );
  302. typedef
  303. EFI_STATUS
  304. (EFIAPI *EFI_PXE_BASE_CODE_SET_PARAMETERS) (
  305. IN struct _EFI_PXE_BASE_CODE *This,
  306. IN BOOLEAN *NewAutoArp, OPTIONAL
  307. IN BOOLEAN *NewSendGUID, OPTIONAL
  308. IN UINT8 *NewTTL, OPTIONAL
  309. IN UINT8 *NewToS, OPTIONAL
  310. IN BOOLEAN *NewMakeCallback OPTIONAL
  311. );
  312. typedef
  313. EFI_STATUS
  314. (EFIAPI *EFI_PXE_BASE_CODE_SET_STATION_IP) (
  315. IN struct _EFI_PXE_BASE_CODE *This,
  316. IN EFI_IP_ADDRESS *NewStationIp, OPTIONAL
  317. IN EFI_IP_ADDRESS *NewSubnetMask OPTIONAL
  318. );
  319. typedef
  320. EFI_STATUS
  321. (EFIAPI *EFI_PXE_BASE_CODE_SET_PACKETS) (
  322. IN struct _EFI_PXE_BASE_CODE *This,
  323. BOOLEAN *NewDhcpDiscoverValid, OPTIONAL
  324. BOOLEAN *NewDhcpAckReceived, OPTIONAL
  325. BOOLEAN *NewProxyOfferReceived, OPTIONAL
  326. BOOLEAN *NewPxeDiscoverValid, OPTIONAL
  327. BOOLEAN *NewPxeReplyReceived, OPTIONAL
  328. BOOLEAN *NewPxeBisReplyReceived,OPTIONAL
  329. IN EFI_PXE_BASE_CODE_PACKET *NewDhcpDiscover, OPTIONAL
  330. IN EFI_PXE_BASE_CODE_PACKET *NewDhcpAck, OPTIONAL
  331. IN EFI_PXE_BASE_CODE_PACKET *NewProxyOffer, OPTIONAL
  332. IN EFI_PXE_BASE_CODE_PACKET *NewPxeDiscover, OPTIONAL
  333. IN EFI_PXE_BASE_CODE_PACKET *NewPxeReply, OPTIONAL
  334. IN EFI_PXE_BASE_CODE_PACKET *NewPxeBisReply OPTIONAL
  335. );
  336. /*
  337. * PXE Base Code Protocol structure
  338. */
  339. #define EFI_PXE_BASE_CODE_INTERFACE_REVISION 0x00010000
  340. typedef struct _EFI_PXE_BASE_CODE {
  341. UINT64 Revision;
  342. EFI_PXE_BASE_CODE_START Start;
  343. EFI_PXE_BASE_CODE_STOP Stop;
  344. EFI_PXE_BASE_CODE_DHCP Dhcp;
  345. EFI_PXE_BASE_CODE_DISCOVER Discover;
  346. EFI_PXE_BASE_CODE_MTFTP Mtftp;
  347. EFI_PXE_BASE_CODE_UDP_WRITE UdpWrite;
  348. EFI_PXE_BASE_CODE_UDP_READ UdpRead;
  349. EFI_PXE_BASE_CODE_SET_IP_FILTER SetIpFilter;
  350. EFI_PXE_BASE_CODE_ARP Arp;
  351. EFI_PXE_BASE_CODE_SET_PARAMETERS SetParameters;
  352. EFI_PXE_BASE_CODE_SET_STATION_IP SetStationIp;
  353. EFI_PXE_BASE_CODE_SET_PACKETS SetPackets;
  354. EFI_PXE_BASE_CODE_MODE *Mode;
  355. } EFI_PXE_BASE_CODE;
  356. /*
  357. * Call Back Definitions
  358. */
  359. #define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL \
  360. { 0x245dca21, 0xfb7b, 0x11d3, 0x8f, 0x01, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
  361. /*
  362. * Revision Number
  363. */
  364. #define EFI_PXE_BASE_CODE_CALLBACK_INTERFACE_REVISION 0x00010000
  365. INTERFACE_DECL(_EFI_PXE_BASE_CODE_CALLBACK);
  366. typedef enum {
  367. EFI_PXE_BASE_CODE_FUNCTION_FIRST,
  368. EFI_PXE_BASE_CODE_FUNCTION_DHCP,
  369. EFI_PXE_BASE_CODE_FUNCTION_DISCOVER,
  370. EFI_PXE_BASE_CODE_FUNCTION_MTFTP,
  371. EFI_PXE_BASE_CODE_FUNCTION_UDP_WRITE,
  372. EFI_PXE_BASE_CODE_FUNCTION_UDP_READ,
  373. EFI_PXE_BASE_CODE_FUNCTION_ARP,
  374. EFI_PXE_BASE_CODE_FUNCTION_IGMP,
  375. EFI_PXE_BASE_CODE_PXE_FUNCTION_LAST
  376. } EFI_PXE_BASE_CODE_FUNCTION;
  377. typedef enum {
  378. EFI_PXE_BASE_CODE_CALLBACK_STATUS_FIRST,
  379. EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE,
  380. EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORT,
  381. EFI_PXE_BASE_CODE_CALLBACK_STATUS_LAST
  382. } EFI_PXE_BASE_CODE_CALLBACK_STATUS;
  383. typedef
  384. EFI_PXE_BASE_CODE_CALLBACK_STATUS
  385. (EFIAPI *EFI_PXE_CALLBACK) (
  386. IN struct _EFI_PXE_BASE_CODE_CALLBACK *This,
  387. IN EFI_PXE_BASE_CODE_FUNCTION Function,
  388. IN BOOLEAN Received,
  389. IN UINTN PacketLen,
  390. IN EFI_PXE_BASE_CODE_PACKET *Packet OPTIONAL
  391. );
  392. typedef struct _EFI_PXE_BASE_CODE_CALLBACK {
  393. UINT64 Revision;
  394. EFI_PXE_CALLBACK Callback;
  395. } EFI_PXE_BASE_CODE_CALLBACK;
  396. #endif /* _EFIPXEBC_H */