3 Copyright (c) 2007, Intel Corporation
4 All rights reserved. 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
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.
21 #ifndef __EFI_PXEBC_IMPL_H__
22 #define __EFI_PXEBC_IMPL_H__
25 typedef struct _PXEBC_PRIVATE_DATA PXEBC_PRIVATE_DATA
;
29 #include <Guid/SmBios.h>
30 #include <IndustryStandard/Smbios.h>
31 #include <Protocol/Dhcp4.h>
32 #include <Protocol/PxeBaseCode.h>
33 #include <Protocol/Mtftp4.h>
34 #include <Protocol/Udp4.h>
35 #include <Protocol/LoadFile.h>
36 #include <Protocol/NetworkInterfaceIdentifier.h>
37 #include <Protocol/PxeBaseCodeCallBack.h>
39 #include <Library/DebugLib.h>
40 #include <Library/BaseMemoryLib.h>
41 #include <Library/UefiDriverEntryPoint.h>
42 #include <Library/UefiBootServicesTableLib.h>
43 #include <Library/UefiLib.h>
44 #include <Library/BaseLib.h>
45 #include <Library/NetLib.h>
47 #include "PxeBcDriver.h"
49 #include "PxeBcDhcp.h"
50 #include "PxeBcMtftp.h"
51 #include "PxeBcSupport.h"
53 #define PXEBC_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('P', 'X', 'E', 'P')
54 #define PXEBC_MTFTP_TIMEOUT 4
55 #define PXEBC_MTFTP_RETRIES 6
57 struct _PXEBC_PRIVATE_DATA
{
59 EFI_HANDLE Controller
;
61 EFI_HANDLE Dhcp4Child
;
62 EFI_HANDLE Mtftp4Child
;
65 EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL
*Nii
;
67 EFI_PXE_BASE_CODE_PROTOCOL PxeBc
;
68 EFI_LOAD_FILE_PROTOCOL LoadFile
;
69 EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL LoadFileCallback
;
70 EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL
*PxeBcCallback
;
71 EFI_DHCP4_PROTOCOL
*Dhcp4
;
72 EFI_MTFTP4_PROTOCOL
*Mtftp4
;
73 EFI_UDP4_PROTOCOL
*Udp4
;
74 EFI_UDP4_CONFIG_DATA Udp4CfgData
;
76 EFI_PXE_BASE_CODE_MODE Mode
;
77 EFI_PXE_BASE_CODE_FUNCTION Function
;
81 EFI_IP_ADDRESS StationIp
;
82 EFI_IP_ADDRESS SubnetMask
;
83 EFI_IP_ADDRESS GatewayIp
;
84 EFI_IP_ADDRESS ServerIp
;
89 UINT8 OptionBuffer
[PXEBC_DHCP4_MAX_OPTION_SIZE
];
90 EFI_DHCP4_PACKET SeedPacket
;
95 UINT32 ProxyOfferType
;
98 // Cached packets as complements of pxe mode data
100 PXEBC_CACHED_DHCP4_PACKET ProxyOffer
;
101 PXEBC_CACHED_DHCP4_PACKET Dhcp4Ack
;
102 PXEBC_CACHED_DHCP4_PACKET PxeReply
;
103 PXEBC_CACHED_DHCP4_PACKET Dhcp4Offers
[PXEBC_MAX_OFFER_NUM
];
106 // Arrays for different types of offers:
107 // ServerCount records the count of the servers we got the offers,
108 // OfferIndex records the index of the offer sent by the server indexed by ServerCount.
110 UINT32 ServerCount
[DHCP4_PACKET_TYPE_MAX
];
111 UINT32 OfferIndex
[DHCP4_PACKET_TYPE_MAX
][PXEBC_MAX_OFFER_NUM
];
113 UINT32 ProxyIndex
[DHCP4_PACKET_TYPE_MAX
];
114 UINT32 BinlIndex
[PXEBC_MAX_OFFER_NUM
];
117 #define PXEBC_PRIVATE_DATA_FROM_PXEBC(a) CR (a, PXEBC_PRIVATE_DATA, PxeBc, PXEBC_PRIVATE_DATA_SIGNATURE)
119 #define PXEBC_PRIVATE_DATA_FROM_LOADFILE(a) CR (a, PXEBC_PRIVATE_DATA, LoadFile, PXEBC_PRIVATE_DATA_SIGNATURE)
121 #define PXEBC_PRIVATE_DATA_FROM_PXEBCCALLBACK(a) CR (a, PXEBC_PRIVATE_DATA, PxeBcCallback, PXEBC_PRIVATE_DATA_SIGNATURE)
123 extern EFI_PXE_BASE_CODE_PROTOCOL mPxeBcProtocolTemplate
;
124 extern EFI_LOAD_FILE_PROTOCOL mLoadFileProtocolTemplate
;