Home | History | Annotate | Download | only in obio
History log of /src/sys/arch/mac68k/obio/iwm_fd.c
RevisionDateAuthorComments
 1.62  06-Aug-2025  hauke Sync the iwm_match() code with the comments (and intentions), and fix
the conditions to match the right machines.

For matched hardware, we set IWMBase and break out of the case block; the
default is no match.
 1.61  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.60  13-May-2021  hauke branches: 1.60.4;
We do not match machines whose SWIM does not support the IWM register
set used by this driver (SWIM II/III, SWIM behind IOP, AV models' DMA
based controllers). Unfortunately, this distinction does not run
cleanly along MACH_CLASS* lines, and we have to look at MACH_MAC{model} tags.
 1.59  24-Apr-2021  thorpej branches: 1.59.2; 1.59.4;
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.58  19-Dec-2020  thorpej branches: 1.58.2;
malloc(9) -> kmem(9)
 1.57  12-Nov-2019  msaitoh branches: 1.57.8;
Add missing initialization of sc_dev.
 1.56  26-Apr-2015  mlelstv branches: 1.56.10; 1.56.18; 1.56.22;
Use C99-style initializers for struct dkdriver.
 1.55  03-Jan-2015  christos fix typo
 1.54  02-Jan-2015  christos We have three sets of DTYPE_ constants in the kernel:
altq Drop Type
disklabel Disk Type
file Descriptor Type
(not to mention constants that contain the string DTYPE).
Let's make them two, by changing the disklabel one to be DisK TYPE since the
other disklabel constants seem to do that. Not many userland programs use
these constants (and the ones that they do are mostly in ifdefs). They will
be fixed shortly.
 1.53  02-Jan-2015  christos name the flag ioctl argument "flag" like most other drivers.
 1.52  01-Jan-2015  christos declare error
 1.51  31-Dec-2014  christos make more drivers use disk_ioctl, and add a dev parameter to it so that
we can merge the "easy" disklabel ioctls to it. Ultimately all this will
go do dk_ioctl once all the drivers have been converted.
 1.50  25-Jul-2014  dholland branches: 1.50.4;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.49  25-Jul-2014  dholland Add d_discard to all struct bdevsw instances I could find.

I've set them all to nodiscard. Some of them (wd, dk, vnd, ld,
raidframe, maybe cgd) should be implemented for real.
 1.48  16-Mar-2014  dholland branches: 1.48.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.47  27-Oct-2012  chs branches: 1.47.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.46  13-Jan-2009  yamt branches: 1.46.14; 1.46.24;
g/c BUFQ_FOO() macros and use bufq_foo() directly.
 1.45  11-Jan-2009  oster Deal with new dev_t build lossage. Fix from lukem.
 1.44  12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.43  15-Jun-2008  tsutsui branches: 1.43.2; 1.43.4;
Don't pass fdUnit to lookup softc of iwm. It's a parent of fd, not fd itself.
 1.42  13-Jun-2008  cegger use device_lookup_private to get softc
 1.41  26-May-2008  hauke branches: 1.41.2;
Switch files I authored to two-clause BSD license.
 1.40  17-Oct-2007  garbled branches: 1.40.16; 1.40.18; 1.40.20; 1.40.22;
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.39  08-Oct-2007  ad Merge disk init changes from the vmlocking branch. These seperate init /
destroy of 'struct disk' from attach / detach.
 1.38  29-Jul-2007  ad branches: 1.38.4; 1.38.6; 1.38.8;
It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.37  09-Jul-2007  ad branches: 1.37.2; 1.37.4;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.36  04-Mar-2007  christos branches: 1.36.2; 1.36.4; 1.36.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.35  11-Dec-2005  christos branches: 1.35.26;
merge ktrace-lwp.
 1.34  15-Oct-2005  yamt - change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
