History log of /freebsd-9.3-release/sys/dev/iicbus/
Revision Date Author Comments
267654 20-Jun-2014 gjb

Copy stable/9 to releng/9.3 as part of the 9.3-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


262745 04-Mar-2014 dumbbell

MFC r232365:

Provide pre/post transfer method callbacks for icbbb
clients.

These are helful when making certain drivers work on both Linux
and FreeBSD without changing the code flow too much.

Reviewed by: kib, wlosh
Approved by: kan@


249132 05-Apr-2013 mav

MFC r227293 (by ed):
Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.

This means that their use is restricted to a single C file.


241803 21-Oct-2012 marius

MFC: r241679

It turns out that as documented, PCF8563_R_SECOND_VL (i.e. battery low)
doesn't automatically clear when VDD rises above Vlow again and needs to be
cleared manually. However, apparently this needs all of the time registers
to be set, i.e. pcf8563_settime(), and not just PCF8563_R_SECOND in order
for PCF8563_R_SECOND_VL to stick. Thus, we just issue a warning during
pcf8563_attach() rather than failing with ENXIO in case it is set.


236078 26-May-2012 marius

MFC: r234248

Add a driver for the NXP (Philips) PCF8563 RTC.

Obtained from: NetBSD (pcf8563reg.h)


235743 21-May-2012 jhb

Toss bogus mergeinfo.


235738 21-May-2012 sbruno

MFC r235634

Fix and update battery status bits according to linux driver


229093 31-Dec-2011 hselasky

MFC r226173, r227843, r227848 and r227908:
Use DEVMETHOD_END to mark end of device methods.
Remove superfluous device methods.
Add some missing __FBSBID() macros.


226667 23-Oct-2011 brueffer

MFC: r226398, r226442

Move the allocation of usrbufs down a few lines to avoid leaking it
in case of an error.

Approved by: re (kib)


225736 23-Sep-2011 kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by: re (implicit)


223741 03-Jul-2011 bz

Tag mbufs of all incoming frames or packets with the interface's FIB
setting (either default or if supported as set by SIOCSIFFIB, e.g.
from ifconfig).

Submitted by: Alexander V. Chernikov (melifaro ipfw.ru)
Reviewed by: julian
MFC after: 2 weeks


223624 28-Jun-2011 kevlo

Remove duplicate header includes


222860 08-Jun-2011 andreast

- Improve error handling.
- Add retry loops in the i2c read/write functions.
- Combied the ADC channel selection and readout of the value into
one iicbus_transfer to avoid possible races.

Reviewed by: nwhitehorn


222813 07-Jun-2011 attilio

etire the cpumask_t type and replace it with cpuset_t usage.

This is intended to fix the bug where cpu mask objects are
capped to 32. MAXCPU, then, can now arbitrarely bumped to whatever
value. Anyway, as long as several structures in the kernel are
statically allocated and sized as MAXCPU, it is suggested to keep it
as low as possible for the time being.

Technical notes on this commit itself:
- More functions to handle with cpuset_t objects are introduced.
The most notable are cpusetobj_ffs() (which calculates a ffs(3)
for a cpuset_t object), cpusetobj_strprint() (which prepares a string
representing a cpuset_t object) and cpusetobj_strscan() (which
creates a valid cpuset_t starting from a string representation).
- pc_cpumask and pc_other_cpus are target to be removed soon.
With the moving from cpumask_t to cpuset_t they are now inefficient
and not really useful. Anyway, for the time being, please note that
access to pcpu datas is protected by sched_pin() in order to avoid
migrating the CPU while reading more than one (possible) word
- Please note that size of cpuset_t objects may differ between kernel
and userland. While this is not directly related to the patch itself,
it is good to understand that concept and possibly use the patch
as a reference on how to deal with cpuset_t objects in userland, when
accessing kernland members.
- KTR_CPUMASK is changed and now is represented through a string, to be
set as the example reported in NOTES.

Please additively note that no MAXCPU is bumped in this patch, but
private testing has been done until to MAXCPU=128 on a real 8x8x2(htt)
machine (amd64).

Please note that the FreeBSD version is not yet bumped because of
the upcoming pcpu changes. However, note that this patch is not
targeted for MFC.

People to thank for the time spent on this patch:
- sbruno, pluknet and Nicholas Esborn (nick AT desert DOT net) tested
several revision of the patches and really helped in improving
stability of this work.
- marius fixed several bugs in the sparc64 implementation and reviewed
patches related to ktr.
- jeff and jhb discussed the basic approach followed.
- kib and marcel made targeted review on some specific part of the
patch.
- marius, art, nwhitehorn and andreast reviewed MD specific part of
the patch.
- marius, andreast, gonzo, nwhitehorn and jceel tested MD specific
implementations of the patch.
- Other people have made contributions on other patches that have been
already committed and have been listed separately.

Companies that should be mentioned for having participated at several
degrees:
- Yahoo! for having offered the machines used for testing on big
count of CPUs.
- The FreeBSD Foundation for having sponsored my devsummit attendance,
which has been instrumental.
- Sandvine for having offered offices and infrastructure during
development.

(I really hope I didn't forget anyone, if it happened I apologize in
advance).


