Commit Graph

648 Commits

Author SHA1 Message Date
Søren Schmidt
9855ae3844 Update the PIO mode gathering code.
Reported by: bde
2003-09-08 08:30:43 +00:00
Poul-Henning Kamp
bc7c831fc7 Forgotten in previous commit to atapi-cd.c: Add #ifndef BURN_BRIDGES
around cloning routines.
2003-09-05 11:08:55 +00:00
Poul-Henning Kamp
7837155fa2 Put the device cloning functions for disk-drivers under #ifndef BURN_BRIDGES.
For the floppy driver, use fdcontrol to manipulate density selection.

For the CD drivers, the 'a' and 'c' suffix is without actual effect and
any applications insisting on it can be satisfied with a symlink:
	ln -s /dev/cd0 /dev/cd0a

Ongoing discussion may result in these pieces of code being removed before
the 5-stable branch as opposed to after.
2003-09-05 10:40:16 +00:00
David E. O'Brien
debffe8383 Support the nForce3 chip found on Opteron motherboards:
atapci0: <nVidia nForce3 UDMA133 controller>

Approved by:	sos
2003-09-02 21:02:46 +00:00
Søren Schmidt
b57e5e1898 cosmetics 2003-09-02 15:53:01 +00:00
Søren Schmidt
dce3b7cc71 Adjust the max transfer size used. 2003-09-02 13:26:02 +00:00
Søren Schmidt
7c78880561 Rearrange the probe code yet again. 2003-09-01 11:13:21 +00:00
Søren Schmidt
d7e9ef77f8 Be more carefull on nulling the ATAPI magic for fake slave.
Skip polling devices that keeps returning 0xff early (ie no HW there).
2003-08-28 09:15:05 +00:00
Søren Schmidt
07844fe49c Make sure to call start when retrying. 2003-08-28 08:22:53 +00:00
Thomas Quinot
c8fb1af26c Add missing braces. Fixes boot-time kernel panic with ATAng and ATAPI/CAM.
Reviewed by:	roberto
2003-08-28 03:56:04 +00:00
Søren Schmidt
61f07fc6ca Return the translated result code from ATA/ATAPI commands. 2003-08-27 15:27:56 +00:00
Søren Schmidt
1d68703f6a Hopefully Fix problem with probing some ATAPI devices, while still
trying to avoid the "fake slave" problem.
2003-08-27 11:21:30 +00:00
Søren Schmidt
3a83be8e3b Try to get rid of the fake slave problem. 2003-08-25 13:06:13 +00:00
Søren Schmidt
6419d0b0e4 Cleanup the dma int/alloc/free code. 2003-08-25 11:13:04 +00:00
Søren Schmidt
9f06a4277f Unify prototypes.
Cosmetics.
2003-08-25 09:01:49 +00:00
Søren Schmidt
ea01d56917 Only call FLUSH_CACHE on devices that say they can.
This will get rid of the warnings issued at shutdown (that seems to
worry alot of users), but will also no flush cache on lots of
devices that can, but doesn't set the right support bits...
2003-08-25 07:59:50 +00:00
Søren Schmidt
8b0ca37153 Dont check the cable bit on ich5 when on the SATA channel. 2003-08-25 07:45:54 +00:00
Søren Schmidt
bcebaec6ce Sync with local version (cosmetics) 2003-08-24 19:58:11 +00:00
Søren Schmidt
6c48d6493d There is no detach func for PCI ATA devs. 2003-08-24 19:55:41 +00:00
Søren Schmidt
36d76a0137 Fix ad_dump top actually produce a dump.
Reported by: Tor Egge <Tor.Egge@cvsup.no.freebsd.org>
2003-08-24 19:50:22 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Søren Schmidt
5fdbb0d222 This is a major rework of the ATA driver (ATAng)
Restructure the way ATA/ATAPI commands are processed, use a common
ata_request structure for both. This centralises the way requests
are handled so locking is much easier to handle.

The driver is now layered much more cleanly to seperate the lowlevel
HW access so it can be tailored to specific controllers without touching
the upper layers. This is needed to support some of the newer
semi-intelligent ATA controllers showing up.

The top level drivers (disk, ATAPI devices) are more or less still
the same with just corrections to use the new interface.

Pull ATA out from under Gaint now that locking can be done in a sane way.

Add support for a the National Geode SC1100. Thanks to Soekris engineering
for sponsoring a Soekris 4801 to make this support.

Fixed alot of small bugs in the chipset code for various chips now
we are around in that corner anyways.
2003-08-24 09:22:26 +00:00
Warner Losh
4fbd232c86 Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.
2003-08-22 05:54:52 +00:00
Nate Lawson
1deac58179 Add a PATH_INQ flag, PIM_NO_6_BYTE, which indicates the SIM never wishes to
receive 6 byte commands.  Add a check for this flag to da(4) and cd(4) so
that they honor it.  This is a quick workaround for many devices (especially
USB) that require da(4) quirks to operate.  The more complete approach is
to finish the new transport code which will be aware of the SCSI version a
transport implements.

