diff options
author | Scott Wood <scottwood@freescale.com> | 2014-04-08 01:00:49 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-04-08 19:58:35 (GMT) |
commit | 47d2261a3fa71cde24263559a4219a25e50d8c89 (patch) | |
tree | 28774d5b330ccf1b777a3af222d8356918328013 /arch/powerpc/platforms | |
parent | fb7f27080adc65cd5f341bdf56a1d0c14f316c1b (diff) | |
parent | 5fb9d37f27351e42f002e372074249f92cbdf815 (diff) | |
download | linux-fsl-qoriq-47d2261a3fa71cde24263559a4219a25e50d8c89.tar.xz |
Merge branch 'merge' into sdk-v1.6.x
This reverts v3.13-rc3+ (78fd82238d0e5716) to v3.12, except for
commits which I noticed which appear relevant to the SDK.
Signed-off-by: Scott Wood <scottwood@freescale.com>
Conflicts:
arch/powerpc/include/asm/kvm_host.h
arch/powerpc/kvm/book3s_hv_rmhandlers.S
arch/powerpc/kvm/book3s_interrupts.S
arch/powerpc/kvm/e500.c
arch/powerpc/kvm/e500mc.c
arch/powerpc/sysdev/fsl_soc.h
drivers/Kconfig
drivers/cpufreq/ppc-corenet-cpufreq.c
drivers/dma/fsldma.c
drivers/dma/s3c24xx-dma.c
drivers/misc/Makefile
drivers/mmc/host/sdhci-of-esdhc.c
drivers/mtd/devices/m25p80.c
drivers/net/ethernet/freescale/gianfar.h
drivers/platform/Kconfig
drivers/platform/Makefile
drivers/spi/spi-fsl-espi.c
include/crypto/algapi.h
include/linux/netdev_features.h
include/linux/skbuff.h
include/net/ip.h
net/core/ethtool.c
Diffstat (limited to 'arch/powerpc/platforms')
72 files changed, 331 insertions, 1606 deletions
diff --git a/arch/powerpc/platforms/512x/clock.c b/arch/powerpc/platforms/512x/clock.c index fd8a376..e504166 100644 --- a/arch/powerpc/platforms/512x/clock.c +++ b/arch/powerpc/platforms/512x/clock.c @@ -24,7 +24,6 @@ #include <linux/mutex.h> #include <linux/io.h> -#include <linux/of_address.h> #include <linux/of_platform.h> #include <asm/mpc5xxx.h> #include <asm/mpc5121.h> diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/platforms/512x/mpc512x_shared.c index 36b5652..a82a41b 100644 --- a/arch/powerpc/platforms/512x/mpc512x_shared.c +++ b/arch/powerpc/platforms/512x/mpc512x_shared.c @@ -60,6 +60,8 @@ void mpc512x_restart(char *cmd) ; } +#if IS_ENABLED(CONFIG_FB_FSL_DIU) + struct fsl_diu_shared_fb { u8 gamma[0x300]; /* 32-bit aligned! */ struct diu_ad ad0; /* 32-bit aligned! */ @@ -69,7 +71,7 @@ struct fsl_diu_shared_fb { }; #define DIU_DIV_MASK 0x000000ff -static void mpc512x_set_pixel_clock(unsigned int pixclock) +void mpc512x_set_pixel_clock(unsigned int pixclock) { unsigned long bestval, bestfreq, speed, busfreq; unsigned long minpixclock, maxpixclock, pixval; @@ -162,7 +164,7 @@ static void mpc512x_set_pixel_clock(unsigned int pixclock) iounmap(ccm); } -static enum fsl_diu_monitor_port +enum fsl_diu_monitor_port mpc512x_valid_monitor_port(enum fsl_diu_monitor_port port) { return FSL_DIU_PORT_DVI; @@ -177,7 +179,7 @@ static inline void mpc512x_free_bootmem(struct page *page) free_reserved_page(page); } -static void mpc512x_release_bootmem(void) +void mpc512x_release_bootmem(void) { unsigned long addr = diu_shared_fb.fb_phys & PAGE_MASK; unsigned long size = diu_shared_fb.fb_len; @@ -203,7 +205,7 @@ static void mpc512x_release_bootmem(void) * address range will be reserved in setup_arch() after bootmem * allocator is up. */ -static void __init mpc512x_init_diu(void) +void __init mpc512x_init_diu(void) { struct device_node *np; struct diu __iomem *diu_reg; @@ -272,7 +274,7 @@ out: iounmap(diu_reg); } -static void __init mpc512x_setup_diu(void) +void __init mpc512x_setup_diu(void) { int ret; @@ -301,6 +303,8 @@ static void __init mpc512x_setup_diu(void) diu_ops.release_bootmem = mpc512x_release_bootmem; } +#endif + void __init mpc512x_init_IRQ(void) { struct device_node *np; @@ -333,7 +337,7 @@ static struct of_device_id __initdata of_bus_ids[] = { {}, }; -static void __init mpc512x_declare_of_platform_devices(void) +void __init mpc512x_declare_of_platform_devices(void) { if (of_platform_bus_probe(NULL, of_bus_ids, NULL)) printk(KERN_ERR __FILE__ ": " @@ -383,7 +387,7 @@ static unsigned int __init get_fifo_size(struct device_node *np, ((u32)(_base) + sizeof(struct mpc52xx_psc))) /* Init PSC FIFO space for TX and RX slices */ -static void __init mpc512x_psc_fifo_init(void) +void __init mpc512x_psc_fifo_init(void) { struct device_node *np; void __iomem *psc; diff --git a/arch/powerpc/platforms/512x/pdm360ng.c b/arch/powerpc/platforms/512x/pdm360ng.c index 116f2325..24b314d 100644 --- a/arch/powerpc/platforms/512x/pdm360ng.c +++ b/arch/powerpc/platforms/512x/pdm360ng.c @@ -14,8 +14,6 @@ #include <linux/kernel.h> #include <linux/io.h> -#include <linux/of_address.h> -#include <linux/of_fdt.h> #include <linux/of_platform.h> #include <asm/machdep.h> diff --git a/arch/powerpc/platforms/52xx/Kconfig b/arch/powerpc/platforms/52xx/Kconfig index af54174..90f4496 100644 --- a/arch/powerpc/platforms/52xx/Kconfig +++ b/arch/powerpc/platforms/52xx/Kconfig @@ -57,5 +57,5 @@ config PPC_MPC5200_BUGFIX config PPC_MPC5200_LPBFIFO tristate "MPC5200 LocalPlus bus FIFO driver" - depends on PPC_MPC52xx && PPC_BESTCOMM + depends on PPC_MPC52xx select PPC_BESTCOMM_GEN_BD diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c index 2898b73..b69221b 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c @@ -340,7 +340,7 @@ static int mpc52xx_irqhost_map(struct irq_domain *h, unsigned int virq, { int l1irq; int l2irq; - struct irq_chip *uninitialized_var(irqchip); + struct irq_chip *irqchip; void *hndlr; int type; u32 reg; @@ -373,8 +373,9 @@ static int mpc52xx_irqhost_map(struct irq_domain *h, unsigned int virq, case MPC52xx_IRQ_L1_PERP: irqchip = &mpc52xx_periph_irqchip; break; case MPC52xx_IRQ_L1_SDMA: irqchip = &mpc52xx_sdma_irqchip; break; case MPC52xx_IRQ_L1_CRIT: + default: pr_warn("%s: Critical IRQ #%d is unsupported! Nopping it.\n", - __func__, l2irq); + __func__, l1irq); irq_set_chip(virq, &no_irq_chip); return 0; } diff --git a/arch/powerpc/platforms/82xx/mpc8272_ads.c b/arch/powerpc/platforms/82xx/mpc8272_ads.c index 6a14cf5..30394b4 100644 --- a/arch/powerpc/platforms/82xx/mpc8272_ads.c +++ b/arch/powerpc/platforms/82xx/mpc8272_ads.c @@ -16,8 +16,6 @@ #include <linux/init.h> #include <linux/interrupt.h> #include <linux/fsl_devices.h> -#include <linux/of_address.h> -#include <linux/of_fdt.h> #include <linux/of_platform.h> #include <linux/io.h> diff --git a/arch/powerpc/platforms/82xx/pq2fads.c b/arch/powerpc/platforms/82xx/pq2fads.c index e5f82ec..e1dceee 100644 --- a/arch/powerpc/platforms/82xx/pq2fads.c +++ b/arch/powerpc/platforms/82xx/pq2fads.c @@ -15,8 +15,6 @@ #include <linux/init.h> #include <linux/interrupt.h> #include <linux/fsl_devices.h> -#include <linux/of_address.h> -#include <linux/of_fdt.h> #include <linux/of_platform.h> #include <asm/io.h> diff --git a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c index fd71cfd..7bc3158 100644 --- a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c +++ b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c @@ -204,6 +204,7 @@ static int mcu_remove(struct i2c_client *client) ret = mcu_gpiochip_remove(mcu); if (ret) return ret; + i2c_set_clientdata(client, NULL); kfree(mcu); return 0; } diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c index 3d9716c..1d769a2 100644 --- a/arch/powerpc/platforms/83xx/suspend.c +++ b/arch/powerpc/platforms/83xx/suspend.c @@ -20,8 +20,6 @@ #include <linux/freezer.h> #include <linux/suspend.h> #include <linux/fsl_devices.h> -#include <linux/of_address.h> -#include <linux/of_irq.h> #include <linux/of_platform.h> #include <linux/export.h> diff --git a/arch/powerpc/platforms/85xx/c293pcie.c b/arch/powerpc/platforms/85xx/c293pcie.c index 213d5b8..6208e49 100644 --- a/arch/powerpc/platforms/85xx/c293pcie.c +++ b/arch/powerpc/platforms/85xx/c293pcie.c @@ -11,7 +11,6 @@ #include <linux/stddef.h> #include <linux/kernel.h> -#include <linux/of_fdt.h> #include <linux/of_platform.h> #include <asm/machdep.h> diff --git a/arch/powerpc/platforms/85xx/common.c b/arch/powerpc/platforms/85xx/common.c index eed44c9..7731c75 100644 --- a/arch/powerpc/platforms/85xx/common.c +++ b/arch/powerpc/platforms/85xx/common.c @@ -5,8 +5,6 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ - -#include <linux/of_irq.h> #include <linux/of_platform.h> #include <asm/qe.h> diff --git a/arch/powerpc/platforms/85xx/ppa8548.c b/arch/powerpc/platforms/85xx/ppa8548.c index 3daff7c..6a7704b 100644 --- a/arch/powerpc/platforms/85xx/ppa8548.c +++ b/arch/powerpc/platforms/85xx/ppa8548.c @@ -19,7 +19,6 @@ #include <linux/init.h> #include <linux/reboot.h> #include <linux/seq_file.h> -#include <linux/of_fdt.h> #include <linux/of_platform.h> #include <asm/machdep.h> diff --git a/arch/powerpc/platforms/85xx/sgy_cts1000.c b/arch/powerpc/platforms/85xx/sgy_cts1000.c index b9197ce..7179726 100644 --- a/arch/powerpc/platforms/85xx/sgy_cts1000.c +++ b/arch/powerpc/platforms/85xx/sgy_cts1000.c @@ -16,7 +16,6 @@ #include <linux/module.h> #include <linux/init.h> #include <linux/of_gpio.h> -#include <linux/of_irq.h> #include <linux/workqueue.h> #include <linux/reboot.h> #include <linux/interrupt.h> diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c index e7dd05b..521ca17 100644 --- a/arch/powerpc/platforms/85xx/smp.c +++ b/arch/powerpc/platforms/85xx/smp.c @@ -15,7 +15,6 @@ #include <linux/init.h> #include <linux/delay.h> #include <linux/of.h> -#include <linux/of_address.h> #include <linux/kexec.h> #include <linux/highmem.h> #include <linux/cpu.h> diff --git a/arch/powerpc/platforms/85xx/socrates_fpga_pic.c b/arch/powerpc/platforms/85xx/socrates_fpga_pic.c index 55a9682..3bbbf74 100644 --- a/arch/powerpc/platforms/85xx/socrates_fpga_pic.c +++ b/arch/powerpc/platforms/85xx/socrates_fpga_pic.c @@ -9,8 +9,6 @@ */ #include <linux/irq.h> -#include <linux/of_address.h> -#include <linux/of_irq.h> #include <linux/of_platform.h> #include <linux/io.h> diff --git a/arch/powerpc/platforms/86xx/pic.c b/arch/powerpc/platforms/86xx/pic.c index d5b98c0..9982f57 100644 --- a/arch/powerpc/platforms/86xx/pic.c +++ b/arch/powerpc/platforms/86xx/pic.c @@ -10,7 +10,6 @@ #include <linux/stddef.h> #include <linux/kernel.h> #include <linux/interrupt.h> -#include <linux/of_irq.h> #include <linux/of_platform.h> #include <asm/mpic.h> diff --git a/arch/powerpc/platforms/8xx/ep88xc.c b/arch/powerpc/platforms/8xx/ep88xc.c index e621666..7d9ac60 100644 --- a/arch/powerpc/platforms/8xx/ep88xc.c +++ b/arch/powerpc/platforms/8xx/ep88xc.c @@ -10,8 +10,6 @@ */ #include <linux/init.h> -#include <linux/of_address.h> -#include <linux/of_fdt.h> #include <linux/of_platform.h> #include <asm/machdep.h> diff --git a/arch/powerpc/platforms/8xx/mpc86xads_setup.c b/arch/powerpc/platforms/8xx/mpc86xads_setup.c index 6308464..866feff 100644 --- a/arch/powerpc/platforms/8xx/mpc86xads_setup.c +++ b/arch/powerpc/platforms/8xx/mpc86xads_setup.c @@ -15,8 +15,6 @@ */ #include <linux/init.h> -#include <linux/of_address.h> -#include <linux/of_fdt.h> #include <linux/of_platform.h> #include <asm/io.h> diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c index c126258..5d98398 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c +++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c @@ -25,8 +25,6 @@ #include <linux/fs_uart_pd.h> #include <linux/fsl_devices.h> #include <linux/mii.h> -#include <linux/of_address.h> -#include <linux/of_fdt.h> #include <linux/of_platform.h> #include <asm/delay.h> diff --git a/arch/powerpc/platforms/8xx/tqm8xx_setup.c b/arch/powerpc/platforms/8xx/tqm8xx_setup.c index 251aba8..8d21ab7 100644 --- a/arch/powerpc/platforms/8xx/tqm8xx_setup.c +++ b/arch/powerpc/platforms/8xx/tqm8xx_setup.c @@ -28,7 +28,6 @@ #include <linux/fs_uart_pd.h> #include <linux/fsl_devices.h> #include <linux/mii.h> -#include <linux/of_fdt.h> #include <linux/of_platform.h> #include <asm/delay.h> @@ -49,7 +48,7 @@ struct cpm_pin { int port, pin, flags; }; -static struct cpm_pin tqm8xx_pins[] __initdata = { +static struct __initdata cpm_pin tqm8xx_pins[] = { /* SMC1 */ {CPM_PORTB, 24, CPM_PIN_INPUT}, /* RX */ {CPM_PORTB, 25, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */ @@ -64,7 +63,7 @@ static struct cpm_pin tqm8xx_pins[] __initdata = { {CPM_PORTC, 11, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_GPIO}, }; -static struct cpm_pin tqm8xx_fec_pins[] __initdata = { +static struct __initdata cpm_pin tqm8xx_fec_pins[] = { /* MII */ {CPM_PORTD, 3, CPM_PIN_OUTPUT}, {CPM_PORTD, 4, CPM_PIN_OUTPUT}, diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype index 75a8ffe..1211e3b 100644 --- a/arch/powerpc/platforms/Kconfig.cputype +++ b/arch/powerpc/platforms/Kconfig.cputype @@ -93,23 +93,22 @@ choice config GENERIC_CPU bool "Generic" - depends on !CPU_LITTLE_ENDIAN config CELL_CPU bool "Cell Broadband Engine" - depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN + depends on PPC_BOOK3S_64 config POWER4_CPU bool "POWER4" - depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN + depends on PPC_BOOK3S_64 config POWER5_CPU bool "POWER5" - depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN + depends on PPC_BOOK3S_64 config POWER6_CPU bool "POWER6" - depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN + depends on PPC_BOOK3S_64 config POWER7_CPU bool "POWER7" @@ -472,28 +471,3 @@ config PPC_DOORBELL default n endmenu - -choice - prompt "Endianness selection" - default CPU_BIG_ENDIAN - help - This option selects whether a big endian or little endian kernel will - be built. - -config CPU_BIG_ENDIAN - bool "Build big endian kernel" - help - Build a big endian kernel. - - If unsure, select this option. - -config CPU_LITTLE_ENDIAN - bool "Build little endian kernel" - help - Build a little endian kernel. - - Note that if cross compiling a little endian kernel, - CROSS_COMPILE must point to a toolchain capable of targeting - little endian powerpc. - -endchoice diff --git a/arch/powerpc/platforms/cell/celleb_scc_pciex.c b/arch/powerpc/platforms/cell/celleb_scc_pciex.c index 4278acf..14be2bd 100644 --- a/arch/powerpc/platforms/cell/celleb_scc_pciex.c +++ b/arch/powerpc/platforms/cell/celleb_scc_pciex.c @@ -486,6 +486,7 @@ static __init int celleb_setup_pciex(struct device_node *node, struct pci_controller *phb) { struct resource r; + struct of_irq oirq; int virq; /* SMMIO registers; used inside this file */ @@ -506,11 +507,12 @@ static __init int celleb_setup_pciex(struct device_node *node, phb->ops = &scc_pciex_pci_ops; /* internal interrupt handler */ - virq = irq_of_parse_and_map(node, 1); - if (!virq) { + if (of_irq_map_one(node, 1, &oirq)) { pr_err("PCIEXC:Failed to map irq\n"); goto error; } + virq = irq_create_of_mapping(oirq.controller, oirq.specifier, + oirq.size); if (request_irq(virq, pciex_handle_internal_irq, 0, "pciex", (void *)phb)) { pr_err("PCIEXC:Failed to request irq\n"); diff --git a/arch/powerpc/platforms/cell/celleb_scc_sio.c b/arch/powerpc/platforms/cell/celleb_scc_sio.c index c8eb571..9c339ec 100644 --- a/arch/powerpc/platforms/cell/celleb_scc_sio.c +++ b/arch/powerpc/platforms/cell/celleb_scc_sio.c @@ -45,7 +45,7 @@ static int __init txx9_serial_init(void) struct device_node *node; int i; struct uart_port req; - struct of_phandle_args irq; + struct of_irq irq; struct resource res; for_each_compatible_node(node, "serial", "toshiba,sio-scc") { @@ -53,7 +53,7 @@ static int __init txx9_serial_init(void) if (!(txx9_serial_bitmap & (1<<i))) continue; - if (of_irq_parse_one(node, i, &irq)) + if (of_irq_map_one(node, i, &irq)) continue; if (of_address_to_resource(node, txx9_scc_tab[i].index, &res)) @@ -66,7 +66,8 @@ static int __init txx9_serial_init(void) #ifdef CONFIG_SERIAL_TXX9_CONSOLE req.membase = ioremap(req.mapbase, 0x24); #endif - req.irq = irq_create_of_mapping(&irq); + req.irq = irq_create_of_mapping(irq.controller, + irq.specifier, irq.size); req.flags |= UPF_IOREMAP | UPF_BUGGY_UART /*HAVE_CTS_LINE*/; req.uartclk = 83300000; diff --git a/arch/powerpc/platforms/cell/spider-pic.c b/arch/powerpc/platforms/cell/spider-pic.c index 1f72f4a..8e29944 100644 --- a/arch/powerpc/platforms/cell/spider-pic.c +++ b/arch/powerpc/platforms/cell/spider-pic.c @@ -235,9 +235,12 @@ static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic) /* First, we check whether we have a real "interrupts" in the device * tree in case the device-tree is ever fixed */ - virq = irq_of_parse_and_map(pic->host->of_node, 0); - if (virq) + struct of_irq oirq; + if (of_irq_map_one(pic->host->of_node, 0, &oirq) == 0) { + virq = irq_create_of_mapping(oirq.controller, oirq.specifier, + oirq.size); return virq; + } /* Now do the horrible hacks */ tmp = of_get_property(pic->host->of_node, "#interrupt-cells", NULL); diff --git a/arch/powerpc/platforms/cell/spu_manage.c b/arch/powerpc/platforms/cell/spu_manage.c index c3327f3..2bb6977 100644 --- a/arch/powerpc/platforms/cell/spu_manage.c +++ b/arch/powerpc/platforms/cell/spu_manage.c @@ -177,20 +177,21 @@ out: static int __init spu_map_interrupts(struct spu *spu, struct device_node *np) { - struct of_phandle_args oirq; + struct of_irq oirq; int ret; int i; for (i=0; i < 3; i++) { - ret = of_irq_parse_one(np, i, &oirq); + ret = of_irq_map_one(np, i, &oirq); if (ret) { pr_debug("spu_new: failed to get irq %d\n", i); goto err; } ret = -EINVAL; - pr_debug(" irq %d no 0x%x on %s\n", i, oirq.args[0], - oirq.np->full_name); - spu->irqs[i] = irq_create_of_mapping(&oirq); + pr_debug(" irq %d no 0x%x on %s\n", i, oirq.specifier[0], + oirq.controller->full_name); + spu->irqs[i] = irq_create_of_mapping(oirq.controller, + oirq.specifier, oirq.size); if (spu->irqs[i] == NO_IRQ) { pr_debug("spu_new: failed to map it !\n"); goto err; @@ -199,7 +200,7 @@ static int __init spu_map_interrupts(struct spu *spu, struct device_node *np) return 0; err: - pr_debug("failed to map irq %x for spu %s\n", *oirq.args, + pr_debug("failed to map irq %x for spu %s\n", *oirq.specifier, spu->name); for (; i >= 0; i--) { if (spu->irqs[i] != NO_IRQ) diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c b/arch/powerpc/platforms/cell/spu_syscalls.c index 3844f13..db4e638 100644 --- a/arch/powerpc/platforms/cell/spu_syscalls.c +++ b/arch/powerpc/platforms/cell/spu_syscalls.c @@ -25,7 +25,6 @@ #include <linux/module.h> #include <linux/syscalls.h> #include <linux/rcupdate.h> -#include <linux/binfmts.h> #include <asm/spu.h> @@ -127,7 +126,7 @@ int elf_coredump_extra_notes_size(void) return ret; } -int elf_coredump_extra_notes_write(struct coredump_params *cprm) +int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset) { struct spufs_calls *calls; int ret; @@ -136,7 +135,7 @@ int elf_coredump_extra_notes_write(struct coredump_params *cprm) if (!calls) return 0; - ret = calls->coredump_extra_notes_write(cprm); + ret = calls->coredump_extra_notes_write(file, foffset); spufs_calls_put(calls); diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c index be6212d..c9500ea 100644 --- a/arch/powerpc/platforms/cell/spufs/coredump.c +++ b/arch/powerpc/platforms/cell/spufs/coredump.c @@ -27,8 +27,6 @@ #include <linux/gfp.h> #include <linux/list.h> #include <linux/syscalls.h> -#include <linux/coredump.h> -#include <linux/binfmts.h> #include <asm/uaccess.h> @@ -50,6 +48,44 @@ static ssize_t do_coredump_read(int num, struct spu_context *ctx, void *buffer, return ++ret; /* count trailing NULL */ } +/* + * These are the only things you should do on a core-file: use only these + * functions to write out all the necessary info. + */ +static int spufs_dump_write(struct file *file, const void *addr, int nr, loff_t *foffset) +{ + unsigned long limit = rlimit(RLIMIT_CORE); + ssize_t written; + + if (*foffset + nr > limit) + return -EIO; + + written = file->f_op->write(file, addr, nr, &file->f_pos); + *foffset += written; + + if (written != nr) + return -EIO; + + return 0; +} + +static int spufs_dump_align(struct file *file, char *buf, loff_t new_off, + loff_t *foffset) +{ + int rc, size; + + size = min((loff_t)PAGE_SIZE, new_off - *foffset); + memset(buf, 0, size); + + rc = 0; + while (rc == 0 && new_off > *foffset) { + size = min((loff_t)PAGE_SIZE, new_off - *foffset); + rc = spufs_dump_write(file, buf, size, foffset); + } + + return rc; +} + static int spufs_ctx_note_size(struct spu_context *ctx, int dfd) { int i, sz, total = 0; @@ -129,10 +165,10 @@ int spufs_coredump_extra_notes_size(void) } static int spufs_arch_write_note(struct spu_context *ctx, int i, - struct coredump_params *cprm, int dfd) + struct file *file, int dfd, loff_t *foffset) { loff_t pos = 0; - int sz, rc, total = 0; + int sz, rc, nread, total = 0; const int bufsz = PAGE_SIZE; char *name; char fullname[80], *buf; @@ -150,39 +186,42 @@ static int spufs_arch_write_note(struct spu_context *ctx, int i, en.n_descsz = sz; en.n_type = NT_SPU; - if (!dump_emit(cprm, &en, sizeof(en))) - goto Eio; + rc = spufs_dump_write(file, &en, sizeof(en), foffset); + if (rc) + goto out; - if (!dump_emit(cprm, fullname, en.n_namesz)) - goto Eio; + rc = spufs_dump_write(file, fullname, en.n_namesz, foffset); + if (rc) + goto out; - if (!dump_align(cprm, 4)) - goto Eio; + rc = spufs_dump_align(file, buf, roundup(*foffset, 4), foffset); + if (rc) + goto out; do { - rc = do_coredump_read(i, ctx, buf, bufsz, &pos); - if (rc > 0) { - if (!dump_emit(cprm, buf, rc)) - goto Eio; - total += rc; + nread = do_coredump_read(i, ctx, buf, bufsz, &pos); + if (nread > 0) { + rc = spufs_dump_write(file, buf, nread, foffset); + if (rc) + goto out; + total += nread; } - } while (rc == bufsz && total < sz); + } while (nread == bufsz && total < sz); - if (rc < 0) + if (nread < 0) { + rc = nread; goto out; + } + + rc = spufs_dump_align(file, buf, roundup(*foffset - total + sz, 4), + foffset); - if (!dump_skip(cprm, - roundup(cprm->written - total + sz, 4) - cprm->written)) - goto Eio; out: free_page((unsigned long)buf); return rc; -Eio: - free_page((unsigned long)buf); - return -EIO; } -int spufs_coredump_extra_notes_write(struct coredump_params *cprm) +int spufs_coredump_extra_notes_write(struct file *file, loff_t *foffset) { struct spu_context *ctx; int fd, j, rc; @@ -194,7 +233,7 @@ int spufs_coredump_extra_notes_write(struct coredump_params *cprm) return rc; for (j = 0; spufs_coredump_read[j].name != NULL; j++) { - rc = spufs_arch_write_note(ctx, j, cprm, fd); + rc = spufs_arch_write_note(ctx, j, file, fd, foffset); if (rc) { spu_release_saved(ctx); return rc; diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h index 0ba3c95..67852ad 100644 --- a/arch/powerpc/platforms/cell/spufs/spufs.h +++ b/arch/powerpc/platforms/cell/spufs/spufs.h @@ -247,13 +247,12 @@ extern const struct spufs_tree_descr spufs_dir_debug_contents[]; /* system call implementation */ extern struct spufs_calls spufs_calls; -struct coredump_params; long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *status); long spufs_create(struct path *nd, struct dentry *dentry, unsigned int flags, umode_t mode, struct file *filp); /* ELF coredump callbacks for writing SPU ELF notes */ extern int spufs_coredump_extra_notes_size(void); -extern int spufs_coredump_extra_notes_write(struct coredump_params *cprm); +extern int spufs_coredump_extra_notes_write(struct file *file, loff_t *foffset); extern const struct file_operations spufs_context_fops; diff --git a/arch/powerpc/platforms/chrp/nvram.c b/arch/powerpc/platforms/chrp/nvram.c index 9ef8cc3..d3ceff0 100644 --- a/arch/powerpc/platforms/chrp/nvram.c +++ b/arch/powerpc/platforms/chrp/nvram.c @@ -66,7 +66,7 @@ static void chrp_nvram_write(int addr, unsigned char val) void __init chrp_nvram_init(void) { struct device_node *nvram; - const __be32 *nbytes_p; + const unsigned int *nbytes_p; unsigned int proplen; nvram = of_find_node_by_type(NULL, "nvram"); @@ -79,7 +79,7 @@ void __init chrp_nvram_init(void) return; } - nvram_size = be32_to_cpup(nbytes_p); + nvram_size = *nbytes_p; printk(KERN_INFO "CHRP nvram contains %u bytes\n", nvram_size); of_node_put(nvram); diff --git a/arch/powerpc/platforms/embedded6xx/flipper-pic.c b/arch/powerpc/platforms/embedded6xx/flipper-pic.c index 4cde8e7..53d6eee0 100644 --- a/arch/powerpc/platforms/embedded6xx/flipper-pic.c +++ b/arch/powerpc/platforms/embedded6xx/flipper-pic.c @@ -18,7 +18,6 @@ #include <linux/init.h> #include <linux/irq.h> #include <linux/of.h> -#include <linux/of_address.h> #include <asm/io.h> #include "flipper-pic.h" diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c index 6c03034..3006b51 100644 --- a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c +++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c @@ -18,8 +18,6 @@ #include <linux/init.h> #include <linux/irq.h> #include <linux/of.h> -#include <linux/of_address.h> -#include <linux/of_irq.h> #include <asm/io.h> #include "hlwd-pic.h" @@ -183,7 +181,6 @@ struct irq_domain *hlwd_pic_init(struct device_node *np) &hlwd_irq_domain_ops, io_base); if (!irq_domain) { pr_err("failed to allocate irq_domain\n"); - iounmap(io_base); return NULL; } diff --git a/arch/powerpc/platforms/fsl_uli1575.c b/arch/powerpc/platforms/fsl_uli1575.c index b97f6f3..92ac9b5 100644 --- a/arch/powerpc/platforms/fsl_uli1575.c +++ b/arch/powerpc/platforms/fsl_uli1575.c @@ -321,7 +321,8 @@ static void hpcd_final_uli5288(struct pci_dev *dev) { struct pci_controller *hose = pci_bus_to_host(dev->bus); struct device_node *hosenode = hose ? hose->dn : NULL; - struct of_phandle_args oirq; + struct of_irq oirq; + int virq, pin = 2; u32 laddr[3]; if (!machine_is(mpc86xx_hpcd)) @@ -330,13 +331,12 @@ static void hpcd_final_uli5288(struct pci_dev *dev) if (!hosenode) return; - oirq.np = hosenode; - oirq.args[0] = 2; - oirq.args_count = 1; laddr[0] = (hose->first_busno << 16) | (PCI_DEVFN(31, 0) << 8); laddr[1] = laddr[2] = 0; - of_irq_parse_raw(laddr, &oirq); - dev->irq = irq_create_of_mapping(&oirq); + of_irq_map_raw(hosenode, &pin, 1, laddr, &oirq); + virq = irq_create_of_mapping(oirq.controller, oirq.specifier, + oirq.size); + dev->irq = virq; } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, hpcd_quirk_uli1575); diff --git a/arch/powerpc/platforms/pasemi/gpio_mdio.c b/arch/powerpc/platforms/pasemi/gpio_mdio.c index 15adee5..0237ab7 100644 --- a/arch/powerpc/platforms/pasemi/gpio_mdio.c +++ b/arch/powerpc/platforms/pasemi/gpio_mdio.c @@ -30,7 +30,6 @@ #include <linux/ioport.h> #include <linux/interrupt.h> #include <linux/phy.h> -#include <linux/of_address.h> #include <linux/of_mdio.h> #include <linux/of_platform.h> diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c index 7553b6a..fc536f2 100644 --- a/arch/powerpc/platforms/powermac/low_i2c.c +++ b/arch/powerpc/platforms/powermac/low_i2c.c @@ -452,7 +452,7 @@ static int kw_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize, */ if (use_irq) { /* Clear completion */ - reinit_completion(&host->complete); + INIT_COMPLETION(host->complete); /* Ack stale interrupts */ kw_write_reg(reg_isr, kw_read_reg(reg_isr)); /* Arm timeout */ @@ -717,7 +717,7 @@ static int pmu_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize, return -EINVAL; } - reinit_completion(&comp); + INIT_COMPLETION(comp); req->data[0] = PMU_I2C_CMD; req->reply[0] = 0xff; req->nbytes = sizeof(struct pmu_i2c_hdr) + 1; @@ -748,7 +748,7 @@ static int pmu_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize, hdr->bus = PMU_I2C_BUS_STATUS; - reinit_completion(&comp); + INIT_COMPLETION(comp); req->data[0] = PMU_I2C_CMD; req->reply[0] = 0xff; req->nbytes = 2; diff --git a/arch/powerpc/platforms/powermac/pfunc_base.c b/arch/powerpc/platforms/powermac/pfunc_base.c index e49d07f..f5e3cda 100644 --- a/arch/powerpc/platforms/powermac/pfunc_base.c +++ b/arch/powerpc/platforms/powermac/pfunc_base.c @@ -4,7 +4,6 @@ #include <linux/kernel.h> #include <linux/interrupt.h> #include <linux/spinlock.h> -#include <linux/of_irq.h> #include <asm/pmac_feature.h> #include <asm/pmac_pfunc.h> diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c index 4c24bf6..31036b5 100644 --- a/arch/powerpc/platforms/powermac/pic.c +++ b/arch/powerpc/platforms/powermac/pic.c @@ -393,8 +393,8 @@ static void __init pmac_pic_probe_oldstyle(void) #endif } -int of_irq_parse_oldworld(struct device_node *device, int index, - struct of_phandle_args *out_irq) +int of_irq_map_oldworld(struct device_node *device, int index, + struct of_irq *out_irq) { const u32 *ints = NULL; int intlen; @@ -422,9 +422,9 @@ int of_irq_parse_oldworld(struct device_node *device, int index, if (index >= intlen) return -EINVAL; - out_irq->np = NULL; - out_irq->args[0] = ints[index]; - out_irq->args_count = 1; + out_irq->controller = NULL; + out_irq->specifier[0] = ints[index]; + out_irq->size = 1; return 0; } diff --git a/arch/powerpc/platforms/powernv/Kconfig b/arch/powerpc/platforms/powernv/Kconfig index 9fced3f..6fae5eb 100644 --- a/arch/powerpc/platforms/powernv/Kconfig +++ b/arch/powerpc/platforms/powernv/Kconfig @@ -9,8 +9,6 @@ config PPC_POWERNV select EPAPR_BOOT select PPC_INDIRECT_PIO select PPC_UDBG_16550 - select PPC_SCOM - select ARCH_RANDOM default y config POWERNV_MSI diff --git a/arch/powerpc/platforms/powernv/Makefile b/arch/powerpc/platforms/powernv/Makefile index 873fa13..300c437 100644 --- a/arch/powerpc/platforms/powernv/Makefile +++ b/arch/powerpc/platforms/powernv/Makefile @@ -1,8 +1,6 @@ obj-y += setup.o opal-takeover.o opal-wrappers.o opal.o -obj-y += opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o -obj-y += rng.o +obj-y += opal-rtc.o opal-nvram.o opal-lpc.o obj-$(CONFIG_SMP) += smp.o obj-$(CONFIG_PCI) += pci.o pci-p5ioc2.o pci-ioda.o obj-$(CONFIG_EEH) += eeh-ioda.o eeh-powernv.o -obj-$(CONFIG_PPC_SCOM) += opal-xscom.o diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c index 02245ce..cf42e74 100644 --- a/arch/powerpc/platforms/powernv/eeh-ioda.c +++ b/arch/powerpc/platforms/powernv/eeh-ioda.c @@ -59,60 +59,26 @@ static struct notifier_block ioda_eeh_nb = { }; #ifdef CONFIG_DEBUG_FS -static int ioda_eeh_dbgfs_set(void *data, int offset, u64 val) +static int ioda_eeh_dbgfs_set(void *data, u64 val) { struct pci_controller *hose = data; struct pnv_phb *phb = hose->private_data; - out_be64(phb->regs + offset, val); + out_be64(phb->regs + 0xD10, val); return 0; } -static int ioda_eeh_dbgfs_get(void *data, int offset, u64 *val) +static int ioda_eeh_dbgfs_get(void *data, u64 *val) { struct pci_controller *hose = data; struct pnv_phb *phb = hose->private_data; - *val = in_be64(phb->regs + offset); + *val = in_be64(phb->regs + 0xD10); return 0; } -static int ioda_eeh_outb_dbgfs_set(void *data, u64 val) -{ - return ioda_eeh_dbgfs_set(data, 0xD10, val); -} - -static int ioda_eeh_outb_dbgfs_get(void *data, u64 *val) -{ - return ioda_eeh_dbgfs_get(data, 0xD10, val); -} - -static int ioda_eeh_inbA_dbgfs_set(void *data, u64 val) -{ - return ioda_eeh_dbgfs_set(data, 0xD90, val); -} - -static int ioda_eeh_inbA_dbgfs_get(void *data, u64 *val) -{ - return ioda_eeh_dbgfs_get(data, 0xD90, val); -} - -static int ioda_eeh_inbB_dbgfs_set(void *data, u64 val) -{ - return ioda_eeh_dbgfs_set(data, 0xE10, val); -} - -static int ioda_eeh_inbB_dbgfs_get(void *data, u64 *val) -{ - return ioda_eeh_dbgfs_get(data, 0xE10, val); -} - -DEFINE_SIMPLE_ATTRIBUTE(ioda_eeh_outb_dbgfs_ops, ioda_eeh_outb_dbgfs_get, - ioda_eeh_outb_dbgfs_set, "0x%llx\n"); -DEFINE_SIMPLE_ATTRIBUTE(ioda_eeh_inbA_dbgfs_ops, ioda_eeh_inbA_dbgfs_get, - ioda_eeh_inbA_dbgfs_set, "0x%llx\n"); -DEFINE_SIMPLE_ATTRIBUTE(ioda_eeh_inbB_dbgfs_ops, ioda_eeh_inbB_dbgfs_get, - ioda_eeh_inbB_dbgfs_set, "0x%llx\n"); +DEFINE_SIMPLE_ATTRIBUTE(ioda_eeh_dbgfs_ops, ioda_eeh_dbgfs_get, + ioda_eeh_dbgfs_set, "0x%llx\n"); #endif /* CONFIG_DEBUG_FS */ /** @@ -140,30 +106,27 @@ static int ioda_eeh_post_init(struct pci_controller *hose) ioda_eeh_nb_init = 1; } - /* We needn't HUB diag-data on PHB3 */ - if (phb->type == PNV_PHB_IODA1 && !hub_diag) { - hub_diag = (char *)__get_free_page(GFP_KERNEL | __GFP_ZERO); + /* FIXME: Enable it for PHB3 later */ + if (phb->type == PNV_PHB_IODA1) { if (!hub_diag) { - pr_err("%s: Out of memory !\n", __func__); - return -ENOMEM; + hub_diag = (char *)__get_free_page(GFP_KERNEL | + __GFP_ZERO); + if (!hub_diag) { + pr_err("%s: Out of memory !\n", + __func__); + return -ENOMEM; + } } - } #ifdef CONFIG_DEBUG_FS - if (phb->dbgfs) { - debugfs_create_file("err_injct_outbound", 0600, - phb->dbgfs, hose, - &ioda_eeh_outb_dbgfs_ops); - debugfs_create_file("err_injct_inboundA", 0600, - phb->dbgfs, hose, - &ioda_eeh_inbA_dbgfs_ops); - debugfs_create_file("err_injct_inboundB", 0600, - phb->dbgfs, hose, - &ioda_eeh_inbB_dbgfs_ops); - } + if (phb->dbgfs) + debugfs_create_file("err_injct", 0600, + phb->dbgfs, hose, + &ioda_eeh_dbgfs_ops); #endif - phb->eeh_state |= PNV_EEH_STATE_ENABLED; + phb->eeh_state |= PNV_EEH_STATE_ENABLED; + } return 0; } @@ -583,8 +546,8 @@ static int ioda_eeh_get_log(struct eeh_pe *pe, int severity, phb->diag.blob, PNV_PCI_DIAG_BUF_SIZE); if (ret) { spin_unlock_irqrestore(&phb->lock, flags); - pr_warning("%s: Can't get log for PHB#%x-PE#%x (%lld)\n", - __func__, hose->global_number, pe->addr, ret); + pr_warning("%s: Failed to get log for PHB#%x-PE#%x\n", + __func__, hose->global_number, pe->addr); return -EIO; } @@ -747,73 +710,6 @@ static void ioda_eeh_p7ioc_phb_diag(struct pci_controller *hose, } } -static void ioda_eeh_phb3_phb_diag(struct pci_controller *hose, - struct OpalIoPhbErrorCommon *common) -{ - struct OpalIoPhb3ErrorData *data; - int i; - - data = (struct OpalIoPhb3ErrorData*)common; - pr_info("PHB3 PHB#%x Diag-data (Version: %d)\n\n", - hose->global_number, common->version); - - pr_info(" brdgCtl: %08x\n", data->brdgCtl); - - pr_info(" portStatusReg: %08x\n", data->portStatusReg); - pr_info(" rootCmplxStatus: %08x\n", data->rootCmplxStatus); - pr_info(" busAgentStatus: %08x\n", data->busAgentStatus); - - pr_info(" deviceStatus: %08x\n", data->deviceStatus); - pr_info(" slotStatus: %08x\n", data->slotStatus); - pr_info(" linkStatus: %08x\n", data->linkStatus); - pr_info(" devCmdStatus: %08x\n", data->devCmdStatus); - pr_info(" devSecStatus: %08x\n", data->devSecStatus); - - pr_info(" rootErrorStatus: %08x\n", data->rootErrorStatus); - pr_info(" uncorrErrorStatus: %08x\n", data->uncorrErrorStatus); - pr_info(" corrErrorStatus: %08x\n", data->corrErrorStatus); - pr_info(" tlpHdr1: %08x\n", data->tlpHdr1); - pr_info(" tlpHdr2: %08x\n", data->tlpHdr2); - pr_info(" tlpHdr3: %08x\n", data->tlpHdr3); - pr_info(" tlpHdr4: %08x\n", data->tlpHdr4); - pr_info(" sourceId: %08x\n", data->sourceId); - pr_info(" errorClass: %016llx\n", data->errorClass); - pr_info(" correlator: %016llx\n", data->correlator); - pr_info(" nFir: %016llx\n", data->nFir); - pr_info(" nFirMask: %016llx\n", data->nFirMask); - pr_info(" nFirWOF: %016llx\n", data->nFirWOF); - pr_info(" PhbPlssr: %016llx\n", data->phbPlssr); - pr_info(" PhbCsr: %016llx\n", data->phbCsr); - pr_info(" lemFir: %016llx\n", data->lemFir); - pr_info(" lemErrorMask: %016llx\n", data->lemErrorMask); - pr_info(" lemWOF: %016llx\n", data->lemWOF); - pr_info(" phbErrorStatus: %016llx\n", data->phbErrorStatus); - pr_info(" phbFirstErrorStatus: %016llx\n", data->phbFirstErrorStatus); - pr_info(" phbErrorLog0: %016llx\n", data->phbErrorLog0); - pr_info(" phbErrorLog1: %016llx\n", data->phbErrorLog1); - pr_info(" mmioErrorStatus: %016llx\n", data->mmioErrorStatus); - pr_info(" mmioFirstErrorStatus: %016llx\n", data->mmioFirstErrorStatus); - pr_info(" mmioErrorLog0: %016llx\n", data->mmioErrorLog0); - pr_info(" mmioErrorLog1: %016llx\n", data->mmioErrorLog1); - pr_info(" dma0ErrorStatus: %016llx\n", data->dma0ErrorStatus); - pr_info(" dma0FirstErrorStatus: %016llx\n", data->dma0FirstErrorStatus); - pr_info(" dma0ErrorLog0: %016llx\n", data->dma0ErrorLog0); - pr_info(" dma0ErrorLog1: %016llx\n", data->dma0ErrorLog1); - pr_info(" dma1ErrorStatus: %016llx\n", data->dma1ErrorStatus); - pr_info(" dma1FirstErrorStatus: %016llx\n", data->dma1FirstErrorStatus); - pr_info(" dma1ErrorLog0: %016llx\n", data->dma1ErrorLog0); - pr_info(" dma1ErrorLog1: %016llx\n", data->dma1ErrorLog1); - - for (i = 0; i < OPAL_PHB3_NUM_PEST_REGS; i++) { - if ((data->pestA[i] >> 63) == 0 && - (data->pestB[i] >> 63) == 0) - continue; - - pr_info(" PE[%3d] PESTA: %016llx\n", i, data->pestA[i]); - pr_info(" PESTB: %016llx\n", data->pestB[i]); - } -} - static void ioda_eeh_phb_diag(struct pci_controller *hose) { struct pnv_phb *phb = hose->private_data; @@ -832,9 +728,6 @@ static void ioda_eeh_phb_diag(struct pci_controller *hose) case OPAL_PHB_ERROR_DATA_TYPE_P7IOC: ioda_eeh_p7ioc_phb_diag(hose, common); break; - case OPAL_PHB_ERROR_DATA_TYPE_PHB3: - ioda_eeh_phb3_phb_diag(hose, common); - break; default: pr_warning("%s: Unrecognized I/O chip %d\n", __func__, common->ioType); diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c index 73b9814..79663d2 100644 --- a/arch/powerpc/platforms/powernv/eeh-powernv.c +++ b/arch/powerpc/platforms/powernv/eeh-powernv.c @@ -144,8 +144,11 @@ static int powernv_eeh_dev_probe(struct pci_dev *dev, void *flag) /* * Enable EEH explicitly so that we will do EEH check * while accessing I/O stuff + * + * FIXME: Enable that for PHB3 later */ - eeh_subsystem_enabled = 1; + if (phb->type == PNV_PHB_IODA1) + eeh_subsystem_enabled = 1; /* Save memory bars */ eeh_save_bars(edev); diff --git a/arch/powerpc/platforms/powernv/opal-flash.c b/arch/powerpc/platforms/powernv/opal-flash.c deleted file mode 100644 index 6ffa6b1..0000000 --- a/arch/powerpc/platforms/powernv/opal-flash.c +++ /dev/null @@ -1,667 +0,0 @@ -/* - * PowerNV OPAL Firmware Update Interface - * - * Copyright 2013 IBM Corp. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#define DEBUG - -#include <linux/kernel.h> -#include <linux/reboot.h> -#include <linux/init.h> -#include <linux/kobject.h> -#include <linux/sysfs.h> -#include <linux/slab.h> -#include <linux/mm.h> -#include <linux/vmalloc.h> -#include <linux/pagemap.h> - -#include <asm/opal.h> - -/* FLASH status codes */ -#define FLASH_NO_OP -1099 /* No operation initiated by user */ -#define FLASH_NO_AUTH -9002 /* Not a service authority partition */ - -/* Validate image status values */ -#define VALIDATE_IMG_READY -1001 /* Image ready for validation */ -#define VALIDATE_IMG_INCOMPLETE -1002 /* User copied < VALIDATE_BUF_SIZE */ - -/* Manage image status values */ -#define MANAGE_ACTIVE_ERR -9001 /* Cannot overwrite active img */ - -/* Flash image status values */ -#define FLASH_IMG_READY 0 /* Img ready for flash on reboot */ -#define FLASH_INVALID_IMG -1003 /* Flash image shorter than expected */ -#define FLASH_IMG_NULL_DATA -1004 /* Bad data in sg list entry */ -#define FLASH_IMG_BAD_LEN -1005 /* Bad length in sg list entry */ - -/* Manage operation tokens */ -#define FLASH_REJECT_TMP_SIDE 0 /* Reject temporary fw image */ -#define FLASH_COMMIT_TMP_SIDE 1 /* Commit temporary fw image */ - -/* Update tokens */ -#define FLASH_UPDATE_CANCEL 0 /* Cancel update request */ -#define FLASH_UPDATE_INIT 1 /* Initiate update */ - -/* Validate image update result tokens */ -#define VALIDATE_TMP_UPDATE 0 /* T side will be updated */ -#define VALIDATE_FLASH_AUTH 1 /* Partition does not have authority */ -#define VALIDATE_INVALID_IMG 2 /* Candidate image is not valid */ -#define VALIDATE_CUR_UNKNOWN 3 /* Current fixpack level is unknown */ -/* - * Current T side will be committed to P side before being replace with new - * image, and the new image is downlevel from current image - */ -#define VALIDATE_TMP_COMMIT_DL 4 -/* - * Current T side will be committed to P side before being replaced with new - * image - */ -#define VALIDATE_TMP_COMMIT 5 -/* - * T side will be updated with a downlevel image - */ -#define VALIDATE_TMP_UPDATE_DL 6 -/* - * The candidate image's release date is later than the system's firmware - * service entitlement date - service warranty period has expired - */ -#define VALIDATE_OUT_OF_WRNTY 7 - -/* Validate buffer size */ -#define VALIDATE_BUF_SIZE 4096 - -/* XXX: Assume candidate image size is <= 256MB */ -#define MAX_IMAGE_SIZE 0x10000000 - -/* Flash sg list version */ -#define SG_LIST_VERSION (1UL) - -/* Image status */ -enum { - IMAGE_INVALID, - IMAGE_LOADING, - IMAGE_READY, -}; - -/* Candidate image data */ -struct image_data_t { - int status; - void *data; - uint32_t size; -}; - -/* Candidate image header */ -struct image_header_t { - uint16_t magic; - uint16_t version; - uint32_t size; -}; - -/* Scatter/gather entry */ -struct opal_sg_entry { - void *data; - long length; -}; - -/* We calculate number of entries based on PAGE_SIZE */ -#define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry)) - -/* - * This struct is very similar but not identical to that - * needed by the opal flash update. All we need to do for - * opal is rewrite num_entries into a version/length and - * translate the pointers to absolute. - */ -struct opal_sg_list { - unsigned long num_entries; - struct opal_sg_list *next; - struct opal_sg_entry entry[SG_ENTRIES_PER_NODE]; -}; - -struct validate_flash_t { - int status; /* Return status */ - void *buf; /* Candiate image buffer */ - uint32_t buf_size; /* Image size */ - uint32_t result; /* Update results token */ -}; - -struct manage_flash_t { - int status; /* Return status */ -}; - -struct update_flash_t { - int status; /* Return status */ -}; - -static struct image_header_t image_header; -static struct image_data_t image_data; -static struct validate_flash_t validate_flash_data; -static struct manage_flash_t manage_flash_data; -static struct update_flash_t update_flash_data; - -static DEFINE_MUTEX(image_data_mutex); - -/* - * Validate candidate image - */ -static inline void opal_flash_validate(void) -{ - struct validate_flash_t *args_buf = &validate_flash_data; - - args_buf->status = opal_validate_flash(__pa(args_buf->buf), - &(args_buf->buf_size), - &(args_buf->result)); -} - -/* - * Validate output format: - * validate result token - * current image version details - * new image version details - */ -static ssize_t validate_show(struct kobject *kobj, - struct kobj_attribute *attr, char *buf) -{ - struct validate_flash_t *args_buf = &validate_flash_data; - int len; - - /* Candidate image is not validated */ - if (args_buf->status < VALIDATE_TMP_UPDATE) { - len = sprintf(buf, "%d\n", args_buf->status); - goto out; - } - - /* Result token */ - len = sprintf(buf, "%d\n", args_buf->result); - - /* Current and candidate image version details */ - if ((args_buf->result != VALIDATE_TMP_UPDATE) && - (args_buf->result < VALIDATE_CUR_UNKNOWN)) - goto out; - - if (args_buf->buf_size > (VALIDATE_BUF_SIZE - len)) { - memcpy(buf + len, args_buf->buf, VALIDATE_BUF_SIZE - len); - len = VALIDATE_BUF_SIZE; - } else { - memcpy(buf + len, args_buf->buf, args_buf->buf_size); - len += args_buf->buf_size; - } -out: - /* Set status to default */ - args_buf->status = FLASH_NO_OP; - return len; -} - -/* - * Validate candidate firmware image - * - * Note: - * We are only interested in first 4K bytes of the - * candidate image. - */ -static ssize_t validate_store(struct kobject *kobj, - struct kobj_attribute *attr, - const char *buf, size_t count) -{ - struct validate_flash_t *args_buf = &validate_flash_data; - - if (buf[0] != '1') - return -EINVAL; - - mutex_lock(&image_data_mutex); - - if (image_data.status != IMAGE_READY || - image_data.size < VALIDATE_BUF_SIZE) { - args_buf->result = VALIDATE_INVALID_IMG; - args_buf->status = VALIDATE_IMG_INCOMPLETE; - goto out; - } - - /* Copy first 4k bytes of candidate image */ - memcpy(args_buf->buf, image_data.data, VALIDATE_BUF_SIZE); - - args_buf->status = VALIDATE_IMG_READY; - args_buf->buf_size = VALIDATE_BUF_SIZE; - - /* Validate candidate image */ - opal_flash_validate(); - -out: - mutex_unlock(&image_data_mutex); - return count; -} - -/* - * Manage flash routine - */ -static inline void opal_flash_manage(uint8_t op) -{ - struct manage_flash_t *const args_buf = &manage_flash_data; - - args_buf->status = opal_manage_flash(op); -} - -/* - * Show manage flash status - */ -static ssize_t manage_show(struct kobject *kobj, - struct kobj_attribute *attr, char *buf) -{ - struct manage_flash_t *const args_buf = &manage_flash_data; - int rc; - - rc = sprintf(buf, "%d\n", args_buf->status); - /* Set status to default*/ - args_buf->status = FLASH_NO_OP; - return rc; -} - -/* - * Manage operations: - * 0 - Reject - * 1 - Commit - */ -static ssize_t manage_store(struct kobject *kobj, - struct kobj_attribute *attr, - const char *buf, size_t count) -{ - uint8_t op; - switch (buf[0]) { - case '0': - op = FLASH_REJECT_TMP_SIDE; - break; - case '1': - op = FLASH_COMMIT_TMP_SIDE; - break; - default: - return -EINVAL; - } - - /* commit/reject temporary image */ - opal_flash_manage(op); - return count; -} - -/* - * Free sg list - */ -static void free_sg_list(struct opal_sg_list *list) -{ - struct opal_sg_list *sg1; - while (list) { - sg1 = list->next; - kfree(list); - list = sg1; - } - list = NULL; -} - -/* - * Build candidate image scatter gather list - * - * list format: - * ----------------------------------- - * | VER (8) | Entry length in bytes | - * ----------------------------------- - * | Pointer to next entry | - * ----------------------------------- - * | Address of memory area 1 | - * ----------------------------------- - * | Length of memory area 1 | - * ----------------------------------- - * | ......... | - * ----------------------------------- - * | ......... | - * ----------------------------------- - * | Address of memory area N | - * ----------------------------------- - * | Length of memory area N | - * ----------------------------------- - */ -static struct opal_sg_list *image_data_to_sglist(void) -{ - struct opal_sg_list *sg1, *list = NULL; - void *addr; - int size; - - addr = image_data.data; - size = image_data.size; - - sg1 = kzalloc((sizeof(struct opal_sg_list)), GFP_KERNEL); - if (!sg1) - return NULL; - - list = sg1; - sg1->num_entries = 0; - while (size > 0) { - /* Translate virtual address to physical address */ - sg1->entry[sg1->num_entries].data = - (void *)(vmalloc_to_pfn(addr) << PAGE_SHIFT); - - if (size > PAGE_SIZE) - sg1->entry[sg1->num_entries].length = PAGE_SIZE; - else - sg1->entry[sg1->num_entries].length = size; - - sg1->num_entries++; - if (sg1->num_entries >= SG_ENTRIES_PER_NODE) { - sg1->next = kzalloc((sizeof(struct opal_sg_list)), - GFP_KERNEL); - if (!sg1->next) { - pr_err("%s : Failed to allocate memory\n", - __func__); - goto nomem; - } - - sg1 = sg1->next; - sg1->num_entries = 0; - } - addr += PAGE_SIZE; - size -= PAGE_SIZE; - } - return list; -nomem: - free_sg_list(list); - return NULL; -} - -/* - * OPAL update flash - */ -static int opal_flash_update(int op) -{ - struct opal_sg_list *sg, *list, *next; - unsigned long addr; - int64_t rc = OPAL_PARAMETER; - - if (op == FLASH_UPDATE_CANCEL) { - pr_alert("FLASH: Image update cancelled\n"); - addr = '\0'; - goto flash; - } - - list = image_data_to_sglist(); - if (!list) - goto invalid_img; - - /* First entry address */ - addr = __pa(list); - - /* Translate sg list address to absolute */ - for (sg = list; sg; sg = next) { - next = sg->next; - /* Don't translate NULL pointer for last entry */ - if (sg->next) - sg->next = (struct opal_sg_list *)__pa(sg->next); - else - sg->next = NULL; - - /* Make num_entries into the version/length field */ - sg->num_entries = (SG_LIST_VERSION << 56) | - (sg->num_entries * sizeof(struct opal_sg_entry) + 16); - } - - pr_alert("FLASH: Image is %u bytes\n", image_data.size); - pr_alert("FLASH: Image update requested\n"); - pr_alert("FLASH: Image will be updated during system reboot\n"); - pr_alert("FLASH: This will take several minutes. Do not power off!\n"); - -flash: - rc = opal_update_flash(addr); - -invalid_img: - return rc; -} - -/* - * Show candidate image status - */ -static ssize_t update_show(struct kobject *kobj, - struct kobj_attribute *attr, char *buf) -{ - struct update_flash_t *const args_buf = &update_flash_data; - return sprintf(buf, "%d\n", args_buf->status); -} - -/* - * Set update image flag - * 1 - Flash new image - * 0 - Cancel flash request - */ -static ssize_t update_store(struct kobject *kobj, - struct kobj_attribute *attr, - const char *buf, size_t count) -{ - struct update_flash_t *const args_buf = &update_flash_data; - int rc = count; - - mutex_lock(&image_data_mutex); - - switch (buf[0]) { - case '0': - if (args_buf->status == FLASH_IMG_READY) - opal_flash_update(FLASH_UPDATE_CANCEL); - args_buf->status = FLASH_NO_OP; - break; - case '1': - /* Image is loaded? */ - if (image_data.status == IMAGE_READY) - args_buf->status = - opal_flash_update(FLASH_UPDATE_INIT); - else - args_buf->status = FLASH_INVALID_IMG; - break; - default: - rc = -EINVAL; - } - - mutex_unlock(&image_data_mutex); - return rc; -} - -/* - * Free image buffer - */ -static void free_image_buf(void) -{ - void *addr; - int size; - - addr = image_data.data; - size = PAGE_ALIGN(image_data.size); - while (size > 0) { - ClearPageReserved(vmalloc_to_page(addr)); - addr += PAGE_SIZE; - size -= PAGE_SIZE; - } - vfree(image_data.data); - image_data.data = NULL; - image_data.status = IMAGE_INVALID; -} - -/* - * Allocate image buffer. - */ -static int alloc_image_buf(char *buffer, size_t count) -{ - void *addr; - int size; - - if (count < sizeof(struct image_header_t)) { - pr_warn("FLASH: Invalid candidate image\n"); - return -EINVAL; - } - - memcpy(&image_header, (void *)buffer, sizeof(struct image_header_t)); - image_data.size = be32_to_cpu(image_header.size); - pr_debug("FLASH: Candiate image size = %u\n", image_data.size); - - if (image_data.size > MAX_IMAGE_SIZE) { - pr_warn("FLASH: Too large image\n"); - return -EINVAL; - } - if (image_data.size < VALIDATE_BUF_SIZE) { - pr_warn("FLASH: Image is shorter than expected\n"); - return -EINVAL; - } - - image_data.data = vzalloc(PAGE_ALIGN(image_data.size)); - if (!image_data.data) { - pr_err("%s : Failed to allocate memory\n", __func__); - return -ENOMEM; - } - - /* Pin memory */ - addr = image_data.data; - size = PAGE_ALIGN(image_data.size); - while (size > 0) { - SetPageReserved(vmalloc_to_page(addr)); - addr += PAGE_SIZE; - size -= PAGE_SIZE; - } - - image_data.status = IMAGE_LOADING; - return 0; -} - -/* - * Copy candidate image - * - * Parse candidate image header to get total image size - * and pre-allocate required memory. - */ -static ssize_t image_data_write(struct file *filp, struct kobject *kobj, - struct bin_attribute *bin_attr, - char *buffer, loff_t pos, size_t count) -{ - int rc; - - mutex_lock(&image_data_mutex); - - /* New image ? */ - if (pos == 0) { - /* Free memory, if already allocated */ - if (image_data.data) - free_image_buf(); - - /* Cancel outstanding image update request */ - if (update_flash_data.status == FLASH_IMG_READY) - opal_flash_update(FLASH_UPDATE_CANCEL); - - /* Allocate memory */ - rc = alloc_image_buf(buffer, count); - if (rc) - goto out; - } - - if (image_data.status != IMAGE_LOADING) { - rc = -ENOMEM; - goto out; - } - - if ((pos + count) > image_data.size) { - rc = -EINVAL; - goto out; - } - - memcpy(image_data.data + pos, (void *)buffer, count); - rc = count; - - /* Set image status */ - if ((pos + count) == image_data.size) { - pr_debug("FLASH: Candidate image loaded....\n"); - image_data.status = IMAGE_READY; - } - -out: - mutex_unlock(&image_data_mutex); - return rc; -} - -/* - * sysfs interface : - * OPAL uses below sysfs files for code update. - * We create these files under /sys/firmware/opal. - * - * image : Interface to load candidate firmware image - * validate_flash : Validate firmware image - * manage_flash : Commit/Reject firmware image - * update_flash : Flash new firmware image - * - */ -static struct bin_attribute image_data_attr = { - .attr = {.name = "image", .mode = 0200}, - .size = MAX_IMAGE_SIZE, /* Limit image size */ - .write = image_data_write, -}; - -static struct kobj_attribute validate_attribute = - __ATTR(validate_flash, 0600, validate_show, validate_store); - -static struct kobj_attribute manage_attribute = - __ATTR(manage_flash, 0600, manage_show, manage_store); - -static struct kobj_attribute update_attribute = - __ATTR(update_flash, 0600, update_show, update_store); - -static struct attribute *image_op_attrs[] = { - &validate_attribute.attr, - &manage_attribute.attr, - &update_attribute.attr, - NULL /* need to NULL terminate the list of attributes */ -}; - -static struct attribute_group image_op_attr_group = { - .attrs = image_op_attrs, -}; - -void __init opal_flash_init(void) -{ - int ret; - - /* Allocate validate image buffer */ - validate_flash_data.buf = kzalloc(VALIDATE_BUF_SIZE, GFP_KERNEL); - if (!validate_flash_data.buf) { - pr_err("%s : Failed to allocate memory\n", __func__); - return; - } - - /* Make sure /sys/firmware/opal directory is created */ - if (!opal_kobj) { - pr_warn("FLASH: opal kobject is not available\n"); - goto nokobj; - } - - /* Create the sysfs files */ - ret = sysfs_create_group(opal_kobj, &image_op_attr_group); - if (ret) { - pr_warn("FLASH: Failed to create sysfs files\n"); - goto nokobj; - } - - ret = sysfs_create_bin_file(opal_kobj, &image_data_attr); - if (ret) { - pr_warn("FLASH: Failed to create sysfs files\n"); - goto nosysfs_file; - } - - /* Set default status */ - validate_flash_data.status = FLASH_NO_OP; - manage_flash_data.status = FLASH_NO_OP; - update_flash_data.status = FLASH_NO_OP; - image_data.status = IMAGE_INVALID; - return; - -nosysfs_file: - sysfs_remove_group(opal_kobj, &image_op_attr_group); - -nokobj: - kfree(validate_flash_data.buf); - return; -} diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platforms/powernv/opal-lpc.c index e7e59e4..a7614bb 100644 --- a/arch/powerpc/platforms/powernv/opal-lpc.c +++ b/arch/powerpc/platforms/powernv/opal-lpc.c @@ -17,7 +17,6 @@ #include <asm/firmware.h> #include <asm/xics.h> #include <asm/opal.h> -#include <asm/prom.h> static int opal_lpc_chip_id = -1; diff --git a/arch/powerpc/platforms/powernv/opal-nvram.c b/arch/powerpc/platforms/powernv/opal-nvram.c index acd9f7e..3f83e1a 100644 --- a/arch/powerpc/platforms/powernv/opal-nvram.c +++ b/arch/powerpc/platforms/powernv/opal-nvram.c @@ -65,7 +65,7 @@ static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index) void __init opal_nvram_init(void) { struct device_node *np; - const __be32 *nbytes_p; + const u32 *nbytes_p; np = of_find_compatible_node(NULL, NULL, "ibm,opal-nvram"); if (np == NULL) @@ -76,7 +76,7 @@ void __init opal_nvram_init(void) of_node_put(np); return; } - nvram_size = be32_to_cpup(nbytes_p); + nvram_size = *nbytes_p; printk(KERN_INFO "OPAL nvram setup, %u bytes\n", nvram_size); of_node_put(np); diff --git a/arch/powerpc/platforms/powernv/opal-rtc.c b/arch/powerpc/platforms/powernv/opal-rtc.c index 7d07c7e..2aa7641 100644 --- a/arch/powerpc/platforms/powernv/opal-rtc.c +++ b/arch/powerpc/platforms/powernv/opal-rtc.c @@ -37,12 +37,10 @@ unsigned long __init opal_get_boot_time(void) struct rtc_time tm; u32 y_m_d; u64 h_m_s_ms; - __be32 __y_m_d; - __be64 __h_m_s_ms; long rc = OPAL_BUSY; while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { - rc = opal_rtc_read(&__y_m_d, &__h_m_s_ms); + rc = opal_rtc_read(&y_m_d, &h_m_s_ms); if (rc == OPAL_BUSY_EVENT) opal_poll_events(NULL); else @@ -50,8 +48,6 @@ unsigned long __init opal_get_boot_time(void) } if (rc != OPAL_SUCCESS) return 0; - y_m_d = be32_to_cpu(__y_m_d); - h_m_s_ms = be64_to_cpu(__h_m_s_ms); opal_to_tm(y_m_d, h_m_s_ms, &tm); return mktime(tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); @@ -62,11 +58,9 @@ void opal_get_rtc_time(struct rtc_time *tm) long rc = OPAL_BUSY; u32 y_m_d; u64 h_m_s_ms; - __be32 __y_m_d; - __be64 __h_m_s_ms; while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { - rc = opal_rtc_read(&__y_m_d, &__h_m_s_ms); + rc = opal_rtc_read(&y_m_d, &h_m_s_ms); if (rc == OPAL_BUSY_EVENT) opal_poll_events(NULL); else @@ -74,8 +68,6 @@ void opal_get_rtc_time(struct rtc_time *tm) } if (rc != OPAL_SUCCESS) return; - y_m_d = be32_to_cpu(__y_m_d); - h_m_s_ms = be64_to_cpu(__h_m_s_ms); opal_to_tm(y_m_d, h_m_s_ms, tm); } diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S index e780650..8f38445 100644 --- a/arch/powerpc/platforms/powernv/opal-wrappers.S +++ b/arch/powerpc/platforms/powernv/opal-wrappers.S @@ -24,7 +24,7 @@ mflr r0; \ mfcr r12; \ std r0,16(r1); \ - stw r12,8(r1); \ + std r12,8(r1); \ std r1,PACAR1(r13); \ li r0,0; \ mfmsr r12; \ @@ -34,7 +34,7 @@ mtmsrd r12,1; \ LOAD_REG_ADDR(r0,.opal_return); \ mtlr r0; \ - li r0,MSR_DR|MSR_IR|MSR_LE;\ + li r0,MSR_DR|MSR_IR; \ andc r12,r12,r0; \ li r0,token; \ mtspr SPRN_HSRR1,r12; \ @@ -45,15 +45,8 @@ hrfid _STATIC(opal_return) - /* - * Fixup endian on OPAL return... we should be able to simplify - * this by instead converting the below trampoline to a set of - * bytes (always BE) since MSR:LE will end up fixed up as a side - * effect of the rfid. - */ - FIXUP_ENDIAN ld r2,PACATOC(r13); - lwz r4,8(r1); + ld r4,8(r1); ld r5,16(r1); ld r6,PACASAVEDMSR(r13); mtspr SPRN_SRR0,r5; @@ -123,6 +116,3 @@ OPAL_CALL(opal_xscom_write, OPAL_XSCOM_WRITE); OPAL_CALL(opal_lpc_read, OPAL_LPC_READ); OPAL_CALL(opal_lpc_write, OPAL_LPC_WRITE); OPAL_CALL(opal_return_cpu, OPAL_RETURN_CPU); -OPAL_CALL(opal_validate_flash, OPAL_FLASH_VALIDATE); -OPAL_CALL(opal_manage_flash, OPAL_FLASH_MANAGE); -OPAL_CALL(opal_update_flash, OPAL_FLASH_UPDATE); diff --git a/arch/powerpc/platforms/powernv/opal-xscom.c b/arch/powerpc/platforms/powernv/opal-xscom.c deleted file mode 100644 index 4d99a8f..0000000 --- a/arch/powerpc/platforms/powernv/opal-xscom.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * PowerNV LPC bus handling. - * - * Copyright 2013 IBM Corp. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include <linux/kernel.h> -#include <linux/of.h> -#include <linux/bug.h> -#include <linux/gfp.h> -#include <linux/slab.h> - -#include <asm/machdep.h> -#include <asm/firmware.h> -#include <asm/opal.h> -#include <asm/scom.h> - -/* - * We could probably fit that inside the scom_map_t - * which is a void* after all but it's really too ugly - * so let's kmalloc it for now - */ -struct opal_scom_map { - uint32_t chip; - uint64_t addr; -}; - -static scom_map_t opal_scom_map(struct device_node *dev, u64 reg, u64 count) -{ - struct opal_scom_map *m; - const __be32 *gcid; - - if (!of_get_property(dev, "scom-controller", NULL)) { - pr_err("%s: device %s is not a SCOM controller\n", - __func__, dev->full_name); - return SCOM_MAP_INVALID; - } - gcid = of_get_property(dev, "ibm,chip-id", NULL); - if (!gcid) { - pr_err("%s: device %s has no ibm,chip-id\n", - __func__, dev->full_name); - return SCOM_MAP_INVALID; - } - m = kmalloc(sizeof(struct opal_scom_map), GFP_KERNEL); - if (!m) - return NULL; - m->chip = be32_to_cpup(gcid); - m->addr = reg; - - return (scom_map_t)m; -} - -static void opal_scom_unmap(scom_map_t map) -{ - kfree(map); -} - -static int opal_xscom_err_xlate(int64_t rc) -{ - switch(rc) { - case 0: - return 0; - /* Add more translations if necessary */ - default: - return -EIO; - } -} - -static u64 opal_scom_unmangle(u64 reg) -{ - /* - * XSCOM indirect addresses have the top bit set. Additionally - * the reset of the top 3 nibbles is always 0. - * - * Because the debugfs interface uses signed offsets and shifts - * the address left by 3, we basically cannot use the top 4 bits - * of the 64-bit address, and thus cannot use the indirect bit. - * - * To deal with that, we support the indirect bit being in bit - * 4 (IBM notation) instead of bit 0 in this API, we do the - * conversion here. To leave room for further xscom address - * expansion, we only clear out the top byte - * - */ - if (reg & (1ull << 59)) - reg = (reg & ~(0xffull << 56)) | (1ull << 63); - return reg; -} - -static int opal_scom_read(scom_map_t map, u64 reg, u64 *value) -{ - struct opal_scom_map *m = map; - int64_t rc; - - reg = opal_scom_unmangle(reg); - rc = opal_xscom_read(m->chip, m->addr + reg, (uint64_t *)__pa(value)); - return opal_xscom_err_xlate(rc); -} - -static int opal_scom_write(scom_map_t map, u64 reg, u64 value) -{ - struct opal_scom_map *m = map; - int64_t rc; - - reg = opal_scom_unmangle(reg); - rc = opal_xscom_write(m->chip, m->addr + reg, value); - return opal_xscom_err_xlate(rc); -} - -static const struct scom_controller opal_scom_controller = { - .map = opal_scom_map, - .unmap = opal_scom_unmap, - .read = opal_scom_read, - .write = opal_scom_write -}; - -static int opal_xscom_init(void) -{ - if (firmware_has_feature(FW_FEATURE_OPALv3)) - scom_init(&opal_scom_controller); - return 0; -} -arch_initcall(opal_xscom_init); diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c index 1c798cd..2911abe 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c @@ -13,20 +13,15 @@ #include <linux/types.h> #include <linux/of.h> -#include <linux/of_fdt.h> #include <linux/of_platform.h> #include <linux/interrupt.h> #include <linux/notifier.h> #include <linux/slab.h> -#include <linux/kobject.h> #include <asm/opal.h> #include <asm/firmware.h> #include "powernv.h" -/* /sys/firmware/opal */ -struct kobject *opal_kobj; - struct opal { u64 base; u64 entry; @@ -82,7 +77,6 @@ int __init early_init_dt_scan_opal(unsigned long node, static int __init opal_register_exception_handlers(void) { -#ifdef __BIG_ENDIAN__ u64 glue; if (!(powerpc_firmware_features & FW_FEATURE_OPAL)) @@ -100,7 +94,6 @@ static int __init opal_register_exception_handlers(void) 0, glue); glue += 128; opal_register_exception_handler(OPAL_SOFTPATCH_HANDLER, 0, glue); -#endif return 0; } @@ -171,28 +164,27 @@ void opal_notifier_disable(void) int opal_get_chars(uint32_t vtermno, char *buf, int count) { - s64 rc; - __be64 evt, len; + s64 len, rc; + u64 evt; if (!opal.entry) return -ENODEV; opal_poll_events(&evt); - if ((be64_to_cpu(evt) & OPAL_EVENT_CONSOLE_INPUT) == 0) + if ((evt & OPAL_EVENT_CONSOLE_INPUT) == 0) return 0; - len = cpu_to_be64(count); - rc = opal_console_read(vtermno, &len, buf); + len = count; + rc = opal_console_read(vtermno, &len, buf); if (rc == OPAL_SUCCESS) - return be64_to_cpu(len); + return len; return 0; } int opal_put_chars(uint32_t vtermno, const char *data, int total_len) { int written = 0; - __be64 olen; s64 len, rc; unsigned long flags; - __be64 evt; + u64 evt; if (!opal.entry) return -ENODEV; @@ -207,14 +199,13 @@ int opal_put_chars(uint32_t vtermno, const char *data, int total_len) */ spin_lock_irqsave(&opal_write_lock, flags); if (firmware_has_feature(FW_FEATURE_OPALv2)) { - rc = opal_console_write_buffer_space(vtermno, &olen); - len = be64_to_cpu(olen); + rc = opal_console_write_buffer_space(vtermno, &len); if (rc || len < total_len) { spin_unlock_irqrestore(&opal_write_lock, flags); /* Closed -> drop characters */ if (rc) return total_len; - opal_poll_events(NULL); + opal_poll_events(&evt); return -EAGAIN; } } @@ -225,9 +216,8 @@ int opal_put_chars(uint32_t vtermno, const char *data, int total_len) rc = OPAL_BUSY; while(total_len > 0 && (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT || rc == OPAL_SUCCESS)) { - olen = cpu_to_be64(total_len); - rc = opal_console_write(vtermno, &olen, data); - len = be64_to_cpu(olen); + len = total_len; + rc = opal_console_write(vtermno, &len, data); /* Closed or other error drop */ if (rc != OPAL_SUCCESS && rc != OPAL_BUSY && @@ -247,8 +237,7 @@ int opal_put_chars(uint32_t vtermno, const char *data, int total_len) */ do opal_poll_events(&evt); - while(rc == OPAL_SUCCESS && - (be64_to_cpu(evt) & OPAL_EVENT_CONSOLE_OUTPUT)); + while(rc == OPAL_SUCCESS && (evt & OPAL_EVENT_CONSOLE_OUTPUT)); } spin_unlock_irqrestore(&opal_write_lock, flags); return written; @@ -371,7 +360,7 @@ int opal_machine_check(struct pt_regs *regs) static irqreturn_t opal_interrupt(int irq, void *data) { - __be64 events; + uint64_t events; opal_handle_interrupt(virq_to_hw(irq), &events); @@ -380,21 +369,10 @@ static irqreturn_t opal_interrupt(int irq, void *data) return IRQ_HANDLED; } -static int opal_sysfs_init(void) -{ - opal_kobj = kobject_create_and_add("opal", firmware_kobj); - if (!opal_kobj) { - pr_warn("kobject_create_and_add opal failed\n"); - return -ENOMEM; - } - - return 0; -} - static int __init opal_init(void) { struct device_node *np, *consoles; - const __be32 *irqs; + const u32 *irqs; int rc, i, irqlen; opal_node = of_find_node_by_path("/ibm,opal"); @@ -436,14 +414,6 @@ static int __init opal_init(void) " (0x%x)\n", rc, irq, hwirq); opal_irqs[i] = irq; } - - /* Create "opal" kobject under /sys/firmware */ - rc = opal_sysfs_init(); - if (rc == 0) { - /* Setup code update interface */ - opal_flash_init(); - } - return 0; } subsys_initcall(opal_init); diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 614356c..4daa288 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -70,16 +70,6 @@ define_pe_printk_level(pe_err, KERN_ERR); define_pe_printk_level(pe_warn, KERN_WARNING); define_pe_printk_level(pe_info, KERN_INFO); -/* - * stdcix is only supposed to be used in hypervisor real mode as per - * the architecture spec - */ -static inline void __raw_rm_writeq(u64 val, volatile void __iomem *paddr) -{ - __asm__ __volatile__("stdcix %0,0,%1" - : : "r" (val), "r" (paddr) : "memory"); -} - static int pnv_ioda_alloc_pe(struct pnv_phb *phb) { unsigned long pe; @@ -163,23 +153,13 @@ static int pnv_ioda_configure_pe(struct pnv_phb *phb, struct pnv_ioda_pe *pe) rid_end = pe->rid + 1; } - /* - * Associate PE in PELT. We need add the PE into the - * corresponding PELT-V as well. Otherwise, the error - * originated from the PE might contribute to other - * PEs. - */ + /* Associate PE in PELT */ rc = opal_pci_set_pe(phb->opal_id, pe->pe_number, pe->rid, bcomp, dcomp, fcomp, OPAL_MAP_PE); if (rc) { pe_err(pe, "OPAL error %ld trying to setup PELT table\n", rc); return -ENXIO; } - - rc = opal_pci_set_peltv(phb->opal_id, pe->pe_number, - pe->pe_number, OPAL_ADD_PE_TO_DOMAIN); - if (rc) - pe_warn(pe, "OPAL error %d adding self to PELTV\n", rc); opal_pci_eeh_freeze_clear(phb->opal_id, pe->pe_number, OPAL_EEH_ACTION_CLEAR_FREEZE_ALL); @@ -474,13 +454,10 @@ static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bus *bus) } } -static void pnv_pci_ioda1_tce_invalidate(struct pnv_ioda_pe *pe, - struct iommu_table *tbl, - __be64 *startp, __be64 *endp, bool rm) +static void pnv_pci_ioda1_tce_invalidate(struct iommu_table *tbl, + u64 *startp, u64 *endp) { - __be64 __iomem *invalidate = rm ? - (__be64 __iomem *)pe->tce_inval_reg_phys : - (__be64 __iomem *)tbl->it_index; + u64 __iomem *invalidate = (u64 __iomem *)tbl->it_index; unsigned long start, end, inc; start = __pa(startp); @@ -507,10 +484,7 @@ static void pnv_pci_ioda1_tce_invalidate(struct pnv_ioda_pe *pe, mb(); /* Ensure above stores are visible */ while (start <= end) { - if (rm) - __raw_rm_writeq(cpu_to_be64(start), invalidate); - else - __raw_writeq(cpu_to_be64(start), invalidate); + __raw_writeq(start, invalidate); start += inc; } @@ -522,12 +496,10 @@ static void pnv_pci_ioda1_tce_invalidate(struct pnv_ioda_pe *pe, static void pnv_pci_ioda2_tce_invalidate(struct pnv_ioda_pe *pe, struct iommu_table *tbl, - __be64 *startp, __be64 *endp, bool rm) + u64 *startp, u64 *endp) { unsigned long start, end, inc; - __be64 __iomem *invalidate = rm ? - (__be64 __iomem *)pe->tce_inval_reg_phys : - (__be64 __iomem *)tbl->it_index; + u64 __iomem *invalidate = (u64 __iomem *)tbl->it_index; /* We'll invalidate DMA address in PE scope */ start = 0x2ul << 60; @@ -543,25 +515,22 @@ static void pnv_pci_ioda2_tce_invalidate(struct pnv_ioda_pe *pe, mb(); while (start <= end) { - if (rm) - __raw_rm_writeq(cpu_to_be64(start), invalidate); - else - __raw_writeq(cpu_to_be64(start), invalidate); + __raw_writeq(start, invalidate); start += inc; } } void pnv_pci_ioda_tce_invalidate(struct iommu_table *tbl, - __be64 *startp, __be64 *endp, bool rm) + u64 *startp, u64 *endp) { struct pnv_ioda_pe *pe = container_of(tbl, struct pnv_ioda_pe, tce32_table); struct pnv_phb *phb = pe->phb; if (phb->type == PNV_PHB_IODA1) - pnv_pci_ioda1_tce_invalidate(pe, tbl, startp, endp, rm); + pnv_pci_ioda1_tce_invalidate(tbl, startp, endp); else - pnv_pci_ioda2_tce_invalidate(pe, tbl, startp, endp, rm); + pnv_pci_ioda2_tce_invalidate(pe, tbl, startp, endp); } static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb, @@ -634,9 +603,7 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb, * bus number, print that out instead. */ tbl->it_busno = 0; - pe->tce_inval_reg_phys = be64_to_cpup(swinvp); - tbl->it_index = (unsigned long)ioremap(pe->tce_inval_reg_phys, - 8); + tbl->it_index = (unsigned long)ioremap(be64_to_cpup(swinvp), 8); tbl->it_type = TCE_PCI_SWINV_CREATE | TCE_PCI_SWINV_FREE | TCE_PCI_SWINV_PAIR; } @@ -714,9 +681,7 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb, * bus number, print that out instead. */ tbl->it_busno = 0; - pe->tce_inval_reg_phys = be64_to_cpup(swinvp); - tbl->it_index = (unsigned long)ioremap(pe->tce_inval_reg_phys, - 8); + tbl->it_index = (unsigned long)ioremap(be64_to_cpup(swinvp), 8); tbl->it_type = TCE_PCI_SWINV_CREATE | TCE_PCI_SWINV_FREE; } iommu_init_table(tbl, phb->hose->node); @@ -821,7 +786,8 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev, struct irq_data *idata; struct irq_chip *ichip; unsigned int xive_num = hwirq - phb->msi_base; - __be32 data; + uint64_t addr64; + uint32_t addr32, data; int rc; /* No PE assigned ? bail out ... no MSI for you ! */ @@ -845,8 +811,6 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev, } if (is_64) { - __be64 addr64; - rc = opal_get_msi_64(phb->opal_id, pe->mve_number, xive_num, 1, &addr64, &data); if (rc) { @@ -854,11 +818,9 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev, pci_name(dev), rc); return -EIO; } - msg->address_hi = be64_to_cpu(addr64) >> 32; - msg->address_lo = be64_to_cpu(addr64) & 0xfffffffful; + msg->address_hi = addr64 >> 32; + msg->address_lo = addr64 & 0xfffffffful; } else { - __be32 addr32; - rc = opal_get_msi_32(phb->opal_id, pe->mve_number, xive_num, 1, &addr32, &data); if (rc) { @@ -867,9 +829,9 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev, return -EIO; } msg->address_hi = 0; - msg->address_lo = be32_to_cpu(addr32); + msg->address_lo = addr32; } - msg->data = be32_to_cpu(data); + msg->data = data; /* * Change the IRQ chip for the MSI interrupts on PHB3. @@ -1144,8 +1106,8 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np, struct pci_controller *hose; struct pnv_phb *phb; unsigned long size, m32map_off, iomap_off, pemap_off; - const __be64 *prop64; - const __be32 *prop32; + const u64 *prop64; + const u32 *prop32; int len; u64 phb_id; void *aux; @@ -1180,8 +1142,8 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np, spin_lock_init(&phb->lock); prop32 = of_get_property(np, "bus-range", &len); if (prop32 && len == 8) { - hose->first_busno = be32_to_cpu(prop32[0]); - hose->last_busno = be32_to_cpu(prop32[1]); + hose->first_busno = prop32[0]; + hose->last_busno = prop32[1]; } else { pr_warn(" Broken <bus-range> on %s\n", np->full_name); hose->first_busno = 0; @@ -1209,13 +1171,12 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np, pr_err(" Failed to map registers !\n"); /* Initialize more IODA stuff */ - phb->ioda.total_pe = 1; prop32 = of_get_property(np, "ibm,opal-num-pes", NULL); - if (prop32) - phb->ioda.total_pe = be32_to_cpup(prop32); - prop32 = of_get_property(np, "ibm,opal-reserved-pe", NULL); - if (prop32) - phb->ioda.reserved_pe = be32_to_cpup(prop32); + if (!prop32) + phb->ioda.total_pe = 1; + else + phb->ioda.total_pe = *prop32; + phb->ioda.m32_size = resource_size(&hose->mem_resources[0]); /* FW Has already off top 64k of M32 space (MSI space) */ phb->ioda.m32_size += 0x10000; @@ -1244,7 +1205,7 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np, if (phb->type == PNV_PHB_IODA1) phb->ioda.io_segmap = aux + iomap_off; phb->ioda.pe_array = aux + pemap_off; - set_bit(phb->ioda.reserved_pe, phb->ioda.pe_alloc); + set_bit(0, phb->ioda.pe_alloc); INIT_LIST_HEAD(&phb->ioda.pe_dma_list); INIT_LIST_HEAD(&phb->ioda.pe_list); @@ -1269,10 +1230,8 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np, segment_size); #endif - pr_info(" %d (%d) PE's M32: 0x%x [segment=0x%x]" - " IO: 0x%x [segment=0x%x]\n", + pr_info(" %d PE's M32: 0x%x [segment=0x%x] IO: 0x%x [segment=0x%x]\n", phb->ioda.total_pe, - phb->ioda.reserved_pe, phb->ioda.m32_size, phb->ioda.m32_segsize, phb->ioda.io_size, phb->ioda.io_segsize); @@ -1309,6 +1268,13 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np, rc = opal_pci_reset(phb_id, OPAL_PCI_IODA_TABLE_RESET, OPAL_ASSERT_RESET); if (rc) pr_warning(" OPAL Error %ld performing IODA table reset !\n", rc); + + /* + * On IODA1 map everything to PE#0, on IODA2 we assume the IODA reset + * has cleared the RTT which has the same effect + */ + if (ioda_type == PNV_PHB_IODA1) + opal_pci_set_pe(phb_id, 0, 0, 7, 1, 1 , OPAL_MAP_PE); } void __init pnv_pci_init_ioda2_phb(struct device_node *np) @@ -1319,7 +1285,7 @@ void __init pnv_pci_init_ioda2_phb(struct device_node *np) void __init pnv_pci_init_ioda_hub(struct device_node *np) { struct device_node *phbn; - const __be64 *prop64; + const u64 *prop64; u64 hub_id; pr_info("Probing IODA IO-Hub %s\n", np->full_name); diff --git a/arch/powerpc/platforms/powernv/pci-p5ioc2.c b/arch/powerpc/platforms/powernv/pci-p5ioc2.c index e3807d6..ede341b 100644 --- a/arch/powerpc/platforms/powernv/pci-p5ioc2.c +++ b/arch/powerpc/platforms/powernv/pci-p5ioc2.c @@ -99,7 +99,7 @@ static void __init pnv_pci_init_p5ioc2_phb(struct device_node *np, u64 hub_id, void *tce_mem, u64 tce_size) { struct pnv_phb *phb; - const __be64 *prop64; + const u64 *prop64; u64 phb_id; int64_t rc; static int primary = 1; @@ -178,7 +178,7 @@ static void __init pnv_pci_init_p5ioc2_phb(struct device_node *np, u64 hub_id, void __init pnv_pci_init_p5ioc2_hub(struct device_node *np) { struct device_node *phbn; - const __be64 *prop64; + const u64 *prop64; u64 hub_id; void *tce_mem; uint64_t tce_per_phb; diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c index 6f3d49c..c005011 100644 --- a/arch/powerpc/platforms/powernv/pci.c +++ b/arch/powerpc/platforms/powernv/pci.c @@ -236,21 +236,17 @@ static void pnv_pci_config_check_eeh(struct pnv_phb *phb, { s64 rc; u8 fstate; - __be16 pcierr; + u16 pcierr; u32 pe_no; /* * Get the PE#. During the PCI probe stage, we might not * setup that yet. So all ER errors should be mapped to - * reserved PE. + * PE#0 */ pe_no = PCI_DN(dn)->pe_number; - if (pe_no == IODA_INVALID_PE) { - if (phb->type == PNV_PHB_P5IOC2) - pe_no = 0; - else - pe_no = phb->ioda.reserved_pe; - } + if (pe_no == IODA_INVALID_PE) + pe_no = 0; /* Read freeze status */ rc = opal_pci_eeh_freeze_status(phb->opal_id, pe_no, &fstate, &pcierr, @@ -287,16 +283,16 @@ int pnv_pci_cfg_read(struct device_node *dn, break; } case 2: { - __be16 v16; + u16 v16; rc = opal_pci_config_read_half_word(phb->opal_id, bdfn, where, &v16); - *val = (rc == OPAL_SUCCESS) ? be16_to_cpu(v16) : 0xffff; + *val = (rc == OPAL_SUCCESS) ? v16 : 0xffff; break; } case 4: { - __be32 v32; + u32 v32; rc = opal_pci_config_read_word(phb->opal_id, bdfn, where, &v32); - *val = (rc == OPAL_SUCCESS) ? be32_to_cpu(v32) : 0xffffffff; + *val = (rc == OPAL_SUCCESS) ? v32 : 0xffffffff; break; } default: @@ -405,10 +401,10 @@ struct pci_ops pnv_pci_ops = { static int pnv_tce_build(struct iommu_table *tbl, long index, long npages, unsigned long uaddr, enum dma_data_direction direction, - struct dma_attrs *attrs, bool rm) + struct dma_attrs *attrs) { u64 proto_tce; - __be64 *tcep, *tces; + u64 *tcep, *tces; u64 rpn; proto_tce = TCE_PCI_READ; // Read allowed @@ -416,48 +412,33 @@ static int pnv_tce_build(struct iommu_table *tbl, long index, long npages, if (direction != DMA_TO_DEVICE) proto_tce |= TCE_PCI_WRITE; - tces = tcep = ((__be64 *)tbl->it_base) + index - tbl->it_offset; + tces = tcep = ((u64 *)tbl->it_base) + index - tbl->it_offset; rpn = __pa(uaddr) >> TCE_SHIFT; while (npages--) - *(tcep++) = cpu_to_be64(proto_tce | (rpn++ << TCE_RPN_SHIFT)); + *(tcep++) = proto_tce | (rpn++ << TCE_RPN_SHIFT); /* Some implementations won't cache invalid TCEs and thus may not * need that flush. We'll probably turn it_type into a bit mask * of flags if that becomes the case */ if (tbl->it_type & TCE_PCI_SWINV_CREATE) - pnv_pci_ioda_tce_invalidate(tbl, tces, tcep - 1, rm); + pnv_pci_ioda_tce_invalidate(tbl, tces, tcep - 1); return 0; } -static int pnv_tce_build_vm(struct iommu_table *tbl, long index, long npages, - unsigned long uaddr, - enum dma_data_direction direction, - struct dma_attrs *attrs) +static void pnv_tce_free(struct iommu_table *tbl, long index, long npages) { - return pnv_tce_build(tbl, index, npages, uaddr, direction, attrs, - false); -} + u64 *tcep, *tces; -static void pnv_tce_free(struct iommu_table *tbl, long index, long npages, - bool rm) -{ - __be64 *tcep, *tces; - - tces = tcep = ((__be64 *)tbl->it_base) + index - tbl->it_offset; + tces = tcep = ((u64 *)tbl->it_base) + index - tbl->it_offset; while (npages--) - *(tcep++) = cpu_to_be64(0); + *(tcep++) = 0; if (tbl->it_type & TCE_PCI_SWINV_FREE) - pnv_pci_ioda_tce_invalidate(tbl, tces, tcep - 1, rm); -} - -static void pnv_tce_free_vm(struct iommu_table *tbl, long index, long npages) -{ - pnv_tce_free(tbl, index, npages, false); + pnv_pci_ioda_tce_invalidate(tbl, tces, tcep - 1); } static unsigned long pnv_tce_get(struct iommu_table *tbl, long index) @@ -465,19 +446,6 @@ static unsigned long pnv_tce_get(struct iommu_table *tbl, long index) return ((u64 *)tbl->it_base)[index - tbl->it_offset]; } -static int pnv_tce_build_rm(struct iommu_table *tbl, long index, long npages, - unsigned long uaddr, - enum dma_data_direction direction, - struct dma_attrs *attrs) -{ - return pnv_tce_build(tbl, index, npages, uaddr, direction, attrs, true); -} - -static void pnv_tce_free_rm(struct iommu_table *tbl, long index, long npages) -{ - pnv_tce_free(tbl, index, npages, true); -} - void pnv_pci_setup_iommu_table(struct iommu_table *tbl, void *tce_mem, u64 tce_size, u64 dma_offset) @@ -516,8 +484,8 @@ static struct iommu_table *pnv_pci_setup_bml_iommu(struct pci_controller *hose) swinvp = of_get_property(hose->dn, "linux,tce-sw-invalidate-info", NULL); if (swinvp) { - tbl->it_busno = be64_to_cpu(swinvp[1]); - tbl->it_index = (unsigned long)ioremap(be64_to_cpup(swinvp), 8); + tbl->it_busno = swinvp[1]; + tbl->it_index = (unsigned long)ioremap(swinvp[0], 8); tbl->it_type = TCE_PCI_SWINV_CREATE | TCE_PCI_SWINV_FREE; } return tbl; @@ -642,10 +610,8 @@ void __init pnv_pci_init(void) /* Configure IOMMU DMA hooks */ ppc_md.pci_dma_dev_setup = pnv_pci_dma_dev_setup; - ppc_md.tce_build = pnv_tce_build_vm; - ppc_md.tce_free = pnv_tce_free_vm; - ppc_md.tce_build_rm = pnv_tce_build_rm; - ppc_md.tce_free_rm = pnv_tce_free_rm; + ppc_md.tce_build = pnv_tce_build; + ppc_md.tce_free = pnv_tce_free; ppc_md.tce_get = pnv_tce_get; ppc_md.pci_probe_mode = pnv_pci_probe_mode; set_pci_dma_ops(&dma_iommu_ops); diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h index 911c24e..d633c64 100644 --- a/arch/powerpc/platforms/powernv/pci.h +++ b/arch/powerpc/platforms/powernv/pci.h @@ -17,7 +17,7 @@ enum pnv_phb_model { PNV_PHB_MODEL_PHB3, }; -#define PNV_PCI_DIAG_BUF_SIZE 8192 +#define PNV_PCI_DIAG_BUF_SIZE 4096 #define PNV_IODA_PE_DEV (1 << 0) /* PE has single PCI device */ #define PNV_IODA_PE_BUS (1 << 1) /* PE has primary PCI bus */ #define PNV_IODA_PE_BUS_ALL (1 << 2) /* PE has subordinate buses */ @@ -52,7 +52,6 @@ struct pnv_ioda_pe { int tce32_seg; int tce32_segcount; struct iommu_table tce32_table; - phys_addr_t tce_inval_reg_phys; /* XXX TODO: Add support for additional 64-bit iommus */ @@ -125,7 +124,6 @@ struct pnv_phb { struct { /* Global bridge info */ unsigned int total_pe; - unsigned int reserved_pe; unsigned int m32_size; unsigned int m32_segsize; unsigned int m32_pci_base; @@ -195,6 +193,6 @@ extern void pnv_pci_init_p5ioc2_hub(struct device_node *np); extern void pnv_pci_init_ioda_hub(struct device_node *np); extern void pnv_pci_init_ioda2_phb(struct device_node *np); extern void pnv_pci_ioda_tce_invalidate(struct iommu_table *tbl, - __be64 *startp, __be64 *endp, bool rm); + u64 *startp, u64 *endp); #endif /* __POWERNV_PCI_H */ diff --git a/arch/powerpc/platforms/powernv/rng.c b/arch/powerpc/platforms/powernv/rng.c deleted file mode 100644 index 1cb160d..0000000 --- a/arch/powerpc/platforms/powernv/rng.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2013, Michael Ellerman, IBM Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#define pr_fmt(fmt) "powernv-rng: " fmt - -#include <linux/kernel.h> -#include <linux/of.h> -#include <linux/of_address.h> -#include <linux/of_platform.h> -#include <linux/slab.h> -#include <linux/smp.h> -#include <asm/archrandom.h> -#include <asm/io.h> -#include <asm/prom.h> -#include <asm/machdep.h> -#include <asm/smp.h> - - -struct powernv_rng { - void __iomem *regs; - unsigned long mask; -}; - -static DEFINE_PER_CPU(struct powernv_rng *, powernv_rng); - - -static unsigned long rng_whiten(struct powernv_rng *rng, unsigned long val) -{ - unsigned long parity; - - /* Calculate the parity of the value */ - asm ("popcntd %0,%1" : "=r" (parity) : "r" (val)); - - /* xor our value with the previous mask */ - val ^= rng->mask; - - /* update the mask based on the parity of this value */ - rng->mask = (rng->mask << 1) | (parity & 1); - - return val; -} - -int powernv_get_random_long(unsigned long *v) -{ - struct powernv_rng *rng; - - rng = get_cpu_var(powernv_rng); - - *v = rng_whiten(rng, in_be64(rng->regs)); - - put_cpu_var(rng); - - return 1; -} -EXPORT_SYMBOL_GPL(powernv_get_random_long); - -static __init void rng_init_per_cpu(struct powernv_rng *rng, - struct device_node *dn) -{ - int chip_id, cpu; - - chip_id = of_get_ibm_chip_id(dn); - if (chip_id == -1) - pr_warn("No ibm,chip-id found for %s.\n", dn->full_name); - - for_each_possible_cpu(cpu) { - if (per_cpu(powernv_rng, cpu) == NULL || - cpu_to_chip_id(cpu) == chip_id) { - per_cpu(powernv_rng, cpu) = rng; - } - } -} - -static __init int rng_create(struct device_node *dn) -{ - struct powernv_rng *rng; - unsigned long val; - - rng = kzalloc(sizeof(*rng), GFP_KERNEL); - if (!rng) - return -ENOMEM; - - rng->regs = of_iomap(dn, 0); - if (!rng->regs) { - kfree(rng); - return -ENXIO; - } - - val = in_be64(rng->regs); - rng->mask = val; - - rng_init_per_cpu(rng, dn); - - pr_info_once("Registering arch random hook.\n"); - - ppc_md.get_random_long = powernv_get_random_long; - - return 0; -} - -static __init int rng_init(void) -{ - struct device_node *dn; - int rc; - - for_each_compatible_node(dn, NULL, "ibm,power-rng") { - rc = rng_create(dn); - if (rc) { - pr_err("Failed creating rng for %s (%d).\n", - dn->full_name, rc); - continue; - } - - /* Create devices for hwrng driver */ - of_platform_device_create(dn, NULL, NULL); - } - - return 0; -} -subsys_initcall(rng_init); diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c index 19884b2..e239dcf 100644 --- a/arch/powerpc/platforms/powernv/setup.c +++ b/arch/powerpc/platforms/powernv/setup.c @@ -23,7 +23,6 @@ #include <linux/irq.h> #include <linux/seq_file.h> #include <linux/of.h> -#include <linux/of_fdt.h> #include <linux/interrupt.h> #include <linux/bug.h> diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile index fbccac9..6c61ec5 100644 --- a/arch/powerpc/platforms/pseries/Makefile +++ b/arch/powerpc/platforms/pseries/Makefile @@ -3,7 +3,7 @@ ccflags-$(CONFIG_PPC_PSERIES_DEBUG) += -DDEBUG obj-y := lpar.o hvCall.o nvram.o reconfig.o \ setup.o iommu.o event_sources.o ras.o \ - firmware.o power.o dlpar.o mobility.o rng.o + firmware.o power.o dlpar.o mobility.o obj-$(CONFIG_SMP) += smp.o obj-$(CONFIG_SCANLOG) += scanlog.o obj-$(CONFIG_EEH) += eeh_pseries.o diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c index a8fe5aa..7cfdaae 100644 --- a/arch/powerpc/platforms/pseries/dlpar.c +++ b/arch/powerpc/platforms/pseries/dlpar.c @@ -404,38 +404,46 @@ static ssize_t dlpar_cpu_probe(const char *buf, size_t count) unsigned long drc_index; int rc; + cpu_hotplug_driver_lock(); rc = strict_strtoul(buf, 0, &drc_index); - if (rc) - return -EINVAL; + if (rc) { + rc = -EINVAL; + goto out; + } parent = of_find_node_by_path("/cpus"); - if (!parent) - return -ENODEV; + if (!parent) { + rc = -ENODEV; + goto out; + } dn = dlpar_configure_connector(drc_index, parent); - if (!dn) - return -EINVAL; + if (!dn) { + rc = -EINVAL; + goto out; + } of_node_put(parent); rc = dlpar_acquire_drc(drc_index); if (rc) { dlpar_free_cc_nodes(dn); - return -EINVAL; + rc = -EINVAL; + goto out; } rc = dlpar_attach_node(dn); if (rc) { dlpar_release_drc(drc_index); dlpar_free_cc_nodes(dn); - return rc; + goto out; } rc = dlpar_online_cpu(dn); - if (rc) - return rc; +out: + cpu_hotplug_driver_unlock(); - return count; + return rc ? rc : count; } static int dlpar_offline_cpu(struct device_node *dn) @@ -508,27 +516,30 @@ static ssize_t dlpar_cpu_release(const char *buf, size_t count) return -EINVAL; } + cpu_hotplug_driver_lock(); rc = dlpar_offline_cpu(dn); if (rc) { of_node_put(dn); - return -EINVAL; + rc = -EINVAL; + goto out; } rc = dlpar_release_drc(*drc_index); if (rc) { of_node_put(dn); - return rc; + goto out; } rc = dlpar_detach_node(dn); if (rc) { dlpar_acquire_drc(*drc_index); - return rc; + goto out; } of_node_put(dn); - - return count; +out: + cpu_hotplug_driver_unlock(); + return rc ? rc : count; } static int __init pseries_dlpar_init(void) diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c index ccb633e..7fbc25b 100644 --- a/arch/powerpc/platforms/pseries/eeh_pseries.c +++ b/arch/powerpc/platforms/pseries/eeh_pseries.c @@ -189,9 +189,8 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag) struct eeh_dev *edev; struct eeh_pe pe; struct pci_dn *pdn = PCI_DN(dn); - const __be32 *classp, *vendorp, *devicep; - u32 class_code; - const __be32 *regs; + const u32 *class_code, *vendor_id, *device_id; + const u32 *regs; u32 pcie_flags; int enable = 0; int ret; @@ -202,24 +201,22 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag) return NULL; /* Retrieve class/vendor/device IDs */ - classp = of_get_property(dn, "class-code", NULL); - vendorp = of_get_property(dn, "vendor-id", NULL); - devicep = of_get_property(dn, "device-id", NULL); + class_code = of_get_property(dn, "class-code", NULL); + vendor_id = of_get_property(dn, "vendor-id", NULL); + device_id = of_get_property(dn, "device-id", NULL); /* Skip for bad OF node or PCI-ISA bridge */ - if (!classp || !vendorp || !devicep) + if (!class_code || !vendor_id || !device_id) return NULL; if (dn->type && !strcmp(dn->type, "isa")) return NULL; - class_code = of_read_number(classp, 1); - /* * Update class code and mode of eeh device. We need * correctly reflects that current device is root port * or PCIe switch downstream port. */ - edev->class_code = class_code; + edev->class_code = *class_code; edev->pcie_cap = pseries_eeh_find_cap(dn, PCI_CAP_ID_EXP); edev->mode &= 0xFFFFFF00; if ((edev->class_code >> 8) == PCI_CLASS_BRIDGE_PCI) { @@ -246,12 +243,12 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag) /* Initialize the fake PE */ memset(&pe, 0, sizeof(struct eeh_pe)); pe.phb = edev->phb; - pe.config_addr = of_read_number(regs, 1); + pe.config_addr = regs[0]; /* Enable EEH on the device */ ret = eeh_ops->set_option(&pe, EEH_OPT_ENABLE); if (!ret) { - edev->config_addr = of_read_number(regs, 1); + edev->config_addr = regs[0]; /* Retrieve PE address */ edev->pe_config_addr = eeh_ops->get_pe_addr(&pe); pe.addr = edev->pe_config_addr; diff --git a/arch/powerpc/platforms/pseries/event_sources.c b/arch/powerpc/platforms/pseries/event_sources.c index 18380e8..2605c31 100644 --- a/arch/powerpc/platforms/pseries/event_sources.c +++ b/arch/powerpc/platforms/pseries/event_sources.c @@ -25,7 +25,7 @@ void request_event_sources_irqs(struct device_node *np, const char *name) { int i, index, count = 0; - struct of_phandle_args oirq; + struct of_irq oirq; const u32 *opicprop; unsigned int opicplen; unsigned int virqs[16]; @@ -55,11 +55,13 @@ void request_event_sources_irqs(struct device_node *np, /* Else use normal interrupt tree parsing */ else { /* First try to do a proper OF tree parsing */ - for (index = 0; of_irq_parse_one(np, index, &oirq) == 0; + for (index = 0; of_irq_map_one(np, index, &oirq) == 0; index++) { if (count > 15) break; - virqs[count] = irq_create_of_mapping(&oirq); + virqs[count] = irq_create_of_mapping(oirq.controller, + oirq.specifier, + oirq.size); if (virqs[count] == NO_IRQ) { pr_err("event-sources: Unable to allocate " "interrupt number for %s\n", diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c index 9590dbb..9a432de 100644 --- a/arch/powerpc/platforms/pseries/hotplug-memory.c +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c @@ -10,14 +10,12 @@ */ #include <linux/of.h> -#include <linux/of_address.h> #include <linux/memblock.h> #include <linux/vmalloc.h> #include <linux/memory.h> #include <asm/firmware.h> #include <asm/machdep.h> -#include <asm/prom.h> #include <asm/sparsemem.h> static unsigned long get_memblock_size(void) diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index a80af6c..d9d0d7a 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c @@ -52,7 +52,7 @@ static void tce_invalidate_pSeries_sw(struct iommu_table *tbl, - __be64 *startp, __be64 *endp) + u64 *startp, u64 *endp) { u64 __iomem *invalidate = (u64 __iomem *)tbl->it_index; unsigned long start, end, inc; @@ -86,7 +86,7 @@ static int tce_build_pSeries(struct iommu_table *tbl, long index, struct dma_attrs *attrs) { u64 proto_tce; - __be64 *tcep, *tces; + u64 *tcep, *tces; u64 rpn; proto_tce = TCE_PCI_READ; // Read allowed @@ -94,12 +94,12 @@ static int tce_build_pSeries(struct iommu_table *tbl, long index, if (direction != DMA_TO_DEVICE) proto_tce |= TCE_PCI_WRITE; - tces = tcep = ((__be64 *)tbl->it_base) + index; + tces = tcep = ((u64 *)tbl->it_base) + index; while (npages--) { /* can't move this out since we might cross MEMBLOCK boundary */ rpn = __pa(uaddr) >> TCE_SHIFT; - *tcep = cpu_to_be64(proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT); + *tcep = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT; uaddr += TCE_PAGE_SIZE; tcep++; @@ -113,9 +113,9 @@ static int tce_build_pSeries(struct iommu_table *tbl, long index, static void tce_free_pSeries(struct iommu_table *tbl, long index, long npages) { - __be64 *tcep, *tces; + u64 *tcep, *tces; - tces = tcep = ((__be64 *)tbl->it_base) + index; + tces = tcep = ((u64 *)tbl->it_base) + index; while (npages--) *(tcep++) = 0; @@ -126,11 +126,11 @@ static void tce_free_pSeries(struct iommu_table *tbl, long index, long npages) static unsigned long tce_get_pseries(struct iommu_table *tbl, long index) { - __be64 *tcep; + u64 *tcep; - tcep = ((__be64 *)tbl->it_base) + index; + tcep = ((u64 *)tbl->it_base) + index; - return be64_to_cpu(*tcep); + return *tcep; } static void tce_free_pSeriesLP(struct iommu_table*, long, long); @@ -177,7 +177,7 @@ static int tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum, return ret; } -static DEFINE_PER_CPU(__be64 *, tce_page); +static DEFINE_PER_CPU(u64 *, tce_page); static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages, unsigned long uaddr, @@ -186,7 +186,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, { u64 rc = 0; u64 proto_tce; - __be64 *tcep; + u64 *tcep; u64 rpn; long l, limit; long tcenum_start = tcenum, npages_start = npages; @@ -206,7 +206,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, * from iommu_alloc{,_sg}() */ if (!tcep) { - tcep = (__be64 *)__get_free_page(GFP_ATOMIC); + tcep = (u64 *)__get_free_page(GFP_ATOMIC); /* If allocation fails, fall back to the loop implementation */ if (!tcep) { local_irq_restore(flags); @@ -230,7 +230,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, limit = min_t(long, npages, 4096/TCE_ENTRY_SIZE); for (l = 0; l < limit; l++) { - tcep[l] = cpu_to_be64(proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT); + tcep[l] = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT; rpn++; } @@ -329,16 +329,16 @@ struct direct_window { /* Dynamic DMA Window support */ struct ddw_query_response { - __be32 windows_available; - __be32 largest_available_block; - __be32 page_size; - __be32 migration_capable; + u32 windows_available; + u32 largest_available_block; + u32 page_size; + u32 migration_capable; }; struct ddw_create_response { - __be32 liobn; - __be32 addr_hi; - __be32 addr_lo; + u32 liobn; + u32 addr_hi; + u32 addr_lo; }; static LIST_HEAD(direct_window_list); @@ -392,8 +392,7 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn, unsigned long num_pfn, const void *arg) { const struct dynamic_dma_window_prop *maprange = arg; - u64 tce_size, num_tce, dma_offset, next, proto_tce, liobn; - __be64 *tcep; + u64 *tcep, tce_size, num_tce, dma_offset, next, proto_tce, liobn; u32 tce_shift; u64 rc = 0; long l, limit; @@ -402,7 +401,7 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn, tcep = __get_cpu_var(tce_page); if (!tcep) { - tcep = (__be64 *)__get_free_page(GFP_ATOMIC); + tcep = (u64 *)__get_free_page(GFP_ATOMIC); if (!tcep) { local_irq_enable(); return -ENOMEM; @@ -436,7 +435,7 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn, dma_offset = next + be64_to_cpu(maprange->dma_base); for (l = 0; l < limit; l++) { - tcep[l] = cpu_to_be64(proto_tce | next); + tcep[l] = proto_tce | next; next += tce_size; } @@ -783,7 +782,7 @@ static u64 find_existing_ddw(struct device_node *pdn) list_for_each_entry(window, &direct_window_list, list) { if (window->device == pdn) { direct64 = window->prop; - dma_addr = be64_to_cpu(direct64->dma_base); + dma_addr = direct64->dma_base; break; } } @@ -1048,11 +1047,11 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn) dev_dbg(&dev->dev, "no free dynamic windows"); goto out_restore_window; } - if (be32_to_cpu(query.page_size) & 4) { + if (query.page_size & 4) { page_shift = 24; /* 16MB */ - } else if (be32_to_cpu(query.page_size) & 2) { + } else if (query.page_size & 2) { page_shift = 16; /* 64kB */ - } else if (be32_to_cpu(query.page_size) & 1) { + } else if (query.page_size & 1) { page_shift = 12; /* 4kB */ } else { dev_dbg(&dev->dev, "no supported direct page size in mask %x", @@ -1062,7 +1061,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn) /* verify the window * number of ptes will map the partition */ /* check largest block * page size > max memory hotplug addr */ max_addr = memory_hotplug_max(); - if (be32_to_cpu(query.largest_available_block) < (max_addr >> page_shift)) { + if (query.largest_available_block < (max_addr >> page_shift)) { dev_dbg(&dev->dev, "can't map partiton max 0x%llx with %u " "%llu-sized pages\n", max_addr, query.largest_available_block, 1ULL << page_shift); @@ -1088,7 +1087,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn) if (ret != 0) goto out_free_prop; - ddwprop->liobn = create.liobn; + ddwprop->liobn = cpu_to_be32(create.liobn); ddwprop->dma_base = cpu_to_be64(of_read_number(&create.addr_hi, 2)); ddwprop->tce_shift = cpu_to_be32(page_shift); ddwprop->window_shift = cpu_to_be32(len); diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 4fca3de..356bc75 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c @@ -245,23 +245,6 @@ static void pSeries_lpar_hptab_clear(void) &(ptes[j].pteh), &(ptes[j].ptel)); } } - -#ifdef __LITTLE_ENDIAN__ - /* Reset exceptions to big endian */ - if (firmware_has_feature(FW_FEATURE_SET_MODE)) { - long rc; - - rc = pseries_big_endian_exceptions(); - /* - * At this point it is unlikely panic() will get anything - * out to the user, but at least this will stop us from - * continuing on further and creating an even more - * difficult to debug situation. - */ - if (rc) - panic("Could not enable big endian exceptions"); - } -#endif } /* diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c index 7bfaf58..d276cd3 100644 --- a/arch/powerpc/platforms/pseries/nvram.c +++ b/arch/powerpc/platforms/pseries/nvram.c @@ -31,7 +31,7 @@ #define NVRW_CNT 0x20 /* - * Set oops header version to distinguish between old and new format header. + * Set oops header version to distingush between old and new format header. * lnx,oops-log partition max size is 4000, header version > 4000 will * help in identifying new header. */ @@ -429,6 +429,9 @@ static int __init pseries_nvram_init_os_partition(struct nvram_os_partition loff_t p; int size; + /* Scan nvram for partitions */ + nvram_scan_partitions(); + /* Look for ours */ p = nvram_find_partition(part->name, NVRAM_SIG_OS, &size); @@ -792,9 +795,6 @@ static int __init pseries_nvram_init_log_partitions(void) { int rc; - /* Scan nvram for partitions */ - nvram_scan_partitions(); - rc = pseries_nvram_init_os_partition(&rtas_log_partition); nvram_init_oops_partition(rc == 0); return 0; @@ -804,7 +804,7 @@ machine_arch_initcall(pseries, pseries_nvram_init_log_partitions); int __init pSeries_nvram_init(void) { struct device_node *nvram; - const __be32 *nbytes_p; + const unsigned int *nbytes_p; unsigned int proplen; nvram = of_find_node_by_type(NULL, "nvram"); @@ -817,7 +817,7 @@ int __init pSeries_nvram_init(void) return -EIO; } - nvram_size = be32_to_cpup(nbytes_p); + nvram_size = *nbytes_p; nvram_fetch = rtas_token("nvram-fetch"); nvram_store = rtas_token("nvram-store"); diff --git a/arch/powerpc/platforms/pseries/rng.c b/arch/powerpc/platforms/pseries/rng.c deleted file mode 100644 index 72a1027..0000000 --- a/arch/powerpc/platforms/pseries/rng.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2013, Michael Ellerman, IBM Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#define pr_fmt(fmt) "pseries-rng: " fmt - -#include <linux/kernel.h> -#include <linux/of.h> -#include <asm/archrandom.h> -#include <asm/machdep.h> -#include <asm/plpar_wrappers.h> - - -static int pseries_get_random_long(unsigned long *v) -{ - unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; - - if (plpar_hcall(H_RANDOM, retbuf) == H_SUCCESS) { - *v = retbuf[0]; - return 1; - } - - return 0; -} - -static __init int rng_init(void) -{ - struct device_node *dn; - - dn = of_find_compatible_node(NULL, NULL, "ibm,random"); - if (!dn) - return -ENODEV; - - pr_info("Registering arch random hook.\n"); - - ppc_md.get_random_long = pseries_get_random_long; - - return 0; -} -subsys_initcall(rng_init); diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index c1f1908..1f97e2b 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -442,32 +442,6 @@ static void pSeries_machine_kexec(struct kimage *image) } #endif -#ifdef __LITTLE_ENDIAN__ -long pseries_big_endian_exceptions(void) -{ - long rc; - - while (1) { - rc = enable_big_endian_exceptions(); - if (!H_IS_LONG_BUSY(rc)) - return rc; - mdelay(get_longbusy_msecs(rc)); - } -} - -static long pseries_little_endian_exceptions(void) -{ - long rc; - - while (1) { - rc = enable_little_endian_exceptions(); - if (!H_IS_LONG_BUSY(rc)) - return rc; - mdelay(get_longbusy_msecs(rc)); - } -} -#endif - static void __init pSeries_setup_arch(void) { panic_timeout = 10; @@ -724,22 +698,6 @@ static int __init pSeries_probe(void) /* Now try to figure out if we are running on LPAR */ of_scan_flat_dt(pseries_probe_fw_features, NULL); -#ifdef __LITTLE_ENDIAN__ - if (firmware_has_feature(FW_FEATURE_SET_MODE)) { - long rc; - /* - * Tell the hypervisor that we want our exceptions to - * be taken in little endian mode. If this fails we don't - * want to use BUG() because it will trigger an exception. - */ - rc = pseries_little_endian_exceptions(); - if (rc) { - ppc_md.progress("H_SET_MODE LE exception fail", 0); - panic("Could not enable little endian exceptions"); - } - } -#endif - if (firmware_has_feature(FW_FEATURE_LPAR)) hpte_init_lpar(); else diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c index 16a2552..5f997e7 100644 --- a/arch/powerpc/platforms/pseries/suspend.c +++ b/arch/powerpc/platforms/pseries/suspend.c @@ -106,7 +106,7 @@ static int pseries_prepare_late(void) atomic_set(&suspend_data.done, 0); atomic_set(&suspend_data.error, 0); suspend_data.complete = &suspend_work; - reinit_completion(&suspend_work); + INIT_COMPLETION(suspend_work); return 0; } diff --git a/arch/powerpc/platforms/wsp/chroma.c b/arch/powerpc/platforms/wsp/chroma.c index aaa46b3..8ef53bc 100644 --- a/arch/powerpc/platforms/wsp/chroma.c +++ b/arch/powerpc/platforms/wsp/chroma.c @@ -15,7 +15,6 @@ #include <linux/of.h> #include <linux/smp.h> #include <linux/time.h> -#include <linux/of_fdt.h> #include <asm/machdep.h> #include <asm/udbg.h> diff --git a/arch/powerpc/platforms/wsp/h8.c b/arch/powerpc/platforms/wsp/h8.c index a3c87f3..d18e6cc 100644 --- a/arch/powerpc/platforms/wsp/h8.c +++ b/arch/powerpc/platforms/wsp/h8.c @@ -10,7 +10,6 @@ #include <linux/kernel.h> #include <linux/of.h> #include <linux/io.h> -#include <linux/of_address.h> #include "wsp.h" diff --git a/arch/powerpc/platforms/wsp/ics.c b/arch/powerpc/platforms/wsp/ics.c index 9cd92e6..2d3b1dd 100644 --- a/arch/powerpc/platforms/wsp/ics.c +++ b/arch/powerpc/platforms/wsp/ics.c @@ -18,8 +18,6 @@ #include <linux/smp.h> #include <linux/spinlock.h> #include <linux/types.h> -#include <linux/of_address.h> -#include <linux/of_irq.h> #include <asm/io.h> #include <asm/irq.h> diff --git a/arch/powerpc/platforms/wsp/opb_pic.c b/arch/powerpc/platforms/wsp/opb_pic.c index 3f67298..cb565bf 100644 --- a/arch/powerpc/platforms/wsp/opb_pic.c +++ b/arch/powerpc/platforms/wsp/opb_pic.c @@ -15,8 +15,6 @@ #include <linux/of.h> #include <linux/slab.h> #include <linux/time.h> -#include <linux/of_address.h> -#include <linux/of_irq.h> #include <asm/reg_a2.h> #include <asm/irq.h> diff --git a/arch/powerpc/platforms/wsp/psr2.c b/arch/powerpc/platforms/wsp/psr2.c index a87b414..508ec82 100644 --- a/arch/powerpc/platforms/wsp/psr2.c +++ b/arch/powerpc/platforms/wsp/psr2.c @@ -15,7 +15,6 @@ #include <linux/of.h> #include <linux/smp.h> #include <linux/time.h> -#include <linux/of_fdt.h> #include <asm/machdep.h> #include <asm/udbg.h> diff --git a/arch/powerpc/platforms/wsp/scom_smp.c b/arch/powerpc/platforms/wsp/scom_smp.c index 268bc89..b56b70a 100644 --- a/arch/powerpc/platforms/wsp/scom_smp.c +++ b/arch/powerpc/platforms/wsp/scom_smp.c @@ -116,14 +116,7 @@ static int a2_scom_ram(scom_map_t scom, int thread, u32 insn, int extmask) scom_write(scom, SCOM_RAMIC, cmd); - for (;;) { - if (scom_read(scom, SCOM_RAMC, &val) != 0) { - pr_err("SCOM error on instruction 0x%08x, thread %d\n", - insn, thread); - return -1; - } - if (val & mask) - break; + while (!((val = scom_read(scom, SCOM_RAMC)) & mask)) { pr_devel("Waiting on RAMC = 0x%llx\n", val); if (++n == 3) { pr_err("RAMC timeout on instruction 0x%08x, thread %d\n", @@ -158,7 +151,9 @@ static int a2_scom_getgpr(scom_map_t scom, int thread, int gpr, int alt, if (rc) return rc; - return scom_read(scom, SCOM_RAMD, out_gpr); + *out_gpr = scom_read(scom, SCOM_RAMD); + + return 0; } static int a2_scom_getspr(scom_map_t scom, int thread, int spr, u64 *out_spr) @@ -358,10 +353,7 @@ int a2_scom_startup_cpu(unsigned int lcpu, int thr_idx, struct device_node *np) pr_devel("Bringing up CPU%d using SCOM...\n", lcpu); - if (scom_read(scom, SCOM_PCCR0, &pccr0) != 0) { - printk(KERN_ERR "XSCOM failure readng PCCR0 on CPU%d\n", lcpu); - return -1; - } + pccr0 = scom_read(scom, SCOM_PCCR0); scom_write(scom, SCOM_PCCR0, pccr0 | SCOM_PCCR0_ENABLE_DEBUG | SCOM_PCCR0_ENABLE_RAM); diff --git a/arch/powerpc/platforms/wsp/scom_wsp.c b/arch/powerpc/platforms/wsp/scom_wsp.c index 6538b4d..4052e22 100644 --- a/arch/powerpc/platforms/wsp/scom_wsp.c +++ b/arch/powerpc/platforms/wsp/scom_wsp.c @@ -14,7 +14,6 @@ #include <linux/of.h> #include <linux/spinlock.h> #include <linux/types.h> -#include <linux/of_address.h> #include <asm/cputhreads.h> #include <asm/reg_a2.h> @@ -51,22 +50,18 @@ static void wsp_scom_unmap(scom_map_t map) iounmap((void *)map); } -static int wsp_scom_read(scom_map_t map, u64 reg, u64 *value) +static u64 wsp_scom_read(scom_map_t map, u32 reg) { u64 __iomem *addr = (u64 __iomem *)map; - *value = in_be64(addr + reg); - - return 0; + return in_be64(addr + reg); } -static int wsp_scom_write(scom_map_t map, u64 reg, u64 value) +static void wsp_scom_write(scom_map_t map, u32 reg, u64 value) { u64 __iomem *addr = (u64 __iomem *)map; - out_be64(addr + reg, value); - - return 0; + return out_be64(addr + reg, value); } static const struct scom_controller wsp_scom_controller = { diff --git a/arch/powerpc/platforms/wsp/wsp.c b/arch/powerpc/platforms/wsp/wsp.c index 58cd1f0..d25cc96 100644 --- a/arch/powerpc/platforms/wsp/wsp.c +++ b/arch/powerpc/platforms/wsp/wsp.c @@ -13,7 +13,6 @@ #include <linux/smp.h> #include <linux/delay.h> #include <linux/time.h> -#include <linux/of_address.h> #include <asm/scom.h> @@ -90,7 +89,6 @@ void wsp_halt(void) struct device_node *dn; struct device_node *mine; struct device_node *me; - int rc; me = of_get_cpu_node(smp_processor_id(), NULL); mine = scom_find_parent(me); @@ -103,15 +101,15 @@ void wsp_halt(void) /* read-modify-write it so the HW probe does not get * confused */ - rc = scom_read(m, 0, &val); - if (rc == 0) - scom_write(m, 0, val | 1); + val = scom_read(m, 0); + val |= 1; + scom_write(m, 0, val); scom_unmap(m); } m = scom_map(mine, 0, 1); - rc = scom_read(m, 0, &val); - if (rc == 0) - scom_write(m, 0, val | 1); + val = scom_read(m, 0); + val |= 1; + scom_write(m, 0, val); /* should never return */ scom_unmap(m); } |