enable patch for 4Bg-ram laptops and cardbus addressing
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 12 May 2009 12:27:13 +0000 (12:27 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 12 May 2009 12:27:13 +0000 (12:27 +0000)
kernel-2.6.spec
linux-2.6-710-avoid-64bits-addr-pcmcia.patch [new file with mode: 0644]

index cb607f0..4ec069b 100644 (file)
@@ -188,6 +188,7 @@ Patch670: linux-2.6-670-gcc43.patch
 %endif
 Patch680: linux-2.6-680-htb-hysteresis-tso.patch
 Patch690: linux-2.6-690-web100.patch
+Patch710: linux-2.6-710-avoid-64bits-addr-pcmcia.patch
 
 # See also the file named 'sources' here for the related checksums
 # NOTE. iwlwifi should be in-kernel starting from 2.6.24
@@ -400,6 +401,7 @@ KERNEL_PREVIOUS=vanilla
 %endif
 %ApplyPatch 680
 %ApplyPatch 690
+%ApplyPatch 710
 
 
 # NetNS conflict-resolving patch for VINI. Will work with patch vini_pl_patch-1 but may
diff --git a/linux-2.6-710-avoid-64bits-addr-pcmcia.patch b/linux-2.6-710-avoid-64bits-addr-pcmcia.patch
new file mode 100644 (file)
index 0000000..d513426
--- /dev/null
@@ -0,0 +1,69 @@
+diff -Naur linux-source-2.6.29-orig/drivers/pci/bus.c linux-source-2.6.29/drivers/pci/bus.c
+--- linux-source-2.6.29-orig/drivers/pci/bus.c 2009-03-24 00:12:14.000000000 +0100
++++ linux-source-2.6.29/drivers/pci/bus.c      2009-04-06 11:04:41.000000000 +0200
+@@ -41,6 +41,7 @@
+               void *alignf_data)
+ {
+       int i, ret = -ENOMEM;
++      resource_size_t max = -1;
+       type_mask |= IORESOURCE_IO | IORESOURCE_MEM;
+@@ -59,10 +60,15 @@
+                   !(res->flags & IORESOURCE_PREFETCH))
+                       continue;
++              /* Limit address to 32 bits when requested */
++              if ((res->flags & IORESOURCE_MEM) &&
++                  (res->flags & IORESOURCE_PCI_32BIT))
++                      max = (u32) -1;
++
+               /* Ok, try it out.. */
+               ret = allocate_resource(r, res, size,
+                                       r->start ? : min,
+-                                      -1, align,
++                                      max, align,
+                                       alignf, alignf_data);
+               if (ret == 0)
+                       break;
+diff -Naur linux-source-2.6.29-orig/drivers/pci/setup-bus.c linux-source-2.6.29/drivers/pci/setup-bus.c
+--- linux-source-2.6.29-orig/drivers/pci/setup-bus.c   2009-03-24 00:12:14.000000000 +0100
++++ linux-source-2.6.29/drivers/pci/setup-bus.c        2009-04-06 11:04:41.000000000 +0200
+@@ -429,19 +429,23 @@
+        * If we have prefetchable memory support, allocate
+        * two regions.  Otherwise, allocate one region of
+        * twice the size.
++       * Avoid 64bit address space, as cardbus devices can't handle it.
+        */
+       if (ctrl & PCI_CB_BRIDGE_CTL_PREFETCH_MEM0) {
+               b_res[2].start = 0;
+               b_res[2].end = pci_cardbus_mem_size - 1;
+-              b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH | IORESOURCE_SIZEALIGN;
++              b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH |
++                      IORESOURCE_SIZEALIGN | IORESOURCE_PCI_32BIT;
+               b_res[3].start = 0;
+               b_res[3].end = pci_cardbus_mem_size - 1;
+-              b_res[3].flags |= IORESOURCE_MEM | IORESOURCE_SIZEALIGN;
++              b_res[3].flags |= IORESOURCE_MEM | IORESOURCE_SIZEALIGN |
++                      IORESOURCE_PCI_32BIT;
+       } else {
+               b_res[3].start = 0;
+               b_res[3].end = pci_cardbus_mem_size * 2 - 1;
+-              b_res[3].flags |= IORESOURCE_MEM | IORESOURCE_SIZEALIGN;
++              b_res[3].flags |= IORESOURCE_MEM | IORESOURCE_SIZEALIGN |
++                      IORESOURCE_PCI_32BIT;
+       }
+ }
+diff -Naur linux-source-2.6.29-orig/include/linux/ioport.h linux-source-2.6.29/include/linux/ioport.h
+--- linux-source-2.6.29-orig/include/linux/ioport.h    2009-03-24 00:12:14.000000000 +0100
++++ linux-source-2.6.29/include/linux/ioport.h 2009-04-06 11:04:41.000000000 +0200
+@@ -103,6 +103,7 @@
+ /* PCI control bits.  Shares IORESOURCE_BITS with above PCI ROM.  */
+ #define IORESOURCE_PCI_FIXED          (1<<4)  /* Do not move resource */
++#define IORESOURCE_PCI_32BIT          (1<<5)  /* Do not use 64bit address space (for cardbus devices) */
+ /* PC/ISA/whatever - the normal PC address spaces: IO and memory */
+ extern struct resource ioport_resource;