222674 04-Jun-2011 andreast

- Improve error handling.
- Add a retry loop for the i2c sensor reading.
- Check on busy status of the chip and on invalid values.
- Fix a typo in a comment.
- Replace the constant 2732 with the ZERO_C_TO_K macro.

Approved by: nwhitehorn (mentor)


222673 04-Jun-2011 andreast

Replace the FCU_ZERO_C_TO_K with the ZERO_C_TO_K from powermac_thermal.h.

Approved by: nwhitehorn (mentor)


222658 03-Jun-2011 andreast

- Improve error handling.
- Add a retry loop for the i2c sensor reading.
- Update the sensor handling for sensors which do not have a location
entry. [1]

Submitted by: [1] Justin Hibbits.
Approved by: nwhitehorn (mentor)


222461 29-May-2011 nwhitehorn

Move the celsius-to-kelvin conversion to a place that powermac_thermal can
see it as well.


222458 29-May-2011 nwhitehorn

Update the I2C-based temperature/fan drivers to connect to the Powermac
thermal control module. This provides automatic fan management on all G5
PowerMacs and Xserves.


222449 29-May-2011 andreast

Add a new driver, the ad7417, to read temperatures and voltages on some
PowerMac's.

Approved by: nwhitehorn (mentor)


217560 18-Jan-2011 andreast

There are PowerMacs which do not have a hwsensor-location property
for this sensor. Instead of leaving this location empty we use here
the default name 'sensor'.

Submitted by: Justin Hibbits <chmeeedalf at gmail dot com>
Approved by: nwhitehorn (mentor)


217452 15-Jan-2011 andreast

