diff options
Diffstat (limited to 'arch/sparc64')
-rw-r--r-- | arch/sparc64/kernel/of_device.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c index f8b50cbf4bf7..f845f150f565 100644 --- a/arch/sparc64/kernel/of_device.c +++ b/arch/sparc64/kernel/of_device.c | |||
@@ -96,7 +96,7 @@ struct of_bus { | |||
96 | int *addrc, int *sizec); | 96 | int *addrc, int *sizec); |
97 | int (*map)(u32 *addr, const u32 *range, | 97 | int (*map)(u32 *addr, const u32 *range, |
98 | int na, int ns, int pna); | 98 | int na, int ns, int pna); |
99 | unsigned int (*get_flags)(const u32 *addr); | 99 | unsigned long (*get_flags)(const u32 *addr, unsigned long); |
100 | }; | 100 | }; |
101 | 101 | ||
102 | /* | 102 | /* |
@@ -156,8 +156,10 @@ static int of_bus_default_map(u32 *addr, const u32 *range, | |||
156 | return 0; | 156 | return 0; |
157 | } | 157 | } |
158 | 158 | ||
159 | static unsigned int of_bus_default_get_flags(const u32 *addr) | 159 | static unsigned long of_bus_default_get_flags(const u32 *addr, unsigned long flags) |
160 | { | 160 | { |
161 | if (flags) | ||
162 | return flags; | ||
161 | return IORESOURCE_MEM; | 163 | return IORESOURCE_MEM; |
162 | } | 164 | } |
163 | 165 | ||
@@ -249,17 +251,21 @@ static int of_bus_pci_map(u32 *addr, const u32 *range, | |||
249 | return 0; | 251 | return 0; |
250 | } | 252 | } |
251 | 253 | ||
252 | static unsigned int of_bus_pci_get_flags(const u32 *addr) | 254 | static unsigned long of_bus_pci_get_flags(const u32 *addr, unsigned long flags) |
253 | { | 255 | { |
254 | unsigned int flags = 0; | ||
255 | u32 w = addr[0]; | 256 | u32 w = addr[0]; |
256 | 257 | ||
258 | /* For PCI, we override whatever child busses may have used. */ | ||
259 | flags = 0; | ||
257 | switch((w >> 24) & 0x03) { | 260 | switch((w >> 24) & 0x03) { |
258 | case 0x01: | 261 | case 0x01: |
259 | flags |= IORESOURCE_IO; | 262 | flags |= IORESOURCE_IO; |
263 | break; | ||
264 | |||
260 | case 0x02: /* 32 bits */ | 265 | case 0x02: /* 32 bits */ |
261 | case 0x03: /* 64 bits */ | 266 | case 0x03: /* 64 bits */ |
262 | flags |= IORESOURCE_MEM; | 267 | flags |= IORESOURCE_MEM; |
268 | break; | ||
263 | } | 269 | } |
264 | if (w & 0x40000000) | 270 | if (w & 0x40000000) |
265 | flags |= IORESOURCE_PREFETCH; | 271 | flags |= IORESOURCE_PREFETCH; |
@@ -478,10 +484,10 @@ static void __init build_device_resources(struct of_device *op, | |||
478 | int pna, pns; | 484 | int pna, pns; |
479 | 485 | ||
480 | size = of_read_addr(reg + na, ns); | 486 | size = of_read_addr(reg + na, ns); |
481 | flags = bus->get_flags(reg); | ||
482 | |||
483 | memcpy(addr, reg, na * 4); | 487 | memcpy(addr, reg, na * 4); |
484 | 488 | ||
489 | flags = bus->get_flags(addr, 0); | ||
490 | |||
485 | if (use_1to1_mapping(pp)) { | 491 | if (use_1to1_mapping(pp)) { |
486 | result = of_read_addr(addr, na); | 492 | result = of_read_addr(addr, na); |
487 | goto build_res; | 493 | goto build_res; |
@@ -506,6 +512,8 @@ static void __init build_device_resources(struct of_device *op, | |||
506 | dna, dns, pna)) | 512 | dna, dns, pna)) |
507 | break; | 513 | break; |
508 | 514 | ||
515 | flags = pbus->get_flags(addr, flags); | ||
516 | |||
509 | dna = pna; | 517 | dna = pna; |
510 | dns = pns; | 518 | dns = pns; |
511 | dbus = pbus; | 519 | dbus = pbus; |