Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 07 Oct 2001 14:05:24 -0600
From:      Warner Losh <imp@harmony.village.org>
To:        Marcel Moolenaar <marcel@xcllnt.net>
Cc:        Bruce Evans <bde@zeta.org.au>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/ia64/include cpufunc.h 
Message-ID:  <200110072005.f97K5O753677@harmony.village.org>
In-Reply-To: Your message of "Sun, 07 Oct 2001 12:37:37 PDT." <20011007123737.A380@athlon.pn.xcllnt.net> 
References:  <20011007123737.A380@athlon.pn.xcllnt.net>  <20011006121654.B68233@kayak.xcllnt.net> <20011007132357.J6012-100000@delplex.bde.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <20011007123737.A380@athlon.pn.xcllnt.net> Marcel Moolenaar writes:
: > bus_memio.h is supposed to just enable the memio functions in
: > bus_xyz${MACHINE}.h (I don't like this, but...).
: > 
: > Why do you even need these functions?
: 
: Because sys/dev/fb uses it (see below).

drivers are supposed to use bus_space* exclusively.  Those drivers
that do not do it because a) they are old an predate bus_space*
functions, b) the driver author was ignorant of the new api, c) there
was some compelling reason to use things directly.  By far, (a) is the
most common, but it can be hard to tell the difference between that
and the others sometimes :-)

Drivers should generally be updated to use bus_space, as this effort
has been going on since CAM was integreated into the kernel.

: > The alpha versions
: > of these functions actually seem to be compatibility cruft, mainly for
: > NetBSD.
: 
: Above you say that drivers for *BSD are supposed to use the bus_space
: functions. This seems to contradict with the statement that we added
: the mem*io functions for compatibility with NetBSD on Alpha. This is
: fine, but it makes it all the harder for me to figure out what we call
: "right", so that I can do it right the first time.

There's more to the kernel than just the drivers.  The mem*io
functions were used to implement routines that the drivers call.

: > This is closer to the original intended use of cpufunc.h
: > than the i386 implementation of bus space.  However, I think the i/o
: > interfaces are special enough to keep separate (remove all the i/o
: > primitives from the i386 cpufunc.h...).
: 
: Yes, I can agree with that. I'll probably reshuffle things if and when
: I manage to get a bigger picture. I'm too preoccupied ATM with getting
: a firm enough grip on the porting work that I don't fall flat on my
: face everytime the world changes around me...

The big picture is that drivers are supposed to use bus_space.
bus_space can be coded directly to the iron, or can use cpufunc.h.
cpufunc.h generally shouldn't be used in drivers or by userland
programs (although it is used by many many different userland programs
as there's no other api that we support).

Do not remove the inb/outb functions from cpufunc.h.  For better or
worse, it is used by userland programs.  Many ports will break.

Warner

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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