Home | History | Annotate | Download | only in dev
History log of /src/sys/arch/macppc/dev/cuda.c
RevisionDateAuthorComments
 1.34  23-Sep-2025  thorpej Make the i2c_enumerate_deventries() callback a bit more generic so
it can also be used for the filtering function that macppc::cuda
and sandpoint need.
 1.33  22-Sep-2025  thorpej cuda's i2c children are not in the OF device tree. Rather than using
an i2c-child-devices array, provide a private i2c device enumeration
method by subclassing our devhandle and providing that to the iic
instance.
 1.32  15-Sep-2025  thorpej Encapsulate what's needed to attach an I2C bus into a iicbus_attach()
inline.
 1.31  07-Sep-2025  thorpej Change todr_chip_handle::cookie -> todr_chip_handle::todr_dev, and
make it a device_t. Upcoming functional changes will require the
device_t associated with a TODR device.

Change todr_chip_handle::bus_cookie -> todr_chip_handle::todr_devaux.
Nothing was using the old field, but I decided to keep it around just
in cause something needs it in the future.

And with these largely mechanical yet semantically meaningful changes,
thus spake the Oracle: "Welcome to NetBSD 11.99.2."
 1.30  06-Sep-2023  macallan yet another tsleep/wakeup -> cv_*
 1.29  07-Aug-2021  thorpej branches: 1.29.2;
Merge thorpej-cfargs2.
 1.28  24-Apr-2021  thorpej branches: 1.28.2; 1.28.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.27  05-Mar-2021  rin branches: 1.27.2;
Convert to intr_establish_xname().
 1.26  14-Jul-2020  martin branches: 1.26.2;
Adapt to new proplib API
 1.25  14-Jul-2020  martin Adapt to new proplib API
 1.24  22-Dec-2019  thorpej Cleanup i2c bus acquire / release, centralizing all of the logic into
iic_acquire_bus() / iic_release_bus(). "acquire" and "release" hooks
no longer need to be provided by back-end controller drivers (only if
they need special handling, e.g. powering on the i2c controller).
This results in the removal of a bunch of rendundant code from each
back-end controller driver.

Assert that we are not in hard interrupt context in iic_acquire_bus(),
iic_exec(), and iic_release_bus().
 1.23  03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.22  22-Sep-2017  macallan branches: 1.22.2; 1.22.4;
direct configure i2c devices
 1.21  14-Feb-2016  chs zero the i2c_attach_args structure before filling it in.
fixes occasional crashes in iic_attach().
 1.20  13-Aug-2014  macallan branches: 1.20.2;
if we get garbage from the RTC try again a couple times
this seems to happen more frequently when the PRAM battery goes bad
 1.19  14-Mar-2014  mrg remove various set-but-unused variables.
 1.18  30-Jul-2013  joerg Strip redundant parenthesis.
 1.17  01-Jul-2011  dyoung branches: 1.17.2; 1.17.12; 1.17.16;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.16  18-Jun-2011  matt struct device * -> device_t
struct cfdata * -> cfdata_t
use device accessors, use device_private.
some softc/device_t splits (macppc needs a bunch more)
aprint*_dev used considerably more
 1.15  12-Dec-2009  tsutsui branches: 1.15.10;
Remove `volatile' qualifier from argument types of
struct timeval passed to todr_gettime(9) and todr_settime(9).
We no longer have an ancient and volatile struct timeval `time'
global since we have switched to MI timercounter(9) on all port.

XXX1: some of these RTC drivers still assume 32bit time_t
XXX2: some of these should be rewritten to use todr_[gs]ettime_ymdhms()
XXX3: todr(9) man page doesn't mention todr_[gs]ettime_ymdhms()
 1.14  18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.13  04-Feb-2009  pgoyette branches: 1.13.2;
Return error status if an attempt is made to use the quick_{read,write}
i2c protocols, since we don't (yet) know how to make the controller do it.
 1.12  11-Jan-2009  macallan fix format instead of casting wildly
 1.11  11-Jan-2009  christos don't truncate the print.
 1.10  11-Jan-2009  macallan deal with 64bit time_t
Noticed by Wojciech Galazka
 1.9  07-Dec-2008  tsutsui Fix attach messages. (extra colons, misplaced newline etc.)
 1.8  16-May-2008  macallan branches: 1.8.4; 1.8.6; 1.8.8;
struct device * -> device_t
 1.7  29-Apr-2008  martin branches: 1.7.2;
Convert to new 2 clause license
 1.6  06-Dec-2007  ad branches: 1.6.12; 1.6.14; 1.6.16;
lockmgr -> mutex
 1.5  07-Nov-2007  garbled branches: 1.5.2;
Convert macppc to shared ofw_autoconf.c. Compile tested only.
 1.4  17-Oct-2007  garbled branches: 1.4.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.3  15-Feb-2007  macallan branches: 1.3.4; 1.3.8; 1.3.12; 1.3.16; 1.3.24; 1.3.26; 1.3.28; 1.3.30;
don't use IPL_HIGH
 1.2  05-Feb-2007  macallan - don't go CUDA_IDLE before calling message handlers, that way we force all
