Commit Graph

875 Commits

Author SHA1 Message Date
mav
2734f2ef98 - Report SATA in legacy emulation mode still as SATA.
- Make ATA XPT able to handle such case.
2010-01-10 09:20:56 +00:00
mbr
7450f52a57 Remove extraneous semicolons, no functional changes.
Submitted by:	Marc Balmer <marc@msys.ch>
MFC after:	1 week
2010-01-07 21:01:37 +00:00
mav
f60568ce2e Add BIO_DELETE support to ada(4):
- For SSDs use TRIM feature of DATA SET MANAGEMENT command, as defined by
ACS-2 specification working draft.
- For CompactFlash use CFA ERASE command, same as ad(4) does.

With this patch, `newfs -E /dev/ada1` was able to restore write speed of
my heavily weared OCZ Vertex SSD (firmware 1.4) up to the initial level
for the most part of it's capacity. Previous 1.3 firmware, even reportiong
TRIM capabilty bit set, was not working, reporting ABORT error for every
DSM command.

I have no idea whether it is normal, but for some reason it takes 200ms
to handle any TRIM command on this drive, that was making delete extremely
slow. But TRIM command is able to accept long list of LBAs and the length of
that list seems doesn't affect it's execution time. Implemented request
clusting algorithm allowed me to rise delete rate up to reasonable numbers,
when many parallel DELETE requests running.
2009-12-28 20:08:01 +00:00
mav
88b0564b4a Report stripe size only if physical sector size is not equal to logical. 2009-12-24 21:54:44 +00:00
mav
c211a09bc5 Remove duplicate devstat_start_transaction_bio() call. It is already called
from geom_disk. Dulicate call causes wrong queue depth and busy accounting.
2009-12-18 14:41:30 +00:00
mav
7424576c84 Clear result before requesting XPT_PATH_INQ.
Many SIMs doesn't fill maxio field yet.
2009-12-09 14:21:21 +00:00
mav
537829a1a5 MFp4;
- Cleanup kernel messages, mostly PMP.
- Took references on devices, while PMP reinitializes them, to not let them
go and distort freeze reference counting.
2009-12-07 16:23:25 +00:00
mav
3b25356a7f MFp4:
If we panicked with SIM lock held, do not try to flush caches.
Extra lock recursing will not make debugging easier.
2009-12-06 11:48:53 +00:00
mav
6a3018e7cf MFp4:
Introduce ATA_CAM kernel option, turning ata(4) controller drivers into
cam(4) interface modules. When enabled, this options deprecates all ata(4)
peripheral drivers (ad, acd, ...) and interfaces and allows cam(4) drivers
(ada, cd, ...) and interfaces to be natively used instead.

As side effect of this, ata(4) mode setting code was completely rewritten
to make controller API more strict and permit above change. While doing
this, SATA revision was separated from PATA mode. It allows DMA-incapable
SATA devices to operate and makes hw.ata.atapi_dma tunable work again.

Also allow ata(4) controller drivers (except some specific or broken ones)
to handle larger data transfers. Previous constraint of 64K was artificial
and is not really required by PCI ATA BM specification or hardware.

Submitted by:	nwitehorn (powerpc part)
2009-12-06 00:10:13 +00:00
scottl
b6444e150f Fix several cases where the periph lock was held over malloc.
Submitted by:	Jaakko Heinonen
2009-12-02 16:08:33 +00:00
mav
2f9ebae5d3 Add CAM_ATAIO_DMA ATA command flag to mark DMA protocol commands.
It is not needed for SATA controllers, but required for PATA.
2009-12-01 23:01:29 +00:00
mav
7c0d54bcfc MFp4:
Improve ATA mode/SATA revision control.
2009-11-26 08:49:46 +00:00
mav
d4d8d346dc Fix small copu-paste bug. 2009-11-25 14:24:14 +00:00
mav
b24d810911 MFp4:
- Extend XPT-SIM transfer settings control API. Now it allows to report to
SATA SIM number of tags supported by each device, implement ATA mode and
SATA revision negotiation for both SATA and PATA SIMs.
- Make ahci(4) and siis(4) to use submitted maximum tag number, when
scheduling requests. It allows to support NCQ on devices with lower tags
count then controller supports.
- Make PMP driver to report attached devices connection speeds.
- Implement ATA mode negotiation between user settings, device and
controller capabilities.
2009-11-24 12:47:58 +00:00
mav
fcc28e89e2 Disable PortMultiplier Async Notifications for time of ports reset.
They are useless at that time, but confuse Marvell AHCI.

