15UINTN mEfiLocateHandleRequest = 0;
110 IN VOID *SearchKey OPTIONAL,
118 CORE_GET_NEXT GetNext;
124 if (BufferSize ==
NULL) {
125 return EFI_INVALID_PARAMETER;
128 if ((*BufferSize > 0) && (Buffer ==
NULL)) {
129 return EFI_INVALID_PARAMETER;
137 Position.Protocol = Protocol;
138 Position.SearchKey = SearchKey;
139 Position.Position = &gHandleList;
142 ResultBuffer = (
IHANDLE **)Buffer;
148 switch (SearchType) {
157 if (SearchKey ==
NULL) {
158 Status = EFI_INVALID_PARAMETER;
167 if (Protocol ==
NULL) {
168 Status = EFI_INVALID_PARAMETER;
176 if (Position.ProtEntry ==
NULL) {
177 Status = EFI_NOT_FOUND;
181 Position.Position = &Position.ProtEntry->
Protocols;
185 Status = EFI_INVALID_PARAMETER;
189 if (EFI_ERROR (Status)) {
193 ASSERT (GetNext !=
NULL);
197 mEfiLocateHandleRequest += 1;
202 Handle = GetNext (&Position, &Interface);
203 if (
NULL == Handle) {
211 ResultSize +=
sizeof (Handle);
212 if (ResultSize <= *BufferSize) {
213 *ResultBuffer = Handle;
222 if (ResultSize == 0) {
223 Status = EFI_NOT_FOUND;
229 if (ResultSize > *BufferSize) {
230 Status = EFI_BUFFER_TOO_SMALL;
233 *BufferSize = ResultSize;
240 ASSERT (SearchKey !=
NULL);
241 ProtNotify = SearchKey;
272 IN VOID *SearchKey OPTIONAL,
310 Position->Position = Position->Position->ForwardLink;
317 if (Position->Position != &gHandleList) {
349 ProtNotify = Position->SearchKey;
354 if (ProtNotify !=
NULL) {
355 ASSERT (ProtNotify->Signature == PROTOCOL_NOTIFY_SIGNATURE);
356 Position->SearchKey =
NULL;
361 Link = ProtNotify->
Position->ForwardLink;
362 if (Link != &ProtNotify->Protocol->
Protocols) {
399 Link = Position->Position->ForwardLink;
400 Position->Position = Link;
405 if (Link == &Position->ProtEntry->Protocols) {
421 if (Handle->LocateRequest != mEfiLocateHandleRequest) {
422 Handle->LocateRequest = mEfiLocateHandleRequest;
466 if (Protocol ==
NULL) {
467 return EFI_INVALID_PARAMETER;
470 if ((DevicePath ==
NULL) || (*DevicePath ==
NULL)) {
471 return EFI_INVALID_PARAMETER;
476 SourcePath = *DevicePath;
477 TmpDevicePath = SourcePath;
490 SourceSize = (
UINTN)TmpDevicePath - (
UINTN)SourcePath;
496 if (EFI_ERROR (Status) || (HandleCount == 0)) {
497 return EFI_NOT_FOUND;
501 for (Index = 0; Index < HandleCount; Index += 1) {
502 Handle = Handles[Index];
504 if (EFI_ERROR (Status)) {
516 if ((Size <= SourceSize) && (
CompareMem (SourcePath, TmpDevicePath, (
UINTN)Size) == 0)) {
522 ASSERT (Size != BestMatch);
527 if (Size > BestMatch) {
540 if (BestMatch == -1) {
541 return EFI_NOT_FOUND;
544 if (Device ==
NULL) {
545 return EFI_INVALID_PARAMETER;
548 *Device = BestDevice;
577 IN VOID *Registration OPTIONAL,
586 if ((Interface ==
NULL) || (Protocol ==
NULL)) {
587 return EFI_INVALID_PARAMETER;
596 Position.Protocol = Protocol;
597 Position.SearchKey = Registration;
598 Position.Position = &gHandleList;
604 if (EFI_ERROR (Status)) {
605 return EFI_NOT_FOUND;
608 mEfiLocateHandleRequest += 1;
610 if (Registration ==
NULL) {
615 if (Position.ProtEntry ==
NULL) {
616 Status = EFI_NOT_FOUND;
620 Position.Position = &Position.ProtEntry->
Protocols;
627 if (Handle ==
NULL) {
628 Status = EFI_NOT_FOUND;
629 }
else if (Registration !=
NULL) {
634 ProtNotify = Registration;
670 IN VOID *SearchKey OPTIONAL,
678 if (NumberHandles ==
NULL) {
679 return EFI_INVALID_PARAMETER;
682 if (Buffer ==
NULL) {
683 return EFI_INVALID_PARAMETER;
707 if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
708 if (Status != EFI_INVALID_PARAMETER) {
709 Status = EFI_NOT_FOUND;
717 if (*Buffer ==
NULL) {
719 return EFI_OUT_OF_RESOURCES;
730 *NumberHandles = BufferSize /
sizeof (
EFI_HANDLE);
731 if (EFI_ERROR (Status)) {
733 if (*Buffer !=
NULL) {
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI IsDevicePathEnd(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI NextDevicePathNode(IN CONST VOID *Node)
UINTN EFIAPI GetDevicePathSize(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
BOOLEAN EFIAPI IsDevicePathEndInstance(IN CONST VOID *Node)
EFI_STATUS CoreAcquireLockOrFail(IN EFI_LOCK *Lock)
EFI_STATUS EFIAPI CoreHandleProtocol(IN EFI_HANDLE UserHandle, IN EFI_GUID *Protocol, OUT VOID **Interface)
EFI_STATUS EFIAPI CoreFreePool(IN VOID *Buffer)
PROTOCOL_ENTRY * CoreFindProtocolEntry(IN EFI_GUID *Protocol, IN BOOLEAN Create)
VOID CoreReleaseProtocolLock(VOID)
VOID CoreAcquireProtocolLock(VOID)
IHANDLE * CoreGetNextLocateAllHandles(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface)
EFI_STATUS InternalCoreLocateHandle(IN EFI_LOCATE_SEARCH_TYPE SearchType, IN EFI_GUID *Protocol OPTIONAL, IN VOID *SearchKey OPTIONAL, IN OUT UINTN *BufferSize, OUT EFI_HANDLE *Buffer)
EFI_STATUS EFIAPI CoreLocateProtocol(IN EFI_GUID *Protocol, IN VOID *Registration OPTIONAL, OUT VOID **Interface)
EFI_STATUS EFIAPI CoreLocateHandleBuffer(IN EFI_LOCATE_SEARCH_TYPE SearchType, IN EFI_GUID *Protocol OPTIONAL, IN VOID *SearchKey OPTIONAL, IN OUT UINTN *NumberHandles, OUT EFI_HANDLE **Buffer)
IHANDLE * CoreGetNextLocateByProtocol(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface)
EFI_STATUS EFIAPI CoreLocateDevicePath(IN EFI_GUID *Protocol, IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, OUT EFI_HANDLE *Device)
EFI_STATUS EFIAPI CoreLocateHandle(IN EFI_LOCATE_SEARCH_TYPE SearchType, IN EFI_GUID *Protocol OPTIONAL, IN VOID *SearchKey OPTIONAL, IN OUT UINTN *BufferSize, OUT EFI_HANDLE *Buffer)
IHANDLE * CoreGetNextLocateByRegisterNotify(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface)
#define CR(Record, TYPE, Field, TestSignature)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
LIST_ENTRY Protocols
All protocol interfaces.
IHANDLE * Handle
Back pointer.
VOID * Interface
The interface value.
LIST_ENTRY * Position
Last position notified.