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