Add quirk for SiI57XX Port Multipliers, to hide extra port.
2009-11-16 15:18:02 +00:00
mav
3579059b77 MFp4:
Some more missed parts from previous commits.
2009-11-14 20:30:42 +00:00
mav
c8c30ba379 MFp4:
Remove code that years ago was closing race between request submission
to SIM and device/SIM freeze. That race become impossible after moving from
spl to mutex locking, while this workaround causes some unexpected effects.
2009-11-14 20:23:20 +00:00
mav
2f5418e2b9 MFp4:
Fix several device freeze counting bugs.
2009-11-14 20:13:38 +00:00
mav
c95dd39afe MFp4:
Do not enable tagged queueing if controller reports 0 tags support.
2009-11-14 08:08:49 +00:00
mav
17cadb1aa5 MFp4:
- Move tagged queueing control from ADA to ATA XPT. It allows to control
  device command queue length correctly. First step to support < 32 tags.
- Limit queue for non-tagged devices by 2 slots for ahci(4) and siis(4).
- Implement quirk matching for ATA devices.
- Move xpt_schedule_dev_sendq() from header to source file.
- Move delayed queue shrinking to the more expected place - element freeing.
- Remove some SCSIsms in ATA.
2009-11-11 11:10:36 +00:00
mav
4ae82cac5a MFp4:
Implement device stats accounting for ATA commands.
2009-11-05 08:55:24 +00:00
mav
eeda889003 Fix protype. 2009-11-04 16:37:13 +00:00
mav
0d34760a30 PMP commands use short format. PMP write doesn't return result. 2009-11-04 16:16:50 +00:00
mav
60555b7f32 MFp4:
- Remove CAM_PERIPH_POLLED flag. It is broken by design. Polling can't be
periph flag. May be SIM, may be CCB, but now it works fine just without it.
- Remove check unused for at least five years. If we will ever have non-BIO
devices in CAM, this check is smallest of what we will need.
- If several controllers complete requests same time, call swi_sched()
only once.
2009-11-04 15:40:19 +00:00
mav
3b2c41e094 MFp4:
- Add support for sector size > 512 bytes and physical sector of several
logical sectors, introduced by ATA-7 specification.
- Remove some obsoleted code.
2009-11-04 15:24:32 +00:00
mav
73c660a883 MFp4:
Improve reporting ATA Status error details.
2009-11-03 11:19:05 +00:00
thompsa
8bc2cf3863 Provide the same sanity check on the sector size in dagetcapacity as when the
disk is first probed. dagetcapacity is called whenever the disk is opened from
geom via d_open(), a zero sector size will cause geom to panic later on.
2009-11-02 23:30:15 +00:00
mav
66bbab4f74 The async callback could free the device. If it is a broadcast async,
it doesn't hold device reference, so take our own reference.

Submitted by:   thompsa
2009-11-02 08:31:00 +00:00
mav
f730b0005e MFp4:
Fix reference counting bug, when device unreferenced before then
invalidated. To do it, do not handle validity flag as another
reference, but explicitly modify reference count each time flag is
modified.