from sys/bufq.h to sys/bufq_impl.h.
(is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c. (not tested)
 1.33  16-Jun-2005  jmc branches: 1.33.2;
Shadowing and const fixes.
 1.32  16-Jan-2005  chs branches: 1.32.2;
handle lack of locators in LKM context differently.
 1.31  15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.30  15-Dec-2004  jmc If LKM deal w. locators different
 1.29  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.28  28-Oct-2004  yamt move buffer queue related stuffs from buf.h to their own header, bufq.h.
 1.27  22-Sep-2004  yamt fix printf formats to match with sys/buf.h 1.75.
 1.26  13-Sep-2004  drochner use config_found() instead of config_found_sm() if no submatch
function is used
 1.25  27-Oct-2003  fredb Initialize some "might (not) be used uninitialized" variables.
 1.24  15-Jul-2003  lukem __KERNEL_RCSID()
 1.23  02-May-2003  dsl branches: 1.23.2;
Change return type of readdisklabel() to const char *
I hope I've found all the correct places!
 1.22  03-Feb-2003  jdolecek attempt to fix compilationg errors for printf formats due to 64bit daddr_t
adresses PR port-mac68k/20188 by Hauke Fath
 1.21  06-Jan-2003  wiz writable, not writeable.
 1.20  01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.19  01-Nov-2002  mrg implement separate read/write disk statistics:
- disk_unbusy() gets a new parameter to tell the IO direction.
- struct disk_sysctl gets 4 new members for read/write bytes/transfers.
when processing hw.diskstats, add the read&write bytes/transfers for
the old combined stats to attempt to keep backwards compatibility.

unfortunately, due to multiple bugs, this will cause new kernels and old
vmstat/iostat/systat programs to fail. however, the next time this is
change it will not fail again.

this is just the kernel portion.
 1.18  23-Oct-2002  jdolecek merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.17  02-Oct-2002  jdolecek remove local declaration of iwm_cd and fd_cd for LKM case; it's superfluous
and doesn't even compile after latest autoconf changes
 1.16  02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.15  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.14  06-Sep-2002  gehenna make this compile with _LKM.
 1.13  06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.12  29-Aug-2002  hannken Convert to new device buffer queue interface.

Tested with help from Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
on Performa 600 and Quadra 700.
 1.11  27-May-2000  jdolecek branches: 1.11.6; 1.11.8; 1.11.12; 1.11.20;
fix prototype for fd_mod_free() - should fix port-mac68k/10063
 1.10  19-May-2000  thorpej A foolish consistency; most parts of the kernel use bp->b_data, so
change these from bp->b_un.b_addr to bp->b_data, as well. This also
allows us more flexibility to experiment with other data buffer types
hung off of struct buf.
 1.9  05-Apr-2000  jdolecek LKM fixes:
* fix a typo in callout_stop() call
* prototype fd_mod_init(), fd_mod_free() to avoid warnings
* include iwm_mod.h

Fix sent in port-mac68k/9787 by Dave Huang.
 1.8  23-Mar-2000  thorpej New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.7  24-Feb-2000  scottr Turn off some noise during autoconfig on the IIfx/Q9x0, making it
conditional on the TRACE_CONFIG debugging flag.
 1.6  07-Feb-2000  thorpej Fix a bug in disksort_*() which caused non-optimal ordering when multiple
active partitions were on a single spindle. Add a b_rawblkno member to
struct buf which contains the non-partition-relative block number to sort
by.
 1.5  27-Jan-2000  ender Fix PR 9302. Fix provided by Hauke Fath (hauke@Espresso.Rhein-Neckar.DE).
 1.4  21-Jan-2000  thorpej Update for sys/buf.h/disksort_*() changes.
 1.3  25-Oct-1999  kleink Wrap an otherwise unused variable inside #ifdef DIAGNOSTIC; from Ben Mesander
in PR port-mac68k/8513.
 1.2  27-Mar-1999  scottr branches: 1.2.8; 1.2.10; 1.2.12;
Update from Hauke to resolve some relatively severe performance problems.
 1.1  18-Feb-1999  scottr branches: 1.1.2;
First cut at a floppy disk device driver, for IWM and IWM-compatible
controllers. Supports GCR-encoded disks only (400K and 800K); neither
of the 1.44M formats will work until someone figures out how to drive
the SWIM and its descendants.

This code was written by Hauke Fath, and had only minor touchup (mostly
KNF) by me.
 1.1.2.4  13-Feb-2000  scottr Sync with main branch.
 1.1.2.3  06-Feb-2000  scottr Sync with main branch.
 1.1.2.2  01-Nov-1999  scottr Sync with main branch.
 1.1.2.1  16-May-1999  scottr Sync with main branch.
 1.2.12.2  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.12.1  21-Dec-1999  wrstuden Initial commit of recent changes to make DEV_BSIZE go away.

Runs on i386, needs work on other arch's. Main kernel routines should be
fine, but a number of the stand programs need help.

cd, fd, ccd, wd, and sd have been updated. sd has been tested with non-512
byte block devices. vnd, raidframe, and lfs need work.

Non 2**n block support is automatic for LKM's and conditional for kernels
on "options NON_PO2_BLOCKS".
 1.2.10.1  15-Nov-1999  fvdl Sync with -current
 1.2.8.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.11.20.2  31-Aug-2002  gehenna catch up with -current.
 1.11.20.1  17-May-2002  gehenna Add device switch.
 1.11.12.5  07-Jan-2003  thorpej Sync with HEAD.
 1.11.12.4  03-Jan-2003  thorpej Sync with HEAD.
 1.11.12.3  11-Nov-2002  nathanw Catch up to -current
 1.11.12.2  18-Oct-2002  nathanw Catch up to -current.
 1.11.12.1  17-Sep-2002  nathanw Catch up to -current.
 1.11.8.2  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.11.8.1  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.11.6.1  10-Oct-2001  fvdl Convert all remaining devices.
 1.23.2.9  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.23.2.8  25-Jan-2005  skrll Adapt to branch.
 1.23.2.7  17-Jan-2005  skrll Sync with HEAD.
 1.23.2.6  18-Dec-2004  skrll Sync with HEAD.
 1.23.2.5  02-Nov-2004  skrll Sync with HEAD.
 1.23.2.4  24-Sep-2004  skrll Sync with HEAD.
 1.23.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.23.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.23.2.1  03-Aug-2004  skrll Sync with HEAD
 1.32.2.2  16-Jan-2005  chs handle lack of locators in LKM context differently.
 1.32.2.1  16-Jan-2005  chs file iwm_fd.c was added on branch kent-audio2 on 2005-01-16 00:32:04 +0000
 1.33.2.3  27-Oct-2007  yamt sync with head.
 1.33.2.2  03-Sep-2007  yamt sync with head.
 1.33.2.1  21-Jun-2006  yamt sync with head.
 1.35.26.1  12-Mar-2007  rmind Sync with HEAD.
 1.36.10.2  16-Oct-2007  garbled Sync with HEAD
 1.36.10.1  03-Oct-2007  garbled Sync with HEAD
 1.36.4.1  11-Jul-2007  mjf Sync with head.
 1.36.2.3  20-Aug-2007  ad - Alter disk attach/detach to fix a panic when closing a vnd device.
- Sync with HEAD.
 1.36.2.2  19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.36.2.1  15-Jul-2007  ad Sync with head.
 1.37.4.1  15-Aug-2007  skrll Sync with HEAD.
 1.37.2.1  07-Aug-2007  matt Sync with HEAD.
 1.38.8.1  14-Oct-2007  yamt sync with head.
 1.38.6.1  06-Nov-2007  matt sync with HEAD
 1.38.4.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.40.22.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.40.20.1  04-May-2009  yamt sync with head.
 1.40.18.2  17-Jun-2008  yamt sync with head.
 1.40.18.1  04-Jun-2008  yamt sync with head
 1.40.16.3  17-Jan-2009  mjf Sync with HEAD.
 1.40.16.2  29-Jun-2008  mjf Sync with HEAD.
 1.40.16.1  02-Jun-2008  mjf Sync with HEAD.
 1.41.2.1  18-Jun-2008  simonb Sync with head.
 1.43.4.1  19-Jan-2009  skrll Sync with HEAD.
 1.43.2.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.46.24.3  03-Dec-2017  jdolecek update from HEAD
 1.46.24.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.46.24.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.46.14.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.46.14.1  30-Oct-2012  yamt sync with head
 1.47.2.1  18-May-2014  rmind sync with head
 1.48.2.1  10-Aug-2014  tls Rebase.
 1.50.4.2  06-Jun-2015  skrll Sync with HEAD
 1.50.4.1  06-Apr-2015  skrll Sync with HEAD
 1.56.22.1  14-Nov-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #425):

sys/dev/sbus/sio16.c: revision 1.25
sys/dev/gpib/mt.c: revision 1.33
sys/arch/mvme68k/dev/wdsc.c: revision 1.33
sys/dev/gpib/ct.c: revision 1.31
sys/dev/isa/mcd.c: revision 1.119
sys/dev/pci/if_stge.c: revision 1.73
sys/dev/gpib/ppi.c: revision 1.25
sys/dev/pcmcia/if_tr_pcmcia.c: revision 1.29
sys/arch/amiga/dev/zssc.c: revision 1.46
sys/arch/mac68k/obio/iwm_fd.c: revision 1.57
sys/arch/amiga/dev/if_qn.c: revision 1.48
sys/dev/isa/tcic2_isa.c: revision 1.28
sys/dev/isa/uha_isa.c: revision 1.42
sys/dev/pci/neo.c: revision 1.55
sys/arch/next68k/dev/nextdisplay.c: revision 1.22
sys/dev/isa/if_iy.c: revision 1.111

Add missing initialization of sc_dev.

Initialize sc_dev correctly to avoid null pointer dereference when
bus_space_map() failed.

Add missing initialization of sc_dev.
 1.56.18.1  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.56.10.1  14-Nov-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1439):