Remove unused variable. Spotted by a cppcheck
(devel/cppcheck, http://sourceforge.net/projects/cppcheck) run.

Approved by: nwhitehorn (mentor)


216360 10-Dec-2010 andreast

On the Xserve G5 we find the LM75 instead of the DS1775. The core
functionality is the same, a difference is that the DS1775 has a better
precision than the LM75. But we do not use it in our setup. Make the
LM75 work the same as the DS1775.

Fix a typo in device_set_desc.

Tested by: Paul Mather <paul at gromit dlib vt edu>

Approved by: nwhitehorn (mentor)


214999 08-Nov-2010 nwhitehorn

Provide support for IIC_M_NOSTOP/IIC_M_NOSTART for bit-banging and
otherwise low-level controllers.

Reviewed by: thompsa


213904 15-Oct-2010 andreast

Add three new drivers for fan control and temperature reading on the
PowerMac7,2.

- The fcu driver lets us read and write the fan RPMs for all fans in the
PowerMac7,2. This driver is PowerMac specific.
- The ds1775 is a driver to read the temperature for the drive bay sensor.
- The max6690 is another driver to read temperatures. Here it is used to
read the inlet, the backside and the U3 heatsink temperature.

An additional driver, the ad7417, will follow later.

Thanks to nwhitehorn for guiding me through this driver development.

Approved by: nwhitehorn (mentor)


212413 10-Sep-2010 avg

bus_add_child: change type of order parameter to u_int

This reflects actual type used to store and compare child device orders.
Change is mostly done via a Coccinelle (soon to be devel/coccinelle)
semantic patch.
Verified by LINT+modules kernel builds.

Followup to: r212213
MFC after: 10 days


210998 07-Aug-2010 joel

Fix typo in comment.


209800 08-Jul-2010 nwhitehorn

Fix iicbus_get_addr() on 64-bit big-endian systems. The bus accessor
passes a uintptr_t, not a uint32_t.


209301 18-Jun-2010 nwhitehorn

Revert changes accidentally committed as part of r209298.


209298 18-Jun-2010 nwhitehorn

Provide for multiple, cascaded PICs on PowerPC systems, and extend the
OFW interrupt map interface to also return the device's interrupt parent.

MFC after: 8.1-RELEASE


208839 05-Jun-2010 nwhitehorn

Add two new flags (IIC_M_NOSTOP and IIC_M_NOSTART) to struct iic_msg to
allow consumers of iicbus_transfer() to send messages with repeated starts.

Reviewed by: imp


207554 03-May-2010 sobomax

Add new tunable 'net.link.ifqmaxlen' to set default send interface
queue length. The default value for this parameter is 50, which is
quite low for many of today's uses and the only way to modify this
parameter right now is to edit if_var.h file. Also add read-only
sysctl with the same name, so that it's possible to retrieve the
current value.

MFC after: 1 month


191369 21-Apr-2009 stas

- Rename ds1672 and ds133x devices to "ds1672_rtc" and "ds133x_rtc"
respectivly. This will allow one to have a kernel with both devices
present and use it for multiple boards with different types of RTC
sitting on a bus.

Discussed with: imp


191322 20-Apr-2009 stas

- Give a warning and start the oscillator if it was not previously
runned.
- Rename ds1672 -> rtc to follow the other drivers.
- Refactor/simplify the code a bit.

MFC after: 2 weeks


191148 16-Apr-2009 kmacy

Change if_output to take a struct route as its fourth argument in order
to allow passing a cached struct llentry * down to L2

Reviewed by: rwatson


188461 10-Feb-2009 imp

Fix iicbus_intr, iicbus_write and device_read_ivar prototypes...


187709 26-Jan-2009 raj

Teach iic(4) the 'repeated start' I2C condition. This will be used by the
upcoming i2c(8) diag utility.

Reviewed by: bms, stas
Obtained from: Semihalf


187457 20-Jan-2009 nwhitehorn

Change the probe priority for PCI and I2C generic bus modules from
numerical constants to BUS_PROBE_GENERIC.

Suggested by: jhb


187321 15-Jan-2009 nwhitehorn

Revert revision 186833 and try a different strategy to allow this device to
work when the bus attaches its own children. Instead of hardcoding a unit
number and returning BUS_PROBE_NOWILDCARD, which will break multiple iicbus
systems, check in the probe routine whether the device address is 0. Real
I2C devices will never have this address, but devices added with
BUS_ADD_CHILD() will.

Requested by: jhb
Reviewed by: jhb


187261 15-Jan-2009 nwhitehorn

Import an Open Firmware I2C bus module. This attaches firmware device tree
indicated I2C devices, and provides an ofw_bus interface for driver probing.
This should be MI, but is currently provided only on PowerPC due to lack of
sparc64 hardware with an I2C controller.

Discussed on: freebsd-arch


186833 06-Jan-2009 nwhitehorn

Change the way I2C bus attachment works to allow firmware-assisted bus
subclasses as are available with PCI. Changes I2C device drivers without
real probe logic to return BUS_PROBE_NOWILDWARD to avoid interference with
firmware bus enumeration, and reduces the probe priority of the iicbus
base driver to allow subclass attachment at higher priority.

Discussed on: freebsd-arch


183714 09-Oct-2008 peter

Clean out some empty mergeinfo records, presumably by people doing local
cp/mv operations. The full repo-relative URL should be specified for the
source in these cases.


182872 08-Sep-2008 raj

Streamline #include sections in ds133x and ds1672 drivers. This unbreaks the
LINT build.


182870 08-Sep-2008 raj

ds133x: Introduce device_identify method; update NOTES.

Obtained from: Semihalf


182034 23-Aug-2008 imp

Handle errors from device_get_chidlren.
Free child list when there's more children than we expected.


181682 13-Aug-2008 ed

Fix compilation of arm's AVILA.

Compilation of the AVILA kernel failed because of two reasons:

- It needed curthread, which is defined through <sys/pcpu.h>.

- It still referred the softc's sc_mtx field, which has been replaced by
sc_lock three weeks ago.

To solve the first problem, I decided to include <sys/pcpu.h> in
<sys/sx.h>, which also seems to be done by <sys/mutex.h> and
<sys/rwlock.h>. Those header files also require curthread.

Approved by: jhb


181602 11-Aug-2008 raj

Rework Dallas Semiconductor RTC support.

- Extend the DS1339 driver to recognize more chips in the family:
DS1337, DS1338, DS1339 are now supported
- Provide run-time chip detection

Reviewed, tested by: stas
Obtained from: Piotr Ziecik kosmo ! semihalf dot com


181601 11-Aug-2008 raj

Rename ds1339 -> ds133x to better fit the upcoming driver extensions.


181325 05-Aug-2008 stas

- Reflect the iicbus infrastructure changes.

Approved by: raj


181324 05-Aug-2008 stas

- Reflect changes in iic infrastructure.


181305 04-Aug-2008 jhb

Lock the consumers of the iicbus(4) infrastructure:
- ad7418(4) uses an sx lock instead of a mtx since the iicbus(4) stuff it
calls can sleep (request_bus()). Also, I expanded the locking slightly
to serialize writes to data stored in the softc.
- Similarly, the icee(4) driver now uses an sx lock instead of a mutex.
I also removed the pointless OPENED flag and flags field from the softc.
- The locking for the ic(4) driver was a bit trickier:
- Add a mutex to the softc to protect softc data.
- The driver uses malloc'd buffers that are the size of the interface
MTU to send and receive packets. Previously, these were allocated
every time the interface was brought up and anytime the MTU was
changed, with various races that could result in memory leaks. I
changed this to be a bit simpler and more like other NIC drivers in
that we allocate buffers during attach for the default MTU size and
only reallocate them on MTU changes. The reallocation procedure
goes to some lengths with various flags to not replace either the
the receive or transmit buffers while the driver is busy receiving
or transmitting a packet.
- Store the device_t of the driver in the softc instead of detours into
new-bus using if_dunit from the ifnet and an even more bizarre detour
to get the softc instead of using if_softc.
- Drop the driver mutex when invoking netisr_dispatch() to pass the
packet up to IP.
- Use if_printf().


181304 04-Aug-2008 jhb

Add locking to the core iicbus(4) drivers:
- Add an sx lock to the iic(4) driver to serialize open(), close(), read(),
and write and to protect sc_addr and sc_count in the softc.
- Use cdev->si_drv1 instead of using the minor number of the cdev to
lookup the softc via newbus in iic(4).
- Store the device_t in the softc to avoid a similar detour via minor
numbers in iic(4).
- Only add at most one instance of iic(4) and iicsmb(4) to each iicbus(4)
instance, and do it in the child driver.
- Add a mutex to the iicbus(4) softc to synchronize the request/release bus
stuff.
- Use __BUS_ACCESSOR() for IICBUS_ACCESSOR() instead of rolling our own.
- Add a mutex to the iicsmb(4) softc to protect softc state updated in the
interrupt handler.
- Remove Giant from all the smbus methods in iicsmb(4) now that all the
iicbus(4) backend is locked.


181303 04-Aug-2008 jhb

Add locking to the various iicbus(4) bridge drivers:
- Just grab Giant in the ixp425_iic(4) driver since this driver uses
a shared address/data register window pair to access the actual
I2C registers. None of the other ixp425 drivers lock access to these
shared address/data registers yet and that would need to be done before
this could use any meaningful locking.
- Add locking to the interrupt handler and 'iicbus_reset' methods of the
at91_twi(4) driver.
- Add locking to the pcf(4) driver. Other pcf(4) fixes include:
- Don't needlessly zero the softc.
- Use bus_foo rather than bus_space_foo and remove bus space tag and
handle from softc.
- The lpbb(4) driver just grabs Giant for now. This will be refined later
when ppbus(4) is locked.
- As was done with smbus earlier, move the DRIVER_MODULE() lines to match
the bus driver (either iicbus or iicbb) to the bridge driver into the
bridge drivers.

Tested by: sam (arm/ixp425)


180811 25-Jul-2008 stas

- Add driver for Dallas Semiconductor DS1339 RTC sitting
on I2C bus.

Reviewed by: raj
Approved by: imp
MFC after: 2 week


179624 06-Jun-2008 jhb

Explicitly lock Giant in smbus_if methods in the bktr_i2c and iicsmb
drivers for now. This can be replaced with driver locks when these
drivers are locked.


168806 17-Apr-2007 imp

Don't use spinlocks here. The iicbus transactions can take a long
time, and this prevents interrupts (say for Hz/hardclock) from
happening. Time stands still during the transfers...


167857 23-Mar-2007 imp

New device: icee. Generic i2c eeprom driver.


167856 23-Mar-2007 imp

MFp4: Make the iicbus fully hinted. We no longer automatically add
some devices (and not others). To get instances onto the iicbus, one
now needs hints or an identify routine. We also do not probe the bus
for devices because many iic devices cannot be safely probed (and when
they can, the probe order turns out to be somewhat difficult to get
right).

# I'm not 100% sure that the iicsmb removal is right. Please contact me if
# this causes difficulty.


167855 23-Mar-2007 imp

MFp4: Make iicbus_trasnfer_gen suitable for bridge drivers. Use it in the
bitbang bridge.


167854 23-Mar-2007 imp

MFp4: Create an ivar for each iic device on the iicbus. This ivar
holds the device's address.


164901 05-Dec-2006 imp

const poison

submitted by: john wehle


164900 05-Dec-2006 imp

More properly cleanup the iicbus child when deleting it.

These are from patches by John Wehle, but the commentary has been
updated by me.

Obtained from: ports/multimedia/pvr250, indirectly


164897 05-Dec-2006 imp

Reference Hauppage's cxm_iic bit-bang device here.
Add a note that suggests a cleanup.

Note: This patch was derived based on looking at the pvrxxx/pvr250
ports' Makefiles only, and may be incomplete. It is not derived from
anything I saw from Hauppage.


164714 28-Nov-2006 imp

Add a fake flag for write. Many drivers have started to use it and it
seems like a good idea.

Submitted by: sam


164704 28-Nov-2006 imp

Remove unused leftovers.


164502 22-Nov-2006 imp

MFp4: Add ixpiic bit-bang driver.

Submitted by: sam@


164501 22-Nov-2006 imp

<blush> copyout on read, not write.
Tweak a comment while I'm here.


164421 19-Nov-2006 sam

o define transfer method
o attach ds1672 and ad7418, to be cleaned up

MFC after: 1 month


164420 19-Nov-2006 sam

i2c and clock driver for Dallas Semiconductor DS1672 RTC

MFC after: 1 month


164419 19-Nov-2006 sam

i2c driver for Analog Devices AD7418

MFC after: 1 month


162234 11-Sep-2006 jhb

Minor overhaul of SMBus support:
- Change smbus_callback() to pass a void * rather than caddr_t.
- Change smbus_bread() to pass a pointer to the count and have it be an
in/out parameter. The input is the size of the buffer (same as before),
but on return it will contain the actual amount of data read back from
the bus. Note that this value may be larger than the input value. It
is up to the caller to treat this as an error if desired.
- Change the SMB_BREAD ioctl to write out the updated struct smbcmd which
will contain the actual number of bytes read in the 'count' field. To
preserve the previous ABI, the old ioctl value is mapped to SMB_OLD_BREAD
which doesn't copy the updated smbcmd back out to userland. I doubt anyone
actually used the old BREAD anyway as it was rediculous to do a bulk-read
but not tell the using program how much data was actually read.
- Make the smbus driver and devclass public in the smbus module and
push all the DRIVER_MODULE()'s for attaching the smbus driver to
various foosmb drivers out into the foosmb modules. This makes all
the foosmb logic centralized and allows new foosmb modules to be
self-contained w/o having to hack smbus.c everytime a new smbus driver
is added.
- Add a new SMB_EINVAL error bit and use it in place of EINVAL to return
an error for bad arguments (such as invalid counts for bread and bwrite).
- Map SMB bus error bits to EIO in smbus_error().
- Make the smbus driver call bus_generic_probe() and require child drivers
such as smb(4) to create device_t's via identify routines. Previously,
smbus just created one anonymous device during attach, and if you had
multiple drivers that could attach it was just random chance as to which
driver got to probe for the sole device_t first.
- Add a mutex to the smbus(4) softc and use it in place of dummy splhigh()
to protect the 'owner' field and perform necessary synchronization for
smbus_request_bus() and smbus_release_bus().
- Change the bread() and bwrite() methods of alpm(4), amdpm(4), and
viapm(4) to only perform a single transaction and not try to use a
loop of multiple transactions for a large request. The framing and
commands to use for a large transaction depend on the upper-layer
protocol (such as SSIF for IPMI over SMBus) from what I can tell, and the
smb(4) driver never allowed bulk read/writes of more than 32-bytes
anyway. The other smb drivers only performed single transactions.
- Fix buffer overflows in the bread() methods of ichsmb(4), alpm(4),
amdpm(4), amdsmb(4), intpm(4), and nfsmb(4).
- Use SMB_xxx errors in viapm(4).
- Destroy ichsmb(4)'s mutex after bus_generic_detach() to avoid problems
from child devices making smb upcalls that would use the mutex during
their detach methods.

MFC after: 1 week
Reviewed by: jmg (mostly)


162074 06-Sep-2006 imp

jhb points out that these mallocs don't need to be checked because
of M_WAITOK.


162072 06-Sep-2006 imp

MFp4: check the return value of malloc and report an error when invalid.


161516 21-Aug-2006 imp

Minor style(9) treatment to make things a little more consistant
within iicbus code.


160372 14-Jul-2006 imp

Allow iic bridges to support a generalized transfer, rather than
forcing all transfers to do the start read/write stop by hand. Some
smart bridges prefer this sort of operation, and this allows us to
support their features more easily. When bridges don't support it, we
fall back to using the old-style opertaions. Expand the ioctl
interface to expose this function. Unlike the old-style interface,
this interface is thread safe, even on old bridges.


157827 17-Apr-2006 jmg

remove DRIVER_MODULE lines that are useless... pcf doesn't exist (only
as pcf_ebus and pcf_isa, they should probably be fixed back to pcf),
and bti2c doesn't exist, bktr has smbus or iicbb as children..

