1 /** @file
2   Definitions for the Socket layer driver.
3 
4   Copyright (c) 2011, Intel Corporation
5   All rights reserved. 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
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 **/
14 #ifndef _SOCKET_H_
15 #define _SOCKET_H_
16 
17 #include <Library/UefiDriverEntryPoint.h>
18 #include <Efi/EfiSocketLib.h>
19 
20 #include <Protocol/LoadedImage.h>
21 
22 //------------------------------------------------------------------------------
23 // Protocol Declarations
24 //------------------------------------------------------------------------------
25 
26 extern EFI_COMPONENT_NAME_PROTOCOL mComponentName;    ///<  Component name protocol declaration
27 extern EFI_COMPONENT_NAME2_PROTOCOL mComponentName2;  ///<  Component name 2 protocol declaration
28 extern EFI_DRIVER_BINDING_PROTOCOL mDriverBinding;    ///<  Driver binding protocol declaration
29 extern EFI_SERVICE_BINDING_PROTOCOL mServiceBinding;  ///<  Service binding protocol delcaration
30 
31 //------------------------------------------------------------------------------
32 // Driver Binding Protocol Support
33 //------------------------------------------------------------------------------
34 
35 /**
36   Stop this driver on Controller by removing NetworkInterfaceIdentifier protocol and
37   closing the DevicePath and PciIo protocols on Controller.
38 
39   @param [in] pThis                Protocol instance pointer.
40   @param [in] Controller           Handle of device to stop driver on.
41   @param [in] NumberOfChildren     How many children need to be stopped.
42   @param [in] pChildHandleBuffer   Not used.
43 
44   @retval EFI_SUCCESS          This driver is removed Controller.
45   @retval EFI_DEVICE_ERROR     The device could not be stopped due to a device error.
46   @retval other                This driver was not removed from this device.
47 
48 **/
49 EFI_STATUS
50 EFIAPI
51 DriverStop (
52   IN  EFI_DRIVER_BINDING_PROTOCOL * pThis,
53   IN  EFI_HANDLE Controller,
54   IN  UINTN NumberOfChildren,
55   IN  EFI_HANDLE * pChildHandleBuffer
56   );
57 
58 //------------------------------------------------------------------------------
59 // EFI Component Name Protocol Support
60 //------------------------------------------------------------------------------
61 
62 /**
63   Retrieves a Unicode string that is the user readable name of the driver.
64 
65   This function retrieves the user readable name of a driver in the form of a
66   Unicode string. If the driver specified by This has a user readable name in
67   the language specified by Language, then a pointer to the driver name is
68   returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
69   by This does not support the language specified by Language,
70   then EFI_UNSUPPORTED is returned.
71 
72   @param [in] pThis             A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
73                                 EFI_COMPONENT_NAME_PROTOCOL instance.
74   @param [in] pLanguage         A pointer to a Null-terminated ASCII string
75                                 array indicating the language. This is the
76                                 language of the driver name that the caller is
77                                 requesting, and it must match one of the
78                                 languages specified in SupportedLanguages. The
79                                 number of languages supported by a driver is up
80                                 to the driver writer. Language is specified
81                                 in RFC 3066 or ISO 639-2 language code format.
82   @param [out] ppDriverName     A pointer to the Unicode string to return.
83                                 This Unicode string is the name of the
84                                 driver specified by This in the language
85                                 specified by Language.
86 
87   @retval EFI_SUCCESS           The Unicode string for the Driver specified by
88                                 This and the language specified by Language was
89                                 returned in DriverName.
90   @retval EFI_INVALID_PARAMETER Language is NULL.
91   @retval EFI_INVALID_PARAMETER DriverName is NULL.
92   @retval EFI_UNSUPPORTED       The driver specified by This does not support
93                                 the language specified by Language.
94 
95 **/
96 EFI_STATUS
97 EFIAPI
98 GetDriverName (
99   IN  EFI_COMPONENT_NAME_PROTOCOL * pThis,
100   IN  CHAR8 * pLanguage,
101   OUT CHAR16 ** ppDriverName
102   );
103 
104 
105 /**
106   Retrieves a Unicode string that is the user readable name of the controller
107   that is being managed by a driver.
108 
109   This function retrieves the user readable name of the controller specified by
110   ControllerHandle and ChildHandle in the form of a Unicode string. If the
111   driver specified by This has a user readable name in the language specified by
112   Language, then a pointer to the controller name is returned in ControllerName,
113   and EFI_SUCCESS is returned.  If the driver specified by This is not currently
114   managing the controller specified by ControllerHandle and ChildHandle,
115   then EFI_UNSUPPORTED is returned.  If the driver specified by This does not
116   support the language specified by Language, then EFI_UNSUPPORTED is returned.
117 
118   @param [in] pThis             A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
119                                 EFI_COMPONENT_NAME_PROTOCOL instance.
120   @param [in] ControllerHandle  The handle of a controller that the driver
121                                 specified by This is managing.  This handle
122                                 specifies the controller whose name is to be
123                                 returned.
124   @param [in] ChildHandle       The handle of the child controller to retrieve
125                                 the name of.  This is an optional parameter that
126                                 may be NULL.  It will be NULL for device
127                                 drivers.  It will also be NULL for a bus drivers
128                                 that wish to retrieve the name of the bus
129                                 controller.  It will not be NULL for a bus
130                                 driver that wishes to retrieve the name of a
131                                 child controller.
132   @param [in] pLanguage         A pointer to a Null-terminated ASCII string
133                                 array indicating the language.  This is the
134                                 language of the driver name that the caller is
135                                 requesting, and it must match one of the
136                                 languages specified in SupportedLanguages. The
137                                 number of languages supported by a driver is up
138                                 to the driver writer. Language is specified in
139                                 RFC 3066 or ISO 639-2 language code format.
140   @param [out] ppControllerName A pointer to the Unicode string to return.
141                                 This Unicode string is the name of the
142                                 controller specified by ControllerHandle and
143                                 ChildHandle in the language specified by
144                                 Language from the point of view of the driver
145                                 specified by This.
146 
147   @retval EFI_SUCCESS           The Unicode string for the user readable name in
148                                 the language specified by Language for the
149                                 driver specified by This was returned in
150                                 DriverName.
151   @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
152   @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
153                                 EFI_HANDLE.
154   @retval EFI_INVALID_PARAMETER Language is NULL.
155   @retval EFI_INVALID_PARAMETER ControllerName is NULL.
156   @retval EFI_UNSUPPORTED       The driver specified by This is not currently
157                                 managing the controller specified by
158                                 ControllerHandle and ChildHandle.
159   @retval EFI_UNSUPPORTED       The driver specified by This does not support
160                                 the language specified by Language.
161 
162 **/
163 EFI_STATUS
164 EFIAPI
165 GetControllerName (
166   IN  EFI_COMPONENT_NAME_PROTOCOL * pThis,
167   IN  EFI_HANDLE ControllerHandle,
168   IN OPTIONAL EFI_HANDLE ChildHandle,
169   IN  CHAR8 * pLanguage,
170   OUT CHAR16 ** ppControllerName
171   );
172 
173 //------------------------------------------------------------------------------
174 
175 #endif  //  _SOCKET_H_
176