Home | History | Annotate | Download | only in dev
History log of /src/sys/arch/sparc/dev/obio.c
RevisionDateAuthorComments
 1.77  20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.76  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.75  24-Apr-2021  thorpej branches: 1.75.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.74  24-Mar-2013  jdc branches: 1.74.50;
Check if sbus is defined in the kernel configuration before using it.
From Taylor R Campbell.
 1.73  27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.72  01-Jul-2011  dyoung branches: 1.72.2; 1.72.12;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.71  17-May-2008  macallan more device_t-ification
 1.70  28-Apr-2008  martin branches: 1.70.2;
Remove clause 3 and 4 from TNF licenses
 1.69  16-Nov-2005  uwe branches: 1.69.74; 1.69.76; 1.69.78;
ANSIify function declarations/defintions. Use uint<N>_t.
Propagate "static" to function definitions. Drop trailing whitespace.
Same binary code is produced for GENERIC.MP + KGDB + DDB.
 1.68  26-Aug-2005  drochner branches: 1.68.6;
s/locdesc_t/int/g
 1.67  30-Jun-2005  drochner branches: 1.67.2;
adaptions to config_search() change, and minor autoconf fixes, mostly from Havard Eidnes
 1.66  14-Dec-2004  chs use the generated macros in locators.h rather than hard-coded numbers
to index the cf_loc[] array. reviewed by allen briggs.
 1.65  27-Jun-2004  pk Always use `full bus space'. In order to implement this more efficiently,
require that all bus tags have pointers to bus_space_read/write functions,
i.e. no run-time hunting for the first "upstream" implementation.
Since this changes the way bus tags should be constructed it makes sense
to do the same thing for the rest of the bus space methods.
So, now bus space tags are generally constructed by copying the parent's bus
tag and then overriding the methods that the bus driver needs to handle,
instead of starting with an empty bus tag and fiiling in only the fields needed.
 1.64  15-Jul-2003  lukem __KERNEL_RCSID()
 1.63  03-May-2003  wiz branches: 1.63.2;
DMA, not dma nor Dma.
 1.62  30-Apr-2003  martin Make this compile with __FULL_SPARC_BUS_SPACE,
from Steve Rumble in PR 21398.
 1.61  02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.60  03-Jan-2003  mrg part one of bus_space(9) fixes to enable bus spaces to override the
bus_space_{read,write}_[1248]() functions, which will allow 16-bit
PCMCIA support to work without additional hacks in MI drivers.
this option is not enabled yet.
 1.59  01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.58  02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.57  01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.56  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.55  27-Sep-2002  thorpej Introduce a new routine, config_match(), which invokes the
cfattach->ca_match function in behalf of the caller. Use it
rather than invoking cfattach->ca_match directly.
 1.54  27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.53  25-Aug-2002  thorpej Put a bus's ranges in the bus space tag, and make sparc_bus_map()
perform the translation and recursion if t->ranges != NULL. Make
sbus, cpuunit, and bootbus inherit the parent's map/mmap routines,
and delete the now-unused mapping functions. Update all places where
bus space tags are statically allocated.
 1.52  11-Apr-2002  pk branches: 1.52.2;
Pass fully encoded bus addresses in the attach arguments.
 1.51  11-Mar-2002  pk * `bus_type_t' is gone.
* Use BUS_ADDR() where appropriate to encode I/O space and physical
address offset into a `bus_addr_t' value.
* Drop obio_bus_map() since it's now completely equivalent to bus_space_map()
* Use bus_space_map2() to map device space at a fixed virtual address.
* Remove the virtual address argument from sbus_sbus_addr()
 1.50  24-Sep-2001  eeh branches: 1.50.4;
Change bus_space_mmap() signature to the official one.
 1.49  25-Jul-2000  pk branches: 1.49.2; 1.49.4;
Add `dma' to the `early device' list, since we need it before an `esp'
is configured. Traced and tested by Julian Coleman.
 1.48  29-Jun-2000  mrg remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.47  11-Jan-2000  pk branches: 1.47.4;
Remove old-style boot device recognition.
 1.46  28-Jun-1999  pk branches: 1.46.2;
More ugly code to force early configuration of the sun4 on-board timer.
 1.45  05-Sep-1998  eeh branches: 1.45.8;
Remove function naming conflict.
 1.44  21-Aug-1998  pk Convert to [pv]addr_t.
 1.43  07-Apr-1998  pk The bus space functions now take care of "pass-through" methods.
 1.42  29-Mar-1998  pk Implement `_obio_bus_map()' and insert it into the obio bus' bus tag.