MFC after:	1 day
2003-07-28 06:15:59 +00:00
Søren Schmidt
e158f2b820 Update the SATA support code to work more correctly with
real SATA disks now that I can test it.

Add support for the SiI 3112 SATA chip using memory mapped I/O.
Update the support for the SiI 0680 to use the memio interface as well.

Sponsored by:	David Leimbach <leimy2k@mac.com> (3112 based controller)
Sponsored by:	FreeBSD Systems (www.FreeBSDsystems.com) (SATA disks)
2003-07-02 10:50:44 +00:00
Scott Long
f6b1c44d1f Mega busdma API commit.
Add two new arguments to bus_dma_tag_create(): lockfunc and lockfuncarg.
Lockfunc allows a driver to provide a function for managing its locking
semantics while using busdma.  At the moment, this is used for the
asynchronous busdma_swi and callback mechanism.  Two lockfunc implementations
are provided: busdma_lock_mutex() performs standard mutex operations on the
mutex that is specified from lockfuncarg.  dftl_lock() is a panic
implementation and is defaulted to when NULL, NULL are passed to
bus_dma_tag_create().  The only time that NULL, NULL should ever be used is
when the driver ensures that bus_dmamap_load() will not be deferred.
Drivers that do not provide their own locking can pass
busdma_lock_mutex,&Giant args in order to preserve the former behaviour.

sparc64 and powerpc do not provide real busdma_swi functions, so this is
largely a noop on those platforms.  The busdma_swi on is64 is not properly
locked yet, so warnings will be emitted on this platform when busdma
callback deferrals happen.

If anyone gets panics or warnings from dflt_lock() being called, please
let me know right away.

Reviewed by:	tmm, gibbs
2003-07-01 15:52:06 +00:00
Peter Grehan
09bf574a28 Prevent probing the secondary channel on CMD646 controllers if the
channel has been disabled by BIOS. This prevents a bus timeout
machine check on B&W G3 PowerMacs, which have a primary-only CMD646
on the motherboard.

Approved by: sos
Obtained from: NetBSD
2003-06-27 10:11:54 +00:00
Warner Losh
60c64b939b Remove check to see if the get resource for the second resource
succeeds.  There is a difference between how OLDCARD and NEWCARD deal
with their resources, and this code exposes that difference.  I'm not
sure which behavior is correct, and will need to look into that in
more detail.  However, it appears that we go ahead and allocate the
right thing in both cases that I have access to (CF cards, CDROM, and
external ata enclosures), so go ahead and ignore the failure to get
the resource for the other rid.  There's already another check to make
sure that the actual allocation works correctly, and that should be
sufficient to catch cases that don't work.

Submitted by: wpaul and iedowse
2003-06-27 03:25:43 +00:00
Søren Schmidt
d72d63c03e Add support for the HighPoint HPT302 & HPT371
HW sponsored by:	Martin Blapp <mbr@FreeBSD.ORG>
2003-06-19 15:11:04 +00:00
Warner Losh
04fd143fa8 Add FREECOM PCCARD-IDE to the mix. It doesn't have a manufacturer or
product ID, so we have to use the CIS strings to ID it.

dmesg by: Christian Laursen
2003-06-17 12:33:53 +00:00
Nate Lawson
2813692cc2 Merge common XPT_CALC_GEOMETRY functions into a single convenience function.
Devices below may experience a change in geometry.

* Due to a bug, aic(4) never used extended geometry.  Changes all drives
  >1G to now use extended translation.
* sbp(4) drives exactly 1 GB in size now no longer use extended geometry.
* umass(4) drives exactly 1 GB in size now no longer use extended geometry.

For all other controllers in this commit, this should be a no-op.

Looked over by:	scottl
2003-06-14 22:17:41 +00:00
Søren Schmidt
c283397793 Fix the setup of old Promise controllers, clocks was not setup right
causing way too low transfer rates.

Enable interrupts on old CMD64[89] chips, apparently some bogus BIOS's
doesn't get this right.
2003-06-07 15:19:16 +00:00
Warner Losh
49d5015da8 Add support for generic PMCICA ATA CARD 2003-06-03 01:30:55 +00:00
Søren Schmidt
e1750fb855 Print the right position on disk errors
Approved by: re@
2003-05-19 13:43:12 +00:00
Søren Schmidt
c9f5649b3e Unbork the chip locating code.
Approved by: re@
2003-05-19 13:42:23 +00:00
Søren Schmidt
05688ceccc Support the ICH5 SATA part.
Fix HPT374 UDMA133 timing.
Fix Promise ID.
Cosmetics on probe print for Promise & HPT.

