3 Copyright (c) 2005 - 2007, 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.
24 #include <Protocol/ServiceBinding.h>
25 #include <Protocol/SimpleNetwork.h>
26 #include <Protocol/LoadedImage.h>
27 #include <Protocol/NicIp4Config.h>
28 #include <Protocol/ComponentName.h>
29 #include <Protocol/ComponentName2.h>
31 #include <Library/NetLib.h>
32 #include <Library/BaseLib.h>
33 #include <Library/DebugLib.h>
34 #include <Library/BaseMemoryLib.h>
35 #include <Library/UefiBootServicesTableLib.h>
36 #include <Library/UefiRuntimeServicesTableLib.h>
37 #include <Library/UefiLib.h>
38 #include <Library/MemoryAllocationLib.h>
41 EFI_DPC_PROTOCOL
*mDpc
= NULL
;
44 // All the supported IP4 maskes in host byte order.
46 IP4_ADDR mIp4AllMasks
[IP4_MASK_NUM
] = {
85 EFI_IPv4_ADDRESS mZeroIp4Addr
= {{0, 0, 0, 0}};
88 Return the length of the mask. If the mask is invalid,
89 return the invalid length 33, which is IP4_MASK_NUM.
90 NetMask is in the host byte order.
92 @param NetMask The netmask to get the length from
94 @return The length of the netmask, IP4_MASK_NUM if the mask isn't
106 for (Index
= 0; Index
< IP4_MASK_NUM
; Index
++) {
107 if (NetMask
== mIp4AllMasks
[Index
]) {
118 Return the class of the address, such as class a, b, c.
119 Addr is in host byte order.
121 @param Addr The address to get the class from
123 @return IP address class, such as IP4_ADDR_CLASSA
134 ByteOne
= (UINT8
) (Addr
>> 24);
136 if ((ByteOne
& 0x80) == 0) {
137 return IP4_ADDR_CLASSA
;
139 } else if ((ByteOne
& 0xC0) == 0x80) {
140 return IP4_ADDR_CLASSB
;
142 } else if ((ByteOne
& 0xE0) == 0xC0) {
143 return IP4_ADDR_CLASSC
;
145 } else if ((ByteOne
& 0xF0) == 0xE0) {
146 return IP4_ADDR_CLASSD
;
149 return IP4_ADDR_CLASSE
;
156 Check whether the IP is a valid unicast address according to
157 the netmask. If NetMask is zero, use the IP address's class to
158 get the default mask.
160 @param Ip The IP to check againist
161 @param NetMask The mask of the IP
163 @return TRUE if IP is a valid unicast address on the network, otherwise FALSE
175 Class
= NetGetIpClass (Ip
);
177 if ((Ip
== 0) || (Class
>= IP4_ADDR_CLASSD
)) {
182 NetMask
= mIp4AllMasks
[Class
<< 3];
185 if (((Ip
&~NetMask
) == ~NetMask
) || ((Ip
&~NetMask
) == 0)) {
194 Initialize a random seed using current time.
198 @return The random seed initialized with current time.
210 gRT
->GetTime (&Time
, NULL
);
211 Seed
= (~Time
.Hour
<< 24 | Time
.Day
<< 16 | Time
.Minute
<< 8 | Time
.Second
);
212 Seed
^= Time
.Nanosecond
;
213 Seed
^= Time
.Year
<< 7;
220 Extract a UINT32 from a byte stream, then convert it to host
221 byte order. Use this function to avoid alignment error.
223 @param Buf The buffer to extract the UINT32.
225 @return The UINT32 extracted.
236 CopyMem (&Value
, Buf
, sizeof (UINT32
));
237 return NTOHL (Value
);
242 Put a UINT32 to the byte stream. Convert it from host byte order
243 to network byte order before putting.
245 @param Buf The buffer to put the UINT32
246 @param Data The data to put
259 CopyMem (Buf
, &Data
, sizeof (UINT32
));
264 Remove the first entry on the list
266 @param Head The list header
268 @return The entry that is removed from the list, NULL if the list is empty.
279 ASSERT (Head
!= NULL
);
281 if (IsListEmpty (Head
)) {
285 First
= Head
->ForwardLink
;
286 Head
->ForwardLink
= First
->ForwardLink
;
287 First
->ForwardLink
->BackLink
= Head
;
290 First
->ForwardLink
= (LIST_ENTRY
*) NULL
;
291 First
->BackLink
= (LIST_ENTRY
*) NULL
;
299 Remove the last entry on the list
301 @param Head The list head
303 @return The entry that is removed from the list, NULL if the list is empty.
314 ASSERT (Head
!= NULL
);
316 if (IsListEmpty (Head
)) {
320 Last
= Head
->BackLink
;
321 Head
->BackLink
= Last
->BackLink
;
322 Last
->BackLink
->ForwardLink
= Head
;
325 Last
->ForwardLink
= (LIST_ENTRY
*) NULL
;
326 Last
->BackLink
= (LIST_ENTRY
*) NULL
;
334 Insert the NewEntry after the PrevEntry
336 @param PrevEntry The previous entry to insert after
337 @param NewEntry The new entry to insert
345 IN LIST_ENTRY
*PrevEntry
,
346 IN LIST_ENTRY
*NewEntry
349 NewEntry
->BackLink
= PrevEntry
;
350 NewEntry
->ForwardLink
= PrevEntry
->ForwardLink
;
351 PrevEntry
->ForwardLink
->BackLink
= NewEntry
;
352 PrevEntry
->ForwardLink
= NewEntry
;
357 Insert the NewEntry before the PostEntry
359 @param PostEntry The entry to insert before
360 @param NewEntry The new entry to insert
367 NetListInsertBefore (
368 IN LIST_ENTRY
*PostEntry
,
369 IN LIST_ENTRY
*NewEntry
372 NewEntry
->ForwardLink
= PostEntry
;
373 NewEntry
->BackLink
= PostEntry
->BackLink
;
374 PostEntry
->BackLink
->ForwardLink
= NewEntry
;
375 PostEntry
->BackLink
= NewEntry
;
380 Initialize the netmap. Netmap is a reposity to keep the <Key, Value> pairs.
382 @param Map The netmap to initialize
393 ASSERT (Map
!= NULL
);
395 InitializeListHead (&Map
->Used
);
396 InitializeListHead (&Map
->Recycled
);
402 To clean up the netmap, that is, release allocated memories.
404 @param Map The netmap to clean up.
419 ASSERT (Map
!= NULL
);
421 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &Map
->Used
) {
422 Item
= NET_LIST_USER_STRUCT (Entry
, NET_MAP_ITEM
, Link
);
424 RemoveEntryList (&Item
->Link
);
427 gBS
->FreePool (Item
);
430 ASSERT ((Map
->Count
== 0) && IsListEmpty (&Map
->Used
));
432 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, &Map
->Recycled
) {
433 Item
= NET_LIST_USER_STRUCT (Entry
, NET_MAP_ITEM
, Link
);
435 RemoveEntryList (&Item
->Link
);
436 gBS
->FreePool (Item
);
439 ASSERT (IsListEmpty (&Map
->Recycled
));
444 Test whether the netmap is empty
446 @param Map The net map to test
448 @return TRUE if the netmap is empty, otherwise FALSE.
457 ASSERT (Map
!= NULL
);
458 return (BOOLEAN
) (Map
->Count
== 0);
463 Return the number of the <Key, Value> pairs in the netmap.
465 @param Map The netmap to get the entry number
467 @return The entry number in the netmap.
481 Allocate an item for the netmap. It will try to allocate
482 a batch of items and return one.
484 @param Map The netmap to allocate item for
486 @return The allocated item or NULL
499 ASSERT (Map
!= NULL
);
501 Head
= &Map
->Recycled
;
503 if (IsListEmpty (Head
)) {
504 for (Index
= 0; Index
< NET_MAP_INCREAMENT
; Index
++) {
505 Item
= AllocatePool (sizeof (NET_MAP_ITEM
));
515 InsertHeadList (Head
, &Item
->Link
);
519 Item
= NET_LIST_HEAD (Head
, NET_MAP_ITEM
, Link
);
520 NetListRemoveHead (Head
);
527 Allocate an item to save the <Key, Value> pair to the head of the netmap.
529 @param Map The netmap to insert into
530 @param Key The user's key
531 @param Value The user's value for the key
533 @retval EFI_OUT_OF_RESOURCES Failed to allocate the memory for the item
534 @retval EFI_SUCCESS The item is inserted to the head
542 IN VOID
*Value OPTIONAL
547 ASSERT (Map
!= NULL
);
549 Item
= NetMapAllocItem (Map
);
552 return EFI_OUT_OF_RESOURCES
;
557 InsertHeadList (&Map
->Used
, &Item
->Link
);
565 Allocate an item to save the <Key, Value> pair to the tail of the netmap.
567 @param Map The netmap to insert into
568 @param Key The user's key
569 @param Value The user's value for the key
571 @retval EFI_OUT_OF_RESOURCES Failed to allocate the memory for the item
572 @retval EFI_SUCCESS The item is inserted to the tail
580 IN VOID
*Value OPTIONAL
585 ASSERT (Map
!= NULL
);
587 Item
= NetMapAllocItem (Map
);
590 return EFI_OUT_OF_RESOURCES
;
595 InsertTailList (&Map
->Used
, &Item
->Link
);
604 Check whther the item is in the Map
606 @param Map The netmap to search within
607 @param Item The item to search
609 @return TRUE if the item is in the netmap, otherwise FALSE.
616 IN NET_MAP_ITEM
*Item
619 LIST_ENTRY
*ListEntry
;
621 NET_LIST_FOR_EACH (ListEntry
, &Map
->Used
) {
622 if (ListEntry
== &Item
->Link
) {
632 Find the key in the netmap
634 @param Map The netmap to search within
635 @param Key The key to search
637 @return The point to the item contains the Key, or NULL if Key isn't in the map.
650 ASSERT (Map
!= NULL
);
652 NET_LIST_FOR_EACH (Entry
, &Map
->Used
) {
653 Item
= NET_LIST_USER_STRUCT (Entry
, NET_MAP_ITEM
, Link
);
655 if (Item
->Key
== Key
) {
665 Remove the item from the netmap
667 @param Map The netmap to remove the item from
668 @param Item The item to remove
669 @param Value The variable to receive the value if not NULL
671 @return The key of the removed item.
678 IN NET_MAP_ITEM
*Item
,
679 OUT VOID
**Value OPTIONAL
682 ASSERT ((Map
!= NULL
) && (Item
!= NULL
));
683 ASSERT (NetItemInMap (Map
, Item
));
685 RemoveEntryList (&Item
->Link
);
687 InsertHeadList (&Map
->Recycled
, &Item
->Link
);
690 *Value
= Item
->Value
;
698 Remove the first entry on the netmap
700 @param Map The netmap to remove the head from
701 @param Value The variable to receive the value if not NULL
703 @return The key of the item removed
710 OUT VOID
**Value OPTIONAL
716 // Often, it indicates a programming error to remove
717 // the first entry in an empty list
719 ASSERT (Map
&& !IsListEmpty (&Map
->Used
));
721 Item
= NET_LIST_HEAD (&Map
->Used
, NET_MAP_ITEM
, Link
);
722 RemoveEntryList (&Item
->Link
);
724 InsertHeadList (&Map
->Recycled
, &Item
->Link
);
727 *Value
= Item
->Value
;
735 Remove the last entry on the netmap
737 @param Map The netmap to remove the tail from
738 @param Value The variable to receive the value if not NULL
740 @return The key of the item removed
747 OUT VOID
**Value OPTIONAL
753 // Often, it indicates a programming error to remove
754 // the last entry in an empty list
756 ASSERT (Map
&& !IsListEmpty (&Map
->Used
));
758 Item
= NET_LIST_TAIL (&Map
->Used
, NET_MAP_ITEM
, Link
);
759 RemoveEntryList (&Item
->Link
);
761 InsertHeadList (&Map
->Recycled
, &Item
->Link
);
764 *Value
= Item
->Value
;
772 Iterate through the netmap and call CallBack for each item. It will
773 contiue the traverse if CallBack returns EFI_SUCCESS, otherwise, break
774 from the loop. It returns the CallBack's last return value. This
775 function is delete safe for the current item.
777 @param Map The Map to iterate through
778 @param CallBack The callback function to call for each item.
779 @param Arg The opaque parameter to the callback
781 @return It returns the CallBack's last return value.
788 IN NET_MAP_CALLBACK CallBack
,
799 ASSERT ((Map
!= NULL
) && (CallBack
!= NULL
));
803 if (IsListEmpty (Head
)) {
807 NET_LIST_FOR_EACH_SAFE (Entry
, Next
, Head
) {
808 Item
= NET_LIST_USER_STRUCT (Entry
, NET_MAP_ITEM
, Link
);
809 Result
= CallBack (Map
, Item
, Arg
);
811 if (EFI_ERROR (Result
)) {
821 This is the default unload handle for all the network drivers.
823 @param ImageHandle The drivers' driver image.
825 @retval EFI_SUCCESS The image is unloaded.
826 @retval Others Failed to unload the image.
831 NetLibDefaultUnload (
832 IN EFI_HANDLE ImageHandle
836 EFI_HANDLE
*DeviceHandleBuffer
;
837 UINTN DeviceHandleCount
;
839 EFI_DRIVER_BINDING_PROTOCOL
*DriverBinding
;
840 EFI_COMPONENT_NAME_PROTOCOL
*ComponentName
;
841 EFI_COMPONENT_NAME2_PROTOCOL
*ComponentName2
;
844 // Get the list of all the handles in the handle database.
845 // If there is an error getting the list, then the unload
848 Status
= gBS
->LocateHandleBuffer (
856 if (EFI_ERROR (Status
)) {
861 // Disconnect the driver specified by ImageHandle from all
862 // the devices in the handle database.
864 for (Index
= 0; Index
< DeviceHandleCount
; Index
++) {
865 Status
= gBS
->DisconnectController (
866 DeviceHandleBuffer
[Index
],
873 // Uninstall all the protocols installed in the driver entry point
875 for (Index
= 0; Index
< DeviceHandleCount
; Index
++) {
876 Status
= gBS
->HandleProtocol (
877 DeviceHandleBuffer
[Index
],
878 &gEfiDriverBindingProtocolGuid
,
879 (VOID
**) &DriverBinding
882 if (EFI_ERROR (Status
)) {
886 if (DriverBinding
->ImageHandle
!= ImageHandle
) {
890 gBS
->UninstallProtocolInterface (
892 &gEfiDriverBindingProtocolGuid
,
895 Status
= gBS
->HandleProtocol (
896 DeviceHandleBuffer
[Index
],
897 &gEfiComponentNameProtocolGuid
,
898 (VOID
**) &ComponentName
900 if (!EFI_ERROR (Status
)) {
901 gBS
->UninstallProtocolInterface (
903 &gEfiComponentNameProtocolGuid
,
908 Status
= gBS
->HandleProtocol (
909 DeviceHandleBuffer
[Index
],
910 &gEfiComponentName2ProtocolGuid
,
911 (VOID
**) &ComponentName2
913 if (!EFI_ERROR (Status
)) {
914 gBS
->UninstallProtocolInterface (
916 &gEfiComponentName2ProtocolGuid
,
923 // Free the buffer containing the list of handles from the handle database
925 if (DeviceHandleBuffer
!= NULL
) {
926 gBS
->FreePool (DeviceHandleBuffer
);
935 Create a child of the service that is identified by ServiceBindingGuid.
937 @param Controller The controller which has the service installed.
938 @param Image The image handle used to open service.
939 @param ServiceBindingGuid The service's Guid.
940 @param ChildHandle The handle to receive the create child
942 @retval EFI_SUCCESS The child is successfully created.
943 @retval Others Failed to create the child.
948 NetLibCreateServiceChild (
949 IN EFI_HANDLE Controller
,
951 IN EFI_GUID
*ServiceBindingGuid
,
952 OUT EFI_HANDLE
*ChildHandle
956 EFI_SERVICE_BINDING_PROTOCOL
*Service
;
959 ASSERT ((ServiceBindingGuid
!= NULL
) && (ChildHandle
!= NULL
));
962 // Get the ServiceBinding Protocol
964 Status
= gBS
->OpenProtocol (
970 EFI_OPEN_PROTOCOL_GET_PROTOCOL
973 if (EFI_ERROR (Status
)) {
980 Status
= Service
->CreateChild (Service
, ChildHandle
);
986 Destory a child of the service that is identified by ServiceBindingGuid.
988 @param Controller The controller which has the service installed.
989 @param Image The image handle used to open service.
990 @param ServiceBindingGuid The service's Guid.
991 @param ChildHandle The child to destory
993 @retval EFI_SUCCESS The child is successfully destoried.
994 @retval Others Failed to destory the child.
999 NetLibDestroyServiceChild (
1000 IN EFI_HANDLE Controller
,
1001 IN EFI_HANDLE Image
,
1002 IN EFI_GUID
*ServiceBindingGuid
,
1003 IN EFI_HANDLE ChildHandle
1007 EFI_SERVICE_BINDING_PROTOCOL
*Service
;
1009 ASSERT (ServiceBindingGuid
!= NULL
);
1012 // Get the ServiceBinding Protocol
1014 Status
= gBS
->OpenProtocol (
1020 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1023 if (EFI_ERROR (Status
)) {
1028 // destory the child
1030 Status
= Service
->DestroyChild (Service
, ChildHandle
);
1036 Convert the mac address of the simple network protocol installed on
1037 SnpHandle to a unicode string. Callers are responsible for freeing the
1040 @param SnpHandle The handle where the simple network protocol is
1042 @param ImageHandle The image handle used to act as the agent handle to
1043 get the simple network protocol.
1044 @param MacString The pointer to store the address of the string
1045 representation of the mac address.
1047 @retval EFI_OUT_OF_RESOURCES There are not enough memory resource.
1048 @retval other Failed to open the simple network protocol.
1053 NetLibGetMacString (
1054 IN EFI_HANDLE SnpHandle
,
1055 IN EFI_HANDLE ImageHandle
,
1056 IN OUT CHAR16
**MacString
1060 EFI_SIMPLE_NETWORK_PROTOCOL
*Snp
;
1061 EFI_SIMPLE_NETWORK_MODE
*Mode
;
1068 // Get the Simple Network protocol from the SnpHandle.
1070 Status
= gBS
->OpenProtocol (
1072 &gEfiSimpleNetworkProtocolGuid
,
1076 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1078 if (EFI_ERROR (Status
)) {
1085 // It takes 2 unicode characters to represent a 1 byte binary buffer.
1086 // Plus one unicode character for the null-terminator.
1088 MacAddress
= AllocatePool ((2 * Mode
->HwAddressSize
+ 1) * sizeof (CHAR16
));
1089 if (MacAddress
== NULL
) {
1090 return EFI_OUT_OF_RESOURCES
;
1094 // Convert the mac address into a unicode string.
1096 for (Index
= 0; Index
< Mode
->HwAddressSize
; Index
++) {
1097 MacAddress
[Index
* 2] = NibbleToHexChar ((UINT8
) (Mode
->CurrentAddress
.Addr
[Index
] >> 4));
1098 MacAddress
[Index
* 2 + 1] = NibbleToHexChar (Mode
->CurrentAddress
.Addr
[Index
]);
1101 MacAddress
[Mode
->HwAddressSize
* 2] = L
'\0';
1103 *MacString
= MacAddress
;
1109 Check the default address used by the IPv4 driver is static or dynamic (acquired
1112 @param Controller The controller handle which has the NIC Ip4 Config Protocol
1113 relative with the default address to judge.
1115 @retval TRUE If the default address is static.
1116 @retval FALSE If the default address is acquired from DHCP.
1121 NetLibDefaultAddressIsStatic (
1122 IN EFI_HANDLE Controller
1126 EFI_NIC_IP4_CONFIG_PROTOCOL
*NicIp4
;
1128 NIC_IP4_CONFIG_INFO
*ConfigInfo
;
1131 Status
= gBS
->HandleProtocol (
1133 &gEfiNicIp4ConfigProtocolGuid
,
1136 if (EFI_ERROR (Status
)) {
1141 Status
= NicIp4
->GetInfo (NicIp4
, &Len
, NULL
);
1142 if (Status
!= EFI_BUFFER_TOO_SMALL
) {
1146 ConfigInfo
= AllocatePool (Len
);
1147 if (ConfigInfo
== NULL
) {
1152 Status
= NicIp4
->GetInfo (NicIp4
, &Len
, ConfigInfo
);
1153 if (EFI_ERROR (Status
)) {
1157 IsStatic
= (BOOLEAN
) (ConfigInfo
->Source
== IP4_CONFIG_SOURCE_STATIC
);
1161 gBS
->FreePool (ConfigInfo
);
1167 Create an IPv4 device path node.
1169 @param Node Pointer to the IPv4 device path node.
1170 @param Controller The handle where the NIC IP4 config protocol resides.
1171 @param LocalIp The local IPv4 address.
1172 @param LocalPort The local port.
1173 @param RemoteIp The remote IPv4 address.
1174 @param RemotePort The remote port.
1175 @param Protocol The protocol type in the IP header.
1176 @param UseDefaultAddress Whether this instance is using default address or not.
1182 NetLibCreateIPv4DPathNode (
1183 IN OUT IPv4_DEVICE_PATH
*Node
,
1184 IN EFI_HANDLE Controller
,
1185 IN IP4_ADDR LocalIp
,
1186 IN UINT16 LocalPort
,
1187 IN IP4_ADDR RemoteIp
,
1188 IN UINT16 RemotePort
,
1190 IN BOOLEAN UseDefaultAddress
1193 Node
->Header
.Type
= MESSAGING_DEVICE_PATH
;
1194 Node
->Header
.SubType
= MSG_IPv4_DP
;
1195 SetDevicePathNodeLength (&Node
->Header
, 19);
1197 CopyMem (&Node
->LocalIpAddress
, &LocalIp
, sizeof (EFI_IPv4_ADDRESS
));
1198 CopyMem (&Node
->RemoteIpAddress
, &RemoteIp
, sizeof (EFI_IPv4_ADDRESS
));
1200 Node
->LocalPort
= LocalPort
;
1201 Node
->RemotePort
= RemotePort
;
1203 Node
->Protocol
= Protocol
;
1205 if (!UseDefaultAddress
) {
1206 Node
->StaticIpAddress
= TRUE
;
1208 Node
->StaticIpAddress
= NetLibDefaultAddressIsStatic (Controller
);
1214 Find the UNDI/SNP handle from controller and protocol GUID.
1215 For example, IP will open a MNP child to transmit/receive
1216 packets, when MNP is stopped, IP should also be stopped. IP
1217 needs to find its own private data which is related the IP's
1218 service binding instance that is install on UNDI/SNP handle.
1219 Now, the controller is either a MNP or ARP child handle. But
1220 IP opens these handle BY_DRIVER, use that info, we can get the
1223 @param Controller Then protocol handle to check
1224 @param ProtocolGuid The protocol that is related with the handle.
1226 @return The UNDI/SNP handle or NULL.
1231 NetLibGetNicHandle (
1232 IN EFI_HANDLE Controller
,
1233 IN EFI_GUID
*ProtocolGuid
1236 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
*OpenBuffer
;
1242 Status
= gBS
->OpenProtocolInformation (
1249 if (EFI_ERROR (Status
)) {
1255 for (Index
= 0; Index
< OpenCount
; Index
++) {
1256 if (OpenBuffer
[Index
].Attributes
& EFI_OPEN_PROTOCOL_BY_DRIVER
) {
1257 Handle
= OpenBuffer
[Index
].ControllerHandle
;
1262 gBS
->FreePool (OpenBuffer
);
1267 Add a Deferred Procedure Call to the end of the DPC queue.
1269 @DpcTpl The EFI_TPL that the DPC should be invoked.
1270 @DpcProcedure Pointer to the DPC's function.
1271 @DpcContext Pointer to the DPC's context. Passed to DpcProcedure
1272 when DpcProcedure is invoked.
1274 @retval EFI_SUCCESS The DPC was queued.
1275 @retval EFI_INVALID_PARAMETER DpcTpl is not a valid EFI_TPL.
1276 DpcProcedure is NULL.
1277 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to
1278 add the DPC to the queue.
1285 IN EFI_DPC_PROCEDURE DpcProcedure
,
1286 IN VOID
*DpcContext OPTIONAL
1289 return mDpc
->QueueDpc (mDpc
, DpcTpl
, DpcProcedure
, DpcContext
);
1293 Add a Deferred Procedure Call to the end of the DPC queue.
1295 @retval EFI_SUCCESS One or more DPCs were invoked.
1296 @retval EFI_NOT_FOUND No DPCs were invoked.
1305 return mDpc
->DispatchDpc(mDpc
);
1310 The constructor function caches the pointer to DPC protocol.
1312 The constructor function locates DPC protocol from protocol database.
1313 It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.
1315 @param ImageHandle The firmware allocated handle for the EFI image.
1316 @param SystemTable A pointer to the EFI System Table.
1318 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
1324 IN EFI_HANDLE ImageHandle
,
1325 IN EFI_SYSTEM_TABLE
*SystemTable
1330 Status
= gBS
->LocateProtocol (&gEfiDpcProtocolGuid
, NULL
, (VOID
**) &mDpc
);
1331 ASSERT_EFI_ERROR (Status
);
1332 ASSERT (mDpc
!= NULL
);