Brought to you by: http://people.FreeBSD.org/~jmg/driver.pdf


157523 04-Apr-2006 imp

newbus will zero softc, so no need to duplicate the zeroing here.
Plus a minor formatting nit in nearby code.


157497 04-Apr-2006 imp

Turn a file that was mostly style(9) compliant to a file that's really close
to being completely style(9). The odd-ball indentation in a few places was
really distracting.


157482 04-Apr-2006 imp

Replace hard coded '0' with symbolic constant IIC_UNKNOWN to reflect what
we're actually doing.


148920 10-Aug-2005 obrien

Remove public declarations of variables that were forgotten when they were
made static.


148887 09-Aug-2005 rwatson

Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE and
IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to
ifnet.if_drv_flags. Device drivers are now responsible for
synchronizing access to these flags, as they are in if_drv_flags. This
helps prevent races between the network stack and device driver in
maintaining the interface flags field.

Many __FreeBSD__ and __FreeBSD_version checks maintained and continued;
some less so.

Reviewed by: pjd, bz
MFC after: 7 days


147611 26-Jun-2005 dwmalone

Fix some long standing bugs in writing to the BPF device attached to
a DLT_NULL interface. In particular:

1) Consistently use type u_int32_t for the header of a
DLT_NULL device - it continues to represent the address
family as always.
2) In the DLT_NULL case get bpf_movein to store the u_int32_t
in a sockaddr rather than in the mbuf, to be consistent
with all the DLT types.
3) Consequently fix a bug in bpf_movein/bpfwrite which
only permitted packets up to 4 bytes less than the MTU
to be written.
4) Fix all DLT_NULL devices to have the code required to
allow writing to their bpf devices.
5) Move the code to allow writing to if_lo from if_simloop
to looutput, because it only applies to DLT_NULL devices
but was being applied to other devices that use if_simloop
possibly incorrectly.

