patch for review: ATI SB600 SATA AHCI

Jakub Siroky jakob at dev.citybikes.cz
Sun Jan 20 02:27:39 PST 2008


Hello,

I've been using these patches for some time with success. Although
slight correction to patches is needed - code placement changed a bit
(in case of line wrapping, see the attachments). 

--- ata-chipset.c.orig  Mon Oct  9 23:01:35 2006
+++ ata-chipset.c       Wed Sep  5 22:08:02 2007
@@ -1239,12 +1239,16 @@
     struct ata_pci_controller *ctlr = device_get_softc(dev);
     struct ata_chip_id *idx;
     static struct ata_chip_id ids[] =
-    {{ ATA_ATI_IXP200,    0x00, 0,        0, ATA_UDMA5, "IXP200" },
-     { ATA_ATI_IXP300,    0x00, 0,        0, ATA_UDMA6, "IXP300" },
-     { ATA_ATI_IXP400,    0x00, 0,        0, ATA_UDMA6, "IXP400" },
-     { ATA_ATI_IXP300_S1, 0x00, SIIMEMIO, 0, ATA_SA150, "IXP300" },
-     { ATA_ATI_IXP400_S1, 0x00, SIIMEMIO, 0, ATA_SA150, "IXP400" },
-     { ATA_ATI_IXP400_S2, 0x00, SIIMEMIO, 0, ATA_SA150, "IXP400" },
+    {{ ATA_ATI_IXP200,    0x00, 0,        0,         ATA_UDMA5,
"IXP200" },
+     { ATA_ATI_IXP300,    0x00, 0,        0,         ATA_UDMA6,
"IXP300" },
+     { ATA_ATI_IXP400,    0x00, 0,        0,         ATA_UDMA6,
"IXP400" },
+     { ATA_ATI_IXP600,    0x00, 0,        ATISINGLE, ATA_UDMA6,
"IXP600" },
+     { ATA_ATI_IXP700,    0x00, 0,        ATISINGLE, ATA_UDMA6,
"IXP700" },
+     { ATA_ATI_IXP300_S1, 0x00, SIIMEMIO, 0,         ATA_SA150,
"IXP300" },
+     { ATA_ATI_IXP400_S1, 0x00, SIIMEMIO, 0,         ATA_SA150,
"IXP400" },
+     { ATA_ATI_IXP400_S2, 0x00, SIIMEMIO, 0,         ATA_SA150,
"IXP400" },
+     { ATA_ATI_IXP600_S1, 0x00, 0,        AHCI,      ATA_SA300,
"IXP600" },
+     { ATA_ATI_IXP700_S1, 0x00, 0,        AHCI,      ATA_SA300,
"IXP700" }, { 0, 0, 0, 0, 0, 0}};
     char buffer[64];
 
@@ -1271,6 +1275,18 @@
 
     if (ata_setup_interrupt(dev))
        return ENXIO;
+
+    if (ctlr->chip->cfg2 & AHCI) {
+       ctlr->r_rid2 = PCIR_BAR(5);
+       ctlr->r_type2 = SYS_RES_MEMORY;
+       if ((ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2,
+                                                       &ctlr->r_rid2,
+                                                       RF_ACTIVE)))
+          return ata_ahci_chipinit(dev);
+    }
+
+    if (ctlr->chip->cfg2 & ATISINGLE)
+       ctlr->channels = 1;
 
     ctlr->setmode = ata_ati_setmode;
     return 0;

-- ata-pci.h.orig       Sat Sep 30 21:51:49 2006
+++ ata-pci.h   Wed Sep  5 22:00:21 2007
@@ -102,6 +102,10 @@
 #define ATA_ATI_IXP300_S1       0x436e1002
 #define ATA_ATI_IXP400_S1       0x43791002
 #define ATA_ATI_IXP400_S2       0x437a1002
+#define ATA_ATI_IXP600_S1       0x43801002
+#define ATA_ATI_IXP600          0x438c1002
+#define ATA_ATI_IXP700_S1       0x43901002
+#define ATA_ATI_IXP700          0x439c1002
 
 #define ATA_CENATEK_ID          0x16ca
 #define ATA_CENATEK_ROCKET      0x000116ca
