3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. 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
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.
18 EFI internal protocol definitions
31 // IHANDLE - contains a list of protocol handles
34 #define EFI_HANDLE_SIGNATURE EFI_SIGNATURE_32('h','n','d','l')
37 LIST_ENTRY AllHandles
; // All handles list of IHANDLE
38 LIST_ENTRY Protocols
; // List of PROTOCOL_INTERFACE's for this handle
39 UINTN LocateRequest
; //
40 UINT64 Key
; // The Handle Database Key value when this handle was last created or modified
43 #define ASSERT_IS_HANDLE(a) ASSERT((a)->Signature == EFI_HANDLE_SIGNATURE)
47 // PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol
48 // database. Each handler that supports this protocol is listed, along
49 // with a list of registered notifies.
52 #define PROTOCOL_ENTRY_SIGNATURE EFI_SIGNATURE_32('p','r','t','e')
55 LIST_ENTRY AllEntries
; // All entries
56 EFI_GUID ProtocolID
; // ID of the protocol
57 LIST_ENTRY Protocols
; // All protocol interfaces
58 LIST_ENTRY Notify
; // Registerd notification handlers
62 // PROTOCOL_INTERFACE - each protocol installed on a handle is tracked
63 // with a protocol interface structure
66 #define PROTOCOL_INTERFACE_SIGNATURE EFI_SIGNATURE_32('p','i','f','c')
69 EFI_HANDLE Handle
; // Back pointer
70 LIST_ENTRY Link
; // Link on IHANDLE.Protocols
71 LIST_ENTRY ByProtocol
; // Link on PROTOCOL_ENTRY.Protocols
72 PROTOCOL_ENTRY
*Protocol
; // The protocol ID
73 VOID
*Interface
; // The interface value
75 LIST_ENTRY OpenList
; // OPEN_PROTOCOL_DATA list.
78 EFI_HANDLE ControllerHandle
;
82 #define OPEN_PROTOCOL_DATA_SIGNATURE EFI_SIGNATURE_32('p','o','d','l')
88 EFI_HANDLE AgentHandle
;
89 EFI_HANDLE ControllerHandle
;
96 // PROTOCOL_NOTIFY - used for each register notification for a protocol
99 #define PROTOCOL_NOTIFY_SIGNATURE EFI_SIGNATURE_32('p','r','t','n')
102 PROTOCOL_ENTRY
*Protocol
;
103 LIST_ENTRY Link
; // All notifications for this protocol
104 EFI_EVENT Event
; // Event to notify
105 LIST_ENTRY
*Position
; // Last position notified
109 // Internal prototypes
114 CoreFindProtocolEntry (
115 IN EFI_GUID
*Protocol
,
122 Finds the protocol entry for the requested protocol.
124 The gProtocolDatabaseLock must be owned
128 Protocol - The ID of the protocol
130 Create - Create a new entry if not found
140 CoreNotifyProtocolEntry (
141 IN PROTOCOL_ENTRY
*ProtEntry
147 Signal event for every protocol in protocol entry.
151 ProtEntry - Protocol entry
159 CoreFindProtocolInterface (
161 IN EFI_GUID
*Protocol
,
168 Finds the protocol instance for the requested handle and protocol.
170 Note: This function doesn't do parameters checking, it's caller's responsibility
171 to pass in valid parameters.
175 Handle - The handle to search the protocol on
177 Protocol - GUID of the protocol
179 Interface - The interface for the protocol being searched
183 Protocol instance (NULL: Not found)
189 CoreRemoveInterfaceFromProtocol (
191 IN EFI_GUID
*Protocol
,
198 Removes Protocol from the protocol list (but not the handle list).
202 Handle - The handle to remove protocol on.
204 Protocol - GUID of the protocol to be moved
206 Interface - The interface of the protocol
216 CoreUnregisterProtocolNotify (
223 Removes all the events in the protocol database that match Event.
227 Event - The event to search for in the protocol database.
231 EFI_SUCCESS when done searching the entire database.
237 CoreDisconnectControllersUsingProtocolInterface (
238 IN EFI_HANDLE UserHandle
,
239 IN PROTOCOL_INTERFACE
*Prot
245 Attempts to disconnect all drivers that are using the protocol interface being queried.
246 If failed, reconnect all drivers disconnected.
248 Note: This function doesn't do parameters checking, it's caller's responsibility
249 to pass in valid parameters.
253 UserHandle - The handle on which the protocol is installed
254 Prot - The protocol to disconnect drivers from
258 EFI_SUCCESS - Drivers using the protocol interface are all disconnected
259 EFI_ACCESS_DENIED - Failed to disconnect one or all of the drivers
265 CoreAcquireProtocolLock (
272 Acquire lock on gProtocolDatabaseLock.
286 CoreReleaseProtocolLock (
293 Release lock on gProtocolDatabaseLock.
308 IN EFI_HANDLE UserHandle
314 Check whether a handle is a valid EFI_HANDLE
318 UserHandle - The handle to check
322 EFI_INVALID_PARAMETER - The handle is NULL or not a valid EFI_HANDLE.
324 EFI_SUCCESS - The handle is valid EFI_HANDLE.
333 extern EFI_LOCK gProtocolDatabaseLock
;
334 extern LIST_ENTRY gHandleList
;
335 extern UINT64 gHandleDatabaseKey
;