writes they might issue to be delayed which keeps us from deadlocking
- don't splhigh() in cuda_intr() - usually we're there already. Instead do
the splhigh()/splx() dance when we're polling
- remove some leftover debugging gunk
 1.1  17-Jan-2007  macallan branches: 1.1.2;
new drivers for pmu and cuda
 1.1.2.3  09-Feb-2007  ad Sync with HEAD.
 1.1.2.2  01-Feb-2007  ad Sync with head.
 1.1.2.1  17-Jan-2007  ad file cuda.c was added on branch newlock2 on 2007-02-01 08:48:07 +0000
 1.3.30.2  13-Nov-2007  bouyer Sync with HEAD
 1.3.30.1  25-Oct-2007  bouyer Sync with HEAD.
 1.3.28.1  18-Oct-2007  yamt sync with head.
 1.3.26.3  09-Jan-2008  matt sync with HEAD
 1.3.26.2  08-Nov-2007  matt sync with -HEAD
 1.3.26.1  06-Nov-2007  matt sync with HEAD
 1.3.24.3  09-Dec-2007  jmcneill Sync with HEAD.
 1.3.24.2  11-Nov-2007  joerg Sync with HEAD.
 1.3.24.1  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.3.16.2  02-Aug-2007  macallan these days we need to include pio.h for io macros
 1.3.16.1  11-May-2007  macallan request the correct interrupt type in a couple drivers - necessary since
these days we actually do something with the type argument
 1.3.12.1  09-Dec-2007  reinoud Pullup to HEAD
 1.3.8.2  03-Dec-2007  ad Sync with HEAD.
 1.3.8.1  23-Oct-2007  ad Sync with head.
 1.3.4.5  07-Dec-2007  yamt sync with head
 1.3.4.4  15-Nov-2007  yamt sync with head.
 1.3.4.3  27-Oct-2007  yamt sync with head.
 1.3.4.2  26-Feb-2007  yamt sync with head.
 1.3.4.1  15-Feb-2007  yamt file cuda.c was added on branch yamt-lazymbuf on 2007-02-26 09:07:20 +0000
 1.4.2.2  08-Dec-2007  mjf Sync with HEAD.
 1.4.2.1  19-Nov-2007  mjf Sync with HEAD.
 1.5.2.1  08-Dec-2007  ad Sync with head.
 1.6.16.3  11-Mar-2010  yamt sync with head
 1.6.16.2  04-May-2009  yamt sync with head.
 1.6.16.1  16-May-2008  yamt sync with head.
 1.6.14.1  18-May-2008  yamt sync with head.
 1.6.12.2  17-Jan-2009  mjf Sync with HEAD.
 1.6.12.1  02-Jun-2008  mjf Sync with HEAD.
 1.7.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.8.8.1  13-Dec-2008  bouyer Pull up following revision(s) (requested by tsutsui in ticket #182):
sys/arch/macppc/dev/cuda.c: revision 1.9
sys/arch/macppc/macppc/memory.c: revision 1.2
sys/arch/macppc/dev/zs.c: revision 1.48
Fix attach messages. (extra colons, misplaced newline etc.)
 1.8.6.3  28-Apr-2009  skrll Sync with HEAD.
 1.8.6.2  03-Mar-2009  skrll Sync with HEAD.
 1.8.6.1  19-Jan-2009  skrll Sync with HEAD.
 1.8.4.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.13.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.15.10.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.17.16.2  18-May-2014  rmind sync with head
 1.17.16.1  28-Aug-2013  rmind sync with head
 1.17.12.2  03-Dec-2017  jdolecek update from HEAD
 1.17.12.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.17.2.1  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.20.2.1  19-Mar-2016  skrll Sync with HEAD
 1.22.4.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.22.4.1  10-Jun-2019  christos Sync with HEAD
 1.22.2.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.26.2.1  03-Apr-2021  thorpej Sync with HEAD.
 1.27.2.2  02-Apr-2021  thorpej config_found_ia() -> config_found() w/ CFARG_IATTR.
 1.27.2.1  21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.28.8.1  04-Aug-2021  thorpej Adapt to CFARGS().
 1.28.2.2  08-May-2021  thorpej There are no more consumers of i2c attach args "cookie" and "cookietype",
so garbage-collect them.
 1.28.2.1  08-May-2021  thorpej Children of the "cuda" i2c controller don't appear in the OF device tree,
so we need to supply our own "i2c-enumerate-devices" method.
 1.29.2.6  13-Sep-2021  thorpej Move the i2c enumeration helpers to their own header file to detangle
it from reliance on "iic" being configured into the kernel.
 1.29.2.5  11-Sep-2021  thorpej Add a devhandle_subclass() helper function to simplify the common case
and use it. Improve some comments.
 1.29.2.4  11-Sep-2021  thorpej Remove some useless comments.
 1.29.2.3  11-Sep-2021  thorpej Use i2c_enumerate_deventries().
 1.29.2.2  10-Sep-2021  thorpej Remove unnecessary references to i2c_attach_args::ia_prop and mark the ones
that remain as XXX.
 1.29.2.1  09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.

RSS XML Feed