summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Include
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2007-11-20 05:42:23 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2007-11-20 05:42:23 +0000
commit36ee91ca3661d3d020a7841aacbf858d885c4728 (patch)
tree418e7a4d4a84d86a78d4b260acab20877be5bd45 /MdeModulePkg/Include
parent04e12c21476db29e8f92030ed00122fa4e1e56cc (diff)
downloadedk2-36ee91ca3661d3d020a7841aacbf858d885c4728.zip
edk2-36ee91ca3661d3d020a7841aacbf858d885c4728.tar.gz
edk2-36ee91ca3661d3d020a7841aacbf858d885c4728.tar.bz2
1. Add DPC protocol and DpcLib library in MdeModulePkg.
2. Add DpcDxe module and DxeDpcLib module in MdeModulePkg 3. Port network stack module to use DPC. 4. Use MIN, and MAX defined in MdePkg to replace NET_MIN and NET_MAX. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4307 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Include')
-rw-r--r--MdeModulePkg/Include/Library/DpcLib.h65
-rw-r--r--MdeModulePkg/Include/Library/NetLib.h526
-rw-r--r--MdeModulePkg/Include/Protocol/Dpc.h111
3 files changed, 443 insertions, 259 deletions
diff --git a/MdeModulePkg/Include/Library/DpcLib.h b/MdeModulePkg/Include/Library/DpcLib.h
new file mode 100644
index 0000000..7771afb
--- /dev/null
+++ b/MdeModulePkg/Include/Library/DpcLib.h
@@ -0,0 +1,65 @@
+/** @file
+
+Copyright (c) 2007, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ DpcLib.h
+
+Abstract:
+
+ Library for Deferred Procedure Calls.
+
+**/
+
+#ifndef _DPC_LIB_H_
+#define _DPC_LIB_H_
+
+#include <PiDxe.h>
+#include <Protocol/Dpc.h>
+
+/**
+ Add a Deferred Procedure Call to the end of the DPC queue.
+
+ @param DpcTpl The EFI_TPL that the DPC should be invoked.
+ @param DpcProcedure Pointer to the DPC's function.
+ @param DpcContext Pointer to the DPC's context. Passed to DpcProcedure
+ when DpcProcedure is invoked.
+
+ @retval EFI_SUCCESS The DPC was queued.
+ @retval EFI_INVALID_PARAMETER DpcTpl is not a valid EFI_TPL.
+ @retval EFI_INVALID_PARAMETER DpcProcedure is NULL.
+ @retval EFI_OUT_OF_RESOURCES There are not enough resources available to
+ add the DPC to the queue.
+
+**/
+EFI_STATUS
+QueueDpc (
+ IN EFI_TPL DpcTpl,
+ IN EFI_DPC_PROCEDURE DpcProcedure,
+ IN VOID *DpcContext OPTIONAL
+ );
+
+/**
+ Dispatch the queue of DPCs. ALL DPCs that have been queued with a DpcTpl
+ value greater than or equal to the current TPL are invoked in the order that
+ they were queued. DPCs with higher DpcTpl values are invoked before DPCs with
+ lower DpcTpl values.
+
+ @retval EFI_SUCCESS One or more DPCs were invoked.
+ @retval EFI_NOT_FOUND No DPCs were invoked.
+
+**/
+EFI_STATUS
+DispatchDpc (
+ VOID
+ );
+
+#endif
diff --git a/MdeModulePkg/Include/Library/NetLib.h b/MdeModulePkg/Include/Library/NetLib.h
index 3a82741..c843b6c 100644
--- a/MdeModulePkg/Include/Library/NetLib.h
+++ b/MdeModulePkg/Include/Library/NetLib.h
@@ -28,184 +28,185 @@ Abstract:
#include <Protocol/ComponentName.h>
#include <Protocol/DriverConfiguration.h>
#include <Protocol/DriverDiagnostics.h>
+#include <Protocol/Dpc.h>
+
+#define EFI_NET_LITTLE_ENDIAN
+
+typedef UINT32 IP4_ADDR;
+typedef UINT32 TCP_SEQNO;
+typedef UINT16 TCP_PORTNO;
+
+enum {
+ NET_ETHER_ADDR_LEN = 6,
+ NET_IFTYPE_ETHERNET = 0x01,
+
+ EFI_IP_PROTO_UDP = 0x11,
+ EFI_IP_PROTO_TCP = 0x06,
+ EFI_IP_PROTO_ICMP = 0x01,
+
+ //
+ // The address classfication
+ //
+ IP4_ADDR_CLASSA = 1,
+ IP4_ADDR_CLASSB,
+ IP4_ADDR_CLASSC,
+ IP4_ADDR_CLASSD,
+ IP4_ADDR_CLASSE,
+
+ IP4_MASK_NUM = 33,
+};
+
+#pragma pack(1)
+
+//
+// Ethernet head definition
+//
+typedef struct {
+ UINT8 DstMac [NET_ETHER_ADDR_LEN];
+ UINT8 SrcMac [NET_ETHER_ADDR_LEN];
+ UINT16 EtherType;
+} ETHER_HEAD;
+
+
+//
+// The EFI_IP4_HEADER is hard to use because the source and
+// destination address are defined as EFI_IPv4_ADDRESS, which
+// is a structure. Two structures can't be compared or masked
+// directly. This is why there is an internal representation.
+//
+typedef struct {
+#ifdef EFI_NET_LITTLE_ENDIAN
+ UINT8 HeadLen : 4;
+ UINT8 Ver : 4;
+#else
+ UINT8 Ver : 4;
+ UINT8 HeadLen : 4;
+#endif
+ UINT8 Tos;
+ UINT16 TotalLen;
+ UINT16 Id;
+ UINT16 Fragment;
+ UINT8 Ttl;
+ UINT8 Protocol;
+ UINT16 Checksum;
+ IP4_ADDR Src;
+ IP4_ADDR Dst;
+} IP4_HEAD;
+
+
+//
+// ICMP head definition. ICMP message is categoried as either an error
+// message or query message. Two message types have their own head format.
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Code;
+ UINT16 Checksum;
+} IP4_ICMP_HEAD;
+
+typedef struct {
+ IP4_ICMP_HEAD Head;
+ UINT32 Fourth; // 4th filed of the head, it depends on Type.
+ IP4_HEAD IpHead;
+} IP4_ICMP_ERROR_HEAD;
+
+typedef struct {
+ IP4_ICMP_HEAD Head;
+ UINT16 Id;
+ UINT16 Seq;
+} IP4_ICMP_QUERY_HEAD;
+
+
+//
+// UDP header definition
+//
+typedef struct {
+ UINT16 SrcPort;
+ UINT16 DstPort;
+ UINT16 Length;
+ UINT16 Checksum;
+} EFI_UDP4_HEADER;
+
+
+//
+// TCP header definition
+//
+typedef struct {
+ TCP_PORTNO SrcPort;
+ TCP_PORTNO DstPort;
+ TCP_SEQNO Seq;
+ TCP_SEQNO Ack;
+#ifdef EFI_NET_LITTLE_ENDIAN
+ UINT8 Res : 4;
+ UINT8 HeadLen : 4;
+#else
+ UINT8 HeadLen : 4;
+ UINT8 Res : 4;
+#endif
+ UINT8 Flag;
+ UINT16 Wnd;
+ UINT16 Checksum;
+ UINT16 Urg;
+} TCP_HEAD;
+
+#pragma pack()
+
+#define NET_MAC_EQUAL(pMac1, pMac2, Len) \
+ (NetCompareMem ((pMac1), (pMac2), Len) == 0)
+
+#define NET_MAC_IS_MULTICAST(Mac, BMac, Len) \
+ (((*((UINT8 *) Mac) & 0x01) == 0x01) && (!NET_MAC_EQUAL (Mac, BMac, Len)))
+
+#ifdef EFI_NET_LITTLE_ENDIAN
+#define NTOHL(x) (UINT32)((((UINT32) (x) & 0xff) << 24) | \
+ (((UINT32) (x) & 0xff00) << 8) | \
+ (((UINT32) (x) & 0xff0000) >> 8) | \
+ (((UINT32) (x) & 0xff000000) >> 24))
+
+#define HTONL(x) NTOHL(x)
+
+#define NTOHS(x) (UINT16)((((UINT16) (x) & 0xff) << 8) | \
+ (((UINT16) (x) & 0xff00) >> 8))
+
+#define HTONS(x) NTOHS(x)
+#else
+#define NTOHL(x) (UINT32)(x)
+#define HTONL(x) (UINT32)(x)
+#define NTOHS(x) (UINT16)(x)
+#define HTONS(x) (UINT16)(x)
+#endif
+
+//
+// Test the IP's attribute, All the IPs are in host byte order.
+//
+#define IP4_IS_MULTICAST(Ip) (((Ip) & 0xF0000000) == 0xE0000000)
+#define IP4_IS_LOCAL_BROADCAST(Ip) ((Ip) == 0xFFFFFFFF)
+#define IP4_NET_EQUAL(Ip1, Ip2, NetMask) (((Ip1) & (NetMask)) == ((Ip2) & (NetMask)))
+#define IP4_IS_VALID_NETMASK(Ip) (NetGetMaskLength (Ip) != IP4_MASK_NUM)
+
+//
+// Convert the EFI_IP4_ADDRESS to plain UINT32 IP4 address.
+//
+#define EFI_IP4(EfiIpAddr) (*(IP4_ADDR *) ((EfiIpAddr).Addr))
+#define EFI_NTOHL(EfiIp) (NTOHL (EFI_IP4 ((EfiIp))))
+#define EFI_IP4_EQUAL(Ip1, Ip2) (NetCompareMem ((Ip1), (Ip2), sizeof (EFI_IPv4_ADDRESS)) == 0)
+
+INTN
+NetGetMaskLength (
+ IN IP4_ADDR Mask
+ );
+
+INTN
+NetGetIpClass (
+ IN IP4_ADDR Addr
+ );
+
+BOOLEAN
+Ip4IsUnicast (
+ IN IP4_ADDR Ip,
+ IN IP4_ADDR NetMask
+ );
-#define EFI_NET_LITTLE_ENDIAN
-
-typedef UINT32 IP4_ADDR;
-typedef UINT32 TCP_SEQNO;
-typedef UINT16 TCP_PORTNO;
-
-enum {
- NET_ETHER_ADDR_LEN = 6,
- NET_IFTYPE_ETHERNET = 0x01,
-
- EFI_IP_PROTO_UDP = 0x11,
- EFI_IP_PROTO_TCP = 0x06,
- EFI_IP_PROTO_ICMP = 0x01,
-
- //
- // The address classfication
- //
- IP4_ADDR_CLASSA = 1,
- IP4_ADDR_CLASSB,
- IP4_ADDR_CLASSC,
- IP4_ADDR_CLASSD,
- IP4_ADDR_CLASSE,
-
- IP4_MASK_NUM = 33,
-};
-
-#pragma pack(1)
-
-//
-// Ethernet head definition
-//
-typedef struct {
- UINT8 DstMac [NET_ETHER_ADDR_LEN];
- UINT8 SrcMac [NET_ETHER_ADDR_LEN];
- UINT16 EtherType;
-} ETHER_HEAD;
-
-
-//
-// The EFI_IP4_HEADER is hard to use because the source and
-// destination address are defined as EFI_IPv4_ADDRESS, which
-// is a structure. Two structures can't be compared or masked
-// directly. This is why there is an internal representation.
-//
-typedef struct {
-#ifdef EFI_NET_LITTLE_ENDIAN
- UINT8 HeadLen : 4;
- UINT8 Ver : 4;
-#else
- UINT8 Ver : 4;
- UINT8 HeadLen : 4;
-#endif
- UINT8 Tos;
- UINT16 TotalLen;
- UINT16 Id;
- UINT16 Fragment;
- UINT8 Ttl;
- UINT8 Protocol;
- UINT16 Checksum;
- IP4_ADDR Src;
- IP4_ADDR Dst;
-} IP4_HEAD;
-
-
-//
-// ICMP head definition. ICMP message is categoried as either an error
-// message or query message. Two message types have their own head format.
-//
-typedef struct {
- UINT8 Type;
- UINT8 Code;
- UINT16 Checksum;
-} IP4_ICMP_HEAD;
-
-typedef struct {
- IP4_ICMP_HEAD Head;
- UINT32 Fourth; // 4th filed of the head, it depends on Type.
- IP4_HEAD IpHead;
-} IP4_ICMP_ERROR_HEAD;
-
-typedef struct {
- IP4_ICMP_HEAD Head;
- UINT16 Id;
- UINT16 Seq;
-} IP4_ICMP_QUERY_HEAD;
-
-
-//
-// UDP header definition
-//
-typedef struct {
- UINT16 SrcPort;
- UINT16 DstPort;
- UINT16 Length;
- UINT16 Checksum;
-} EFI_UDP4_HEADER;
-
-
-//
-// TCP header definition
-//
-typedef struct {
- TCP_PORTNO SrcPort;
- TCP_PORTNO DstPort;
- TCP_SEQNO Seq;
- TCP_SEQNO Ack;
-#ifdef EFI_NET_LITTLE_ENDIAN
- UINT8 Res : 4;
- UINT8 HeadLen : 4;
-#else
- UINT8 HeadLen : 4;
- UINT8 Res : 4;
-#endif
- UINT8 Flag;
- UINT16 Wnd;
- UINT16 Checksum;
- UINT16 Urg;
-} TCP_HEAD;
-
-#pragma pack()
-
-#define NET_MAC_EQUAL(pMac1, pMac2, Len) \
- (NetCompareMem ((pMac1), (pMac2), Len) == 0)
-
-#define NET_MAC_IS_MULTICAST(Mac, BMac, Len) \
- (((*((UINT8 *) Mac) & 0x01) == 0x01) && (!NET_MAC_EQUAL (Mac, BMac, Len)))
-
-#ifdef EFI_NET_LITTLE_ENDIAN
-#define NTOHL(x) (UINT32)((((UINT32) (x) & 0xff) << 24) | \
- (((UINT32) (x) & 0xff00) << 8) | \
- (((UINT32) (x) & 0xff0000) >> 8) | \
- (((UINT32) (x) & 0xff000000) >> 24))
-
-#define HTONL(x) NTOHL(x)
-
-#define NTOHS(x) (UINT16)((((UINT16) (x) & 0xff) << 8) | \
- (((UINT16) (x) & 0xff00) >> 8))
-
-#define HTONS(x) NTOHS(x)
-#else
-#define NTOHL(x) (UINT32)(x)
-#define HTONL(x) (UINT32)(x)
-#define NTOHS(x) (UINT16)(x)
-#define HTONS(x) (UINT16)(x)
-#endif
-
-//
-// Test the IP's attribute, All the IPs are in host byte order.
-//
-#define IP4_IS_MULTICAST(Ip) (((Ip) & 0xF0000000) == 0xE0000000)
-#define IP4_IS_LOCAL_BROADCAST(Ip) ((Ip) == 0xFFFFFFFF)
-#define IP4_NET_EQUAL(Ip1, Ip2, NetMask) (((Ip1) & (NetMask)) == ((Ip2) & (NetMask)))
-#define IP4_IS_VALID_NETMASK(Ip) (NetGetMaskLength (Ip) != IP4_MASK_NUM)
-
-//
-// Convert the EFI_IP4_ADDRESS to plain UINT32 IP4 address.
-//
-#define EFI_IP4(EfiIpAddr) (*(IP4_ADDR *) ((EfiIpAddr).Addr))
-#define EFI_NTOHL(EfiIp) (NTOHL (EFI_IP4 ((EfiIp))))
-#define EFI_IP4_EQUAL(Ip1, Ip2) (NetCompareMem ((Ip1), (Ip2), sizeof (EFI_IPv4_ADDRESS)) == 0)
-
-INTN
-NetGetMaskLength (
- IN IP4_ADDR Mask
- );
-
-INTN
-NetGetIpClass (
- IN IP4_ADDR Addr
- );
-
-BOOLEAN
-Ip4IsUnicast (
- IN IP4_ADDR Ip,
- IN IP4_ADDR NetMask
- );
-
extern IP4_ADDR mIp4AllMasks [IP4_MASK_NUM];
@@ -228,16 +229,13 @@ extern EFI_IPv4_ADDRESS mZeroIp4Addr;
// to the standard EFI enviornment. It will NOT consider multiprocessor.
//
#define NET_TPL_LOCK TPL_CALLBACK
-#define NET_TPL_RECYCLE_LOCK (NET_TPL_LOCK + 1)
-#define NET_TPL_EVENT TPL_CALLBACK
-#define NET_TPL_RECYCLE (NET_TPL_LOCK + 1)
-#define NET_TPL_SLOW_TIMER (TPL_CALLBACK - 1)
-#define NET_TPL_FAST_TIMER NET_TPL_RECYCLE
-#define NET_TPL_TIMER TPL_CALLBACK
+#define NET_TPL_EVENT TPL_NOTIFY
+#define NET_TPL_RECYCLE TPL_NOTIFY
+#define NET_TPL_TIMER NET_TPL_LOCK
#define NET_LOCK EFI_LOCK
#define NET_LOCK_INIT(x) EfiInitializeLock (x, NET_TPL_LOCK)
-#define NET_RECYCLE_LOCK_INIT(x) EfiInitializeLock (x, NET_TPL_RECYCLE_LOCK)
+#define NET_RECYCLE_LOCK_INIT(x) EfiInitializeLock (x, NET_TPL_RECYCLE)
#define NET_TRYLOCK(x) EfiAcquireLockOrFail (x)
#define NET_UNLOCK(x) EfiReleaseLock (x)
@@ -247,8 +245,6 @@ extern EFI_IPv4_ADDRESS mZeroIp4Addr;
#define TICKS_PER_MS 10000U
#define TICKS_PER_SECOND 10000000U
-#define NET_MIN(a, b) ((a) < (b) ? (a) : (b))
-#define NET_MAX(a, b) ((a) > (b) ? (a) : (b))
#define NET_RANDOM(Seed) ((UINT32) ((UINT32) (Seed) * 1103515245UL + 12345) % 4294967295UL)
@@ -476,6 +472,18 @@ NetLibGetNicHandle (
);
EFI_STATUS
+NetLibQueueDpc (
+ IN EFI_TPL DpcTpl,
+ IN EFI_DPC_PROCEDURE DpcProcedure,
+ IN VOID *DpcContext OPTIONAL
+ );
+
+EFI_STATUS
+NetLibDispatchDpc (
+ VOID
+ );
+
+EFI_STATUS
EFIAPI
NetLibDefaultUnload (
IN EFI_HANDLE ImageHandle
@@ -793,78 +801,78 @@ NetPseudoHeadChecksum (
IN UINT16 Len
);
-//
-// The debug level definition. This value is also used as the
-// syslog's servity level. Don't change it.
-//
-enum {
- NETDEBUG_LEVEL_TRACE = 5,
- NETDEBUG_LEVEL_WARNING = 4,
- NETDEBUG_LEVEL_ERROR = 3,
-};
-
-#ifdef EFI_NETWORK_STACK_DEBUG
-
-//
-// The debug output expects the ASCII format string, Use %a to print ASCII
-// string, and %s to print UNICODE string. PrintArg must be enclosed in ().
-// For example: NET_DEBUG_TRACE ("Tcp", ("State transit to %a\n", Name));
-//
-#define NET_DEBUG_TRACE(Module, PrintArg) \
- NetDebugOutput ( \
- NETDEBUG_LEVEL_TRACE, \
- Module, \
- __FILE__, \
- __LINE__, \
- NetDebugASPrint PrintArg \
- )
-
-#define NET_DEBUG_WARNING(Module, PrintArg) \
- NetDebugOutput ( \
- NETDEBUG_LEVEL_WARNING, \
- Module, \
- __FILE__, \
- __LINE__, \
- NetDebugASPrint PrintArg \
- )
-
-#define NET_DEBUG_ERROR(Module, PrintArg) \
- NetDebugOutput ( \
- NETDEBUG_LEVEL_ERROR, \
- Module, \
- __FILE__, \
- __LINE__, \
- NetDebugASPrint PrintArg \
- )
-
-#else
-#define NET_DEBUG_TRACE(Module, PrintString)
-#define NET_DEBUG_WARNING(Module, PrintString)
-#define NET_DEBUG_ERROR(Module, PrintString)
-#endif
-
-UINT8 *
-NetDebugASPrint (
- UINT8 *Format,
- ...
- );
-
-EFI_STATUS
-NetDebugOutput (
- UINT32 Level,
- UINT8 *Module,
- UINT8 *File,
- UINT32 Line,
- UINT8 *Message
- );
-
-//
-// Network debug message is sent out as syslog.
-//
-enum {
- NET_SYSLOG_FACILITY = 16, // Syslog local facility local use
- NET_SYSLOG_PACKET_LEN = 512,
- NET_DEBUG_MSG_LEN = 470, // 512 - (ether+ip+udp head length)
- NET_SYSLOG_TX_TIMEOUT = 500 *1000 *10, // 500ms
+//
+// The debug level definition. This value is also used as the
+// syslog's servity level. Don't change it.
+//
+enum {
+ NETDEBUG_LEVEL_TRACE = 5,
+ NETDEBUG_LEVEL_WARNING = 4,
+ NETDEBUG_LEVEL_ERROR = 3,
+};
+
+#ifdef EFI_NETWORK_STACK_DEBUG
+
+//
+// The debug output expects the ASCII format string, Use %a to print ASCII
+// string, and %s to print UNICODE string. PrintArg must be enclosed in ().
+// For example: NET_DEBUG_TRACE ("Tcp", ("State transit to %a\n", Name));
+//
+#define NET_DEBUG_TRACE(Module, PrintArg) \
+ NetDebugOutput ( \
+ NETDEBUG_LEVEL_TRACE, \
+ Module, \
+ __FILE__, \
+ __LINE__, \
+ NetDebugASPrint PrintArg \
+ )
+
+#define NET_DEBUG_WARNING(Module, PrintArg) \
+ NetDebugOutput ( \
+ NETDEBUG_LEVEL_WARNING, \
+ Module, \
+ __FILE__, \
+ __LINE__, \
+ NetDebugASPrint PrintArg \
+ )
+
+#define NET_DEBUG_ERROR(Module, PrintArg) \
+ NetDebugOutput ( \
+ NETDEBUG_LEVEL_ERROR, \
+ Module, \
+ __FILE__, \
+ __LINE__, \
+ NetDebugASPrint PrintArg \
+ )
+
+#else
+#define NET_DEBUG_TRACE(Module, PrintString)
+#define NET_DEBUG_WARNING(Module, PrintString)
+#define NET_DEBUG_ERROR(Module, PrintString)
+#endif
+
+UINT8 *
+NetDebugASPrint (
+ UINT8 *Format,
+ ...
+ );
+
+EFI_STATUS
+NetDebugOutput (
+ UINT32 Level,
+ UINT8 *Module,
+ UINT8 *File,
+ UINT32 Line,
+ UINT8 *Message
+ );
+
+//
+// Network debug message is sent out as syslog.
+//
+enum {
+ NET_SYSLOG_FACILITY = 16, // Syslog local facility local use
+ NET_SYSLOG_PACKET_LEN = 512,
+ NET_DEBUG_MSG_LEN = 470, // 512 - (ether+ip+udp head length)
+ NET_SYSLOG_TX_TIMEOUT = 500 *1000 *10, // 500ms
};
#endif
diff --git a/MdeModulePkg/Include/Protocol/Dpc.h b/MdeModulePkg/Include/Protocol/Dpc.h
new file mode 100644
index 0000000..d20c16a
--- /dev/null
+++ b/MdeModulePkg/Include/Protocol/Dpc.h
@@ -0,0 +1,111 @@
+/*++
+
+Copyright (c) 2007, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ Dpc.h
+
+Abstract:
+
+ EFI Deferred Procedure Call Protocol
+
+Revision History
+
+--*/
+
+
+#ifndef __DPC_H__
+#define __DPC_H__
+
+//
+// DPC Protocol GUID value
+//
+#define EFI_DPC_PROTOCOL_GUID \
+ { \
+ 0x480f8ae9, 0xc46, 0x4aa9, { 0xbc, 0x89, 0xdb, 0x9f, 0xba, 0x61, 0x98, 0x6 } \
+ }
+
+//
+// Forward reference for pure ANSI compatability
+//
+typedef struct _EFI_DPC_PROTOCOL EFI_DPC_PROTOCOL;
+
+
+/**
+ Invoke a Deferred Procedure Call.
+
+ @param DpcContext Pointer to the Deferred Procedure Call's context,
+ which is implementation dependent.
+
+**/
+typedef
+VOID
+(EFIAPI *EFI_DPC_PROCEDURE) (
+ IN VOID *DpcContext
+ );
+
+/**
+ Add a Deferred Procedure Call to the end of the DPC queue.
+
+ @param This Protocol instance pointer.
+ @param DpcTpl The EFI_TPL that the DPC should be invoked.
+ @param DpcProcedure Pointer to the DPC's function.
+ @param DpcContext Pointer to the DPC's context. Passed to DpcProcedure
+ when DpcProcedure is invoked.
+
+ @retval EFI_SUCCESS The DPC was queued.
+ @retval EFI_INVALID_PARAMETER DpcTpl is not a valid EFI_TPL.
+ @retval EFI_INVALID_PARAMETER DpcProcedure is NULL.
+ @retval EFI_OUT_OF_RESOURCES There are not enough resources available to
+ add the DPC to the queue.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_DPC_QUEUE_DPC) (
+ IN EFI_DPC_PROTOCOL *This,
+ IN EFI_TPL DpcTpl,
+ IN EFI_DPC_PROCEDURE DpcProcedure,
+ IN VOID *DpcContext OPTIONAL
+ );
+
+/**
+ Dispatch the queue of DPCs. ALL DPCs that have been queued with a DpcTpl
+ value greater than or equal to the current TPL are invoked in the order that
+ they were queued. DPCs with higher DpcTpl values are invoked before DPCs with
+ lower DpcTpl values.
+
+ @param This Protocol instance pointer.
+
+ @retval EFI_SUCCESS One or more DPCs were invoked.
+ @retval EFI_NOT_FOUND No DPCs were invoked.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_DPC_DISPATCH_DPC) (
+ IN EFI_DPC_PROTOCOL *This
+ );
+
+//
+// DPC Protocol structure
+//
+typedef struct _EFI_DPC_PROTOCOL {
+ EFI_DPC_QUEUE_DPC QueueDpc;
+ EFI_DPC_DISPATCH_DPC DispatchDpc;
+};
+
+//
+// DPC Protocol GUID variable
+//
+extern EFI_GUID gEfiDpcProtocolGuid;
+
+#endif