<p>Julius Werner has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/27947">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">arm64: Remove set_cntfrq() function<br><br>CNTFRQ_EL0 is a normal AArch64 architectural register like hundreds of<br>others that are all accessed through the raw_(read|write)_${register}()<br>family of functions. There's no reason why this register in particular<br>should have an inconsistent accessor, so replace all instances of<br>set_cntfrq() with raw_write_cntfrq_el0() and get rid of it.<br><br>Change-Id: I599519ba71c287d4085f9ad28d7349ef0b1eea9b<br>Signed-off-by: Julius Werner <jwerner@chromium.org><br>---<br>M src/arch/arm64/armv8/lib/Makefile.inc<br>D src/arch/arm64/armv8/lib/clock.c<br>D src/arch/arm64/include/arch/clock.h<br>M src/soc/cavium/cn81xx/timer.c<br>M src/soc/nvidia/tegra210/ramstage.c<br>5 files changed, 5 insertions(+), 55 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/47/27947/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/arch/arm64/armv8/lib/Makefile.inc b/src/arch/arm64/armv8/lib/Makefile.inc</span><br><span>index bfc87c3..8fc44de 100644</span><br><span>--- a/src/arch/arm64/armv8/lib/Makefile.inc</span><br><span>+++ b/src/arch/arm64/armv8/lib/Makefile.inc</span><br><span>@@ -15,7 +15,7 @@</span><br><span> ##</span><br><span> ################################################################################</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-lib_access = pstate.c sysctrl.c cache.c tlb.c clock.c</span><br><span style="color: hsl(120, 100%, 40%);">+lib_access = pstate.c sysctrl.c cache.c tlb.c</span><br><span> </span><br><span> ifeq ($(CONFIG_ARCH_BOOTBLOCK_ARMV8_64),y)</span><br><span> decompressor-y += $(lib_access)</span><br><span>diff --git a/src/arch/arm64/armv8/lib/clock.c b/src/arch/arm64/armv8/lib/clock.c</span><br><span>deleted file mode 100644</span><br><span>index f15adf4..0000000</span><br><span>--- a/src/arch/arm64/armv8/lib/clock.c</span><br><span>+++ /dev/null</span><br><span>@@ -1,27 +0,0 @@</span><br><span style="color: hsl(0, 100%, 40%);">-/*</span><br><span style="color: hsl(0, 100%, 40%);">- * This file is part of the coreboot project.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * Copyright (C) 2014 Google Inc</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * This program is free software; you can redistribute it and/or</span><br><span style="color: hsl(0, 100%, 40%);">- * modify it under the terms of the GNU General Public License as</span><br><span style="color: hsl(0, 100%, 40%);">- * published by the Free Software Foundation; version 2 of</span><br><span style="color: hsl(0, 100%, 40%);">- * the License.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(0, 100%, 40%);">- * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(0, 100%, 40%);">- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(0, 100%, 40%);">- * GNU General Public License for more details.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * clock.c: Functions for accessing clock and timer related registers</span><br><span style="color: hsl(0, 100%, 40%);">- * Reference: ARM Architecture Reference Manual, ARMv8-A edition</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#include <stdint.h></span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#include <arch/clock.h></span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-void set_cntfrq(uint32_t freq)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">-   __asm__ __volatile__("msr cntfrq_el0, %0" :: "r"((uint64_t)freq));</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span>diff --git a/src/arch/arm64/include/arch/clock.h b/src/arch/arm64/include/arch/clock.h</span><br><span>deleted file mode 100644</span><br><span>index 77d09d8..0000000</span><br><span>--- a/src/arch/arm64/include/arch/clock.h</span><br><span>+++ /dev/null</span><br><span>@@ -1,23 +0,0 @@</span><br><span style="color: hsl(0, 100%, 40%);">-/*</span><br><span style="color: hsl(0, 100%, 40%);">- * This file is part of the coreboot project.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * Copyright 2014 Google Inc.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * This program is free software; you can redistribute it and/or modify</span><br><span style="color: hsl(0, 100%, 40%);">- * it under the terms of the GNU General Public License as published by</span><br><span style="color: hsl(0, 100%, 40%);">- * the Free Software Foundation; version 2 of the License.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(0, 100%, 40%);">- * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(0, 100%, 40%);">- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(0, 100%, 40%);">- * GNU General Public License for more details.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#ifndef __ARM_CLOCK_H_</span><br><span style="color: hsl(0, 100%, 40%);">-#define __ARM_CLOCK_H_</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#include <types.h></span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-void set_cntfrq(uint32_t);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#endif /* __ARM_CLOCK_H_ */</span><br><span>diff --git a/src/soc/cavium/cn81xx/timer.c b/src/soc/cavium/cn81xx/timer.c</span><br><span>index b1c2285..f2a870a 100644</span><br><span>--- a/src/soc/cavium/cn81xx/timer.c</span><br><span>+++ b/src/soc/cavium/cn81xx/timer.c</span><br><span>@@ -17,6 +17,7 @@</span><br><span>  */</span><br><span> </span><br><span> #include <arch/io.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <arch/lib_helpers.h></span><br><span> #include <console/console.h></span><br><span> #include <inttypes.h></span><br><span> #include <soc/clock.h></span><br><span>@@ -25,7 +26,6 @@</span><br><span> #include <timer.h></span><br><span> #include <soc/addressmap.h></span><br><span> #include <assert.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <arch/clock.h></span><br><span> </span><br><span> /* Global System Timers Unit (GTI) registers */</span><br><span> struct cn81xx_timer {</span><br><span>@@ -131,7 +131,7 @@</span><br><span> </span><br><span> void soc_timer_init(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">-  set_cntfrq(tickrate);</span><br><span style="color: hsl(120, 100%, 40%);">+ raw_write_cntfrq_el0(tickrate);</span><br><span> }</span><br><span> </span><br><span> /**</span><br><span>diff --git a/src/soc/nvidia/tegra210/ramstage.c b/src/soc/nvidia/tegra210/ramstage.c</span><br><span>index 18fdded..86fae67 100644</span><br><span>--- a/src/soc/nvidia/tegra210/ramstage.c</span><br><span>+++ b/src/soc/nvidia/tegra210/ramstage.c</span><br><span>@@ -13,8 +13,8 @@</span><br><span>  * GNU General Public License for more details.</span><br><span>  */</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#include <arch/clock.h></span><br><span> #include <arch/cpu.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <arch/lib_helpers.h></span><br><span> #include <arch/stages.h></span><br><span> #include <gic.h></span><br><span> #include <soc/addressmap.h></span><br><span>@@ -26,7 +26,7 @@</span><br><span> {</span><br><span>    uint32_t freq = clock_get_osc_khz() * 1000;</span><br><span>  // Set the cntfrq register.</span><br><span style="color: hsl(0, 100%, 40%);">-     set_cntfrq(freq);</span><br><span style="color: hsl(120, 100%, 40%);">+     raw_write_cntfrq_el0(freq);</span><br><span> }</span><br><span> </span><br><span> static void mselect_enable_wrap(void)</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/27947">change 27947</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/27947"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I599519ba71c287d4085f9ad28d7349ef0b1eea9b </div>
<div style="display:none"> Gerrit-Change-Number: 27947 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Julius Werner <jwerner@chromium.org> </div>