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