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