aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/of_device.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc64/kernel/of_device.c')
-rw-r--r--arch/sparc64/kernel/of_device.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index c15bcdf75c0d..5c4fbc23aeea 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -119,7 +119,7 @@ struct of_bus {
119 int *addrc, int *sizec); 119 int *addrc, int *sizec);
120 int (*map)(u32 *addr, const u32 *range, 120 int (*map)(u32 *addr, const u32 *range,
121 int na, int ns, int pna); 121 int na, int ns, int pna);
122 unsigned int (*get_flags)(const u32 *addr); 122 unsigned long (*get_flags)(const u32 *addr, unsigned long);
123}; 123};
124 124
125/* 125/*
@@ -179,8 +179,10 @@ static int of_bus_default_map(u32 *addr, const u32 *range,
179 return 0; 179 return 0;
180} 180}
181 181
182static unsigned int of_bus_default_get_flags(const u32 *addr) 182static unsigned long of_bus_default_get_flags(const u32 *addr, unsigned long flags)
183{ 183{
184 if (flags)
185 return flags;
184 return IORESOURCE_MEM; 186 return IORESOURCE_MEM;
185} 187}
186 188
@@ -272,17 +274,21 @@ static int of_bus_pci_map(u32 *addr, const u32 *range,
272 return 0; 274 return 0;
273} 275}
274 276
275static unsigned int of_bus_pci_get_flags(const u32 *addr) 277static unsigned long of_bus_pci_get_flags(const u32 *addr, unsigned long flags)
276{ 278{
277 unsigned int flags = 0;
278 u32 w = addr[0]; 279 u32 w = addr[0];
279 280
281 /* For PCI, we override whatever child busses may have used. */
282 flags = 0;
280 switch((w >> 24) & 0x03) { 283 switch((w >> 24) & 0x03) {
281 case 0x01: 284 case 0x01:
282 flags |= IORESOURCE_IO; 285 flags |= IORESOURCE_IO;
286 break;
287
283 case 0x02: /* 32 bits */ 288 case 0x02: /* 32 bits */
284 case 0x03: /* 64 bits */ 289 case 0x03: /* 64 bits */
285 flags |= IORESOURCE_MEM; 290 flags |= IORESOURCE_MEM;
291 break;
286 } 292 }
287 if (w & 0x40000000) 293 if (w & 0x40000000)
288 flags |= IORESOURCE_PREFETCH; 294 flags |= IORESOURCE_PREFETCH;
@@ -510,10 +516,10 @@ static void __init build_device_resources(struct of_device *op,
510 int pna, pns; 516 int pna, pns;
511 517
512 size = of_read_addr(reg + na, ns); 518 size = of_read_addr(reg + na, ns);
513 flags = bus->get_flags(reg);
514
515 memcpy(addr, reg, na * 4); 519 memcpy(addr, reg, na * 4);
516 520
521 flags = bus->get_flags(addr, 0);
522
517 if (use_1to1_mapping(pp)) { 523 if (use_1to1_mapping(pp)) {
518 result = of_read_addr(addr, na); 524 result = of_read_addr(addr, na);
519 goto build_res; 525 goto build_res;
@@ -538,6 +544,8 @@ static void __init build_device_resources(struct of_device *op,
538 dna, dns, pna)) 544 dna, dns, pna))
539 break; 545 break;
540 546
547 flags = pbus->get_flags(addr, flags);
548
541 dna = pna; 549 dna = pna;
542 dns = pns; 550 dns = pns;
543 dbus = pbus; 551 dbus = pbus;