Home | History | Annotate | Download | only in dev
History log of /src/sys/arch/macppc/dev/smu.c
RevisionDateAuthorComments
 1.17  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.16  22-Jan-2022  thorpej Change the devhandle_from_*() functions to also take a "super handle",
from which the newly created handle will inherit it's implementation.
The root implementation for a new handle type is used if an invalid
"super handle" is passed.
 1.15  03-Sep-2021  macallan switch smu to common fan control code
 1.14  07-Aug-2021  thorpej branches: 1.14.2;
Merge thorpej-cfargs2.
 1.13  24-Apr-2021  thorpej branches: 1.13.2; 1.13.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.12  09-Mar-2021  macallan branches: 1.12.2;
add support for the CPU temperature sensor found in iMac G5s
 1.11  05-Mar-2021  rin Convert to intr_establish_xname().
 1.10  25-Feb-2021  macallan deal with node name inconsistencies between PowerMac10,x and 8,x
Now we find fans and iic devices on iMac G5
 1.9  04-Jul-2020  rin branches: 1.9.2;
- Adjust location of \n in attach message.
- Convert to aprint_*(9).
 1.8  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.7  10-Nov-2019  chs in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.6  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.5  20-Apr-2018  macallan branches: 1.5.2;
overhaul SMU i2c handling:
- get rid of the special smuiicbus, use generic i2cbus
- use shifted i2c addresses like everyone else
- use direct config
with this generic i2c drivers should work on the smu's i2c bus.
 1.4  09-Mar-2018  sevan Initialise ret to avoid returning uninitialised value if the if statement is
false. Found when building the POWERMAC_G5 kernel with clang.
 1.3  01-Oct-2017  macallan branches: 1.3.2; 1.3.4;
we support the drive bay sensor now
 1.2  29-Sep-2017  macallan provide crude but working fan control based on sensor readings
 1.1  06-Jun-2017  macallan branches: 1.1.4;
SMU support, from Phileas Fogg
 1.1.4.2  28-Aug-2017  skrll Sync with HEAD
 1.1.4.1  06-Jun-2017  skrll file smu.c was added on branch nick-nhusb on 2017-08-28 17:51:44 +0000
 1.3.4.3  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.3.4.2  22-Apr-2018  pgoyette Sync with HEAD
 1.3.4.1  15-Mar-2018  pgoyette Synch with HEAD
 1.3.2.2  03-Dec-2017  jdolecek update from HEAD
 1.3.2.1  01-Oct-2017  jdolecek file smu.c was added on branch tls-maxphys on 2017-12-03 11:36:25 +0000
 1.5.2.3  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.5.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.5.2.1  10-Jun-2019  christos Sync with HEAD
 1.9.2.1  03-Apr-2021  thorpej Sync with HEAD.
 1.12.2.2  04-Apr-2021  thorpej Associate the OpenFirmware phandle associated with a found device (including
PCI bus instances) by using CFARG_DEVHANDLE.
 1.12.2.1  23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.13.8.1  04-Aug-2021  thorpej Adapt to CFARGS().
 1.13.2.3  14-May-2021  thorpej Move the bus/channel number for multi-channel / mux controllers out of
i2cbus_attach_args and stash it in the i2c_tag_t instead. This makes it
accessible to platform device tree code when enumerating devices.
 1.13.2.2  14-May-2021  thorpej Deal with quirks / differences in OpenFirmware implementations'
interpreation of the i2c "reg" property by embedding knowledge
of those quicks directly, rather than forcing lots of drivers
to provide their own devhandle implementations. We default to
assuming the Device Tree bindings, and tweak based on platform-
specific #ifdefs.

Start with __HAVE_OPENFIRMWARE_VARIANT_AAPL (all i2c "reg" properties
encode an address that's shifted left 1 bit to account for the R/W bit
that appears on the wire).
 1.13.2.1  09-May-2021  thorpej Adapt the smu driver to the new i2c device enumeration method. While
here, collapse the "smuiic" driver into the base "smu" driver; it was
superfluous given how the rest of the "smu" driver is structured.
 1.14.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