1 /** @file 2 3 Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR> 4 This program and the accompanying materials 5 are licensed and made available under the terms and conditions of the BSD License 6 which accompanies this distribution. The full text of the license may be found at 7 http://opensource.org/licenses/bsd-license.php 8 9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 12 **/ 13 14 #ifndef __EFI_IP4_DRIVER_H__ 15 #define __EFI_IP4_DRIVER_H__ 16 17 #include <Protocol/ServiceBinding.h> 18 19 extern EFI_DRIVER_BINDING_PROTOCOL gIp4DriverBinding; 20 extern EFI_COMPONENT_NAME_PROTOCOL gIp4ComponentName; 21 extern EFI_COMPONENT_NAME2_PROTOCOL gIp4ComponentName2; 22 extern EFI_UNICODE_STRING_TABLE *gIp4ControllerNameTable; 23 24 typedef struct { 25 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; 26 UINTN NumberOfChildren; 27 EFI_HANDLE *ChildHandleBuffer; 28 } IP4_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT; 29 30 // 31 // Function prototype for the driver's entry point 32 // 33 /** 34 This is the declaration of an EFI image entry point. This entry point is 35 the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including 36 both device drivers and bus drivers. 37 38 The entry point for IP4 driver which install the driver 39 binding and component name protocol on its image. 40 41 @param[in] ImageHandle The firmware allocated handle for the UEFI image. 42 @param[in] SystemTable A pointer to the EFI System Table. 43 44 @retval EFI_SUCCESS The operation completed successfully. 45 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. 46 47 **/ 48 EFI_STATUS 49 EFIAPI 50 Ip4DriverEntryPoint ( 51 IN EFI_HANDLE ImageHandle, 52 IN EFI_SYSTEM_TABLE *SystemTable 53 ); 54 55 // 56 // Function prototypes for the Drivr Binding Protocol 57 // 58 /** 59 Test to see if this driver supports ControllerHandle. This service 60 is called by the EFI boot service ConnectController(). In 61 order to make drivers as small as possible, there are a few calling 62 restrictions for this service. ConnectController() must 63 follow these calling restrictions. If any other agent wishes to call 64 Supported() it must also follow these calling restrictions. 65 66 @param[in] This Protocol instance pointer. 67 @param[in] ControllerHandle Handle of device to test 68 @param[in] RemainingDevicePath Optional parameter use to pick a specific child 69 device to start. 70 71 @retval EFI_SUCCESS This driver supports this device 72 @retval EFI_ALREADY_STARTED This driver is already running on this device 73 @retval other This driver does not support this device 74 75 **/ 76 EFI_STATUS 77 EFIAPI 78 Ip4DriverBindingSupported ( 79 IN EFI_DRIVER_BINDING_PROTOCOL * This, 80 IN EFI_HANDLE ControllerHandle, 81 IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL 82 ); 83 84 /** 85 Start this driver on ControllerHandle. This service is called by the 86 EFI boot service ConnectController(). In order to make 87 drivers as small as possible, there are a few calling restrictions for 88 this service. ConnectController() must follow these 89 calling restrictions. If any other agent wishes to call Start() it 90 must also follow these calling restrictions. 91 92 @param[in] This Protocol instance pointer. 93 @param[in] ControllerHandle Handle of device to bind driver to 94 @param[in] RemainingDevicePath Optional parameter use to pick a specific child 95 device to start. 96 97 @retval EFI_SUCCESS This driver is added to ControllerHandle 98 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle 99 @retval other This driver does not support this device 100 101 **/ 102 EFI_STATUS 103 EFIAPI 104 Ip4DriverBindingStart ( 105 IN EFI_DRIVER_BINDING_PROTOCOL * This, 106 IN EFI_HANDLE ControllerHandle, 107 IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL 108 ); 109 110 /** 111 Stop this driver on ControllerHandle. This service is called by the 112 EFI boot service DisconnectController(). In order to 113 make drivers as small as possible, there are a few calling 114 restrictions for this service. DisconnectController() 115 must follow these calling restrictions. If any other agent wishes 116 to call Stop() it must also follow these calling restrictions. 117 118 @param[in] This Protocol instance pointer. 119 @param[in] ControllerHandle Handle of device to stop driver on 120 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number 121 of children is zero stop the entire bus driver. 122 @param[in] ChildHandleBuffer List of Child Handles to Stop. 123 124 @retval EFI_SUCCESS This driver is removed ControllerHandle 125 @retval other This driver was not removed from this device 126 127 **/ 128 EFI_STATUS 129 EFIAPI 130 Ip4DriverBindingStop ( 131 IN EFI_DRIVER_BINDING_PROTOCOL *This, 132 IN EFI_HANDLE ControllerHandle, 133 IN UINTN NumberOfChildren, 134 IN EFI_HANDLE *ChildHandleBuffer 135 ); 136 137 // 138 // Function ptototypes for the ServiceBinding Prococol 139 // 140 /** 141 Creates a child handle and installs a protocol. 142 143 The CreateChild() function installs a protocol on ChildHandle. 144 If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle. 145 If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle. 146 147 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance. 148 @param ChildHandle Pointer to the handle of the child to create. If it is NULL, 149 then a new handle is created. If it is a pointer to an existing UEFI handle, 150 then the protocol is added to the existing UEFI handle. 151 152 @retval EFI_SUCCES The protocol was added to ChildHandle. 153 @retval EFI_INVALID_PARAMETER ChildHandle is NULL. 154 @retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to create 155 the child 156 @retval other The child handle was not created 157 158 **/ 159 EFI_STATUS 160 EFIAPI 161 Ip4ServiceBindingCreateChild ( 162 IN EFI_SERVICE_BINDING_PROTOCOL *This, 163 IN OUT EFI_HANDLE *ChildHandle 164 ); 165 166 /** 167 Destroys a child handle with a protocol installed on it. 168 169 The DestroyChild() function does the opposite of CreateChild(). It removes a protocol 170 that was installed by CreateChild() from ChildHandle. If the removed protocol is the 171 last protocol on ChildHandle, then ChildHandle is destroyed. 172 173 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance. 174 @param ChildHandle Handle of the child to destroy 175 176 @retval EFI_SUCCES The protocol was removed from ChildHandle. 177 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed. 178 @retval EFI_INVALID_PARAMETER Child handle is NULL. 179 @retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle 180 because its services are being used. 181 @retval other The child handle was not destroyed 182 183 **/ 184 EFI_STATUS 185 EFIAPI 186 Ip4ServiceBindingDestroyChild ( 187 IN EFI_SERVICE_BINDING_PROTOCOL *This, 188 IN EFI_HANDLE ChildHandle 189 ); 190 #endif 191