From nobody Mon Jul 4 16:40:10 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D0DE018941E6; Mon, 4 Jul 2022 16:40:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LcBP64xnKz4SLc; Mon, 4 Jul 2022 16:40:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656952810; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8sREuyHSlz+wh47pbaWLeMuJfhmbOF2ADvxxYxwXDfQ=; b=ubdONrk+UtMqUnvL0qMWLgGft0ISEzMXiBhqCa5YCZwVjhXwwzRI9LmVSTviWCD9FFM83p ThIKEaiGMrOn/On+FHoYYBI7y5jJiUhy8KzHnitLpYH+9u4+va71aumZ/xXflDW+dD2mJm yl3UnnaxtB+GGoycnCNVlgxH5Y+ie6tQLnFwfrlCfNBdv0TxNekoaV+D7Ct5zUkJbkxpyX iEp46I5gOpoilj78WOOQGh+XtKQaghzbwYLIBjd5mOqA0bqAaBHZ9aTroae/Ag7ELtJRUj rUURIRPgTSf32BS3klf4pJPwTRsFh2V0w19ckA/4TbPnlKooXiv+f1eMRDHNaQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 54EED14B24; Mon, 4 Jul 2022 16:40:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 264GeAF9044379; Mon, 4 Jul 2022 16:40:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 264GeAKS044376; Mon, 4 Jul 2022 16:40:10 GMT (envelope-from git) Date: Mon, 4 Jul 2022 16:40:10 GMT Message-Id: <202207041640.264GeAKS044376@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: b6e6c534a893 - stable/13 - riscv timer: cleanup List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b6e6c534a8932387e2cc597fe1f481edb0da3dbb Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656952810; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8sREuyHSlz+wh47pbaWLeMuJfhmbOF2ADvxxYxwXDfQ=; b=kIHEEwRxVEm4kykcvK61Y2IDSyPuZSOUH11+85zlmuoXUkKplL/GYJYTbm5sSBanOsPdsI iV7VNJXcE0lwa70EO2WO1VbVQ4o0GenelhuULGPOl1+IA1NSlQnA3mqBy8kfCNd90ZCtVU TftfH+KGe/R/gbC6yZxKw4kv4tQXfelN3gvllWxw8kYg3G9sMU0mdkxV7cVJv8zEMloHPe HhIbqfo8t39fERVKkUr5+wiFZeLLd85omj3QTZdnjEyywYtIJmkWsjpNFSKDqzv3dozhsh /kgXb9+D/cRNbvDaYKqUL+XN+I5aRukPVC/u3GwPv0ciQ9dX2pDF7n71ptPfmQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656952810; a=rsa-sha256; cv=none; b=GoKTSmRmEFCv9TbdGTdbD/t6nkFG3xUs++fUJTIy3whiUpBu6rDB8CX6Ds5uvPP4d/2HmM QmsdQqKReoN0nENhSMXmg7cJTCiabusHUGqnLgONQnmqN7kvTt3HpVFk/tPsDZX6q98aNJ L3vM+jX6ZdVyRfQcQmsUhLK5rPBOi5gBu0+cO5naPWz545vk9FftOVthbwCe6YYzEbMrE6 y+/FuMnyXkuZgSWMBeuxW3iflpP9/AmUoLvhrIBHWckjA37964/D67NeMK3HsnBhi23Foe vJy4UUD+vGqywtLHIUCFKvMtSgNbKvHSF2MU1RcVJAWlho0SDcFUK5ZKycwVaw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=b6e6c534a8932387e2cc597fe1f481edb0da3dbb commit b6e6c534a8932387e2cc597fe1f481edb0da3dbb Author: Mitchell Horne AuthorDate: 2022-06-21 16:22:40 +0000 Commit: Mitchell Horne CommitDate: 2022-07-04 16:37:05 +0000 riscv timer: cleanup - Prune unused definitions and includes - Slight renaming of callback functions to indicate their usage - Place vdso_fill_timehands callback logically in the file - Small style nits MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35460 (cherry picked from commit 715276a08b08c1f30ee3313758a936a417939ef4) --- sys/riscv/riscv/timer.c | 58 +++++++++++++++++-------------------------------- 1 file changed, 20 insertions(+), 38 deletions(-) diff --git a/sys/riscv/riscv/timer.c b/sys/riscv/riscv/timer.c index 34bc7590e397..c852d3dbe0f1 100644 --- a/sys/riscv/riscv/timer.c +++ b/sys/riscv/riscv/timer.c @@ -46,52 +46,35 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include #include #include #include -#include - -#include -#include #include #include -#include -#include #include -#include -#include -#include #include -#define TIMER_COUNTS 0x00 -#define TIMER_MTIMECMP(cpu) (cpu * 8) - struct riscv_timer_softc { void *ih; uint32_t clkfreq; struct eventtimer et; }; - static struct riscv_timer_softc *riscv_timer_sc = NULL; -static uint32_t riscv_timer_fill_vdso_timehands(struct vdso_timehands *vdso_th, - struct timecounter *tc); - -static timecounter_get_t riscv_timer_get_timecount; +static timecounter_get_t riscv_timer_tc_get_timecount; +static timecounter_fill_vdso_timehands_t riscv_timer_tc_fill_vdso_timehands; static struct timecounter riscv_timer_timecount = { .tc_name = "RISC-V Timecounter", - .tc_get_timecount = riscv_timer_get_timecount, + .tc_get_timecount = riscv_timer_tc_get_timecount, .tc_poll_pps = NULL, .tc_counter_mask = ~0u, .tc_frequency = 0, .tc_quality = 1000, - .tc_fill_vdso_timehands = riscv_timer_fill_vdso_timehands, + .tc_fill_vdso_timehands = riscv_timer_tc_fill_vdso_timehands, }; static inline uint64_t @@ -111,8 +94,8 @@ get_counts(struct riscv_timer_softc *sc) return (counts); } -static unsigned -riscv_timer_get_timecount(struct timecounter *tc) +static u_int +riscv_timer_tc_get_timecount(struct timecounter *tc) { struct riscv_timer_softc *sc; @@ -121,8 +104,17 @@ riscv_timer_get_timecount(struct timecounter *tc) return (get_counts(sc)); } +static uint32_t +riscv_timer_tc_fill_vdso_timehands(struct vdso_timehands *vdso_th, + struct timecounter *tc) +{ + vdso_th->th_algo = VDSO_TH_ALGO_RISCV_RDTIME; + bzero(vdso_th->th_res, sizeof(vdso_th->th_res)); + return (1); +} + static int -riscv_timer_start(struct eventtimer *et, sbintime_t first, sbintime_t period) +riscv_timer_et_start(struct eventtimer *et, sbintime_t first, sbintime_t period) { uint64_t counts; @@ -135,11 +127,10 @@ riscv_timer_start(struct eventtimer *et, sbintime_t first, sbintime_t period) } return (EINVAL); - } static int -riscv_timer_stop(struct eventtimer *et) +riscv_timer_et_stop(struct eventtimer *et) { /* Disable timer interrupts. */ @@ -205,7 +196,7 @@ riscv_timer_attach(device_t dev) int error; sc = device_get_softc(dev); - if (riscv_timer_sc) + if (riscv_timer_sc != NULL) return (ENXIO); if (device_get_unit(dev) != 0) @@ -237,8 +228,8 @@ riscv_timer_attach(device_t dev) sc->et.et_frequency = sc->clkfreq; sc->et.et_min_period = (0x00000002LLU << 32) / sc->et.et_frequency; sc->et.et_max_period = (0xfffffffeLLU << 32) / sc->et.et_frequency; - sc->et.et_start = riscv_timer_start; - sc->et.et_stop = riscv_timer_stop; + sc->et.et_start = riscv_timer_et_start; + sc->et.et_stop = riscv_timer_et_stop; sc->et.et_priv = sc; et_register(&sc->et); @@ -309,12 +300,3 @@ DELAY(int usec) } TSEXIT(); } - -static uint32_t -riscv_timer_fill_vdso_timehands(struct vdso_timehands *vdso_th, - struct timecounter *tc) -{ - vdso_th->th_algo = VDSO_TH_ALGO_RISCV_RDTIME; - bzero(vdso_th->th_res, sizeof(vdso_th->th_res)); - return (1); -}