From nobody Thu Jun 23 18:16:07 2022 X-Original-To: dev-commits-src-all@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 8CAD68769AF; Thu, 23 Jun 2022 18:16:08 +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 4LTT2w1m43z3PQ3; Thu, 23 Jun 2022 18:16:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656008168; 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=gySXIEehH09GHun2bDJAcTUYiWToSFqu2qWi8Tm2SdQ=; b=COhOuG2XBWPbPKRYkHzoI227O4ykHRGRac6KeUJK9mTx4okrN70KJO6+TuGnVutKiw0mUT VMtFKKRAwNH/2K30Dr2ElJ04C5JWvtVyqDG4FqKUxN7Zwvj+WpteBml3PnXL2+tf/d4KQy 0owkhyOPNDoKbSTMwM6JhCkaTUi/t2fB/6EONOb4b9IJb1DVy4BS7p04okrjA7RKpTEjKg Js0Krkrzq/aBYIxo5bJMRVmkpqzUn6ikk4hG38pXaRxvYvAaxLhONAvju6XGiBexMstuoX DmFdXnivDHf9L/V3lR2gbYPdAOBcaxeg2eYDaTbhr46HrHoHRecvTSbTDVSaQw== 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 0A7F420167; Thu, 23 Jun 2022 18:16:08 +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 25NIG7dL014927; Thu, 23 Jun 2022 18:16:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25NIG7ku014926; Thu, 23 Jun 2022 18:16:07 GMT (envelope-from git) Date: Thu, 23 Jun 2022 18:16:07 GMT Message-Id: <202206231816.25NIG7ku014926@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 715276a08b08 - main - riscv timer: cleanup List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: 715276a08b08c1f30ee3313758a936a417939ef4 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656008168; 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=gySXIEehH09GHun2bDJAcTUYiWToSFqu2qWi8Tm2SdQ=; b=biJb+7bt6JpBCfx11PJX4gVdZDwLYKqN6DwObPjeAx4HR+KsudB1sehEI1rZyM3IjtzL6M YymVWlkVJKa8FYlvIS4CHmCWOn/9eMIEuwTxfkXmTwU5Mc6TeCqIHdElznMr6SI62lTSJh 4p04CIFlKW838Vm35WWY0ZfZLchn4KQ5L1LeGDADRhGtr8uRKM4OjX49B05R7I8MJWpu22 UrylRxVt3/YUdtu8gC7disefPl7G0hea244u1fPbTMHRcqvKGZNF5LRE5uMLnnKpqVjL1M Ew3no9odDi+j0r7OiQxIycrscfkhlL1mCcDCOTbUBvxPSzZVvF16/+Q/KbFnLA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656008168; a=rsa-sha256; cv=none; b=OWkHSJL5N2tFubzcX979l+qQ4w+lDumfdTl3/Y6+KRfkfmdA7GquKkk3m+1km/muQ607aO 4Ngbeb/aoadIDpH7LXFbYs4h/5kdYXA3Am8fPuWUezD5yZLmtrp0dZKipJ7Jzz6AX8d8EA 1kpHa6Io/pr3ZMbXnvD7Om6U8QLXgDnfHn2t16XO6BtIPEgkW16xn3aB+mN1mkPcreCb9i Y3LPRivSOy/CLZDzXICM0Y4iZ7ZG0l0aHW/aOyeJytWuh4rwLfM2ml69s2P8DBkZZUyYjf w/4Kmp1jaGxQ5fwyNN7YVBkNBpiPOnCTSLGdI7fQWt1psDIqA3Q3ncKS1pvbbw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=715276a08b08c1f30ee3313758a936a417939ef4 commit 715276a08b08c1f30ee3313758a936a417939ef4 Author: Mitchell Horne AuthorDate: 2022-06-21 16:22:40 +0000 Commit: Mitchell Horne CommitDate: 2022-06-23 18:15:11 +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 --- 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 850dc83594ca..5cdfe9cceb41 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) { /* TODO */ @@ -204,7 +195,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) @@ -236,8 +227,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); @@ -304,12 +295,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); -}