Fix capitalization.
authorbbahnsen <bbahnsen@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 19 May 2006 21:48:34 +0000 (21:48 +0000)
committerbbahnsen <bbahnsen@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 19 May 2006 21:48:34 +0000 (21:48 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@215 6f19259b-4bc3-4df7-8a09-765794883524

EdkModulePkg/Universal/Network/PxeBc/Dxe/Bc.h [new file with mode: 0644]
EdkModulePkg/Universal/Network/PxeBc/Dxe/bc.h [deleted file]

diff --git a/EdkModulePkg/Universal/Network/PxeBc/Dxe/Bc.h b/EdkModulePkg/Universal/Network/PxeBc/Dxe/Bc.h
new file mode 100644 (file)
index 0000000..a391709
--- /dev/null
@@ -0,0 +1,499 @@
+/*++\r
+\r
+Copyright (c) 2006, Intel Corporation                                                         \r
+All rights reserved. This program and the accompanying materials                          \r
+are licensed and made available under the terms and conditions of the BSD License         \r
+which accompanies this distribution.  The full text of the license may be found at        \r
+http://opensource.org/licenses/bsd-license.php                                            \r
+                                                                                          \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+Module Name:\r
+  bc.h\r
+\r
+Abstract:\r
+\r
+--*/\r
+\r
+#ifndef _BC_H\r
+#define _BC_H\r
+\r
+#ifndef EFI_MIN\r
+#define EFI_MIN(_a, _b) ((_a) < (_b) ? (_a) : (_b))\r
+#endif\r
+\r
+#define CALLBACK_INTERVAL             100 // ten times a second\r
+#define FILTER_BITS                   (EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP | \\r
+                     EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST | \\r
+                     EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS | \\r
+                     EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST \\r
+          )\r
+\r
+#define WAIT_TX_TIMEOUT               1000\r
+\r
+#define SUPPORT_IPV6                  0\r
+\r
+#define PXE_BASECODE_DEVICE_SIGNATURE EFI_SIGNATURE_32('p','x','e','d')\r
+\r
+//\r
+// Determine the classes of IPv4 address\r
+//\r
+#define  IS_CLASSA_IPADDR(x)  ((((EFI_IP_ADDRESS*)x)->v4.Addr[0] & 0x80) == 0x00) \r
+#define  IS_CLASSB_IPADDR(x)  ((((EFI_IP_ADDRESS*)x)->v4.Addr[0] & 0xc0) == 0x80) \r
+#define  IS_CLASSC_IPADDR(x)  ((((EFI_IP_ADDRESS*)x)->v4.Addr[0] & 0xe0) == 0xc0) \r
+#define  IS_INADDR_UNICAST(x) ((IS_CLASSA_IPADDR(x) || IS_CLASSB_IPADDR(x) || IS_CLASSC_IPADDR(x)) && (((EFI_IP_ADDRESS*)x)->Addr[0] != 0) )\r
+\r
+//\r
+// Definitions for internet group management protocol version 2 message\r
+// structure\r
+// Per RFC 2236, November 1997\r
+//\r
+#pragma pack(1)\r
+\r
+typedef struct {\r
+  UINT8   Type;\r
+  UINT8   MaxRespTime;  // in tenths of a second\r
+  UINT16  Checksum;     // ones complement of ones complement sum of\r
+                        // 16 bit words of message\r
+  UINT32  GroupAddress; // for general query, all systems group,\r
+                        // for group specific, the group\r
+} IGMPV2_MESSAGE;\r
+\r
+#define IGMP_TYPE_QUERY                 0x11\r
+#define IGMP_TYPE_REPORT                0x16\r
+#define IGMP_TYPE_V1REPORT              0x12\r
+#define IGMP_TYPE_LEAVE_GROUP           0x17\r
+\r
+#define IGMP_DEFAULT_MAX_RESPONSE_TIME  10  // 10 second default\r
+#pragma pack()\r
+\r
+#define MAX_MCAST_GROUPS  8                 // most we allow ourselves to join at once\r
+#define MAX_OFFERS        16\r
+\r
+typedef struct {\r
+  UINTN                                     Signature;\r
+  EFI_LOCK                                  Lock;\r
+  BOOLEAN                                   ShowErrorMessages;\r
+  EFI_PXE_BASE_CODE_PROTOCOL                EfiBc;\r
+  EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL       *CallbackProtocolPtr;\r
+  EFI_HANDLE                                Handle;\r
+\r
+  EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *NiiPtr;\r
+  EFI_SIMPLE_NETWORK_PROTOCOL               *SimpleNetwork;\r
+  UINT8                                     *TransmitBufferPtr;\r
+  UINT8                                     *ReceiveBufferPtr;\r
+  EFI_PXE_BASE_CODE_FUNCTION                Function;\r
+\r
+  UINTN                                     OldestArpEntry;\r
+  UINTN                                     MCastGroupCount;\r
+  EFI_EVENT                                 Igmpv1TimeoutEvent;\r
+  BOOLEAN                                   UseIgmpv1Reporting;\r
+  EFI_EVENT                                 IgmpGroupEvent[MAX_MCAST_GROUPS];\r
+  UINT16                                    RandomPort;\r
+\r
+#if SUPPORT_IPV6\r
+  //\r
+  // TBD\r
+  //\r
+#else\r
+  UINT32          MCastGroup[MAX_MCAST_GROUPS];\r
+#endif\r
+\r
+  BOOLEAN         GoodStationIp;\r
+  BOOLEAN         DidTransmit;\r
+  UINTN           IpLength;\r
+  VOID            *DhcpPacketBuffer;\r
+  UINTN           FileSize;\r
+  VOID            *BootServerReceiveBuffer;\r
+  EFI_IP_ADDRESS  ServerIp;\r
+\r
+  //\r
+  // work area\r
+  // for dhcp\r
+  //\r
+  VOID            *ReceiveBuffers;\r
+  VOID            *TransmitBuffer;\r
+  UINTN           NumOffersReceived;\r
+  UINT16          TotalSeconds;\r
+\r
+  //\r
+  // arrays for different types of offers\r
+  //\r
+  UINT8           ServerCount[4];\r
+  UINT8           OfferCount[4][MAX_OFFERS];\r
+  UINT8           GotBootp;\r
+  UINT8           GotProxy[4];\r
+  UINT8           BinlProxies[MAX_OFFERS];\r
+\r
+  UINT8           *ArpBuffer;\r
+  UINT8           *TftpAckBuffer;\r
+  UINT8           *TftpErrorBuffer;\r
+  IGMPV2_MESSAGE  IgmpMessage;\r
+  BOOLEAN         BigBlkNumFlag;\r
+  UINT8           Timeout;\r
+  UINT16          RandomSeed;\r
+} PXE_BASECODE_DEVICE;\r
+\r
+//\r
+// type index\r
+//\r
+#define DHCP_ONLY_IX      0\r
+#define PXE10_IX          1\r
+#define WfM11a_IX         2\r
+#define BINL_IX           3\r
+\r
+#define PXE_RND_PORT_LOW  2070\r
+\r
+#define PXE_MAX_PRINT_BUFFER 128\r
+\r
+//\r
+//\r
+//\r
+#define LOADFILE_DEVICE_SIGNATURE EFI_SIGNATURE_32('p','x','e','l')\r
+\r
+typedef struct {\r
+  UINTN                   Signature;\r
+  EFI_LOCK                Lock;\r
+  EFI_LOAD_FILE_PROTOCOL  LoadFile;\r
+  PXE_BASECODE_DEVICE     *Private;\r
+} LOADFILE_DEVICE;\r
+\r
+#define EFI_BASE_CODE_DEV_FROM_THIS(a)  CR (a, PXE_BASECODE_DEVICE, efi_bc, PXE_BASECODE_DEVICE_SIGNATURE);\r
+\r
+#define EFI_LOAD_FILE_DEV_FROM_THIS(a)  CR (a, LOADFILE_DEVICE, LoadFile, LOADFILE_DEVICE_SIGNATURE)\r
+\r
+EFI_BIS_PROTOCOL                    *\r
+PxebcBisStart (\r
+  PXE_BASECODE_DEVICE     *Private,\r
+  BIS_APPLICATION_HANDLE  *BisAppHandle,\r
+  EFI_BIS_DATA            **BisDataSigInfo\r
+  )\r
+;\r
+\r
+VOID\r
+PxebcBisStop (\r
+  EFI_BIS_PROTOCOL        *Bis,\r
+  BIS_APPLICATION_HANDLE  BisAppHandle,\r
+  EFI_BIS_DATA            *BisDataSigInfo\r
+  )\r
+;\r
+\r
+BOOLEAN\r
+PxebcBisVerify (\r
+  PXE_BASECODE_DEVICE     *Private,\r
+  VOID                    *FileBuffer,\r
+  UINTN                   FileBufferLength,\r
+  VOID                    *CredentialBuffer,\r
+  UINTN                   CredentialBufferLength\r
+  )\r
+;\r
+\r
+BOOLEAN\r
+PxebcBisDetect (\r
+  PXE_BASECODE_DEVICE *Private\r
+  )\r
+;\r
+\r
+//\r
+// Global Variables\r
+//\r
+extern EFI_DRIVER_BINDING_PROTOCOL  gPxeBcDriverBinding;\r
+extern EFI_COMPONENT_NAME_PROTOCOL  gPxeBcComponentName;\r
+\r
+//\r
+// //////////////////////////////////////////////////////////\r
+//\r
+// prototypes\r
+//\r
+EFI_STATUS\r
+EFIAPI\r
+InitializeBCDriver (\r
+  IN EFI_HANDLE                       ImageHandle,\r
+  IN EFI_SYSTEM_TABLE                 *SystemTable\r
+  )\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BcStart (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL       *This,\r
+  IN BOOLEAN                          UseIpv6\r
+  )\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BcStop (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL       *This\r
+  )\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BcDhcp (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL       *This,\r
+  IN BOOLEAN                          SortOffers\r
+  )\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BcDiscover (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL       * This,\r
+  IN UINT16                           Type,\r
+  IN UINT16                           *Layer,\r
+  IN BOOLEAN                          UseBis,\r
+  IN EFI_PXE_BASE_CODE_DISCOVER_INFO  * Info OPTIONAL\r
+  )\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BcMtftp (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL       * This,\r
+  IN EFI_PXE_BASE_CODE_TFTP_OPCODE    Operation,\r
+  IN OUT VOID                         *BufferPtr,\r
+  IN BOOLEAN                          Overwrite,\r
+  IN OUT UINT64                       *BufferSize,\r
+  IN UINTN                            *BlockSize OPTIONAL,\r
+  IN EFI_IP_ADDRESS                   * ServerIp,\r
+  IN UINT8                            *Filename,\r
+  IN EFI_PXE_BASE_CODE_MTFTP_INFO     * Info OPTIONAL,\r
+  IN BOOLEAN                          DontUseBuffer\r
+  )\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BcUdpWrite (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL       *This,\r
+  IN UINT16                           OpFlags,\r
+  IN EFI_IP_ADDRESS                   *DestIp,\r
+  IN EFI_PXE_BASE_CODE_UDP_PORT       *DestPort,\r
+  IN EFI_IP_ADDRESS                   *GatewayIp, OPTIONAL\r
+  IN EFI_IP_ADDRESS                   *SrcIp, OPTIONAL\r
+  IN OUT EFI_PXE_BASE_CODE_UDP_PORT   *SrcPort, OPTIONAL\r
+  IN UINTN                            *HeaderSize, OPTIONAL\r
+  IN VOID                             *HeaderPtr, OPTIONAL\r
+  IN UINTN                            *BufferSize,\r
+  IN VOID                             *BufferPtr\r
+  )\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BcUdpRead (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL       *This,\r
+  IN UINT16                           OpFlags,\r
+  IN OUT EFI_IP_ADDRESS               *DestIp, OPTIONAL\r
+  IN OUT EFI_PXE_BASE_CODE_UDP_PORT   *DestPort, OPTIONAL\r
+  IN OUT EFI_IP_ADDRESS               *SrcIp, OPTIONAL\r
+  IN OUT EFI_PXE_BASE_CODE_UDP_PORT   *SrcPort, OPTIONAL\r
+  IN UINTN                            *HeaderSize, OPTIONAL\r
+  IN VOID                             *HeaderPtr, OPTIONAL\r
+  IN OUT UINTN                        *BufferSize,\r
+  IN VOID                             *BufferPtr\r
+  )\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BcArp (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL       * This,\r
+  IN EFI_IP_ADDRESS                   * IpAddr,\r
+  IN EFI_MAC_ADDRESS                  * MacAddr OPTIONAL\r
+  )\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BcIpFilter (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL       *This,\r
+  IN EFI_PXE_BASE_CODE_IP_FILTER      *NewFilter\r
+  )\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BcSetParameters (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL       * This,\r
+  IN BOOLEAN                          *NewAutoArp, OPTIONAL\r
+  IN BOOLEAN                          *NewSendGUID, OPTIONAL\r
+  IN UINT8                            *NewTTL, OPTIONAL\r
+  IN UINT8                            *NewToS, OPTIONAL\r
+  IN BOOLEAN                          *NewMakeCallback OPTIONAL\r
+  )\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BcSetStationIP (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL       * This,\r
+  IN EFI_IP_ADDRESS                   * NewStationIp, OPTIONAL\r
+  IN EFI_IP_ADDRESS                   * NewSubnetMask OPTIONAL\r
+  )\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BcSetPackets (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL       * This,\r
+  BOOLEAN                             *NewDhcpDiscoverValid, OPTIONAL\r
+  BOOLEAN                             *NewDhcpAckReceived, OPTIONAL\r
+  BOOLEAN                             *NewProxyOfferReceived, OPTIONAL\r
+  BOOLEAN                             *NewPxeDiscoverValid, OPTIONAL\r
+  BOOLEAN                             *NewPxeReplyReceived, OPTIONAL\r
+  BOOLEAN                             *NewPxeBisReplyReceived, OPTIONAL\r
+  IN EFI_PXE_BASE_CODE_PACKET         * NewDhcpDiscover, OPTIONAL\r
+  IN EFI_PXE_BASE_CODE_PACKET         * NewDhcpAck, OPTIONAL\r
+  IN EFI_PXE_BASE_CODE_PACKET         * NewProxyOffer, OPTIONAL\r
+  IN EFI_PXE_BASE_CODE_PACKET         * NewPxeDiscover, OPTIONAL\r
+  IN EFI_PXE_BASE_CODE_PACKET         * NewPxeReply, OPTIONAL\r
+  IN EFI_PXE_BASE_CODE_PACKET         * NewPxeBisReply OPTIONAL\r
+  )\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+LoadFile (\r
+  IN EFI_LOAD_FILE_PROTOCOL           *This,\r
+  IN EFI_DEVICE_PATH_PROTOCOL         *FilePath,\r
+  IN BOOLEAN                          BootPolicy,\r
+  IN OUT UINTN                        *BufferSize,\r
+  IN VOID                             *Buffer\r
+  )\r
+;\r
+\r
+EFI_STATUS\r
+PxeBcLibGetSmbiosSystemGuidAndSerialNumber (\r
+  IN  EFI_GUID    *SystemGuid,\r
+  OUT CHAR8       **SystemSerialNumber\r
+  )\r
+;\r
+\r
+UINTN\r
+EFIAPI\r
+AsciiPrint (\r
+  IN CONST CHAR8 *Format,\r
+  ...\r
+  )\r
+;\r
+\r
+//\r
+// Define SMBIOS tables.\r
+//\r
+#pragma pack(1)\r
+typedef struct {\r
+  UINT8   AnchorString[4];\r
+  UINT8   EntryPointStructureChecksum;\r
+  UINT8   EntryPointLength;\r
+  UINT8   MajorVersion;\r
+  UINT8   MinorVersion;\r
+  UINT16  MaxStructureSize;\r
+  UINT8   EntryPointRevision;\r
+  UINT8   FormattedArea[5];\r
+  UINT8   IntermediateAnchorString[5];\r
+  UINT8   IntermediateChecksum;\r
+  UINT16  TableLength;\r
+  UINT32  TableAddress;\r
+  UINT16  NumberOfSmbiosStructures;\r
+  UINT8   SmbiosBcdRevision;\r
+} SMBIOS_STRUCTURE_TABLE;\r
+\r
+//\r
+// Please note that SMBIOS structures can be odd byte aligned since the\r
+//  unformated section of each record is a set of arbitrary size strings.\r
+//\r
+typedef struct {\r
+  UINT8 Type;\r
+  UINT8 Length;\r
+  UINT8 Handle[2];\r
+} SMBIOS_HEADER;\r
+\r
+typedef UINT8 SMBIOS_STRING;\r
+\r
+typedef struct {\r
+  SMBIOS_HEADER Hdr;\r
+  SMBIOS_STRING Vendor;\r
+  SMBIOS_STRING BiosVersion;\r
+  UINT8         BiosSegment[2];\r
+  SMBIOS_STRING BiosReleaseDate;\r
+  UINT8         BiosSize;\r
+  UINT8         BiosCharacteristics[8];\r
+} SMBIOS_TYPE0;\r
+\r
+typedef struct {\r
+  SMBIOS_HEADER Hdr;\r
+  SMBIOS_STRING Manufacturer;\r
+  SMBIOS_STRING ProductName;\r
+  SMBIOS_STRING Version;\r
+  SMBIOS_STRING SerialNumber;\r
+\r
+  //\r
+  // always byte copy this data to prevent alignment faults!\r
+  //\r
+  EFI_GUID      Uuid;\r
+\r
+  UINT8         WakeUpType;\r
+} SMBIOS_TYPE1;\r
+\r
+typedef struct {\r
+  SMBIOS_HEADER Hdr;\r
+  SMBIOS_STRING Manufacturer;\r
+  SMBIOS_STRING ProductName;\r
+  SMBIOS_STRING Version;\r
+  SMBIOS_STRING SerialNumber;\r
+} SMBIOS_TYPE2;\r
+\r
+typedef struct {\r
+  SMBIOS_HEADER Hdr;\r
+  SMBIOS_STRING Manufacturer;\r
+  UINT8         Type;\r
+  SMBIOS_STRING Version;\r
+  SMBIOS_STRING SerialNumber;\r
+  SMBIOS_STRING AssetTag;\r
+  UINT8         BootupState;\r
+  UINT8         PowerSupplyState;\r
+  UINT8         ThermalState;\r
+  UINT8         SecurityStatus;\r
+  UINT8         OemDefined[4];\r
+} SMBIOS_TYPE3;\r
+\r
+typedef struct {\r
+  SMBIOS_HEADER Hdr;\r
+  UINT8         Socket;\r
+  UINT8         ProcessorType;\r
+  UINT8         ProcessorFamily;\r
+  SMBIOS_STRING ProcessorManufacture;\r
+  UINT8         ProcessorId[8];\r
+  SMBIOS_STRING ProcessorVersion;\r
+  UINT8         Voltage;\r
+  UINT8         ExternalClock[2];\r
+  UINT8         MaxSpeed[2];\r
+  UINT8         CurrentSpeed[2];\r
+  UINT8         Status;\r
+  UINT8         ProcessorUpgrade;\r
+  UINT8         L1CacheHandle[2];\r
+  UINT8         L2CacheHandle[2];\r
+  UINT8         L3CacheHandle[2];\r
+} SMBIOS_TYPE4;\r
+\r
+typedef union {\r
+  SMBIOS_HEADER *Hdr;\r
+  SMBIOS_TYPE0  *Type0;\r
+  SMBIOS_TYPE1  *Type1;\r
+  SMBIOS_TYPE2  *Type2;\r
+  SMBIOS_TYPE3  *Type3;\r
+  SMBIOS_TYPE4  *Type4;\r
+  UINT8         *Raw;\r
+} SMBIOS_STRUCTURE_POINTER;\r
+#pragma pack()\r
+\r
+#include "ip.h"\r
+#include "dhcp.h"\r
+#include "tftp.h"\r
+\r
+#endif /* _BC_H */\r
+\r
+/* EOF - bc.h */\r
diff --git a/EdkModulePkg/Universal/Network/PxeBc/Dxe/bc.h b/EdkModulePkg/Universal/Network/PxeBc/Dxe/bc.h
deleted file mode 100644 (file)
index a391709..0000000
+++ /dev/null
@@ -1,499 +0,0 @@
-/*++\r
-\r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. This program and the accompanying materials                          \r
-are licensed and made available under the terms and conditions of the BSD License         \r
-which accompanies this distribution.  The full text of the license may be found at        \r
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
-\r
-Module Name:\r
-  bc.h\r
-\r
-Abstract:\r
-\r
---*/\r
-\r
-#ifndef _BC_H\r
-#define _BC_H\r
-\r
-#ifndef EFI_MIN\r
-#define EFI_MIN(_a, _b) ((_a) < (_b) ? (_a) : (_b))\r
-#endif\r
-\r
-#define CALLBACK_INTERVAL             100 // ten times a second\r
-#define FILTER_BITS                   (EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP | \\r
-                     EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST | \\r
-                     EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS | \\r
-                     EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST \\r
-          )\r
-\r
-#define WAIT_TX_TIMEOUT               1000\r
-\r
-#define SUPPORT_IPV6                  0\r
-\r
-#define PXE_BASECODE_DEVICE_SIGNATURE EFI_SIGNATURE_32('p','x','e','d')\r
-\r
-//\r
-// Determine the classes of IPv4 address\r
-//\r
-#define  IS_CLASSA_IPADDR(x)  ((((EFI_IP_ADDRESS*)x)->v4.Addr[0] & 0x80) == 0x00) \r
-#define  IS_CLASSB_IPADDR(x)  ((((EFI_IP_ADDRESS*)x)->v4.Addr[0] & 0xc0) == 0x80) \r
-#define  IS_CLASSC_IPADDR(x)  ((((EFI_IP_ADDRESS*)x)->v4.Addr[0] & 0xe0) == 0xc0) \r
-#define  IS_INADDR_UNICAST(x) ((IS_CLASSA_IPADDR(x) || IS_CLASSB_IPADDR(x) || IS_CLASSC_IPADDR(x)) && (((EFI_IP_ADDRESS*)x)->Addr[0] != 0) )\r
-\r
-//\r
-// Definitions for internet group management protocol version 2 message\r
-// structure\r
-// Per RFC 2236, November 1997\r
-//\r
-#pragma pack(1)\r
-\r
-typedef struct {\r
-  UINT8   Type;\r
-  UINT8   MaxRespTime;  // in tenths of a second\r
-  UINT16  Checksum;     // ones complement of ones complement sum of\r
-                        // 16 bit words of message\r
-  UINT32  GroupAddress; // for general query, all systems group,\r
-                        // for group specific, the group\r
-} IGMPV2_MESSAGE;\r
-\r
-#define IGMP_TYPE_QUERY                 0x11\r
-#define IGMP_TYPE_REPORT                0x16\r
-#define IGMP_TYPE_V1REPORT              0x12\r
-#define IGMP_TYPE_LEAVE_GROUP           0x17\r
-\r
-#define IGMP_DEFAULT_MAX_RESPONSE_TIME  10  // 10 second default\r
-#pragma pack()\r
-\r
-#define MAX_MCAST_GROUPS  8                 // most we allow ourselves to join at once\r
-#define MAX_OFFERS        16\r
-\r
-typedef struct {\r
-  UINTN                                     Signature;\r
-  EFI_LOCK                                  Lock;\r
-  BOOLEAN                                   ShowErrorMessages;\r
-  EFI_PXE_BASE_CODE_PROTOCOL                EfiBc;\r
-  EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL       *CallbackProtocolPtr;\r
-  EFI_HANDLE                                Handle;\r
-\r
-  EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *NiiPtr;\r
-  EFI_SIMPLE_NETWORK_PROTOCOL               *SimpleNetwork;\r
-  UINT8                                     *TransmitBufferPtr;\r
-  UINT8                                     *ReceiveBufferPtr;\r
-  EFI_PXE_BASE_CODE_FUNCTION                Function;\r
-\r
-  UINTN                                     OldestArpEntry;\r
-  UINTN                                     MCastGroupCount;\r
-  EFI_EVENT                                 Igmpv1TimeoutEvent;\r
-  BOOLEAN                                   UseIgmpv1Reporting;\r
-  EFI_EVENT                                 IgmpGroupEvent[MAX_MCAST_GROUPS];\r
-  UINT16                                    RandomPort;\r
-\r
-#if SUPPORT_IPV6\r
-  //\r
-  // TBD\r
-  //\r
-#else\r
-  UINT32          MCastGroup[MAX_MCAST_GROUPS];\r
-#endif\r
-\r
-  BOOLEAN         GoodStationIp;\r
-  BOOLEAN         DidTransmit;\r
-  UINTN           IpLength;\r
-  VOID            *DhcpPacketBuffer;\r
-  UINTN           FileSize;\r
-  VOID            *BootServerReceiveBuffer;\r
-  EFI_IP_ADDRESS  ServerIp;\r
-\r
-  //\r
-  // work area\r
-  // for dhcp\r
-  //\r
-  VOID            *ReceiveBuffers;\r
-  VOID            *TransmitBuffer;\r
-  UINTN           NumOffersReceived;\r
-  UINT16          TotalSeconds;\r
-\r
-  //\r
-  // arrays for different types of offers\r
-  //\r
-  UINT8           ServerCount[4];\r
-  UINT8           OfferCount[4][MAX_OFFERS];\r
-  UINT8           GotBootp;\r
-  UINT8           GotProxy[4];\r
-  UINT8           BinlProxies[MAX_OFFERS];\r
-\r
-  UINT8           *ArpBuffer;\r
-  UINT8           *TftpAckBuffer;\r
-  UINT8           *TftpErrorBuffer;\r
-  IGMPV2_MESSAGE  IgmpMessage;\r
-  BOOLEAN         BigBlkNumFlag;\r
-  UINT8           Timeout;\r
-  UINT16          RandomSeed;\r
-} PXE_BASECODE_DEVICE;\r
-\r
-//\r
-// type index\r
-//\r
-#define DHCP_ONLY_IX      0\r
-#define PXE10_IX          1\r
-#define WfM11a_IX         2\r
-#define BINL_IX           3\r
-\r
-#define PXE_RND_PORT_LOW  2070\r
-\r
-#define PXE_MAX_PRINT_BUFFER 128\r
-\r
-//\r
-//\r
-//\r
-#define LOADFILE_DEVICE_SIGNATURE EFI_SIGNATURE_32('p','x','e','l')\r
-\r
-typedef struct {\r
-  UINTN                   Signature;\r
-  EFI_LOCK                Lock;\r
-  EFI_LOAD_FILE_PROTOCOL  LoadFile;\r
-  PXE_BASECODE_DEVICE     *Private;\r
-} LOADFILE_DEVICE;\r
-\r
-#define EFI_BASE_CODE_DEV_FROM_THIS(a)  CR (a, PXE_BASECODE_DEVICE, efi_bc, PXE_BASECODE_DEVICE_SIGNATURE);\r
-\r
-#define EFI_LOAD_FILE_DEV_FROM_THIS(a)  CR (a, LOADFILE_DEVICE, LoadFile, LOADFILE_DEVICE_SIGNATURE)\r
-\r
-EFI_BIS_PROTOCOL                    *\r
-PxebcBisStart (\r
-  PXE_BASECODE_DEVICE     *Private,\r
-  BIS_APPLICATION_HANDLE  *BisAppHandle,\r
-  EFI_BIS_DATA            **BisDataSigInfo\r
-  )\r
-;\r
-\r
-VOID\r
-PxebcBisStop (\r
-  EFI_BIS_PROTOCOL        *Bis,\r
-  BIS_APPLICATION_HANDLE  BisAppHandle,\r
-  EFI_BIS_DATA            *BisDataSigInfo\r
-  )\r
-;\r
-\r
-BOOLEAN\r
-PxebcBisVerify (\r
-  PXE_BASECODE_DEVICE     *Private,\r
-  VOID                    *FileBuffer,\r
-  UINTN                   FileBufferLength,\r
-  VOID                    *CredentialBuffer,\r
-  UINTN                   CredentialBufferLength\r
-  )\r
-;\r
-\r
-BOOLEAN\r
-PxebcBisDetect (\r
-  PXE_BASECODE_DEVICE *Private\r
-  )\r
-;\r
-\r
-//\r
-// Global Variables\r
-//\r
-extern EFI_DRIVER_BINDING_PROTOCOL  gPxeBcDriverBinding;\r
-extern EFI_COMPONENT_NAME_PROTOCOL  gPxeBcComponentName;\r
-\r
-//\r
-// //////////////////////////////////////////////////////////\r
-//\r
-// prototypes\r
-//\r
-EFI_STATUS\r
-EFIAPI\r
-InitializeBCDriver (\r
-  IN EFI_HANDLE                       ImageHandle,\r
-  IN EFI_SYSTEM_TABLE                 *SystemTable\r
-  )\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-BcStart (\r
-  IN EFI_PXE_BASE_CODE_PROTOCOL       *This,\r
-  IN BOOLEAN                          UseIpv6\r
-  )\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-BcStop (\r
-  IN EFI_PXE_BASE_CODE_PROTOCOL       *This\r
-  )\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-BcDhcp (\r
-  IN EFI_PXE_BASE_CODE_PROTOCOL       *This,\r
-  IN BOOLEAN                          SortOffers\r
-  )\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-BcDiscover (\r
-  IN EFI_PXE_BASE_CODE_PROTOCOL       * This,\r
-  IN UINT16                           Type,\r
-  IN UINT16                           *Layer,\r
-  IN BOOLEAN                          UseBis,\r
-  IN EFI_PXE_BASE_CODE_DISCOVER_INFO  * Info OPTIONAL\r
-  )\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-BcMtftp (\r
-  IN EFI_PXE_BASE_CODE_PROTOCOL       * This,\r
-  IN EFI_PXE_BASE_CODE_TFTP_OPCODE    Operation,\r
-  IN OUT VOID                         *BufferPtr,\r
-  IN BOOLEAN                          Overwrite,\r
-  IN OUT UINT64                       *BufferSize,\r
-  IN UINTN                            *BlockSize OPTIONAL,\r
-  IN EFI_IP_ADDRESS                   * ServerIp,\r
-  IN UINT8                            *Filename,\r
-  IN EFI_PXE_BASE_CODE_MTFTP_INFO     * Info OPTIONAL,\r
-  IN BOOLEAN                          DontUseBuffer\r
-  )\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-BcUdpWrite (\r
-  IN EFI_PXE_BASE_CODE_PROTOCOL       *This,\r
-  IN UINT16                           OpFlags,\r
-  IN EFI_IP_ADDRESS                   *DestIp,\r
-  IN EFI_PXE_BASE_CODE_UDP_PORT       *DestPort,\r
-  IN EFI_IP_ADDRESS                   *GatewayIp, OPTIONAL\r
-  IN EFI_IP_ADDRESS                   *SrcIp, OPTIONAL\r
-  IN OUT EFI_PXE_BASE_CODE_UDP_PORT   *SrcPort, OPTIONAL\r
-  IN UINTN                            *HeaderSize, OPTIONAL\r
-  IN VOID                             *HeaderPtr, OPTIONAL\r
-  IN UINTN                            *BufferSize,\r
-  IN VOID                             *BufferPtr\r
-  )\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-BcUdpRead (\r
-  IN EFI_PXE_BASE_CODE_PROTOCOL       *This,\r
-  IN UINT16                           OpFlags,\r
-  IN OUT EFI_IP_ADDRESS               *DestIp, OPTIONAL\r
-  IN OUT EFI_PXE_BASE_CODE_UDP_PORT   *DestPort, OPTIONAL\r
-  IN OUT EFI_IP_ADDRESS               *SrcIp, OPTIONAL\r
-  IN OUT EFI_PXE_BASE_CODE_UDP_PORT   *SrcPort, OPTIONAL\r
-  IN UINTN                            *HeaderSize, OPTIONAL\r
-  IN VOID                             *HeaderPtr, OPTIONAL\r
-  IN OUT UINTN                        *BufferSize,\r
-  IN VOID                             *BufferPtr\r
-  )\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-BcArp (\r
-  IN EFI_PXE_BASE_CODE_PROTOCOL       * This,\r
-  IN EFI_IP_ADDRESS                   * IpAddr,\r
-  IN EFI_MAC_ADDRESS                  * MacAddr OPTIONAL\r
-  )\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-BcIpFilter (\r
-  IN EFI_PXE_BASE_CODE_PROTOCOL       *This,\r
-  IN EFI_PXE_BASE_CODE_IP_FILTER      *NewFilter\r
-  )\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-BcSetParameters (\r
-  IN EFI_PXE_BASE_CODE_PROTOCOL       * This,\r
-  IN BOOLEAN                          *NewAutoArp, OPTIONAL\r
-  IN BOOLEAN                          *NewSendGUID, OPTIONAL\r
-  IN UINT8                            *NewTTL, OPTIONAL\r
-  IN UINT8                            *NewToS, OPTIONAL\r
-  IN BOOLEAN                          *NewMakeCallback OPTIONAL\r
-  )\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-BcSetStationIP (\r
-  IN EFI_PXE_BASE_CODE_PROTOCOL       * This,\r
-  IN EFI_IP_ADDRESS                   * NewStationIp, OPTIONAL\r
-  IN EFI_IP_ADDRESS                   * NewSubnetMask OPTIONAL\r
-  )\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-BcSetPackets (\r
-  IN EFI_PXE_BASE_CODE_PROTOCOL       * This,\r
-  BOOLEAN                             *NewDhcpDiscoverValid, OPTIONAL\r
-  BOOLEAN                             *NewDhcpAckReceived, OPTIONAL\r
-  BOOLEAN                             *NewProxyOfferReceived, OPTIONAL\r
-  BOOLEAN                             *NewPxeDiscoverValid, OPTIONAL\r
-  BOOLEAN                             *NewPxeReplyReceived, OPTIONAL\r
-  BOOLEAN                             *NewPxeBisReplyReceived, OPTIONAL\r
-  IN EFI_PXE_BASE_CODE_PACKET         * NewDhcpDiscover, OPTIONAL\r
-  IN EFI_PXE_BASE_CODE_PACKET         * NewDhcpAck, OPTIONAL\r
-  IN EFI_PXE_BASE_CODE_PACKET         * NewProxyOffer, OPTIONAL\r
-  IN EFI_PXE_BASE_CODE_PACKET         * NewPxeDiscover, OPTIONAL\r
-  IN EFI_PXE_BASE_CODE_PACKET         * NewPxeReply, OPTIONAL\r
-  IN EFI_PXE_BASE_CODE_PACKET         * NewPxeBisReply OPTIONAL\r
-  )\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-LoadFile (\r
-  IN EFI_LOAD_FILE_PROTOCOL           *This,\r
-  IN EFI_DEVICE_PATH_PROTOCOL         *FilePath,\r
-  IN BOOLEAN                          BootPolicy,\r
-  IN OUT UINTN                        *BufferSize,\r
-  IN VOID                             *Buffer\r
-  )\r
-;\r
-\r
-EFI_STATUS\r
-PxeBcLibGetSmbiosSystemGuidAndSerialNumber (\r
-  IN  EFI_GUID    *SystemGuid,\r
-  OUT CHAR8       **SystemSerialNumber\r
-  )\r
-;\r
-\r
-UINTN\r
-EFIAPI\r
-AsciiPrint (\r
-  IN CONST CHAR8 *Format,\r
-  ...\r
-  )\r
-;\r
-\r
-//\r
-// Define SMBIOS tables.\r
-//\r
-#pragma pack(1)\r
-typedef struct {\r
-  UINT8   AnchorString[4];\r
-  UINT8   EntryPointStructureChecksum;\r
-  UINT8   EntryPointLength;\r
-  UINT8   MajorVersion;\r
-  UINT8   MinorVersion;\r
-  UINT16  MaxStructureSize;\r
-  UINT8   EntryPointRevision;\r
-  UINT8   FormattedArea[5];\r
-  UINT8   IntermediateAnchorString[5];\r
-  UINT8   IntermediateChecksum;\r
-  UINT16  TableLength;\r
-  UINT32  TableAddress;\r
-  UINT16  NumberOfSmbiosStructures;\r
-  UINT8   SmbiosBcdRevision;\r
-} SMBIOS_STRUCTURE_TABLE;\r
-\r
-//\r
-// Please note that SMBIOS structures can be odd byte aligned since the\r
-//  unformated section of each record is a set of arbitrary size strings.\r
-//\r
-typedef struct {\r
-  UINT8 Type;\r
-  UINT8 Length;\r
-  UINT8 Handle[2];\r
-} SMBIOS_HEADER;\r
-\r
-typedef UINT8 SMBIOS_STRING;\r
-\r
-typedef struct {\r
-  SMBIOS_HEADER Hdr;\r
-  SMBIOS_STRING Vendor;\r
-  SMBIOS_STRING BiosVersion;\r
-  UINT8         BiosSegment[2];\r
-  SMBIOS_STRING BiosReleaseDate;\r
-  UINT8         BiosSize;\r
-  UINT8         BiosCharacteristics[8];\r
-} SMBIOS_TYPE0;\r
-\r
-typedef struct {\r
-  SMBIOS_HEADER Hdr;\r
-  SMBIOS_STRING Manufacturer;\r
-  SMBIOS_STRING ProductName;\r
-  SMBIOS_STRING Version;\r
-  SMBIOS_STRING SerialNumber;\r
-\r
-  //\r
-  // always byte copy this data to prevent alignment faults!\r
-  //\r
-  EFI_GUID      Uuid;\r
-\r
-  UINT8         WakeUpType;\r
-} SMBIOS_TYPE1;\r
-\r
-typedef struct {\r
-  SMBIOS_HEADER Hdr;\r
-  SMBIOS_STRING Manufacturer;\r
-  SMBIOS_STRING ProductName;\r
-  SMBIOS_STRING Version;\r
-  SMBIOS_STRING SerialNumber;\r
-} SMBIOS_TYPE2;\r
-\r
-typedef struct {\r
-  SMBIOS_HEADER Hdr;\r
-  SMBIOS_STRING Manufacturer;\r
-  UINT8         Type;\r
-  SMBIOS_STRING Version;\r
-  SMBIOS_STRING SerialNumber;\r
-  SMBIOS_STRING AssetTag;\r
-  UINT8         BootupState;\r
-  UINT8         PowerSupplyState;\r
-  UINT8         ThermalState;\r
-  UINT8         SecurityStatus;\r
-  UINT8         OemDefined[4];\r
-} SMBIOS_TYPE3;\r
-\r
-typedef struct {\r
-  SMBIOS_HEADER Hdr;\r
-  UINT8         Socket;\r
-  UINT8         ProcessorType;\r
-  UINT8         ProcessorFamily;\r
-  SMBIOS_STRING ProcessorManufacture;\r
-  UINT8         ProcessorId[8];\r
-  SMBIOS_STRING ProcessorVersion;\r
-  UINT8         Voltage;\r
-  UINT8         ExternalClock[2];\r
-  UINT8         MaxSpeed[2];\r
-  UINT8         CurrentSpeed[2];\r
-  UINT8         Status;\r
-  UINT8         ProcessorUpgrade;\r
-  UINT8         L1CacheHandle[2];\r
-  UINT8         L2CacheHandle[2];\r
-  UINT8         L3CacheHandle[2];\r
-} SMBIOS_TYPE4;\r
-\r
-typedef union {\r
-  SMBIOS_HEADER *Hdr;\r
-  SMBIOS_TYPE0  *Type0;\r
-  SMBIOS_TYPE1  *Type1;\r
-  SMBIOS_TYPE2  *Type2;\r
-  SMBIOS_TYPE3  *Type3;\r
-  SMBIOS_TYPE4  *Type4;\r
-  UINT8         *Raw;\r
-} SMBIOS_STRUCTURE_POINTER;\r
-#pragma pack()\r
-\r
-#include "ip.h"\r
-#include "dhcp.h"\r
-#include "tftp.h"\r
-\r
-#endif /* _BC_H */\r
-\r
-/* EOF - bc.h */\r