Home | History | Annotate | Download | only in dev
History log of /src/sys/arch/atari/dev/wdc_mb.c
RevisionDateAuthorComments
 1.43  20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h> include.
 1.42  06-Jan-2023  tsutsui TAB/spaces/indents cleanup.
 1.41  29-Jun-2019  tsutsui Make local functions static.
 1.40  20-Oct-2017  jdolecek branches: 1.40.4;
move ata_queue_alloc(1) and ata_queue_free() calls to ata_channel_init()
and ata_channel_destroy() respectively, to make attachment code simpler,
and to make it easier to spot special queue manipulation like cmdide(4)

on topic of PR kern/52606
 1.39  07-Oct-2017  jdolecek Merge support for SATA NCQ (Native Command Queueing) from jdolecek-ncq branch

ATA subsystem was changed to support several outstanding commands, and use
NCQ xfers if supported by both the controller and the disk, including NCQ
error recovery. Set NCQ high priority for BPRIO_TIMECRITICAL xfers
if supported. Added FUA support.

Done some work towards MP-safe, all ATA code tsleep()/wakeup() replaced
by condvars, and switched most code from spl* to mutexes (separate
wd(4) and ata channel lock).

Introduced new option WD_CHAOS_MONKEY to facilitate testing of error
handling, fixed several uncovered issues. Also fixed several problems
with kernel dump to wd(4) disk.

Tested with ahcisata(4), mvsata(4), siisata(4), piixide(4) on amd64,
with and without port multiplier, both disk and ATAPI devices; other
drivers and archs mechanically adjusted and compile-tested. NCQ is
supported for ahcisata(4) and siisata(4) for any controller, for
mvsata(4) only Gen IIe ones for now. Also enabled ATAPI support in
mvsata(4).

Thanks to Matt Thomas for initial ATA infrastructure patch, and
Jonathan A.Kollasch for siisata(4) NCQ changes and general testing.

Also fixes PR kern/43169 (wd(4)); and PR kern/11811, PR kern/47041,
PR kern/51979 (kernel dump)
 1.38  31-Jul-2012  bouyer branches: 1.38.2; 1.38.28;
Apply back changes that were reverted on Jul 24 and Jul 26 (general ata/wdc
cleanup and SATA PMP support), now that I'm back to fix the fallouts.
 1.37  26-Jul-2012  jakllsch Revert, with intention of restoring in a less invasive way, the SATA Port
Multiplier code.

ok christos@
 1.36  02-Jul-2012  bouyer Add sata Port MultiPlier (PMP) support to the ata bus layer,
as described in
http://mail-index.netbsd.org/tech-kern/2012/06/23/msg013442.html
PMP support in integrated to the atabus layer.
struct ata_channel's ch_drive[] is not dynamically allocated, and ch_ndrive
(renamed to ch_ndrives) closely reflects the size of the ch_drive[] array.
Add helper functions atabus_alloc_drives() and atabus_free_drives()
to manage ch_drive[]/ch_ndrives.
Add wdc_maxdrives to struct wdc_softc so that bus front-end can specify
how much drive they really support (master/slave or single).
ata_reset_drive() callback gains a uint32_t *sigp argument which,
when not NULL, will contain the signature of the device being reset.
While there, some cosmetic changes:
- added a drive_type enum to ata_drive_datas, and stop encoding the
probed drive type in drive_flags (we were out of drive flags anyway).
- rename DRIVE_ATAPIST to DRIVE_ATAPIDSCW to better reflect what this
really is
- remove ata_channel->ata_drives, it's redundant with the pointer in
ata_drive_datas
- factor out the interpretation of SATA signatures in sata_interpet_sig()

propagate these changes to the ATA HBA drivers, and add support for PMP
to ahcisata(4) and siisata(4).