Discovered by:	thompsa
2009-11-01 11:31:06 +00:00
mav
924c32a1e2 MFp4:
- Reduce code duplication in ATA XPT and PMP driver.
- Move PIO size setting from ada driver to ATA XPT. It is XPT business
to negotiate transfer details. ada driver is now stateless.
- Report PIO size to SIM. It is required for correct PATA SIM operation.
- Tune PMP scan timings. It workarounds some problems with SiI.
- If reset hapens during PMP initialization - restart it.
- Introduce early-initialized periph drivers, which are used during initial
scan process. Use it for xpt, probe, aprobe and pmp. It gives pmp chance
to finish scan before mountroot and numerate devices in right order.
2009-10-31 10:43:38 +00:00
mav
c621c3c0b4 MFp4:
Ensure target/lun passed from user-level supported on this bus.
Scanning unsupported IDs causes different issues from duplicate
devices to system crash.
2009-10-31 09:03:48 +00:00
mav
e0351f030b Make "Retrying Command" to be printed before actual retrying.
It should make debug/error log a bit more readable.
2009-10-23 13:39:30 +00:00
mav
737d93433c MFp4:
Move Port Multiplier support code out of ATA XPT into pmp periph driver.
This is convinient, as PMP itself is a bus target and has own state.
2009-10-23 12:36:42 +00:00
mav
8b90cff22d Fix the build. 2009-10-23 11:26:58 +00:00
mav
ab67e90581 Replace most of priority numbers with defines. No logical changes. 2009-10-23 08:27:55 +00:00
mav
f23b3653c1 Remove some obsoleted comments. 2009-10-23 07:54:15 +00:00
mav
127ea9fc88 After thinking again, implement cam_ccbq_fini().
This is effectively NULL change, but makes this API a bit more consistent.
2009-10-22 21:07:32 +00:00
mav
f7033e8b18 cam_ccbq_fini() declared for 11 years, but never implemented. Remove it. 2009-10-22 20:44:55 +00:00
brueffer
ea57e2fd11 Fix a memory leak in an error case.
PR:		138376
Submitted by:	Patroklos Argyroudis <argp@census-labs.com>
Reviewed by:	scottl
MFC after:	1 week
2009-10-22 06:13:07 +00:00
mav
e4fb54a8c1 MFp4:
Do not search for bus when it is not needed,
2009-10-21 15:57:16 +00:00
mav
edb3a69fdb MFp4:
Separate CAM_DEV_IDENTIFY_DATA_VALID flag from CAM_DEV_INQUIRY_DATA_VALID.
Add workaround for very old devices without support for mode setting.
Add some PATA bus scanning support.
Remove some SCSIsms.
2009-10-21 15:27:48 +00:00
mav
cc204586da MFp4:
Add support for PIO-only devices.
Fix maxio values and 256 sectors transactions for 28bits commands.
Implement periodic ordered commands insertion, sames as da driver does.
Remove some SCSIsms.
2009-10-21 14:20:55 +00:00
mav
bd4f73fc0a MFp4:
Report real max_target = 15. SIM doesn't need to know that target 15 is PMP.
It is XPT business.
2009-10-21 13:00:01 +00:00
pjd
5c6baa445d Export disk serial numbers for adaX disks.
Reviewed by:	mav
MFC after:	3 days
2009-10-09 09:29:59 +00:00
mav
d397ebb9a8 Report SATA 3.x devices. 2009-09-27 20:50:54 +00:00
mav
d9e3a566ae MFp4:
If on sense request device returns no sence, give up and return,
or we may loop forever.
2009-09-22 22:23:52 +00:00
mjacob
e116e5b346 Remember to unlock the peripheral prior to notifying the user. Make some
allocations M_NOWAIT so that we don't try and sleep with a nested non-sleepable
lock.

This makes the userland scsi_target begin to function again.

Obtained from:	Sean Bruno
MFC after:	1 month
2009-09-19 20:25:54 +00:00
ken
f2066f0140 Fix some instances where CAM rescans get hung up or take a long time to
complete.

Also, allow xpt_rescan() to rescan a LUN instead of a full bus.

MFC after:	3 days
Sponsored by:	Copan Systems, Inc.
2009-09-15 00:15:24 +00:00
rwatson
53eaed07bc Use C99 initialization for struct filterops.
Obtained from:	Mac OS X
Sponsored by:	Apple Inc.
MFC after:	3 weeks
2009-09-12 20:03:45 +00:00
scottl
d54317171d Free the correct buffer in an error case.
Submitted by:	phk
2009-09-08 16:09:28 +00:00