Ip4Driver.h 7.1 KB

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