Thanks to:
- Protocase (http://www.protocase.com/) which provided a system
with lots of controllers, SATA PMP and drive slots
- Conservation Genomics Laboratory, Department of Biology, New Mexico State
University for hosting the above system
- Brook Milligan, who set up remote access and has been very responsive
when SATA cable move was needed
 1.35  01-Jul-2011  dyoung branches: 1.35.2;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.34  08-Mar-2009  tsutsui ANSIfy, some KNF, misc cosmetics.
 1.33  27-Dec-2008  tsutsui branches: 1.33.2;
Sprinkle volatile to bus_space(9) access functions.
 1.32  28-Apr-2008  martin branches: 1.32.8; 1.32.10;
Remove clause 3 and 4 from TNF licenses
 1.31  18-Mar-2008  cube branches: 1.31.2; 1.31.4;
Split device_t and softc for ATA devices, as well as wd(4). Other
cosmetic changes where appropriate.
 1.30  04-Dec-2007  tsutsui branches: 1.30.8; 1.30.12;
- add a missing brace in the previous
- print error message on failure to map aux register
 1.29  04-Dec-2007  tsutsui Apply missed following MI wdc changes to atari's mainbus wdc backend:
- make bus space handles an array for each command register
http://mail-index.netbsd.org/source-changes/2003/11/27/0036.html
(note we no longer have to specify stride for wdc after this change)
- add the notion of "shadow register"
http://mail-index.netbsd.org/source-changes/2004/05/25/0048.html

Problem reported by Alan Hourihane in PR port-amiga/37464.
 1.28  29-Jan-2006  dsl branches: 1.28.22; 1.28.38; 1.28.46; 1.28.48; 1.28.54; 1.28.58;
Make almost everything #include <sys/bswap.h> instead of <machine/bswap.h>
The bswap.h and endian.h files are all rather incestuous, but I want to
get the constant folding stuff into one place - sys/bswap.h
 1.27  16-Jan-2006  bouyer properly use ata_channel->ch_ndrive:
- initialize it properly in the bus front-ends (all 2, exept in wdc_pcmcia.c
for the "Sandisk CompactFlash Card" where it's set to 1)
- remplace hardcoded '2' by ata_channel->ch_ndrive in MI IDE drivers.

From Christos Zoulas in kern/32501.
 1.26  11-Dec-2005  christos branches: 1.26.2;
merge ktrace-lwp.
 1.25  10-May-2005  jdc branches: 1.25.2;
Add some definitions of the (Falcon) IDE register locations and use these
to initialise the wdc register array.

Doesn't make the wdc probe work on the Falcon, but at least the kernel no
longer dies at boot time.
 1.24  20-Aug-2004  thorpej branches: 1.24.10;
Move most of wdc_softc into a new atac_softc structure that contains
info common to all types of ATA controllers.
 1.23  14-Aug-2004  thorpej - Split the register handles out of struct wdc_channel into a separate
wdc_regs structure, and array of which (indexed per channel) is pointed
to by struct wdc_softc.
- Move the resulting wdc_channel structure to atavar.h and rename it to
ata_channel. Rename the corresponding flags.
- Add a "ch_ndrive" member to struct ata_channel, which indicates the
maximum number of drives that can be present on the channel. For now,
this is always 2. Add an ATA_MAXDRIVES constant that places an upper
limit on this value, also currently 2.
 1.22  13-Aug-2004  thorpej Don't bother with bits that tell of the presence of optional callbacks;
just check the function pointers for NULL.
 1.21  06-Jan-2004  he Make these compile again after the latest adjustments.
 1.20  03-Jan-2004  thorpej More wdc_channel structure member namespace cleanup:
- channel -> ch_channel
- wdc -> ch_wdc
 1.19  03-Jan-2004  thorpej Rename "struct channel_softc" to "struct wdc_channel".
 1.18  01-Jan-2004  thorpej Rename:
- wdc_xfer to ata_xfer
- channel_queue to ata_queue
and move them to <dev/ata/atavar.h> so they can be used by non-wdc ATA
controllers. Clean up the member names of these structures while at it.
 1.17  31-Dec-2003  thorpej Simplfy allocation of the channel queue.
 1.16  16-Dec-2003  he Replace cmd_ioh with cmd_baseioh, to track changes to wdcvar.h, so
that this compiles again. Untested for now.

Reviewed by leo.
 1.15  08-Oct-2003  bouyer Adapt for wdcattach() prototype change.
 1.14  25-Sep-2003  mycroft Hide the use of config_interrupts() in one place.
 1.13  19-Sep-2003  mycroft 1) Use config_interrupts() to attach IDE and ATAPI drives. This eliminates
most polling.
2) Clean up some goofiness in pciide -- get rid of the whole "candisable" path
(it's gratuitous) and simplify the code by calling pciide_map_compat_intr(),
*_set_modes() and wdc_print_modes() from central locations.
3) Add a register writability and register ghost test to eliminate phantom
drives more quickly.
 1.12  15-Jul-2003  lukem __KERNEL_RCSID()
 1.11  02-Oct-2002  thorpej branches: 1.11.6;
