]> git.proxmox.com Git - pve-kernel-2.6.32.git/commitdiff
add suport for IDE-R
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 26 Sep 2011 07:05:12 +0000 (09:05 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 26 Sep 2011 07:05:12 +0000 (09:05 +0200)
Makefile
ahci-ata_generic-let-ata_generic-handle-new-MBP-w-MCP89.patch [new file with mode: 0644]
ata-Intel-IDE-R-support.patch [new file with mode: 0644]
ata_generic-drop-hard-coded-DMA-force-logic-for-CENATEK.patch [new file with mode: 0644]
ata_generic-implement-ATA_GEN_-flags-and-force-enable-DMA-on-MBP-7,1.patch [new file with mode: 0644]
changelog.Debian

index e838e3e7a7dea7e897a8477f6833e2f2275b8a93..1ec489e902dd048e2e3c5bf8ec93ce162aed73f4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -137,7 +137,11 @@ ${KERNEL_SRC}/README: ${KERNEL_SRC}.org/README
        cd ${KERNEL_SRC}; patch -p1 <../dlm-delayed-reply-message-warning.patch
        cd ${KERNEL_SRC}; patch -p1 <../dlm-remove-shared-message-stub-for-recovery.patch
        cd ${KERNEL_SRC}; patch -p1 <../dlm-make-plock-operation-killable.patch
-       #cd ${KERNEL_SRC}; patch -p1 <../ovz-fix-slow-fsync.patch
+       # update ata_generic to support intel IDE-R
+       cd ${KERNEL_SRC}; patch -p1 <../ahci-ata_generic-let-ata_generic-handle-new-MBP-w-MCP89.patch
+       cd ${KERNEL_SRC}; patch -p1 <../ata_generic-implement-ATA_GEN_-flags-and-force-enable-DMA-on-MBP-7,1.patch
+       cd ${KERNEL_SRC}; patch -p1 <../ata_generic-drop-hard-coded-DMA-force-logic-for-CENATEK.patch
+       cd ${KERNEL_SRC}; patch -p1 <../ata-Intel-IDE-R-support.patch
        sed -i ${KERNEL_SRC}/Makefile -e 's/^EXTRAVERSION.*$$/EXTRAVERSION=${EXTRAVERSION}/'
        touch $@
 
diff --git a/ahci-ata_generic-let-ata_generic-handle-new-MBP-w-MCP89.patch b/ahci-ata_generic-let-ata_generic-handle-new-MBP-w-MCP89.patch
new file mode 100644 (file)
index 0000000..7fe9169
--- /dev/null
@@ -0,0 +1,90 @@
+From bdc358c1311531b459cbd12a22556d6cd62aa7cb Mon Sep 17 00:00:00 2001
+From: Tejun Heo <tj@kernel.org>
+Date: Thu, 17 Jun 2010 11:42:22 +0200
+Subject: [PATCH] ahci,ata_generic: let ata_generic handle new MBP w/ MCP89
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+commit c6353b4520788e34098bbf61c73fb9618ca7fdd6 upstream.
+
+For yet unknown reason, MCP89 on MBP 7,1 doesn't work w/ ahci under
+linux but the controller doesn't require explicit mode setting and
+works fine with ata_generic.  Make ahci ignore the controller on MBP
+7,1 and let ata_generic take it for now.
+
+Reported in bko#15923.
+
+  https://bugzilla.kernel.org/show_bug.cgi?id=15923
+
+NVIDIA is investigating why ahci mode doesn't work.
+
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Cc: Peer Chen <pchen@nvidia.com>
+Cc: stable@kernel.org
+Reported-by: Anders Østhus <grapz666@gmail.com>
+Reported-by: Andreas Graf <andreas_graf@csgraf.de>
+Reported-by: Benoit Gschwind <gschwind@gnu-log.net>
+Reported-by: Damien Cassou <damien.cassou@gmail.com>
+Reported-by: tixetsal@juno.com
+Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
+[bwh: Adjust context for 2.6.32]
+---
+ drivers/ata/ahci.c        |   10 ++++++++++
+ drivers/ata/ata_generic.c |    6 ++++++
+ include/linux/pci_ids.h   |    1 +
+ 3 files changed, 17 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
+index cb05205..e3d9816 100644
+--- a/drivers/ata/ahci.c
++++ b/drivers/ata/ahci.c
+@@ -3037,6 +3037,16 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
+       if (pdev->vendor == PCI_VENDOR_ID_MARVELL && !marvell_enable)
+               return -ENODEV;
++      /*
++       * For some reason, MCP89 on MacBook 7,1 doesn't work with
++       * ahci, use ata_generic instead.
++       */
++      if (pdev->vendor == PCI_VENDOR_ID_NVIDIA &&
++          pdev->device == PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA &&
++          pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE &&
++          pdev->subsystem_device == 0xcb89)
++              return -ENODEV;
++
+       /* acquire resources */
+       rc = pcim_enable_device(pdev);
+       if (rc)
+diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c
+index ecfd22b..b5aa93c 100644
+--- a/drivers/ata/ata_generic.c
++++ b/drivers/ata/ata_generic.c
+@@ -168,6 +168,12 @@ static struct pci_device_id ata_generic[] = {
+       { PCI_DEVICE(PCI_VENDOR_ID_VIA,    PCI_DEVICE_ID_VIA_82C561), },
+       { PCI_DEVICE(PCI_VENDOR_ID_OPTI,   PCI_DEVICE_ID_OPTI_82C558), },
+       { PCI_DEVICE(PCI_VENDOR_ID_CENATEK,PCI_DEVICE_ID_CENATEK_IDE), },
++      /*
++       * For some reason, MCP89 on MacBook 7,1 doesn't work with
++       * ahci, use ata_generic instead.
++       */
++      { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA,
++        PCI_VENDOR_ID_APPLE, 0xcb89, },
+       { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO), },
+       { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), },
+       { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2),  },
+diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
+index c398cc3..a8ea95f 100644
+--- a/include/linux/pci_ids.h
++++ b/include/linux/pci_ids.h
+@@ -1262,6 +1262,7 @@
+ #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE       0x0759
+ #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_SMBUS     0x07D8
+ #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP79_SMBUS     0x0AA2
++#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA            0x0D85
+ #define PCI_VENDOR_ID_IMS             0x10e0
+ #define PCI_DEVICE_ID_IMS_TT128               0x9128
+-- 
+1.7.1
+
diff --git a/ata-Intel-IDE-R-support.patch b/ata-Intel-IDE-R-support.patch
new file mode 100644 (file)
index 0000000..b9bdaf8
--- /dev/null
@@ -0,0 +1,100 @@
+From: Alan Cox <alan@linux.intel.com>
+Date: Tue, 28 Sep 2010 13:19:38 +0100
+Subject: [PATCH] ata: Intel IDE-R support
+
+commit 60039a5295b3d82a48fe132c699987d2e1408675 upstream.
+
+Intel IDE-R devices are part of the Intel AMT management setup. They don't
+have any special configuration registers or settings so the ata_generic
+driver will support them fully.
+
+Rather than add a huge table of IDs for each chipset and keep sending in
+new ones this patch autodetects them.
+
+Signed-off-by: Alan Cox <alan@linux.intel.com>
+Acked-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
+[bwh: Adjust context for 2.6.32]
+---
+--- a/drivers/ata/ata_generic.c
++++ b/drivers/ata/ata_generic.c
+@@ -35,6 +35,7 @@
+ enum {
+       ATA_GEN_CLASS_MATCH             = (1 << 0),
+       ATA_GEN_FORCE_DMA               = (1 << 1),
++      ATA_GEN_INTEL_IDER              = (1 << 2),
+ };
+ /**
+@@ -113,6 +114,49 @@ static struct ata_port_operations generic_port_ops = {
+ static int all_generic_ide;           /* Set to claim all devices */
+ /**
++ *    is_intel_ider           -       identify intel IDE-R devices
++ *    @dev: PCI device
++ *
++ *    Distinguish Intel IDE-R controller devices from other Intel IDE
++ *    devices. IDE-R devices have no timing registers and are in
++ *    most respects virtual. They should be driven by the ata_generic
++ *    driver.
++ *
++ *    IDE-R devices have PCI offset 0xF8.L as zero, later Intel ATA has
++ *    it non zero. All Intel ATA has 0x40 writable (timing), but it is
++ *    not writable on IDE-R devices (this is guaranteed).
++ */
++
++static int is_intel_ider(struct pci_dev *dev)
++{
++      /* For Intel IDE the value at 0xF8 is only zero on IDE-R
++         interfaces */
++      u32 r;
++      u16 t;
++
++      /* Check the manufacturing ID, it will be zero for IDE-R */
++      pci_read_config_dword(dev, 0xF8, &r);
++      /* Not IDE-R: punt so that ata_(old)piix gets it */
++      if (r != 0)
++              return 0;
++      /* 0xF8 will also be zero on some early Intel IDE devices
++         but they will have a sane timing register */
++      pci_read_config_word(dev, 0x40, &t);
++      if (t != 0)
++              return 0;
++      /* Finally check if the timing register is writable so that
++         we eliminate any early devices hot-docked in a docking
++         station */
++      pci_write_config_word(dev, 0x40, 1);
++      pci_read_config_word(dev, 0x40, &t);
++      if (t) {
++              pci_write_config_word(dev, 0x40, 0);
++              return 0;
++      }
++      return 1;
++}
++
++/**
+  *    ata_generic_init                -       attach generic IDE
+  *    @dev: PCI device found
+  *    @id: match entry
+@@ -138,6 +182,10 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id
+       if ((id->driver_data & ATA_GEN_CLASS_MATCH) && all_generic_ide == 0)
+               return -ENODEV;
++      if (id->driver_data & ATA_GEN_INTEL_IDER)
++              if (!is_intel_ider(dev))
++                      return -ENODEV;
++
+       /* Devices that need care */
+       if (dev->vendor == PCI_VENDOR_ID_UMC &&
+           dev->device == PCI_DEVICE_ID_UMC_UM8886A &&
+@@ -188,6 +236,10 @@ static struct pci_device_id ata_generic[] = {
+       { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO), },
+       { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), },
+       { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2),  },
++      /* Intel, IDE class device */
++      { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
++        PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL, 
++        .driver_data = ATA_GEN_INTEL_IDER },
+       /* Must come last. If you add entries adjust this table appropriately */
+       { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL),
+         .driver_data = ATA_GEN_CLASS_MATCH },
diff --git a/ata_generic-drop-hard-coded-DMA-force-logic-for-CENATEK.patch b/ata_generic-drop-hard-coded-DMA-force-logic-for-CENATEK.patch
new file mode 100644 (file)
index 0000000..838e82b
--- /dev/null
@@ -0,0 +1,38 @@
+commit 728e0eaf99631d197e5158e21b4a8c4335a39231
+Author: Tejun Heo <tj@kernel.org>
+Date:   Fri Jul 2 14:41:24 2010 +0200
+
+    ata_generic: drop hard coded DMA force logic for CENATEK
+    
+    Commit 1529c69adc (ata_generic: implement ATA_GEN_* flags and force
+    enable DMA on MBP 7,1) implemented ATA_GEN_FORCE_DMA for forcing DMA
+    mode and applied it to CENATEK but forgot to remove the original hard
+    coded logic.  This is removal of redundant logic and doesn't affect
+    correctness.
+    
+    Signed-off-by: Tejun Heo <tj@kernel.org>
+    Reported-by: Andy Whitcroft <apw@canonical.com>
+    Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
+
+diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c
+index 7107a69..cc5f772 100644
+--- a/drivers/ata/ata_generic.c
++++ b/drivers/ata/ata_generic.c
+@@ -54,7 +54,6 @@ static int generic_set_mode(struct ata_link *link, struct ata_device **unused)
+       const struct pci_device_id *id = ap->host->private_data;
+       int dma_enabled = 0;
+       struct ata_device *dev;
+-      struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+       if (id->driver_data & ATA_GEN_FORCE_DMA) {
+               dma_enabled = 0xff;
+@@ -63,9 +62,6 @@ static int generic_set_mode(struct ata_link *link, struct ata_device **unused)
+               dma_enabled = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
+       }
+-      if (pdev->vendor == PCI_VENDOR_ID_CENATEK)
+-              dma_enabled = 0xFF;
+-
+       ata_for_each_dev(dev, link, ENABLED) {
+               /* We don't really care */
+               dev->pio_mode = XFER_PIO_0;
diff --git a/ata_generic-implement-ATA_GEN_-flags-and-force-enable-DMA-on-MBP-7,1.patch b/ata_generic-implement-ATA_GEN_-flags-and-force-enable-DMA-on-MBP-7,1.patch
new file mode 100644 (file)
index 0000000..02720e5
--- /dev/null
@@ -0,0 +1,108 @@
+[Backported to Debian's 2.6.32 by dann frazier <dannf@debian.org>]
+
+commit 1529c69adce1e95f7ae72f0441590c226bbac7fc
+Author: Tejun Heo <tj@kernel.org>
+Date:   Tue Jun 22 12:27:26 2010 +0200
+
+    ata_generic: implement ATA_GEN_* flags and force enable DMA on MBP 7,1
+    
+    IDE mode of MCP89 on MBP 7,1 doesn't set DMA enable bits in the BMDMA
+    status register.  Make the following changes to work around the problem.
+    
+    * Instead of using hard coded 1 in id->driver_data as class code
+      match, use ATA_GEN_CLASS_MATCH and carry the matched id in
+      host->private_data.
+    
+    * Instead of matching PCI_VENDOR_ID_CENATEK, use ATA_GEN_FORCE_DMA
+      flag in id instead.
+    
+    * Add ATA_GEN_FORCE_DMA to the id entry of MBP 7,1.
+    
+    Signed-off-by: Tejun Heo <tj@kernel.org>
+    Cc: Peer Chen <pchen@nvidia.com>
+    Cc: stable@kernel.org
+    Reported-by: Anders Østhus <grapz666@gmail.com>
+    Reported-by: Andreas Graf <andreas_graf@csgraf.de>
+    Reported-by: Benoit Gschwind <gschwind@gnu-log.net>
+    Reported-by: Damien Cassou <damien.cassou@gmail.com>
+    Reported-by: tixetsal@juno.com
+    Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
+
+diff -urpN a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c
+--- a/drivers/ata/ata_generic.c        2010-10-18 17:18:22.160591155 -0600
++++ b/drivers/ata/ata_generic.c        2010-10-18 17:28:35.700130856 -0600
+@@ -32,6 +32,11 @@
+  *    A generic parallel ATA driver using libata
+  */
++enum {
++      ATA_GEN_CLASS_MATCH             = (1 << 0),
++      ATA_GEN_FORCE_DMA               = (1 << 1),
++};
++
+ /**
+  *    generic_set_mode        -       mode setting
+  *    @link: link to set up
+@@ -46,13 +51,17 @@
+ static int generic_set_mode(struct ata_link *link, struct ata_device **unused)
+ {
+       struct ata_port *ap = link->ap;
++      const struct pci_device_id *id = ap->host->private_data;
+       int dma_enabled = 0;
+       struct ata_device *dev;
+       struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+-      /* Bits 5 and 6 indicate if DMA is active on master/slave */
+-      if (ap->ioaddr.bmdma_addr)
++      if (id->driver_data & ATA_GEN_FORCE_DMA) {
++              dma_enabled = 0xff;
++      } else if (ap->ioaddr.bmdma_addr) {
++              /* Bits 5 and 6 indicate if DMA is active on master/slave */
+               dma_enabled = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
++      }
+       if (pdev->vendor == PCI_VENDOR_ID_CENATEK)
+               dma_enabled = 0xFF;
+@@ -126,7 +135,7 @@ static int ata_generic_init_one(struct p
+       const struct ata_port_info *ppi[] = { &info, NULL };
+       /* Don't use the generic entry unless instructed to do so */
+-      if (id->driver_data == 1 && all_generic_ide == 0)
++      if ((id->driver_data & ATA_GEN_CLASS_MATCH) && all_generic_ide == 0)
+               return -ENODEV;
+       /* Devices that need care */
+@@ -155,7 +164,7 @@ static int ata_generic_init_one(struct p
+                       return rc;
+               pcim_pin_device(dev);
+       }
+-      return ata_pci_sff_init_one(dev, ppi, &generic_sht, NULL);
++      return ata_pci_sff_init_one(dev, ppi, &generic_sht, (void *)id);
+ }
+ static struct pci_device_id ata_generic[] = {
+@@ -167,18 +176,21 @@ static struct pci_device_id ata_generic[
+       { PCI_DEVICE(PCI_VENDOR_ID_HINT,   PCI_DEVICE_ID_HINT_VXPROII_IDE), },
+       { PCI_DEVICE(PCI_VENDOR_ID_VIA,    PCI_DEVICE_ID_VIA_82C561), },
+       { PCI_DEVICE(PCI_VENDOR_ID_OPTI,   PCI_DEVICE_ID_OPTI_82C558), },
+-      { PCI_DEVICE(PCI_VENDOR_ID_CENATEK,PCI_DEVICE_ID_CENATEK_IDE), },
++      { PCI_DEVICE(PCI_VENDOR_ID_CENATEK,PCI_DEVICE_ID_CENATEK_IDE),
++        .driver_data = ATA_GEN_FORCE_DMA },
+       /*
+        * For some reason, MCP89 on MacBook 7,1 doesn't work with
+        * ahci, use ata_generic instead.
+        */
+       { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA,
+-        PCI_VENDOR_ID_APPLE, 0xcb89, },
++        PCI_VENDOR_ID_APPLE, 0xcb89,
++        .driver_data = ATA_GEN_FORCE_DMA },
+       { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO), },
+       { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), },
+       { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2),  },
+       /* Must come last. If you add entries adjust this table appropriately */
+-      { PCI_ANY_ID,           PCI_ANY_ID,                        PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL, 1},
++      { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL),
++        .driver_data = ATA_GEN_CLASS_MATCH },
+       { 0, },
+ };
index 6c1b16ad2eb16661ded384cc7300d09469a4a65e..730f96e670777a131b36275475170da018d1d7b7 100644 (file)
@@ -16,6 +16,8 @@ pve-kernel-2.6.32 (2.6.32-46) unstable; urgency=low
 
   * use bnx2 from upstream
   
+  * update ata_generic to support intel IDE-R
+
  -- Proxmox Support Team <support@proxmox.com>  Mon, 26 Sep 2011 08:48:39 +0200
 
 pve-kernel-2.6.32 (2.6.32-45) unstable; urgency=low