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