Use CFATTACH_DECL().
 1.10  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.9  29-Mar-2000  leo branches: 1.9.8; 1.9.12;
Nuke a bunch of cf_unit abuses.
 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  06-Aug-1999  leo branches: 1.7.2;
Change the way that bit's are cleared in the InterruptPending register of
the 68901. Do this now by _assigning_ ~<bit_to_clear> instead of the
previously used 'andb ~<bit_to_clear>'. The latter caused a rwm-cycle that
caused a race condition to happen when an interrupt arrived between the
Read and Modify-Write.
Anyway, this solved my hanging keyboard problem.
 1.6  19-Feb-1999  leo Add <machine/bswap.h> in the list of include-files.
 1.5  03-Dec-1998  bouyer Rename pio_mode, etc ... to PIO_cap, etc ... for consistency with the
ata_drive_datas struct. Suggested by Soren S. Jorvan.
 1.4  22-Nov-1998  drochner oops - forget update for wdc_channels definition change
 1.3  12-Oct-1998  bouyer Merge bouyer-ide
 1.2  15-Aug-1998  mycroft Assign my copyrights to TNF.
 1.1  10-Apr-1998  leo branches: 1.1.2;
Use MI wdc-driver.
 1.1.2.6  02-Oct-1998  bouyer Cleanup a few error message, remove some dead code. Re-add a reset at end of
attach, unless we have WDC_NO_EXTRA_RESETS.
Add support for data32iot/data32ioh from -current: each controller pass
WDC_CAPABILITY_DATA32 if they can do 32bit, and WDC_CAPABILITY_DATA16 if they
can do 16bit. For controller that support both, the usual autodetect
mechanism is still used.
 1.1.2.5  21-Aug-1998  bouyer Sync with -current
 1.1.2.4  13-Aug-1998  bouyer - sync with -current
- b* -> mem*
 1.1.2.3  23-Jun-1998  leo Add necessary cruft to handle swapped byte-lanes on the data-register. It
basically boils down to the fact that there are 2 new options:
WDC_CAPABILITY_{ATA,ATAPI}_NOSTREAM with which you are able to control
the usage bus_space_read_multi_X() vs. bus_space_read_multi_stream_X().
 1.1.2.2  05-Jun-1998  bouyer Patches from Leo Weppelman for IDE on atari, with minor fixes by me
(needed the addition of a void wdcrestart __P((void*)) function).
Quoting his words:
These diffs are preliminary because it looks like the free_hw() function
does not get called. This is only a problem on the atari falcon. I have not
yet been able to track this down.
Also, KNF wdc.c.
 1.1.2.1  04-Jun-1998  bouyer Commit changes to the IDE system in a branch. This allows a better separation
between higth-level and low-level (i.e. registers read/write) and generalize
the queue for all commands. This also add supports for IDE DMA.
 1.7.2.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.9.12.1  18-Oct-2002  nathanw Catch up to -current.
 1.9.8.1  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.6.5  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.11.6.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.6.3  18-Sep-2004  skrll Sync with HEAD.
 1.11.6.2  25-Aug-2004  skrll Sync with HEAD.
 1.11.6.1  03-Aug-2004  skrll Sync with HEAD
 1.24.10.1  12-Dec-2007  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1885):
