Commit Graph

144 Commits

Author SHA1 Message Date
christos 12269bd46c Don't try to use ultra-dma on sis chips with revision 0xd0. It loses
immediately with a lost interrupt on udma mode 2, downgrades to mode 1
at which point it silently corrupts data on high disk activity. This
happens on two out of 3 machines I own that exhibit high disk activity.
2000-11-26 04:59:18 +00:00
bouyer d81861796a Add support for Intel ICH2 2000-11-19 15:32:24 +00:00
thorpej cfe0892ed3 NBPG -> PAGE_SIZE 2000-11-14 18:42:55 +00:00
matt d0c3ebd9d8 Make the test for dmareg >= 0x10000 quirked on IDE_16BIT_IOSPACE 2000-11-08 18:22:27 +00:00
wrstuden 88cbfbe36d Move guts of pciide_print_modes() to wdc_print_modes() so that non-pciide
wdc drivers (like macppc's obio IDE interface) can use it. Also add
support to both wd attach line and to wdc_print_modes() to print
Ultra/{33,66,100} for respective UDMA modes (From Manuel Bouyer).
2000-11-08 17:57:36 +00:00
matt 43ff857e29 Don't allow use of mapreg is they are at or above 0x10000 in I/O space. (in
other words, if the address uses bits in the top 16 bits, don't use it).
2000-11-05 21:14:59 +00:00
bouyer a2c02690af only VT82C586A rev >= 6 supports Ultra-DMA. From OpenBSD. 2000-10-04 09:34:09 +00:00
enami efb0ce0996 Recognize Promise ATA-100 controller as PDC-20262 instead of 20246. 2000-08-21 15:52:50 +00:00
enami 84ebb6165e Match the Promise ATA-100 controller found on the mother board
MS-6321 (MSI 694D Pro).  Reported in PR#10756 by Kazuki Sakamoto.
2000-08-21 15:43:46 +00:00
drochner a1b037bc3a recognize the i440MX mobile chipset's IDE interface 2000-08-09 13:23:07 +00:00
bouyer 46c3f0204d PCIIDE_CMD0646U_UDMA->PCIIDE_CMD0646U_ENABLEUDMA for consistency with
PCIIDE_AMD756_ENABLEDMA
defopt PCIIDE_CMD0646U_ENABLEUDMA, PCIIDE_AMD756_ENABLEDMA,
    PCIIDE_CMD064x_DISABLE
Fix a typo pointed out by John Hawkinson
2000-08-02 21:49:09 +00:00
bouyer bd0766459c Add support for the CMD PCI646U. Linux claims that this driver is brocken
with UDMA, so enable Ultra-DMA only if "options PCIIDE_CMD0646U_UDMA" is set.
2000-08-02 20:23:45 +00:00
bouyer 76c77aca38 Add support for the CMD PCI0646U2, an Ultra/33 version of the 0646.
Note: there's also a PCI0646U, for which I don't have docs for now.
2000-08-01 21:02:55 +00:00
bouyer aa0d4a41d5 HPT370: clear disable interrupt bit; make it works in Ultra/66 mode. 2000-07-27 14:28:45 +00:00
bouyer 6e88d58524 Make it compile when PCIIDE_AMD756_ENABLEDMA is defined. From kern/10555
by MURATA Shuuichirou.
2000-07-20 12:19:41 +00:00
bouyer 2646cf1612 Use the CMD PCI0648/9 IRQ ACK code for the 0646 too, makes the 0646 works
in native mode.
2000-07-07 13:54:25 +00:00
bouyer e2aaf9ef7f Work around a bug in AMD756 rev D2, from patches provided by David Sainty:
disable multiword DMA for these chips. multiword DMA can be forced with
options PCIIDE_AMD756_ENABLEDMA on rev D2 chips, but use at your own risk !
While I'm there remove a duplicate allocation of sc_wdcdev.nchannels in HPT
code.
2000-07-06 15:08:11 +00:00
bouyer 3c5afc2677 Back out previous, it has to be done in a different way. 2000-07-05 19:05:31 +00:00
bouyer 838676ce64 Apply patch from David Sainty <David.Sainty@optimation.co.nz>:
Some AMD controllers have a bug which can look up the machine when using DMA, so
disable DMA for some revisions (info provided by AMD).
"options PCIIDE_AMD756_ENABLEDMA" can be used to force DMA on these chips.
2000-07-05 18:58:41 +00:00
bouyer fa436f165c HPT: use pciide_channels[i] not pciide_channels[0]. My HPT370 now probes
both channels (but still doesn't work properly; I suspect I got a broken one).
2000-07-05 16:11:35 +00:00
enami 88a0f6ee93 Match with promise ultra100/ata contoller. I haven't actually test this
contoller with ultra100 drive, but it works at least with ultra66 or more
older drive
2000-07-04 16:34:33 +00:00
mrg 7c15053eed remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h> 2000-06-28 16:08:42 +00:00
tron bddc013764 Add special IRQ handler for CMD PCI0648 and PCI0649 taken from the
experimental version of Manuel Bouyer's driver.
2000-06-27 05:57:05 +00:00
mrg 2f159a1bac remove/move more mach vm header files:
<vm/pglist.h> -> <uvm/uvm_pglist.h>
	<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
	<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
	<vm/vm_object.h> -> nothing
	<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
2000-06-26 14:20:25 +00:00
bouyer 8a0d96e59e Add support for the CMD PCI0648 and PCI0649 IDE controllers.
Thanks to Matthias Scheler for testing.
2000-06-26 10:07:52 +00:00
bouyer 2e861ca3ce Correct 80 pin handling for promise Ultra/66: when the bit is set
we *don't* have a Ultra/66 cable.
2000-06-26 09:55:26 +00:00
bouyer 034590578d Shorter description for the HPT366 2000-06-12 21:25:01 +00:00
bouyer b21bc1b5b6 - add a pciide_irqack() callback, which clears the IDE DMA status bit once
the IRQ has been cleared on the drive.
- use pa->pa_class instead of re-reading PCI_CLASS_REG when possible
- Add support for Highpoint HPT366 and HPT370 (370 untested), based
  on patches from Roger Brooks  <R.S.Brooks@liverpool.ac.uk> posted on
  current-users Mach, 15. Given how Highpoint docs have been wrong for the
  366, the 370 is likely to not work.
  Thanks to Chris Cappuccio <chris@dqc.org> for sending me the Highpoint
  docs, and to Total Archive (http://www.totalarchive.com/) for sending
  me hardware.
2000-06-12 21:20:51 +00:00
scw 295ed77595 The OPTi controller supports a 32-bit dataport after all.
Also detect when the chip is sitting on a 25MHz PCIbus and
set the timing registers accordingly.
2000-06-07 20:42:52 +00:00
thorpej b15bbb90f9 Add missing break; 2000-06-07 04:31:49 +00:00
thorpej c85d6d7ca3 Improve the Cypress name a little. 2000-06-06 22:56:06 +00:00
thorpej a452638f06 In pciide_mapreg_dma(), check to see what type the BAR is before
mapping the registers, as suggested by a comment in that function.
2000-06-06 22:47:22 +00:00
soren ba5df2479b Shorten names of VIA controllers to fit in 80 columns with versions. 2000-06-06 17:48:12 +00:00
thorpej c40fa3c4d4 Actually program the DMA mode of the drives into the Cypress
controller.  Fixes a long-standing problem where IDE DMA wasn't
working on the AlphaPC 164SX.
2000-06-06 17:34:22 +00:00
gmcgarry 745e3fef63 pciiide -> pciide 2000-06-04 22:22:12 +00:00
scw 46807640c7 Add support for the OPTi 82c621 PCIIDE controller and its derivatives.
I only have a Compaq laptop on which to test this, so reports of
success/failure in other systems would be welcomed.
2000-05-27 17:18:41 +00:00
bouyer c4042e45a5 Sync my copyrigth notice. 2000-05-15 08:46:00 +00:00
thorpej cd82969dfc Print the revision info from the PCI configuration header. From
Dave Sainty, kern/10025.
2000-05-12 17:52:07 +00:00
bouyer 26f6c9a9cf - DMA code cleanup: pciide_dma_finish() doesn't stop/unload the current DMA op
if an IRQ was not detected, unless the force flag was given. Use this to
  detect if the IRQ was for us (closer to shared IRQ for controllers which
  don't have their own IRQ handler in pciide.c) and to poll for DMA xfer.
  Also makes the timeout recovery code simpler.
- ATAPI cleanup: don't call controller-specific functions from atapiconf.c
  (wdc_*), so that it's possible to attach an atapibus to something else
  than a wdc/pciide (Hi Lennart :).
  Overload struct scsi_adapter with struct atapi_adapter, defined
  as struct scsi_adapter + atapi-specific callbacks. scsipi_link still points
  to an scsi_adapter, atapi code casts it to atapi_adapter if needed.
  Move atapi_softc to atapiconf.h so that it can be used by the underlying
  controller code (e.g. atapi_wdc.c).
  Add an atapi-specific callback *atapi_probedev(), which probe a drive
  in a controller-specific way, allocate the sc_link and fills in the
  ataparams if needed. It then calls atapi_probedev() (from atapiconf.c)
  to do the generic initialisations and attach the device.
- While I'm there merge and centralise the state definitions in atavar.h.
  It should now be possible to use a common ata/atapi routine to set the
  drive's modes (will do later).
2000-04-01 14:32:22 +00:00
bouyer b58bf3c7bb Don't reset cp->hw_ok ro 0 when cp isn't initialised in cy693_chip_map()
(used only in failure case). Pointed out by Wolfgang Solfrank.
While I'm here correct indentation.
2000-03-10 21:21:48 +00:00
soren c70220f2a2 Move PCIIDE_CHANNEL_NAME macro to pciidereg.h. 2000-03-09 20:26:31 +00:00
bouyer c34cce88c4 Add support for the AMD 756 DMA/UDMA IDE controller, provided in
PR kern/9536 by Dave Sainty.
2000-03-06 18:02:26 +00:00
bouyer 0016706a70 Clean up revision stuff for the sis. Suggested by Chris Cappuccio. 2000-01-18 13:58:07 +00:00
bouyer 9156026f0f From chris@openbsd.org:
"Don't enable UDMA modes for revisions of SiS 5513 < 0xd0
The only revisions I know which don't actually support UDMA are 0x09 and below..
But the only revision I know which does support UDMA is 0xd0 (and presumably
above that)"
2000-01-16 21:31:28 +00:00
soren 841d4966c3 Lower-case Bus-Master for consistency. 1999-12-26 21:46:23 +00:00
thorpej afbb07a0e5 Use htole32() and le32toh(). 1999-12-12 02:53:56 +00:00
bouyer 0c3ecf8e5e Improve Ultra/66 support now that I've got some docs from Promise. 1999-11-28 20:05:18 +00:00
soren 748b241afb Export softc. 1999-11-13 13:40:28 +00:00
mycroft 4f1f2c6398 Fix silly error that caused the secondary channel to be ignored if the primary
channel was disabled.
1999-11-03 14:54:07 +00:00
bouyer 0021900156 Add a missing '\n' in the cmd0640 attach printfs. 1999-10-25 14:13:12 +00:00
ross 533b6088cd Make it compile. 1999-09-02 23:23:03 +00:00
bouyer ce80d27933 Don't try to unmap unmapped space in case of failure in
pciide_mapregs_compat(). From OpenBSD.
1999-09-01 15:17:07 +00:00
bouyer 8e49b58de0 Add support for Intel 810 chipset (ICH/ICH0).
While I'm there merge back piix_channel_map into piix_chip_map.
1999-08-30 12:49:21 +00:00
bouyer 52068f73ce Add support for the Promise Ultra/33 and /66 pci IDE controller. In addition to
chip-dependant code this required the following changes:
- Instead of attaching the device in a generic way with some chip-dependant
  routines, use a chip-dependant attach routine with some common code
  factored out. The code is marginally bigger, but this allows the CMD64x
  flag hack to go away.
- For chips that report per-channel 'irq triggered', test this before calling
  wdcintr() for the native-pci irq case (compat intr can't be shared),
  as wdcintr() has no good way to know if a irq was for it or not, and
  ends up with irq loss. XXX for chips that don't have this feature irq sharing
  will not work properly !
- add my copyrigth notice (could have been done some time ago I think :)

There are still some issues to be solved with the Promise controller and
ATAPI devices.
Many thanks to Paul Newhouse for shipping me 2 Ultra/33 boards for doing this
work.
1999-08-29 17:20:10 +00:00
bouyer 0612a1ddef Fix typo in a printf, from Soren S. Jorvan. 1999-07-12 13:49:38 +00:00
mrg efb227d3a7 fix a few KNF nits .. 1999-06-08 10:38:15 +00:00
bouyer cc46db1ba6 For the PIIX, make sure the PIO_mode and DMA_mode get reset to the values used
by the controller for all drives.
1999-05-27 09:45:50 +00:00
bouyer 9893727873 Fix the way we compute the mode to use: for multiword DMA, the used mode was
2 less than the one we could really use, so for multiword DMA mode 0 or 1,
the driver tried to use DMA mode 255 or 254 (0 - 2 with a u_int8_t).
1999-05-05 15:24:59 +00:00
ross 7bffc1e720 Protect WDCDEBUG from multiple definitions. 1999-05-03 07:44:47 +00:00
thorpej 55fd59f1e0 Make PCI IDE DMA work on big-endian systems. 1999-04-28 00:18:12 +00:00
bouyer 2198b984e8 Kill an extra 'pciide0: ' in a printf 1999-04-06 17:49:14 +00:00
bouyer 71036465a5 In cy693_setup_channel(), setup timings for IOR too (they were left to 0,
which is a way too higth timing for some devices). Thanks to Ken Wellsch
for trying the multiple debug kernels until the problem was located.
1999-02-22 10:12:00 +00:00
bouyer 2ccd5cde74 Correctly compute PIO/DMA mode for sis and acer chips when the drive support
a DMA mode with higther capabilities than PIO mode.
1999-02-16 18:11:52 +00:00
bouyer 5888b4354e channel_map is called before setup_chip, so whe need to enable the channel
status bits in acer_channel_map().
1999-02-02 17:06:05 +00:00
bouyer ca240ca7b5 Support for Acerlab M5229 IDE controller. Thanks to Thilo Manske for testing
the code, and to Takahiro Kambe who run several tests and finally found the
bug by himself :)
1999-02-02 16:13:59 +00:00
bouyer f1addbd3fd Defer mapping of pci interrupt to pciide_mapregs_native(). This way,
the native interrupt shouldn't be mapped if a channel is in native mode,
but disabled.
1998-12-16 13:21:26 +00:00
bouyer 2093338697 Rearange the modes setup to allow these to be dyanmically changed. Fill
in the new "set_mode" callback.
1998-12-16 12:48:45 +00:00
bouyer 47ab212504 Rename pio_mode, etc ... to PIO_cap, etc ... for consistency with the
ata_drive_datas struct. Suggested by Soren S. Jorvan.
1998-12-03 18:24:30 +00:00
bouyer e39a5bdc53 Now that vtophy() is no longuer used, re-enable WDCDEBUG, with
wdcdebug_pciide_mask = 0 (so that one can easily patch this variable and give
me more informations :)
1998-12-03 17:27:57 +00:00
bouyer 2b28c858d8 add a udma_mode field to wdc_softc, and use it the same way dma_mode is used
(higthest ultra-dma mode supported). There may be a higther ultra-dma mode
defined ...
1998-12-03 15:38:59 +00:00
bouyer 7d87d6a5f6 Use correct register when disabling the second channel. 1998-12-03 13:50:38 +00:00
bouyer 8ef785add8 Restore changes from revision 1.17:
"If a channel has no drives, do *not* unmap its I/O regions.
 It's not really safe to use them for anything else, and in legacy mode it
 will just cause us to probe the channel again as an ISA device."
1998-12-03 13:30:00 +00:00
bouyer 1af63c0605 Correct a few bogons in the SiS chip initialisation. 1998-12-03 13:25:44 +00:00
bouyer 09408781c9 Ouh ! Correct the 8-bit PCI registers reading/writing functions: need to
multiply the register offset by 8.
1998-12-03 13:24:11 +00:00
bouyer 45675ab14b - change drive_flags from u_int8_t to u_int16_t
- keep the modes supported by the drive in struct ata_drive_datas (will be
  later used for downgrading the DMA/PIO mode on error)
- use config flags to force/disable PIO/DMA/UDMA modes
- For the CMD PCI0643/6 setup DMA mode to DMA Read multiple.
1998-12-02 10:52:24 +00:00
drochner 5888c5ef44 a small optimization for the compat interrupt handling, possible after
channel_softc is within pciide_channel
1998-11-24 19:54:20 +00:00
drochner 9effbbe436 some restructuring, more or less to get support for weird IDE controllers,
eg the Cypress ISA bridge:
-put channel mapping into the chip specific part, unify with
 channel_probe() into channel_map()
-use pointer to channel data as function call argument wherever possible
 instead of the channel number
-allow the "compat" channel number to differ from the per-controller
 channel number - for mapping and interrupt functions
-add support for SiS5598 and Cypress 82C693 chips
Mostly done by Manuel, I only contributed to the first 2 items.
1998-11-21 15:55:31 +00:00
mycroft cb703f0332 If a channel has no drives, do *not* unmap its I/O regions.
It's not really safe to use them for anything else, and in legacy mode it
will just cause us to probe the channel again as an ISA device.
1998-11-17 17:59:14 +00:00
bouyer 56107b8e10 Force PCI_COMMAND_MASTER_ENABLE if DMA has been setup properly. The BIOS is
supposed to do it but who knows ...
1998-11-12 15:05:29 +00:00
bouyer 1e71e76d6c - clearify the boot messages (features supported vs features used). Thanks to
Havard Eidnes for his complains about this :)
- fix some typo in comments
- hoppefully better detection of drives reporting bogus PIO modes.
1998-11-11 19:38:27 +00:00
bouyer 432a301fc6 Support for the CMD PCI064{3,6}. Tested on a 0646 with a
"wd0: PIO mode 4, DMA mode 2, UDMA mode 2" device.
1998-11-09 09:21:09 +00:00
bouyer 31dec5ddc5 Add config flags for pciide: 0x001 forces the use of DMA when the driver
don't know how to set the controller's modes.
1998-10-22 15:11:39 +00:00
bouyer 1456b01d77 Fix for Apollo DMA mode (not UDMA): DMA mode = PIO mode - 2, not PIO mode + 2 ! 1998-10-20 18:47:45 +00:00
bouyer c90c4b829b Add support for the second flavour of the VIA IDE chip (which has UDMA).
Don't claim DMA support if we don't have explicit support for this chip.
They're to may way to loose when trying to use DMA without configuring the
controller and disks.
1998-10-19 12:24:33 +00:00
bouyer da5d0a6f17 pciide.c: don't define WDCDEBUG, so it compiles on alpha. Correct a bogon
in the printing of DMA mode (piix3/4 only)
others: set the debug_mask to 0, so that debug messages are turned off by
default but can be easily turned on.
Reset drive_flags to 0 for unconfigured devices, so that they are ignored
later. For configured devices, reset state to 0 after probe/attach.
1998-10-13 08:59:45 +00:00
bouyer 19fddaeeb5 Merge bouyer-ide 1998-10-12 16:09:10 +00:00
drochner a8d0a43ffa 2 changes to pciide_probe_wdc() (used in compatibility mode to check
if i drive is responding):
-if the reset succeeds, check some registers to make sure there is really
 a drive (and not a chipset which echoes back the last written value)
-explicitely select the master before trying to read the master's status
1998-08-14 20:35:40 +00:00
thorpej ea3a1d9c44 Nuke __BROKEN_INDIRECT_CONFIG. 1998-06-08 06:55:54 +00:00
cgd b9eaff9db8 when considering attaching compatibility-mode channels, try a quick reset
and see if anything responds.  if nothing (that's attributable to the
PCI IDE controller) responds, then that channel either has no devices on
it or has been disabled (via a non-standard mechanism) by the BIOS.  If nothing
responds, don't map the compat.-mode interrupt or attach the wdc to that
channel, because the BIOS is likely to assign that IRQ to a different PCI
device.  If that happens, the kernel will panic because that device will
try to map the IRQ level-triggered, but the compat interrupt will have been
mapped edge-triggered.  (One possible way around this is to map the compat
interrupt edge-triggered, but it's not clear reading the spec that this
is correct or desirable.)
1998-03-12 23:34:29 +00:00
cgd ff06be8ce0 reorganize mapping/attachment of wdc channels so that it'll be easier to
insert a check to see whether a channel appears to be enabled.  Shouldn't
be necessary, according to the spec, but some PC chipsets allow individual
compatibility channels to be disabled.  "I hate PCs."
1998-03-06 19:13:19 +00:00
cgd f528463b81 despite the spec, some people map the bus master IDE registers into
memory space.  Note that in a comment, but don't try to fix it (for now).
1998-03-06 17:41:59 +00:00
cgd 2682c61855 clean up a printf 1998-03-04 19:19:21 +00:00
cgd c3cdd2752a slight cleanup (consistency, make a few comments better). add support
for recognizing bus-master DMA interface and mapping the regs (but
still no support for DMA).
1998-03-04 19:18:22 +00:00
cgd b37b33d302 PCI IDE glue. Right now, just glues 'wdc's to PCI IDE controller
channels.  Eventually should do things like support PCI IDE DMA (it _DOES
NOT_ do that now).
1998-03-04 06:35:11 +00:00