1 /** @file
2   The driver binding protocol for the WiFi Connection Manager.
3 
4   Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
5 
6   SPDX-License-Identifier: BSD-2-Clause-Patent
7 
8 **/
9 
10 #ifndef __EFI_WIFI_DRIVER_BINDING__
11 #define __EFI_WIFI_DRIVER_BINDING__
12 
13 /**
14   Tests to see if this driver supports a given controller. If a child device is provided,
15   it further tests to see if this driver supports creating a handle for the specified child device.
16 
17   This function checks to see if the driver specified by This supports the device specified by
18   ControllerHandle. Drivers will typically use the device path attached to
19   ControllerHandle and/or the services from the bus I/O abstraction attached to
20   ControllerHandle to determine if the driver supports ControllerHandle. This function
21   may be called many times during platform initialization. In order to reduce boot times, the tests
22   performed by this function must be very small, and take as little time as possible to execute. This
23   function must not change the state of any hardware devices, and this function must be aware that the
24   device specified by ControllerHandle may already be managed by the same driver or a
25   different driver. This function must match its calls to AllocatePages() with FreePages(),
26   AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
27   Because ControllerHandle may have been previously started by the same driver, if a protocol is
28   already in the opened state, then it must not be closed with CloseProtocol(). This is required
29   to guarantee the state of ControllerHandle is not modified by this function.
30 
31   @param[in]  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
32   @param[in]  ControllerHandle     The handle of the controller to test. This handle
33                                    must support a protocol interface that supplies
34                                    an I/O abstraction to the driver.
35   @param[in]  RemainingDevicePath  A pointer to the remaining portion of a device path.  This
36                                    parameter is ignored by device drivers, and is optional for bus
37                                    drivers. For bus drivers, if this parameter is not NULL, then
38                                    the bus driver must determine if the bus controller specified
39                                    by ControllerHandle and the child controller specified
40                                    by RemainingDevicePath are both supported by this
41                                    bus driver.
42 
43   @retval EFI_SUCCESS              The device specified by ControllerHandle and
44                                    RemainingDevicePath is supported by the driver specified by This.
45   @retval EFI_ALREADY_STARTED      The device specified by ControllerHandle and
46                                    RemainingDevicePath is already being managed by the driver
47                                    specified by This.
48   @retval EFI_ACCESS_DENIED        The device specified by ControllerHandle and
49                                    RemainingDevicePath is already being managed by a different
50                                    driver or an application that requires exclusive access.
51                                    Currently not implemented.
52   @retval EFI_UNSUPPORTED          The device specified by ControllerHandle and
53                                    RemainingDevicePath is not supported by the driver specified by This.
54 
55 **/
56 EFI_STATUS
57 EFIAPI
58 WifiMgrDxeDriverBindingSupported (
59   IN EFI_DRIVER_BINDING_PROTOCOL  *This,
60   IN EFI_HANDLE                   ControllerHandle,
61   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL
62   );
63 
64 /**
65   Starts a device controller or a bus controller.
66 
67   The Start() function is designed to be invoked from the EFI boot service ConnectController().
68   As a result, much of the error checking on the parameters to Start() has been moved into this
69   common boot service. It is legal to call Start() from other locations,
70   but the following calling restrictions must be followed, or the system behavior will not be deterministic.
71   1. ControllerHandle must be a valid EFI_HANDLE.
72   2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
73      EFI_DEVICE_PATH_PROTOCOL.
74   3. Prior to calling Start(), the Supported() function for the driver specified by This must
75      have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
76 
77   @param[in]  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
78   @param[in]  ControllerHandle     The handle of the controller to start. This handle
79                                    must support a protocol interface that supplies
80                                    an I/O abstraction to the driver.
81   @param[in]  RemainingDevicePath  A pointer to the remaining portion of a device path.  This
82                                    parameter is ignored by device drivers, and is optional for bus
83                                    drivers. For a bus driver, if this parameter is NULL, then handles
84                                    for all the children of Controller are created by this driver.
85                                    If this parameter is not NULL and the first Device Path Node is
86                                    not the End of Device Path Node, then only the handle for the
87                                    child device specified by the first Device Path Node of
88                                    RemainingDevicePath is created by this driver.
89                                    If the first Device Path Node of RemainingDevicePath is
90                                    the End of Device Path Node, no child handle is created by this
91                                    driver.
92 
93   @retval EFI_SUCCESS              The device was started.
94   @retval EFI_DEVICE_ERROR         The device could not be started due to a device error.Currently not implemented.
95   @retval EFI_OUT_OF_RESOURCES     The request could not be completed due to a lack of resources.
96   @retval Others                   The driver failded to start the device.
97 
98 **/
99 EFI_STATUS
100 EFIAPI
101 WifiMgrDxeDriverBindingStart (
102   IN EFI_DRIVER_BINDING_PROTOCOL  *This,
103   IN EFI_HANDLE                   ControllerHandle,
104   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL
105   );
106 
107 /**
108   Stops a device controller or a bus controller.
109 
110   The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
111   As a result, much of the error checking on the parameters to Stop() has been moved
112   into this common boot service. It is legal to call Stop() from other locations,
113   but the following calling restrictions must be followed, or the system behavior will not be deterministic.
114   1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
115      same driver's Start() function.
116   2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
117      EFI_HANDLE. In addition, all of these handles must have been created in this driver's
118      Start() function, and the Start() function must have called OpenProtocol() on
119      ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
120 
121   @param[in]  This              A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
122   @param[in]  ControllerHandle  A handle to the device being stopped. The handle must
123                                 support a bus specific I/O protocol for the driver
124                                 to use to stop the device.
125   @param[in]  NumberOfChildren  The number of child device handles in ChildHandleBuffer.
126   @param[in]  ChildHandleBuffer An array of child handles to be freed. May be NULL
127                                 if NumberOfChildren is 0.
128 
129   @retval EFI_SUCCESS           The device was stopped.
130   @retval EFI_DEVICE_ERROR      The device could not be stopped due to a device error.
131 
132 **/
133 EFI_STATUS
134 EFIAPI
135 WifiMgrDxeDriverBindingStop (
136   IN EFI_DRIVER_BINDING_PROTOCOL  *This,
137   IN  EFI_HANDLE                  ControllerHandle,
138   IN  UINTN                       NumberOfChildren,
139   IN  EFI_HANDLE                  *ChildHandleBuffer OPTIONAL
140   );
141 
142 #endif
143