enable patch for 4Bg-ram laptops and cardbus addressing
[linux-2.6.git] / linux-2.6-710-avoid-64bits-addr-pcmcia.patch
1 diff -Naur linux-source-2.6.29-orig/drivers/pci/bus.c linux-source-2.6.29/drivers/pci/bus.c
2 --- linux-source-2.6.29-orig/drivers/pci/bus.c  2009-03-24 00:12:14.000000000 +0100
3 +++ linux-source-2.6.29/drivers/pci/bus.c       2009-04-06 11:04:41.000000000 +0200
4 @@ -41,6 +41,7 @@
5                 void *alignf_data)
6  {
7         int i, ret = -ENOMEM;
8 +       resource_size_t max = -1;
9  
10         type_mask |= IORESOURCE_IO | IORESOURCE_MEM;
11  
12 @@ -59,10 +60,15 @@
13                     !(res->flags & IORESOURCE_PREFETCH))
14                         continue;
15  
16 +               /* Limit address to 32 bits when requested */
17 +               if ((res->flags & IORESOURCE_MEM) &&
18 +                   (res->flags & IORESOURCE_PCI_32BIT))
19 +                       max = (u32) -1;
20 +
21                 /* Ok, try it out.. */
22                 ret = allocate_resource(r, res, size,
23                                         r->start ? : min,
24 -                                       -1, align,
25 +                                       max, align,
26                                         alignf, alignf_data);
27                 if (ret == 0)
28                         break;
29 diff -Naur linux-source-2.6.29-orig/drivers/pci/setup-bus.c linux-source-2.6.29/drivers/pci/setup-bus.c
30 --- linux-source-2.6.29-orig/drivers/pci/setup-bus.c    2009-03-24 00:12:14.000000000 +0100
31 +++ linux-source-2.6.29/drivers/pci/setup-bus.c 2009-04-06 11:04:41.000000000 +0200
32 @@ -429,19 +429,23 @@
33          * If we have prefetchable memory support, allocate
34          * two regions.  Otherwise, allocate one region of
35          * twice the size.
36 +        * Avoid 64bit address space, as cardbus devices can't handle it.
37          */
38         if (ctrl & PCI_CB_BRIDGE_CTL_PREFETCH_MEM0) {
39                 b_res[2].start = 0;
40                 b_res[2].end = pci_cardbus_mem_size - 1;
41 -               b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH | IORESOURCE_SIZEALIGN;
42 +               b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH |
43 +                       IORESOURCE_SIZEALIGN | IORESOURCE_PCI_32BIT;
44  
45                 b_res[3].start = 0;
46                 b_res[3].end = pci_cardbus_mem_size - 1;
47 -               b_res[3].flags |= IORESOURCE_MEM | IORESOURCE_SIZEALIGN;
48 +               b_res[3].flags |= IORESOURCE_MEM | IORESOURCE_SIZEALIGN |
49 +                       IORESOURCE_PCI_32BIT;
50         } else {
51                 b_res[3].start = 0;
52                 b_res[3].end = pci_cardbus_mem_size * 2 - 1;
53 -               b_res[3].flags |= IORESOURCE_MEM | IORESOURCE_SIZEALIGN;
54 +               b_res[3].flags |= IORESOURCE_MEM | IORESOURCE_SIZEALIGN |
55 +                       IORESOURCE_PCI_32BIT;
56         }
57  }
58  
59 diff -Naur linux-source-2.6.29-orig/include/linux/ioport.h linux-source-2.6.29/include/linux/ioport.h
60 --- linux-source-2.6.29-orig/include/linux/ioport.h     2009-03-24 00:12:14.000000000 +0100
61 +++ linux-source-2.6.29/include/linux/ioport.h  2009-04-06 11:04:41.000000000 +0200
62 @@ -103,6 +103,7 @@
63  
64  /* PCI control bits.  Shares IORESOURCE_BITS with above PCI ROM.  */
65  #define IORESOURCE_PCI_FIXED           (1<<4)  /* Do not move resource */
66 +#define IORESOURCE_PCI_32BIT           (1<<5)  /* Do not use 64bit address space (for cardbus devices) */
67  
68  /* PC/ISA/whatever - the normal PC address spaces: IO and memory */
69  extern struct resource ioport_resource;