sys/arch/atari/dev/wdc_mb.c: revisions 1.29, 1.30 via patch
Apply missed following MI wdc changes to atari's mainbus wdc backend:
- make bus space handles an array for each command register
http://mail-index.netbsd.org/source-changes/2003/11/27/0036.html
(note we no longer have to specify stride for wdc after this change)
- add the notion of "shadow register"
http://mail-index.netbsd.org/source-changes/2004/05/25/0048.html
Problem reported by Alan Hourihane in PR port-amiga/37464.
 1.25.2.3  24-Mar-2008  yamt sync with head.
 1.25.2.2  07-Dec-2007  yamt sync with head
 1.25.2.1  21-Jun-2006  yamt sync with head.
 1.26.2.1  01-Feb-2006  yamt sync with head.
 1.28.58.1  08-Dec-2007  ad Sync with head.
 1.28.54.1  08-Dec-2007  mjf Sync with HEAD.
 1.28.48.2  23-Mar-2008  matt sync with HEAD
 1.28.48.1  09-Jan-2008  matt sync with HEAD
 1.28.46.1  09-Dec-2007  jmcneill Sync with HEAD.
 1.28.38.1  03-Jun-2008  skrll Sync with netbsd-4.
 1.28.22.2  02-Jan-2009  jdc Pull up revisions:
1.10 src/sys/arch/atari/atari/be_bus.c
1.14 src/sys/arch/atari/atari/le_bus.c
1.8 src/sys/arch/atari/atari/mainbus.c
1.33 src/sys/arch/atari/dev/wdc_mb.c
(requested by tsutsui in ticket #1252).

Sprinkle volatile to bus_space(9) access functions.
 1.28.22.1  02-Feb-2008  riz Pull up following revision(s) (requested by tsutsui in ticket #1013):
sys/arch/atari/dev/wdc_mb.c: revision 1.30
sys/arch/atari/dev/wdc_mb.c: revision 1.29
Apply missed following MI wdc changes to atari's mainbus wdc backend:
- make bus space handles an array for each command register
http://mail-index.netbsd.org/source-changes/2003/11/27/0036.html
(note we no longer have to specify stride for wdc after this change)
- add the notion of "shadow register"
http://mail-index.netbsd.org/source-changes/2004/05/25/0048.html
Problem reported by Alan Hourihane in PR port-amiga/37464.
- add a missing brace in the previous
- print error message on failure to map aux register
 1.30.12.3  17-Jan-2009  mjf Sync with HEAD.
 1.30.12.2  02-Jun-2008  mjf Sync with HEAD.
 1.30.12.1  03-Apr-2008  mjf Sync with HEAD.
 1.30.8.1  24-Mar-2008  keiichi sync with head.
 1.31.4.2  04-May-2009  yamt sync with head.
 1.31.4.1  16-May-2008  yamt sync with head.
 1.31.2.1  18-May-2008  yamt sync with head.
 1.32.10.1  06-Jan-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #218):
sys/arch/atari/dev/wdc_mb.c: revision 1.33
sys/arch/atari/atari/mainbus.c: revision 1.8
sys/arch/atari/atari/le_bus.c: revision 1.14
sys/arch/atari/atari/be_bus.c: revision 1.10
Sprinkle volatile to bus_space(9) access functions.
 1.32.8.2  28-Apr-2009  skrll Sync with HEAD.
 1.32.8.1  19-Jan-2009  skrll Sync with HEAD.
 1.33.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.35.2.1  30-Oct-2012  yamt sync with head
 1.38.28.4  27-Sep-2017  jdolecek pass ata channel interlock to st_dmagrab() so that it can release
and reacquire it if it sleeps
 1.38.28.3  27-Sep-2017  jdolecek g/c mistakely left over code
 1.38.28.2  27-Sep-2017  jdolecek change wdc_init_shadow_regs() to accept only struct wdc_regs, it doesn't
touch anything else

factor out the probe-only struct ata_channel initialization to wdcprobe(), to
reduce duplication of logic in individual drivers, and to actually work now
that more init is needed beyond the memset()
 1.38.28.1  24-Apr-2017  jdolecek use ata_queue_alloc() to dynamically allocate ata_queue for ata channel
 1.38.2.1  03-Dec-2017  jdolecek update from HEAD
 1.40.4.1  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411

RSS XML Feed