From nobody@FreeBSD.org  Mon May 23 19:51:17 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 97137106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 23 May 2011 19:51:17 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 87A568FC17
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 23 May 2011 19:51:17 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p4NJpHLY037683
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 23 May 2011 19:51:17 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p4NJpHKH037682;
	Mon, 23 May 2011 19:51:17 GMT
	(envelope-from nobody)
Message-Id: <201105231951.p4NJpHKH037682@red.freebsd.org>
Date: Mon, 23 May 2011 19:51:17 GMT
From: Josh Carroll <josh.carroll@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Add support to ahci for Marvell 88SE9172 (patch included)
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         157281
>Category:       kern
>Synopsis:       [ahci] [patch] Add support to ahci for Marvell 88SE9172 (patch included)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 23 20:00:19 UTC 2011
>Closed-Date:    Thu Jun 30 19:24:19 UTC 2011
>Last-Modified:  Thu Jun 30 19:24:19 UTC 2011
>Originator:     Josh Carroll
>Release:        8.2-RELEASE amd64
>Organization:
n/a
>Environment:
FreeBSD pflog.net 8.2-RELEASE-p1 FreeBSD 8.2-RELEASE-p1 #0 r222170M: Sun May 22 01:32:51 PDT 2011     root@pflog.net:/usr/obj/usr/src/sys/PFLOG  amd64
>Description:
The secondary SATA controller on the Asus P8Z68-V pro motherboard is a Marvell 88SE9172.

This request is to add support to sys/dev/ahci/ahci.c for this motherboard. I added the following to ahci_ids[] modeling it after the entry for the 9182. The revision on this motherboard for the controller is 0x11 as reported by pciconf. Here is the additional entry to ahci_ids[]:

    {0x91721b4b, 0x11, "Marvell 88SE9172",  AHCI_Q_NOBSYRES},

After applying this update and booting with the new kernel, the controller is properly attached to ahci(4) and I can see devices on the controller and use them. Here is dmesg output with the above change:

ahci0: <Marvell 88SE9172 AHCI SATA controller> port 0xb040-0xb047,0xb030-0xb033,0xb020-0xb027,0xb010-0xb013,0xb000-0xb00f mem 0xfb810000-0xfb8101ff irq 19 at device 0.0 on pci9
ahci0: [ITHREAD]
ahci0: AHCI v1.00 with 2 6Gbps ports, Port Multiplier supported with FBS
ahcich0: <AHCI channel> at channel 0 on ahci0
ahcich0: [ITHREAD]
ahcich1: <AHCI channel> at channel 1 on ahci0
ahcich1: [ITHREAD]

And camcontrol devlist output for the controller:

scbus0 on ahcich0 bus 0:
<>                                 at scbus0 target -1 lun -1 ()
scbus1 on ahcich1 bus 0:
<WDC WD4000AAKS-00A7B0 01.03B01>   at scbus1 target 0 lun 0 (ada0,pass0)
<>                                 at scbus1 target -1 lun -1 ()

Here is the pciconf -lcvb output corresponding to this controller:

ahci0@pci0:9:0:0:   class=0x010601 card=0x84771043 chip=0x91721b4b rev=0x11 hdr=0x00
    class      = mass storage
    subclass   = SATA
    bar   [10] = type I/O Port, range 32, base 0xb040, size  8, enabled
    bar   [14] = type I/O Port, range 32, base 0xb030, size  4, enabled
    bar   [18] = type I/O Port, range 32, base 0xb020, size  8, enabled
    bar   [1c] = type I/O Port, range 32, base 0xb010, size  4, enabled
    bar   [20] = type I/O Port, range 32, base 0xb000, size 16, enabled
    bar   [24] = type Memory, range 32, base 0xfb810000, size 512, enabled
    cap 01[40] = powerspec 3  supports D0 D3  current D0
    cap 05[50] = MSI supports 1 message enabled with 1 message
    cap 10[70] = PCI-Express 2 legacy endpoint max data 128(512) link x1(x1)

I have not observed any adverse problems with the disk on the controller since I updated the kernel.  It seems to be working fine.
>How-To-Repeat:
Attempt to use a disk on the Marvell 88SE9172 controller without the attached patch, and the disk is not visible/usable.
>Fix:
See attached patch, adding the 88SE9172 to the ahci_ids[].

Patch attached with submission follows:

--- ahci.c.orig	2011-05-23 12:37:15.000000000 -0700
+++ ahci.c	2011-05-23 12:46:35.000000000 -0700
@@ -194,6 +194,7 @@
 	{0x91201b4b, 0x00, "Marvell 88SE912x",	AHCI_Q_EDGEIS|AHCI_Q_NOBSYRES},
 	{0x91231b4b, 0x11, "Marvell 88SE912x",	AHCI_Q_NOBSYRES},
 	{0x91231b4b, 0x00, "Marvell 88SE912x",	AHCI_Q_EDGEIS|AHCI_Q_SATA2|AHCI_Q_NOBSYRES},
+	{0x91721b4b, 0x11, "Marvell 88SE9172",	AHCI_Q_NOBSYRES},
 	{0x91821b4b, 0x00, "Marvell 88SE9182",	AHCI_Q_NOBSYRES},
 	{0x06201103, 0x00, "HighPoint RocketRAID 620",	AHCI_Q_NOBSYRES},
 	{0x06201b4b, 0x00, "HighPoint RocketRAID 620",	AHCI_Q_NOBSYRES},


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->patched 
State-Changed-By: mav 
State-Changed-When: Thu May 26 18:52:30 UTC 2011 
State-Changed-Why:  
Patch committed to 9-CURRENT. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=157281 

From: Mark Linimon <linimon@lonesome.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/157281: [ahci] [patch] Add support to ahci for Marvell
 88SE9172 (patch included)
Date: Mon, 30 May 2011 09:36:31 -0500

 ----- Forwarded message from Josh Carroll <josh.carroll@gmail.com> -----
 
 Date: Sat, 28 May 2011 22:50:54 -0700
 From: Josh Carroll <josh.carroll@gmail.com>
 To: mav@freebsd.org, freebsd-bugs@freebsd.org
 Subject: Re: kern/157281: [ahci] [patch] Add support to ahci for Marvell
 	88SE9172 (patch included)
 
 Working fine with the same patch (well, the relevant line anyway)
 against 8.2-RELEASE's sys/dev/ahci/ahci.c, so far so good.
 
 Thanks again!
 Josh
 
 ----- End forwarded message -----
State-Changed-From-To: patched->closed 
State-Changed-By: mav 
State-Changed-When: Thu Jun 30 19:23:59 UTC 2011 
State-Changed-Why:  
Patch merged to 8-STABLE. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=157281 
>Unformatted:
