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