Approved by: re
2003-05-18 16:45:48 +00:00
Søren Schmidt
27409aa046 Add string for SATA150
Approved by: re
2003-05-18 16:43:08 +00:00
Thomas Quinot
b3c957133a In atapi_cam_reinit_bus, only call reinit_bus if the ATAPI channel
has already been registered with ATAPI/CAM (else there is nothing
to do). atapi_cam_reinit_bus may be called before the bus is
registered if an ATAPI command times out during the boot sequence.

PR:		i386/51421
Reviewed by:	roberto
Approved by:	re (rwatson)
MFC after:	1 week
2003-05-14 14:20:22 +00:00
Søren Schmidt
69d691371a Fix typo (that even got cut/pasted 2 times)
Found by:	phk
Approved by:	re@
2003-05-12 16:43:13 +00:00
Poul-Henning Kamp
df1970aa55 Fix an off-by-1 error.
Found by:	FlexeLint
Reviewed by:	sos
Approved by:	re/rwatson
2003-05-12 15:26:05 +00:00
Søren Schmidt
60ad94dea4 Add a couble new Intel PCI id's
Approved by: re@
2003-05-10 14:49:19 +00:00
John Baldwin
258dbbab69 Acquire Giant at the start of the raid rebuild kthreads.
Reported by:	Masachika ISHIZUKA <ishizuka@ish.org>
Reviewed by:	sos
Approved by:	re (bmah)
2003-05-08 16:38:14 +00:00
John Baldwin
6e52134c70 Add PCI ID's for the Intel ICH5 (82801EB) chipset.
Approved by:	re (murray)
Sponsored by:	The Weather Channel
2003-05-06 19:31:56 +00:00
Søren Schmidt
b4074fb04d Add a missing ~ when clearing flags in close.
PR: 35392
2003-05-05 10:11:17 +00:00
Søren Schmidt
64ff745cf5 Change the way loadbalancing works on RAID1's.
Based on code partially by me and by <Tor.Egge@cvsup.no.freebsd.org>.
2003-05-04 16:17:54 +00:00
Søren Schmidt
cf764e45ae Implement dump function for ATA RAID's. Minor fixes by me...
Submitted by: Tor Egge <Tor.Egge@cvsup.no.freebsd.org>
2003-05-04 12:16:47 +00:00
Søren Schmidt
9c51ecf436 Grap the ATA lock on all channels before suspend, this makes certain
that we have no outstanding ops in transit, which would cause problems
on resume.
2003-05-04 09:34:14 +00:00
Søren Schmidt
7af89aab59 Fix locking on reinit. 2003-05-03 18:28:43 +00:00
Søren Schmidt
a23507bcff Add the pdc20268r as candidate for the TX test. 2003-05-03 18:26:00 +00:00
Søren Schmidt
93f307bbea Add flushing of devices on shutdown.
Note: this might print failure messages on some systems, unfortunatly
the info from the device, stating if flushing is supported, cannot be trusted
so the operation is always issued on all devices, just in case...
2003-05-02 13:47:44 +00:00
Søren Schmidt
31de970e72 Add ioctl to add a spare disk to a RAID array.
Fix the discovery of RAID's to not grap unused disks.
Change the probe printing of a RAID a bit.
2003-05-02 12:41:44 +00:00
Søren Schmidt
5909dab38c Dont try to call detached interrupt routine. 2003-05-02 12:37:03 +00:00
Søren Schmidt
84351184a9 I'm pleased to announce that Promise is now supporting the FreeBSD
project by providing documentation (under NDA) and hardware for
testing. This commit is the first result of the cooperation, and
adds support for several of their new controllers that we didn't
support before (and probably newer would have without this arrangement).

Add support for the Promise SATA150 TX2/TX4 and the Promise TX4000
controllers. This also adds support for various motherboard fitted
Promise SATA/ATA chips.
Note that this code uses memory mapped registers to minimize overhead.
I belive FreeBSD has made another first in the Open Source world
by being able to release support for this :)
2003-05-01 06:20:50 +00:00
Søren Schmidt
3a6fb16ff1 Relax the test for when to use LBA instead of CHS size. 2003-05-01 06:17:30 +00:00
Warner Losh
03988eea4d MF-p4:
"Ian gave me this patch"  I assume this is iadowse@.

Also, pull in a few devices NetBSD's table.  More are there, but I need
to properly move them to pccarddev before including them here.
2003-04-26 22:19:02 +00:00
Søren Schmidt
29273dcd58 Cosmetics. 2003-04-16 08:30:40 +00:00
Søren Schmidt
db16c8c28b Fix a panic with Cenatek controllers. 2003-04-16 08:30:10 +00:00
Søren Schmidt
4379543ce8 Spell 55 with two '5's 2003-04-10 12:56:33 +00:00
Søren Schmidt
041187d122 Add a few more older SiS ID's. 2003-04-10 12:24:39 +00:00
Søren Schmidt
71ec78e340 Fix breakage on sparc64.
Note to self: always test even the smallest changes on all platforms.
2003-04-08 18:01:30 +00:00
Søren Schmidt
08312d8f48 Fix a long standing bug in handling the last part of a stripe
on "odd" size disks.

