tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bus_space(9) header files



On Wed, Apr 07, 2010 at 10:52:25AM -0500, David Young wrote:
> On Wed, Apr 07, 2010 at 10:34:09AM +0000, Andrew Doran wrote:
> > On Mon, Apr 05, 2010 at 09:02:53PM -0500, David Young wrote:
> > > On Fri, Apr 02, 2010 at 07:42:43PM +0000, Andrew Doran wrote:
> > > > On Fri, Apr 02, 2010 at 12:51:26PM -0500, David Young wrote:
> > > > 
> > > > > I would like to add some function prototypes to <sys/bus.h> for all
> > > > > architectures to share.  Today, <sys/bus.h> is little more than this:
> > > > > 
> > > > > #include <machine/bus.h>
> > > > > 
> > > > > I would like to add the MI function prototypes underneath the
> > > > > #include:
> > > > > 
> > > > > #include <machine/bus.h>
> > > > > 
> > > > > /* MI function prototypes */
> > > > > bus_space_tag_t bus_space_tag_create(bus_space_tag_t, /* TBD */);
> > > > > void bus_space_tag_destroy(bus_space_tag_t);
> > > > > 
> > > > > According to the manual page, drivers should #include <machine/bus.h>
> > > > > for bus_space(9) definitions.  Many #include <sys/bus.h>, instead.  
> > > > > ISTM
> > > > > that the doco should be corrected to say <sys/bus.h>.
> > > > 
> > > > sys/bus.h is correct.  The intent behind having a sys/bus.h was to
> > > > eventually eliminate the pasteware so please go for it.  Did you
> > > > miss bus_proto.h?
> > > 
> > > What if I re-work the bus_space(9) header files along these lines:
> > > 
> > > 1 Each architecture provides <machine/bus_defs.h> with
> > >   the typedefs (bus_space_tag_t, bus_space_handle_t, et cetera)
> > > 
> > > 2 Each architecture provides <machine/bus_funcs.h> with
> > >   any and all macro and/or inline implementations of 
> > > 
> > > 3 <machine/bus.h> goes away, because its content is splits between
> > >   bus_defs.h and bus_funcs.h.
> > > 
> > > 4 sys/bus.h turns to this:
> > > 
> > >   #include <machine/bus_defs.h>
> > >   #include <sys/bus_proto.h>
> > >   #include <machine/bus_funcs.h>
> > > 
> > >   /* MI function declarations */
> > > 
> > > Now, is there any reliable way to declare routines that may or may not
> > > be macros or "static inline"?
> > 
> > Do you see a reason not to include contents of bus_proto.h in bus.h?
> 
> In machine/bus.h or sys/bus.h?
> 
> I think that it should be #included in only sys/bus.h.  It has to be
> #included after the typedefs are defined, and before the macros/inlines
> are defined.

I have started to work on this again.

At least one port, sparc64, has assigned different values to the
bus_dma(9) flags than sys/bus_proto.h does.  I hope that someone will
tell me that it is not necessary to preserve the differences.

Dave

-- 
David Young             OJC Technologies
dyoung%ojctech.com@localhost      Urbana, IL * (217) 344-0444 x24


Home | Main Index | Thread Index | Old Index