@@ -415,6 +419,7 @@
 #define VIABUG          0x0200
 #define VIABAR          0x0400
 #define VIAAHCI         0x0800
+#define ATISINGLE       0x1000


On Sun, 20 Jan 2008 04:13:34 +0100
Volker <volker at vwsoft.com> wrote:

> Hi!
> 
> I've done the following local changes to get the ATA controller being
> correctly detected and initialized as an AHCI controller on an HP
> 6715b notebook using ATI SB-600 chipset. With stock kernel, the ATA
> controller is being recognized as a generic ATA controller and devices
> being driven in UDMA-33 mode.
> 
> With the following patch, the controller is being initialized in AHCI
> mode and devices being set to SATA-150/300 mode.
> 
> atapci0: <ATI IXP600 SATA300 controller> port
> 0x9000-0x9007,0x9008-0x900b,0x9010-0x9017,0x5018-0x501b,0x5020-0x502f
> mem 0xd0609000-0xd06093ff irq 16 at device 18.0 on pci0
> atapci0: Reserved 0x10 bytes for rid 0x20 type 4 at 0x5020
> atapci0: Reserved 0x400 bytes for rid 0x24 type 3 at 0xd0609000
> atapci0: [MPSAFE]
> atapci0: [ITHREAD]
> atapci0: AHCI Version 01.10 controller with 4 ports detected
> 
> %atacontrol mode ad4
> current mode = SATA150
> 
> 
> My patch has been tested on RELENG_7 as of 2008-01-19. Please review,
> check and test if possible. Should work on 8-CURRENT, too.
> 
> If nobody complains until tuesday (2008-01-22), I'll file a PR for
> that patch.
> 
> Volker
> 
> --- sys/dev/ata/ata-chipset.c.orig      2008-01-20 03:22:37.000000000
> +0100
> +++ sys/dev/ata/ata-chipset.c   2008-01-20 03:30:03.000000000 +0100
> @@ -1348,6 +1348,7 @@
>       { ATA_ATI_IXP400_S1, 0x00, SIIMEMIO, 0, ATA_SA150, "IXP400" },
>       { ATA_ATI_IXP400_S2, 0x00, SIIMEMIO, 0, ATA_SA150, "IXP400" },
>       { ATA_ATI_IXP600,    0x00, 0,        0, ATA_UDMA6, "IXP600" },
> +     { ATA_ATI_IXP600_S1, 0x00, 0,     AHCI, ATA_SA300, "IXP600" },
>       { ATA_ATI_IXP700,    0x00, 0,        0, ATA_UDMA6, "IXP700" },
>       { 0, 0, 0, 0, 0, 0}};
> 
> @@ -1360,7 +1361,10 @@
>      if (ctlr->chip->cfg1 & SIIMEMIO)
>         ctlr->chipinit = ata_sii_chipinit;
>      else
> -       ctlr->chipinit = ata_ati_chipinit;
> +       if (ctlr->chip->cfg2 & AHCI)
> +               ctlr->chipinit = ata_ahci_chipinit;
> +       else
> +               ctlr->chipinit = ata_ati_chipinit;
>      return 0;
>  }
> 
> --- sys/dev/ata/ata-pci.h.orig  2008-01-20 03:22:28.000000000 +0100
> +++ sys/dev/ata/ata-pci.h       2008-01-20 03:23:56.000000000 +0100
> @@ -104,6 +104,7 @@
>  #define ATA_ATI_IXP400_S1       0x43791002
>  #define ATA_ATI_IXP400_S2       0x437a1002
>  #define ATA_ATI_IXP600          0x438c1002
> +#define ATA_ATI_IXP600_S1       0x43801002
>  #define ATA_ATI_IXP700          0x439c1002
> 
>  #define ATA_CENATEK_ID          0x16ca
> _______________________________________________
> freebsd-stable at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-stable
> To unsubscribe, send any mail to
> "freebsd-stable-unsubscribe at freebsd.org"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ata-chipset.c.diff
Type: text/x-patch
Size: 2056 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20080120/f4864c32/ata-chipset.c.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ata-pci.h.diff
Type: text/x-patch
Size: 645 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20080120/f4864c32/ata-pci.h.bin


More information about the freebsd-stable mailing list