]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.h
UefiCpuPkg/LocalApic.h: Remove duplicated/conflicted definitions
[mirror_edk2.git] / SourceLevelDebugPkg / Library / DebugAgent / DebugAgentCommon / DebugAgent.h
index 65e05fb4c65e8ccca19115aba5ceb88cbd97158b..e09ead9cf07433ea259af116b844a727ce9e0729 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Command header of for Debug Agent library instance.\r
 \r
-  Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -34,6 +34,7 @@
 #include <Library/PrintLib.h>\r
 #include <Library/PeCoffGetEntryPointLib.h>\r
 #include <Library/PeCoffExtraActionLib.h>\r
+#include <Register/ArchitecturalMsr.h>\r
 \r
 #include <TransferProtocol.h>\r
 #include <ImageDebugSupport.h>\r
@@ -60,6 +61,7 @@
 //  Timeout value for reading packet (unit is microsecond)\r
 //\r
 #define READ_PACKET_TIMEOUT     (500 * 1000)\r
+#define DEBUG_TIMER_INTERVAL    (100 * 1000)\r
 \r
 #define SOFT_INTERRUPT_SIGNATURE    SIGNATURE_32('S','O','F','T')\r
 #define SYSTEM_RESET_SIGNATURE      SIGNATURE_32('S','Y','S','R')\r
@@ -92,6 +94,7 @@ typedef struct {
 #define DEBUG_AGENT_FLAG_STEPPING              BIT3\r
 #define DEBUG_AGENT_FLAG_CHECK_MAILBOX_IN_HOB  BIT4\r
 #define DEBUG_AGENT_FLAG_INIT_ARCH             BIT5|BIT6\r
+#define DEBUG_AGENT_FLAG_INTERRUPT_FLAG        BIT7\r
 #define DEBUG_AGENT_FLAG_BREAK_ON_NEXT_SMI     BIT32\r
 #define DEBUG_AGENT_FLAG_PRINT_ERROR_LEVEL     (BIT33|BIT34|BIT35|BIT36)\r
 #define DEBUG_AGENT_FLAG_BREAK_BOOT_SCRIPT     BIT37\r
@@ -102,6 +105,7 @@ typedef struct {
 #define DEBUG_MAILBOX_LAST_ACK                        4\r
 #define DEBUG_MAILBOX_SEQUENCE_NO_INDEX               5\r
 #define DEBUG_MAILBOX_HOST_SEQUENCE_NO_INDEX          6\r
+#define DEBUG_MAILBOX_DEBUG_TIMER_FREQUENCY           7\r
 \r
 #pragma pack(1)\r
 typedef union {\r
@@ -115,7 +119,8 @@ typedef union {
     UINT32  SteppingFlag      : 1;   // 1: Agent is running stepping command\r
     UINT32  CheckMailboxInHob : 1;   // 1: Need to check mailbox saved in HOB\r
     UINT32  InitArch          : 2;   // value of DEBUG_DATA_RESPONSE_ARCH_MODE\r
-    UINT32  Reserved1         : 25;\r
+    UINT32  InterruptFlag     : 1;   // 1: EFLAGS.IF is set\r
+    UINT32  Reserved1         : 24;\r
     //\r
     // Higher 32bits to control the behavior of DebugAgent\r
     //\r
@@ -137,6 +142,7 @@ typedef struct {
   UINT8                      LastAck;      // The last ack packet type\r
   UINT8                      SequenceNo;\r
   UINT8                      HostSequenceNo;\r
+  UINT32                     DebugTimerFrequency;\r
   UINT8                      CheckSum;     // Mailbox checksum\r
   UINT8                      ToBeCheckSum; // To be Mailbox checksum at the next\r
 } DEBUG_AGENT_MAILBOX;\r
@@ -338,7 +344,7 @@ IsDebugAgentInitialzed (
   );\r
 \r
 /**\r
-  Caculate Mailbox checksum and update the checksum field.\r
+  Calculate Mailbox checksum and update the checksum field.\r
 \r
   @param[in]  Mailbox  Debug Agent Mailbox pointer.\r
 \r
@@ -469,5 +475,30 @@ ReadRemainingBreakPacket (
   IN OUT DEBUG_PACKET_HEADER    *DebugHeader\r
   );\r
 \r
+/**\r
+  Read data from debug channel and save the data in buffer.\r
+\r
+  Reads NumberOfBytes data bytes from a debug device into the buffer\r
+  specified by Buffer. The number of bytes actually read is returned.\r
+  If the return value is less than NumberOfBytes, then the rest operation failed.\r
+  If NumberOfBytes is zero, then return 0.\r
+\r
+  @param  Handle           Debug port handle.\r
+  @param  Buffer           Pointer to the data buffer to store the data read from the debug device.\r
+  @param  NumberOfBytes    Number of bytes which will be read.\r
+  @param  Timeout          Timeout value for reading from debug device. It unit is Microsecond.\r
+\r
+  @retval 0                Read data failed, no data is to be read.\r
+  @retval >0               Actual number of bytes read from debug device.\r
+\r
+**/\r
+UINTN\r
+DebugAgentReadBuffer (\r
+  IN     DEBUG_PORT_HANDLE     Handle,\r
+  IN OUT UINT8                 *Buffer,\r
+  IN     UINTN                 NumberOfBytes,\r
+  IN     UINTN                 Timeout\r
+  );\r
+\r
 #endif\r
 \r