• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   UEFI DriverBinding Protocol is defined in UEFI specification.
3 
4   This protocol is produced by every driver that follows the UEFI Driver Model,
5   and it is the central component that allows drivers and controllers to be managed.
6 
7   Copyright (c) 2006 - 2008, Intel Corporation
8   All rights reserved. This program and the accompanying materials
9   are licensed and made available under the terms and conditions of the BSD License
10   which accompanies this distribution.  The full text of the license may be found at
11   http://opensource.org/licenses/bsd-license.php
12 
13   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 
16 **/
17 
18 #ifndef __EFI_DRIVER_BINDING_H__
19 #define __EFI_DRIVER_BINDING_H__
20 
21 #include <gpxe/efi/Protocol/DevicePath.h>
22 ///
23 /// Global ID for the ControllerHandle Driver Protocol
24 ///
25 #define EFI_DRIVER_BINDING_PROTOCOL_GUID \
26   { \
27     0x18a031ab, 0xb443, 0x4d1a, {0xa5, 0xc0, 0xc, 0x9, 0x26, 0x1e, 0x9f, 0x71 } \
28   }
29 
30 typedef struct _EFI_DRIVER_BINDING_PROTOCOL  EFI_DRIVER_BINDING_PROTOCOL;
31 
32 /**
33   Test to see if this driver supports ControllerHandle. This service
34   is called by the EFI boot service ConnectController(). In
35   order to make drivers as small as possible, there are a few calling
36   restrictions for this service. ConnectController() must
37   follow these calling restrictions. If any other agent wishes to call
38   Supported() it must also follow these calling restrictions.
39 
40   @param  This                Protocol instance pointer.
41   @param  ControllerHandle    Handle of device to test
42   @param  RemainingDevicePath Optional parameter use to pick a specific child
43                               device to start.
44 
45   @retval EFI_SUCCESS         This driver supports this device
46   @retval EFI_ALREADY_STARTED This driver is already running on this device
47   @retval other               This driver does not support this device
48 
49 **/
50 typedef
51 EFI_STATUS
52 (EFIAPI *EFI_DRIVER_BINDING_SUPPORTED)(
53   IN EFI_DRIVER_BINDING_PROTOCOL            *This,
54   IN EFI_HANDLE                             ControllerHandle,
55   IN EFI_DEVICE_PATH_PROTOCOL               *RemainingDevicePath OPTIONAL
56   );
57 
58 /**
59   Start this driver on ControllerHandle. This service is called by the
60   EFI boot service ConnectController(). In order to make
61   drivers as small as possible, there are a few calling restrictions for
62   this service. ConnectController() must follow these
63   calling restrictions. If any other agent wishes to call Start() it
64   must also follow these calling restrictions.
65 
66   @param  This                 Protocol instance pointer.
67   @param  ControllerHandle     Handle of device to bind driver to
68   @param  RemainingDevicePath  Optional parameter use to pick a specific child
69                                device to start.
70 
71   @retval EFI_SUCCESS          This driver is added to ControllerHandle
72   @retval EFI_ALREADY_STARTED  This driver is already running on ControllerHandle
73   @retval other                This driver does not support this device
74 
75 **/
76 typedef
77 EFI_STATUS
78 (EFIAPI *EFI_DRIVER_BINDING_START)(
79   IN EFI_DRIVER_BINDING_PROTOCOL            *This,
80   IN EFI_HANDLE                             ControllerHandle,
81   IN EFI_DEVICE_PATH_PROTOCOL               *RemainingDevicePath OPTIONAL
82   );
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 
92   @param  This              Protocol instance pointer.
93   @param  ControllerHandle  Handle of device to stop driver on
94   @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of
95                             children is zero stop the entire bus driver.
96   @param  ChildHandleBuffer List of Child Handles to Stop.
97 
98   @retval EFI_SUCCESS       This driver is removed ControllerHandle
99   @retval other             This driver was not removed from this device
100 
101 **/
102 typedef
103 EFI_STATUS
104 (EFIAPI *EFI_DRIVER_BINDING_STOP)(
105   IN EFI_DRIVER_BINDING_PROTOCOL            *This,
106   IN  EFI_HANDLE                            ControllerHandle,
107   IN  UINTN                                 NumberOfChildren,
108   IN  EFI_HANDLE                            *ChildHandleBuffer OPTIONAL
109   );
110 
111 ///
112 /// This protocol provides the services required to determine if a driver supports a given controller.
113 /// If a controller is supported, then it also provides routines to start and stop the controller.
114 ///
115 struct _EFI_DRIVER_BINDING_PROTOCOL {
116   EFI_DRIVER_BINDING_SUPPORTED  Supported;
117   EFI_DRIVER_BINDING_START      Start;
118   EFI_DRIVER_BINDING_STOP       Stop;
119 
120   ///
121   /// The version number of the UEFI driver that produced the
122   /// EFI_DRIVER_BINDING_PROTOCOL. This field is used by
123   /// the EFI boot service ConnectController() to determine
124   /// the order that driver's Supported() service will be used when
125   /// a controller needs to be started. EFI Driver Binding Protocol
126   /// instances with higher Version values will be used before ones
127   /// with lower Version values. The Version values of 0x0-
128   /// 0x0f and 0xfffffff0-0xffffffff are reserved for
129   /// platform/OEM specific drivers. The Version values of 0x10-
130   /// 0xffffffef are reserved for IHV-developed drivers.
131   ///
132   UINT32                        Version;
133 
134   ///
135   /// The image handle of the UEFI driver that produced this instance
136   /// of the EFI_DRIVER_BINDING_PROTOCOL.
137   ///
138   EFI_HANDLE                    ImageHandle;
139 
140   ///
141   /// The handle on which this instance of the
142   /// EFI_DRIVER_BINDING_PROTOCOL is installed. In most
143   /// cases, this is the same handle as ImageHandle. However, for
144   /// UEFI drivers that produce more than one instance of the
145   /// EFI_DRIVER_BINDING_PROTOCOL, this value may not be
146   /// the same as ImageHandle.
147   ///
148   EFI_HANDLE                    DriverBindingHandle;
149 };
150 
151 extern EFI_GUID gEfiDriverBindingProtocolGuid;
152 
153 #endif
154