* [edk2-devel] [PATCH edk2-platforms v1 1/1] Platform/ARM: SgiPkg: Add serial debug port mapping.
@ 2024-01-19 9:40 levi.yun
0 siblings, 0 replies; only message in thread
From: levi.yun @ 2024-01-19 9:40 UTC (permalink / raw)
To: thomas.abraham, sami.mujawar, devel; +Cc: nd, levi.yun
The serial debug port must be initialised by the firmware. This
is done by SetupDebugUart when DynamicTables Framework
is used.
However, the address range for the serial debug port must
be mapped. Otherwise this results in a page fault when the
serial port is accessed.
Therefore, update the page tables to add the address range
covering the serial debug port.
Signed-off-by: levi.yun <yeoreum.yun@arm.com>
---
Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf | 1 +
Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c | 12 +++++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
index 020bde0d1f567d0b379fe2323dd6bf0dc4f7c1ce..539d2a460d56d400cf37a5c2ad3fbe9ad2e705bd 100644
--- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
+++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf
@@ -40,6 +40,7 @@ [FixedPcd]
gArmPlatformTokenSpaceGuid.PcdClusterCount
gArmPlatformTokenSpaceGuid.PcdCoreCount
gArmPlatformTokenSpaceGuid.PcdArmHdLcdBase
+ gArmPlatformTokenSpaceGuid.PcdSerialDbgRegisterBase
gArmSgiTokenSpaceGuid.PcdDramBlock2Base
gArmSgiTokenSpaceGuid.PcdDramBlock2Size
diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c
index fa3cfbc730f6ff94cd8a46694f99ea0a1ace9e00..92ca6bf64ab2781e09d31a90ecb5ce05c4e7027b 100644
--- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c
+++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c
@@ -18,7 +18,7 @@
// Total number of descriptors, including the final "end-of-table" descriptor.
#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS \
- ((14 + (FixedPcdGet32 (PcdChipCount) * 2)) + \
+ ((15 + (FixedPcdGet32 (PcdChipCount) * 2)) + \
(FixedPcdGet32 (PcdIoVirtSocExpBlkUartEnable) * \
FixedPcdGet32 (PcdChipCount) * 2))
@@ -184,6 +184,16 @@ ArmPlatformGetVirtualMemoryMap (
VirtualMemoryTable[Index].Length = SIZE_64KB;
VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+ /**
+ * DynamicTable initializes debug serial port. And OS expects firmware initalizes it.
+ * So, add mapping for DbgRegisterBase.
+ */
+ VirtualMemoryTable[++Index].PhysicalBase = FixedPcdGet64 (PcdSerialDbgRegisterBase);
+ VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdSerialDbgRegisterBase);
+ VirtualMemoryTable[Index].Length = SIZE_4KB;
+ VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+
+
#if (FixedPcdGet32 (PcdIoVirtSocExpBlkUartEnable) == 1)
// Chip-0 IO Virtualization SoC Expansion Block - UART0
IO_VIRT_SOC_EXP_BLK_UART_MMAP(0, 0)
--
Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114037): https://edk2.groups.io/g/devel/message/114037
Mute This Topic: https://groups.io/mt/103827145/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-01-19 9:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-19 9:40 [edk2-devel] [PATCH edk2-platforms v1 1/1] Platform/ARM: SgiPkg: Add serial debug port mapping levi.yun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox