From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web11.1470.1574390803221112220 for ; Thu, 21 Nov 2019 18:46:43 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=0229d066a2=abner.chang@hpe.com) Received: from pps.filterd (m0150241.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xAM2kehO014865; Fri, 22 Nov 2019 02:46:42 GMT Received: from g2t2352.austin.hpe.com (g2t2352.austin.hpe.com [15.233.44.25]) by mx0a-002e3701.pphosted.com with ESMTP id 2we351hd1t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 22 Nov 2019 02:46:42 +0000 Received: from g2t2360.austin.hpecorp.net (g2t2360.austin.hpecorp.net [16.196.225.135]) by g2t2352.austin.hpe.com (Postfix) with ESMTP id 5820EB2; Fri, 22 Nov 2019 02:46:38 +0000 (UTC) Received: from UB16Abner.asiapacific.hpqcorp.net (ub16abner.asiapacific.hpqcorp.net [15.119.209.229]) by g2t2360.austin.hpecorp.net (Postfix) with ESMTP id 2DEE036; Fri, 22 Nov 2019 02:46:35 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: abner.chang@hpe.com, Michael D Kinney , Ard Biesheuvel , Leif Lindholm , Gilbert Chen Subject: [Platform/devel-riscv-v2 PATCHv5-3] SiFive/U5SeriesPkg: Add PCD of system clock for U5 series platforms Date: Fri, 22 Nov 2019 10:13:50 +0800 Message-Id: <1574388830-1875-1-git-send-email-abner.chang@hpe.com> X-Mailer: git-send-email 2.7.4 X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-21_07:2019-11-21,2019-11-21 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 clxscore=1015 mlxlogscore=999 priorityscore=1501 malwarescore=0 suspectscore=13 impostorscore=0 phishscore=0 adultscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1911220024 Create PCD for SiFive U5 series platforms clock setting. Signed-off-by: Abner Chang Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Gilbert Chen --- Platform/SiFive/U5SeriesPkg/U5SeriesPkg.dec | 7 ++++--- .../SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.fdf.inc | 11 ++++++----- .../FreedomU540HiFiveUnleashedBoard/U540.fdf.inc | 13 +++++++------ .../Library/OpensbiPlatformLib/OpensbiPlatformLib.inf | 1 + .../Library/OpensbiPlatformLib/OpensbiPlatformLib.inf | 1 + .../SiFive/U5SeriesPkg/Library/SerialIoLib/SerialIoLib.inf | 1 + .../Library/OpensbiPlatformLib/Platform.c | 2 +- .../Library/OpensbiPlatformLib/Platform.c | 2 +- .../SiFive/U5SeriesPkg/Library/SerialIoLib/SerialPortLib.c | 2 +- 9 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Platform/SiFive/U5SeriesPkg/U5SeriesPkg.dec b/Platform/SiFive/U5SeriesPkg/U5SeriesPkg.dec index a01135b..7f9de20 100644 --- a/Platform/SiFive/U5SeriesPkg/U5SeriesPkg.dec +++ b/Platform/SiFive/U5SeriesPkg/U5SeriesPkg.dec @@ -23,9 +23,10 @@ gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid = {0x725B804B, 0x10B5, 0x4326, { 0xAD, 0xFF, 0x59, 0xCE, 0x6E, 0xFD, 0x5B, 0x36 }} [PcdsFixedAtBuild] - gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdNumberofU5Cores|0x8|UINT32|0x00001000 - gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdE5MCSupported|TRUE|BOOLEAN|0x00001001 - gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5UartBase|0x0|UINT32|0x00001002 + gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5PlatformSystemClock|0x0|UINT32|0x00001000 + gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdNumberofU5Cores|0x8|UINT32|0x00001001 + gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdE5MCSupported|TRUE|BOOLEAN|0x00001002 + gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5UartBase|0x0|UINT32|0x00001003 [PcdsPatchableInModule] diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.fdf.inc b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.fdf.inc index 936ff22..effff62 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.fdf.inc +++ b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.fdf.inc @@ -46,10 +46,11 @@ SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdTemporaryRamBase = $(CODE_BASE_ADDRES SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdTemporaryRamSize = 0x10000 -SET gUefiRiscVPkgTokenSpaceGuid.PcdRiscVMachineTimerFrequencyInHerz = 1000000 -SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdHartCount = 4 # Total cores on U500 platform -SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdNumberofU5Cores = 4 # Total U5 cores enabled on U500 platform -SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdE5MCSupported = False # Enable optional E51 MC core? -SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdBootHartId = 0 # Boot hart ID +SET gUefiRiscVPkgTokenSpaceGuid.PcdRiscVMachineTimerFrequencyInHerz = 1000000 +SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5PlatformSystemClock = 100000000 # 100Mhz system clock +SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdHartCount = 4 # Total cores on U500 platform +SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdNumberofU5Cores = 4 # Total U5 cores enabled on U500 platform +SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdE5MCSupported = False # Enable optional E51 MC core? +SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdBootHartId = 0 # Boot hart ID SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5UartBase = 0x54000000 diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf.inc b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf.inc index 00a2315..3e8d833 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf.inc +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.fdf.inc @@ -46,9 +46,10 @@ SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdTemporaryRamBase = $(CODE_BASE_ADDRES SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdTemporaryRamSize = 0x10000 -SET gUefiRiscVPkgTokenSpaceGuid.PcdRiscVMachineTimerFrequencyInHerz = 1000000 -SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdHartCount = 5 # Total cores on U540 platform -SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdBootHartId = 1 # Boot hart ID -SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdNumberofU5Cores = 4 # Total U5 cores enabled on U540 platform -SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdE5MCSupported = True # E51 MC exists. -SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5UartBase = 0x10010000 # Serial port base address +SET gUefiRiscVPkgTokenSpaceGuid.PcdRiscVMachineTimerFrequencyInHerz = 1000000 +SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5PlatformSystemClock = 1000000000 # 1GHz system clock +SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdHartCount = 5 # Total cores on U540 platform +SET gUefiRiscVPlatformPkgTokenSpaceGuid.PcdBootHartId = 1 # Boot hart ID +SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdNumberofU5Cores = 4 # Total U5 cores enabled on U540 platform +SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdE5MCSupported = True # E51 MC exists. +SET gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5UartBase = 0x10010000 # Serial port base address diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf index 60aec6d..e1b4627 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf +++ b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf @@ -50,3 +50,4 @@ gUefiRiscVPlatformPkgTokenSpaceGuid.PcdOpenSbiStackSize gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5UartBase + gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5PlatformSystemClock diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf index 21710d4..0fdc558 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf @@ -50,3 +50,4 @@ gUefiRiscVPlatformPkgTokenSpaceGuid.PcdOpenSbiStackSize gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5UartBase + gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5PlatformSystemClock diff --git a/Platform/SiFive/U5SeriesPkg/Library/SerialIoLib/SerialIoLib.inf b/Platform/SiFive/U5SeriesPkg/Library/SerialIoLib/SerialIoLib.inf index 0044f84..941e309 100644 --- a/Platform/SiFive/U5SeriesPkg/Library/SerialIoLib/SerialIoLib.inf +++ b/Platform/SiFive/U5SeriesPkg/Library/SerialIoLib/SerialIoLib.inf @@ -33,6 +33,7 @@ [FixedPcd] gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5UartBase + gSiFiveU5SeriesPlatformsPkgTokenSpaceGuid.PcdU5PlatformSystemClock [Sources] SerialPortLib.c diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Library/OpensbiPlatformLib/Platform.c b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Library/OpensbiPlatformLib/Platform.c index bcdb643..1577b01 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Library/OpensbiPlatformLib/Platform.c +++ b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/Library/OpensbiPlatformLib/Platform.c @@ -27,7 +27,7 @@ #define U500_HART_STACK_SIZE FixedPcdGet32(PcdOpenSbiStackSize) #define U500_BOOT_HART_ID FixedPcdGet32(PcdBootHartId) -#define U500_SYS_CLK 100000000 +#define U500_SYS_CLK FixedPcdGet32(PcdU5PlatformSystemClock) #define U500_PLIC_ADDR 0xc000000 #define U500_PLIC_NUM_SOURCES 0x35 diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/Platform.c b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/Platform.c index b9deec6..3b36379 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/Platform.c +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/OpensbiPlatformLib/Platform.c @@ -27,7 +27,7 @@ #define U540_HART_STACK_SIZE FixedPcdGet32(PcdOpenSbiStackSize) #define U540_BOOT_HART_ID FixedPcdGet32(PcdBootHartId) -#define U540_SYS_CLK 100000000 +#define U540_SYS_CLK FixedPcdGet32(PcdU5PlatformSystemClock) #define U540_PLIC_ADDR 0xc000000 #define U540_PLIC_NUM_SOURCES 0x35 diff --git a/Platform/SiFive/U5SeriesPkg/Library/SerialIoLib/SerialPortLib.c b/Platform/SiFive/U5SeriesPkg/Library/SerialIoLib/SerialPortLib.c index 5e06515..504db0f 100644 --- a/Platform/SiFive/U5SeriesPkg/Library/SerialIoLib/SerialPortLib.c +++ b/Platform/SiFive/U5SeriesPkg/Library/SerialIoLib/SerialPortLib.c @@ -24,7 +24,7 @@ //--------------------------------------------- #define UART_BAUDRATE 115200 -#define SYS_CLK 100000000 +#define SYS_CLK FixedPcdGet32(PcdU5PlatformSystemClock) BOOLEAN Initiated = FALSE; -- 2.7.4