Setting tag linux-2.6-22-50
[linux-2.6.git] / linux-2.6-710-avoid-64bits-addr-pcmcia.patch
1 diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
2 index 9e5ea07..db1206b 100644
3 --- a/drivers/pci/bus.c
4 +++ b/drivers/pci/bus.c
5 @@ -41,6 +41,7 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
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 *bus, struct resource *res,
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 diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
31 index 5ec297d..24b1ddc 100644
32 --- a/drivers/pci/setup-bus.c
33 +++ b/drivers/pci/setup-bus.c
34 @@ -430,15 +430,15 @@ pci_bus_size_cardbus(struct pci_bus *bus)
35         if (ctrl & PCI_CB_BRIDGE_CTL_PREFETCH_MEM0) {
36                 b_res[2].start = pci_cardbus_mem_size;
37                 b_res[2].end = b_res[2].start + pci_cardbus_mem_size - 1;
38 -               b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH;
39 +               b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH | IORESOURCE_PCI_32BIT;
40  
41                 b_res[3].start = pci_cardbus_mem_size;
42                 b_res[3].end = b_res[3].start + pci_cardbus_mem_size - 1;
43 -               b_res[3].flags |= IORESOURCE_MEM;
44 +               b_res[3].flags |= IORESOURCE_MEM | IORESOURCE_PCI_32BIT;
45         } else {
46                 b_res[3].start = pci_cardbus_mem_size * 2;
47                 b_res[3].end = b_res[3].start + pci_cardbus_mem_size * 2 - 1;
48 -               b_res[3].flags |= IORESOURCE_MEM;
49 +               b_res[3].flags |= IORESOURCE_MEM | IORESOURCE_PCI_32BIT;
50         }
51  }
52  
53 diff --git a/include/linux/ioport.h b/include/linux/ioport.h
54 index 71ea923..f45930d 100644
55 --- a/include/linux/ioport.h
56 +++ b/include/linux/ioport.h
57 @@ -93,6 +93,7 @@ struct resource_list {
58  
59  /* PCI control bits.  Shares IORESOURCE_BITS with above PCI ROM.  */
60  #define IORESOURCE_PCI_FIXED           (1<<4)  /* Do not move resource */
61 +#define IORESOURCE_PCI_32BIT           (1<<5)  /* Do not use 64bit address space (for cardbus devices) */
62  
63  /* PC/ISA/whatever - the normal PC address spaces: IO and memory */
64  extern struct resource ioport_resource;