]> git.proxmox.com Git - mirror_edk2.git/blob - UnixPkg/UnixSnpDxe/UnixSnp.h
Fix issue with fixing tabs.
[mirror_edk2.git] / UnixPkg / UnixSnpDxe / UnixSnp.h
1 /** @file
2
3 Copyright (c) 2010, Apple, Inc. All rights reserved.<BR>
4
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 Module Name:
14
15 UnixSnp.h
16
17 Abstract:
18
19 -**/
20
21 #ifndef _UNIX_SNP_H_
22 #define _UNIX_SNP_H_
23
24 #include <Uefi.h>
25
26 #include <Protocol/SimpleNetwork.h>
27 #include <Protocol/DevicePath.h>
28 #include <Protocol/UnixIo.h>
29
30
31 #include <Library/BaseLib.h>
32 #include <Library/DebugLib.h>
33 #include <Library/BaseMemoryLib.h>
34 #include <Library/UefiBootServicesTableLib.h>
35 #include <Library/UefiLib.h>
36 #include <Library/DevicePathLib.h>
37 #include <Library/MemoryAllocationLib.h>
38 #include <Library/NetLib.h>
39
40 #define NET_ETHER_HEADER_SIZE 14
41
42 //
43 // Private data for driver.
44 //
45 #define UNIX_SNP_PRIVATE_DATA_SIGNATURE SIGNATURE_32( 'U', 'S', 'N', 'P' )
46
47 typedef struct
48 {
49 UINT32 Signature;
50
51 EFI_UNIX_THUNK_PROTOCOL* UnixThunk;
52
53 EFI_HANDLE DeviceHandle;
54 EFI_DEVICE_PATH_PROTOCOL* DevicePath;
55
56 EFI_MAC_ADDRESS MacAddress;
57
58 CHAR8* InterfaceName;
59 INTN ReadBufferSize;
60 VOID* ReadBuffer;
61 //
62 // Two walking pointers to manage the multiple packets that can be returned
63 // in a single read.
64 //
65 VOID* CurrentReadPointer;
66 VOID* EndReadPointer;
67
68 INTN BpfFd;
69
70 EFI_SIMPLE_NETWORK_PROTOCOL Snp;
71 EFI_SIMPLE_NETWORK_MODE Mode;
72 } UNIX_SNP_PRIVATE_DATA;
73
74 #define UNIX_SNP_PRIVATE_DATA_FROM_SNP_THIS(a) \
75 CR( a, UNIX_SNP_PRIVATE_DATA, Snp, UNIX_SNP_PRIVATE_DATA_SIGNATURE )
76
77 extern EFI_DRIVER_BINDING_PROTOCOL gUnixSnpDriverBinding;
78 extern EFI_COMPONENT_NAME_PROTOCOL gUnixSnpDriverComponentName;
79 extern EFI_COMPONENT_NAME2_PROTOCOL gUnixSnpDriverComponentName2;
80
81 /**
82 Test to see if this driver supports ControllerHandle. This service
83 is called by the EFI boot service ConnectController(). In
84 order to make drivers as small as possible, there are a few calling
85 restrictions for this service. ConnectController() must
86 follow these calling restrictions. If any other agent wishes to call
87 Supported() it must also follow these calling restrictions.
88
89 @param This Protocol instance pointer.
90 @param ControllerHandle Handle of device to test
91 @param RemainingDevicePath Optional parameter use to pick a specific child
92 device to start.
93
94 @retval EFI_SUCCESS This driver supports this device
95 @retval EFI_UNSUPPORTED This driver does not support this device
96
97 **/
98 EFI_STATUS
99 EFIAPI
100 UnixSnpDriverBindingSupported (
101 IN EFI_DRIVER_BINDING_PROTOCOL * This,
102 IN EFI_HANDLE ControllerHandle,
103 IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
104 );
105
106 /**
107 Start this driver on ControllerHandle. This service is called by the
108 EFI boot service ConnectController(). In order to make
109 drivers as small as possible, there are a few calling restrictions for
110 this service. ConnectController() must follow these
111 calling restrictions. If any other agent wishes to call Start() it
112 must also follow these calling restrictions.
113
114 @param This Protocol instance pointer.
115 @param ControllerHandle Handle of device to bind driver to
116 @param RemainingDevicePath Optional parameter use to pick a specific child
117 device to start.
118
119 @retval EFI_SUCCESS Always succeeds.
120
121 **/
122 EFI_STATUS
123 EFIAPI
124 UnixSnpDriverBindingStart (
125 IN EFI_DRIVER_BINDING_PROTOCOL * This,
126 IN EFI_HANDLE ControllerHandle,
127 IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
128 );
129
130 /**
131 Stop this driver on ControllerHandle. This service is called by the
132 EFI boot service DisconnectController(). In order to
133 make drivers as small as possible, there are a few calling
134 restrictions for this service. DisconnectController()
135 must follow these calling restrictions. If any other agent wishes
136 to call Stop() it must also follow these calling restrictions.
137
138 @param This Protocol instance pointer.
139 @param ControllerHandle Handle of device to stop driver on
140 @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
141 children is zero stop the entire bus driver.
142 @param ChildHandleBuffer List of Child Handles to Stop.
143
144 @retval EFI_SUCCESS Always succeeds.
145
146 **/
147 EFI_STATUS
148 EFIAPI
149 UnixSnpDriverBindingStop (
150 IN EFI_DRIVER_BINDING_PROTOCOL *This,
151 IN EFI_HANDLE ControllerHandle,
152 IN UINTN NumberOfChildren,
153 IN EFI_HANDLE *ChildHandleBuffer
154 );
155
156 #endif // _UNIX_SNP_H_