Home | History | Annotate | Download | only in pci
History log of /src/sys/dev/pci/amdpm_smbus.c
RevisionDateAuthorComments
 1.26  15-Sep-2025  thorpej Encapsulate what's needed to attach an I2C bus into a iicbus_attach()
inline.
 1.25  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.24  24-Apr-2021  thorpej branches: 1.24.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.23  22-Dec-2019  thorpej branches: 1.23.10;
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.22  14-Feb-2016  chs branches: 1.22.18;
zero the i2c_attach_args structure before filling it in.
fixes occasional crashes in iic_attach().
 1.21  13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.20  13-Jun-2013  tls branches: 1.20.10;
Convert the entropy pool framework from pseudo-callout-driven to
soft interrupt driven operation.

Add a polling mode of operation -- now we can ask hardware random number
generators to top us up just when we need it (bcm2835_rng and amdpm
converted as examples).

Fix a stall noticed with repeated reads from /dev/random while testing.
 1.19  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.18  14-Feb-2012  pgoyette branches: 1.18.6;
Replace the xxx_acquire()/xxx_release() rwlocks with mutexes. There are
only RW_WRITERs for these, and no RW_READERs, so no need to incur the
extra overhead of allowing for both. As discussed on tech-kern.

For piixpm and ichsmb, the acquire/release protocol needs to be used,
even if the request is I2C_F_POLL'd (or if the device supports only
polled mode). Otherwise multiple requests can be running at the same
time, and they stomp on each other and create anomolous results.

Part 2 addresses my PR kern/45889

3 ACKs from releng
 1.17  19-Nov-2011  christos branches: 1.17.4;
bye xbox
 1.16  03-Feb-2009  pgoyette branches: 1.16.14;
Update the i2c_exec() functions to handle quick_read/quick_write protocol.

Although interface routines i2c_smbus_*() exist, nothing in NetBSD actually
uses them yet.
 1.15  10-Apr-2008  cegger branches: 1.15.4; 1.15.12;
use aprint_*_dev and device_xname
 1.14  27-Aug-2007  xtraeme branches: 1.14.22;
Use rwlock(9) rather than lockmgr(9).
 1.13  27-Aug-2007  xtraeme Apply some KNF.
 1.12  06-Feb-2007  jmcneill branches: 1.12.6; 1.12.14; 1.12.18;
Fix build failure for !XBOX, pointed out by Paul Goyette on current-users
 1.11  06-Feb-2007  jmcneill Another Xbox hack;

If we're handling system management interrupts ourselves, the system locks
solid when the ACPI timer SCI fires. Disable this interrupt so we can have
an uptime of more than ~10 minutes.
 1.10  05-Feb-2007  jmcneill Disgusting Xbox hack;

The "pci0 dev 1 function 2" aka "System Management" on the nForce chipset
isn't detected on the Xbox. If XBOX is defined and arch_i386_is_xbox is
true, force intrline to 12 and map the system management IO space at
0x8000. We can now call iic_smbus_intr when a system management interrupt
takes place.

While we're here, make amdpm_smbus honour the I2C_F_POLL flag.

The Xbox no longer resets when you press the eject button.
 1.9  06-Jan-2007  jmcneill There is absolutely no way that this code could have worked for reading
values from the smbus before. amdpm_smbus_exec was using the values read
from the registers and using them as return values instead of filling in
the caller's buffer.
 1.8  06-Jan-2007  jmcneill nForce uses a slightly different register offset for the smbus controls;
compensate for this.
 1.7  16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.6  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.5  24-Sep-2006  jmcneill Use /* ... */ for comment instead of // ...
 1.4  26-Jun-2006  drochner branches: 1.4.4; 1.4.6; 1.4.8;
use the "i2cbus" interface attribute rather than putting a string name
into the i2cbus attach args
 1.3  30-Apr-2006  xtraeme branches: 1.3.4; 1.3.6;
PR kern/32913: amdpm(4) smbus/i2cbus needs locking. Apply patch
from Nicolas Joly.
 1.2  19-Feb-2006  xtraeme branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8; 1.2.10; 1.2.12;
Add __KERNEL_RCSID.
 1.1  19-Feb-2006  tls Add support for i2c bus on AMD-8111 used on many Opteron server motherboards,
and ADT 7463c thermal and voltage monitor found on the Tyan S2881 and S2882-D
(and probably other boards as well). We do not currently support any kind
of detection of the i2c address of the thermal monitor; it appears to be
at 0x2D on the S2881 and 0x2E on the S2882-D (kernel config examples
forthcoming).

