On 2/21/13 4:27 AM, Warner Losh wrote:
> Author: imp
> Date: Thu Feb 21 00:27:51 2013
> New Revision: 247066
> URL: http://svnweb.freebsd.org/changeset/base/247066
> 
> Log:
>   Replace splhigh() with critical_enter()/leave() to ensure we write the
>   config mode unlock sequence quickly enough. This likely isn't too critical,
>   since splhigh() has been a noop for a decade...
> 
> Modified:
>   head/sys/dev/ppc/ppc.c
> 
> Modified: head/sys/dev/ppc/ppc.c
> ==============================================================================
> --- head/sys/dev/ppc/ppc.c    Thu Feb 21 00:26:31 2013        (r247065)
> +++ head/sys/dev/ppc/ppc.c    Thu Feb 21 00:27:51 2013        (r247066)
> @@ -74,6 +74,22 @@ static void ppcintr(void *arg);
>  
>  #define DEVTOSOFTC(dev) ((struct ppc_data *)device_get_softc(dev))
>  
> +/*
> + * We use critical enter/leave for the simple config locking needed to
> + * detect the devices. We just want to make sure that both of our writes
> + * happen without someone else also writing to those config registers. Since
> + * we just do this at startup, Giant keeps multiple threads from executing,
> + * and critical_enter() then is all that's needed to keep us from being 
> preempted
> + * during the critical sequences with the hardware.
> + *
> + * Note: this doesn't prevent multiple threads from putting the chips into
> + * config mode, but since we only do that to detect the type at startup the
> + * extra overhead isn't needed since Giant protects us from multiple entry
> + * and no other code changes these registers.
> + */
> +#define PPC_CONFIG_LOCK(ppc)         critical_enter()
> +#define PPC_CONFIG_UNLOCK(ppc)               critical_leave()
> +

s/critical_leave/critical_exit/?

-- 
Andrey Zonov

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to