Add printout of the RAID structure on verbose boot.
2003-04-08 07:48:52 +00:00
Søren Schmidt
b5855cd133 Minor cleanup of the ATA RAID code. 2003-04-07 14:14:29 +00:00
Søren Schmidt
1b39bd2412 Third round of updates to the ATA driver.
More DMA cleanups, including fix for breakage on older Promise controllers.

Add more ways of getting to the ATA registers.
2003-04-07 14:12:12 +00:00
Poul-Henning Kamp
3ad3653c7a Don't use dkmakeminor(), create our own minor encoding instead. 2003-04-03 08:50:35 +00:00
Poul-Henning Kamp
891619a66d Use bioq_flush() to drain a bio queue with a specific error code.
Retain the mistake of not updating the devstat API for now.

Spell bioq_disksort() consistently with the remaining bioq_*().

#include <geom/geom_disk.h> where this is more appropriate.
2003-04-01 15:06:26 +00:00
Søren Schmidt
0c4b980607 Fix ATA_DEBUG case breakage. 2003-03-30 09:27:59 +00:00
Søren Schmidt
566cf07a7c Second round of updates to the ATA driver.
Clean up the DMA interface too much unneeded stuff crept in with
the busdma code back when.

Modify the ATA_IN* / ATA_OUT* macros so that resource and offset
are gotten from a table. That allows for new chipsets that doesn't
nessesarily have things ordered the good old way. This also removes
the need for the wierd PC98 resource functions.

Tested on: i386, PC98, Alpha, Sparc64
2003-03-29 13:37:09 +00:00
Søren Schmidt
c7f547fde8 Biofinish the request if we cannot malloc in ad_start. 2003-03-27 10:48:21 +00:00
Maxime Henrion
0a50de79cb - Add a new ioctl to get the maximum number of ATA channels.
- Use it in atacontrol(8) when listing ATA devices instead of
  stopping at the first ENXIO received.

This makes atacontrol list work on my sparc64 where the two ATA
channels I have are numbered 2 and 3.

Reviewed by:	sos
2003-03-22 12:18:20 +00:00
Poul-Henning Kamp
b4b138c27f Including <sys/stdint.h> is (almost?) universally only to be able to use
%j in printfs, so put a newsted include in <sys/systm.h> where the printf
prototype lives and save everybody else the trouble.
2003-03-18 08:45:25 +00:00
Søren Schmidt
92737d1739 Fix the cable detection and properly find the host bridge on
older SiS chips.
2003-03-16 16:26:51 +00:00
Poul-Henning Kamp
09a6b2aad6 Call devstat_start_transaction_bio() instead of devstat_start_transaction(). 2003-03-15 10:56:19 +00:00
Poul-Henning Kamp
1ecc485c1b Call devstat_start_transaction_bio() instead of devstat_start_transaction() 2003-03-15 10:50:44 +00:00
Søren Schmidt
f711eff1d2 Remove the check for more than one open if one is a write op.
This allows using DVD+RW and DVD-RW as random storage, provided
the 32K blocksize is honoured for DVD-RW (DVD+RW has built in
read-modify-write).
2003-03-13 09:12:17 +00:00
Søren Schmidt
6918962fad Dont free the stats struct, this has been changed by the new stat code.
Spotted by: Ian Dowse <iedowse@maths.tcd.ie>
2003-03-13 09:09:10 +00:00
Søren Schmidt
394046e66f Dont call dma->free unless dma is there.
Spotted by: Ian Dowse <iedowse@maths.tcd.ie>
2003-03-13 09:04:55 +00:00
Søren Schmidt
deff57d72c Correct the last commit, only look for subfunctions on the same PCI slot. 2003-03-12 15:45:52 +00:00
Søren Schmidt
5b24125046 Cleanup the probe code a bit. 2003-03-12 12:05:17 +00:00
Søren Schmidt
9eb8572ea2 Dont hang the channel on enclosures without sensors. 2003-03-12 10:59:35 +00:00
Søren Schmidt
cad57b089a Remove the enclose_print() call, it is already called from ata-disk.c 2003-03-10 08:20:57 +00:00
Søren Schmidt
7b4cb338ac Dont use r_bmio on Cyrix chips if not set from BIOS. 2003-03-10 08:20:14 +00:00
Poul-Henning Kamp
8098046099 Allocate the devstat structure with devstat_new_entry(). 2003-03-08 21:32:59 +00:00
Poul-Henning Kamp
60794e0478 Centralize the devstat handling for all GEOM disk device drivers
in geom_disk.c.