sys/dev/sbus/sio16.c: revision 1.25
sys/dev/gpib/mt.c: revision 1.33
sys/arch/mvme68k/dev/wdsc.c: revision 1.33
sys/dev/gpib/ct.c: revision 1.31
sys/dev/isa/mcd.c: revision 1.119
sys/dev/pci/if_stge.c: revision 1.73
sys/dev/gpib/ppi.c: revision 1.25
sys/dev/pcmcia/if_tr_pcmcia.c: revision 1.29
sys/arch/amiga/dev/zssc.c: revision 1.46
sys/arch/mac68k/obio/iwm_fd.c: revision 1.57
sys/arch/amiga/dev/if_qn.c: revision 1.48
sys/dev/isa/tcic2_isa.c: revision 1.28
sys/dev/isa/uha_isa.c: revision 1.42
sys/dev/pci/neo.c: revision 1.55
sys/arch/next68k/dev/nextdisplay.c: revision 1.22
sys/dev/isa/if_iy.c: revision 1.111

Add missing initialization of sc_dev.


Initialize sc_dev correctly to avoid null pointer dereference when
bus_space_map() failed.


Add missing initialization of sc_dev.
 1.57.8.1  03-Jan-2021  thorpej Sync w/ HEAD.
 1.58.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.59.4.1  31-May-2021  cjep sync with head
 1.59.2.1  17-Jun-2021  thorpej Sync w/ HEAD.
 1.60.4.1  04-Aug-2021  thorpej Adapt to CFARGS().

RSS XML Feed