diff options
Diffstat (limited to 'arch/sparc/kernel/of_device.c')
-rw-r--r-- | arch/sparc/kernel/of_device.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c index cc4c235c4f59..c481d45f97b7 100644 --- a/arch/sparc/kernel/of_device.c +++ b/arch/sparc/kernel/of_device.c | |||
@@ -70,7 +70,7 @@ struct of_bus { | |||
70 | int *addrc, int *sizec); | 70 | int *addrc, int *sizec); |
71 | int (*map)(u32 *addr, const u32 *range, | 71 | int (*map)(u32 *addr, const u32 *range, |
72 | int na, int ns, int pna); | 72 | int na, int ns, int pna); |
73 | unsigned int (*get_flags)(const u32 *addr); | 73 | unsigned long (*get_flags)(const u32 *addr, unsigned long); |
74 | }; | 74 | }; |
75 | 75 | ||
76 | /* | 76 | /* |
@@ -130,8 +130,10 @@ static int of_bus_default_map(u32 *addr, const u32 *range, | |||
130 | return 0; | 130 | return 0; |
131 | } | 131 | } |
132 | 132 | ||
133 | static unsigned int of_bus_default_get_flags(const u32 *addr) | 133 | static unsigned long of_bus_default_get_flags(const u32 *addr, unsigned long flags) |
134 | { | 134 | { |
135 | if (flags) | ||
136 | return flags; | ||
135 | return IORESOURCE_MEM; | 137 | return IORESOURCE_MEM; |
136 | } | 138 | } |
137 | 139 | ||
@@ -194,17 +196,21 @@ static int of_bus_pci_map(u32 *addr, const u32 *range, | |||
194 | return 0; | 196 | return 0; |
195 | } | 197 | } |
196 | 198 | ||
197 | static unsigned int of_bus_pci_get_flags(const u32 *addr) | 199 | static unsigned long of_bus_pci_get_flags(const u32 *addr, unsigned long flags) |
198 | { | 200 | { |
199 | unsigned int flags = 0; | ||
200 | u32 w = addr[0]; | 201 | u32 w = addr[0]; |
201 | 202 | ||
203 | /* For PCI, we override whatever child busses may have used. */ | ||
204 | flags = 0; | ||
202 | switch((w >> 24) & 0x03) { | 205 | switch((w >> 24) & 0x03) { |
203 | case 0x01: | 206 | case 0x01: |
204 | flags |= IORESOURCE_IO; | 207 | flags |= IORESOURCE_IO; |
208 | break; | ||
209 | |||
205 | case 0x02: /* 32 bits */ | 210 | case 0x02: /* 32 bits */ |
206 | case 0x03: /* 64 bits */ | 211 | case 0x03: /* 64 bits */ |
207 | flags |= IORESOURCE_MEM; | 212 | flags |= IORESOURCE_MEM; |
213 | break; | ||
208 | } | 214 | } |
209 | if (w & 0x40000000) | 215 | if (w & 0x40000000) |
210 | flags |= IORESOURCE_PREFETCH; | 216 | flags |= IORESOURCE_PREFETCH; |
@@ -362,10 +368,11 @@ static void __init build_device_resources(struct of_device *op, | |||
362 | int pna, pns; | 368 | int pna, pns; |
363 | 369 | ||
364 | size = of_read_addr(reg + na, ns); | 370 | size = of_read_addr(reg + na, ns); |
365 | flags = bus->get_flags(reg); | ||
366 | 371 | ||
367 | memcpy(addr, reg, na * 4); | 372 | memcpy(addr, reg, na * 4); |
368 | 373 | ||
374 | flags = bus->get_flags(reg, 0); | ||
375 | |||
369 | /* If the immediate parent has no ranges property to apply, | 376 | /* If the immediate parent has no ranges property to apply, |
370 | * just use a 1<->1 mapping. | 377 | * just use a 1<->1 mapping. |
371 | */ | 378 | */ |
@@ -393,6 +400,8 @@ static void __init build_device_resources(struct of_device *op, | |||
393 | dna, dns, pna)) | 400 | dna, dns, pna)) |
394 | break; | 401 | break; |
395 | 402 | ||
403 | flags = pbus->get_flags(addr, flags); | ||
404 | |||
396 | dna = pna; | 405 | dna = pna; |
397 | dns = pns; | 406 | dns = pns; |
398 | dbus = pbus; | 407 | dbus = pbus; |