From PR kern/32463 submitted by Anil Gopinath, anil_public@yahoo.com.
 1.2.12.3  01-Jun-2006  kardel Sync with head.
 1.2.12.2  22-Apr-2006  simonb Sync with head.
 1.2.12.1  19-Feb-2006  simonb file amdpm_smbus.c was added on branch simonb-timecounters on 2006-04-22 11:39:13 +0000
 1.2.10.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.8.1  11-May-2006  elad sync with head
 1.2.6.2  11-Aug-2006  yamt sync with head
 1.2.6.1  24-May-2006  yamt sync with head.
 1.2.4.2  01-Mar-2006  yamt sync with head.
 1.2.4.1  19-Feb-2006  yamt file amdpm_smbus.c was added on branch yamt-uio_vmspace on 2006-03-01 09:28:21 +0000
 1.2.2.2  20-Feb-2006  tron Pull up following revision(s) (requested by tls in ticket #1179):
sys/dev/pci/amdpm.c: revision 1.11
sys/dev/i2c/files.i2c: revision 1.7
sys/dev/i2c/adt7463.c: revision 1.1
sys/dev/pci/files.pci: revision 1.242 via patch
sys/dev/pci/amdpmvar.h: revision 1.1
sys/dev/i2c/adt7463reg.h: revision 1.1
sys/dev/DEVNAMES: revision 1.192 via patch
sys/dev/pci/amdpm_smbus.c: revision 1.1
sys/dev/pci/amdpm_smbusreg.h: revision 1.1
Add support for i2c bus on AMD-8111 used on many Opteron server motherboards,
and ADT 7463c thermal and voltage monitor found on the Tyan S2881 and S2882-D
(and probably other boards as well). We do not currently support any kind
of detection of the i2c address of the thermal monitor; it appears to be
at 0x2D on the S2881 and 0x2E on the S2882-D (kernel config examples
forthcoming).
From PR kern/32463 submitted by Anil Gopinath, anil_public@yahoo.com.
 1.2.2.1  19-Feb-2006  tron file amdpm_smbus.c was added on branch netbsd-3 on 2006-02-20 23:00:27 +0000
 1.3.6.5  03-Sep-2007  yamt sync with head.
 1.3.6.4  26-Feb-2007  yamt sync with head.
 1.3.6.3  30-Dec-2006  yamt sync with head.
 1.3.6.2  21-Jun-2006  yamt sync with head.
 1.3.6.1  30-Apr-2006  yamt file amdpm_smbus.c was added on branch yamt-lazymbuf on 2006-06-21 15:05:03 +0000
 1.3.4.1  13-Jul-2006  gdamore Merge from HEAD.
 1.4.8.2  10-Dec-2006  yamt sync with head.
 1.4.8.1  22-Oct-2006  yamt sync with head
 1.4.6.2  09-Sep-2006  rpaulo sync with head
 1.4.6.1  26-Jun-2006  rpaulo file amdpm_smbus.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:52:16 +0000
 1.4.4.3  09-Feb-2007  ad Sync with HEAD.
 1.4.4.2  12-Jan-2007  ad Sync with head.
 1.4.4.1  18-Nov-2006  ad Sync with head.
 1.12.18.1  03-Sep-2007  jmcneill Sync with HEAD.
 1.12.14.1  03-Sep-2007  skrll Sync with HEAD.
 1.12.6.1  09-Oct-2007  ad Sync with head.
 1.14.22.1  02-Jun-2008  mjf Sync with HEAD.
 1.15.12.1  03-Mar-2009  skrll Sync with HEAD.
 1.15.4.1  04-May-2009  yamt sync with head.
 1.16.14.3  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.16.14.2  30-Oct-2012  yamt sync with head
 1.16.14.1  17-Apr-2012  yamt sync with head
 1.17.4.1  18-Feb-2012  mrg merge to -current.
 1.18.6.3  03-Dec-2017  jdolecek update from HEAD
 1.18.6.2  23-Jun-2013  tls resync from head
 1.18.6.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.20.10.2  19-Mar-2016  skrll Sync with HEAD
 1.20.10.1  06-Jun-2015  skrll Sync with HEAD
 1.22.18.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.23.10.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.24.8.1  04-Aug-2021  thorpej Adapt to CFARGS().

RSS XML Feed