From ed@hoeg.nl  Mon Nov 19 19:42:39 2007
Return-Path: <ed@hoeg.nl>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EA62A16A469
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 19 Nov 2007 19:42:39 +0000 (UTC)
	(envelope-from ed@hoeg.nl)
Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:610:652::211])
	by mx1.freebsd.org (Postfix) with ESMTP id BC54913C448
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 19 Nov 2007 19:42:39 +0000 (UTC)
	(envelope-from ed@hoeg.nl)
Received: by palm.hoeg.nl (Postfix, from userid 1000)
	id 27A3F1CCC6; Mon, 19 Nov 2007 20:42:39 +0100 (CET)
Message-Id: <20071119194239.27A3F1CCC6@palm.hoeg.nl>
Date: Mon, 19 Nov 2007 20:42:39 +0100 (CET)
From: Ed Schouten <ed@fxq.nl>
Reply-To: Ed Schouten <ed@fxq.nl>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [Patch] ATA: Detect ATA controllers in MacBook3,1
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         118135
>Category:       kern
>Synopsis:       [ata] [patch] Detect ATA controllers in MacBook3,1
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    remko
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 19 19:50:01 UTC 2007
>Closed-Date:    Sat Aug 02 12:42:07 UTC 2008
>Last-Modified:  Sat Aug  2 12:50:00 UTC 2008
>Originator:     Ed Schouten
>Release:        FreeBSD 6.3-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD mekker.fxq.nl 8.0-CURRENT FreeBSD 8.0-CURRENT #1: Mon Nov 19 20:18:07 CET 2007 root@mekker.fxq.nl:/usr/obj/usr/src/sys/MEKKER  amd64
>Description:
Yesterday I made a dual-boot install from my new Apple MacBook3,1 (the
ones that have been released last month).

Because the FreeBSD ATA code doesn't yet know the device ID's from the
ATA chipsets, it shows that the devices are using UDMA33, while they can
do better.

According to various sources (Linux kernel mailing list, etc), I
discovered that only one of them is using SATA (the one used by the
harddisk) and that one doesn't use AHCI. My guess is that the ATA
controller uses UDMA5 or 6. Just to be safe, I selected 5, but someone
else can probably solve this question better.
>How-To-Repeat:
>Fix:
This patch:

--- src/sys/dev/ata/ata-chipset.c	2007-11-19 20:10:24.000000000 +0100
+++ src/sys/dev/ata/ata-chipset.c	2007-11-19 20:34:51.000000000 +0100
@@ -1788,8 +1788,10 @@
      { ATA_I82801HB_R1,  0, AHCI, 0x00, ATA_SA300, "ICH8" },
      { ATA_I82801HB_AH4, 0, AHCI, 0x00, ATA_SA300, "ICH8" },
      { ATA_I82801HB_AH6, 0, AHCI, 0x00, ATA_SA300, "ICH8" },
-     { ATA_I82801HBM_S1, 0, AHCI, 0x00, ATA_SA300, "ICH8M" },
+     { ATA_I82801HBM_S1, 0,    0, 0x00, ATA_SA150, "ICH8M" },
      { ATA_I82801HBM_S2, 0, AHCI, 0x00, ATA_SA300, "ICH8M" },
+     { ATA_I82801HBM_S3, 0, AHCI, 0x00, ATA_SA300, "ICH8M" },
+     { ATA_I82801HBM,    0,    0, 0x00, ATA_UDMA5, "ICH8M" },
      { ATA_I82801IB_S1,  0, AHCI, 0x00, ATA_SA300, "ICH9" },
      { ATA_I82801IB_S2,  0, AHCI, 0x00, ATA_SA300, "ICH9" },
      { ATA_I82801IB_AH2, 0, AHCI, 0x00, ATA_SA300, "ICH9" },
--- src/sys/dev/ata/ata-pci.h	2007-11-19 20:10:24.000000000 +0100
+++ src/sys/dev/ata/ata-pci.h	2007-11-19 20:34:51.000000000 +0100
@@ -168,8 +168,10 @@
 #define ATA_I82801HB_R1         0x28228086
 #define ATA_I82801HB_AH4        0x28248086
 #define ATA_I82801HB_S2         0x28258086
