1 /** @file 2 Driver Binding functions declaration for XenBus Bus driver. 3 4 Copyright (C) 2014, Citrix Ltd. 5 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 http://opensource.org/licenses/bsd-license.php 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 14 **/ 15 16 /** 17 Tests to see if this driver supports a given controller. If a child device is provided, 18 it further tests to see if this driver supports creating a handle for the specified child device. 19 20 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 21 @param[in] ControllerHandle The handle of the controller to test. This handle 22 must support a protocol interface that supplies 23 an I/O abstraction to the driver. 24 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 25 parameter is ignored by device drivers, and is optional for bus 26 drivers. For bus drivers, if this parameter is not NULL, then 27 the bus driver must determine if the bus controller specified 28 by ControllerHandle and the child controller specified 29 by RemainingDevicePath are both supported by this 30 bus driver. 31 32 @retval EFI_SUCCESS The device specified by ControllerHandle and 33 RemainingDevicePath is supported by the driver specified by This. 34 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and 35 RemainingDevicePath is already being managed by the driver 36 specified by This. 37 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and 38 RemainingDevicePath is already being managed by a different 39 driver or an application that requires exclusive access. 40 Currently not implemented. 41 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and 42 RemainingDevicePath is not supported by the driver specified by This. 43 **/ 44 EFI_STATUS 45 EFIAPI 46 XenBusDxeDriverBindingSupported ( 47 IN EFI_DRIVER_BINDING_PROTOCOL *This, 48 IN EFI_HANDLE ControllerHandle, 49 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 50 ); 51 52 /** 53 Starts a device controller or a bus controller. 54 55 The Start() function is designed to be invoked from the EFI boot service ConnectController(). 56 As a result, much of the error checking on the parameters to Start() has been moved into this 57 common boot service. It is legal to call Start() from other locations, 58 but the following calling restrictions must be followed, or the system behavior will not be deterministic. 59 1. ControllerHandle must be a valid EFI_HANDLE. 60 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned 61 EFI_DEVICE_PATH_PROTOCOL. 62 3. Prior to calling Start(), the Supported() function for the driver specified by This must 63 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS. 64 65 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 66 @param[in] ControllerHandle The handle of the controller to start. This handle 67 must support a protocol interface that supplies 68 an I/O abstraction to the driver. 69 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This 70 parameter is ignored by device drivers, and is optional for bus 71 drivers. For a bus driver, if this parameter is NULL, then handles 72 for all the children of Controller are created by this driver. 73 If this parameter is not NULL and the first Device Path Node is 74 not the End of Device Path Node, then only the handle for the 75 child device specified by the first Device Path Node of 76 RemainingDevicePath is created by this driver. 77 If the first Device Path Node of RemainingDevicePath is 78 the End of Device Path Node, no child handle is created by this 79 driver. 80 81 @retval EFI_SUCCESS The device was started. 82 @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented. 83 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. 84 @retval Others The driver failded to start the device. 85 86 **/ 87 EFI_STATUS 88 EFIAPI 89 XenBusDxeDriverBindingStart ( 90 IN EFI_DRIVER_BINDING_PROTOCOL *This, 91 IN EFI_HANDLE ControllerHandle, 92 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL 93 ); 94 95 /** 96 Stops a device controller or a bus controller. 97 98 The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). 99 As a result, much of the error checking on the parameters to Stop() has been moved 100 into this common boot service. It is legal to call Stop() from other locations, 101 but the following calling restrictions must be followed, or the system behavior will not be deterministic. 102 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this 103 same driver's Start() function. 104 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid 105 EFI_HANDLE. In addition, all of these handles must have been created in this driver's 106 Start() function, and the Start() function must have called OpenProtocol() on 107 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER. 108 109 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. 110 @param[in] ControllerHandle A handle to the device being stopped. The handle must 111 support a bus specific I/O protocol for the driver 112 to use to stop the device. 113 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer. 114 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL 115 if NumberOfChildren is 0. 116 117 @retval EFI_SUCCESS The device was stopped. 118 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error. 119 120 **/ 121 EFI_STATUS 122 EFIAPI 123 XenBusDxeDriverBindingStop ( 124 IN EFI_DRIVER_BINDING_PROTOCOL *This, 125 IN EFI_HANDLE ControllerHandle, 126 IN UINTN NumberOfChildren, 127 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL 128 ); 129