As a side effect this makes a lot of #include <sys/devicestat.h>
lines not needed and some biofinish() calls can be reduced to
biodone() again.
2003-03-08 08:01:31 +00:00
Poul-Henning Kamp
7ac40f5f59 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)
2003-03-03 12:15:54 +00:00
Søren Schmidt
3cb179a848 Minor cleanup of the Promise code. 2003-03-03 11:51:08 +00:00
Søren Schmidt
c55607ce1f Always set the setmode funcptr. 2003-03-03 11:15:32 +00:00
Dag-Erling Smørgrav
521f364b80 More low-hanging fruit: kill caddr_t in calls to wakeup(9) / [mt]sleep(9). 2003-03-02 16:54:40 +00:00
Søren Schmidt
638914f17d Fix support for HPT controllers they where always left in PIO mode.
Amazing what a ';' can do :/
2003-03-01 09:33:35 +00:00
Poul-Henning Kamp
3e7b60db4b NO_GEOM cleanup:
Convert to "struct disk *" centric API.

OK'ed by:	sos
2003-02-28 09:53:36 +00:00
Nate Lawson
fdb8bf0997 Zero cpi->target_sprt since atapi-cam does not support target mode. This
gets rid of annoying messages when targbh tries to attach to the ATA bus
and gets rejected.

MFC after:	1 day
2003-02-27 20:56:56 +00:00
Søren Schmidt
33c788a554 Only use function 1 not 0 on cypress chips. 2003-02-27 09:42:57 +00:00
Søren Schmidt
4f57804cd3 Fix UDMA modes setup on CMD chips. 2003-02-27 07:11:42 +00:00
Søren Schmidt
9fb9aa7f06 Fix a reversed test for ATAPI_DEVICE in the Promise setup code. 2003-02-26 19:13:17 +00:00
Søren Schmidt
2957c08b9c Fix support for Acer chips. The UDMA enable regs wasn't set properly. 2003-02-25 21:22:27 +00:00
Søren Schmidt
dd6a5ae906 Convert to new disk API.
Prodded by: phk
2003-02-25 15:33:36 +00:00
Søren Schmidt
2e6c2a1089 Properly teardown the interrupt so we wont panic on detach. 2003-02-25 14:46:30 +00:00
Søren Schmidt
472e291b31 Removed the ISA only hooks here, no longer needed.. 2003-02-25 14:24:42 +00:00
Søren Schmidt
ae64a900aa Fix support for the old CMD 646 chips, interrupt setup was wrong. 2003-02-25 12:56:37 +00:00
Søren Schmidt
b301920c88 Revert the probe code change.
It helped those fake devices probe delays to go away, but as a side
effect it also made some not so conforming CD/DVD drives go away...
2003-02-25 08:22:01 +00:00
Søren Schmidt
7931af6934 Temporarily disable tagged queueing while I figure out why it broke. 2003-02-23 16:43:26 +00:00
Søren Schmidt
4efc1603dc Fix chipset setup problem on older ALI chips. 2003-02-23 16:36:21 +00:00
Søren Schmidt
9644f64b75 Fix timeout when using UDMA speeds, bad chip setup. 2003-02-23 15:05:04 +00:00
Poul-Henning Kamp
2c6b49f6af NO_GEOM cleanup:
Retire the "d_dump_t" and use the "dumper_t" type instead.

Dumper_t takes a void * as first arg which is more general than the
dev_t taken by d_dump_t.  (Remember: we could have net-dumpers if
somebody wrote us one!)

Define the convention for GEOM controlled disk devices to be that the
first argument to the dumper function is the struct disk pointer.

Change device drivers accordingly.
2003-02-21 19:00:48 +00:00
Poul-Henning Kamp
b82ff75854 NO_GEOM cleanup:
Change the argument to disk_destroy() to be the same struct disk * as
disk_create() takes.

