Skip to content

Commit

Permalink
ARM/JunoPkg: Add HDLCD platform library
Browse files Browse the repository at this point in the history
This change adds the HDLCD platform lib for the Juno plaform. This
library will be instantiated as a LcdPlatformLib to link with
LcdGraphicsOutputDxe for the Juno platform.

HDLCD platform library depends on the Arm SCMI DXE driver for
communication with the SCP for clock setting. Therefore this change also
enables building of Arm SCMI DXE driver for the Juno platform.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Girish Pathak <[email protected]>
Signed-off-by: Evan Lloyd <[email protected]>
Reviewed-by: Leif Lindholm <[email protected]>
  • Loading branch information
girishpathak authored and Leif Lindholm committed Apr 23, 2018
1 parent b3b892d commit b581a49
Show file tree
Hide file tree
Showing 7 changed files with 665 additions and 3 deletions.
8 changes: 8 additions & 0 deletions Platform/ARM/JunoPkg/ArmJuno.dec
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,11 @@
gArmJunoTokenSpaceGuid.PcdArmMtlMailBoxBase|0x2E000000|UINT64|0x00000025
gArmJunoTokenSpaceGuid.PcdArmMtlMailBoxSize|0x80|UINT32|0x00000026

# MaxMode must be one number higher than the actual max mode,
# i.e. for actual maximum mode 2, set the value to 3.
#
# Default value zero allows platform to enumerate maximum supported mode.
#
# For a list of mode numbers look in HdLcdArmJuno.c
gArmJunoTokenSpaceGuid.PcdArmHdLcdMaxMode|0|UINT32|0x00000017

26 changes: 26 additions & 0 deletions Platform/ARM/JunoPkg/ArmJuno.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
# SCMI Mailbox Transport Layer
ArmMtlLib|Platform/ARM/JunoPkg/Library/ArmJunoMtlLib/ArmJunoMtlLib.inf

!ifndef HEADLESS_PLATFORM
LcdPlatformLib|Platform/ARM/JunoPkg/Library/HdLcdArmJunoLib/HdLcdArmJunoLib.inf
LcdHwLib|ArmPlatformPkg/Library/HdLcd/HdLcd.inf
!endif

[LibraryClasses.common.SEC]
PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
Expand Down Expand Up @@ -100,7 +105,15 @@

# System Memory (2GB - 16MB of Trusted DRAM at the top of the 32bit address space)
gArmTokenSpaceGuid.PcdSystemMemoryBase|0x80000000

!ifdef HEADLESS_PLATFORM
gArmTokenSpaceGuid.PcdSystemMemorySize|0x7F000000
!else
# Default framebuffer size is 0x7E9000, reduce system memory size for framebuffer.
gArmTokenSpaceGuid.PcdSystemMemorySize|0x7E817000
gArmPlatformTokenSpaceGuid.PcdArmLcdDdrFrameBufferBase|0xFE817000
gArmPlatformTokenSpaceGuid.PcdArmHdLcdSwapBlueRedSelect|TRUE
!endif

# Juno Dual-Cluster profile
gArmPlatformTokenSpaceGuid.PcdCoreCount|6
Expand Down Expand Up @@ -142,6 +155,11 @@
gArmTokenSpaceGuid.PcdGicDistributorBase|0x2C010000
gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x2C02F000

!ifndef HEADLESS_PLATFORM
# ARM Juno HDLCD Base
gArmPlatformTokenSpaceGuid.PcdArmHdLcdBase|0x7FF60000
!endif

