Revision: 14285
http://edk2.svn.sourceforge.net/edk2/?rev=14285&view=rev
Author: vanjeff
Date: 2013-04-18 05:08:50 +0000 (Thu, 18 Apr 2013)
Log Message:
-----------
Allocate ACPImemoryNVS type memory to save mailbox and debug port handle buffer
since original allocated pool memory may be marked as free by DXE Core.
Signed-off-by: Jeff Fan <[email protected]>
Reviewed-by: Ruiyu Ni <[email protected]>
Modified Paths:
--------------
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
Modified:
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
===================================================================
---
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
2013-04-18 02:08:51 UTC (rev 14284)
+++
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
2013-04-18 05:08:50 UTC (rev 14285)
@@ -244,23 +244,51 @@
IN VOID *Ppi
)
{
+ EFI_STATUS Status;
DEBUG_AGENT_MAILBOX *Mailbox;
BOOLEAN InterruptStatus;
-
+ EFI_PHYSICAL_ADDRESS Memory;
+ DEBUG_AGENT_MAILBOX *NewMailbox;
+ UINT64 *MailboxLocationInHob;
+
//
// Save and disable original interrupt status
//
InterruptStatus = SaveAndDisableInterrupts ();
-
+
//
+ // Allocate ACPI NVS memory for new Mailbox and Debug Port Handle buffer
+ //
+ Status = PeiServicesAllocatePages (
+ EfiACPIMemoryNVS,
+ EFI_SIZE_TO_PAGES (sizeof(DEBUG_AGENT_MAILBOX) +
PcdGet16(PcdDebugPortHandleBufferSize)),
+ &Memory
+ );
+ ASSERT_EFI_ERROR (Status);
+ NewMailbox = (DEBUG_AGENT_MAILBOX *) (UINTN) Memory;
+ //
+ // Copy Mailbox and Debug Port Handle buffer to new location in ACPI NVS
memory, because original Mailbox
+ // and Debug Port Handle buffer in the allocated pool that may be marked as
free by DXE Core after DXE Core
+ // reallocates the HOB.
+ //
+ Mailbox = GetMailboxPointer ();
+ CopyMem (NewMailbox, Mailbox, sizeof (DEBUG_AGENT_MAILBOX));
+ CopyMem (NewMailbox + 1, (VOID *)(UINTN)Mailbox->DebugPortHandle,
PcdGet16(PcdDebugPortHandleBufferSize));
+ //
+ // Update Mailbox Location pointer in GUIDed HOB and IDT entry with new one
+ //
+ MailboxLocationInHob = GetMailboxLocationFromHob ();
+ *MailboxLocationInHob = (UINT64)(UINTN)NewMailbox;
+ SetLocationSavedMailboxPointerInIdtEntry (MailboxLocationInHob);
+ //
+ // Update Debug Port Handle in new Mailbox
+ //
+ UpdateMailboxContent (NewMailbox, DEBUG_MAILBOX_DEBUG_PORT_HANDLE_INDEX,
(UINT64)(UINTN)(NewMailbox + 1));
+ //
// Set physical memory ready flag
//
- Mailbox = GetMailboxPointer ();
SetDebugFlag (DEBUG_AGENT_FLAG_MEMORY_READY, 1);
- //
- // Memory has been ready
- //
if (IsHostAttached ()) {
//
// Trigger one software interrupt to inform HOST
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits