From owner-freebsd-drivers@FreeBSD.ORG Fri Sep 23 15:38:40 2011 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59EE4106564A; Fri, 23 Sep 2011 15:38:40 +0000 (UTC) (envelope-from gavin.atkinson@ury.york.ac.uk) Received: from ixe-mta-27.emailfiltering.com (ixe-mta-27-tx.emailfiltering.com [194.116.199.158]) by mx1.freebsd.org (Postfix) with ESMTP id 881F38FC12; Fri, 23 Sep 2011 15:38:39 +0000 (UTC) Received: from mail-gw14.york.ac.uk ([144.32.129.164]) by ixe-mta-27.emailfiltering.com with emfmta (version 4.8.3.54) by TLS id 1295691174 for hselasky@c2i.net; 3a0a1a60edd1a086; Fri, 23 Sep 2011 16:21:08 +0100 Received: from buffy-128.york.ac.uk ([144.32.128.160]:24806) by mail-gw14.york.ac.uk with esmtpsa (SSL3.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1R77Yo-0005mq-VN; Fri, 23 Sep 2011 16:21:06 +0100 X-Authenticated-User: ga9 From: Gavin Atkinson To: Hans Petter Selasky In-Reply-To: <201109222007.19182.hselasky@c2i.net> References: <75E1A2A7D185F841A975979B0906BBA67BCCAB7609@AVEXMB1.qlogic.org> <201109222007.19182.hselasky@c2i.net> Content-Type: text/plain; charset="ASCII" Date: Fri, 23 Sep 2011 16:21:06 +0100 Message-ID: <1316791266.39972.3.camel@buffy.york.ac.uk> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: freebsd-current@freebsd.org, "freebsd-drivers@freebsd.org" Subject: Re: Choosing between DELAY(useconds) and pause() X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2011 15:38:40 -0000 On Thu, 2011-09-22 at 20:07 +0200, Hans Petter Selasky wrote: > On Thursday 22 September 2011 19:55:23 David Somayajulu wrote: > > It appears that the pause() function cannot be used in driver functions > > which are invoked early in the boot process. Is there is a kernel api > > which a device driver can use to determine whether to use pause() or > > DELAY(), for delays which are say greater than 10hz - may be even 1 hz ? > > Maybe you want to use something like this: > > if (cold) > DELAY() > else > pause() > > In your code. Note that this still shouldn't be done in your suspend/resume paths, as "cold" isn't set there, however there also appears to be no guarantee that pause() will ever return (as you could be running after the timer has been suspended, or before it resumes). I'm not sure what the correct answer is for suspend/resume code. Gavin