#
# PLDA PCI Root Complex
#
Expand Down Expand Up @@ -315,6 +333,11 @@
MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceDxe.inf
!ifndef HEADLESS_PLATFORM
# Graphic Output Protocol
ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.inf
!endif
#
# Juno platform driver
#
Expand Down Expand Up @@ -348,6 +371,9 @@
BdsLib|Platform/ARM/Library/BdsLib/BdsLib.inf
}
# SCMI Driver
ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf
[Components.AARCH64]
#
# EBC
Expand Down
12 changes: 11 additions & 1 deletion Platform/ARM/JunoPkg/ArmJuno.fdf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2013-2015, ARM Limited. All rights reserved.
# Copyright (c) 2013-2018, ARM Limited. All rights reserved.
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
Expand Down Expand Up @@ -163,6 +163,13 @@ FvNameGuid = B73FE497-B92E-416e-8326-45AD0D270092
INF MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
INF MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceDxe.inf

!ifndef HEADLESS_PLATFORM
#
# Graphics Output Protocol
#
INF ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.inf
!endif

#
# PCI Support
#
Expand Down Expand Up @@ -223,6 +230,9 @@ FvNameGuid = B73FE497-B92E-416e-8326-45AD0D270092
# after the device drivers (eg: Ethernet) to ensure we have support for them.
INF Platform/ARM/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf

# SCMI Driver
INF ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf

!if $(ARCH) == AARCH64
#
# EBC
Expand Down
5 changes: 4 additions & 1 deletion Platform/ARM/JunoPkg/Library/ArmJunoLib/ArmJunoLib.inf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2013-2016, ARM Limited. All rights reserved.
# Copyright (c) 2013-2018, ARM Limited. All rights reserved.
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
Expand Down Expand Up @@ -54,6 +54,9 @@
gArmJunoTokenSpaceGuid.PcdPciConfigurationSpaceBaseAddress
gArmJunoTokenSpaceGuid.PcdPciConfigurationSpaceSize

# Framebuffer Memory
gArmPlatformTokenSpaceGuid.PcdArmLcdDdrFrameBufferBase
gArmPlatformTokenSpaceGuid.PcdArmLcdDdrFrameBufferSize

#
# PL011 Serial Debug UART
Expand Down
21 changes: 20 additions & 1 deletion Platform/ARM/JunoPkg/Library/ArmJunoLib/ArmJunoMem.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@

#include <ArmPlatform.h>

#define FRAME_BUFFER_DESCRIPTOR ((FixedPcdGet32 (PcdArmLcdDdrFrameBufferBase) != 0) ? 1 : 0)

// The total number of descriptors, including the final "end-of-table" descriptor.
#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 16
#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS (16 + FRAME_BUFFER_DESCRIPTOR)

// DDR attributes
#define DDR_ATTRIBUTES_CACHED ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK
Expand Down Expand Up @@ -149,6 +151,23 @@ ArmPlatformGetVirtualMemoryMap (
VirtualMemoryTable[Index].Length = ARM_JUNO_SOC_PERIPHERALS_SZ;
VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;

// Framebuffer Memory
if (FixedPcdGet32 (PcdArmLcdDdrFrameBufferBase) != 0) {
ASSERT ((PcdGet64 (PcdSystemMemoryBase) +
PcdGet64 (PcdSystemMemorySize) - 1) <
FixedPcdGet64 (PcdArmLcdDdrFrameBufferBase));
VirtualMemoryTable[++Index].PhysicalBase = FixedPcdGet64 (PcdArmLcdDdrFrameBufferBase);
VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdArmLcdDdrFrameBufferBase);
VirtualMemoryTable[Index].Length = FixedPcdGet32 (PcdArmLcdDdrFrameBufferSize);
// Map as Normal Non-Cacheable memory, so that we can use the accelerated
// SetMem/CopyMem routines that may use unaligned accesses or
// DC ZVA instructions. If mapped as device memory, these routine may cause
// alignment faults.
// NOTE: The attribute value is misleading, it indicates memory map type as
// an un-cached, un-buffered but allows buffering and reordering.
VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED;
}

// DDR - 2GB
VirtualMemoryTable[++Index].PhysicalBase = PcdGet64 (PcdSystemMemoryBase);
VirtualMemoryTable[Index].VirtualBase = PcdGet64 (PcdSystemMemoryBase);
Expand Down
Loading

0 comments on commit b581a49

Please sign in to comment.