From owner-svn-src-head@freebsd.org Sat Jun 3 15:56:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4598CBF4829; Sat, 3 Jun 2017 15:56:56 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19A1C753B7; Sat, 3 Jun 2017 15:56:56 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v53FutI0096752; Sat, 3 Jun 2017 15:56:55 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v53FutIR096751; Sat, 3 Jun 2017 15:56:55 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201706031556.v53FutIR096751@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sat, 3 Jun 2017 15:56:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r319538 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jun 2017 15:56:56 -0000 Author: andrew Date: Sat Jun 3 15:56:54 2017 New Revision: 319538 URL: https://svnweb.freebsd.org/changeset/base/319538 Log: Add MULTIDELAY support to the mpcore timer driver. This is needed when using this with GENERIC. While here remove the weak symbol, it doesn't seem to be needed anymore. Modified: head/sys/arm/arm/mpcore_timer.c Modified: head/sys/arm/arm/mpcore_timer.c ============================================================================== --- head/sys/arm/arm/mpcore_timer.c Sat Jun 3 15:48:03 2017 (r319537) +++ head/sys/arm/arm/mpcore_timer.c Sat Jun 3 15:56:54 2017 (r319538) @@ -59,6 +59,10 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef MULTIDELAY +#include /* For arm_set_delay */ +#endif + #include #include #include @@ -115,6 +119,8 @@ static boolean_t arm_tmr_freq_varies; #define tmr_gbl_read_4(sc, reg) bus_read_4((sc)->gbl_mem, reg) #define tmr_gbl_write_4(sc, reg, val) bus_write_4((sc)->gbl_mem, reg, val) +static void arm_tmr_delay(int, void *); + static timecounter_get_t arm_tmr_get_timecount; static struct timecounter arm_tmr_timecount = { @@ -431,6 +437,11 @@ arm_tmr_attach(device_t dev) if (tc_err != 0 && et_err != 0) { return (ENXIO); } + +#ifdef MULTIDELAY + arm_set_delay(arm_tmr_delay, sc); +#endif + return (0); } @@ -482,37 +493,14 @@ arm_tmr_change_frequency(uint64_t newfreq) et_change_frequency(arm_tmr_et, newfreq); } -/** - * DELAY - Delay for at least usec microseconds. - * @usec: number of microseconds to delay by - * - * This function is called all over the kernel and is suppose to provide a - * consistent delay. This function may also be called before the console - * is setup so no printf's can be called here. - * - * RETURNS: - * nothing - */ -static void __used /* Must emit function code for the weak ref below. */ -arm_tmr_DELAY(int usec) +static void +arm_tmr_delay(int usec, void *arg) { - struct arm_tmr_softc *sc; + struct arm_tmr_softc *sc = arg; int32_t counts_per_usec; int32_t counts; uint32_t first, last; - /* Check the timers are setup, if not just use a for loop for the meantime */ - if (arm_tmr_tc == NULL || arm_tmr_timecount.tc_frequency == 0) { - for (; usec > 0; usec--) - for (counts = 200; counts > 0; counts--) - cpufunc_nullop(); /* Prevent gcc from optimizing - * out the loop - */ - return; - } - - sc = arm_tmr_tc->tc_priv; - /* Get the number of times to count */ counts_per_usec = ((arm_tmr_timecount.tc_frequency / 1000000) + 1); @@ -536,10 +524,34 @@ arm_tmr_DELAY(int usec) } } -/* - * Supply a DELAY() implementation via weak linkage. A platform may want to use - * the mpcore per-cpu eventtimers but provide its own DELAY() routine, - * especially when the core frequency can change on the fly. +#ifndef MULTIDELAY +/** + * DELAY - Delay for at least usec microseconds. + * @usec: number of microseconds to delay by + * + * This function is called all over the kernel and is suppose to provide a + * consistent delay. This function may also be called before the console + * is setup so no printf's can be called here. + * + * RETURNS: + * nothing */ -__weak_reference(arm_tmr_DELAY, DELAY); +void +DELAY(int usec) +{ + struct arm_tmr_softc *sc; + int32_t counts; + /* Check the timers are setup, if not just use a for loop for the meantime */ + if (arm_tmr_tc == NULL || arm_tmr_timecount.tc_frequency == 0) { + for (; usec > 0; usec--) + for (counts = 200; counts > 0; counts--) + cpufunc_nullop(); /* Prevent gcc from optimizing + * out the loop + */ + } else { + sc = arm_tmr_tc->tc_priv; + arm_tmr_delay(usec, sc); + } +} +#endif