This enables drivers to ignore the (now) bogus dev_t which disk_create()
returns.
2003-02-21 15:13:26 +00:00
Kenneth D. Merry
56eac725a3 Fix ATAPI/USB/Firewire CDROM drive handling in cd(4) and hopefully fix
a number of related problems along the way.

 - Automatically detect CDROM drives that can't handle 6 byte mode
   sense and mode select, and adjust our command size accordingly.
   We have to handle this in the cd(4) driver (where the buffers are
   allocated), since the parameter list length is different for the
   6 and 10 byte mode sense commands.

 - Remove MODE_SENSE and MODE_SELECT translation removed in ATAPICAM
   and in the umass(4) driver, since there's no way for that to work
   properly.

 - Add a quirk entry for CDROM drives that just hang when they get a 6
   byte mode sense or mode select.  The reason for the quirk must be
   documented in a PR, and all quirks must be approved by
   ken@FreeBSD.org.  This is to make sure that we fully understand why
   each quirk is needed.  Once the CAM_NEW_TRAN_CODE is finished, we
   should be able to remove any such quirks, since we'll know what
   protocol the drive speaks (SCSI, ATAPI, etc.) and therefore whether
   we should use 6 or 10 byte mode sense/select commands.

 - Change the way the da(4) handles the no_6_byte sysctl.  There is
   now a per-drive sysctl to set the minimum command size for that
   particular disk.  (Since you could have multiple disks with
   multiple requirements in one system.)

 - Loader tunable support for all the sysctls in the da(4) and cd(4)
   drivers.

 - Add a CDIOCCLOSE ioctl for cd(4) (bde pointed this out a long
   time ago).

 - Add a media validation routine (cdcheckmedia()) to the cd(4)
   driver, to fix some problems bde pointed out a long time ago.  We
   now allow open() to succeed no matter what, but if we don't detect
   valid media, the user can only issue CDIOCCLOSE or CDIOCEJECT
   ioctls.

 - The media validation routine also reads the table of contents off
   the drive.  We use the table of contents to implement the
   CDIOCPLAYTRACKS ioctl using the PLAY AUDIO MSF command.  The
   PLAY AUDIO TRACK INDEX command that we previously used was
   deprecated after SCSI-2.  It works in every SCSI CDROM I've tried,
   but doesn't seem to work on ATAPI CDROM drives.  We still use the
   play audio track index command if we don't have a valid TOC, but
   I suppose it'll fail anyway in that case.

 - Add _len() versions of scsi_mode_sense() and scsi_mode_select() so
   that we can specify the minimum command length.

 - Fix a couple of formatting problems in the sense printing code.

MFC after: 	4 weeks
2003-02-21 06:19:38 +00:00
Søren Schmidt
bb5bdd386e First round off updates/fixes to the ATA driver.
This moves all chipset specific code to a new file 'ata-chipset.c'.
Extensive use of tables and pointers to avoid having the same switch
on chipset type in several places, and to allow substituting various
functions for different HW arch needs.
Added PIO mode setup and all DMA modes.
Support for all known SiS chipsets. Thanks to Christoph Kukulies for
sponsoring a nice ASUS P4S8X SiS648 based board for this work!

Tested on:	i386, PC98, alpha and sparc64
2003-02-20 20:02:32 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Alfred Perlstein
c11110eabe Fix crash dumps on ata and scsi.
To fix scsi, don't wait for ithreads if we're dumping, it makes the
debugger sad.

To fix ata, use what appears to be a polling method if we're dumping,
I stole this from tmm but added code to ensure that this change is
only in effect while dumping.

Tested by: des
2003-02-14 13:10:40 +00:00
Poul-Henning Kamp
1686ac18f9 NO_GEOM cleanup: retire disk_invalidate() 2003-01-30 19:43:50 +00:00
Søren Schmidt
33ede9b3e7 Update the code that deals with disk enclosures:
Properly handle the newer Promise SuperSwap 1000 enclosures.
Print out what kind of enclosure was found in the probe.
Misc cleanups in the enclosure handling code.

Sponsored by: Advanis Inc.
2003-01-27 09:04:29 +00:00
Poul-Henning Kamp
3bc7d563e3 Add a missing '{' 2003-01-21 09:57:01 +00:00
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Søren Schmidt
d7b64c95c0 Remove the fake disklabel, no longer needed.
Fix potential malloc panic.

Prodded by: phk
2003-01-21 08:33:48 +00:00
Søren Schmidt
7fc7425df3 Small change to the previous commit, zero out the 48BIT flag in ata_command
instead of in dmadone.
2003-01-19 20:18:07 +00:00
Søren Schmidt
188869473d Add support for the ServerWorks CSB6.
The support for the 3'rd channel is only experimental.
2003-01-19 13:03:20 +00:00
Søren Schmidt
15fa4bd593 Fix the 48bit access support for the older Promise 66/100 controllers, the
first attempt was wrong and could cause r/w timeouts.

Add yet another Promise PCI id.
2003-01-19 11:47:32 +00:00
Søren Schmidt
610e02649a Dont probe PnP devices.
Submitted by: Takahashi Yoshihiro <nyan@FreeBSD.org>
2003-01-09 14:00:07 +00:00
Søren Schmidt
2768d40bf1 Fix typo
PR: 45375
2003-01-09 13:54:07 +00:00
Søren Schmidt
fb02f8eeb8 Dont attach a Promise chip located behind a i960 bridge/chip.
This makes it possible to run a Promise SuperTrak SX6000 with
OS type set to "Other" as well as "Linux".
2003-01-08 17:44:36 +00:00
Søren Schmidt
4b4f97ae4c Add support for the nVidia nForce2 ATA part.
Fix support for the nForce1 as well, registers are offset 0x10
against the AMD/VIA parts.
2003-01-08 16:51:41 +00:00
Søren Schmidt
837832bc18 Add code that works around the problem that the older Promise
controllers (ultra/fasttrak-66/100) fails on 48bit accesses.
2003-01-08 10:03:31 +00:00
Søren Schmidt
4d08a40b15 Try to fix the problem with burncd blank not seeing the end of
the blank operation.
2002-12-17 16:27:45 +00:00
Søren Schmidt
5dd009808a This should be the way PC98 ATA disks are seen geometry wise.
Should go into 5_0_RELEASE as well.
2002-12-17 16:26:22 +00:00
Søren Schmidt
9dec0f3de0 Fix linking problem when atadisk is not use in ata-all.c
Add dummy intr_func and lock_func to ata-card.c

