Hi. I want to notice, that I've just merged from HEAD to 8-STABLE latest results of my last months work on CAM-based ATA implementation and CAM subsystem itself. Please contact me if you will have any problems, questions, propositions, ... What's done: - major code cleanup. Many SCSIsms in ATA code removed, or reworked for ATA specifics. Many ATA support parts reworked or newly implemented; - CAM code took some fixes and optimizations. Luckily no major changes were required yet. - NCQ support re-factored. Same as for SCSI, non-capable devices now limited by queue depth of 2, to let request sorter do it's job better. - Port Multipliers support re-factored. Is is more stable now. Devices hot-insert/remove supported. Implemented reinitialization after bus resets. - ahci(4) and siis(4) drivers took many changes, including improved timeout handling, error recovery and performance optimizations. - added basic support for PATA transport. After ata(4) drivers wrapper will be finished, it will allow to completely disable old ATA infrastructure. - camcontrol tool now reports more information about ATA devices and supports ATA Power Management. - added support for ATA devices with large sector size, declared by ATA-7 spec (only theoretically now, I haven't seen such yet) - added quirks mechanism for ATA, to allow, for example, to disable NCQ, or later DMA, for specific device model or firmware revision, - added support for DMA-incapable, and some old ATA devices; - implemented ATA error reporting. Things to be done yet: - timeouts and hard errors recovery process with Port Multipliers used can cause deadlocks if happen under heavy load. Any way it is a step forward, as previously it just was not recovering at all. - devices connected using Port Multipliers detected asynchronously, and in some cases they may not get in time for root mounting. - interface mode control possible only using loader tunables, but not with camcontrol. - NCQ is not used for devices with less tags supported then controller capable (it is quite rare). Many thanks to iXsystems Inc for supporting my work, making this all possible. Also thanks to Vitsch Electronics, Sentex Corp, lissyara.su, and many other people for hardware donations. Feedbacks are welcome as always. -- Alexander Motin
Alexander Motin wrote:> Feedbacks are welcome as always.Today's RELENG_8 build is broken (my /usr/src is symlink to /usr/local/src): # make -j3 MODULES_WITH_WORLD=yes buildworld [skip] ===> sys/modules/ahci (all) cc -O2 -pipe -march=prescott -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc -I. -I@ -I@/contrib/altq -finline-limit=8000 --param inline-unit-gr owth=100 --param large-function-growth=1000 -fno-common -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -ffreestanding -fstack-protector -std=iso9899:1999 -fstack-protector -Wall -Wred undant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointe r-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -c / usr/local/src/sys/modules/ahci/../../dev/ahci/ahci.c /usr/local/src/sys/modules/ahci/../../dev/ahci/ahci.c: In function 'ahci_timeout ': /usr/local/src/sys/modules/ahci/../../dev/ahci/ahci.c:1286: error: 'struct ahci_ channel' has no member named 'fatalerr' /usr/local/src/sys/modules/ahci/../../dev/ahci/ahci.c: In function 'ahci_end_tra nsaction': /usr/local/src/sys/modules/ahci/../../dev/ahci/ahci.c:1368: error: 'struct ahci_ channel' has no member named 'fatalerr' /usr/local/src/sys/modules/ahci/../../dev/ahci/ahci.c:1384: error: 'struct ahci_ channel' has no member named 'fatalerr' /usr/local/src/sys/modules/ahci/../../dev/ahci/ahci.c:1396: error: 'struct ahci_ channel' has no member named 'fatalerr' /usr/local/src/sys/modules/ahci/../../dev/ahci/ahci.c:1405: error: 'struct ahci_ channel' has no member named 'fatalerr' /usr/local/src/sys/modules/ahci/../../dev/ahci/ahci.c:1447: error: 'struct ahci_ channel' has no member named 'fatalerr' /usr/local/src/sys/modules/ahci/../../dev/ahci/ahci.c: In function 'ahci_reset': /usr/local/src/sys/modules/ahci/../../dev/ahci/ahci.c:1703: error: 'struct ahci_ channel' has no member named 'fatalerr' *** Error code 1 Stop in /usr/local/src/sys/modules/ahci. *** Error code 1 Stop in /usr/local/src/sys/modules. *** Error code 1 Stop in /usr/local/src/sys. *** Error code 1 Stop in /usr/local/src. *** Error code 1 Stop in /usr/local/src. *** Error code 1 Stop in /usr/local/src.
According to Alexander Motin:> Feedbacks are welcome as always.Working fine from here, on a recent Dell T3500 with ICH8/ICH10 controllers (ATA/AHCI). Thanks a lot! Disks were renamed from ad{4,6,8} into ada{0,1,2}. I'm using a full-GPT-ZFS setup here. ZFS mounted all pools w/o any issue and seems to be using the gptids instead of the /dev/adNp3 partitions. Swap is not on ZFS but I added GPT labels with gpart and glabel added the /dev/gpt entries so swap is fine too. See below: ahci0: <Intel ICH10 AHCI SATA controller> port 0xfe00-0xfe07,0xfe10-0xfe13,0xfe20-0xfe27,0xfe30-0xfe33,0xfec0-0xfedf mem 0xff970000-0xff9707ff irq 20 at device 31.2 on pci0 ahci0: [ITHREAD] ahci0: AHCI v1.20 with 6 3Gbps ports, Port Multiplier not supported ahcich0: <AHCI channel> at channel 0 on ahci0 ahcich0: [ITHREAD] ahcich1: <AHCI channel> at channel 1 on ahci0 ahcich1: [ITHREAD] ahcich2: <AHCI channel> at channel 2 on ahci0 ahcich2: [ITHREAD] ahcich3: <AHCI channel> at channel 3 on ahci0 ahcich3: [ITHREAD] ahcich4: <AHCI channel> at channel 4 on ahci0 ahcich4: [ITHREAD] ahcich5: <AHCI channel> at channel 5 on ahci0 ahcich5: [ITHREAD] ... (aprobe0:ahcich0:0:0:0): SIGNATURE: 0000 (aprobe1:ahcich1:0:0:0): SIGNATURE: 0000 (aprobe2:ahcich2:0:0:0): SIGNATURE: 0000 (aprobe3:ahcich3:0:0:0): SIGNATURE: eb14 ada0 at ahcich0 bus 0 scbus0 target 0 lun 0 ada0: <ST3320418AS CC44> ATA/ATAPI-8 SATA 2.x device ada0: 300.000MB/s transfers ada0: Command Queueing enabled ada0: 305245MB (625142448 512 byte sectors: 16H 63S/T 16383C) cd0 at ahcich3 bus 0 scbus3 target 0 lun 0 cd0: <PLDS DVD-ROM DH-16D5S VD15> Removable CD-ROM SCSI-0 device cd0: 150.000MB/s transfers cd0: Attempt to query device size failed: NOT READY, Medium not present - tray closed ada1 at ahcich1 bus 0 scbus1 target 0 lun 0 ada1: <ST3320418AS CC44> ATA/ATAPI-8 SATA 2.x device ada1: 300.000MB/s transfers ada1: Command Queueing enabled ada1: 305245MB (625142448 512 byte sectors: 16H 63S/T 16383C) ada2 at ahcich2 bus 0 scbus2 target 0 lun 0 ada2: <ST3320418AS CC44> ATA/ATAPI-8 SATA 2.x device ada2: 300.000MB/s transfers ada2: Command Queueing enabled ada2: 305245MB (625142448 512 byte sectors: 16H 63S/T 16383C) 411 [0:31] roberto@ng:~> swapinfo Device 1K-blocks Used Avail Capacity /dev/gpt/swap0 4194304 0 4194304 0% /dev/gpt/swap1 4194304 0 4194304 0% /dev/gpt/swap2 4194304 0 4194304 0% Total 12582912 0 12582912 0%
Jeremy Chadwick wrote:> AHCI in the BIOS is enabled, AHCI in FreeBSD is in use. > > Kernel configuration is below my .sig, ditto with dmesg. World sources > are from ~45 minutes prior to kernel build date (2009/11/17 20:07 PST). > > FreeBSD icarus.home.lan 8.0-PRERELEASE FreeBSD 8.0-PRERELEASE #0: Tue Nov 17 20:07:21 PST 2009 root@icarus.home.lan:/usr/obj/usr/src/sys/X7SBA_RELENG_8_amd64 amd64 > > Like I said, this whole thing needs to get documented.FreeBSD now has two AHCI drivers - legacy ataahci from ata(4) infrastructure and new ahci(4) from CAM. According to atapci0: <Intel ICH9 SATA300 controller> ... you are using legacy one. New one reports as ahci0: <Intel ICH8M AHCI SATA controller> ... -- Alexander Motin
Jeremy Chadwick wrote:> On Thu, Nov 19, 2009 at 10:22:53AM +0200, Alexander Motin wrote: >> Read ahci(4) carefully. It has all possible references. If you think it >> is not enough, propose patches. > > I had no idea said details were in the ahci(4) man page, and I doubt the > rest of the user community will know that either. There's also no man > page for ada(4). > > There is some ambiguity in this part of the ahci(4) man page: > > AHCI hardware is also supported by ataahci driver from ata(4) subsystem. > If both drivers are loaded at the same time, this one will be given > precedence as the more functional of the two. > > The grammar here is very difficult to understand; "if both drivers" is > too vague. The way this paragraph can be interpreted: > > - "If both drivers" could refer to ata(4) and ataahciNo. ataahci is a part of ata(4).> - "If both drivers" could refer to ata(4) and ahci(4)Yes, if with ata(4) understand it's ataahci part.> - "If both drivers" could refer to ada(4) and ahci(4)No. It is mentioned in ahci(4), that ada is peripheral driver. Not a controller.> - "If both drivers" could refer to ahci(4) and ata(4)It is same as second.> I'll happily re-write the documentation for this if someone can take the > time to explain what the paragraph actually is trying to say.Welcome.> Users are > going to be very, very confused if there is a driver called ataahci and > another driver called ahci.This is temporal situation, until new infrastructure will settle. Then old one will be removed.> Finally, appropriate details need to be placed into the i386 and amd64 > kernel configuration files; either in GENERIC (commented out) or in > /sys/conf/NOTES. As it stands, there's nothing that informs anyone of > this change, and if users are being pointed to the ahci(4) man page, > they're going to get confused (see above).Both new ahci and siis drivers are mentioned in NOTES file. -- Alexander Motin
On Wed, 2009-11-18 at 01:30 +0200, Alexander Motin wrote:> Feedbacks are welcome as always. >Works here (ThinkPad X60): ahci0: <Intel ICH7M AHCI SATA controller> port 0x18d0-0x18d7,0x18c4-0x18c7,0x18c8-0x18cf,0x18c0-0x18c3,0x18b0-0x18bf mem 0xee444400-0xee4447ff irq 16 at device 31.2 on pci0 ahci0: [ITHREAD] ahci0: AHCI v1.10 with 4 1.5Gbps ports, Port Multiplier not supported ahcich0: <AHCI channel> at channel 0 on ahci0 RabbitsDen# camcontrol tags ada0 (pass0:ahcich0:0:0:0): device openings: 32 RabbitsDen# Thank you for doing this work. -- Alexandre Kovalenko (????????? ?????????)
On Thu, 2009-11-19 at 22:43 -0500, Alexandre "Sunny" Kovalenko wrote:> On Wed, 2009-11-18 at 01:30 +0200, Alexander Motin wrote: > > Feedbacks are welcome as always. > > > Works here (ThinkPad X60): > > ahci0: <Intel ICH7M AHCI SATA controller> port > 0x18d0-0x18d7,0x18c4-0x18c7,0x18c8-0x18cf,0x18c0-0x18c3,0x18b0-0x18bf > mem 0xee444400-0xee4447ff irq 16 at device 31.2 on pci0 > ahci0: [ITHREAD] > ahci0: AHCI v1.10 with 4 1.5Gbps ports, Port Multiplier not supported > ahcich0: <AHCI channel> at channel 0 on ahci0 > > RabbitsDen# camcontrol tags ada0 > (pass0:ahcich0:0:0:0): device openings: 32 > RabbitsDen#Might be of interest for some other people out there: with this driver, I can suspend/resume my ThinkPad X60 with UP kernel -- the original ATA driver was going into the timeout loop upon resume. -- Alexandre Kovalenko (????????? ?????????)