From: Jeff Fan <jeff.fan@intel.com>
To: edk2-devel@lists.01.org
Cc: Jiewen Yao <jiewen.yao@intel.com>,
Feng Tian <feng.tian@intel.com>,
Michael D Kinney <michael.d.kinney@intel.com>
Subject: [PATCH] UefiCpuPkg/CpuDxe: Add Local APIC memory mapped space in gDS
Date: Mon, 20 Feb 2017 16:40:05 +0800 [thread overview]
Message-ID: <20170220084005.21924-1-jeff.fan@intel.com> (raw)
Local APIC memory mapped space should be added into gDS and be allocated.
Otherwise, UEFI firmware cannot get correct memory map for it. For example,
SMM profile feature needs to get the completed MMIO map to protect them.
https://bugzilla.tianocore.org/show_bug.cgi?id=390
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
---
UefiCpuPkg/CpuDxe/CpuDxe.c | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c
index 9fb6d76..71a08cd 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.c
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
@@ -887,6 +887,40 @@ IdleLoopEventCallback (
CpuSleep ();
}
+/**
+ Add and allocate CPU local APIC memory mapped space.
+
+ @param[in]ImageHandle Image handle this driver.
+
+**/
+VOID
+AddLocalApicMemorySpace (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS BaseAddress;
+
+ BaseAddress = (EFI_PHYSICAL_ADDRESS) GetLocalApicBaseAddress ();
+ Status = gDS->AddMemorySpace (
+ EfiGcdMemoryTypeMemoryMappedIo,
+ BaseAddress,
+ SIZE_4KB,
+ EFI_MEMORY_UC
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = gDS->AllocateMemorySpace (
+ EfiGcdAllocateAddress,
+ EfiGcdMemoryTypeMemoryMappedIo,
+ 0,
+ SIZE_4KB,
+ &BaseAddress,
+ ImageHandle,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+}
/**
Initialize the state information for the CPU Architectural Protocol.
@@ -947,6 +981,11 @@ InitializeCpu (
RefreshGcdMemoryAttributes ();
//
+ // Add and allocate local APIC memory mapped space
+ //
+ AddLocalApicMemorySpace (ImageHandle);
+
+ //
// Setup a callback for idle events
//
Status = gBS->CreateEventEx (
--
2.9.3.windows.2
next reply other threads:[~2017-02-20 8:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-20 8:40 Jeff Fan [this message]
2017-02-20 9:11 ` [PATCH] UefiCpuPkg/CpuDxe: Add Local APIC memory mapped space in gDS Laszlo Ersek
2017-02-21 1:33 ` Fan, Jeff
2017-02-21 8:32 ` Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170220084005.21924-1-jeff.fan@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox