Re: How do I use NCQ of Intel X25-E(SSD) on ahci(4)?

From: Norikatsu Shigemura <nork_at_FreeBSD.org>
Date: Thu, 19 Nov 2009 02:14:40 +0900
Hi Alexander.

On Wed, 18 Nov 2009 18:38:28 +0200
Alexander Motin <mav_at_freebsd.org> wrote:
> > Native Command Queuing (NCQ)   yes              30/0x1E
> 
> Here is the reason                                ^^^
> This drive support less tags (31) then your AHCI controller does (32).
> Support for such case is not implemented yet. As temporary solution you
> may limit controller to use only 31 tag, then NCQ will be used. All you
> need is to go to ahci.c and change line
> ch->numslots = ...;
> to
> ch->numslots = min(31, ...);

	Oops, OK!  I confirmed following patch:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
--- sys/dev/ahci/ahci.c.orig    2009-11-17 22:25:07.474418000 +0900
+++ sys/dev/ahci/ahci.c 2009-11-19 02:00:22.193688908 +0900
_at__at_ -779,7 +779,7 _at__at_
 	ch->caps = ctlr->caps;
 	ch->caps2 = ctlr->caps2;
 	ch->quirks = ctlr->quirks;
-	ch->numslots = ((ch->caps & AHCI_CAP_NCS) >> AHCI_CAP_NCS_SHIFT) + 1,
+	ch->numslots = min(31, ((ch->caps & AHCI_CAP_NCS) >> AHCI_CAP_NCS_SHIFT) + 1),
 	mtx_init(&ch->mtx, "AHCI channel lock", NULL, MTX_DEF);
 	resource_int_value(device_get_name(dev),
 	    device_get_unit(dev), "pm_level", &ch->pm_level);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

	ahci(4) can use NCQ of X25-E.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ada0 at ahcich0 bus 0 scbus0 target 0 lun 0
ada0: <SSDSA2SH064G1GC INTEL 045C8790> ATA/ATAPI-7 SATA 2.x device
ada0: 300.000MB/s transfers
ada0: Command Queueing enabled
ada0: 61057MB (125045424 512 byte sectors: 16H 63S/T 16383C)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# camcontrol tags ada0
(pass0:ahcich0:0:0:0): device openings: 31
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

	Thank you!
Received on Wed Nov 18 2009 - 16:14:47 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:58 UTC