Remove obio_bus_probe().
 1.41  23-Mar-1998  pk Only print interesting interrupt levels.
 1.40  21-Mar-1998  pk Switch to a bus_space(9)-based device attachment scheme.

- device attachment arguments contain bus-specific
address and interrupt levels.

- devices must call back on bus map functions to get their
addresses and interrupt levels translated properly.

- sun4m's obio bus is treated like an Sbus slot.

- the sun4-style obio bus has its own attach arguments
and map functions.
 1.39  25-Jan-1998  pk All VME stuff is gone from here.
 1.38  12-Jan-1998  thorpej Update for changes to config.
 1.37  29-Jul-1997  fair %x -> 0x%x
 1.36  10-Jun-1997  pk vme_establishintr: remove SUN4 arch check; this now works on sun4m as well.
 1.35  07-Jun-1997  pk Use the `ranges' property to deal with VMEbus address spaces.
 1.34  24-May-1997  pk Use `rr_iospace' to track the MMU page type bits. On sun4c/sun4m the
iospace value is always learned from the PROM; on sun4, we infer it
from the BUS_* parameters.

This obsoletes the `bustype' argument in bus_tmp().
 1.33  18-May-1997  pk Remove bus_tmp(); it's just a special case of mapdev().
 1.32  18-May-1997  pk A bit of framework for sun4m VME busses.
 1.31  08-Apr-1997  pk Move "range" property description out of generic `romaux'.
Allocate room for this property when needed in bus attachment.
 1.30  10-Mar-1997  pk Replace `cpumod' with `cpuinfo.cpu_type' equivalents.
 1.29  10-Dec-1996  pk branches: 1.29.6;
Not all sun4m's have an `auxio'.
 1.28  10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.27  13-Oct-1996  christos backout previous kprintf change
 1.26  11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.25  27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.24  18-May-1996  mrg don't set tmp twice.
 1.23  05-Apr-1996  chuck make netbsd/sparc boot on sun4 once again. the sun4m changes introduced
config lines for obio0 devices without addresses (thus cf->cf_loc[0] took
the default value of -1). we now ignore these entries on a sun4 since
they could never be valid (eliminates a 'panic:alignment' fault at bootup).
 1.22  31-Mar-1996  pk Handle sun4m `obio' devices.
Cleanup `#if defined(SUN4*)' mess.
 1.21  17-Mar-1996  thorpej New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.20  14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.19  12-Jan-1996  chuck improved handling of mapping of devices who's registers do not reside on
