1 /** @file
2   Mtftp drivers function header.
3 
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6 
7 **/
8 
9 #ifndef __EFI_MTFTP4_DRIVER_H__
10 #define __EFI_MTFTP4_DRIVER_H__
11 
12 #include <Uefi.h>
13 
14 #include <Protocol/ServiceBinding.h>
15 
16 #include <Library/NetLib.h>
17 #include <Library/UefiLib.h>
18 #include <Library/UefiDriverEntryPoint.h>
19 
20 extern EFI_COMPONENT_NAME_PROTOCOL   gMtftp4ComponentName;
21 extern EFI_COMPONENT_NAME2_PROTOCOL  gMtftp4ComponentName2;
22 extern EFI_DRIVER_BINDING_PROTOCOL   gMtftp4DriverBinding;
23 extern EFI_UNICODE_STRING_TABLE      *gMtftp4ControllerNameTable;
24 
25 /**
26   Test whether MTFTP driver support this controller.
27 
28   @param  This                   The MTFTP driver binding instance
29   @param  Controller             The controller to test
30   @param  RemainingDevicePath    The remaining device path
31 
32   @retval EFI_SUCCESS            The controller has UDP service binding protocol
33                                  installed, MTFTP can support it.
34   @retval Others                 MTFTP can't support the controller.
35 
36 **/
37 EFI_STATUS
38 EFIAPI
39 Mtftp4DriverBindingSupported (
40   IN EFI_DRIVER_BINDING_PROTOCOL    *This,
41   IN EFI_HANDLE                     Controller,
42   IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath
43   );
44 
45 /**
46   Start the MTFTP driver on this controller.
47 
48   MTFTP driver will install a MTFTP SERVICE BINDING protocol on the supported
49   controller, which can be used to create/destroy MTFTP children.
50 
51   @param  This                   The MTFTP driver binding protocol.
52   @param  Controller             The controller to manage.
53   @param  RemainingDevicePath    Remaining device path.
54 
55   @retval EFI_ALREADY_STARTED    The MTFTP service binding protocol has been
56                                  started  on the controller.
57   @retval EFI_SUCCESS            The MTFTP service binding is installed on the
58                                  controller.
59 
60 **/
61 EFI_STATUS
62 EFIAPI
63 Mtftp4DriverBindingStart (
64   IN EFI_DRIVER_BINDING_PROTOCOL  *This,
65   IN EFI_HANDLE                   Controller,
66   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
67   );
68 
69 /**
70   Stop the MTFTP driver on controller. The controller is a UDP
71   child handle.
72 
73   @param  This                   The MTFTP driver binding protocol
74   @param  Controller             The controller to stop
75   @param  NumberOfChildren       The number of children
76   @param  ChildHandleBuffer      The array of the child handle.
77 
78   @retval EFI_SUCCESS            The driver is stopped on the controller.
79   @retval EFI_DEVICE_ERROR       Failed to stop the driver on the controller.
80 
81 **/
82 EFI_STATUS
83 EFIAPI
84 Mtftp4DriverBindingStop (
85   IN EFI_DRIVER_BINDING_PROTOCOL *This,
86   IN EFI_HANDLE                  Controller,
87   IN UINTN                       NumberOfChildren,
88   IN EFI_HANDLE                  *ChildHandleBuffer
89   );
90 
91 /**
92   Create a MTFTP child for the service binding instance, then
93   install the MTFTP protocol to the ChildHandle.
94 
95   @param  This                   The MTFTP service binding instance.
96   @param  ChildHandle            The Child handle to install the MTFTP protocol.
97 
98   @retval EFI_INVALID_PARAMETER  The parameter is invalid.
99   @retval EFI_OUT_OF_RESOURCES   Failed to allocate resource for the new child.
100   @retval EFI_SUCCESS            The child is successfully create.
101 
102 **/
103 EFI_STATUS
104 EFIAPI
105 Mtftp4ServiceBindingCreateChild (
106   IN EFI_SERVICE_BINDING_PROTOCOL  *This,
107   IN EFI_HANDLE                *ChildHandle
108   );
109 
110 /**
111   Destroy one of the service binding's child.
112 
113   @param  This                   The service binding instance
114   @param  ChildHandle            The child handle to destroy
115 
116   @retval EFI_INVALID_PARAMETER  The parameter is invalid.
117   @retval EFI_UNSUPPORTED        The child may have already been destroyed.
118   @retval EFI_SUCCESS            The child is destroyed and removed from the
119                                  parent's child list.
120 
121 **/
122 EFI_STATUS
123 EFIAPI
124 Mtftp4ServiceBindingDestroyChild (
125   IN EFI_SERVICE_BINDING_PROTOCOL *This,
126   IN EFI_HANDLE                   ChildHandle
127   );
128 
129 
130 
131 #endif
132