aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ppc64/kernel')
-rw-r--r--arch/ppc64/kernel/bpa_iommu.c8
-rw-r--r--arch/ppc64/kernel/dma.c2
-rw-r--r--arch/ppc64/kernel/head.S6
-rw-r--r--arch/ppc64/kernel/iommu.c2
-rw-r--r--arch/ppc64/kernel/kprobes.c8
-rw-r--r--arch/ppc64/kernel/machine_kexec.c1
-rw-r--r--arch/ppc64/kernel/module.c13
-rw-r--r--arch/ppc64/kernel/of_device.c7
-rw-r--r--arch/ppc64/kernel/pSeries_iommu.c181
-rw-r--r--arch/ppc64/kernel/pSeries_pci.c4
-rw-r--r--arch/ppc64/kernel/pci.c9
-rw-r--r--arch/ppc64/kernel/pci_direct_iommu.c2
-rw-r--r--arch/ppc64/kernel/pci_iommu.c2
-rw-r--r--arch/ppc64/kernel/pmac_setup.c21
-rw-r--r--arch/ppc64/kernel/pmac_time.c4
-rw-r--r--arch/ppc64/kernel/prom_init.c3
-rw-r--r--arch/ppc64/kernel/ptrace.c1
-rw-r--r--arch/ppc64/kernel/vdso32/gettimeofday.S2
-rw-r--r--arch/ppc64/kernel/vio.c2
19 files changed, 161 insertions, 117 deletions
diff --git a/arch/ppc64/kernel/bpa_iommu.c b/arch/ppc64/kernel/bpa_iommu.c
index f33a7bccb0d7..5f2460090e03 100644
--- a/arch/ppc64/kernel/bpa_iommu.c
+++ b/arch/ppc64/kernel/bpa_iommu.c
@@ -99,7 +99,11 @@ get_iost_entry(unsigned long iopt_base, unsigned long io_address, unsigned page_
99 break; 99 break;
100 100
101 default: /* not a known compile time constant */ 101 default: /* not a known compile time constant */
102 BUILD_BUG_ON(1); 102 {
103 /* BUILD_BUG_ON() is not usable here */
104 extern void __get_iost_entry_bad_page_size(void);
105 __get_iost_entry_bad_page_size();
106 }
103 break; 107 break;
104 } 108 }
105 109
@@ -306,7 +310,7 @@ static void bpa_map_iommu(void)
306 310
307 311
308static void *bpa_alloc_coherent(struct device *hwdev, size_t size, 312static void *bpa_alloc_coherent(struct device *hwdev, size_t size,
309 dma_addr_t *dma_handle, unsigned int __nocast flag) 313 dma_addr_t *dma_handle, gfp_t flag)
310{ 314{
311 void *ret; 315 void *ret;
312 316
diff --git a/arch/ppc64/kernel/dma.c b/arch/ppc64/kernel/dma.c
index 4da8e31b2b61..7c3419656ccc 100644
--- a/arch/ppc64/kernel/dma.c
+++ b/arch/ppc64/kernel/dma.c
@@ -53,7 +53,7 @@ int dma_set_mask(struct device *dev, u64 dma_mask)
53EXPORT_SYMBOL(dma_set_mask); 53EXPORT_SYMBOL(dma_set_mask);
54 54
55void *dma_alloc_coherent(struct device *dev, size_t size, 55void *dma_alloc_coherent(struct device *dev, size_t size,
56 dma_addr_t *dma_handle, unsigned int __nocast flag) 56 dma_addr_t *dma_handle, gfp_t flag)
57{ 57{
58 struct dma_mapping_ops *dma_ops = get_dma_ops(dev); 58 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
59 59
diff --git a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S
index 58c314738c99..72c61041151a 100644
--- a/arch/ppc64/kernel/head.S
+++ b/arch/ppc64/kernel/head.S
@@ -1649,7 +1649,7 @@ _GLOBAL(__secondary_start)
1649 ld r3,0(r3) 1649 ld r3,0(r3)
1650 lwz r3,PLATFORM(r3) /* r3 = platform flags */ 1650 lwz r3,PLATFORM(r3) /* r3 = platform flags */
1651 andi. r3,r3,PLATFORM_LPAR /* Test if bit 0 is set (LPAR bit) */ 1651 andi. r3,r3,PLATFORM_LPAR /* Test if bit 0 is set (LPAR bit) */
1652 bne 98f 1652 beq 98f /* branch if result is 0 */
1653 mfspr r3,PVR 1653 mfspr r3,PVR
1654 srwi r3,r3,16 1654 srwi r3,r3,16
1655 cmpwi r3,0x37 /* SStar */ 1655 cmpwi r3,0x37 /* SStar */
@@ -1813,7 +1813,7 @@ _STATIC(start_here_multiplatform)
1813 ld r3,0(r3) 1813 ld r3,0(r3)
1814 lwz r3,PLATFORM(r3) /* r3 = platform flags */ 1814 lwz r3,PLATFORM(r3) /* r3 = platform flags */
1815 andi. r3,r3,PLATFORM_LPAR /* Test if bit 0 is set (LPAR bit) */ 1815 andi. r3,r3,PLATFORM_LPAR /* Test if bit 0 is set (LPAR bit) */
1816 bne 98f 1816 beq 98f /* branch if result is 0 */
1817 mfspr r3,PVR 1817 mfspr r3,PVR
1818 srwi r3,r3,16 1818 srwi r3,r3,16
1819 cmpwi r3,0x37 /* SStar */ 1819 cmpwi r3,0x37 /* SStar */
@@ -1834,7 +1834,7 @@ _STATIC(start_here_multiplatform)
1834 lwz r3,PLATFORM(r3) /* r3 = platform flags */ 1834 lwz r3,PLATFORM(r3) /* r3 = platform flags */
1835 /* Test if bit 0 is set (LPAR bit) */ 1835 /* Test if bit 0 is set (LPAR bit) */
1836 andi. r3,r3,PLATFORM_LPAR 1836 andi. r3,r3,PLATFORM_LPAR
1837 bne 98f 1837 bne 98f /* branch if result is !0 */
1838 LOADADDR(r6,_SDR1) /* Only if NOT LPAR */ 1838 LOADADDR(r6,_SDR1) /* Only if NOT LPAR */
1839 sub r6,r6,r26 1839 sub r6,r6,r26
1840 ld r6,0(r6) /* get the value of _SDR1 */ 1840 ld r6,0(r6) /* get the value of _SDR1 */
diff --git a/arch/ppc64/kernel/iommu.c b/arch/ppc64/kernel/iommu.c
index 9032b6bfe036..4d9b4388918b 100644
--- a/arch/ppc64/kernel/iommu.c
+++ b/arch/ppc64/kernel/iommu.c
@@ -519,7 +519,7 @@ void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle,
519 * to the dma address (mapping) of the first page. 519 * to the dma address (mapping) of the first page.
520 */ 520 */
521void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size, 521void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size,
522 dma_addr_t *dma_handle, unsigned int __nocast flag) 522 dma_addr_t *dma_handle, gfp_t flag)
523{ 523{
524 void *ret = NULL; 524 void *ret = NULL;
525 dma_addr_t mapping; 525 dma_addr_t mapping;
diff --git a/arch/ppc64/kernel/kprobes.c b/arch/ppc64/kernel/kprobes.c
index 7e80d49c589a..9c6facc24f70 100644
--- a/arch/ppc64/kernel/kprobes.c
+++ b/arch/ppc64/kernel/kprobes.c
@@ -59,9 +59,9 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
59 59
60 /* insn must be on a special executable page on ppc64 */ 60 /* insn must be on a special executable page on ppc64 */
61 if (!ret) { 61 if (!ret) {
62 up(&kprobe_mutex);
63 p->ainsn.insn = get_insn_slot();
64 down(&kprobe_mutex); 62 down(&kprobe_mutex);
63 p->ainsn.insn = get_insn_slot();
64 up(&kprobe_mutex);
65 if (!p->ainsn.insn) 65 if (!p->ainsn.insn)
66 ret = -ENOMEM; 66 ret = -ENOMEM;
67 } 67 }
@@ -90,9 +90,9 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
90 90
91void __kprobes arch_remove_kprobe(struct kprobe *p) 91void __kprobes arch_remove_kprobe(struct kprobe *p)
92{ 92{
93 up(&kprobe_mutex);
94 free_insn_slot(p->ainsn.insn);
95 down(&kprobe_mutex); 93 down(&kprobe_mutex);
94 free_insn_slot(p->ainsn.insn);
95 up(&kprobe_mutex);
96} 96}
97 97
98static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs) 98static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
diff --git a/arch/ppc64/kernel/machine_kexec.c b/arch/ppc64/kernel/machine_kexec.c
index 4775f12a013c..bf7cc4f8210f 100644
--- a/arch/ppc64/kernel/machine_kexec.c
+++ b/arch/ppc64/kernel/machine_kexec.c
@@ -205,6 +205,7 @@ static void kexec_prepare_cpus(void)
205 continue; 205 continue;
206 206
207 while (paca[i].hw_cpu_id != -1) { 207 while (paca[i].hw_cpu_id != -1) {
208 barrier();
208 if (!cpu_possible(i)) { 209 if (!cpu_possible(i)) {
209 printk("kexec: cpu %d hw_cpu_id %d is not" 210 printk("kexec: cpu %d hw_cpu_id %d is not"
210 " possible, ignoring\n", 211 " possible, ignoring\n",
diff --git a/arch/ppc64/kernel/module.c b/arch/ppc64/kernel/module.c
index c683bf88e690..928b8581fcb0 100644
--- a/arch/ppc64/kernel/module.c
+++ b/arch/ppc64/kernel/module.c
@@ -341,6 +341,19 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
341 *(unsigned long *)location = my_r2(sechdrs, me); 341 *(unsigned long *)location = my_r2(sechdrs, me);
342 break; 342 break;
343 343
344 case R_PPC64_TOC16:
345 /* Subtact TOC pointer */
346 value -= my_r2(sechdrs, me);
347 if (value + 0x8000 > 0xffff) {
348 printk("%s: bad TOC16 relocation (%lu)\n",
349 me->name, value);
350 return -ENOEXEC;
351 }
352 *((uint16_t *) location)
353 = (*((uint16_t *) location) & ~0xffff)
354 | (value & 0xffff);
355 break;
356
344 case R_PPC64_TOC16_DS: 357 case R_PPC64_TOC16_DS:
345 /* Subtact TOC pointer */ 358 /* Subtact TOC pointer */
346 value -= my_r2(sechdrs, me); 359 value -= my_r2(sechdrs, me);
diff --git a/arch/ppc64/kernel/of_device.c b/arch/ppc64/kernel/of_device.c
index da580812ddfe..9f200f0f2ad5 100644
--- a/arch/ppc64/kernel/of_device.c
+++ b/arch/ppc64/kernel/of_device.c
@@ -233,7 +233,9 @@ void of_device_unregister(struct of_device *ofdev)
233 device_unregister(&ofdev->dev); 233 device_unregister(&ofdev->dev);
234} 234}
235 235
236struct of_device* of_platform_device_create(struct device_node *np, const char *bus_id) 236struct of_device* of_platform_device_create(struct device_node *np,
237 const char *bus_id,
238 struct device *parent)
237{ 239{
238 struct of_device *dev; 240 struct of_device *dev;
239 241
@@ -245,7 +247,7 @@ struct of_device* of_platform_device_create(struct device_node *np, const char *
245 dev->node = np; 247 dev->node = np;
246 dev->dma_mask = 0xffffffffUL; 248 dev->dma_mask = 0xffffffffUL;
247 dev->dev.dma_mask = &dev->dma_mask; 249 dev->dev.dma_mask = &dev->dma_mask;
248 dev->dev.parent = NULL; 250 dev->dev.parent = parent;
249 dev->dev.bus = &of_platform_bus_type; 251 dev->dev.bus = &of_platform_bus_type;
250 dev->dev.release = of_release_dev; 252 dev->dev.release = of_release_dev;
251 253
@@ -259,6 +261,7 @@ struct of_device* of_platform_device_create(struct device_node *np, const char *
259 return dev; 261 return dev;
260} 262}
261 263
264
262EXPORT_SYMBOL(of_match_device); 265EXPORT_SYMBOL(of_match_device);
263EXPORT_SYMBOL(of_platform_bus_type); 266EXPORT_SYMBOL(of_platform_bus_type);
264EXPORT_SYMBOL(of_register_driver); 267EXPORT_SYMBOL(of_register_driver);
diff --git a/arch/ppc64/kernel/pSeries_iommu.c b/arch/ppc64/kernel/pSeries_iommu.c
index f0fd7fbd6531..d17f0108a032 100644
--- a/arch/ppc64/kernel/pSeries_iommu.c
+++ b/arch/ppc64/kernel/pSeries_iommu.c
@@ -265,8 +265,10 @@ static void iommu_table_setparms(struct pci_controller *phb,
265 tbl->it_offset = phb->dma_window_base_cur >> PAGE_SHIFT; 265 tbl->it_offset = phb->dma_window_base_cur >> PAGE_SHIFT;
266 266
267 /* Test if we are going over 2GB of DMA space */ 267 /* Test if we are going over 2GB of DMA space */
268 if (phb->dma_window_base_cur + phb->dma_window_size > (1L << 31)) 268 if (phb->dma_window_base_cur + phb->dma_window_size > 0x80000000ul) {
269 udbg_printf("PCI_DMA: Unexpected number of IOAs under this PHB.\n");
269 panic("PCI_DMA: Unexpected number of IOAs under this PHB.\n"); 270 panic("PCI_DMA: Unexpected number of IOAs under this PHB.\n");
271 }
270 272
271 phb->dma_window_base_cur += phb->dma_window_size; 273 phb->dma_window_base_cur += phb->dma_window_size;
272 274
@@ -310,92 +312,85 @@ static void iommu_table_setparms_lpar(struct pci_controller *phb,
310 312
311static void iommu_bus_setup_pSeries(struct pci_bus *bus) 313static void iommu_bus_setup_pSeries(struct pci_bus *bus)
312{ 314{
313 struct device_node *dn, *pdn; 315 struct device_node *dn;
314 struct pci_dn *pci;
315 struct iommu_table *tbl; 316 struct iommu_table *tbl;
317 struct device_node *isa_dn, *isa_dn_orig;
318 struct device_node *tmp;
319 struct pci_dn *pci;
320 int children;
316 321
317 DBG("iommu_bus_setup_pSeries, bus %p, bus->self %p\n", bus, bus->self); 322 DBG("iommu_bus_setup_pSeries, bus %p, bus->self %p\n", bus, bus->self);
318 323
319 /* For each (root) bus, we carve up the available DMA space in 256MB 324 dn = pci_bus_to_OF_node(bus);
320 * pieces. Since each piece is used by one (sub) bus/device, that would 325 pci = PCI_DN(dn);
321 * give a maximum of 7 devices per PHB. In most cases, this is plenty. 326
322 * 327 if (bus->self) {
323 * The exception is on Python PHBs (pre-POWER4). Here we don't have EADS 328 /* This is not a root bus, any setup will be done for the
324 * bridges below the PHB to allocate the sectioned tables to, so instead 329 * device-side of the bridge in iommu_dev_setup_pSeries().
325 * we allocate a 1GB table at the PHB level. 330 */
331 return;
332 }
333
334 /* Check if the ISA bus on the system is under
335 * this PHB.
326 */ 336 */
337 isa_dn = isa_dn_orig = of_find_node_by_type(NULL, "isa");
327 338
328 dn = pci_bus_to_OF_node(bus); 339 while (isa_dn && isa_dn != dn)
329 pci = dn->data; 340 isa_dn = isa_dn->parent;
330 341
331 if (!bus->self) { 342 if (isa_dn_orig)
332 /* Root bus */ 343 of_node_put(isa_dn_orig);
333 if (is_python(dn)) {
334 unsigned int *iohole;
335
336 DBG("Python root bus %s\n", bus->name);
337
338 iohole = (unsigned int *)get_property(dn, "io-hole", 0);
339
340 if (iohole) {
341 /* On first bus we need to leave room for the
342 * ISA address space. Just skip the first 256MB
343 * alltogether. This leaves 768MB for the window.
344 */
345 DBG("PHB has io-hole, reserving 256MB\n");
346 pci->phb->dma_window_size = 3 << 28;
347 pci->phb->dma_window_base_cur = 1 << 28;
348 } else {
349 /* 1GB window by default */
350 pci->phb->dma_window_size = 1 << 30;
351 pci->phb->dma_window_base_cur = 0;
352 }
353
354 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
355
356 iommu_table_setparms(pci->phb, dn, tbl);
357 pci->iommu_table = iommu_init_table(tbl);
358 } else {
359 /* Do a 128MB table at root. This is used for the IDE
360 * controller on some SMP-mode POWER4 machines. It
361 * doesn't hurt to allocate it on other machines
362 * -- it'll just be unused since new tables are
363 * allocated on the EADS level.
364 *
365 * Allocate at offset 128MB to avoid having to deal
366 * with ISA holes; 128MB table for IDE is plenty.
367 */
368 pci->phb->dma_window_size = 1 << 27;
369 pci->phb->dma_window_base_cur = 1 << 27;
370
371 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
372
373 iommu_table_setparms(pci->phb, dn, tbl);
374 pci->iommu_table = iommu_init_table(tbl);
375
376 /* All child buses have 256MB tables */
377 pci->phb->dma_window_size = 1 << 28;
378 }
379 } else {
380 pdn = pci_bus_to_OF_node(bus->parent);
381 344
382 if (!bus->parent->self && !is_python(pdn)) { 345 /* Count number of direct PCI children of the PHB.
383 struct iommu_table *tbl; 346 * All PCI device nodes have class-code property, so it's
384 /* First child and not python means this is the EADS 347 * an easy way to find them.
385 * level. Allocate new table for this slot with 256MB 348 */
386 * window. 349 for (children = 0, tmp = dn->child; tmp; tmp = tmp->sibling)
387 */ 350 if (get_property(tmp, "class-code", NULL))
351 children++;
388 352
389 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL); 353 DBG("Children: %d\n", children);
390 354
391 iommu_table_setparms(pci->phb, dn, tbl); 355 /* Calculate amount of DMA window per slot. Each window must be
356 * a power of two (due to pci_alloc_consistent requirements).
357 *
358 * Keep 256MB aside for PHBs with ISA.
359 */
392 360
393 pci->iommu_table = iommu_init_table(tbl); 361 if (!isa_dn) {
394 } else { 362 /* No ISA/IDE - just set window size and return */
395 /* Lower than first child or under python, use parent table */ 363 pci->phb->dma_window_size = 0x80000000ul; /* To be divided */
396 pci->iommu_table = PCI_DN(pdn)->iommu_table; 364
397 } 365 while (pci->phb->dma_window_size * children > 0x80000000ul)
366 pci->phb->dma_window_size >>= 1;
367 DBG("No ISA/IDE, window size is 0x%lx\n",
368 pci->phb->dma_window_size);
369 pci->phb->dma_window_base_cur = 0;
370
371 return;
398 } 372 }
373
374 /* If we have ISA, then we probably have an IDE
375 * controller too. Allocate a 128MB table but
376 * skip the first 128MB to avoid stepping on ISA
377 * space.
378 */
379 pci->phb->dma_window_size = 0x8000000ul;
380 pci->phb->dma_window_base_cur = 0x8000000ul;
381
382 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
383
384 iommu_table_setparms(pci->phb, dn, tbl);
385 pci->iommu_table = iommu_init_table(tbl);
386
387 /* Divide the rest (1.75GB) among the children */
388 pci->phb->dma_window_size = 0x80000000ul;
389 while (pci->phb->dma_window_size * children > 0x70000000ul)
390 pci->phb->dma_window_size >>= 1;
391
392 DBG("ISA/IDE, window size is 0x%lx\n", pci->phb->dma_window_size);
393
399} 394}
400 395
401 396
@@ -446,21 +441,36 @@ static void iommu_bus_setup_pSeriesLP(struct pci_bus *bus)
446static void iommu_dev_setup_pSeries(struct pci_dev *dev) 441static void iommu_dev_setup_pSeries(struct pci_dev *dev)
447{ 442{
448 struct device_node *dn, *mydn; 443 struct device_node *dn, *mydn;
444 struct iommu_table *tbl;
445
446 DBG("iommu_dev_setup_pSeries, dev %p (%s)\n", dev, pci_name(dev));
449 447
450 DBG("iommu_dev_setup_pSeries, dev %p (%s)\n", dev, dev->pretty_name);
451 /* Now copy the iommu_table ptr from the bus device down to the
452 * pci device_node. This means get_iommu_table() won't need to search
453 * up the device tree to find it.
454 */
455 mydn = dn = pci_device_to_OF_node(dev); 448 mydn = dn = pci_device_to_OF_node(dev);
456 449
450 /* If we're the direct child of a root bus, then we need to allocate
451 * an iommu table ourselves. The bus setup code should have setup
452 * the window sizes already.
453 */
454 if (!dev->bus->self) {
455 DBG(" --> first child, no bridge. Allocating iommu table.\n");
456 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
457 iommu_table_setparms(PCI_DN(dn)->phb, dn, tbl);
458 PCI_DN(mydn)->iommu_table = iommu_init_table(tbl);
459
460 return;
461 }
462
463 /* If this device is further down the bus tree, search upwards until
464 * an already allocated iommu table is found and use that.
465 */
466
457 while (dn && dn->data && PCI_DN(dn)->iommu_table == NULL) 467 while (dn && dn->data && PCI_DN(dn)->iommu_table == NULL)
458 dn = dn->parent; 468 dn = dn->parent;
459 469
460 if (dn && dn->data) { 470 if (dn && dn->data) {
461 PCI_DN(mydn)->iommu_table = PCI_DN(dn)->iommu_table; 471 PCI_DN(mydn)->iommu_table = PCI_DN(dn)->iommu_table;
462 } else { 472 } else {
463 DBG("iommu_dev_setup_pSeries, dev %p (%s) has no iommu table\n", dev, dev->pretty_name); 473 DBG("iommu_dev_setup_pSeries, dev %p (%s) has no iommu table\n", dev, pci_name(dev));
464 } 474 }
465} 475}
466 476
@@ -494,7 +504,7 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
494 int *dma_window = NULL; 504 int *dma_window = NULL;
495 struct pci_dn *pci; 505 struct pci_dn *pci;
496 506
497 DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, dev->pretty_name); 507 DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, pci_name(dev));
498 508
499 /* dev setup for LPAR is a little tricky, since the device tree might 509 /* dev setup for LPAR is a little tricky, since the device tree might
500 * contain the dma-window properties per-device and not neccesarily 510 * contain the dma-window properties per-device and not neccesarily
@@ -516,9 +526,8 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
516 * slots on POWER4 machines. 526 * slots on POWER4 machines.
517 */ 527 */
518 if (dma_window == NULL || pdn->parent == NULL) { 528 if (dma_window == NULL || pdn->parent == NULL) {
519 /* Fall back to regular (non-LPAR) dev setup */ 529 DBG("No dma window for device, linking to parent\n");
520 DBG("No dma window for device, falling back to regular setup\n"); 530 PCI_DN(dn)->iommu_table = PCI_DN(pdn)->iommu_table;
521 iommu_dev_setup_pSeries(dev);
522 return; 531 return;
523 } else { 532 } else {
524 DBG("Found DMA window, allocating table\n"); 533 DBG("Found DMA window, allocating table\n");
diff --git a/arch/ppc64/kernel/pSeries_pci.c b/arch/ppc64/kernel/pSeries_pci.c
index 1f5f141fb7a1..928f8febdb3b 100644
--- a/arch/ppc64/kernel/pSeries_pci.c
+++ b/arch/ppc64/kernel/pSeries_pci.c
@@ -32,7 +32,7 @@
32 32
33#include "pci.h" 33#include "pci.h"
34 34
35static int __initdata s7a_workaround = -1; 35static int __devinitdata s7a_workaround = -1;
36 36
37#if 0 37#if 0
38void pcibios_name_device(struct pci_dev *dev) 38void pcibios_name_device(struct pci_dev *dev)
@@ -60,7 +60,7 @@ void pcibios_name_device(struct pci_dev *dev)
60DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_name_device); 60DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_name_device);
61#endif 61#endif
62 62
63static void __init check_s7a(void) 63static void __devinit check_s7a(void)
64{ 64{
65 struct device_node *root; 65 struct device_node *root;
66 char *model; 66 char *model;
diff --git a/arch/ppc64/kernel/pci.c b/arch/ppc64/kernel/pci.c
index 861138ad092c..ff4be1da69d5 100644
--- a/arch/ppc64/kernel/pci.c
+++ b/arch/ppc64/kernel/pci.c
@@ -246,11 +246,14 @@ static unsigned int pci_parse_of_flags(u32 addr0)
246 unsigned int flags = 0; 246 unsigned int flags = 0;
247 247
248 if (addr0 & 0x02000000) { 248 if (addr0 & 0x02000000) {
249 flags |= IORESOURCE_MEM; 249 flags = IORESOURCE_MEM | PCI_BASE_ADDRESS_SPACE_MEMORY;
250 flags |= (addr0 >> 22) & PCI_BASE_ADDRESS_MEM_TYPE_64;
251 flags |= (addr0 >> 28) & PCI_BASE_ADDRESS_MEM_TYPE_1M;
250 if (addr0 & 0x40000000) 252 if (addr0 & 0x40000000)
251 flags |= IORESOURCE_PREFETCH; 253 flags |= IORESOURCE_PREFETCH
254 | PCI_BASE_ADDRESS_MEM_PREFETCH;
252 } else if (addr0 & 0x01000000) 255 } else if (addr0 & 0x01000000)
253 flags |= IORESOURCE_IO; 256 flags = IORESOURCE_IO | PCI_BASE_ADDRESS_SPACE_IO;
254 return flags; 257 return flags;
255} 258}
256 259
diff --git a/arch/ppc64/kernel/pci_direct_iommu.c b/arch/ppc64/kernel/pci_direct_iommu.c
index b8f7f58824f4..54055c81017a 100644
--- a/arch/ppc64/kernel/pci_direct_iommu.c
+++ b/arch/ppc64/kernel/pci_direct_iommu.c
@@ -31,7 +31,7 @@
31#include "pci.h" 31#include "pci.h"
32 32
33static void *pci_direct_alloc_coherent(struct device *hwdev, size_t size, 33static void *pci_direct_alloc_coherent(struct device *hwdev, size_t size,
34 dma_addr_t *dma_handle, unsigned int __nocast flag) 34 dma_addr_t *dma_handle, gfp_t flag)
35{ 35{
36 void *ret; 36 void *ret;
37 37
diff --git a/arch/ppc64/kernel/pci_iommu.c b/arch/ppc64/kernel/pci_iommu.c
index 14647e09c9cd..d9e33b7d4203 100644
--- a/arch/ppc64/kernel/pci_iommu.c
+++ b/arch/ppc64/kernel/pci_iommu.c
@@ -76,7 +76,7 @@ static inline struct iommu_table *devnode_table(struct device *dev)
76 * to the dma address (mapping) of the first page. 76 * to the dma address (mapping) of the first page.
77 */ 77 */
78static void *pci_iommu_alloc_coherent(struct device *hwdev, size_t size, 78static void *pci_iommu_alloc_coherent(struct device *hwdev, size_t size,
79 dma_addr_t *dma_handle, unsigned int __nocast flag) 79 dma_addr_t *dma_handle, gfp_t flag)
80{ 80{
81 return iommu_alloc_coherent(devnode_table(hwdev), size, dma_handle, 81 return iommu_alloc_coherent(devnode_table(hwdev), size, dma_handle,
82 flag); 82 flag);
diff --git a/arch/ppc64/kernel/pmac_setup.c b/arch/ppc64/kernel/pmac_setup.c
index 325426c7bed0..fa8121d53b89 100644
--- a/arch/ppc64/kernel/pmac_setup.c
+++ b/arch/ppc64/kernel/pmac_setup.c
@@ -115,7 +115,7 @@ static void __pmac pmac_show_cpuinfo(struct seq_file *m)
115 115
116 /* find motherboard type */ 116 /* find motherboard type */
117 seq_printf(m, "machine\t\t: "); 117 seq_printf(m, "machine\t\t: ");
118 np = find_devices("device-tree"); 118 np = of_find_node_by_path("/");
119 if (np != NULL) { 119 if (np != NULL) {
120 pp = (char *) get_property(np, "model", NULL); 120 pp = (char *) get_property(np, "model", NULL);
121 if (pp != NULL) 121 if (pp != NULL)
@@ -133,6 +133,7 @@ static void __pmac pmac_show_cpuinfo(struct seq_file *m)
133 } 133 }
134 seq_printf(m, "\n"); 134 seq_printf(m, "\n");
135 } 135 }
136 of_node_put(np);
136 } else 137 } else
137 seq_printf(m, "PowerMac\n"); 138 seq_printf(m, "PowerMac\n");
138 139
@@ -434,15 +435,23 @@ static int pmac_check_legacy_ioport(unsigned int baseport)
434 435
435static int __init pmac_declare_of_platform_devices(void) 436static int __init pmac_declare_of_platform_devices(void)
436{ 437{
437 struct device_node *np; 438 struct device_node *np, *npp;
438 439
439 np = find_devices("u3"); 440 npp = of_find_node_by_name(NULL, "u3");
440 if (np) { 441 if (npp) {
441 for (np = np->child; np != NULL; np = np->sibling) 442 for (np = NULL; (np = of_get_next_child(npp, np)) != NULL;) {
442 if (strncmp(np->name, "i2c", 3) == 0) { 443 if (strncmp(np->name, "i2c", 3) == 0) {
443 of_platform_device_create(np, "u3-i2c"); 444 of_platform_device_create(np, "u3-i2c", NULL);
445 of_node_put(np);
444 break; 446 break;
445 } 447 }
448 }
449 of_node_put(npp);
450 }
451 npp = of_find_node_by_type(NULL, "smu");
452 if (npp) {
453 of_platform_device_create(npp, "smu", NULL);
454 of_node_put(npp);
446 } 455 }
447 456
448 return 0; 457 return 0;
diff --git a/arch/ppc64/kernel/pmac_time.c b/arch/ppc64/kernel/pmac_time.c
index 3059edb09cc8..41bbb8c59697 100644
--- a/arch/ppc64/kernel/pmac_time.c
+++ b/arch/ppc64/kernel/pmac_time.c
@@ -84,7 +84,7 @@ void __pmac pmac_get_rtc_time(struct rtc_time *tm)
84 84
85#ifdef CONFIG_PMAC_SMU 85#ifdef CONFIG_PMAC_SMU
86 case SYS_CTRLER_SMU: 86 case SYS_CTRLER_SMU:
87 smu_get_rtc_time(tm); 87 smu_get_rtc_time(tm, 1);
88 break; 88 break;
89#endif /* CONFIG_PMAC_SMU */ 89#endif /* CONFIG_PMAC_SMU */
90 default: 90 default:
@@ -128,7 +128,7 @@ int __pmac pmac_set_rtc_time(struct rtc_time *tm)
128 128
129#ifdef CONFIG_PMAC_SMU 129#ifdef CONFIG_PMAC_SMU
130 case SYS_CTRLER_SMU: 130 case SYS_CTRLER_SMU:
131 return smu_set_rtc_time(tm); 131 return smu_set_rtc_time(tm, 1);
132#endif /* CONFIG_PMAC_SMU */ 132#endif /* CONFIG_PMAC_SMU */
133 default: 133 default:
134 return -ENODEV; 134 return -ENODEV;
diff --git a/arch/ppc64/kernel/prom_init.c b/arch/ppc64/kernel/prom_init.c
index 9979919cdf92..f252670874a4 100644
--- a/arch/ppc64/kernel/prom_init.c
+++ b/arch/ppc64/kernel/prom_init.c
@@ -1711,6 +1711,7 @@ static void __init flatten_device_tree(void)
1711 unsigned long offset = reloc_offset(); 1711 unsigned long offset = reloc_offset();
1712 unsigned long mem_start, mem_end, room; 1712 unsigned long mem_start, mem_end, room;
1713 struct boot_param_header *hdr; 1713 struct boot_param_header *hdr;
1714 struct prom_t *_prom = PTRRELOC(&prom);
1714 char *namep; 1715 char *namep;
1715 u64 *rsvmap; 1716 u64 *rsvmap;
1716 1717
@@ -1765,6 +1766,7 @@ static void __init flatten_device_tree(void)
1765 RELOC(dt_struct_end) = PAGE_ALIGN(mem_start); 1766 RELOC(dt_struct_end) = PAGE_ALIGN(mem_start);
1766 1767
1767 /* Finish header */ 1768 /* Finish header */
1769 hdr->boot_cpuid_phys = _prom->cpu;
1768 hdr->magic = OF_DT_HEADER; 1770 hdr->magic = OF_DT_HEADER;
1769 hdr->totalsize = RELOC(dt_struct_end) - RELOC(dt_header_start); 1771 hdr->totalsize = RELOC(dt_struct_end) - RELOC(dt_header_start);
1770 hdr->off_dt_struct = RELOC(dt_struct_start) - RELOC(dt_header_start); 1772 hdr->off_dt_struct = RELOC(dt_struct_start) - RELOC(dt_header_start);
@@ -1854,7 +1856,6 @@ static void __init prom_find_boot_cpu(void)
1854 1856
1855 cpu_pkg = call_prom("instance-to-package", 1, 1, prom_cpu); 1857 cpu_pkg = call_prom("instance-to-package", 1, 1, prom_cpu);
1856 1858
1857 prom_setprop(cpu_pkg, "linux,boot-cpu", NULL, 0);
1858 prom_getprop(cpu_pkg, "reg", &getprop_rval, sizeof(getprop_rval)); 1859 prom_getprop(cpu_pkg, "reg", &getprop_rval, sizeof(getprop_rval));
1859 _prom->cpu = getprop_rval; 1860 _prom->cpu = getprop_rval;
1860 1861
diff --git a/arch/ppc64/kernel/ptrace.c b/arch/ppc64/kernel/ptrace.c
index 85ed3188a91d..b1c044ca5756 100644
--- a/arch/ppc64/kernel/ptrace.c
+++ b/arch/ppc64/kernel/ptrace.c
@@ -219,6 +219,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
219 219
220 case PTRACE_SET_DEBUGREG: 220 case PTRACE_SET_DEBUGREG:
221 ret = ptrace_set_debugreg(child, addr, data); 221 ret = ptrace_set_debugreg(child, addr, data);
222 break;
222 223
223 case PTRACE_DETACH: 224 case PTRACE_DETACH:
224 ret = ptrace_detach(child, data); 225 ret = ptrace_detach(child, data);
diff --git a/arch/ppc64/kernel/vdso32/gettimeofday.S b/arch/ppc64/kernel/vdso32/gettimeofday.S
index 07f1c1c650c8..e243c1d24af7 100644
--- a/arch/ppc64/kernel/vdso32/gettimeofday.S
+++ b/arch/ppc64/kernel/vdso32/gettimeofday.S
@@ -109,7 +109,7 @@ __do_get_xsec:
109 lwz r6,(CFG_TB_TO_XS+4)(r9) 109 lwz r6,(CFG_TB_TO_XS+4)(r9)
110 mulhwu r4,r7,r5 110 mulhwu r4,r7,r5
111 mulhwu r6,r7,r6 111 mulhwu r6,r7,r6
112 mullw r6,r7,r5 112 mullw r0,r7,r5
113 addc r6,r6,r0 113 addc r6,r6,r0
114 114
115 /* At this point, we have the scaled xsec value in r4 + XER:CA 115 /* At this point, we have the scaled xsec value in r4 + XER:CA
diff --git a/arch/ppc64/kernel/vio.c b/arch/ppc64/kernel/vio.c
index c90e1dd875ce..0e555b7a6587 100644
--- a/arch/ppc64/kernel/vio.c
+++ b/arch/ppc64/kernel/vio.c
@@ -218,7 +218,7 @@ static void vio_unmap_sg(struct device *dev, struct scatterlist *sglist,
218} 218}
219 219
220static void *vio_alloc_coherent(struct device *dev, size_t size, 220static void *vio_alloc_coherent(struct device *dev, size_t size,
221 dma_addr_t *dma_handle, unsigned int __nocast flag) 221 dma_addr_t *dma_handle, gfp_t flag)
222{ 222{
223 return iommu_alloc_coherent(to_vio_dev(dev)->iommu_table, size, 223 return iommu_alloc_coherent(to_vio_dev(dev)->iommu_table, size,
224 dma_handle, flag); 224 dma_handle, flag);