Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Jan 2013 13:37:56 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        "freebsd-hardware@freebsd.org" <freebsd-hardware@freebsd.org>
Subject:   Re: ppc fails to attach to puc on 9.1-STABLE, 7.4-STABLE works
Message-ID:  <201301171337.56851.jhb@freebsd.org>
In-Reply-To: <20130117134523.K1345@besplex.bde.org>
References:  <20130110074052.GA8922@bali> <20130116163342.GA30733@bali> <20130117134523.K1345@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday, January 16, 2013 10:10:34 pm Bruce Evans wrote:
> On Wed, 16 Jan 2013, Andre Albsmeier wrote:
> 
> > On Tue, 15-Jan-2013 at 21:27:07 +0100, John Baldwin wrote:
> >> On Tuesday, January 15, 2013 10:44:33 am Andre Albsmeier wrote:
> >>* ...
> >>> I have no idea if this has ever worked before -- in FreeBSD-7 I
> >>> also had to use the "do not use interrupt"-flag 0x20 in loader.conf
> >>> or ppc wouldn't have attached...
> >>>
> >>> Which brings me back to the initial problem: Hints like
> >>>
> >>> hint.ppc.0.at=puc0
> >>> hint.ppc.0.irq=""
> >>> hint.ppc.0.flags=0x2F
> >>>
> >>> seems to be ignored in 9.1. While the interrupt thing seems
> >>> to be fixed now, one possibly still wants to used the other
> >>> flags. I have helped myself with this (ugly) patch to ppc
> >>>
> >>> --- ppc.c.ORI 2013-01-12 18:07:44.000000000 +0100
> >>> +++ ppc.c       2013-01-12 18:07:24.000000000 +0100
> >>> @@ -1729,6 +1729,11 @@
> >>>         ppc->ppc_base = rman_get_start(ppc->res_ioport);
> >>>
> >>>         ppc->ppc_flags = device_get_flags(dev);
> >>> +  if( ppc->ppc_flags == 0 ) {
> >>> +    int tmp;
> >>> +    if( resource_int_value( "ppc" , device_get_unit( dev ), "flags", &tmp)
> >> == 0 )
> >>> +      ppc->ppc_flags = tmp;
> >>> +  }
> >>>
> >>>         if (!(ppc->ppc_flags & 0x20)) {
> >>>                 ppc->res_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ,
> >>>
> >>> in order to get at least the flags applied as it was the case
> >>> before in FreeBSD-7. Unfortuantely, I have no idea how to fix
> >>> that properly ;-(...
> >>
> >> This should not be needed for "flags".  Look for 'devflags' in
> >> sys/kern/subr_bus.c.  The kernel always reads the current 'flags' hint during
> >> device probe and stores them in dev->devflags and leaves them there after a
> >> successful probe (so they should be seen by attach).  Specifically, note:
> >>
> >> 		/* Set the winning driver, devclass, and flags. */
> 
> So the flags interface is unusable before some driver "wins".

No, we set it twice.  Specifically, it is set before each probe, then it is
set again after a winning driver is chosen so that the proper flags exist
during attach as well.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301171337.56851.jhb>