-#define ATA_I82801HBM_S1        0x28298086
-#define ATA_I82801HBM_S2        0x282a8086
+#define ATA_I82801HBM_S1        0x28288086
+#define ATA_I82801HBM_S2        0x28298086
+#define ATA_I82801HBM_S3        0x282a8086
+#define ATA_I82801HBM           0x28508086
 #define ATA_I82801IB_S1         0x29208086
 #define ATA_I82801IB_AH2        0x29218086
 #define ATA_I82801IB_AH6        0x29228086

makes my ATA devices show up like this:

atapci0: <Intel ICH8M UDMA100 controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0x30e0-0x30ef irq 21 at device 31.1 on pci0
ata0: <ATA channel 0> on atapci0
ata1: <ATA channel 1> on atapci0
atapci1: <Intel ICH8M SATA150 controller> port 0x30f8-0x30ff,0x311c-0x311f,0x30f0-0x30f7,0x3118-0x311b,0x3020-0x302f,0x4000-0x400f irq 18 at device 31.2 on pci0
ata2: <ATA channel 0> on atapci1
ata3: <ATA channel 1> on atapci1
acd0: DVDR <MATSHITADVD-R UJ-857E/ZF1E> at ata0-master UDMA66
ad0: 238475MB <FUJITSU MHY2250BH 0081000D> at ata2-master SATA150

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->remko 
Responsible-Changed-By: remko 
Responsible-Changed-When: Thu Jul 10 20:52:35 UTC 2008 
Responsible-Changed-Why:  
I'll take it. 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/118135: commit references a PR
Date: Thu, 10 Jul 2008 21:37:09 +0000 (UTC)

 remko       2008-07-10 21:36:53 UTC
 
   FreeBSD src repository
 
   Modified files:
     sys/dev/ata          ata-chipset.c ata-pci.h 
   Log:
   SVN rev 180437 on 2008-07-10 21:36:53Z by remko
   
   Detect ATA controllers in the Macbook3.
   
   PR:             118135
   Submitted by:   ed
   Approved by:    imp (mentor, implicit)
   MFC after:      1 week
   
   Revision  Changes    Path
   1.224     +2 -1      src/sys/dev/ata/ata-chipset.c
   1.89      +3 -2      src/sys/dev/ata/ata-pci.h
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: remko 
State-Changed-When: Thu Jul 10 21:40:56 UTC 2008 
State-Changed-Why:  
patched in current 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/118135: commit references a PR
Date: Sat,  2 Aug 2008 12:35:05 +0000 (UTC)

 remko       2008-08-02 12:34:49 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_7)
     sys/dev/ata          ata-chipset.c ata-pci.h 
   Log:
   SVN rev 181168 on 2008-08-02 12:34:49Z by remko
   
   MFC r180437
   
     Detect ATA controllers in the Macbook3.
   
     PR:           118135
     Submitted by: ed
     Approved by:  imp (mentor, implicit)
     MFC after:    1 week
   
   Approved by:    imp (mentor, implicit)
   
   Revision    Changes    Path
   1.202.2.11  +2 -1      src/sys/dev/ata/ata-chipset.c
   1.81.2.5    +3 -2      src/sys/dev/ata/ata-pci.h
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: remko 
State-Changed-When: Sat Aug 2 12:42:06 UTC 2008 
State-Changed-Why:  
Committed. Thanks! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/118135: commit references a PR
Date: Sat,  2 Aug 2008 12:40:25 +0000 (UTC)

 remko       2008-08-02 12:40:12 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     sys/dev/ata          ata-chipset.c ata-pci.h 
   Log:
   SVN rev 181172 on 2008-08-02 12:40:12Z by remko
   
   MFC r180437
   
       Detect ATA controllers in the Macbook3.
   
       PR:           118135
       Submitted by: ed
       Approved by:  imp (mentor, implicit)
       MFC after:    1 week
   
   Approved by:    imp (mentor, implicit)
   
   Revision    Changes    Path
   1.126.2.31  +2 -1      src/sys/dev/ata/ata-chipset.c
   1.49.2.19   +3 -2      src/sys/dev/ata/ata-pci.h
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