page boundaries:
- change bus_tmp() to include the offset from the start of page in the
returned KVA [rather than forcing each driver to add it back in
individually]
- changed bus_map() to include the offset from the start of page in the
the returned value if a mapping is found in the PROM's KVA area
- clarified a few comments
 1.18  11-Jan-1996  pk Correct page frame calculation after mapdev() interface change.
 1.17  11-Dec-1995  pk Adapt to changed mapiodev() interface.
 1.16  18-Aug-1995  pk Use actual bus names (matches Chuck's bootpath code).
 1.15  27-May-1995  pk Propagate bootpaths
 1.14  25-Apr-1995  pk Remove duplication of code from subr_autoconf.c
 1.13  10-Apr-1995  mycroft kernel_pmap --> pmap_kernel()
 1.12  01-Mar-1995  pk Better 4/100 support.
 1.11  01-Feb-1995  pk Integrate changes from Chuck Cranor for the Sun 4/100.
Support for multiple register banks on SBUS devices (based on patches
from Francis Dupont).
Highlights:
romaux defines an array of register spaces.
pay attention to `vactype'.
quirks handling 4/100 idiosyncracies.
 1.10  25-Nov-1994  deraadt wzero/wcopy moved to machdep.c
 1.9  23-Nov-1994  deraadt XXmatch change (and a few __P() as well)
 1.8  05-Nov-1994  deraadt only print the vec if needed
 1.7  02-Nov-1994  deraadt let busmatch print the level/vec
 1.6  02-Nov-1994  deraadt add wcopy/wzero, and ack VME using ldcontrob
 1.5  26-Oct-1994  deraadt working vme16/32 support
 1.4  15-Oct-1994  deraadt mapiodev takes a bustype argument now
 1.3  02-Oct-1994  deraadt sun4/300 support works
 1.2  17-Sep-1994  deraadt obio bus driver, for dealing with devices on the sun4 motherboard.
 1.1  24-Aug-1994  deraadt first cut at sun4 on-board io bus
 1.29.6.1  12-Mar-1997  is Merge in changes from The Trunk
 1.45.8.1  01-Jul-1999  thorpej Sync w/ -current.
 1.46.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.47.4.1  26-Jul-2000  pk Pull up revision 1.49 from trunk:

Add `dma' to the `early device' list, since we need it before an `esp'
is configured. Traced and tested by Julian Coleman.
 1.49.4.5  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.49.4.4  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.49.4.3  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.49.4.2  16-Mar-2002  jdolecek Catch up with -current.
 1.49.4.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.49.2.1  01-Oct-2001  fvdl Catch up with -current.
 1.50.4.7  03-Jan-2003  thorpej Sync with HEAD (again).
 1.50.4.6  03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.50.4.5  18-Oct-2002  nathanw Catch up to -current.
 1.50.4.4  27-Aug-2002  nathanw Catch up to -current.
 1.50.4.3  17-Apr-2002  nathanw Catch up to -current.
 1.50.4.2  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.50.4.1  24-Sep-2001  nathanw file obio.c was added on branch nathanw_sa on 2002-04-01 07:42:42 +0000
 1.52.2.1  31-Aug-2002  gehenna catch up with -current.
 1.63.2.6  11-Dec-2005  christos Sync with head.
 1.63.2.5  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.63.2.4  18-Dec-2004  skrll Sync with HEAD.
 1.63.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.63.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.63.2.1  03-Aug-2004  skrll Sync with HEAD
 1.67.2.1  21-Jun-2006  yamt sync with head.
 1.68.6.1  22-Nov-2005  yamt sync with head.
 1.69.78.2  04-May-2009  yamt sync with head.
 1.69.78.1  16-May-2008  yamt sync with head.
 1.69.76.1  18-May-2008  yamt sync with head.
 1.69.74.1  02-Jun-2008  mjf Sync with HEAD.
 1.70.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.72.12.2  23-Jun-2013  tls resync from head
 1.72.12.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.72.2.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.72.2.1  30-Oct-2012  yamt sync with head
 1.74.50.6  05-Apr-2021  thorpej Treat config_probe() as if it were a boolean function; don't compare
return value > 0... except for the odd balls, which are now really easy
to spot.
 1.74.50.5  05-Apr-2021  thorpej config_match() -> config_probe() for the straight-forward indirect config
cases. There are still a few odd balls using config_match() which should
be sorted out later.
 1.74.50.4  04-Apr-2021  thorpej CFARG_SUBMATCH -> CFARG_SEARCH for the indirect configuration uses.
 1.74.50.3  03-Apr-2021  thorpej Give config_attach() the tagged variadic argument treatment and
mechanically convert all call sites.
 1.74.50.2  21-Mar-2021  thorpej CFARG_IATTR usage audit:

If a device carries only one interface attribute, there is no need
to specify it when calling config_search(); that specification is
meant only to disambiguate which interface attribute (which is a
proxy for "what kind of attach args are being used") is having
children attached. cfparent_match() will take care of ensuring that
any potential children can attach to one of the parent's iterface
attributes, and if the parent only carries one, no disambiguation is
necessary.
 1.74.50.1  20-Mar-2021  thorpej The proliferation if config_search_*() and config_found_*() combinations
is a little absurd, so begin to tidy this up:

- Introduce a new cfarg_t enumerated type, that defines the types of
tag-value variadic arguments that can be passed to the various
config_*() functions (CFARG_SUBMATCH, CFARG_IATTR, and CFARG_LOCATORS,
for now, plus a CFARG_EOL sentinel).
- Collapse config_search_*() into config_search() that takes these
variadic arguments.
- Convert all call sites of config_search_*() to the new signature.
Noticed several incorrect usages along the way, which will be
audited in a future commit.
 1.75.8.1  04-Aug-2021  thorpej Adapt to CFARGS().

RSS XML Feed