Dont call ad_print if the driver decided there is no disk.
2002-12-06 19:29:53 +00:00
Søren Schmidt
8ba4488cea Add support for the PC98 platform to the ATA driver.
This mostly consists of functionality to serialize accesses to
the two ATA channels (which can also be used to "fix" certain
PCI based controllers).
Add support for Acard controllers.
Enable the ATA driver in PC98 GENERIC, and add device hints.
Update man page with latest support.

The PC98 core team has kindly provided me with a PC98
machine that made this all possible, thanks to all that
contributed to that effort, without that this would
probably newer have been possible..

Approved by: re@
2002-12-03 20:20:44 +00:00
Thomas Quinot
9e3a06e150 In ata_reinit, when ata_getparam fails for a new device (indicating that
the device is not actually present), clear the corresponding bit in
the ch->devices bitmap. This resolves a panic that occurred with ATAPI/CAM
after an APM suspend/resume, when the ATA hardware would erroneously
report an extra ATAPI device.

Approved by:	re, sos
Reviewed by:	roberto
MFC after:	7 days
2002-12-01 14:20:08 +00:00
Nate Lawson
c3bf92aa58 Allow acd(4) and cd(4) to support old behavior for CDRIOC*SPEED ioctls.
If the value from the user is less than 177, assume it is a multiple of
a single speed CDROM and convert to KB/sec.

No complaints from:	sos
Reviewed by:	ken
Approved by:	re
MFC after:	1 day
2002-11-23 22:51:50 +00:00
John Baldwin
482a5259ac Use [u]intmax_t and %j instead of long long and %ll to better fix warnings
I fixed earlier.

Requested by:	mux, jake
2002-11-07 22:23:46 +00:00
John Baldwin
929791c8cc Use some long long casts to quiet warnings in debug printf's on alpha. 2002-11-06 19:52:13 +00:00
Thomas Quinot
e937fdbdcd Fill in missing parts of the ATAPI/CAM XPT: implement XPT_RESET_BUS
and XPT_RESET_DEV.

In order to properly handle reset requests whether they originate in the
ATA layer (atacontrol reinit) or from the CAM layer (camcontrol reset)
ata_reinit does not cause the SIM to be deallocated anymore. The SIM
is now unconditionnally created for each ATAPI bus.

This change may cause existing bus ids to change on some setups.

Reviewed by:	roberto
Approved by:	sos
2002-10-22 20:18:51 +00:00
Nate Lawson
76ba4ecdad * Add CDRIOC{READ,WRITE}SPEED ioctls to cd(4). Units are in KB/sec.
* Change atapi-cd ioctls to use the same units.
* Change burncd, cdcontrol to convert CDROM speed to KB/sec before
calling the ioctl.  Add a "max" speed option for their command lines.

This change does not break ABI but does change the units passed through
the ioctl so 3rd party software that uses cdrio.h will have to convert
(most likely by multiplying CDROM speed by 177 to get KB/s).

PR:		kern/36845
Submitted by:	Philipp Mergenthaler <p@i609a.hadiko.de> (CAM ioctls)
Reviewed by:	sos, ken
MFC after:	1 month
2002-10-18 22:03:39 +00:00
Søren Schmidt
c13beb0171 Fix for the panic when using a Promise TX2.
The problem is that the code does a check for the granparent of
the Promise chip, if this is a bridge of the right type, we have
a TX4 on our hands, and need to handle that ones "issues".
Now the grandparent check cause subtle bugs in the newbus system,
mainly that pci_get_devid doesn't return an error value.
This patch works around the issue by using BUS_READ_IVAR() instead.
2002-10-08 18:25:10 +00:00
Scott Long
316ec49abd Some kernel threads try to do significant work, and the default KSTACK_PAGES
doesn't give them enough stack to do much before blowing away the pcb.
This adds MI and MD code to allow the allocation of an alternate kstack
who's size can be speficied when calling kthread_create.  Passing the
value 0 prevents the alternate kstack from being created.  Note that the
ia64 MD code is missing for now, and PowerPC was only partially written
due to the pmap.c being incomplete there.
Though this patch does not modify anything to make use of the alternate
kstack, acpi and usb are good candidates.