PR: 82157
Submitted by: Matthew Luckie <mjl@luckie.org.nz>
Approved by: re (scottl)


147256 10-Jun-2005 brooks

Stop embedding struct ifnet at the top of driver softcs. Instead the
struct ifnet or the layer 2 common structure it was embedded in have
been replaced with a struct ifnet pointer to be filled by a call to the
new function, if_alloc(). The layer 2 common structure is also allocated
via if_alloc() based on the interface type. It is hung off the new
struct ifnet member, if_l2com.

This change removes the size of these structures from the kernel ABI and
will allow us to better manage them as interfaces come and go.

Other changes of note:
- Struct arpcom is no longer referenced in normal interface code.
Instead the Ethernet address is accessed via the IFP2ENADDR() macro.
To enforce this ac_enaddr has been renamed to _ac_enaddr.
- The second argument to ether_ifattach is now always the mac address
from driver private storage rather than sometimes being ac_enaddr.

Reviewed by: sobomax, sam


139749 06-Jan-2005 imp

Start each of the license/copyright comments with /*-, minor shuffle of lines


133690 13-Aug-2004 rwatson

Since if_ic doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.


130585 16-Jun-2004 phk

Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.


129778 27-May-2004 joerg

Make "envctrl" a known master driver for iicbus.


129291 16-May-2004 joerg

Another candidate that didn't use copyin/copyout for user<->kernel
transfers.

MFC after: 1 month


129289 16-May-2004 joerg

After successfully attaching an iicbus instance, instead of using a
NULL name in device_add_child(), explicitly name all of our known
child drivers in order to give them a chance to attach to us.
Otherwise, only the first one present would be probed and attached.

Reviewed by: nsouch
MFC after: 1 month


129152 12-May-2004 joerg

Convert the #if 0 magic to #if SCAN_IICBUS, and make it actually compile
again. While it's not generally recommended anymore, it might still prove
useful for debugging purposes.


126080 21-Feb-2004 phk

Device megapatch 4/6:

Introduce d_version field in struct cdevsw, this must always be
initialized to D_VERSION.

Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing
four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.


126076 21-Feb-2004 phk

Device megapatch 1/6:

Free approx 86 major numbers with a mostly automatically generated patch.

A number of strategic drivers have been left behind by caution, and a few
because they still (ab)use their major number.


123922 28-Dec-2003 sam

o eliminate widespread on-stack mbuf use for bpf by introducing
a new bpf_mtap2 routine that does the right thing for an mbuf
and a variable-length chunk of data that should be prepended.
o while we're sweeping the drivers, use u_int32_t uniformly when
when prepending the address family (several places were assuming
sizeof(int) was 4)
o return M_ASSERTVALID to BPF_MTAP* now that all stack-allocated
mbufs have been eliminated; this may better be moved to the bpf
routines

Reviewed by: arch@ and several others


121816 31-Oct-2003 brooks

Replace the if_name and if_unit members of struct ifnet with new members
if_xname, if_dname, and if_dunit. if_xname is the name of the interface
and if_dname/unit are the driver name and instance.

This change paves the way for interface renaming and enhanced pseudo
device creation and configuration symantics.

Approved By: re (in principle)
Reviewed By: njl, imp
Tested On: i386, amd64, sparc64
Obtained From: NetBSD (if_xname)


119418 24-Aug-2003 obrien

Use __FBSDID().
Also some minor style cleanups.


118728 10-Aug-2003 ticso

Don't hardcode unit numer '0'.
We can have multiple instances.


116559 19-Jun-2003 jmg

make iicbb_devclass and iicbb_driver globally visible. This will let
drivers that implemnt the i2c bit banging bus interface not have to
recompile iicbb in order to add an attachment for it.

This will mean the bktr and other definitions can go back to their
respective drivers.


111888 04-Mar-2003 jlemon

Update netisr handling; Each SWI now registers its queue, and all queue
drain routines are done by swi_net, which allows for better queue control
at some future point. Packets may also be directly dispatched to a netisr
instead of queued, this may be of interest at some installations, but
currently defaults to off.

Reviewed by: hsu, silby, jayanth, sam
Sponsored by: DARPA, NAI Labs


111815 03-Mar-2003 phk

Gigacommit to improve device-driver source compatibility between
branches:

Initialize struct cdevsw using C99 sparse initializtion and remove
all initializations to default values.

This patch is automatically generated and has been tested by compiling
LINT with all the fields in struct cdevsw in reverse order on alpha,
sparc64 and i386.

Approved by: re(scottl)


111119 19-Feb-2003 imp

Back out M_* changes, per decision of the TRB.

Approved by: trb


109623 21-Jan-2003 alfred

Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.


106937 14-Nov-2002 sam

network interface driver changes:

o don't strip the Ethernet header from inbound packets; pass packets
up the stack intact (required significant changes to some drivers)
o reference common definitions in net/ethernet.h (e.g. ETHER_ALIGN)
o track ether_ifattach/ether_ifdetach API changes
o track bpf changes (use BPF_TAP and BPF_MTAP)
o track vlan changes (ifnet capabilities, revised processing scheme, etc.)
o use if_input to pass packets "up"
o call ether_ioctl for default handling of ioctls

Reviewed by: many
Approved by: re


105214 16-Oct-2002 phk

Fix misindentation.

Spotted by: FlexeLint


103588 19-Sep-2002 peter

move <machine/iic.h> and <machine/smb.h> to <dev/iicbus/iic.h> and
<dev/smbus/smb.h> - there is nothing MD about these ioctl definitions.


93023 23-Mar-2002 nsouch

Major rework of the iicbus/smbus framework:

- VIA chipset SMBus controllers added
- alpm driver updated
- Support for dynamic modules added
- bktr FreeBSD smbus updated but not tested
- cleanup


87599 10-Dec-2001 obrien

Update to C99, s/__FUNCTION__/__func__/,
also don't use ANSI string concatenation.


83366 12-Sep-2001 julian

KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after: ha ha ha ha


74810 26-Mar-2001 phk

Send the remains (such as I have located) of "block major numbers" to
the bit-bucket.


69152 25-Nov-2000 jlemon

Lock down the network interface queues. The queue mutex must be obtained
before adding/removing packets from the queue. Also, the if_obytes and
if_omcasts fields should only be manipulated under protection of the mutex.

IF_ENQUEUE, IF_PREPEND, and IF_DEQUEUE perform all necessary locking on
the queue. An IF_LOCK macro is provided, as well as the old (mutex-less)
versions of the macros in the form _IF_ENQUEUE, _IF_QFULL, for code which
needs them, but their use is discouraged.

Two new macros are introduced: IF_DRAIN() to drain a queue, and IF_HANDOFF,
which takes care of locking/enqueue, and also statistics updating/start
if necessary.


67882 29-Oct-2000 phk

Remove unneeded #include <sys/proc.h> lines.


67164 15-Oct-2000 phk

Remove unneeded #include <machine/clock.h>


61722 16-Jun-2000 jake

Allow these drivers to be detached.

Reviewed by: mdodd


59760 29-Apr-2000 phk

Remove unneeded #include <sys/kernel.h>


59391 19-Apr-2000 phk

Remove ~25 unneeded #include <sys/conf.h>
Remove ~60 unneeded #include <sys/malloc.h>


59368 18-Apr-2000 phk

Remove unneeded <sys/buf.h> includes.

Due to some interesting cpp tricks in lockmgr, the LINT kernel shrinks
by 924 bytes.


59093 08-Apr-2000 dfr

* Factor out the object system from new-bus so that it can be used by
non-device code.
* Re-implement the method dispatch to improve efficiency. The new system
takes about 40ns for a method dispatch on a 300Mhz PII which is only
10ns slower than a direct function call on the same hardware.

This changes the new-bus ABI slightly so make sure you re-compile any
driver modules which you use.


55205 29-Dec-1999 peter

Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"
is an application space macro and the applications are supposed to be free
to use it as they please (but cannot). This is consistant with the other
BSD's who made this change quite some time ago. More commits to come.


54073 03-Dec-1999 mdodd

Remove the 'ivars' arguement to device_add_child() and
device_add_child_ordered(). 'ivars' may now be set using the
device_set_ivars() function.

This makes it easier for us to change how arbitrary data structures are
associated with a device_t. Eventually we won't be modifying device_t
to add additional pointers for ivars, softc data etc.

Despite my best efforts I've probably forgotten something so let me know
if this breaks anything. I've been running with this change for months
and its been quite involved actually isolating all the changes from
the rest of the local changes in my tree.

Reviewed by: peter, dfr


53329 18-Nov-1999 peter

Convert iic to use make_dev() rather than cdevsw_add(). This stops the
annoying 'iic is usurping iic's cdevsw' type messages. (Yes, there are
other ways to fix cdevsw_add(), but that is a doomed api)


53005 08-Nov-1999 peter

Use cdevsw_add() explicitly and DRIVER_MODULE().


52776 01-Nov-1999 nsouch

Sync with RELENG_3.


51936 04-Oct-1999 peter

Fix: WARNING: "iic" is usurping "iic"'s cdevsw[] - the DEV_DRIVER_MODULE()
takes care of the cdevsw_add() - it doesn't need to be done twice.


51658 25-Sep-1999 phk

Remove five now unused fields from struct cdevsw. They should never
have been there in the first place. A GENERIC kernel shrinks almost 1k.

Add a slightly different safetybelt under nostop for tty drivers.

Add some missing FreeBSD tags


51646 25-Sep-1999 phk

Remove NBPF conditionality of bpf calls in most of our network drivers.

This means that we will not have to have a bpf and a non-bpf version
of our driver modules.

This does not open any security hole, because the bpf core isn't loadable

The drivers left unchanged are the "cross platform" drivers where the respective
maintainers are urged to DTRT, whatever that may be.

Add a couple of missing FreeBSD tags.


50477 28-Aug-1999 peter

$Id$ -> $FreeBSD$


49195 29-Jul-1999 mdodd

Alter the behavior of sys/kern/subr_bus.c:device_print_child()

- device_print_child() either lets the BUS_PRINT_CHILD
method produce the entire device announcement message or
it prints "foo0: not found\n"

Alter sys/kern/subr_bus.c:bus_generic_print_child() to take on
the previous behavior of device_print_child() (printing the
"foo0: <FooDevice 1.1>" bit of the announce message.)

Provide bus_print_child_header() and bus_print_child_footer()
to actually print the output for bus_generic_print_child().
These functions should be used whenever possible (unless you can
just use bus_generic_print_child())

The BUS_PRINT_CHILD method now returns int instead of void.

Modify everything else that defines or uses a BUS_PRINT_CHILD
method to comply with the above changes.

- Devices are 'on' a bus, not 'at' it.
- If a custom BUS_PRINT_CHILD method does the same thing
as bus_generic_print_child(), use bus_generic_print_child()
- Use device_get_nameunit() instead of both
device_get_name() and device_get_unit()
- All BUS_PRINT_CHILD methods return the number of
characters output.

Reviewed by: dfr, peter


48645 06-Jul-1999 des

Rename bpfilter to bpf.


48557 04-Jul-1999 phk

Remove cmaj and bmaj args from DEV_DRIVER_MODULE.


47640 31-May-1999 phk

Simplify cdevsw registration.

The cdevsw_add() function now finds the major number(s) in the
struct cdevsw passed to it. cdevsw_add_generic() is no longer
needed, cdevsw_add() does the same thing.

cdevsw_add() will print an message if the d_maj field looks bogus.

Remove nblkdev and nchrdev variables. Most places they were used
bogusly. Instead check a dev_t for validity by seeing if devsw()
or bdevsw() returns NULL.

Move bdevsw() and devsw() functions to kern/kern_conf.c

Bump __FreeBSD_version to 400006

This commit removes:
72 bogus makedev() calls
26 bogus SYSINIT functions

if_xe.c bogusly accessed cdevsw[], author/maintainer please fix.

I4b and vinum not changed. Patches emailed to authors. LINT
probably broken until they catch up.


47625 30-May-1999 phk

This commit should be a extensive NO-OP:

Reformat and initialize correctly all "struct cdevsw".

Initialize the d_maj and d_bmaj fields.

The d_reset field was not removed, although it is never used.

I used a program to do most of this, so all the files now use the
same consistent format. Please keep it that way.

Vinum and i4b not modified, patches emailed to respective authors.


46792 09-May-1999 phk

Unconfuse DEV_MODULE() and DEV_DRIVER_MODULE() about the difference between
a major number for a dev_t.


46743 08-May-1999 dfr

Move the declaration of the interrupt type from the driver structure
to the BUS_SETUP_INTR call.


46635 07-May-1999 phk

Continue where Julian left off in July 1998:

Virtualize bdevsw[] from cdevsw. bdevsw() is now an (inline)
function.

Join CDEV_MODULE and BDEV_MODULE to DEV_MODULE (please pay attention
to the order of the cmaj/bmaj arguments!)

Join CDEV_DRIVER_MODULE and BDEV_DRIVER_MODULE to DEV_DRIVER_MODULE
(ditto!)

(Next step will be to convert all bdev dev_t's to cdev dev_t's
before they get to do any damage^H^H^H^H^H^Hwork in the kernel.)


45575 11-Apr-1999 eivind

Staticize.


43976 13-Feb-1999 nsouch

Handle correctly iicbus request/release mechanism. Add iicbus allocation
to the general purpose i/o iic(4) driver.


43714 06-Feb-1999 roger

Changed to use IICBUS_REPEATED_START

Submitted by: Changed to use IICBUS_REPEATED_START


43347 28-Jan-1999 roger

Submitted by: Nicolas Souchu <nsouch@freebsd.org>

Updated to support bt848 driver and MSP3400 audio chip.
This adds changes made in 1.4.2.1 and 1.4.2.2 from RELENG_3


43346 28-Jan-1999 roger

Submitted by: Nicolas Souchu <nsouch@freebsd.org>

Updated to support bt848 driver MSP34xx audio chip.
This adds changes made in 1.3.2.1 and 1.3.2.2 from RELENG_3


43345 28-Jan-1999 roger

Submitted by: Nicolas Souchu <nsouch@freebsd.org>

Added support required by bt848 driver for MSP34xx audio chip


43301 27-Jan-1999 dillon

Fix warnings in preparation for adding -Wall -Wcast-qual to the
kernel compile


42442 09-Jan-1999 nsouch

Change /dev/smb and /dev/iic interface to allow user programs to interact with
devices dynamically. That means,

+ only one /dev/iic or /dev/smb device for each smb/iic bus to access
+ I2C/SMB device address must be given to any ioctl
+ new devices may be plugged and accessed after boot, which was
impossible previously (device addresses were hardcoded into
the kernel)


41591 07-Dec-1998 archie

The "easy" fixes for compiling the kernel -Wunused: remove unreferenced static
and local variables, goto labels, and functions declared but not defined.


41296 22-Nov-1998 nsouch

Remove broken and useless intr interface.

Submitted by: Doug Rabson <dfr@nlsystems.com>
Amancio Hasty <hasty@rah.star-gate.com>

Avoid compile warnings.


41015 08-Nov-1998 nsouch

Check if devclass exists for probed devices before
declaring the device 'alive'.


41012 08-Nov-1998 nsouch

Add semicolon to INTERFACE declarations


40992 07-Nov-1998 nsouch

Add iic driver iff the corresponding devclass exists.


40914 04-Nov-1998 nsouch

Properly reset parent to get interface addr.


40782 31-Oct-1998 nsouch

iicbb is generic support for I2C bit-banging.

Other files: timeout management added to the I2C framework.


39023 09-Sep-1998 nsouch

Major number allocated for generic I2C i/o -> 105


38813 04-Sep-1998 nsouch

Device registration temporaly removed until major number allocation ok.


38780 03-Sep-1998 nsouch

Reviewed by: Doug Rabson
Submitted by: nsouch
I2C and SMB ioctls


38775 03-Sep-1998 nsouch

This commit was generated by cvs2svn to compensate for changes in r38774,
which included commits to RCS files with non-trunk default branches.