Reviewed by:	jake, peter, jhb
2002-10-02 07:44:29 +00:00
Søren Schmidt
94ec75ef27 Misc cleanups.
Pointed out by: phk/flexelint
2002-10-01 15:21:57 +00:00
Søren Schmidt
26cc243d90 Add yet another Promise PCI id. 2002-10-01 15:21:09 +00:00
Poul-Henning Kamp
024cb40078 Fix an indentation problem. 2002-09-28 17:34:31 +00:00
Poul-Henning Kamp
37c841831f Be consistent about "static" functions: if the function is marked
static in its prototype, mark it static at the definition too.

Inspired by:    FlexeLint warning #512
2002-09-28 17:15:38 +00:00
Alfred Perlstein
4f492bfab5 use __packed. 2002-09-23 18:54:32 +00:00
Poul-Henning Kamp
7812d86f03 (This commit touches about 15 disk device drivers in a very consistent
and predictable way, and I apologize if I have gotten it wrong anywhere,
getting prior review on a patch like this is not feasible, considering
the number of people involved and hardware availability etc.)

If struct disklabel is the messenger: kill the messenger.

Inside struct disk we had a struct disklabel which disk drivers used to
communicate certain metrics to the disklayer above (GEOM or the disk
mini-layer).  This commit changes this communication to use four
explicit fields instead.

Amongst the benefits is that the fields do not get overwritten by
wrong or bogus on-disk disklabels.

Once that is clear, <sys/disk.h> which is included in the drivers
no longer need to pull <sys/disklabel.h> and <sys/diskslice.h> in,
the few places that needs them, have gotten explicit #includes for
them.

The disklabel inside struct disk is now only for internal use in
the disk mini-layer, so instead of embedding it, we malloc it as
we need it.

This concludes (modulus any mistakes) the series of disklabel related
commits.

I belive it all amounts to a NOP for all the rest of you :-)

Sponsored by:   DARPA & NAI Labs.
2002-09-20 19:36:05 +00:00
Poul-Henning Kamp
c6ff03e2df Remove unused #includes: <sys/disk.h> <sys/devicestat.h> and <sys/sysctl.h>
Sponsored by:	DARPA & NAI Labs.
Approved by:	sos
2002-09-20 18:08:57 +00:00
Poul-Henning Kamp
f90c382c0c Make FreeBSD "struct disklabel" agnostic, step 311 of 723:
Rename diskerr() to disk_err() for naming consistency.

Drop the by now entirely useless struct disklabel argument.

Add a flag argument for new-line termination.

Fix a couple of printf-format-casts to %j instead of %l.

Correctly print the name of all bio commands.

Move the function from subr_disklabel.c to subr_disk.c,
and from <sys/disklabel.h> to <sys/disk.h>.

Use the new disk_err() throughout, #include <sys/disk.h> as needed.

Bump __FreeBSD_version for the sake of the aac disk drivers #ifdefs.

Remove unused disklabel members of softc for aac, amr and mlx, which seem
to originally have been intended for diskerr() use, but which only rotted
and got Copy&Pasted at least two times to many.

Sponsored by:   DARPA & NAI Labs.
2002-09-20 12:52:03 +00:00
Søren Schmidt
cea0b8e060 Add support for the VIA 8235.
Submitted by: Jason Dambrosio <jason@wiz.cx>
2002-09-18 09:39:37 +00:00
Søren Schmidt
568f03ed88 Fix the clockprobe test on the Sil 680 2002-09-16 09:37:26 +00:00
Poul-Henning Kamp
2f11d560cc remove #includes of <sys/bio.h> where not needed. 2002-09-14 18:59:32 +00:00
Søren Schmidt
a7089c2c4c Add preliminary mostly untested support for the Silicon Image Sil680 chip. 2002-09-12 15:25:59 +00:00
Thomas Quinot
9bdb4a0a3f Change a couple of splcam() calls that do not make sense in atapi-cam
(what we want to mask is the ATA interrupts, which run at level splbio),
and add interrupt masking around the statement that modifies the
request queue for a SIM.

This resolves problems reported by users under heavy ATAPI load.

Reviewed by:	roberto
2002-09-12 15:15:33 +00:00
Søren Schmidt
35ca7a483a Rearrange where to get the ATAPI magic sequence.
Submitted by: Benjamin Close <cisbjc@cs.unisa.edu.au>
2002-09-12 14:32:33 +00:00
Søren Schmidt
175f0ce5a4 Wait for drive to become ready if its in progress of loading..
Based on patch in PR-42659, but done somewhat differently.

PR: 42659
2002-09-12 13:55:24 +00:00
Søren Schmidt
9d54441f7f Dont hang in atprq on poll_dsc command.
This is a temporary fix until I get proper locking done.

Submitted by: iedowse@maths.tcd.ie
2002-09-12 13:53:33 +00:00
Nate Lawson
4927b7b149 printf -> CAM_DEBUG so debugging prints are tunable.
MFC after:	1 week
2002-08-28 07:03:44 +00:00