From d9b2b2a277219d4812311d995054ce4f95067725 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Wed, 13 Feb 2008 16:56:49 -0800 Subject: [LIB]: Make PowerPC LMB code generic so sparc64 can use it too. Signed-off-by: David S. Miller --- arch/powerpc/platforms/cell/iommu.c | 2 +- arch/powerpc/platforms/maple/setup.c | 2 +- arch/powerpc/platforms/powermac/setup.c | 2 +- arch/powerpc/platforms/ps3/htab.c | 3 ++- arch/powerpc/platforms/ps3/mm.c | 3 ++- arch/powerpc/platforms/ps3/os-area.c | 3 ++- 6 files changed, 9 insertions(+), 6 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index edab631a8dcb..61381586895f 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c @@ -28,13 +28,13 @@ #include #include #include +#include #include #include #include #include #include -#include #include #include diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c index 3ce2d73b4177..dadf33b5c09c 100644 --- a/arch/powerpc/platforms/maple/setup.c +++ b/arch/powerpc/platforms/maple/setup.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -57,7 +58,6 @@ #include #include #include -#include #include #include #include diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c index 36ff1b6b7fac..59404baf911f 100644 --- a/arch/powerpc/platforms/powermac/setup.c +++ b/arch/powerpc/platforms/powermac/setup.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -74,7 +75,6 @@ #include #include #include -#include #include #include "pmac.h" diff --git a/arch/powerpc/platforms/ps3/htab.c b/arch/powerpc/platforms/ps3/htab.c index 7382f195c4f8..1cf901fa9031 100644 --- a/arch/powerpc/platforms/ps3/htab.c +++ b/arch/powerpc/platforms/ps3/htab.c @@ -19,9 +19,10 @@ */ #include +#include #include -#include +#include #include #include #include diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c index 68900476c842..5b3fb2b321ab 100644 --- a/arch/powerpc/platforms/ps3/mm.c +++ b/arch/powerpc/platforms/ps3/mm.c @@ -21,9 +21,10 @@ #include #include #include +#include #include -#include +#include #include #include diff --git a/arch/powerpc/platforms/ps3/os-area.c b/arch/powerpc/platforms/ps3/os-area.c index b9ea09d9d2fb..c73379ec9141 100644 --- a/arch/powerpc/platforms/ps3/os-area.c +++ b/arch/powerpc/platforms/ps3/os-area.c @@ -24,8 +24,9 @@ #include #include #include +#include -#include +#include #include "platform.h" -- cgit v1.2.3 From f8c8803bda4db47cbbdadb9b27b024e903e1d645 Mon Sep 17 00:00:00 2001 From: Badari Pulavarty Date: Tue, 29 Jan 2008 09:19:24 +1100 Subject: [POWERPC] Add code for removing HPTEs for parts of the linear mapping For memory remove, we need to clean up htab mappings for the section of the memory we are removing. This implements support for removing htab bolted mappings for pSeries logical partitions. Other sub-archs may need to implement similar functionality for hotplug memory remove to work on them. Signed-off-by: Badari Pulavarty Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/lpar.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 9a455d46379d..233d9be25f49 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c @@ -520,6 +520,20 @@ static void pSeries_lpar_hpte_invalidate(unsigned long slot, unsigned long va, BUG_ON(lpar_rc != H_SUCCESS); } +static void pSeries_lpar_hpte_removebolted(unsigned long ea, + int psize, int ssize) +{ + unsigned long slot, vsid, va; + + vsid = get_kernel_vsid(ea, ssize); + va = hpt_va(ea, vsid, ssize); + + slot = pSeries_lpar_hpte_find(va, psize, ssize); + BUG_ON(slot == -1); + + pSeries_lpar_hpte_invalidate(slot, va, psize, ssize, 0); +} + /* Flag bits for H_BULK_REMOVE */ #define HBR_REQUEST 0x4000000000000000UL #define HBR_RESPONSE 0x8000000000000000UL @@ -597,6 +611,7 @@ void __init hpte_init_lpar(void) ppc_md.hpte_updateboltedpp = pSeries_lpar_hpte_updateboltedpp; ppc_md.hpte_insert = pSeries_lpar_hpte_insert; ppc_md.hpte_remove = pSeries_lpar_hpte_remove; + ppc_md.hpte_removebolted = pSeries_lpar_hpte_removebolted; ppc_md.flush_hash_range = pSeries_lpar_flush_hash_range; ppc_md.hpte_clear_all = pSeries_lpar_hptab_clear; } -- cgit v1.2.3 From 50530378161fa8d7837243119ed9140ee65e55d4 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Fri, 22 Feb 2008 06:45:08 +1100 Subject: [POWERPC] 8xx: Timebase frequency should not depend on bus-frequency m8xx_setup.c says: /* Force all 8xx processors to use divide by 16 processor clock. */ And at the same time it is using bus-frequency for calculating timebase. It is okay for most setups because bus-frequency is equal to clock-frequency. The problem emerges when cpu frequency is > 66MHz, quoting u-boot/cpu/mpc8xx/speed.c: if (gd->cpu_clk <= 66000000) { sccr_reg |= SCCR_EBDF00; /* bus division factor = 1 */ gd->bus_clk = gd->cpu_clk; } else { sccr_reg |= SCCR_EBDF01; /* bus division factor = 2 */ gd->bus_clk = gd->cpu_clk / 2; } So in case of cpu clock > 66MHz, bus_clk = cpu_clk / 2. An then, from Linux, we calculate timebase frequency as tb_freq = bus_clk / 16, that is cpu_clk / 2 / 16, which is wrong. This fixes the system time drifting problem on the EP885C board running at 133MHz. Signed-off-by: Anton Vorontsov Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/8xx/m8xx_setup.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/8xx/m8xx_setup.c b/arch/powerpc/platforms/8xx/m8xx_setup.c index 184f998d1be2..0d9f75c74f8c 100644 --- a/arch/powerpc/platforms/8xx/m8xx_setup.c +++ b/arch/powerpc/platforms/8xx/m8xx_setup.c @@ -111,17 +111,12 @@ void __init mpc8xx_calibrate_decr(void) /* Processor frequency is MHz. */ - ppc_tb_freq = 50000000; - if (!get_freq("bus-frequency", &ppc_tb_freq)) { - printk(KERN_ERR "WARNING: Estimating decrementer frequency " - "(not found)\n"); - } - ppc_tb_freq /= 16; ppc_proc_freq = 50000000; if (!get_freq("clock-frequency", &ppc_proc_freq)) printk(KERN_ERR "WARNING: Estimating processor frequency " "(not found)\n"); + ppc_tb_freq = ppc_proc_freq / 16; printk("Decrementer Frequency = 0x%lx\n", ppc_tb_freq); /* Perform some more timer/timebase initialization. This used -- cgit v1.2.3 From afea3278f73c14271ee60ca7593ad74b7a946486 Mon Sep 17 00:00:00 2001 From: Olof Johansson Date: Wed, 5 Mar 2008 12:11:48 -0600 Subject: pasemi_mac: Move RX/TX section enablement to dma_lib Also stop both rx and tx sections before changing the configuration of the dma device during init. Signed-off-by: Olof Johansson Acked-by: Jeff Garzik --- arch/powerpc/platforms/pasemi/dma_lib.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pasemi/dma_lib.c b/arch/powerpc/platforms/pasemi/dma_lib.c index c529d8dff395..48cb7c99962d 100644 --- a/arch/powerpc/platforms/pasemi/dma_lib.c +++ b/arch/powerpc/platforms/pasemi/dma_lib.c @@ -17,6 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #include #include @@ -410,6 +411,7 @@ int pasemi_dma_init(void) struct resource res; struct device_node *dn; int i, intf, err = 0; + unsigned long timeout; u32 tmp; if (!machine_is(pasemi)) @@ -478,6 +480,34 @@ int pasemi_dma_init(void) for (i = 0; i < MAX_RXCH; i++) __set_bit(i, rxch_free); + timeout = jiffies + HZ; + pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, 0); + while (pasemi_read_dma_reg(PAS_DMA_COM_RXSTA) & 1) { + if (time_after(jiffies, timeout)) { + pr_warning("Warning: Could not disable RX section\n"); + break; + } + } + + timeout = jiffies + HZ; + pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, 0); + while (pasemi_read_dma_reg(PAS_DMA_COM_TXSTA) & 1) { + if (time_after(jiffies, timeout)) { + pr_warning("Warning: Could not disable TX section\n"); + break; + } + } + + /* setup resource allocations for the different DMA sections */ + tmp = pasemi_read_dma_reg(PAS_DMA_COM_CFG); + pasemi_write_dma_reg(PAS_DMA_COM_CFG, tmp | 0x18000000); + + /* enable tx section */ + pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, PAS_DMA_COM_TXCMD_EN); + + /* enable rx section */ + pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, PAS_DMA_COM_RXCMD_EN); + printk(KERN_INFO "PA Semi PWRficient DMA library initialized " "(%d tx, %d rx channels)\n", num_txch, num_rxch); -- cgit v1.2.3 From f37203b5ccaf6d58cb5ca6b1840e40f3b587109c Mon Sep 17 00:00:00 2001 From: Olof Johansson Date: Wed, 5 Mar 2008 12:25:45 -0600 Subject: [POWERPC] pasemi: Add flag management functions to dma_lib Add functions to manage the channel syncronization flags to dma_lib Signed-off-by: Olof Johansson Acked-by: Jeff Garzik --- arch/powerpc/platforms/pasemi/dma_lib.c | 74 +++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pasemi/dma_lib.c b/arch/powerpc/platforms/pasemi/dma_lib.c index 48cb7c99962d..07e4e25ef625 100644 --- a/arch/powerpc/platforms/pasemi/dma_lib.c +++ b/arch/powerpc/platforms/pasemi/dma_lib.c @@ -27,6 +27,7 @@ #define MAX_TXCH 64 #define MAX_RXCH 64 +#define MAX_FLAGS 64 static struct pasdma_status *dma_status; @@ -44,6 +45,7 @@ static struct pci_dev *dma_pdev; static DECLARE_BITMAP(txch_free, MAX_TXCH); static DECLARE_BITMAP(rxch_free, MAX_RXCH); +static DECLARE_BITMAP(flags_free, MAX_FLAGS); /* pasemi_read_iob_reg - read IOB register * @reg: Register to read (offset into PCI CFG space) @@ -374,6 +376,71 @@ void pasemi_dma_free_buf(struct pasemi_dmachan *chan, int size, } EXPORT_SYMBOL(pasemi_dma_free_buf); +/* pasemi_dma_alloc_flag - Allocate a flag (event) for channel syncronization + * + * Allocates a flag for use with channel syncronization (event descriptors). + * Returns allocated flag (0-63), < 0 on error. + */ +int pasemi_dma_alloc_flag(void) +{ + int bit; + +retry: + bit = find_next_bit(flags_free, MAX_FLAGS, 0); + if (bit >= MAX_FLAGS) + return -ENOSPC; + if (!test_and_clear_bit(bit, flags_free)) + goto retry; + + return bit; +} +EXPORT_SYMBOL(pasemi_dma_alloc_flag); + + +/* pasemi_dma_free_flag - Deallocates a flag (event) + * @flag: Flag number to deallocate + * + * Frees up a flag so it can be reused for other purposes. + */ +void pasemi_dma_free_flag(int flag) +{ + BUG_ON(test_bit(flag, flags_free)); + BUG_ON(flag >= MAX_FLAGS); + set_bit(flag, flags_free); +} +EXPORT_SYMBOL(pasemi_dma_free_flag); + + +/* pasemi_dma_set_flag - Sets a flag (event) to 1 + * @flag: Flag number to set active + * + * Sets the flag provided to 1. + */ +void pasemi_dma_set_flag(int flag) +{ + BUG_ON(flag >= MAX_FLAGS); + if (flag < 32) + pasemi_write_dma_reg(PAS_DMA_TXF_SFLG0, 1 << flag); + else + pasemi_write_dma_reg(PAS_DMA_TXF_SFLG1, 1 << flag); +} +EXPORT_SYMBOL(pasemi_dma_set_flag); + +/* pasemi_dma_clear_flag - Sets a flag (event) to 0 + * @flag: Flag number to set inactive + * + * Sets the flag provided to 0. + */ +void pasemi_dma_clear_flag(int flag) +{ + BUG_ON(flag >= MAX_FLAGS); + if (flag < 32) + pasemi_write_dma_reg(PAS_DMA_TXF_CFLG0, 1 << flag); + else + pasemi_write_dma_reg(PAS_DMA_TXF_CFLG1, 1 << flag); +} +EXPORT_SYMBOL(pasemi_dma_clear_flag); + static void *map_onedev(struct pci_dev *p, int index) { struct device_node *dn; @@ -508,6 +575,13 @@ int pasemi_dma_init(void) /* enable rx section */ pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, PAS_DMA_COM_RXCMD_EN); + for (i = 0; i < MAX_FLAGS; i++) + __set_bit(i, flags_free); + + /* clear all status flags */ + pasemi_write_dma_reg(PAS_DMA_TXF_CFLG0, 0xffffffff); + pasemi_write_dma_reg(PAS_DMA_TXF_CFLG1, 0xffffffff); + printk(KERN_INFO "PA Semi PWRficient DMA library initialized " "(%d tx, %d rx channels)\n", num_txch, num_rxch); -- cgit v1.2.3 From dda56df08a28404004bca313d2a1ba1597acd755 Mon Sep 17 00:00:00 2001 From: Olof Johansson Date: Wed, 5 Mar 2008 12:25:59 -0600 Subject: [POWERPC] pasemi: Add function engine management functions to dma_lib Used to allocate functions for crypto/checksum offload. Signed-off-by: Olof Johansson Acked-by: Jeff Garzik --- arch/powerpc/platforms/pasemi/dma_lib.c | 40 +++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pasemi/dma_lib.c b/arch/powerpc/platforms/pasemi/dma_lib.c index 07e4e25ef625..217af321b0ca 100644 --- a/arch/powerpc/platforms/pasemi/dma_lib.c +++ b/arch/powerpc/platforms/pasemi/dma_lib.c @@ -28,6 +28,7 @@ #define MAX_TXCH 64 #define MAX_RXCH 64 #define MAX_FLAGS 64 +#define MAX_FUN 8 static struct pasdma_status *dma_status; @@ -46,6 +47,7 @@ static struct pci_dev *dma_pdev; static DECLARE_BITMAP(txch_free, MAX_TXCH); static DECLARE_BITMAP(rxch_free, MAX_RXCH); static DECLARE_BITMAP(flags_free, MAX_FLAGS); +static DECLARE_BITMAP(fun_free, MAX_FUN); /* pasemi_read_iob_reg - read IOB register * @reg: Register to read (offset into PCI CFG space) @@ -441,6 +443,41 @@ void pasemi_dma_clear_flag(int flag) } EXPORT_SYMBOL(pasemi_dma_clear_flag); +/* pasemi_dma_alloc_fun - Allocate a function engine + * + * Allocates a function engine to use for crypto/checksum offload + * Returns allocated engine (0-8), < 0 on error. + */ +int pasemi_dma_alloc_fun(void) +{ + int bit; + +retry: + bit = find_next_bit(fun_free, MAX_FLAGS, 0); + if (bit >= MAX_FLAGS) + return -ENOSPC; + if (!test_and_clear_bit(bit, fun_free)) + goto retry; + + return bit; +} +EXPORT_SYMBOL(pasemi_dma_alloc_fun); + + +/* pasemi_dma_free_fun - Deallocates a function engine + * @flag: Engine number to deallocate + * + * Frees up a function engine so it can be used for other purposes. + */ +void pasemi_dma_free_fun(int fun) +{ + BUG_ON(test_bit(fun, fun_free)); + BUG_ON(fun >= MAX_FLAGS); + set_bit(fun, fun_free); +} +EXPORT_SYMBOL(pasemi_dma_free_fun); + + static void *map_onedev(struct pci_dev *p, int index) { struct device_node *dn; @@ -578,6 +615,9 @@ int pasemi_dma_init(void) for (i = 0; i < MAX_FLAGS; i++) __set_bit(i, flags_free); + for (i = 0; i < MAX_FUN; i++) + __set_bit(i, fun_free); + /* clear all status flags */ pasemi_write_dma_reg(PAS_DMA_TXF_CFLG0, 0xffffffff); pasemi_write_dma_reg(PAS_DMA_TXF_CFLG1, 0xffffffff); -- cgit v1.2.3 From 53378c2845d93b09056bc7b4233a366798ae2450 Mon Sep 17 00:00:00 2001 From: Nathan Lynch Date: Thu, 13 Mar 2008 10:43:03 +1100 Subject: [POWERPC] maple: Use platform name in define_machine() Prevailing practice for define_machine() in powerpc is to use the platform name when the platform has only one define_machine() statement, but maple uses "maple_md". This caused me some head-scratching when writing some new code that uses machine_is(maple). Use "maple" instead of "maple_md". There should not be any behavioral change -- fixup_maple_ide() calls machine_is(maple) but the body of the function is ifdef'd out. Signed-off-by: Nathan Lynch Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/maple/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c index dadf33b5c09c..364714757cf1 100644 --- a/arch/powerpc/platforms/maple/setup.c +++ b/arch/powerpc/platforms/maple/setup.c @@ -319,7 +319,7 @@ static int __init maple_probe(void) return 1; } -define_machine(maple_md) { +define_machine(maple) { .name = "Maple", .probe = maple_probe, .setup_arch = maple_setup_arch, -- cgit v1.2.3 From 1cd8f348beedf335ef0f1dc8073c05dfe9227d81 Mon Sep 17 00:00:00 2001 From: Nathan Lynch Date: Thu, 13 Mar 2008 10:43:04 +1100 Subject: [POWERPC] maple: Kill fixup_maple_ide This function has been a no-op for about 18 months; it's there in the history should anyone need to resurrect it. Signed-off-by: Nathan Lynch Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/maple/pci.c | 47 -------------------------------------- 1 file changed, 47 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c index 3ffa0ac170ee..301855263b81 100644 --- a/arch/powerpc/platforms/maple/pci.c +++ b/arch/powerpc/platforms/maple/pci.c @@ -592,50 +592,3 @@ int maple_pci_get_legacy_ide_irq(struct pci_dev *pdev, int channel) } return irq; } - -/* XXX: To remove once all firmwares are ok */ -static void fixup_maple_ide(struct pci_dev* dev) -{ - if (!machine_is(maple)) - return; - -#if 0 /* Enable this to enable IDE port 0 */ - { - u8 v; - - pci_read_config_byte(dev, 0x40, &v); - v |= 2; - pci_write_config_byte(dev, 0x40, v); - } -#endif -#if 0 /* fix bus master base */ - pci_write_config_dword(dev, 0x20, 0xcc01); - printk("old ide resource: %lx -> %lx \n", - dev->resource[4].start, dev->resource[4].end); - dev->resource[4].start = 0xcc00; - dev->resource[4].end = 0xcc10; -#endif -#if 0 /* Enable this to fixup IDE sense/polarity of irqs in IO-APICs */ - { - struct pci_dev *apicdev; - u32 v; - - apicdev = pci_get_slot (dev->bus, PCI_DEVFN(5,0)); - if (apicdev == NULL) - printk("IDE Fixup IRQ: Can't find IO-APIC !\n"); - else { - pci_write_config_byte(apicdev, 0xf2, 0x10 + 2*14); - pci_read_config_dword(apicdev, 0xf4, &v); - v &= ~0x00000022; - pci_write_config_dword(apicdev, 0xf4, v); - pci_write_config_byte(apicdev, 0xf2, 0x10 + 2*15); - pci_read_config_dword(apicdev, 0xf4, &v); - v &= ~0x00000022; - pci_write_config_dword(apicdev, 0xf4, v); - pci_dev_put(apicdev); - } - } -#endif -} -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_IDE, - fixup_maple_ide); -- cgit v1.2.3 From 96366a8d3f17ee964802378d4a1f51fda86f070e Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Mon, 17 Mar 2008 16:23:29 +1100 Subject: [POWERPC] Update wait_state_cycles in the VPA The hypervisor can look at the value in the wait_state_cycles field of the VPA for an estimate of how busy dedicated processors are. Currently, as the kernel never touches this field, we appear to be 100% busy. This records the duration the kernel is in powersave and passes that to the HV to provide a reasonable indication of utilisation. Signed-off-by: Tony Breeds Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/setup.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index fdb9b1c8f977..90555a39fe62 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -393,6 +393,7 @@ static void pseries_dedicated_idle_sleep(void) { unsigned int cpu = smp_processor_id(); unsigned long start_snooze; + unsigned long in_purr, out_purr; /* * Indicate to the HV that we are idle. Now would be @@ -400,6 +401,7 @@ static void pseries_dedicated_idle_sleep(void) */ get_lppaca()->idle = 1; get_lppaca()->donate_dedicated_cpu = 1; + in_purr = mfspr(SPRN_PURR); /* * We come in with interrupts disabled, and need_resched() @@ -432,6 +434,8 @@ static void pseries_dedicated_idle_sleep(void) out: HMT_medium(); + out_purr = mfspr(SPRN_PURR); + get_lppaca()->wait_state_cycles += out_purr - in_purr; get_lppaca()->donate_dedicated_cpu = 0; get_lppaca()->idle = 0; } -- cgit v1.2.3 From 59861bc6ee475542c66f4b24b9f5b5148f1d4f0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=2E=C3=87a=C4=9Flar=20Onur?= Date: Mon, 17 Mar 2008 20:36:26 +1100 Subject: [POWERPC] arch/powerpc/platforms/iseries/pci.c: Use time_* macros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The functions time_before, time_before_eq, time_after, and time_after_eq are more robust for comparing jiffies against other values. This implements usage of the time_after() macro, defined at linux/jiffies.h, which deals with wrapping correctly. Signed-off-by: S.Çağlar Onur Acked-by: Stephen Rothwell Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/iseries/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c index cc562e4c2f32..02a634faedbe 100644 --- a/arch/powerpc/platforms/iseries/pci.c +++ b/arch/powerpc/platforms/iseries/pci.c @@ -23,6 +23,7 @@ #undef DEBUG +#include #include #include #include @@ -586,7 +587,7 @@ static inline struct device_node *xlate_iomm_address( static unsigned long last_jiffies; static int num_printed; - if ((jiffies - last_jiffies) > 60 * HZ) { + if (time_after(jiffies, last_jiffies + 60 * HZ)) { last_jiffies = jiffies; num_printed = 0; } -- cgit v1.2.3 From 6ac26c8a7eb149dbd669cc6cd9b77ffc9cd0d2fb Mon Sep 17 00:00:00 2001 From: Manish Ahuja Date: Sat, 22 Mar 2008 10:37:08 +1100 Subject: [POWERPC] pseries: phyp dump: Reserve and release memory Initial patch for reserving memory in early boot, and freeing it later. If the previous boot had ended with a crash, the reserved memory would contain a copy of the crashed kernel data. Signed-off-by: Manish Ahuja Signed-off-by: Linas Vepstas Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/Makefile | 1 + arch/powerpc/platforms/pseries/phyp_dump.c | 103 +++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 arch/powerpc/platforms/pseries/phyp_dump.c (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile index 992ba6753cf2..bdae04bb7a01 100644 --- a/arch/powerpc/platforms/pseries/Makefile +++ b/arch/powerpc/platforms/pseries/Makefile @@ -18,3 +18,4 @@ obj-$(CONFIG_HOTPLUG_CPU) += hotplug-cpu.o obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o obj-$(CONFIG_HVCS) += hvcserver.o obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o +obj-$(CONFIG_PHYP_DUMP) += phyp_dump.o diff --git a/arch/powerpc/platforms/pseries/phyp_dump.c b/arch/powerpc/platforms/pseries/phyp_dump.c new file mode 100644 index 000000000000..230286cafffe --- /dev/null +++ b/arch/powerpc/platforms/pseries/phyp_dump.c @@ -0,0 +1,103 @@ +/* + * Hypervisor-assisted dump + * + * Linas Vepstas, Manish Ahuja 2008 + * Copyright 2008 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 +#include +#include +#include + +#include +#include +#include +#include + +/* Variables, used to communicate data between early boot and late boot */ +static struct phyp_dump phyp_dump_vars; +struct phyp_dump *phyp_dump_info = &phyp_dump_vars; + +/** + * release_memory_range -- release memory previously lmb_reserved + * @start_pfn: starting physical frame number + * @nr_pages: number of pages to free. + * + * This routine will release memory that had been previously + * lmb_reserved in early boot. The released memory becomes + * available for genreal use. + */ +static void +release_memory_range(unsigned long start_pfn, unsigned long nr_pages) +{ + struct page *rpage; + unsigned long end_pfn; + long i; + + end_pfn = start_pfn + nr_pages; + + for (i = start_pfn; i <= end_pfn; i++) { + rpage = pfn_to_page(i); + if (PageReserved(rpage)) { + ClearPageReserved(rpage); + init_page_count(rpage); + __free_page(rpage); + totalram_pages++; + } + } +} + +static int __init phyp_dump_setup(void) +{ + unsigned long start_pfn, nr_pages; + + /* If no memory was reserved in early boot, there is nothing to do */ + if (phyp_dump_info->init_reserve_size == 0) + return 0; + + /* Release memory that was reserved in early boot */ + start_pfn = PFN_DOWN(phyp_dump_info->init_reserve_start); + nr_pages = PFN_DOWN(phyp_dump_info->init_reserve_size); + release_memory_range(start_pfn, nr_pages); + + return 0; +} +machine_subsys_initcall(pseries, phyp_dump_setup); + +int __init early_init_dt_scan_phyp_dump(unsigned long node, + const char *uname, int depth, void *data) +{ + const unsigned int *sizes; + + phyp_dump_info->phyp_dump_configured = 0; + phyp_dump_info->phyp_dump_is_active = 0; + + if (depth != 1 || strcmp(uname, "rtas") != 0) + return 0; + + if (of_get_flat_dt_prop(node, "ibm,configure-kernel-dump", NULL)) + phyp_dump_info->phyp_dump_configured++; + + if (of_get_flat_dt_prop(node, "ibm,dump-kernel", NULL)) + phyp_dump_info->phyp_dump_is_active++; + + sizes = of_get_flat_dt_prop(node, "ibm,configure-kernel-dump-sizes", + NULL); + if (!sizes) + return 0; + + if (sizes[0] == 1) + phyp_dump_info->cpu_state_size = *((unsigned long *)&sizes[1]); + + if (sizes[3] == 2) + phyp_dump_info->hpte_region_size = + *((unsigned long *)&sizes[4]); + return 1; +} -- cgit v1.2.3 From d5a29c7a36958ddec1ae7ab685ce09a002356548 Mon Sep 17 00:00:00 2001 From: Manish Ahuja Date: Sat, 22 Mar 2008 10:39:17 +1100 Subject: [POWERPC] pseries: phyp dump: Use sysfs to release reserved mem Check to see if there actually is data from a previously crashed kernel waiting. If so, allow user-space tools to grab the data (by reading /proc/kcore). When user-space finishes dumping a section, it must release that memory by writing to sysfs. For example, echo "0x40000000 0x10000000" > /sys/kernel/release_region will release 256MB starting at the 1GB. The released memory becomes free for general use. Signed-off-by: Linas Vepstas Signed-off-by: Manish Ahuja Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/phyp_dump.c | 81 ++++++++++++++++++++++++++++-- 1 file changed, 76 insertions(+), 5 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pseries/phyp_dump.c b/arch/powerpc/platforms/pseries/phyp_dump.c index 230286cafffe..f355f052a56c 100644 --- a/arch/powerpc/platforms/pseries/phyp_dump.c +++ b/arch/powerpc/platforms/pseries/phyp_dump.c @@ -12,19 +12,24 @@ */ #include +#include #include +#include #include #include +#include #include #include #include #include +#include /* Variables, used to communicate data between early boot and late boot */ static struct phyp_dump phyp_dump_vars; struct phyp_dump *phyp_dump_info = &phyp_dump_vars; +/* ------------------------------------------------- */ /** * release_memory_range -- release memory previously lmb_reserved * @start_pfn: starting physical frame number @@ -54,18 +59,84 @@ release_memory_range(unsigned long start_pfn, unsigned long nr_pages) } } -static int __init phyp_dump_setup(void) +/* ------------------------------------------------- */ +/** + * sysfs_release_region -- sysfs interface to release memory range. + * + * Usage: + * "echo > /sys/kernel/release_region" + * + * Example: + * "echo 0x40000000 0x10000000 > /sys/kernel/release_region" + * + * will release 256MB starting at 1GB. + */ +static ssize_t store_release_region(struct kobject *kobj, + struct kobj_attribute *attr, + const char *buf, size_t count) { + unsigned long start_addr, length, end_addr; unsigned long start_pfn, nr_pages; + ssize_t ret; + + ret = sscanf(buf, "%lx %lx", &start_addr, &length); + if (ret != 2) + return -EINVAL; + + /* Range-check - don't free any reserved memory that + * wasn't reserved for phyp-dump */ + if (start_addr < phyp_dump_info->init_reserve_start) + start_addr = phyp_dump_info->init_reserve_start; + + end_addr = phyp_dump_info->init_reserve_start + + phyp_dump_info->init_reserve_size; + if (start_addr+length > end_addr) + length = end_addr - start_addr; + + /* Release the region of memory assed in by user */ + start_pfn = PFN_DOWN(start_addr); + nr_pages = PFN_DOWN(length); + release_memory_range(start_pfn, nr_pages); + + return count; +} + +static struct kobj_attribute rr = __ATTR(release_region, 0600, + NULL, store_release_region); + +static int __init phyp_dump_setup(void) +{ + struct device_node *rtas; + const int *dump_header = NULL; + int header_len = 0; + int rc; /* If no memory was reserved in early boot, there is nothing to do */ if (phyp_dump_info->init_reserve_size == 0) return 0; - /* Release memory that was reserved in early boot */ - start_pfn = PFN_DOWN(phyp_dump_info->init_reserve_start); - nr_pages = PFN_DOWN(phyp_dump_info->init_reserve_size); - release_memory_range(start_pfn, nr_pages); + /* Return if phyp dump not supported */ + if (!phyp_dump_info->phyp_dump_configured) + return -ENOSYS; + + /* Is there dump data waiting for us? */ + rtas = of_find_node_by_path("/rtas"); + if (rtas) { + dump_header = of_get_property(rtas, "ibm,kernel-dump", + &header_len); + of_node_put(rtas); + } + + if (dump_header == NULL) + return 0; + + /* Should we create a dump_subsys, analogous to s390/ipl.c ? */ + rc = sysfs_create_file(kernel_kobj, &rr.attr); + if (rc) { + printk(KERN_ERR "phyp-dump: unable to create sysfs file (%d)\n", + rc); + return 0; + } return 0; } -- cgit v1.2.3 From 2c4f41139cc4ffc3ad12d7fdb8dd71dc36824a6e Mon Sep 17 00:00:00 2001 From: Manish Ahuja Date: Sat, 22 Mar 2008 10:43:15 +1100 Subject: [POWERPC] pseries: phyp dump: Register dump area Set up the actual dump header, register it with the hypervisor. Signed-off-by: Manish Ahuja Signed-off-by: Linas Vepstas Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/phyp_dump.c | 137 +++++++++++++++++++++++++++-- 1 file changed, 131 insertions(+), 6 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pseries/phyp_dump.c b/arch/powerpc/platforms/pseries/phyp_dump.c index f355f052a56c..d93f1b1585a3 100644 --- a/arch/powerpc/platforms/pseries/phyp_dump.c +++ b/arch/powerpc/platforms/pseries/phyp_dump.c @@ -29,6 +29,117 @@ static struct phyp_dump phyp_dump_vars; struct phyp_dump *phyp_dump_info = &phyp_dump_vars; +static int ibm_configure_kernel_dump; +/* ------------------------------------------------- */ +/* RTAS interfaces to declare the dump regions */ + +struct dump_section { + u32 dump_flags; + u16 source_type; + u16 error_flags; + u64 source_address; + u64 source_length; + u64 length_copied; + u64 destination_address; +}; + +struct phyp_dump_header { + u32 version; + u16 num_of_sections; + u16 status; + + u32 first_offset_section; + u32 dump_disk_section; + u64 block_num_dd; + u64 num_of_blocks_dd; + u32 offset_dd; + u32 maxtime_to_auto; + /* No dump disk path string used */ + + struct dump_section cpu_data; + struct dump_section hpte_data; + struct dump_section kernel_data; +}; + +/* The dump header *must be* in low memory, so .bss it */ +static struct phyp_dump_header phdr; + +#define NUM_DUMP_SECTIONS 3 +#define DUMP_HEADER_VERSION 0x1 +#define DUMP_REQUEST_FLAG 0x1 +#define DUMP_SOURCE_CPU 0x0001 +#define DUMP_SOURCE_HPTE 0x0002 +#define DUMP_SOURCE_RMO 0x0011 + +/** + * init_dump_header() - initialize the header declaring a dump + * Returns: length of dump save area. + * + * When the hypervisor saves crashed state, it needs to put + * it somewhere. The dump header tells the hypervisor where + * the data can be saved. + */ +static unsigned long init_dump_header(struct phyp_dump_header *ph) +{ + unsigned long addr_offset = 0; + + /* Set up the dump header */ + ph->version = DUMP_HEADER_VERSION; + ph->num_of_sections = NUM_DUMP_SECTIONS; + ph->status = 0; + + ph->first_offset_section = + (u32)offsetof(struct phyp_dump_header, cpu_data); + ph->dump_disk_section = 0; + ph->block_num_dd = 0; + ph->num_of_blocks_dd = 0; + ph->offset_dd = 0; + + ph->maxtime_to_auto = 0; /* disabled */ + + /* The first two sections are mandatory */ + ph->cpu_data.dump_flags = DUMP_REQUEST_FLAG; + ph->cpu_data.source_type = DUMP_SOURCE_CPU; + ph->cpu_data.source_address = 0; + ph->cpu_data.source_length = phyp_dump_info->cpu_state_size; + ph->cpu_data.destination_address = addr_offset; + addr_offset += phyp_dump_info->cpu_state_size; + + ph->hpte_data.dump_flags = DUMP_REQUEST_FLAG; + ph->hpte_data.source_type = DUMP_SOURCE_HPTE; + ph->hpte_data.source_address = 0; + ph->hpte_data.source_length = phyp_dump_info->hpte_region_size; + ph->hpte_data.destination_address = addr_offset; + addr_offset += phyp_dump_info->hpte_region_size; + + /* This section describes the low kernel region */ + ph->kernel_data.dump_flags = DUMP_REQUEST_FLAG; + ph->kernel_data.source_type = DUMP_SOURCE_RMO; + ph->kernel_data.source_address = PHYP_DUMP_RMR_START; + ph->kernel_data.source_length = PHYP_DUMP_RMR_END; + ph->kernel_data.destination_address = addr_offset; + addr_offset += ph->kernel_data.source_length; + + return addr_offset; +} + +static void register_dump_area(struct phyp_dump_header *ph, unsigned long addr) +{ + int rc; + ph->cpu_data.destination_address += addr; + ph->hpte_data.destination_address += addr; + ph->kernel_data.destination_address += addr; + + do { + rc = rtas_call(ibm_configure_kernel_dump, 3, 1, NULL, + 1, ph, sizeof(struct phyp_dump_header)); + } while (rtas_busy_delay(rc)); + + if (rc) + printk(KERN_ERR "phyp-dump: unexpected error (%d) on " + "register\n", rc); +} + /* ------------------------------------------------- */ /** * release_memory_range -- release memory previously lmb_reserved @@ -107,7 +218,9 @@ static struct kobj_attribute rr = __ATTR(release_region, 0600, static int __init phyp_dump_setup(void) { struct device_node *rtas; - const int *dump_header = NULL; + const struct phyp_dump_header *dump_header = NULL; + unsigned long dump_area_start; + unsigned long dump_area_length; int header_len = 0; int rc; @@ -119,7 +232,13 @@ static int __init phyp_dump_setup(void) if (!phyp_dump_info->phyp_dump_configured) return -ENOSYS; - /* Is there dump data waiting for us? */ + /* Is there dump data waiting for us? If there isn't, + * then register a new dump area, and release all of + * the rest of the reserved ram. + * + * The /rtas/ibm,kernel-dump rtas node is present only + * if there is dump data waiting for us. + */ rtas = of_find_node_by_path("/rtas"); if (rtas) { dump_header = of_get_property(rtas, "ibm,kernel-dump", @@ -127,17 +246,23 @@ static int __init phyp_dump_setup(void) of_node_put(rtas); } - if (dump_header == NULL) + dump_area_length = init_dump_header(&phdr); + + /* align down */ + dump_area_start = phyp_dump_info->init_reserve_start & PAGE_MASK; + + if (dump_header == NULL) { + register_dump_area(&phdr, dump_area_start); return 0; + } /* Should we create a dump_subsys, analogous to s390/ipl.c ? */ rc = sysfs_create_file(kernel_kobj, &rr.attr); - if (rc) { + if (rc) printk(KERN_ERR "phyp-dump: unable to create sysfs file (%d)\n", rc); - return 0; - } + /* ToDo: re-register the dump area, for next time. */ return 0; } machine_subsys_initcall(pseries, phyp_dump_setup); -- cgit v1.2.3 From 599c1aa54f06da4fd277982be0731e96f0791caa Mon Sep 17 00:00:00 2001 From: Manish Ahuja Date: Sat, 22 Mar 2008 10:44:05 +1100 Subject: [POWERPC] pseries: phyp dump: Debugging print routines Provide some basic debugging support. Signed-off-by: Manish Ahuja Signed-off-by: Linas Vepstas Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/phyp_dump.c | 61 +++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 2 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pseries/phyp_dump.c b/arch/powerpc/platforms/pseries/phyp_dump.c index d93f1b1585a3..5cdba6a6f70c 100644 --- a/arch/powerpc/platforms/pseries/phyp_dump.c +++ b/arch/powerpc/platforms/pseries/phyp_dump.c @@ -123,6 +123,61 @@ static unsigned long init_dump_header(struct phyp_dump_header *ph) return addr_offset; } +static void print_dump_header(const struct phyp_dump_header *ph) +{ +#ifdef DEBUG + printk(KERN_INFO "dump header:\n"); + /* setup some ph->sections required */ + printk(KERN_INFO "version = %d\n", ph->version); + printk(KERN_INFO "Sections = %d\n", ph->num_of_sections); + printk(KERN_INFO "Status = 0x%x\n", ph->status); + + /* No ph->disk, so all should be set to 0 */ + printk(KERN_INFO "Offset to first section 0x%x\n", + ph->first_offset_section); + printk(KERN_INFO "dump disk sections should be zero\n"); + printk(KERN_INFO "dump disk section = %d\n", ph->dump_disk_section); + printk(KERN_INFO "block num = %ld\n", ph->block_num_dd); + printk(KERN_INFO "number of blocks = %ld\n", ph->num_of_blocks_dd); + printk(KERN_INFO "dump disk offset = %d\n", ph->offset_dd); + printk(KERN_INFO "Max auto time= %d\n", ph->maxtime_to_auto); + + /*set cpu state and hpte states as well scratch pad area */ + printk(KERN_INFO " CPU AREA \n"); + printk(KERN_INFO "cpu dump_flags =%d\n", ph->cpu_data.dump_flags); + printk(KERN_INFO "cpu source_type =%d\n", ph->cpu_data.source_type); + printk(KERN_INFO "cpu error_flags =%d\n", ph->cpu_data.error_flags); + printk(KERN_INFO "cpu source_address =%lx\n", + ph->cpu_data.source_address); + printk(KERN_INFO "cpu source_length =%lx\n", + ph->cpu_data.source_length); + printk(KERN_INFO "cpu length_copied =%lx\n", + ph->cpu_data.length_copied); + + printk(KERN_INFO " HPTE AREA \n"); + printk(KERN_INFO "HPTE dump_flags =%d\n", ph->hpte_data.dump_flags); + printk(KERN_INFO "HPTE source_type =%d\n", ph->hpte_data.source_type); + printk(KERN_INFO "HPTE error_flags =%d\n", ph->hpte_data.error_flags); + printk(KERN_INFO "HPTE source_address =%lx\n", + ph->hpte_data.source_address); + printk(KERN_INFO "HPTE source_length =%lx\n", + ph->hpte_data.source_length); + printk(KERN_INFO "HPTE length_copied =%lx\n", + ph->hpte_data.length_copied); + + printk(KERN_INFO " SRSD AREA \n"); + printk(KERN_INFO "SRSD dump_flags =%d\n", ph->kernel_data.dump_flags); + printk(KERN_INFO "SRSD source_type =%d\n", ph->kernel_data.source_type); + printk(KERN_INFO "SRSD error_flags =%d\n", ph->kernel_data.error_flags); + printk(KERN_INFO "SRSD source_address =%lx\n", + ph->kernel_data.source_address); + printk(KERN_INFO "SRSD source_length =%lx\n", + ph->kernel_data.source_length); + printk(KERN_INFO "SRSD length_copied =%lx\n", + ph->kernel_data.length_copied); +#endif +} + static void register_dump_area(struct phyp_dump_header *ph, unsigned long addr) { int rc; @@ -135,9 +190,11 @@ static void register_dump_area(struct phyp_dump_header *ph, unsigned long addr) 1, ph, sizeof(struct phyp_dump_header)); } while (rtas_busy_delay(rc)); - if (rc) + if (rc) { printk(KERN_ERR "phyp-dump: unexpected error (%d) on " "register\n", rc); + print_dump_header(ph); + } } /* ------------------------------------------------- */ @@ -246,8 +303,8 @@ static int __init phyp_dump_setup(void) of_node_put(rtas); } + print_dump_header(dump_header); dump_area_length = init_dump_header(&phdr); - /* align down */ dump_area_start = phyp_dump_info->init_reserve_start & PAGE_MASK; -- cgit v1.2.3 From a9c508dae10a821dc95653178eec018abc90482e Mon Sep 17 00:00:00 2001 From: Manish Ahuja Date: Sat, 22 Mar 2008 10:45:22 +1100 Subject: [POWERPC] pseries: phyp dump: Invalidate and print dump areas This adds routines to a. invalidate dump b. calculate region that is reserved and needs to be freed. This is exported through sysfs interface. Unregister has been removed for now as it wasn't being used. Signed-off-by: Manish Ahuja Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/phyp_dump.c | 83 +++++++++++++++++++++++++++--- 1 file changed, 77 insertions(+), 6 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pseries/phyp_dump.c b/arch/powerpc/platforms/pseries/phyp_dump.c index 5cdba6a6f70c..df4870ec90d8 100644 --- a/arch/powerpc/platforms/pseries/phyp_dump.c +++ b/arch/powerpc/platforms/pseries/phyp_dump.c @@ -70,6 +70,10 @@ static struct phyp_dump_header phdr; #define DUMP_SOURCE_CPU 0x0001 #define DUMP_SOURCE_HPTE 0x0002 #define DUMP_SOURCE_RMO 0x0011 +#define DUMP_ERROR_FLAG 0x2000 +#define DUMP_TRIGGERED 0x4000 +#define DUMP_PERFORMED 0x8000 + /** * init_dump_header() - initialize the header declaring a dump @@ -181,9 +185,15 @@ static void print_dump_header(const struct phyp_dump_header *ph) static void register_dump_area(struct phyp_dump_header *ph, unsigned long addr) { int rc; - ph->cpu_data.destination_address += addr; - ph->hpte_data.destination_address += addr; - ph->kernel_data.destination_address += addr; + + /* Add addr value if not initialized before */ + if (ph->cpu_data.destination_address == 0) { + ph->cpu_data.destination_address += addr; + ph->hpte_data.destination_address += addr; + ph->kernel_data.destination_address += addr; + } + + /* ToDo Invalidate kdump and free memory range. */ do { rc = rtas_call(ibm_configure_kernel_dump, 3, 1, NULL, @@ -197,6 +207,30 @@ static void register_dump_area(struct phyp_dump_header *ph, unsigned long addr) } } +static +void invalidate_last_dump(struct phyp_dump_header *ph, unsigned long addr) +{ + int rc; + + /* Add addr value if not initialized before */ + if (ph->cpu_data.destination_address == 0) { + ph->cpu_data.destination_address += addr; + ph->hpte_data.destination_address += addr; + ph->kernel_data.destination_address += addr; + } + + do { + rc = rtas_call(ibm_configure_kernel_dump, 3, 1, NULL, + 2, ph, sizeof(struct phyp_dump_header)); + } while (rtas_busy_delay(rc)); + + if (rc) { + printk(KERN_ERR "phyp-dump: unexpected error (%d) " + "on invalidate\n", rc); + print_dump_header(ph); + } +} + /* ------------------------------------------------- */ /** * release_memory_range -- release memory previously lmb_reserved @@ -207,8 +241,8 @@ static void register_dump_area(struct phyp_dump_header *ph, unsigned long addr) * lmb_reserved in early boot. The released memory becomes * available for genreal use. */ -static void -release_memory_range(unsigned long start_pfn, unsigned long nr_pages) +static void release_memory_range(unsigned long start_pfn, + unsigned long nr_pages) { struct page *rpage; unsigned long end_pfn; @@ -269,8 +303,29 @@ static ssize_t store_release_region(struct kobject *kobj, return count; } +static ssize_t show_release_region(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + u64 second_addr_range; + + /* total reserved size - start of scratch area */ + second_addr_range = phyp_dump_info->init_reserve_size - + phyp_dump_info->reserved_scratch_size; + return sprintf(buf, "CPU:0x%lx-0x%lx: HPTE:0x%lx-0x%lx:" + " DUMP:0x%lx-0x%lx, 0x%lx-0x%lx:\n", + phdr.cpu_data.destination_address, + phdr.cpu_data.length_copied, + phdr.hpte_data.destination_address, + phdr.hpte_data.length_copied, + phdr.kernel_data.destination_address, + phdr.kernel_data.length_copied, + phyp_dump_info->init_reserve_start, + second_addr_range); +} + static struct kobj_attribute rr = __ATTR(release_region, 0600, - NULL, store_release_region); + show_release_region, + store_release_region); static int __init phyp_dump_setup(void) { @@ -313,6 +368,22 @@ static int __init phyp_dump_setup(void) return 0; } + /* re-register the dump area, if old dump was invalid */ + if ((dump_header) && (dump_header->status & DUMP_ERROR_FLAG)) { + invalidate_last_dump(&phdr, dump_area_start); + register_dump_area(&phdr, dump_area_start); + return 0; + } + + if (dump_header) { + phyp_dump_info->reserved_scratch_addr = + dump_header->cpu_data.destination_address; + phyp_dump_info->reserved_scratch_size = + dump_header->cpu_data.source_length + + dump_header->hpte_data.source_length + + dump_header->kernel_data.source_length; + } + /* Should we create a dump_subsys, analogous to s390/ipl.c ? */ rc = sysfs_create_file(kernel_kobj, &rr.attr); if (rc) -- cgit v1.2.3 From fd35cff8d285c6ae30c66a70321ebbcd2a4615ec Mon Sep 17 00:00:00 2001 From: Manish Ahuja Date: Sat, 22 Mar 2008 10:47:04 +1100 Subject: [POWERPC] pseries: phyp dump: Tracking memory range freed This tracks the size freed. For now it does a simple rudimentary calculation of the ranges freed. The idea is to keep it simple at the external shell script level and send in large chunks for now. Signed-off-by: Manish Ahuja Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/phyp_dump.c | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pseries/phyp_dump.c b/arch/powerpc/platforms/pseries/phyp_dump.c index df4870ec90d8..034fe1b54dd9 100644 --- a/arch/powerpc/platforms/pseries/phyp_dump.c +++ b/arch/powerpc/platforms/pseries/phyp_dump.c @@ -261,6 +261,39 @@ static void release_memory_range(unsigned long start_pfn, } } +/** + * track_freed_range -- Counts the range being freed. + * Once the counter goes to zero, it re-registers dump for + * future use. + */ +static void +track_freed_range(unsigned long addr, unsigned long length) +{ + static unsigned long scratch_area_size, reserved_area_size; + + if (addr < phyp_dump_info->init_reserve_start) + return; + + if ((addr >= phyp_dump_info->init_reserve_start) && + (addr <= phyp_dump_info->init_reserve_start + + phyp_dump_info->init_reserve_size)) + reserved_area_size += length; + + if ((addr >= phyp_dump_info->reserved_scratch_addr) && + (addr <= phyp_dump_info->reserved_scratch_addr + + phyp_dump_info->reserved_scratch_size)) + scratch_area_size += length; + + if ((reserved_area_size == phyp_dump_info->init_reserve_size) && + (scratch_area_size == phyp_dump_info->reserved_scratch_size)) { + + invalidate_last_dump(&phdr, + phyp_dump_info->reserved_scratch_addr); + register_dump_area(&phdr, + phyp_dump_info->reserved_scratch_addr); + } +} + /* ------------------------------------------------- */ /** * sysfs_release_region -- sysfs interface to release memory range. @@ -285,6 +318,8 @@ static ssize_t store_release_region(struct kobject *kobj, if (ret != 2) return -EINVAL; + track_freed_range(start_addr, length); + /* Range-check - don't free any reserved memory that * wasn't reserved for phyp-dump */ if (start_addr < phyp_dump_info->init_reserve_start) -- cgit v1.2.3 From 654f596da4a83a8d2734fba26c2a1257533e6d75 Mon Sep 17 00:00:00 2001 From: Manish Ahuja Date: Sat, 22 Mar 2008 11:38:59 +1100 Subject: [POWERPC] pseries: phyp dump: Disable phyp-dump through boot-var This adds a kernel command line option "phyp_dump", which takes a 0/1 value for disabling/ enabling phyp_dump at boot time. Kdump can use this on cmdline (phyp_dump=0) to disable phyp-dump during boot when enabling itself. This will ensure only one dumping mechanism is active at any given time. Signed-off-by: Manish Ahuja Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/phyp_dump.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pseries/phyp_dump.c b/arch/powerpc/platforms/pseries/phyp_dump.c index 034fe1b54dd9..f80f8606c6b8 100644 --- a/arch/powerpc/platforms/pseries/phyp_dump.c +++ b/arch/powerpc/platforms/pseries/phyp_dump.c @@ -460,3 +460,21 @@ int __init early_init_dt_scan_phyp_dump(unsigned long node, *((unsigned long *)&sizes[4]); return 1; } + +/* Look for phyp_dump= cmdline option */ +static int __init early_phyp_dump_enabled(char *p) +{ + phyp_dump_info->phyp_dump_at_boot = 1; + + if (!p) + return 0; + + if (strncmp(p, "1", 1) == 0) + phyp_dump_info->phyp_dump_at_boot = 1; + else if (strncmp(p, "0", 1) == 0) + phyp_dump_info->phyp_dump_at_boot = 0; + + return 0; +} +early_param("phyp_dump", early_phyp_dump_enabled); + -- cgit v1.2.3 From 7415d5e0bec6ecd79d2698ae9655b10be47d8aa8 Mon Sep 17 00:00:00 2001 From: Manish Ahuja Date: Sat, 22 Mar 2008 11:40:53 +1100 Subject: [POWERPC] pseries: phyp dump: Inform kdump when phyp-dump is loaded This adds /sys/kernel/phyp_dump_active so that kdump init scripts may look for it and take appropriate action if this file is found. This file is only created when phyp_dump has been registered. Signed-off-by: Manish Ahuja Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/phyp_dump.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pseries/phyp_dump.c b/arch/powerpc/platforms/pseries/phyp_dump.c index f80f8606c6b8..7ddd10526cea 100644 --- a/arch/powerpc/platforms/pseries/phyp_dump.c +++ b/arch/powerpc/platforms/pseries/phyp_dump.c @@ -182,6 +182,18 @@ static void print_dump_header(const struct phyp_dump_header *ph) #endif } +static ssize_t show_phyp_dump_active(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + + /* create filesystem entry so kdump is phyp-dump aware */ + return sprintf(buf, "%lx\n", phyp_dump_info->phyp_dump_at_boot); +} + +static struct kobj_attribute pdl = __ATTR(phyp_dump_active, 0600, + show_phyp_dump_active, + NULL); + static void register_dump_area(struct phyp_dump_header *ph, unsigned long addr) { int rc; @@ -204,7 +216,13 @@ static void register_dump_area(struct phyp_dump_header *ph, unsigned long addr) printk(KERN_ERR "phyp-dump: unexpected error (%d) on " "register\n", rc); print_dump_header(ph); + return; } + + rc = sysfs_create_file(kernel_kobj, &pdl.attr); + if (rc) + printk(KERN_ERR "phyp-dump: unable to create sysfs" + " file (%d)\n", rc); } static -- cgit v1.2.3 From f61fb8a52cdf8b9b6a6badde84aefe58cb35d315 Mon Sep 17 00:00:00 2001 From: Nathan Lynch Date: Mon, 24 Mar 2008 09:51:45 +1100 Subject: [POWERPC] scanlog_init cleanup and minor fixes scanlog_init() could use some love. * properly return -ENODEV if this system doesn't support scan-log-dump * don't printk if scan-log-dump not present; only older systems have it * convert from create_proc_entry() to preferred proc_create() * allocate zeroed data buffer * fix potential memory leak of ent->data on failed create_proc_entry() * simplify control flow Signed-off-by: Nathan Lynch Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/scanlog.c | 37 ++++++++++++++++---------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c index 8e1ef168e2dd..e5b0ea870164 100644 --- a/arch/powerpc/platforms/pseries/scanlog.c +++ b/arch/powerpc/platforms/pseries/scanlog.c @@ -195,31 +195,30 @@ const struct file_operations scanlog_fops = { static int __init scanlog_init(void) { struct proc_dir_entry *ent; + void *data; + int err = -ENOMEM; ibm_scan_log_dump = rtas_token("ibm,scan-log-dump"); - if (ibm_scan_log_dump == RTAS_UNKNOWN_SERVICE) { - printk(KERN_ERR "scan-log-dump not implemented on this system\n"); - return -EIO; - } + if (ibm_scan_log_dump == RTAS_UNKNOWN_SERVICE) + return -ENODEV; - ent = create_proc_entry("ppc64/rtas/scan-log-dump", S_IRUSR, NULL); - if (ent) { - ent->proc_fops = &scanlog_fops; - /* Ideally we could allocate a buffer < 4G */ - ent->data = kmalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL); - if (!ent->data) { - printk(KERN_ERR "Failed to allocate a buffer\n"); - remove_proc_entry("scan-log-dump", ent->parent); - return -ENOMEM; - } - ((unsigned int *)ent->data)[0] = 0; - } else { - printk(KERN_ERR "Failed to create ppc64/scan-log-dump proc entry\n"); - return -EIO; - } + /* Ideally we could allocate a buffer < 4G */ + data = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL); + if (!data) + goto err; + + ent = proc_create("ppc64/rtas/scan-log-dump", S_IRUSR, NULL, + &scanlog_fops); + if (!ent) + goto err; + + ent->data = data; proc_ppc64_scan_log_dump = ent; return 0; +err: + kfree(data); + return err; } static void __exit scanlog_cleanup(void) -- cgit v1.2.3 From 66e4b3341d722d464fea627f7c0b7273d4f2912b Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Sun, 24 Feb 2008 08:07:52 +1100 Subject: [POWERPC] 4xx: Add AMCC Canyonlands 460EX eval board support to platforms/44x Canyonlands is the AMCC 460EX eval board, featuring nearly all of the 460EX interfaces: - 1 * PCI (max 66MHz), 2 * PCIe (one 4-lane, one 1-lane) - 2 * GBit Ethernet with TCP/IP acceleration - USB 2.0 Host/Device OTG and Host interface - SATA port Signed-off-by: Stefan Roese Signed-off-by: Josh Boyer --- arch/powerpc/platforms/44x/Kconfig | 18 +++++++++ arch/powerpc/platforms/44x/Makefile | 1 + arch/powerpc/platforms/44x/canyonlands.c | 64 ++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 arch/powerpc/platforms/44x/canyonlands.c (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig index 1bfb2191010a..83155fe29eba 100644 --- a/arch/powerpc/platforms/44x/Kconfig +++ b/arch/powerpc/platforms/44x/Kconfig @@ -67,6 +67,16 @@ config WARP See http://www.pikatechnologies.com/ and follow the "PIKA for Computer Telephony Developers" link for more information. +config CANYONLANDS + bool "Canyonlands" + depends on 44x + default n + select 460EX + select PCI + select PPC4xx_PCI_EXPRESS + help + This option enables support for the AMCC PPC460EX evaluation board. + #config LUAN # bool "Luan" # depends on 44x @@ -122,6 +132,14 @@ config 440SPe bool select IBM_NEW_EMAC_EMAC4 +config 460EX + bool + select PPC_FPU + select IBM_NEW_EMAC_EMAC4 + select IBM_NEW_EMAC_RGMII + select IBM_NEW_EMAC_ZMII + select IBM_NEW_EMAC_TAH + # 44x errata/workaround config symbols, selected by the CPU models above config IBM440EP_ERR42 bool diff --git a/arch/powerpc/platforms/44x/Makefile b/arch/powerpc/platforms/44x/Makefile index 0864d4f1cbc2..d70eb0341de3 100644 --- a/arch/powerpc/platforms/44x/Makefile +++ b/arch/powerpc/platforms/44x/Makefile @@ -7,3 +7,4 @@ obj-$(CONFIG_KATMAI) += katmai.o obj-$(CONFIG_RAINIER) += rainier.o obj-$(CONFIG_WARP) += warp.o obj-$(CONFIG_WARP) += warp-nand.o +obj-$(CONFIG_CANYONLANDS) += canyonlands.o diff --git a/arch/powerpc/platforms/44x/canyonlands.c b/arch/powerpc/platforms/44x/canyonlands.c new file mode 100644 index 000000000000..dac5b3203696 --- /dev/null +++ b/arch/powerpc/platforms/44x/canyonlands.c @@ -0,0 +1,64 @@ +/* + * Canyonlands board specific routines + * + * Copyright 2008 DENX Software Engineering, Stefan Roese + * + * Based on the Katmai code by + * Benjamin Herrenschmidt + * Copyright 2007 IBM Corp. + * Josh Boyer + * Copyright 2007 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. + */ +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "44x.h" + +static __initdata struct of_device_id canyonlands_of_bus[] = { + { .compatible = "ibm,plb4", }, + { .compatible = "ibm,opb", }, + { .compatible = "ibm,ebc", }, + {}, +}; + +static int __init canyonlands_device_probe(void) +{ + of_platform_bus_probe(NULL, canyonlands_of_bus, NULL); + + return 0; +} +machine_device_initcall(canyonlands, canyonlands_device_probe); + +static int __init canyonlands_probe(void) +{ + unsigned long root = of_get_flat_dt_root(); + + if (!of_flat_dt_is_compatible(root, "amcc,canyonlands")) + return 0; + + ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC; + + return 1; +} + +define_machine(canyonlands) { + .name = "Canyonlands", + .probe = canyonlands_probe, + .progress = udbg_progress, + .init_IRQ = uic_init_tree, + .get_irq = uic_get_irq, + .restart = ppc44x_reset_system, + .calibrate_decr = generic_calibrate_decr, +}; -- cgit v1.2.3 From ed70854a4f45d089bd8ef2e8476dbed6287b2ff7 Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Thu, 6 Mar 2008 21:15:42 -0600 Subject: [POWERPC] 4xx: Add platform support for the AMCC Yosemite board The AMCC 440EP Yosemite board is very similar to the original AMCC Bamboo board. This adds a YOSEMITE option to Kconfig, and reuses the existing bamboo board support in the kernel. Signed-off-by: Josh Boyer --- arch/powerpc/platforms/44x/Kconfig | 9 +++++++++ arch/powerpc/platforms/44x/Makefile | 1 + 2 files changed, 10 insertions(+) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig index 83155fe29eba..6abe91357eee 100644 --- a/arch/powerpc/platforms/44x/Kconfig +++ b/arch/powerpc/platforms/44x/Kconfig @@ -77,6 +77,15 @@ config CANYONLANDS help This option enables support for the AMCC PPC460EX evaluation board. +config YOSEMITE + bool "Yosemite" + depends on 44x + default n + select 440EP + select PCI + help + This option enables support for the AMCC PPC440EP evaluation board. + #config LUAN # bool "Luan" # depends on 44x diff --git a/arch/powerpc/platforms/44x/Makefile b/arch/powerpc/platforms/44x/Makefile index d70eb0341de3..2320ae5dc8a7 100644 --- a/arch/powerpc/platforms/44x/Makefile +++ b/arch/powerpc/platforms/44x/Makefile @@ -2,6 +2,7 @@ obj-$(CONFIG_44x) := misc_44x.o obj-$(CONFIG_EBONY) += ebony.o obj-$(CONFIG_TAISHAN) += taishan.o obj-$(CONFIG_BAMBOO) += bamboo.o +obj-$(CONFIG_YOSEMITE) += bamboo.o obj-$(CONFIG_SEQUOIA) += sequoia.o obj-$(CONFIG_KATMAI) += katmai.o obj-$(CONFIG_RAINIER) += rainier.o -- cgit v1.2.3 From 2a7069190e7a7f19bd37e8c08e2bf02c8d6330f7 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Wed, 26 Mar 2008 22:39:50 +1100 Subject: [POWERPC] 4xx: Add PPC4xx L2-cache support (440GX) This patch adds support for the 256k L2 cache found on some IBM/AMCC 4xx PPC's. It introduces a common 4xx SoC file (sysdev/ppc4xx_soc.c) which currently "only" adds the L2 cache init code. Other common 4xx stuff can be added later here. The L2 cache handling code is a copy of Eugene's code in arch/ppc with small modifications. Tested on AMCC Taishan 440GX. Signed-off-by: Stefan Roese Signed-off-by: Josh Boyer --- arch/powerpc/platforms/44x/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig index 6abe91357eee..5fc28aa459e3 100644 --- a/arch/powerpc/platforms/44x/Kconfig +++ b/arch/powerpc/platforms/44x/Kconfig @@ -129,6 +129,7 @@ config 440GP config 440GX bool + select 4xx_SOC select IBM_NEW_EMAC_EMAC4 select IBM_NEW_EMAC_RGMII select IBM_NEW_EMAC_ZMII #test only -- cgit v1.2.3 From 22b619eee525371a65d1386e5d6439b26d9b024c Mon Sep 17 00:00:00 2001 From: Alexandr Smirnov Date: Thu, 6 Mar 2008 18:17:16 +0300 Subject: [POWERPC] 85xx: Emerson KSI8560 base support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The KSI8560 is a single compact, mid-, or full-size Advanced Mezzanine Card (AdvancedMC™) based on the Freescale™ Semiconductor MPC8560 PowerQUICC III™ microprocessor. This product will serve in data and signaling applications such as signaling gateways (SGW) and softswitch signaling interface cards. The board has altera maxii CPLD, that is used to obtain and manage board configuration. Also there are two SCC UART serial consoles and FCC ethernet, that is routed to the front panel, while other ethernet controlers (TSEC's) are routed to the backplane. Signed-off-by: Alexandr Smirnov Signed-off-by: Kumar Gala --- arch/powerpc/platforms/85xx/Kconfig | 7 + arch/powerpc/platforms/85xx/Makefile | 1 + arch/powerpc/platforms/85xx/ksi8560.c | 257 ++++++++++++++++++++++++++++++++++ 3 files changed, 265 insertions(+) create mode 100644 arch/powerpc/platforms/85xx/ksi8560.c (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig index 7e76ddbd5821..28bc6e58a970 100644 --- a/arch/powerpc/platforms/85xx/Kconfig +++ b/arch/powerpc/platforms/85xx/Kconfig @@ -46,6 +46,13 @@ config MPC85xx_DS help This option enables support for the MPC85xx DS (MPC8544 DS) board +config KSI8560 + bool "Emerson KSI8560" + select PPC_CPM_NEW_BINDING + select DEFAULT_UIMAGE + help + This option enables support for the Emerson KSI8560 board + config STX_GP3 bool "Silicon Turnkey Express GP3" help diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile index cb7af4ebd75f..6cea185f62b2 100644 --- a/arch/powerpc/platforms/85xx/Makefile +++ b/arch/powerpc/platforms/85xx/Makefile @@ -10,3 +10,4 @@ obj-$(CONFIG_STX_GP3) += stx_gp3.o obj-$(CONFIG_TQM85xx) += tqm85xx.o obj-$(CONFIG_SBC8560) += sbc8560.o obj-$(CONFIG_SBC8548) += sbc8548.o +obj-$(CONFIG_KSI8560) += ksi8560.o diff --git a/arch/powerpc/platforms/85xx/ksi8560.c b/arch/powerpc/platforms/85xx/ksi8560.c new file mode 100644 index 000000000000..2145adeb220c --- /dev/null +++ b/arch/powerpc/platforms/85xx/ksi8560.c @@ -0,0 +1,257 @@ +/* + * Board setup routines for the Emerson KSI8560 + * + * Author: Alexandr Smirnov + * + * Based on mpc85xx_ads.c maintained by Kumar Gala + * + * 2008 (c) MontaVista, Software, Inc. This file is licensed under + * the terms of the GNU General Public License version 2. This program + * is licensed "as is" without any warranty of any kind, whether express + * or implied. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + + +#define KSI8560_CPLD_HVR 0x04 /* Hardware Version Register */ +#define KSI8560_CPLD_PVR 0x08 /* PLD Version Register */ +#define KSI8560_CPLD_RCR1 0x30 /* Reset Command Register 1 */ + +#define KSI8560_CPLD_RCR1_CPUHR 0x80 /* CPU Hard Reset */ + +static void __iomem *cpld_base = NULL; + +static void machine_restart(char *cmd) +{ + if (cpld_base) + out_8(cpld_base + KSI8560_CPLD_RCR1, KSI8560_CPLD_RCR1_CPUHR); + else + printk(KERN_ERR "Can't find CPLD base, hang forever\n"); + + for (;;); +} + +static void cpm2_cascade(unsigned int irq, struct irq_desc *desc) +{ + int cascade_irq; + + while ((cascade_irq = cpm2_get_irq()) >= 0) + generic_handle_irq(cascade_irq); + + desc->chip->eoi(irq); +} + +static void __init ksi8560_pic_init(void) +{ + struct mpic *mpic; + struct resource r; + struct device_node *np; +#ifdef CONFIG_CPM2 + int irq; +#endif + + np = of_find_node_by_type(NULL, "open-pic"); + + if (np == NULL) { + printk(KERN_ERR "Could not find open-pic node\n"); + return; + } + + if (of_address_to_resource(np, 0, &r)) { + printk(KERN_ERR "Could not map mpic register space\n"); + of_node_put(np); + return; + } + + mpic = mpic_alloc(np, r.start, + MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN, + 0, 256, " OpenPIC "); + BUG_ON(mpic == NULL); + of_node_put(np); + + mpic_init(mpic); + +#ifdef CONFIG_CPM2 + /* Setup CPM2 PIC */ + np = of_find_compatible_node(NULL, NULL, "fsl,cpm2-pic"); + if (np == NULL) { + printk(KERN_ERR "PIC init: can not find fsl,cpm2-pic node\n"); + return; + } + irq = irq_of_parse_and_map(np, 0); + + cpm2_pic_init(np); + of_node_put(np); + set_irq_chained_handler(irq, cpm2_cascade); + + setup_irq(0, NULL); +#endif +} + +#ifdef CONFIG_CPM2 +/* + * Setup I/O ports + */ +struct cpm_pin { + int port, pin, flags; +}; + +static struct cpm_pin __initdata ksi8560_pins[] = { + /* SCC1 */ + {3, 29, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, + {3, 30, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY}, + {3, 31, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, + + /* SCC2 */ + {3, 26, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, + {3, 27, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, + {3, 28, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, + + /* FCC1 */ + {0, 14, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, + {0, 15, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, + {0, 16, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, + {0, 17, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, + {0, 18, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, + {0, 19, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, + {0, 20, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, + {0, 21, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, + {0, 26, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, + {0, 27, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, + {0, 28, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY}, + {0, 29, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY}, + {0, 30, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, + {0, 31, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, + {2, 23, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* CLK9 */ + {2, 22, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* CLK10 */ + +}; + +static void __init init_ioports(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(ksi8560_pins); i++) { + struct cpm_pin *pin = &ksi8560_pins[i]; + cpm2_set_pin(pin->port, pin->pin, pin->flags); + } + + cpm2_clk_setup(CPM_CLK_SCC1, CPM_BRG1, CPM_CLK_RX); + cpm2_clk_setup(CPM_CLK_SCC1, CPM_BRG1, CPM_CLK_TX); + cpm2_clk_setup(CPM_CLK_SCC2, CPM_BRG2, CPM_CLK_RX); + cpm2_clk_setup(CPM_CLK_SCC2, CPM_BRG2, CPM_CLK_TX); + cpm2_clk_setup(CPM_CLK_FCC1, CPM_CLK9, CPM_CLK_RX); + cpm2_clk_setup(CPM_CLK_FCC1, CPM_CLK10, CPM_CLK_TX); +} +#endif + +/* + * Setup the architecture + */ +static void __init ksi8560_setup_arch(void) +{ + struct device_node *cpld; + + cpld = of_find_compatible_node(NULL, NULL, "emerson,KSI8560-cpld"); + if (cpld) + cpld_base = of_iomap(cpld, 0); + else + printk(KERN_ERR "Can't find CPLD in device tree\n"); + + if (ppc_md.progress) + ppc_md.progress("ksi8560_setup_arch()", 0); + +#ifdef CONFIG_CPM2 + cpm2_reset(); + init_ioports(); +#endif +} + +static void ksi8560_show_cpuinfo(struct seq_file *m) +{ + uint pvid, svid, phid1; + uint memsize = total_memory; + + pvid = mfspr(SPRN_PVR); + svid = mfspr(SPRN_SVR); + + seq_printf(m, "Vendor\t\t: Emerson Network Power\n"); + seq_printf(m, "Board\t\t: KSI8560\n"); + + if (cpld_base) { + seq_printf(m, "Hardware rev\t: %d\n", + in_8(cpld_base + KSI8560_CPLD_HVR)); + seq_printf(m, "CPLD rev\t: %d\n", + in_8(cpld_base + KSI8560_CPLD_PVR)); + } else + seq_printf(m, "Unknown Hardware and CPLD revs\n"); + + seq_printf(m, "PVR\t\t: 0x%x\n", pvid); + seq_printf(m, "SVR\t\t: 0x%x\n", svid); + + /* Display cpu Pll setting */ + phid1 = mfspr(SPRN_HID1); + seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); + + /* Display the amount of memory */ + seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024)); +} + +static struct of_device_id __initdata of_bus_ids[] = { + { .type = "soc", }, + { .name = "cpm", }, + { .name = "localbus", }, + {}, +}; + +static int __init declare_of_platform_devices(void) +{ + of_platform_bus_probe(NULL, of_bus_ids, NULL); + + return 0; +} +machine_device_initcall(ksi8560, declare_of_platform_devices); + +/* + * Called very early, device-tree isn't unflattened + */ +static int __init ksi8560_probe(void) +{ + unsigned long root = of_get_flat_dt_root(); + + return of_flat_dt_is_compatible(root, "emerson,KSI8560"); +} + +define_machine(ksi8560) { + .name = "KSI8560", + .probe = ksi8560_probe, + .setup_arch = ksi8560_setup_arch, + .init_IRQ = ksi8560_pic_init, + .show_cpuinfo = ksi8560_show_cpuinfo, + .get_irq = mpic_get_irq, + .restart = machine_restart, + .calibrate_decr = generic_calibrate_decr, +}; -- cgit v1.2.3 From af8b44e01b4e5a94cb665f6b958f5a5bc4025b0e Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Tue, 25 Mar 2008 13:15:11 +1100 Subject: [POWERPC] spufs: add newline to signal{1,2}_type files All of the single-value files in spufs are terminated by a newline, except for signal1_type and signal2_type. This change adds a trailing newline to these two files. Signed-off-by: Jeremy Kerr --- arch/powerpc/platforms/cell/spufs/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c index f7a7e8635fb6..189933e3a94d 100644 --- a/arch/powerpc/platforms/cell/spufs/file.c +++ b/arch/powerpc/platforms/cell/spufs/file.c @@ -1337,7 +1337,7 @@ static u64 spufs_signal1_type_get(struct spu_context *ctx) return ctx->ops->signal1_type_get(ctx); } DEFINE_SPUFS_ATTRIBUTE(spufs_signal1_type, spufs_signal1_type_get, - spufs_signal1_type_set, "%llu", SPU_ATTR_ACQUIRE); + spufs_signal1_type_set, "%llu\n", SPU_ATTR_ACQUIRE); static int spufs_signal2_type_set(void *data, u64 val) @@ -1359,7 +1359,7 @@ static u64 spufs_signal2_type_get(struct spu_context *ctx) return ctx->ops->signal2_type_get(ctx); } DEFINE_SPUFS_ATTRIBUTE(spufs_signal2_type, spufs_signal2_type_get, - spufs_signal2_type_set, "%llu", SPU_ATTR_ACQUIRE); + spufs_signal2_type_set, "%llu\n", SPU_ATTR_ACQUIRE); #if SPUFS_MMAP_4K static unsigned long spufs_mss_mmap_nopfn(struct vm_area_struct *vma, -- cgit v1.2.3 From 4eb5aef583aab29dc125b6c2feb0b31f2e350c45 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Tue, 25 Mar 2008 13:32:03 +1100 Subject: [POWERPC] spufs: reacquire LS pointer in spu_process_callback During spu_process callback, we release then acquire the SPU, but keep a pointer to the local store memory. Since the context may have been scheduled out during the callback, the ls pointer may become invalid. This change reacquires the pointer to the context local store after spu_acquire()-ing, so that it isn't invalidated by a context switch. Signed-off-by: Jeremy Kerr --- arch/powerpc/platforms/cell/spufs/run.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c index cac69e116776..2619f14546a3 100644 --- a/arch/powerpc/platforms/cell/spufs/run.c +++ b/arch/powerpc/platforms/cell/spufs/run.c @@ -323,6 +323,10 @@ static int spu_process_callback(struct spu_context *ctx) return -EINTR; } + /* need to re-get the ls, as it may have changed when we released the + * spu */ + ls = (void __iomem *)ctx->ops->get_ls(ctx); + /* write result, jump over indirect pointer */ memcpy_toio(ls + ls_pointer, &spu_ret, sizeof(spu_ret)); ctx->ops->npc_write(ctx, npc); -- cgit v1.2.3 From 36d29edb6dded938bf07f741a0bb0f2a7116e617 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Thu, 27 Mar 2008 14:59:58 +1100 Subject: [POWERPC] spufs: save MFC command channel before purging MFC queue During the context save process, we currently save the MFC command channel after purging the MFC queues. This causes a systemsim warning, as the command channel may be in an unknown state after the purge. This change does the save before purging the MFC queues. Signed-off-by: Jeremy Kerr --- arch/powerpc/platforms/cell/spufs/switch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/cell/spufs/switch.c b/arch/powerpc/platforms/cell/spufs/switch.c index e9dc7a55d1b9..d2a1249d36dd 100644 --- a/arch/powerpc/platforms/cell/spufs/switch.c +++ b/arch/powerpc/platforms/cell/spufs/switch.c @@ -1815,6 +1815,7 @@ static void save_csa(struct spu_state *prev, struct spu *spu) save_mfc_csr_ato(prev, spu); /* Step 24. */ save_mfc_tclass_id(prev, spu); /* Step 25. */ set_mfc_tclass_id(prev, spu); /* Step 26. */ + save_mfc_cmd(prev, spu); /* Step 26a - moved from 44. */ purge_mfc_queue(prev, spu); /* Step 27. */ wait_purge_complete(prev, spu); /* Step 28. */ setup_mfc_sr1(prev, spu); /* Step 30. */ @@ -1831,7 +1832,6 @@ static void save_csa(struct spu_state *prev, struct spu *spu) save_ppuint_mb(prev, spu); /* Step 41. */ save_ch_part1(prev, spu); /* Step 42. */ save_spu_mb(prev, spu); /* Step 43. */ - save_mfc_cmd(prev, spu); /* Step 44. */ reset_ch(prev, spu); /* Step 45. */ } -- cgit v1.2.3 From ada397e93d6002021f5bf4ba060aa4ecd5dea3e5 Mon Sep 17 00:00:00 2001 From: Gerhard Stenzel Date: Fri, 28 Mar 2008 14:18:30 +1100 Subject: [POWERPC] spufs: fix incorrect file descriptors in SPU coredump note names At present, ppu-gdb can't trace spu infomation with coredump generated by the kernel. While the core dumps notes have correct contents, they have the wrong names, as the file descriptors used to generate the note names are off-by-one. An application that opens a SPE context as fd 3, the current core dump code will generate notes like: SPU/4/mem SPU/4/regs etc. This confuses GDB, which knows it is looking for SPE context 3 (from parsing the spu_context_run system call arguments), and cannot find any notes that match context 3. This change corrects the file descriptor counting, to only increment the fd until after we've written the note name. Signed-off-by: Gerhard Stenzel Signed-off-by: Jeremy Kerr --- arch/powerpc/platforms/cell/spufs/coredump.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c index 0c6a96b82b2d..b962c3ab470c 100644 --- a/arch/powerpc/platforms/cell/spufs/coredump.c +++ b/arch/powerpc/platforms/cell/spufs/coredump.c @@ -133,8 +133,6 @@ static struct spu_context *coredump_next_context(int *fd) if (ctx->flags & SPU_CREATE_NOSCHED) continue; - /* start searching the next fd next time we're called */ - (*fd)++; break; } @@ -157,6 +155,9 @@ int spufs_coredump_extra_notes_size(void) break; size += rc; + + /* start searching the next fd next time */ + fd++; } return size; @@ -239,6 +240,9 @@ int spufs_coredump_extra_notes_write(struct file *file, loff_t *foffset) } spu_release_saved(ctx); + + /* start searching the next fd next time */ + fd++; } return 0; -- cgit v1.2.3 From ad18c3db337c6307c7bfbe1f89ad6d92714ffc11 Mon Sep 17 00:00:00 2001 From: Roel Kluin <12o3l@tiscali.nl> Date: Thu, 27 Mar 2008 11:37:18 +1100 Subject: [POWERPC] PS3: Fix unlikely typo in ps3_get_irq Fix a typo bug 'unlikely(x) == y' and add an unlikely() call to an unlikely code path in the PS3 interrupt routine ps3_get_irq(). Signed-off-by: Roel Kluin <12o3l@tiscali.nl> Signed-off-by: Geoff Levand Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/ps3/interrupt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c index 3a6db04aa940..a14e5cdc2fed 100644 --- a/arch/powerpc/platforms/ps3/interrupt.c +++ b/arch/powerpc/platforms/ps3/interrupt.c @@ -709,7 +709,7 @@ static unsigned int ps3_get_irq(void) asm volatile("cntlzd %0,%1" : "=r" (plug) : "r" (x)); plug &= 0x3f; - if (unlikely(plug) == NO_IRQ) { + if (unlikely(plug == NO_IRQ)) { pr_debug("%s:%d: no plug found: thread_id %lu\n", __func__, __LINE__, pd->thread_id); dump_bmp(&per_cpu(ps3_private, 0)); -- cgit v1.2.3 From 23afcb4e0061c591776a3350db89512d085397c2 Mon Sep 17 00:00:00 2001 From: Takashi Yamamoto Date: Thu, 27 Mar 2008 11:37:38 +1100 Subject: [POWERPC] PS3: Add ps3_get_speid routine Add a new routine ps3_get_speid() which returns the logical SPE ID. This ID is needed for profiling support. Signed-off-by: Takashi Yamamoto Signed-off-by: Geoff Levand Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/ps3/spu.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/ps3/spu.c b/arch/powerpc/platforms/ps3/spu.c index 5ad41189b494..d135cef9ed6a 100644 --- a/arch/powerpc/platforms/ps3/spu.c +++ b/arch/powerpc/platforms/ps3/spu.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "../cell/spufs/spufs.h" #include "platform.h" @@ -140,6 +141,12 @@ static void _dump_areas(unsigned int spe_id, unsigned long priv2, pr_debug("%s:%d: shadow: %lxh\n", func, line, shadow); } +inline u64 ps3_get_spe_id(void *arg) +{ + return spu_pdata(arg)->spe_id; +} +EXPORT_SYMBOL_GPL(ps3_get_spe_id); + static unsigned long get_vas_id(void) { unsigned long id; -- cgit v1.2.3 From ca052f7924141f34998ab440bb4d908dc021a46b Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Thu, 27 Mar 2008 11:38:31 +1100 Subject: [POWERPC] PS3: Save power in busy loops on halt PS3 save power on halt: - Replace infinite busy loops by smarter loops calling lv1_pause() to save power. - Add ps3_halt() and ps3_sys_manager_halt(). - Add __noreturn annotations. Signed-off-by: Geert Uytterhoeven Signed-off-by: Geoff Levand Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/ps3/setup.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c index 5c2cbb08eb52..c144669a0d3f 100644 --- a/arch/powerpc/platforms/ps3/setup.c +++ b/arch/powerpc/platforms/ps3/setup.c @@ -95,6 +95,14 @@ static void ps3_power_off(void) ps3_sys_manager_power_off(); /* never returns */ } +static void ps3_halt(void) +{ + DBG("%s:%d\n", __func__, __LINE__); + + smp_send_stop(); + ps3_sys_manager_halt(); /* never returns */ +} + static void ps3_panic(char *str) { DBG("%s:%d %s\n", __func__, __LINE__, str); @@ -105,7 +113,8 @@ static void ps3_panic(char *str) printk(" Please press POWER button.\n"); printk("\n"); - while(1); + while(1) + lv1_pause(1); } #if defined(CONFIG_FB_PS3) || defined(CONFIG_FB_PS3_MODULE) || \ @@ -266,6 +275,7 @@ define_machine(ps3) { .progress = ps3_progress, .restart = ps3_restart, .power_off = ps3_power_off, + .halt = ps3_halt, #if defined(CONFIG_KEXEC) .kexec_cpu_down = ps3_kexec_cpu_down, .machine_kexec = default_machine_kexec, -- cgit v1.2.3 From b163a256dac8ceb01d40bebe25c315768cf1877b Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Sat, 29 Mar 2008 03:53:38 +1100 Subject: [POWERPC] PS3: Split device setup for static vs. dynamic devices Split the device setup code in ps3_register_repository_device() in two routines: 1. ps3_setup_static_device(), to handle the setup of static devices in the PS3 repository, which can be __init, 2. ps3_setup_dynamic_device(), to handle the setup of storage devices that may appear later in the PS3 repository. This fixes a few section mismatch warnings. Signed-off-by: Geert Uytterhoeven Signed-off-by: Geoff Levand Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/ps3/device-init.c | 78 +++++++++++++++++++------------- 1 file changed, 46 insertions(+), 32 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c index 9d251d0ca8c6..3866debfa3c4 100644 --- a/arch/powerpc/platforms/ps3/device-init.c +++ b/arch/powerpc/platforms/ps3/device-init.c @@ -499,41 +499,14 @@ static int __init ps3_register_graphics_devices(void) } /** - * ps3_register_repository_device - Register a device from the repositiory info. - * + * ps3_setup_dynamic_device - Setup a dynamic device from the repository */ -static int ps3_register_repository_device( - const struct ps3_repository_device *repo) +static int ps3_setup_dynamic_device(const struct ps3_repository_device *repo) { int result; switch (repo->dev_type) { - case PS3_DEV_TYPE_SB_GELIC: - result = ps3_setup_gelic_device(repo); - if (result) { - pr_debug("%s:%d ps3_setup_gelic_device failed\n", - __func__, __LINE__); - } - break; - case PS3_DEV_TYPE_SB_USB: - - /* Each USB device has both an EHCI and an OHCI HC */ - - result = ps3_setup_ehci_device(repo); - - if (result) { - pr_debug("%s:%d ps3_setup_ehci_device failed\n", - __func__, __LINE__); - } - - result = ps3_setup_ohci_device(repo); - - if (result) { - pr_debug("%s:%d ps3_setup_ohci_device failed\n", - __func__, __LINE__); - } - break; case PS3_DEV_TYPE_STOR_DISK: result = ps3_setup_storage_dev(repo, PS3_MATCH_ID_STOR_DISK); @@ -572,6 +545,48 @@ static int ps3_register_repository_device( return result; } +/** + * ps3_setup_static_device - Setup a static device from the repository + */ + +static int __init ps3_setup_static_device(const struct ps3_repository_device *repo) +{ + int result; + + switch (repo->dev_type) { + case PS3_DEV_TYPE_SB_GELIC: + result = ps3_setup_gelic_device(repo); + if (result) { + pr_debug("%s:%d ps3_setup_gelic_device failed\n", + __func__, __LINE__); + } + break; + case PS3_DEV_TYPE_SB_USB: + + /* Each USB device has both an EHCI and an OHCI HC */ + + result = ps3_setup_ehci_device(repo); + + if (result) { + pr_debug("%s:%d ps3_setup_ehci_device failed\n", + __func__, __LINE__); + } + + result = ps3_setup_ohci_device(repo); + + if (result) { + pr_debug("%s:%d ps3_setup_ohci_device failed\n", + __func__, __LINE__); + } + break; + + default: + return ps3_setup_dynamic_device(repo); + } + + return result; +} + static void ps3_find_and_add_device(u64 bus_id, u64 dev_id) { struct ps3_repository_device repo; @@ -601,7 +616,7 @@ found: pr_debug("%s:%u: device %lu:%lu found after %u retries\n", __func__, __LINE__, bus_id, dev_id, retries); - ps3_register_repository_device(&repo); + ps3_setup_dynamic_device(&repo); return; } @@ -905,8 +920,7 @@ static int __init ps3_register_devices(void) ps3_register_graphics_devices(); - ps3_repository_find_devices(PS3_BUS_TYPE_SB, - ps3_register_repository_device); + ps3_repository_find_devices(PS3_BUS_TYPE_SB, ps3_setup_static_device); ps3_register_sound_devices(); -- cgit v1.2.3 From e48b1b452ff630288c930fd8e0c2d808bc15f7ad Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Sat, 29 Mar 2008 08:21:07 +1100 Subject: [POWERPC] Replace remaining __FUNCTION__ occurrences __FUNCTION__ is gcc-specific, use __func__ Signed-off-by: Harvey Harrison Cc: Benjamin Herrenschmidt Signed-off-by: Andrew Morton Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/52xx/lite5200.c | 4 ++-- arch/powerpc/platforms/85xx/mpc85xx_ds.c | 2 +- arch/powerpc/platforms/cell/iommu.c | 8 ++++---- arch/powerpc/platforms/cell/pervasive.c | 2 +- arch/powerpc/platforms/cell/ras.c | 10 +++++----- arch/powerpc/platforms/cell/spu_base.c | 8 ++++---- arch/powerpc/platforms/cell/spu_callbacks.c | 2 +- arch/powerpc/platforms/cell/spu_manage.c | 8 ++++---- arch/powerpc/platforms/cell/spufs/file.c | 4 ++-- arch/powerpc/platforms/cell/spufs/run.c | 10 +++++----- arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c | 10 +++++----- arch/powerpc/platforms/ps3/setup.c | 2 +- arch/powerpc/platforms/pseries/pci_dlpar.c | 2 +- arch/powerpc/platforms/pseries/reconfig.c | 12 ++++++------ 14 files changed, 42 insertions(+), 42 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c index 956f459e175c..6d584f4e3c9a 100644 --- a/arch/powerpc/platforms/52xx/lite5200.c +++ b/arch/powerpc/platforms/52xx/lite5200.c @@ -63,7 +63,7 @@ lite5200_fix_clock_config(void) of_node_put(np); if (!cdm) { printk(KERN_ERR "%s() failed; expect abnormal behaviour\n", - __FUNCTION__); + __func__); return; } @@ -98,7 +98,7 @@ lite5200_fix_port_config(void) of_node_put(np); if (!gpio) { printk(KERN_ERR "%s() failed. expect abnormal behavior\n", - __FUNCTION__); + __func__); return; } diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c index bdb3d0b38cd2..2865d019afc3 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c @@ -36,7 +36,7 @@ #undef DEBUG #ifdef DEBUG -#define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args) +#define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args) #else #define DBG(fmt, args...) #endif diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index 49fe641d4345..45646b2b4af4 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c @@ -316,7 +316,7 @@ static void cell_iommu_setup_stab(struct cbe_iommu *iommu, segments = max(dbase + dsize, fbase + fsize) >> IO_SEGMENT_SHIFT; pr_debug("%s: iommu[%d]: segments: %lu\n", - __FUNCTION__, iommu->nid, segments); + __func__, iommu->nid, segments); /* set up the segment table */ stab_size = segments * sizeof(unsigned long); @@ -343,7 +343,7 @@ static unsigned long *cell_iommu_alloc_ptab(struct cbe_iommu *iommu, (1 << 12) / sizeof(unsigned long)); ptab_size = segments * pages_per_segment * sizeof(unsigned long); - pr_debug("%s: iommu[%d]: ptab_size: %lu, order: %d\n", __FUNCTION__, + pr_debug("%s: iommu[%d]: ptab_size: %lu, order: %d\n", __func__, iommu->nid, ptab_size, get_order(ptab_size)); page = alloc_pages_node(iommu->nid, GFP_KERNEL, get_order(ptab_size)); BUG_ON(!page); @@ -355,7 +355,7 @@ static unsigned long *cell_iommu_alloc_ptab(struct cbe_iommu *iommu, n_pte_pages = (pages_per_segment * sizeof(unsigned long)) >> 12; pr_debug("%s: iommu[%d]: stab at %p, ptab at %p, n_pte_pages: %lu\n", - __FUNCTION__, iommu->nid, iommu->stab, ptab, + __func__, iommu->nid, iommu->stab, ptab, n_pte_pages); /* initialise the STEs */ @@ -394,7 +394,7 @@ static void cell_iommu_enable_hardware(struct cbe_iommu *iommu) if (cell_iommu_find_ioc(iommu->nid, &xlate_base)) panic("%s: missing IOC register mappings for node %d\n", - __FUNCTION__, iommu->nid); + __func__, iommu->nid); iommu->xlate_regs = ioremap(xlate_base, IOC_Reg_Size); iommu->cmd_regs = iommu->xlate_regs + IOC_IOCmd_Offset; diff --git a/arch/powerpc/platforms/cell/pervasive.c b/arch/powerpc/platforms/cell/pervasive.c index 0304589c0a80..8a3631ce912b 100644 --- a/arch/powerpc/platforms/cell/pervasive.c +++ b/arch/powerpc/platforms/cell/pervasive.c @@ -65,7 +65,7 @@ static void cbe_power_save(void) break; default: printk(KERN_WARNING "%s: unknown configuration\n", - __FUNCTION__); + __func__); break; } mtspr(SPRN_TSC_CELL, thread_switch_control); diff --git a/arch/powerpc/platforms/cell/ras.c b/arch/powerpc/platforms/cell/ras.c index e43024c0392e..655704ad03cf 100644 --- a/arch/powerpc/platforms/cell/ras.c +++ b/arch/powerpc/platforms/cell/ras.c @@ -132,7 +132,7 @@ static int __init cbe_ptcal_enable_on_node(int nid, int order) (unsigned int)(addr >> 32), (unsigned int)(addr & 0xffffffff))) { printk(KERN_ERR "%s: error enabling PTCAL on node %d!\n", - __FUNCTION__, nid); + __func__, nid); goto out_free_pages; } @@ -162,7 +162,7 @@ static int __init cbe_ptcal_enable(void) if (!size) return -ENODEV; - pr_debug("%s: enabling PTCAL, size = 0x%x\n", __FUNCTION__, *size); + pr_debug("%s: enabling PTCAL, size = 0x%x\n", __func__, *size); order = get_order(*size); of_node_put(np); @@ -180,7 +180,7 @@ static int __init cbe_ptcal_enable(void) const u32 *nid = of_get_property(np, "node-id", NULL); if (!nid) { printk(KERN_ERR "%s: node %s is missing node-id?\n", - __FUNCTION__, np->full_name); + __func__, np->full_name); continue; } cbe_ptcal_enable_on_node(*nid, order); @@ -195,13 +195,13 @@ static int cbe_ptcal_disable(void) struct ptcal_area *area, *tmp; int ret = 0; - pr_debug("%s: disabling PTCAL\n", __FUNCTION__); + pr_debug("%s: disabling PTCAL\n", __func__); list_for_each_entry_safe(area, tmp, &ptcal_list, list) { /* disable ptcal on this node */ if (rtas_call(ptcal_stop_tok, 1, 1, NULL, area->nid)) { printk(KERN_ERR "%s: error disabling PTCAL " - "on node %d!\n", __FUNCTION__, + "on node %d!\n", __func__, area->nid); ret = -EIO; continue; diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c index 712001f6b7da..6bab44b7716b 100644 --- a/arch/powerpc/platforms/cell/spu_base.c +++ b/arch/powerpc/platforms/cell/spu_base.c @@ -165,7 +165,7 @@ static int __spu_trap_data_seg(struct spu *spu, unsigned long ea) struct spu_slb slb; int psize; - pr_debug("%s\n", __FUNCTION__); + pr_debug("%s\n", __func__); slb.esid = (ea & ESID_MASK) | SLB_ESID_V; @@ -215,7 +215,7 @@ static int __spu_trap_data_seg(struct spu *spu, unsigned long ea) extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap); //XXX static int __spu_trap_data_map(struct spu *spu, unsigned long ea, u64 dsisr) { - pr_debug("%s, %lx, %lx\n", __FUNCTION__, dsisr, ea); + pr_debug("%s, %lx, %lx\n", __func__, dsisr, ea); /* Handle kernel space hash faults immediately. User hash faults need to be deferred to process context. */ @@ -351,7 +351,7 @@ spu_irq_class_1(int irq, void *data) __spu_trap_data_seg(spu, dar); spin_unlock(&spu->register_lock); - pr_debug("%s: %lx %lx %lx %lx\n", __FUNCTION__, mask, stat, + pr_debug("%s: %lx %lx %lx %lx\n", __func__, mask, stat, dar, dsisr); if (stat & CLASS1_STORAGE_FAULT_INTR) @@ -726,7 +726,7 @@ static int __init init_spu_base(void) if (ret < 0) { printk(KERN_WARNING "%s: Error initializing spus\n", - __FUNCTION__); + __func__); goto out_unregister_sysdev_class; } diff --git a/arch/powerpc/platforms/cell/spu_callbacks.c b/arch/powerpc/platforms/cell/spu_callbacks.c index dceb8b6a9382..19f6bfdbb933 100644 --- a/arch/powerpc/platforms/cell/spu_callbacks.c +++ b/arch/powerpc/platforms/cell/spu_callbacks.c @@ -54,7 +54,7 @@ long spu_sys_callback(struct spu_syscall_block *s) long (*syscall)(u64 a1, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6); if (s->nr_ret >= ARRAY_SIZE(spu_syscall_table)) { - pr_debug("%s: invalid syscall #%ld", __FUNCTION__, s->nr_ret); + pr_debug("%s: invalid syscall #%ld", __func__, s->nr_ret); return -ENOSYS; } diff --git a/arch/powerpc/platforms/cell/spu_manage.c b/arch/powerpc/platforms/cell/spu_manage.c index d351bdebf5f1..4c506c1463cd 100644 --- a/arch/powerpc/platforms/cell/spu_manage.c +++ b/arch/powerpc/platforms/cell/spu_manage.c @@ -92,7 +92,7 @@ static int __init spu_map_interrupts_old(struct spu *spu, tmp = of_get_property(np->parent->parent, "node-id", NULL); if (!tmp) { - printk(KERN_WARNING "%s: can't find node-id\n", __FUNCTION__); + printk(KERN_WARNING "%s: can't find node-id\n", __func__); nid = spu->node; } else nid = tmp[0]; @@ -296,7 +296,7 @@ static int __init of_enumerate_spus(int (*fn)(void *data)) ret = fn(node); if (ret) { printk(KERN_WARNING "%s: Error initializing %s\n", - __FUNCTION__, node->name); + __func__, node->name); break; } n++; @@ -327,7 +327,7 @@ static int __init of_create_spu(struct spu *spu, void *data) if (!legacy_map) { legacy_map = 1; printk(KERN_WARNING "%s: Legacy device tree found, " - "trying to map old style\n", __FUNCTION__); + "trying to map old style\n", __func__); } ret = spu_map_device_old(spu); if (ret) { @@ -342,7 +342,7 @@ static int __init of_create_spu(struct spu *spu, void *data) if (!legacy_irq) { legacy_irq = 1; printk(KERN_WARNING "%s: Legacy device tree found, " - "trying old style irq\n", __FUNCTION__); + "trying old style irq\n", __func__); } ret = spu_map_interrupts_old(spu, spe); if (ret) { diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c index f7a7e8635fb6..f14d3a0a8615 100644 --- a/arch/powerpc/platforms/cell/spufs/file.c +++ b/arch/powerpc/platforms/cell/spufs/file.c @@ -1556,7 +1556,7 @@ void spufs_mfc_callback(struct spu *spu) wake_up_all(&ctx->mfc_wq); - pr_debug("%s %s\n", __FUNCTION__, spu->name); + pr_debug("%s %s\n", __func__, spu->name); if (ctx->mfc_fasync) { u32 free_elements, tagstatus; unsigned int mask; @@ -1790,7 +1790,7 @@ static unsigned int spufs_mfc_poll(struct file *file,poll_table *wait) if (tagstatus & ctx->tagwait) mask |= POLLIN | POLLRDNORM; - pr_debug("%s: free %d tagstatus %d tagwait %d\n", __FUNCTION__, + pr_debug("%s: free %d tagstatus %d tagwait %d\n", __func__, free_elements, tagstatus, ctx->tagwait); return mask; diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c index cac69e116776..5986d08115af 100644 --- a/arch/powerpc/platforms/cell/spufs/run.c +++ b/arch/powerpc/platforms/cell/spufs/run.c @@ -98,7 +98,7 @@ static int spu_setup_isolated(struct spu_context *ctx) != MFC_CNTL_PURGE_DMA_COMPLETE) { if (time_after(jiffies, timeout)) { printk(KERN_ERR "%s: timeout flushing MFC DMA queue\n", - __FUNCTION__); + __func__); ret = -EIO; goto out; } @@ -124,7 +124,7 @@ static int spu_setup_isolated(struct spu_context *ctx) status_loading) { if (time_after(jiffies, timeout)) { printk(KERN_ERR "%s: timeout waiting for loader\n", - __FUNCTION__); + __func__); ret = -EIO; goto out_drop_priv; } @@ -134,7 +134,7 @@ static int spu_setup_isolated(struct spu_context *ctx) if (!(status & SPU_STATUS_RUNNING)) { /* If isolated LOAD has failed: run SPU, we will get a stop-and * signal later. */ - pr_debug("%s: isolated LOAD failed\n", __FUNCTION__); + pr_debug("%s: isolated LOAD failed\n", __func__); ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE); ret = -EACCES; goto out_drop_priv; @@ -142,7 +142,7 @@ static int spu_setup_isolated(struct spu_context *ctx) if (!(status & SPU_STATUS_ISOLATED_STATE)) { /* This isn't allowed by the CBEA, but check anyway */ - pr_debug("%s: SPU fell out of isolated mode?\n", __FUNCTION__); + pr_debug("%s: SPU fell out of isolated mode?\n", __func__); ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_STOP); ret = -EINVAL; goto out_drop_priv; @@ -282,7 +282,7 @@ static int spu_handle_restartsys(struct spu_context *ctx, long *spu_ret, break; default: printk(KERN_WARNING "%s: unexpected return code %ld\n", - __FUNCTION__, *spu_ret); + __func__, *spu_ret); ret = 0; } return ret; diff --git a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c index d4f8bf581e3a..84e2d78b9a62 100644 --- a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c +++ b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c @@ -117,11 +117,11 @@ static void __init mpc7448_hpc2_init_IRQ(void) } if (mpic_paddr == 0) { - printk("%s: No tsi108 PIC found !\n", __FUNCTION__); + printk("%s: No tsi108 PIC found !\n", __func__); return; } - DBG("%s: tsi108 pic phys_addr = 0x%x\n", __FUNCTION__, + DBG("%s: tsi108 pic phys_addr = 0x%x\n", __func__, (u32) mpic_paddr); mpic = mpic_alloc(tsi_pic, mpic_paddr, @@ -140,17 +140,17 @@ static void __init mpc7448_hpc2_init_IRQ(void) #ifdef CONFIG_PCI tsi_pci = of_find_node_by_type(NULL, "pci"); if (tsi_pci == NULL) { - printk("%s: No tsi108 pci node found !\n", __FUNCTION__); + printk("%s: No tsi108 pci node found !\n", __func__); return; } cascade_node = of_find_node_by_type(NULL, "pic-router"); if (cascade_node == NULL) { - printk("%s: No tsi108 pci cascade node found !\n", __FUNCTION__); + printk("%s: No tsi108 pci cascade node found !\n", __func__); return; } cascade_pci_irq = irq_of_parse_and_map(tsi_pci, 0); - DBG("%s: tsi108 cascade_pci_irq = 0x%x\n", __FUNCTION__, + DBG("%s: tsi108 cascade_pci_irq = 0x%x\n", __func__, (u32) cascade_pci_irq); tsi108_pci_int_init(cascade_node); set_irq_data(cascade_pci_irq, mpic); diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c index c144669a0d3f..a413abbd4123 100644 --- a/arch/powerpc/platforms/ps3/setup.c +++ b/arch/powerpc/platforms/ps3/setup.c @@ -126,7 +126,7 @@ static void __init prealloc(struct ps3_prealloc *p) p->address = __alloc_bootmem(p->size, p->align, __pa(MAX_DMA_ADDRESS)); if (!p->address) { - printk(KERN_ERR "%s: Cannot allocate %s\n", __FUNCTION__, + printk(KERN_ERR "%s: Cannot allocate %s\n", __func__, p->name); return; } diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c index 5a5a19e40bb4..0d7229cde0e9 100644 --- a/arch/powerpc/platforms/pseries/pci_dlpar.c +++ b/arch/powerpc/platforms/pseries/pci_dlpar.c @@ -123,7 +123,7 @@ pcibios_pci_config_bridge(struct pci_dev *dev) /* Add to children of PCI bridge dev->bus */ child_bus = pci_add_new_bus(dev->bus, dev, sec_busno); if (!child_bus) { - printk (KERN_ERR "%s: could not add second bus\n", __FUNCTION__); + printk (KERN_ERR "%s: could not add second bus\n", __func__); return -EIO; } sprintf(child_bus->name, "PCI Bus #%02x", child_bus->number); diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c index 2800fced8c7c..ac75c10de278 100644 --- a/arch/powerpc/platforms/pseries/reconfig.c +++ b/arch/powerpc/platforms/pseries/reconfig.c @@ -222,14 +222,14 @@ static char * parse_next_property(char *buf, char *end, char **name, int *length tmp = strchr(buf, ' '); if (!tmp) { printk(KERN_ERR "property parse failed in %s at line %d\n", - __FUNCTION__, __LINE__); + __func__, __LINE__); return NULL; } *tmp = '\0'; if (++tmp >= end) { printk(KERN_ERR "property parse failed in %s at line %d\n", - __FUNCTION__, __LINE__); + __func__, __LINE__); return NULL; } @@ -238,12 +238,12 @@ static char * parse_next_property(char *buf, char *end, char **name, int *length *length = simple_strtoul(tmp, &tmp, 10); if (*length == -1) { printk(KERN_ERR "property parse failed in %s at line %d\n", - __FUNCTION__, __LINE__); + __func__, __LINE__); return NULL; } if (*tmp != ' ' || ++tmp >= end) { printk(KERN_ERR "property parse failed in %s at line %d\n", - __FUNCTION__, __LINE__); + __func__, __LINE__); return NULL; } @@ -252,12 +252,12 @@ static char * parse_next_property(char *buf, char *end, char **name, int *length tmp += *length; if (tmp > end) { printk(KERN_ERR "property parse failed in %s at line %d\n", - __FUNCTION__, __LINE__); + __func__, __LINE__); return NULL; } else if (tmp < end && *tmp != ' ' && *tmp != '\0') { printk(KERN_ERR "property parse failed in %s at line %d\n", - __FUNCTION__, __LINE__); + __func__, __LINE__); return NULL; } tmp++; -- cgit v1.2.3 From 93173ce272e54f81460986ff5040d16ab79488a9 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Fri, 28 Mar 2008 01:43:31 +1100 Subject: [POWERPC] 4xx: Create common ppc4xx_reset_system() in ppc4xx_soc.c This patch creates a common system reset routine for all 40x and 44x systems. Previously only a 44x routine existed. But since this system reset via the debug control register is common for 40x and 44x let's share this code for all those platforms in ppc4xx_soc.c. This patch also enables CONFIG_4xx_SOC for all 40x and 44x platforms. Tested on Kilauea (405EX) and Canyonlands (440EX). Signed-off-by: Stefan Roese Signed-off-by: Josh Boyer --- arch/powerpc/platforms/40x/ep405.c | 2 ++ arch/powerpc/platforms/40x/kilauea.c | 4 +++- arch/powerpc/platforms/40x/makalu.c | 2 ++ arch/powerpc/platforms/40x/virtex.c | 2 ++ arch/powerpc/platforms/40x/walnut.c | 4 +++- arch/powerpc/platforms/44x/44x.h | 1 - arch/powerpc/platforms/44x/Kconfig | 1 - arch/powerpc/platforms/44x/bamboo.c | 15 +++++++-------- arch/powerpc/platforms/44x/canyonlands.c | 5 ++--- arch/powerpc/platforms/44x/ebony.c | 5 ++--- arch/powerpc/platforms/44x/katmai.c | 5 ++--- arch/powerpc/platforms/44x/misc_44x.S | 11 ----------- arch/powerpc/platforms/44x/rainier.c | 4 ++-- arch/powerpc/platforms/44x/sequoia.c | 4 ++-- arch/powerpc/platforms/44x/taishan.c | 5 ++--- arch/powerpc/platforms/44x/warp.c | 6 ++---- arch/powerpc/platforms/Kconfig.cputype | 2 ++ 17 files changed, 35 insertions(+), 43 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/40x/ep405.c b/arch/powerpc/platforms/40x/ep405.c index 13d1345026da..ae2e7f67c18e 100644 --- a/arch/powerpc/platforms/40x/ep405.c +++ b/arch/powerpc/platforms/40x/ep405.c @@ -29,6 +29,7 @@ #include #include #include +#include static struct device_node *bcsr_node; static void __iomem *bcsr_regs; @@ -119,5 +120,6 @@ define_machine(ep405) { .progress = udbg_progress, .init_IRQ = uic_init_tree, .get_irq = uic_get_irq, + .restart = ppc4xx_reset_system, .calibrate_decr = generic_calibrate_decr, }; diff --git a/arch/powerpc/platforms/40x/kilauea.c b/arch/powerpc/platforms/40x/kilauea.c index f9206a7fede0..1dd24ffc0dc1 100644 --- a/arch/powerpc/platforms/40x/kilauea.c +++ b/arch/powerpc/platforms/40x/kilauea.c @@ -1,7 +1,7 @@ /* * Kilauea board specific routines * - * Copyright 2007 DENX Software Engineering, Stefan Roese + * Copyright 2007-2008 DENX Software Engineering, Stefan Roese * * Based on the Walnut code by * Josh Boyer @@ -20,6 +20,7 @@ #include #include #include +#include static __initdata struct of_device_id kilauea_of_bus[] = { { .compatible = "ibm,plb4", }, @@ -54,5 +55,6 @@ define_machine(kilauea) { .progress = udbg_progress, .init_IRQ = uic_init_tree, .get_irq = uic_get_irq, + .restart = ppc4xx_reset_system, .calibrate_decr = generic_calibrate_decr, }; diff --git a/arch/powerpc/platforms/40x/makalu.c b/arch/powerpc/platforms/40x/makalu.c index 4e4df72fc9cd..a6a1d6017b71 100644 --- a/arch/powerpc/platforms/40x/makalu.c +++ b/arch/powerpc/platforms/40x/makalu.c @@ -20,6 +20,7 @@ #include #include #include +#include static __initdata struct of_device_id makalu_of_bus[] = { { .compatible = "ibm,plb4", }, @@ -54,5 +55,6 @@ define_machine(makalu) { .progress = udbg_progress, .init_IRQ = uic_init_tree, .get_irq = uic_get_irq, + .restart = ppc4xx_reset_system, .calibrate_decr = generic_calibrate_decr, }; diff --git a/arch/powerpc/platforms/40x/virtex.c b/arch/powerpc/platforms/40x/virtex.c index 0422590040db..fc7fb001276c 100644 --- a/arch/powerpc/platforms/40x/virtex.c +++ b/arch/powerpc/platforms/40x/virtex.c @@ -14,6 +14,7 @@ #include #include #include +#include static struct of_device_id xilinx_of_bus_ids[] __initdata = { { .compatible = "xlnx,plb-v46-1.00.a", }, @@ -48,5 +49,6 @@ define_machine(virtex) { .probe = virtex_probe, .init_IRQ = xilinx_intc_init_tree, .get_irq = xilinx_intc_get_irq, + .restart = ppc4xx_reset_system, .calibrate_decr = generic_calibrate_decr, }; diff --git a/arch/powerpc/platforms/40x/walnut.c b/arch/powerpc/platforms/40x/walnut.c index b8b257efeb77..335df91fbee5 100644 --- a/arch/powerpc/platforms/40x/walnut.c +++ b/arch/powerpc/platforms/40x/walnut.c @@ -26,6 +26,7 @@ #include #include #include +#include static __initdata struct of_device_id walnut_of_bus[] = { { .compatible = "ibm,plb3", }, @@ -61,5 +62,6 @@ define_machine(walnut) { .progress = udbg_progress, .init_IRQ = uic_init_tree, .get_irq = uic_get_irq, - .calibrate_decr = generic_calibrate_decr, + .restart = ppc4xx_reset_system, + .calibrate_decr = generic_calibrate_decr, }; diff --git a/arch/powerpc/platforms/44x/44x.h b/arch/powerpc/platforms/44x/44x.h index 42eabf87fea3..dbc4d2b4301a 100644 --- a/arch/powerpc/platforms/44x/44x.h +++ b/arch/powerpc/platforms/44x/44x.h @@ -3,6 +3,5 @@ extern u8 as1_readb(volatile u8 __iomem *addr); extern void as1_writeb(u8 data, volatile u8 __iomem *addr); -extern void ppc44x_reset_system(char *cmd); #endif /* __POWERPC_PLATFORMS_44X_44X_H */ diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig index 5fc28aa459e3..6abe91357eee 100644 --- a/arch/powerpc/platforms/44x/Kconfig +++ b/arch/powerpc/platforms/44x/Kconfig @@ -129,7 +129,6 @@ config 440GP config 440GX bool - select 4xx_SOC select IBM_NEW_EMAC_EMAC4 select IBM_NEW_EMAC_RGMII select IBM_NEW_EMAC_ZMII #test only diff --git a/arch/powerpc/platforms/44x/bamboo.c b/arch/powerpc/platforms/44x/bamboo.c index fb9a22a7e8d0..cef169e95156 100644 --- a/arch/powerpc/platforms/44x/bamboo.c +++ b/arch/powerpc/platforms/44x/bamboo.c @@ -22,8 +22,7 @@ #include #include #include - -#include "44x.h" +#include static __initdata struct of_device_id bamboo_of_bus[] = { { .compatible = "ibm,plb4", }, @@ -53,11 +52,11 @@ static int __init bamboo_probe(void) } define_machine(bamboo) { - .name = "Bamboo", - .probe = bamboo_probe, - .progress = udbg_progress, - .init_IRQ = uic_init_tree, - .get_irq = uic_get_irq, - .restart = ppc44x_reset_system, + .name = "Bamboo", + .probe = bamboo_probe, + .progress = udbg_progress, + .init_IRQ = uic_init_tree, + .get_irq = uic_get_irq, + .restart = ppc4xx_reset_system, .calibrate_decr = generic_calibrate_decr, }; diff --git a/arch/powerpc/platforms/44x/canyonlands.c b/arch/powerpc/platforms/44x/canyonlands.c index dac5b3203696..3949289f51df 100644 --- a/arch/powerpc/platforms/44x/canyonlands.c +++ b/arch/powerpc/platforms/44x/canyonlands.c @@ -23,8 +23,7 @@ #include #include #include - -#include "44x.h" +#include static __initdata struct of_device_id canyonlands_of_bus[] = { { .compatible = "ibm,plb4", }, @@ -59,6 +58,6 @@ define_machine(canyonlands) { .progress = udbg_progress, .init_IRQ = uic_init_tree, .get_irq = uic_get_irq, - .restart = ppc44x_reset_system, + .restart = ppc4xx_reset_system, .calibrate_decr = generic_calibrate_decr, }; diff --git a/arch/powerpc/platforms/44x/ebony.c b/arch/powerpc/platforms/44x/ebony.c index 1a8d467bff85..a0e8fe4662f6 100644 --- a/arch/powerpc/platforms/44x/ebony.c +++ b/arch/powerpc/platforms/44x/ebony.c @@ -26,8 +26,7 @@ #include #include #include - -#include "44x.h" +#include static __initdata struct of_device_id ebony_of_bus[] = { { .compatible = "ibm,plb4", }, @@ -66,6 +65,6 @@ define_machine(ebony) { .progress = udbg_progress, .init_IRQ = uic_init_tree, .get_irq = uic_get_irq, - .restart = ppc44x_reset_system, + .restart = ppc4xx_reset_system, .calibrate_decr = generic_calibrate_decr, }; diff --git a/arch/powerpc/platforms/44x/katmai.c b/arch/powerpc/platforms/44x/katmai.c index 11134121f272..44f4b3a00ced 100644 --- a/arch/powerpc/platforms/44x/katmai.c +++ b/arch/powerpc/platforms/44x/katmai.c @@ -22,8 +22,7 @@ #include #include #include - -#include "44x.h" +#include static __initdata struct of_device_id katmai_of_bus[] = { { .compatible = "ibm,plb4", }, @@ -58,6 +57,6 @@ define_machine(katmai) { .progress = udbg_progress, .init_IRQ = uic_init_tree, .get_irq = uic_get_irq, - .restart = ppc44x_reset_system, + .restart = ppc4xx_reset_system, .calibrate_decr = generic_calibrate_decr, }; diff --git a/arch/powerpc/platforms/44x/misc_44x.S b/arch/powerpc/platforms/44x/misc_44x.S index 3bce71d5d756..dc12b8009e48 100644 --- a/arch/powerpc/platforms/44x/misc_44x.S +++ b/arch/powerpc/platforms/44x/misc_44x.S @@ -44,14 +44,3 @@ _GLOBAL(as1_writeb) sync isync blr - -/* - * void ppc44x_reset_system(char *cmd) - * - * At present, this routine just applies a system reset. - */ -_GLOBAL(ppc44x_reset_system) - mfspr r13,SPRN_DBCR0 - oris r13,r13,DBCR0_RST_SYSTEM@h - mtspr SPRN_DBCR0,r13 - b . /* Just in case the reset doesn't work */ diff --git a/arch/powerpc/platforms/44x/rainier.c b/arch/powerpc/platforms/44x/rainier.c index a7fae1cf69c1..4f1ff84c4b63 100644 --- a/arch/powerpc/platforms/44x/rainier.c +++ b/arch/powerpc/platforms/44x/rainier.c @@ -22,7 +22,7 @@ #include #include #include -#include "44x.h" +#include static __initdata struct of_device_id rainier_of_bus[] = { { .compatible = "ibm,plb4", }, @@ -57,6 +57,6 @@ define_machine(rainier) { .progress = udbg_progress, .init_IRQ = uic_init_tree, .get_irq = uic_get_irq, - .restart = ppc44x_reset_system, + .restart = ppc4xx_reset_system, .calibrate_decr = generic_calibrate_decr, }; diff --git a/arch/powerpc/platforms/44x/sequoia.c b/arch/powerpc/platforms/44x/sequoia.c index d279db42c896..49eb73daacdf 100644 --- a/arch/powerpc/platforms/44x/sequoia.c +++ b/arch/powerpc/platforms/44x/sequoia.c @@ -23,7 +23,7 @@ #include #include -#include "44x.h" +#include static __initdata struct of_device_id sequoia_of_bus[] = { { .compatible = "ibm,plb4", }, @@ -58,6 +58,6 @@ define_machine(sequoia) { .progress = udbg_progress, .init_IRQ = uic_init_tree, .get_irq = uic_get_irq, - .restart = ppc44x_reset_system, + .restart = ppc4xx_reset_system, .calibrate_decr = generic_calibrate_decr, }; diff --git a/arch/powerpc/platforms/44x/taishan.c b/arch/powerpc/platforms/44x/taishan.c index 28ab7e2e02c3..49c78b2098b4 100644 --- a/arch/powerpc/platforms/44x/taishan.c +++ b/arch/powerpc/platforms/44x/taishan.c @@ -29,8 +29,7 @@ #include #include #include - -#include "44x.h" +#include static __initdata struct of_device_id taishan_of_bus[] = { { .compatible = "ibm,plb4", }, @@ -68,6 +67,6 @@ define_machine(taishan) { .progress = udbg_progress, .init_IRQ = uic_init_tree, .get_irq = uic_get_irq, - .restart = ppc44x_reset_system, + .restart = ppc4xx_reset_system, .calibrate_decr = generic_calibrate_decr, }; diff --git a/arch/powerpc/platforms/44x/warp.c b/arch/powerpc/platforms/44x/warp.c index da5b7b7599db..39cf6150a72b 100644 --- a/arch/powerpc/platforms/44x/warp.c +++ b/arch/powerpc/platforms/44x/warp.c @@ -18,9 +18,7 @@ #include #include #include - -#include "44x.h" - +#include static __initdata struct of_device_id warp_of_bus[] = { { .compatible = "ibm,plb4", }, @@ -49,7 +47,7 @@ define_machine(warp) { .progress = udbg_progress, .init_IRQ = uic_init_tree, .get_irq = uic_get_irq, - .restart = ppc44x_reset_system, + .restart = ppc4xx_reset_system, .calibrate_decr = generic_calibrate_decr, }; diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype index 0c3face0ddbb..5fc7fac10e93 100644 --- a/arch/powerpc/platforms/Kconfig.cputype +++ b/arch/powerpc/platforms/Kconfig.cputype @@ -41,11 +41,13 @@ config 40x bool "AMCC 40x" select PPC_DCR_NATIVE select PPC_UDBG_16550 + select 4xx_SOC config 44x bool "AMCC 44x" select PPC_DCR_NATIVE select PPC_UDBG_16550 + select 4xx_SOC config E200 bool "Freescale e200" -- cgit v1.2.3 From d0c8df6e4525ebd38a7643ba3dbfe3989dddf781 Mon Sep 17 00:00:00 2001 From: Valentine Barshak Date: Sat, 5 Apr 2008 05:24:37 +1100 Subject: [POWERPC] 4xx: Use machine_device_initcall() for warp_nand With a multiplatform kernel, once built we always have warp_setup_nand_flash() called and NDFC probed, no matter what machine we actually run on. This potentially can cause problems (such as kernel crash), since NDFC is probed at a warp-predefined address. Using machine_device_initcall() NAND devices are registered if we run on a warp only. Signed-off-by: Valentine Barshak Signed-off-by: Josh Boyer --- arch/powerpc/platforms/44x/warp-nand.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/44x/warp-nand.c b/arch/powerpc/platforms/44x/warp-nand.c index 84ab78ff8c03..9150318cfc56 100644 --- a/arch/powerpc/platforms/44x/warp-nand.c +++ b/arch/powerpc/platforms/44x/warp-nand.c @@ -11,6 +11,7 @@ #include #include #include +#include #ifdef CONFIG_MTD_NAND_NDFC @@ -100,6 +101,6 @@ static int warp_setup_nand_flash(void) return 0; } -device_initcall(warp_setup_nand_flash); +machine_device_initcall(warp, warp_setup_nand_flash); #endif -- cgit v1.2.3 From c6d4d5a8a83e4a564bcf233fdd565183c33df5d1 Mon Sep 17 00:00:00 2001 From: Nathan Lynch Date: Fri, 14 Mar 2008 06:52:10 +1100 Subject: [POWERPC] Convert pci and eeh code to of_device_is_available A couple of places are duplicating the function of of_device_is_available; convert them to use it. Signed-off-by: Nathan Lynch Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/eeh.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c index 9eb539ee5f9a..550b2f7d2cc1 100644 --- a/arch/powerpc/platforms/pseries/eeh.c +++ b/arch/powerpc/platforms/pseries/eeh.c @@ -945,7 +945,6 @@ static void *early_enable_eeh(struct device_node *dn, void *data) unsigned int rets[3]; struct eeh_early_enable_info *info = data; int ret; - const char *status = of_get_property(dn, "status", NULL); const u32 *class_code = of_get_property(dn, "class-code", NULL); const u32 *vendor_id = of_get_property(dn, "vendor-id", NULL); const u32 *device_id = of_get_property(dn, "device-id", NULL); @@ -959,8 +958,8 @@ static void *early_enable_eeh(struct device_node *dn, void *data) pdn->eeh_freeze_count = 0; pdn->eeh_false_positives = 0; - if (status && strncmp(status, "ok", 2) != 0) - return NULL; /* ignore devices with bad status */ + if (!of_device_is_available(dn)) + return NULL; /* Ignore bad nodes. */ if (!class_code || !vendor_id || !device_id) -- cgit v1.2.3 From f724bf77813d73318bf97dab9626156a0a87c7fc Mon Sep 17 00:00:00 2001 From: Olof Johansson Date: Fri, 4 Apr 2008 13:06:33 -0500 Subject: [POWERPC] pasemi: Minor iommu cleanup Clean up the pwrficient iommu code a bit. It was using u32 *-based offsets for registers, which can be a bit confusing when comparing to the manual. Generated binaries from the code is unchanged from before. Signed-off-by: Olof Johansson --- arch/powerpc/platforms/pasemi/iommu.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c index 5803f11c77fc..86967bdd8774 100644 --- a/arch/powerpc/platforms/pasemi/iommu.c +++ b/arch/powerpc/platforms/pasemi/iommu.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2007, PA Semi, Inc + * Copyright (C) 2005-2008, PA Semi, Inc * * Maintained by: Olof Johansson * @@ -27,7 +27,6 @@ #include #include - #define IOBMAP_PAGE_SHIFT 12 #define IOBMAP_PAGE_SIZE (1 << IOBMAP_PAGE_SHIFT) #define IOBMAP_PAGE_MASK (IOBMAP_PAGE_SIZE - 1) @@ -35,13 +34,13 @@ #define IOB_BASE 0xe0000000 #define IOB_SIZE 0x3000 /* Configuration registers */ -#define IOBCAP_REG 0x10 -#define IOBCOM_REG 0x40 +#define IOBCAP_REG 0x40 +#define IOBCOM_REG 0x100 /* Enable IOB address translation */ #define IOBCOM_ATEN 0x00000100 /* Address decode configuration register */ -#define IOB_AD_REG 0x53 +#define IOB_AD_REG 0x14c /* IOBCOM_AD_REG fields */ #define IOB_AD_VGPRT 0x00000e00 #define IOB_AD_VGAEN 0x00000100 @@ -56,13 +55,13 @@ #define IOB_AD_TRNG_2G 0x00000001 #define IOB_AD_TRNG_128G 0x00000003 -#define IOB_TABLEBASE_REG 0x55 +#define IOB_TABLEBASE_REG 0x154 /* Base of the 64 4-byte L1 registers */ -#define IOB_XLT_L1_REGBASE 0xac0 +#define IOB_XLT_L1_REGBASE 0x2b00 /* Register to invalidate TLB entries */ -#define IOB_AT_INVAL_TLB_REG 0xb40 +#define IOB_AT_INVAL_TLB_REG 0x2d00 /* The top two bits of the level 1 entry contains valid and type flags */ #define IOBMAP_L1E_V 0x40000000 @@ -76,7 +75,7 @@ #define IOBMAP_L2E_V 0x80000000 #define IOBMAP_L2E_V_CACHED 0xc0000000 -static u32 __iomem *iob; +static void __iomem *iob; static u32 iob_l1_emptyval; static u32 iob_l2_emptyval; static u32 *iob_l2_base; @@ -219,7 +218,7 @@ int __init iob_init(struct device_node *dn) for (i = 0; i < 64; i++) { /* Each L1 covers 32MB, i.e. 8K entries = 32K of ram */ regword = IOBMAP_L1E_V | (__pa(iob_l2_base + i*0x2000) >> 12); - out_le32(iob+IOB_XLT_L1_REGBASE+i, regword); + out_le32(iob+IOB_XLT_L1_REGBASE+i*4, regword); } /* set 2GB translation window, based at 0 */ -- cgit v1.2.3 From a1810b44c2d52392cd63e17fc208783cf6be6215 Mon Sep 17 00:00:00 2001 From: "Mark A. Greer" Date: Tue, 8 Apr 2008 08:09:03 +1000 Subject: [POWERPC] mv64x60: Fix FDT compatible names: mv64x60 => mv64360 Compatible names should refer to a specific version of the hardware, without wildcards. Change each instance of mv64x60 to mv64360, which is the oldest version we currently support. Signed-off-by: Mark A. Greer Signed-off-by: Dale Farnsworth Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/embedded6xx/prpmc2800.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/embedded6xx/prpmc2800.c b/arch/powerpc/platforms/embedded6xx/prpmc2800.c index 653a5eb91c90..5a19b9a1457c 100644 --- a/arch/powerpc/platforms/embedded6xx/prpmc2800.c +++ b/arch/powerpc/platforms/embedded6xx/prpmc2800.c @@ -49,13 +49,13 @@ static void __init prpmc2800_setup_arch(void) * ioremap mpp and gpp registers in case they are later * needed by prpmc2800_reset_board(). */ - np = of_find_compatible_node(NULL, NULL, "marvell,mv64x60-mpp"); + np = of_find_compatible_node(NULL, NULL, "marvell,mv64360-mpp"); reg = of_get_property(np, "reg", NULL); paddr = of_translate_address(np, reg); of_node_put(np); mv64x60_mpp_reg_base = ioremap(paddr, reg[1]); - np = of_find_compatible_node(NULL, NULL, "marvell,mv64x60-gpp"); + np = of_find_compatible_node(NULL, NULL, "marvell,mv64360-gpp"); reg = of_get_property(np, "reg", NULL); paddr = of_translate_address(np, reg); of_node_put(np); -- cgit v1.2.3 From 3eb9cf076180ed2003db77bd2c33ac4ed0211089 Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Thu, 10 Apr 2008 16:39:18 +1000 Subject: [POWERPC] iSeries: Use alternate paca structure for booting The iSeries HV only needs the first two fields of the paca statically initialised, so create an alternate paca that contains only those and switch to our real paca immediately after boot. This is in order to make the 1024 cpu patches easier since they will no longer have to statically initialise the pacas for iSeries. Signed-off-by: Stephen Rothwell Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/iseries/exception.S | 12 +++++++-- arch/powerpc/platforms/iseries/lpardata.c | 39 ++++++++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 4 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/iseries/exception.S b/arch/powerpc/platforms/iseries/exception.S index 5381038f0881..c775cd4b3d6e 100644 --- a/arch/powerpc/platforms/iseries/exception.S +++ b/arch/powerpc/platforms/iseries/exception.S @@ -38,11 +38,19 @@ .globl system_reset_iSeries system_reset_iSeries: - mfspr r13,SPRN_SPRG3 /* Get paca address */ + mfspr r13,SPRN_SPRG3 /* Get alpaca address */ + LOAD_REG_IMMEDIATE(r23, alpaca) + li r0,ALPACA_SIZE + sub r23,r13,r23 + divdu r23,r23,r0 /* r23 has cpu number */ + LOAD_REG_IMMEDIATE(r13, paca) + mulli r0,r23,PACA_SIZE + add r13,r13,r0 + mtspr SPRN_SPRG3,r13 /* Save it away for the future */ mfmsr r24 ori r24,r24,MSR_RI mtmsrd r24 /* RI on */ - lhz r24,PACAPACAINDEX(r13) /* Get processor # */ + mr r24,r23 cmpwi 0,r24,0 /* Are we processor 0? */ bne 1f b .__start_initialization_iSeries /* Start up the first processor */ diff --git a/arch/powerpc/platforms/iseries/lpardata.c b/arch/powerpc/platforms/iseries/lpardata.c index 8162049bb04d..dc8470850a81 100644 --- a/arch/powerpc/platforms/iseries/lpardata.c +++ b/arch/powerpc/platforms/iseries/lpardata.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "naca.h" #include "vpd_areas.h" @@ -159,6 +160,40 @@ struct SpCommArea xSpCommArea = { .xFormat = 1, }; +#define ALPACA_INIT(number) \ +{ \ + .lppaca_ptr = &lppaca[number], \ + .reg_save_ptr = &iseries_reg_save[number], \ +} + +struct alpaca alpaca[] = { + ALPACA_INIT( 0), +#if NR_CPUS > 1 + ALPACA_INIT( 1), ALPACA_INIT( 2), ALPACA_INIT( 3), +#if NR_CPUS > 4 + ALPACA_INIT( 4), ALPACA_INIT( 5), ALPACA_INIT( 6), ALPACA_INIT( 7), +#if NR_CPUS > 8 + ALPACA_INIT( 8), ALPACA_INIT( 9), ALPACA_INIT(10), ALPACA_INIT(11), + ALPACA_INIT(12), ALPACA_INIT(13), ALPACA_INIT(14), ALPACA_INIT(15), + ALPACA_INIT(16), ALPACA_INIT(17), ALPACA_INIT(18), ALPACA_INIT(19), + ALPACA_INIT(20), ALPACA_INIT(21), ALPACA_INIT(22), ALPACA_INIT(23), + ALPACA_INIT(24), ALPACA_INIT(25), ALPACA_INIT(26), ALPACA_INIT(27), + ALPACA_INIT(28), ALPACA_INIT(29), ALPACA_INIT(30), ALPACA_INIT(31), +#if NR_CPUS > 32 + ALPACA_INIT(32), ALPACA_INIT(33), ALPACA_INIT(34), ALPACA_INIT(35), + ALPACA_INIT(36), ALPACA_INIT(37), ALPACA_INIT(38), ALPACA_INIT(39), + ALPACA_INIT(40), ALPACA_INIT(41), ALPACA_INIT(42), ALPACA_INIT(43), + ALPACA_INIT(44), ALPACA_INIT(45), ALPACA_INIT(46), ALPACA_INIT(47), + ALPACA_INIT(48), ALPACA_INIT(49), ALPACA_INIT(50), ALPACA_INIT(51), + ALPACA_INIT(52), ALPACA_INIT(53), ALPACA_INIT(54), ALPACA_INIT(55), + ALPACA_INIT(56), ALPACA_INIT(57), ALPACA_INIT(58), ALPACA_INIT(59), + ALPACA_INIT(60), ALPACA_INIT(61), ALPACA_INIT(62), ALPACA_INIT(63), +#endif +#endif +#endif +#endif +}; + /* The LparMap data is now located at offset 0x6000 in head.S * It was put there so that the HvReleaseData could address it * with a 32-bit offset as required by the iSeries hypervisor @@ -185,7 +220,7 @@ struct ItVpdAreas itVpdAreas = { .xSlicVpdLens = { /* VPD lengths */ 0,0,0, /* 0 - 2 */ sizeof(xItExtVpdPanel), /* 3 Extended VPD */ - sizeof(struct paca_struct), /* 4 length of Paca */ + sizeof(struct alpaca), /* 4 length of (fake) Paca */ 0, /* 5 */ sizeof(struct ItIplParmsReal),/* 6 length of IPL parms */ 26992, /* 7 length of MS VPD */ @@ -203,7 +238,7 @@ struct ItVpdAreas itVpdAreas = { .xSlicVpdAdrs = { /* VPD addresses */ 0,0,0, /* 0 - 2 */ &xItExtVpdPanel, /* 3 Extended VPD */ - &paca[0], /* 4 first Paca */ + &alpaca[0], /* 4 first (fake) Paca */ 0, /* 5 */ &xItIplParmsReal, /* 6 IPL parms */ &xMsVpd, /* 7 MS Vpd */ -- cgit v1.2.3 From 30ff2e87ed55e83b4eb436f5f14a7e49ff81ad99 Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Thu, 10 Apr 2008 16:43:47 +1000 Subject: [POWERPC] iSeries: Make iseries_reg_save private to iSeries Now that we have the alpaca, the reg_save_ptr is no longer needed in the paca. Eradicate all global uses of it and make it static in the iSeries lpardata.c Signed-off-by: Stephen Rothwell Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/iseries/lpardata.c | 72 +++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 8 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/iseries/lpardata.c b/arch/powerpc/platforms/iseries/lpardata.c index dc8470850a81..2331d97e49f3 100644 --- a/arch/powerpc/platforms/iseries/lpardata.c +++ b/arch/powerpc/platforms/iseries/lpardata.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -62,6 +61,63 @@ struct naca_struct naca = { .xRamDiskSize = 0, }; +struct ItLpRegSave { + u32 xDesc; // Eye catcher "LpRS" ebcdic 000-003 + u16 xSize; // Size of this class 004-005 + u8 xInUse; // Area is live 006-007 + u8 xRsvd1[9]; // Reserved 007-00F + + u8 xFixedRegSave[352]; // Fixed Register Save Area 010-16F + u32 xCTRL; // Control Register 170-173 + u32 xDEC; // Decrementer 174-177 + u32 xFPSCR; // FP Status and Control Reg 178-17B + u32 xPVR; // Processor Version Number 17C-17F + + u64 xMMCR0; // Monitor Mode Control Reg 0 180-187 + u32 xPMC1; // Perf Monitor Counter 1 188-18B + u32 xPMC2; // Perf Monitor Counter 2 18C-18F + u32 xPMC3; // Perf Monitor Counter 3 190-193 + u32 xPMC4; // Perf Monitor Counter 4 194-197 + u32 xPIR; // Processor ID Reg 198-19B + + u32 xMMCR1; // Monitor Mode Control Reg 1 19C-19F + u32 xMMCRA; // Monitor Mode Control Reg A 1A0-1A3 + u32 xPMC5; // Perf Monitor Counter 5 1A4-1A7 + u32 xPMC6; // Perf Monitor Counter 6 1A8-1AB + u32 xPMC7; // Perf Monitor Counter 7 1AC-1AF + u32 xPMC8; // Perf Monitor Counter 8 1B0-1B3 + u32 xTSC; // Thread Switch Control 1B4-1B7 + u32 xTST; // Thread Switch Timeout 1B8-1BB + u32 xRsvd; // Reserved 1BC-1BF + + u64 xACCR; // Address Compare Control Reg 1C0-1C7 + u64 xIMR; // Instruction Match Register 1C8-1CF + u64 xSDR1; // Storage Description Reg 1 1D0-1D7 + u64 xSPRG0; // Special Purpose Reg General0 1D8-1DF + u64 xSPRG1; // Special Purpose Reg General1 1E0-1E7 + u64 xSPRG2; // Special Purpose Reg General2 1E8-1EF + u64 xSPRG3; // Special Purpose Reg General3 1F0-1F7 + u64 xTB; // Time Base Register 1F8-1FF + + u64 xFPR[32]; // Floating Point Registers 200-2FF + + u64 xMSR; // Machine State Register 300-307 + u64 xNIA; // Next Instruction Address 308-30F + + u64 xDABR; // Data Address Breakpoint Reg 310-317 + u64 xIABR; // Inst Address Breakpoint Reg 318-31F + + u64 xHID0; // HW Implementation Dependent0 320-327 + + u64 xHID4; // HW Implementation Dependent4 328-32F + u64 xSCOMd; // SCON Data Reg (SPRG4) 330-337 + u64 xSCOMc; // SCON Command Reg (SPRG5) 338-33F + u64 xSDAR; // Sample Data Address Register 340-347 + u64 xSIAR; // Sample Inst Address Register 348-34F + + u8 xRsvd3[176]; // Reserved 350-3FF +}; + extern void system_reset_iSeries(void); extern void machine_check_iSeries(void); extern void data_access_iSeries(void); @@ -160,6 +216,13 @@ struct SpCommArea xSpCommArea = { .xFormat = 1, }; +static struct ItLpRegSave iseries_reg_save[] = { + [0 ... (NR_CPUS-1)] = { + .xDesc = 0xd397d9e2, /* "LpRS" */ + .xSize = sizeof(struct ItLpRegSave), + }, +}; + #define ALPACA_INIT(number) \ { \ .lppaca_ptr = &lppaca[number], \ @@ -254,10 +317,3 @@ struct ItVpdAreas itVpdAreas = { 0,0 } }; - -struct ItLpRegSave iseries_reg_save[] = { - [0 ... (NR_CPUS-1)] = { - .xDesc = 0xd397d9e2, /* "LpRS" */ - .xSize = sizeof(struct ItLpRegSave), - }, -}; -- cgit v1.2.3 From f9a5e6a27d2aa1b37758abb031f37615ac367cca Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Thu, 10 Apr 2008 16:44:30 +1000 Subject: [POWERPC] iSeries: Localise and constify some iSeries data Signed-off-by: Stephen Rothwell Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/iseries/ipl_parms.h | 2 -- arch/powerpc/platforms/iseries/lpardata.c | 14 +++++++------- arch/powerpc/platforms/iseries/naca.h | 2 +- arch/powerpc/platforms/iseries/release_data.h | 2 +- arch/powerpc/platforms/iseries/spcomm_area.h | 2 -- arch/powerpc/platforms/iseries/vpd_areas.h | 4 ++-- 6 files changed, 11 insertions(+), 15 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/iseries/ipl_parms.h b/arch/powerpc/platforms/iseries/ipl_parms.h index 77c135ddbf1b..83e4ca42fc57 100644 --- a/arch/powerpc/platforms/iseries/ipl_parms.h +++ b/arch/powerpc/platforms/iseries/ipl_parms.h @@ -65,6 +65,4 @@ struct ItIplParmsReal { u64 xRsvd13; // Reserved x38-x3F }; -extern struct ItIplParmsReal xItIplParmsReal; - #endif /* _ISERIES_IPL_PARMS_H */ diff --git a/arch/powerpc/platforms/iseries/lpardata.c b/arch/powerpc/platforms/iseries/lpardata.c index 2331d97e49f3..98bd2d37038a 100644 --- a/arch/powerpc/platforms/iseries/lpardata.c +++ b/arch/powerpc/platforms/iseries/lpardata.c @@ -31,7 +31,7 @@ /* The HvReleaseData is the root of the information shared between * the hypervisor and Linux. */ -struct HvReleaseData hvReleaseData = { +const struct HvReleaseData hvReleaseData = { .xDesc = 0xc8a5d9c4, /* "HvRD" ebcdic */ .xSize = sizeof(struct HvReleaseData), .xVpdAreasPtrOffset = offsetof(struct naca_struct, xItVpdAreas), @@ -186,7 +186,7 @@ struct ItLpNaca itLpNaca = { }; /* May be filled in by the hypervisor so cannot end up in the BSS */ -struct ItIplParmsReal xItIplParmsReal __attribute__((__section__(".data"))); +static struct ItIplParmsReal xItIplParmsReal __attribute__((__section__(".data"))); /* May be filled in by the hypervisor so cannot end up in the BSS */ struct ItExtVpdPanel xItExtVpdPanel __attribute__((__section__(".data"))); @@ -209,14 +209,14 @@ u64 xMsVpd[3400] __attribute__((__section__(".data"))); /* Space for Recovery Log Buffer */ /* May be filled in by the hypervisor so cannot end up in the BSS */ -u64 xRecoveryLogBuffer[32] __attribute__((__section__(".data"))); +static u64 xRecoveryLogBuffer[32] __attribute__((__section__(".data"))); -struct SpCommArea xSpCommArea = { +static const struct SpCommArea xSpCommArea = { .xDesc = 0xE2D7C3C2, .xFormat = 1, }; -static struct ItLpRegSave iseries_reg_save[] = { +static const struct ItLpRegSave iseries_reg_save[] = { [0 ... (NR_CPUS-1)] = { .xDesc = 0xd397d9e2, /* "LpRS" */ .xSize = sizeof(struct ItLpRegSave), @@ -229,7 +229,7 @@ static struct ItLpRegSave iseries_reg_save[] = { .reg_save_ptr = &iseries_reg_save[number], \ } -struct alpaca alpaca[] = { +const struct alpaca alpaca[] = { ALPACA_INIT( 0), #if NR_CPUS > 1 ALPACA_INIT( 1), ALPACA_INIT( 2), ALPACA_INIT( 3), @@ -265,7 +265,7 @@ struct alpaca alpaca[] = { * the Naca via the HvReleaseData area. The HvReleaseData has the * offset into the Naca of the pointer to the ItVpdAreas. */ -struct ItVpdAreas itVpdAreas = { +const struct ItVpdAreas itVpdAreas = { .xSlicDesc = 0xc9a3e5c1, /* "ItVA" */ .xSlicSize = sizeof(struct ItVpdAreas), .xSlicVpdEntries = ItVpdMaxEntries, /* # VPD array entries */ diff --git a/arch/powerpc/platforms/iseries/naca.h b/arch/powerpc/platforms/iseries/naca.h index ab2372eb8d2e..f01708e12862 100644 --- a/arch/powerpc/platforms/iseries/naca.h +++ b/arch/powerpc/platforms/iseries/naca.h @@ -14,7 +14,7 @@ struct naca_struct { /* Kernel only data - undefined for user space */ - void *xItVpdAreas; /* VPD Data 0x00 */ + const void *xItVpdAreas; /* VPD Data 0x00 */ void *xRamDisk; /* iSeries ramdisk 0x08 */ u64 xRamDiskSize; /* In pages 0x10 */ }; diff --git a/arch/powerpc/platforms/iseries/release_data.h b/arch/powerpc/platforms/iseries/release_data.h index 66189fd2e32d..6ad7d843e8fc 100644 --- a/arch/powerpc/platforms/iseries/release_data.h +++ b/arch/powerpc/platforms/iseries/release_data.h @@ -58,6 +58,6 @@ struct HvReleaseData { char xRsvd3[20]; /* Reserved x2C-x3F */ }; -extern struct HvReleaseData hvReleaseData; +extern const struct HvReleaseData hvReleaseData; #endif /* _ISERIES_RELEASE_DATA_H */ diff --git a/arch/powerpc/platforms/iseries/spcomm_area.h b/arch/powerpc/platforms/iseries/spcomm_area.h index 6e3b685115c9..598b7c14573a 100644 --- a/arch/powerpc/platforms/iseries/spcomm_area.h +++ b/arch/powerpc/platforms/iseries/spcomm_area.h @@ -31,6 +31,4 @@ struct SpCommArea { u8 xRsvd2[80]; // Reserved 030-07F }; -extern struct SpCommArea xSpCommArea; - #endif /* _ISERIES_SPCOMM_AREA_H */ diff --git a/arch/powerpc/platforms/iseries/vpd_areas.h b/arch/powerpc/platforms/iseries/vpd_areas.h index 601e6dd860ed..feb001f3a5fe 100644 --- a/arch/powerpc/platforms/iseries/vpd_areas.h +++ b/arch/powerpc/platforms/iseries/vpd_areas.h @@ -80,9 +80,9 @@ struct ItVpdAreas { u32 xPlicDmaLens[ItDmaMaxEntries];// Array of DMA lengths 080-0A7 u32 xPlicDmaToks[ItDmaMaxEntries];// Array of DMA tokens 0A8-0CF u32 xSlicVpdLens[ItVpdMaxEntries];// Array of VPD lengths 0D0-12F - void *xSlicVpdAdrs[ItVpdMaxEntries];// Array of VPD buffers 130-1EF + const void *xSlicVpdAdrs[ItVpdMaxEntries];// Array of VPD buffers 130-1EF }; -extern struct ItVpdAreas itVpdAreas; +extern const struct ItVpdAreas itVpdAreas; #endif /* _ISERIES_VPD_AREAS_H */ -- cgit v1.2.3 From e92716f2aa68cdfbf6ec24d6f31f08b072e1a246 Mon Sep 17 00:00:00 2001 From: Jerone Young Date: Sat, 12 Apr 2008 05:03:33 +1000 Subject: [POWERPC] 4xx: Add idle wait support for 44x platforms This changes the cpu_idle loop for 44x platforms to utilize the Wait Enable feature of the CPU. This helps virtulization solutions know when the guest Linux kernel is in an idle state. A command line option called "idle" is also added to allow people to change the idle loop back to the original variation. This is done by setting "idle=spin" on the kernel command line. Signed-off-by: Jerone Young Signed-off-by: Josh Boyer --- arch/powerpc/platforms/44x/Makefile | 2 +- arch/powerpc/platforms/44x/idle.c | 67 +++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 arch/powerpc/platforms/44x/idle.c (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/44x/Makefile b/arch/powerpc/platforms/44x/Makefile index 2320ae5dc8a7..774165f9acdd 100644 --- a/arch/powerpc/platforms/44x/Makefile +++ b/arch/powerpc/platforms/44x/Makefile @@ -1,4 +1,4 @@ -obj-$(CONFIG_44x) := misc_44x.o +obj-$(CONFIG_44x) := misc_44x.o idle.o obj-$(CONFIG_EBONY) += ebony.o obj-$(CONFIG_TAISHAN) += taishan.o obj-$(CONFIG_BAMBOO) += bamboo.o diff --git a/arch/powerpc/platforms/44x/idle.c b/arch/powerpc/platforms/44x/idle.c new file mode 100644 index 000000000000..7a81f921fef9 --- /dev/null +++ b/arch/powerpc/platforms/44x/idle.c @@ -0,0 +1,67 @@ +/* + * Copyright 2008 IBM Corp. + * + * Based on arch/powerpc/platforms/pasemi/idle.c: + * Copyright (C) 2006-2007 PA Semi, Inc + * + * Added by: Jerone Young + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include +#include +#include + +static int mode_spin; + +static void ppc44x_idle(void) +{ + unsigned long msr_save; + + msr_save = mfmsr(); + /* set wait state MSR */ + mtmsr(msr_save|MSR_WE|MSR_EE|MSR_CE|MSR_DE); + isync(); + /* return to initial state */ + mtmsr(msr_save); + isync(); +} + +int __init ppc44x_idle_init(void) +{ + if (!mode_spin) { + /* If we are not setting spin mode + then we set to wait mode */ + ppc_md.power_save = &ppc44x_idle; + } + + return 0; +} + +arch_initcall(ppc44x_idle_init); + +static int __init idle_param(char *p) +{ + + if (!strcmp("spin", p)) { + mode_spin = 1; + ppc_md.power_save = NULL; + } + + return 0; +} + +early_param("idle", idle_param); -- cgit v1.2.3 From 2fe37a6ec933ca7332a8ca8d29e87705116afd3a Mon Sep 17 00:00:00 2001 From: Ishizaki Kou Date: Fri, 14 Mar 2008 23:19:34 +1100 Subject: [POWERPC] celleb: Coding style cleanup Signed-off-by: Kou Ishizaki Acked-by: Arnd Bergmann Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/celleb/beat.c | 17 +++++++---------- arch/powerpc/platforms/celleb/beat.h | 4 ++-- arch/powerpc/platforms/celleb/beat_wrapper.h | 3 ++- arch/powerpc/platforms/celleb/htab.c | 7 ++++--- arch/powerpc/platforms/celleb/interrupt.c | 26 ++++++++++++++------------ arch/powerpc/platforms/celleb/scc_epci.c | 8 ++++---- arch/powerpc/platforms/celleb/scc_sio.c | 4 ++-- arch/powerpc/platforms/celleb/spu_priv1.c | 3 +-- arch/powerpc/platforms/celleb/udbg_beat.c | 5 +++-- 9 files changed, 39 insertions(+), 38 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/celleb/beat.c b/arch/powerpc/platforms/celleb/beat.c index 93ebb7d85120..b64b171f245b 100644 --- a/arch/powerpc/platforms/celleb/beat.c +++ b/arch/powerpc/platforms/celleb/beat.c @@ -48,6 +48,7 @@ void beat_power_off(void) } u64 beat_halt_code = 0x1000000000000000UL; +EXPORT_SYMBOL(beat_halt_code); void beat_halt(void) { @@ -94,9 +95,8 @@ ssize_t beat_nvram_read(char *buf, size_t count, loff_t *index) len = count; if (len > BEAT_NVRW_CNT) len = BEAT_NVRW_CNT; - if (beat_eeprom_read(i, len, p)) { + if (beat_eeprom_read(i, len, p)) return -EIO; - } p += len; i += len; @@ -121,9 +121,8 @@ ssize_t beat_nvram_write(char *buf, size_t count, loff_t *index) len = count; if (len > BEAT_NVRW_CNT) len = BEAT_NVRW_CNT; - if (beat_eeprom_write(i, len, p)) { + if (beat_eeprom_write(i, len, p)) return -EIO; - } p += len; i += len; @@ -149,13 +148,14 @@ int64_t beat_get_term_char(u64 vterm, u64 *len, u64 *t1, u64 *t2) u64 db[2]; s64 ret; - ret = beat_get_characters_from_console(vterm, len, (u8*)db); + ret = beat_get_characters_from_console(vterm, len, (u8 *)db); if (ret == 0) { *t1 = db[0]; *t2 = db[1]; } return ret; } +EXPORT_SYMBOL(beat_get_term_char); int64_t beat_put_term_char(u64 vterm, u64 len, u64 t1, u64 t2) { @@ -163,8 +163,9 @@ int64_t beat_put_term_char(u64 vterm, u64 len, u64 t1, u64 t2) db[0] = t1; db[1] = t2; - return beat_put_characters_to_console(vterm, len, (u8*)db); + return beat_put_characters_to_console(vterm, len, (u8 *)db); } +EXPORT_SYMBOL(beat_put_term_char); void beat_power_save(void) { @@ -261,7 +262,3 @@ static int __init beat_event_init(void) } device_initcall(beat_event_init); - -EXPORT_SYMBOL(beat_get_term_char); -EXPORT_SYMBOL(beat_put_term_char); -EXPORT_SYMBOL(beat_halt_code); diff --git a/arch/powerpc/platforms/celleb/beat.h b/arch/powerpc/platforms/celleb/beat.h index ac82ac35b991..32c8efcedc80 100644 --- a/arch/powerpc/platforms/celleb/beat.h +++ b/arch/powerpc/platforms/celleb/beat.h @@ -21,8 +21,8 @@ #ifndef _CELLEB_BEAT_H #define _CELLEB_BEAT_H -int64_t beat_get_term_char(uint64_t,uint64_t*,uint64_t*,uint64_t*); -int64_t beat_put_term_char(uint64_t,uint64_t,uint64_t,uint64_t); +int64_t beat_get_term_char(uint64_t, uint64_t *, uint64_t *, uint64_t *); +int64_t beat_put_term_char(uint64_t, uint64_t, uint64_t, uint64_t); int64_t beat_repository_encode(int, const char *, uint64_t[4]); void beat_restart(char *); void beat_power_off(void); diff --git a/arch/powerpc/platforms/celleb/beat_wrapper.h b/arch/powerpc/platforms/celleb/beat_wrapper.h index cbc1487df7de..b47dfda48d06 100644 --- a/arch/powerpc/platforms/celleb/beat_wrapper.h +++ b/arch/powerpc/platforms/celleb/beat_wrapper.h @@ -197,7 +197,8 @@ static inline s64 beat_put_characters_to_console(u64 termno, u64 len, u64 b[2]; memcpy(b, buffer, len); - return beat_hcall_norets(HV_put_characters_to_console, termno, len, b[0], b[1]); + return beat_hcall_norets(HV_put_characters_to_console, termno, len, + b[0], b[1]); } static inline s64 beat_get_spe_privileged_state_1_registers( diff --git a/arch/powerpc/platforms/celleb/htab.c b/arch/powerpc/platforms/celleb/htab.c index fbf27c74ebda..81467ff055c8 100644 --- a/arch/powerpc/platforms/celleb/htab.c +++ b/arch/powerpc/platforms/celleb/htab.c @@ -35,9 +35,9 @@ #include "beat_wrapper.h" #ifdef DEBUG_LOW -#define DBG_LOW(fmt...) do { udbg_printf(fmt); } while(0) +#define DBG_LOW(fmt...) do { udbg_printf(fmt); } while (0) #else -#define DBG_LOW(fmt...) do { } while(0) +#define DBG_LOW(fmt...) do { } while (0) #endif static DEFINE_SPINLOCK(beat_htab_lock); @@ -116,7 +116,8 @@ static long beat_lpar_hpte_insert(unsigned long hpte_group, hpte_r &= ~_PAGE_COHERENT; spin_lock(&beat_htab_lock); - if ((lpar_rc = beat_read_mask(hpte_group)) == 0) { + lpar_rc = beat_read_mask(hpte_group); + if (lpar_rc == 0) { if (!(vflags & HPTE_V_BOLTED)) DBG_LOW(" full\n"); spin_unlock(&beat_htab_lock); diff --git a/arch/powerpc/platforms/celleb/interrupt.c b/arch/powerpc/platforms/celleb/interrupt.c index c7c68ca70c82..69562a867876 100644 --- a/arch/powerpc/platforms/celleb/interrupt.c +++ b/arch/powerpc/platforms/celleb/interrupt.c @@ -34,7 +34,7 @@ static DEFINE_SPINLOCK(beatic_irq_mask_lock); static uint64_t beatic_irq_mask_enable[(MAX_IRQS+255)/64]; static uint64_t beatic_irq_mask_ack[(MAX_IRQS+255)/64]; -static struct irq_host *beatic_host = NULL; +static struct irq_host *beatic_host; /* * In this implementation, "virq" == "IRQ plug number", @@ -49,13 +49,13 @@ static inline void beatic_update_irq_mask(unsigned int irq_plug) off = (irq_plug / 256) * 4; masks[0] = beatic_irq_mask_enable[off + 0] - & beatic_irq_mask_ack[off + 0]; + & beatic_irq_mask_ack[off + 0]; masks[1] = beatic_irq_mask_enable[off + 1] - & beatic_irq_mask_ack[off + 1]; + & beatic_irq_mask_ack[off + 1]; masks[2] = beatic_irq_mask_enable[off + 2] - & beatic_irq_mask_ack[off + 2]; + & beatic_irq_mask_ack[off + 2]; masks[3] = beatic_irq_mask_enable[off + 3] - & beatic_irq_mask_ack[off + 3]; + & beatic_irq_mask_ack[off + 3]; if (beat_set_interrupt_mask(irq_plug&~255UL, masks[0], masks[1], masks[2], masks[3]) != 0) panic("Failed to set mask IRQ!"); @@ -96,7 +96,8 @@ static void beatic_end_irq(unsigned int irq_plug) s64 err; unsigned long flags; - if ((err = beat_downcount_of_interrupt(irq_plug)) != 0) { + err = beat_downcount_of_interrupt(irq_plug); + if (err != 0) { if ((err & 0xFFFFFFFF) != 0xFFFFFFF5) /* -11: wrong state */ panic("Failed to downcount IRQ! Error = %16lx", err); @@ -138,7 +139,8 @@ static int beatic_pic_host_map(struct irq_host *h, unsigned int virq, struct irq_desc *desc = get_irq_desc(virq); int64_t err; - if ((err = beat_construct_and_connect_irq_plug(virq, hw)) < 0) + err = beat_construct_and_connect_irq_plug(virq, hw); + if (err < 0) return -EIO; desc->status |= IRQ_LEVEL; @@ -202,22 +204,22 @@ static inline unsigned int beatic_get_irq_plug(void) beat_detect_pending_interrupts(i, pending); __asm__ ("cntlzd %0,%1":"=r"(ub): "r"(pending[0] & beatic_irq_mask_enable[i/64+0] - & beatic_irq_mask_ack[i/64+0])); + & beatic_irq_mask_ack[i/64+0])); if (ub != 64) return i + ub + 0; __asm__ ("cntlzd %0,%1":"=r"(ub): "r"(pending[1] & beatic_irq_mask_enable[i/64+1] - & beatic_irq_mask_ack[i/64+1])); + & beatic_irq_mask_ack[i/64+1])); if (ub != 64) return i + ub + 64; __asm__ ("cntlzd %0,%1":"=r"(ub): "r"(pending[2] & beatic_irq_mask_enable[i/64+2] - & beatic_irq_mask_ack[i/64+2])); + & beatic_irq_mask_ack[i/64+2])); if (ub != 64) return i + ub + 128; __asm__ ("cntlzd %0,%1":"=r"(ub): "r"(pending[3] & beatic_irq_mask_enable[i/64+3] - & beatic_irq_mask_ack[i/64+3])); + & beatic_irq_mask_ack[i/64+3])); if (ub != 64) return i + ub + 192; } @@ -250,7 +252,7 @@ void __init beatic_init_IRQ(void) /* Allocate an irq host */ beatic_host = irq_alloc_host(NULL, IRQ_HOST_MAP_NOMAP, 0, - &beatic_pic_host_ops, + &beatic_pic_host_ops, 0); BUG_ON(beatic_host == NULL); irq_set_default_host(beatic_host); diff --git a/arch/powerpc/platforms/celleb/scc_epci.c b/arch/powerpc/platforms/celleb/scc_epci.c index a3c7cfbcb323..a999b393f6f6 100644 --- a/arch/powerpc/platforms/celleb/scc_epci.c +++ b/arch/powerpc/platforms/celleb/scc_epci.c @@ -161,9 +161,9 @@ static PCI_IO_ADDR celleb_epci_make_config_addr( if (bus != hose->bus) addr = celleb_epci_get_epci_cfg(hose) + (((bus->number & 0xff) << 16) - | ((devfn & 0xff) << 8) - | (where & 0xff) - | 0x01000000); + | ((devfn & 0xff) << 8) + | (where & 0xff) + | 0x01000000); else addr = celleb_epci_get_epci_cfg(hose) + (((devfn & 0xff) << 8) | (where & 0xff)); @@ -174,7 +174,7 @@ static PCI_IO_ADDR celleb_epci_make_config_addr( } static int celleb_epci_read_config(struct pci_bus *bus, - unsigned int devfn, int where, int size, u32 * val) + unsigned int devfn, int where, int size, u32 *val) { PCI_IO_ADDR epci_base; PCI_IO_ADDR addr; diff --git a/arch/powerpc/platforms/celleb/scc_sio.c b/arch/powerpc/platforms/celleb/scc_sio.c index 610008211ca1..3a16c5b3c464 100644 --- a/arch/powerpc/platforms/celleb/scc_sio.c +++ b/arch/powerpc/platforms/celleb/scc_sio.c @@ -28,7 +28,7 @@ /* sio irq0=0xb00010022 irq0=0xb00010023 irq2=0xb00010024 mmio=0xfff000-0x1000,0xff2000-0x1000 */ -static int txx9_serial_bitmap __initdata = 0; +static int txx9_serial_bitmap __initdata; static struct { uint32_t offset; @@ -84,7 +84,7 @@ static int __init txx9_serial_config(char *ptr) int i; for (;;) { - switch(get_option(&ptr, &i)) { + switch (get_option(&ptr, &i)) { default: return 0; case 2: diff --git a/arch/powerpc/platforms/celleb/spu_priv1.c b/arch/powerpc/platforms/celleb/spu_priv1.c index 2bf6700f747a..bcc17f7fe8ad 100644 --- a/arch/powerpc/platforms/celleb/spu_priv1.c +++ b/arch/powerpc/platforms/celleb/spu_priv1.c @@ -183,8 +183,7 @@ static u64 resource_allocation_enable_get(struct spu *spu) return enable; } -const struct spu_priv1_ops spu_priv1_beat_ops = -{ +const struct spu_priv1_ops spu_priv1_beat_ops = { .int_mask_and = int_mask_and, .int_mask_or = int_mask_or, .int_mask_set = int_mask_set, diff --git a/arch/powerpc/platforms/celleb/udbg_beat.c b/arch/powerpc/platforms/celleb/udbg_beat.c index d888c4674c62..6b418f6b6175 100644 --- a/arch/powerpc/platforms/celleb/udbg_beat.c +++ b/arch/powerpc/platforms/celleb/udbg_beat.c @@ -54,7 +54,8 @@ static int udbg_getc_poll_beat(void) if (inbuflen == 0) { /* get some more chars. */ inbuflen = 0; - rc = beat_get_term_char(celleb_vtermno, &inbuflen, inbuf+0, inbuf+1); + rc = beat_get_term_char(celleb_vtermno, &inbuflen, + inbuf+0, inbuf+1); if (rc != 0) inbuflen = 0; /* otherwise inbuflen is garbage */ } @@ -78,7 +79,7 @@ static int udbg_getc_beat(void) if (ch == -1) { /* This shouldn't be needed...but... */ volatile unsigned long delay; - for (delay=0; delay < 2000000; delay++) + for (delay = 0; delay < 2000000; delay++) ; } else { return ch; -- cgit v1.2.3 From 37ddd5d053c57fee798d72fa9c18660f59a9299b Mon Sep 17 00:00:00 2001 From: Manish Ahuja Date: Sat, 12 Apr 2008 09:31:52 +1000 Subject: [POWERPC] pseries/phyp dump: Reserve a variable amount of space at boot This changes the way we calculate how much space to reserve for the pHyp dump. Currently we reserve 256MB only. With this change, the code first checks to see if an amount has been specified on the boot command line with the "phyp_dump_reserve_size" option, and if so, uses that much. Otherwise it computes 5% of total ram and rounds it down to a multiple of 256MB, and uses the larger of that or 256MB. This is for large systems with a lot of memory (10GB or more). The aim is to have more space available for the kernel on reboot on machines with more resources. Although the dump will be collected pretty fast and the memory released really early on allowing the machine to have the full memory available, this alleviates any issues that can be caused by having way too little memory on very very large systems during those few minutes. Signed-off-by: Manish Ahuja Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/phyp_dump.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pseries/phyp_dump.c b/arch/powerpc/platforms/pseries/phyp_dump.c index 7ddd10526cea..edbc012c2ebc 100644 --- a/arch/powerpc/platforms/pseries/phyp_dump.c +++ b/arch/powerpc/platforms/pseries/phyp_dump.c @@ -496,3 +496,12 @@ static int __init early_phyp_dump_enabled(char *p) } early_param("phyp_dump", early_phyp_dump_enabled); +/* Look for phyp_dump_reserve_size= cmdline option */ +static int __init early_phyp_dump_reserve_size(char *p) +{ + if (p) + phyp_dump_info->reserve_bootvar = memparse(p, &p); + + return 0; +} +early_param("phyp_dump_reserve_size", early_phyp_dump_reserve_size); -- cgit v1.2.3 From 21cf91338fabe649ae3744429e13b61da2a17a6a Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Wed, 16 Apr 2008 13:51:48 +1000 Subject: [POWERPC] Move prototype for find_udbg_vterm() into a header file Move the prototype for find_udbg_vterm() into pseries.h, removing it from setup.c. Signed-off-by: Michael Ellerman Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/lpar.c | 1 + arch/powerpc/platforms/pseries/pseries.h | 2 ++ arch/powerpc/platforms/pseries/setup.c | 3 --- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 233d9be25f49..8a204523afbc 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c @@ -40,6 +40,7 @@ #include #include "plpar_wrappers.h" +#include "pseries.h" #ifdef DEBUG_LOW #define DBG_LOW(fmt...) do { udbg_printf(fmt); } while(0) diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h index 61136d019554..9e17c0d2a0c8 100644 --- a/arch/powerpc/platforms/pseries/pseries.h +++ b/arch/powerpc/platforms/pseries/pseries.h @@ -38,4 +38,6 @@ extern void pSeries_final_fixup(void); /* Poweron flag used for enabling auto ups restart */ extern unsigned long rtas_poweron_auto; +extern void find_udbg_vterm(void); + #endif /* _PSERIES_PSERIES_H */ diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 90555a39fe62..fccca89ee04e 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -76,9 +76,6 @@ #define DBG(fmt...) #endif -/* move those away to a .h */ -extern void find_udbg_vterm(void); - int fwnmi_active; /* TRUE if an FWNMI handler is present */ static void pseries_shared_idle_sleep(void); -- cgit v1.2.3 From 5faae2e5d1f53df9dce482032c8486bc3a1feffc Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Wed, 16 Apr 2008 13:51:49 +1000 Subject: [POWERPC] Always add preferred consoles in platforms/pseries/lpar.c There is logic in platforms/peries/lpars.c which checks if the user has specified a console on the command line, and refrains from adding a preferred console entry for the hvc/hvsi console if they have. This trips up if you use "netconsole=foo" on the command line, and has the result that you get _only_ the netconsole, because the hvc device is never added as a preferred console. Worse still if you get the netconsole configuration wrong somehow, you end up with no console at all. As it turns out we don't need to worry about checking the command line. If the user has specified "console=foo", then foo will be set as the preferred console when the command line is parsed in start_kernel(), much later than the pseries code, and so the latter setting will take effect. Signed-off-by: Michael Ellerman Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/lpar.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 8a204523afbc..9235c469449e 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c @@ -204,7 +204,6 @@ void __init find_udbg_vterm(void) struct device_node *stdout_node; const u32 *termno; const char *name; - int add_console; /* find the boot console from /chosen/stdout */ if (!of_chosen) @@ -220,8 +219,6 @@ void __init find_udbg_vterm(void) printk(KERN_WARNING "stdout node missing 'name' property!\n"); goto out; } - /* The user has requested a console so this is already set up. */ - add_console = !strstr(cmd_line, "console="); /* Check if it's a virtual terminal */ if (strncmp(name, "vty", 3) != 0) @@ -235,15 +232,13 @@ void __init find_udbg_vterm(void) udbg_putc = udbg_putcLP; udbg_getc = udbg_getcLP; udbg_getc_poll = udbg_getc_pollLP; - if (add_console) - add_preferred_console("hvc", termno[0] & 0xff, NULL); + add_preferred_console("hvc", termno[0] & 0xff, NULL); } else if (of_device_is_compatible(stdout_node, "hvterm-protocol")) { vtermno = termno[0]; udbg_putc = udbg_hvsi_putc; udbg_getc = udbg_hvsi_getc; udbg_getc_poll = udbg_hvsi_getc_poll; - if (add_console) - add_preferred_console("hvsi", termno[0] & 0xff, NULL); + add_preferred_console("hvsi", termno[0] & 0xff, NULL); } out: of_node_put(stdout_node); -- cgit v1.2.3 From 1028d4f162796a99b87565b6b40b5fec79c242d0 Mon Sep 17 00:00:00 2001 From: Sebastian Siewior Date: Sat, 15 Mar 2008 00:01:30 +0100 Subject: [POWERPC] 85xx: Enable DMA engine on the MPC8544 DS Add the device tree node for the DMA engine on 8544, publish the device and enable the driver in the defconfig. Signed-off-by: Sebastian Siewior Signed-off-by: Kumar Gala --- arch/powerpc/platforms/85xx/mpc85xx_ds.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c index 2865d019afc3..dfd8b4ad9b28 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -183,6 +184,18 @@ static int __init mpc8544_ds_probe(void) } } +static struct of_device_id mpc85xxds_ids[] = { + { .type = "soc", }, + { .compatible = "soc", }, + {}, +}; + +static int __init mpc85xxds_publish_devices(void) +{ + return of_platform_bus_probe(NULL, mpc85xxds_ids, NULL); +} +machine_device_initcall(mpc8544_ds, mpc85xxds_publish_devices); + /* * Called very early, device-tree isn't unflattened */ -- cgit v1.2.3 From 3dd82a1ea72438a545634b3ef90c53313d2caffa Mon Sep 17 00:00:00 2001 From: Scott Wood Date: Thu, 10 Apr 2008 15:45:02 -0500 Subject: [POWERPC] CPM: Always use new binding. The kconfig entry can go away once arch/ppc and references to the config in drivers are removed. Signed-off-by: Scott Wood Signed-off-by: Kumar Gala --- arch/powerpc/platforms/82xx/Kconfig | 3 --- arch/powerpc/platforms/85xx/Kconfig | 8 -------- arch/powerpc/platforms/8xx/Kconfig | 4 ---- arch/powerpc/platforms/Kconfig | 8 +------- 4 files changed, 1 insertion(+), 22 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/82xx/Kconfig b/arch/powerpc/platforms/82xx/Kconfig index 4fad6c7bf9f1..917ac8891555 100644 --- a/arch/powerpc/platforms/82xx/Kconfig +++ b/arch/powerpc/platforms/82xx/Kconfig @@ -11,7 +11,6 @@ config MPC8272_ADS select 8260 select FSL_SOC select PQ2_ADS_PCI_PIC if PCI - select PPC_CPM_NEW_BINDING help This option enables support for the MPC8272 ADS board @@ -22,7 +21,6 @@ config PQ2FADS select 8260 select FSL_SOC select PQ2_ADS_PCI_PIC if PCI - select PPC_CPM_NEW_BINDING help This option enables support for the PQ2FADS board @@ -31,7 +29,6 @@ config EP8248E select 8272 select 8260 select FSL_SOC - select PPC_CPM_NEW_BINDING select MDIO_BITBANG help This enables support for the Embedded Planet EP8248E board. diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig index 28bc6e58a970..7ff29d53dc2d 100644 --- a/arch/powerpc/platforms/85xx/Kconfig +++ b/arch/powerpc/platforms/85xx/Kconfig @@ -19,7 +19,6 @@ config MPC8540_ADS config MPC8560_ADS bool "Freescale MPC8560 ADS" select DEFAULT_UIMAGE - select PPC_CPM_NEW_BINDING select CPM2 help This option enables support for the MPC 8560 ADS board @@ -48,7 +47,6 @@ config MPC85xx_DS config KSI8560 bool "Emerson KSI8560" - select PPC_CPM_NEW_BINDING select DEFAULT_UIMAGE help This option enables support for the Emerson KSI8560 board @@ -60,14 +58,12 @@ config STX_GP3 board. select CPM2 select DEFAULT_UIMAGE - select PPC_CPM_NEW_BINDING config TQM8540 bool "TQ Components TQM8540" help This option enables support for the TQ Components TQM8540 board. select DEFAULT_UIMAGE - select PPC_CPM_NEW_BINDING select TQM85xx config TQM8541 @@ -75,7 +71,6 @@ config TQM8541 help This option enables support for the TQ Components TQM8541 board. select DEFAULT_UIMAGE - select PPC_CPM_NEW_BINDING select TQM85xx select CPM2 @@ -84,7 +79,6 @@ config TQM8555 help This option enables support for the TQ Components TQM8555 board. select DEFAULT_UIMAGE - select PPC_CPM_NEW_BINDING select TQM85xx select CPM2 @@ -93,7 +87,6 @@ config TQM8560 help This option enables support for the TQ Components TQM8560 board. select DEFAULT_UIMAGE - select PPC_CPM_NEW_BINDING select TQM85xx select CPM2 @@ -106,7 +99,6 @@ config SBC8548 config SBC8560 bool "Wind River SBC8560" select DEFAULT_UIMAGE - select PPC_CPM_NEW_BINDING if CPM2 help This option enables support for the Wind River SBC8560 board diff --git a/arch/powerpc/platforms/8xx/Kconfig b/arch/powerpc/platforms/8xx/Kconfig index 7fd224ca233d..6fc849e51e48 100644 --- a/arch/powerpc/platforms/8xx/Kconfig +++ b/arch/powerpc/platforms/8xx/Kconfig @@ -18,7 +18,6 @@ config MPC8XXFADS config MPC86XADS bool "MPC86XADS" select CPM1 - select PPC_CPM_NEW_BINDING help MPC86x Application Development System by Freescale Semiconductor. The MPC86xADS is meant to serve as a platform for s/w and h/w @@ -27,7 +26,6 @@ config MPC86XADS config MPC885ADS bool "MPC885ADS" select CPM1 - select PPC_CPM_NEW_BINDING help Freescale Semiconductor MPC885 Application Development System (ADS). Also known as DUET. @@ -37,7 +35,6 @@ config MPC885ADS config PPC_EP88XC bool "Embedded Planet EP88xC (a.k.a. CWH-PPC-885XN-VE)" select CPM1 - select PPC_CPM_NEW_BINDING help This enables support for the Embedded Planet EP88xC board. @@ -47,7 +44,6 @@ config PPC_EP88XC config PPC_ADDER875 bool "Analogue & Micro Adder 875" select CPM1 - select PPC_CPM_NEW_BINDING select REDBOOT help This enables support for the Analogue & Micro Adder 875 diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig index a578b966ecbc..f38c50b4ce56 100644 --- a/arch/powerpc/platforms/Kconfig +++ b/arch/powerpc/platforms/Kconfig @@ -290,13 +290,7 @@ config CPM2 config PPC_CPM_NEW_BINDING bool depends on CPM1 || CPM2 - help - Select this if your board has been converted to use the new - device tree bindings for CPM, and no longer needs the - ioport callbacks or the platform device glue code. - - The fs_enet and cpm_uart drivers will be built as - of_platform devices. + default y config AXON_RAM tristate "Axon DDR2 memory device driver" -- cgit v1.2.3 From 9c432797d30ffd10d5510854a0f762dc42903898 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Tue, 18 Mar 2008 18:43:59 +0300 Subject: [POWERPC] 83xx: mpc837x_rdb: add simple-bus compatible matching This is needed to probe nor and nand flashes on the localbus. Signed-off-by: Anton Vorontsov Signed-off-by: Kumar Gala --- arch/powerpc/platforms/83xx/mpc837x_rdb.c | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/83xx/mpc837x_rdb.c b/arch/powerpc/platforms/83xx/mpc837x_rdb.c index 2293ae51383d..c00356bdb1dd 100644 --- a/arch/powerpc/platforms/83xx/mpc837x_rdb.c +++ b/arch/powerpc/platforms/83xx/mpc837x_rdb.c @@ -46,6 +46,7 @@ static void __init mpc837x_rdb_setup_arch(void) static struct of_device_id mpc837x_ids[] = { { .type = "soc", }, { .compatible = "soc", }, + { .compatible = "simple-bus", }, {}, }; -- cgit v1.2.3 From 4e8aae89a35d1d572e9faca44fa9774329fceb80 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Tue, 15 Apr 2008 18:41:30 -0400 Subject: [POWERPC] 86xx: Add support for Wind River SBC8641D board This adds support for the Wind River SBC8641D board, based largely on the mpc86xx_hpcn support. The biggest difference is the lack of the Uli and the i8259 cascade, which simplifies things. Signed-off-by: Paul Gortmaker Signed-off-by: Kumar Gala --- arch/powerpc/platforms/86xx/Kconfig | 8 +- arch/powerpc/platforms/86xx/Makefile | 1 + arch/powerpc/platforms/86xx/sbc8641d.c | 164 +++++++++++++++++++++++++++++++++ 3 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 arch/powerpc/platforms/86xx/sbc8641d.c (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig index 21d113536b86..7442c58d44f5 100644 --- a/arch/powerpc/platforms/86xx/Kconfig +++ b/arch/powerpc/platforms/86xx/Kconfig @@ -11,6 +11,12 @@ config MPC8641_HPCN help This option enables support for the MPC8641 HPCN board. +config SBC8641D + bool "Wind River SBC8641D" + select DEFAULT_UIMAGE + help + This option enables support for the WRS SBC8641D board. + config MPC8610_HPCD bool "Freescale MPC8610 HPCD" select DEFAULT_UIMAGE @@ -24,7 +30,7 @@ config MPC8641 select FSL_PCI if PCI select PPC_UDBG_16550 select MPIC - default y if MPC8641_HPCN + default y if MPC8641_HPCN || SBC8641D config MPC8610 bool diff --git a/arch/powerpc/platforms/86xx/Makefile b/arch/powerpc/platforms/86xx/Makefile index c96706327eaa..1b9b4a9b2525 100644 --- a/arch/powerpc/platforms/86xx/Makefile +++ b/arch/powerpc/platforms/86xx/Makefile @@ -4,4 +4,5 @@ obj-$(CONFIG_SMP) += mpc86xx_smp.o obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o +obj-$(CONFIG_SBC8641D) += sbc8641d.o obj-$(CONFIG_MPC8610_HPCD) += mpc8610_hpcd.o diff --git a/arch/powerpc/platforms/86xx/sbc8641d.c b/arch/powerpc/platforms/86xx/sbc8641d.c new file mode 100644 index 000000000000..510a06ef0b55 --- /dev/null +++ b/arch/powerpc/platforms/86xx/sbc8641d.c @@ -0,0 +1,164 @@ +/* + * SBC8641D board specific routines + * + * Copyright 2008 Wind River Systems Inc. + * + * By Paul Gortmaker (see MAINTAINERS for contact information) + * + * Based largely on the 8641 HPCN support by Freescale Semiconductor Inc. + * + * 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 +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include "mpc86xx.h" + +static void __init +sbc8641_init_irq(void) +{ + struct mpic *mpic1; + struct device_node *np; + struct resource res; + + /* Determine PIC address. */ + np = of_find_node_by_type(NULL, "open-pic"); + if (np == NULL) + return; + of_address_to_resource(np, 0, &res); + + /* Alloc mpic structure and per isu has 16 INT entries. */ + mpic1 = mpic_alloc(np, res.start, + MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN, + 0, 256, " MPIC "); + of_node_put(np); + BUG_ON(mpic1 == NULL); + + mpic_init(mpic1); +} + +static void __init +sbc8641_setup_arch(void) +{ +#ifdef CONFIG_PCI + struct device_node *np; +#endif + + if (ppc_md.progress) + ppc_md.progress("sbc8641_setup_arch()", 0); + +#ifdef CONFIG_PCI + for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie") + fsl_add_bridge(np, 0); +#endif + + printk("SBC8641 board from Wind River\n"); + +#ifdef CONFIG_SMP + mpc86xx_smp_init(); +#endif +} + + +static void +sbc8641_show_cpuinfo(struct seq_file *m) +{ + struct device_node *root; + uint memsize = total_memory; + const char *model = ""; + uint svid = mfspr(SPRN_SVR); + + seq_printf(m, "Vendor\t\t: Wind River Systems\n"); + + root = of_find_node_by_path("/"); + if (root) + model = of_get_property(root, "model", NULL); + seq_printf(m, "Machine\t\t: %s\n", model); + of_node_put(root); + + seq_printf(m, "SVR\t\t: 0x%x\n", svid); + seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024)); +} + + +/* + * Called very early, device-tree isn't unflattened + */ +static int __init sbc8641_probe(void) +{ + unsigned long root = of_get_flat_dt_root(); + + if (of_flat_dt_is_compatible(root, "wind,sbc8641")) + return 1; /* Looks good */ + + return 0; +} + +static long __init +mpc86xx_time_init(void) +{ + unsigned int temp; + + /* Set the time base to zero */ + mtspr(SPRN_TBWL, 0); + mtspr(SPRN_TBWU, 0); + + temp = mfspr(SPRN_HID0); + temp |= HID0_TBEN; + mtspr(SPRN_HID0, temp); + asm volatile("isync"); + + return 0; +} + +static __initdata struct of_device_id of_bus_ids[] = { + { .compatible = "simple-bus", }, + {}, +}; + +static int __init declare_of_platform_devices(void) +{ + of_platform_bus_probe(NULL, of_bus_ids, NULL); + + return 0; +} +machine_device_initcall(sbc8641, declare_of_platform_devices); + +define_machine(sbc8641) { + .name = "SBC8641D", + .probe = sbc8641_probe, + .setup_arch = sbc8641_setup_arch, + .init_IRQ = sbc8641_init_irq, + .show_cpuinfo = sbc8641_show_cpuinfo, + .get_irq = mpic_get_irq, + .restart = fsl_rstcr_restart, + .time_init = mpc86xx_time_init, + .calibrate_decr = generic_calibrate_decr, + .progress = udbg_progress, +#ifdef CONFIG_PCI + .pcibios_fixup_bus = fsl_pcibios_fixup_bus, +#endif +}; -- cgit v1.2.3 From a5dc66e2ab2e2cf641346b056a69a67cfcf9458c Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Tue, 15 Apr 2008 23:35:47 -0500 Subject: [POWERPC] 85xx: Fix compile warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit arch/powerpc/platforms/85xx/mpc85xx_ads.c: In function ‘init_ioports’: arch/powerpc/platforms/85xx/mpc85xx_ads.c:168: warning: initialization discards qualifiers from pointer target type Signed-off-by: Kumar Gala --- arch/powerpc/platforms/85xx/mpc85xx_ads.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c index 4e0305096114..3582c841844b 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c @@ -165,7 +165,7 @@ static void __init init_ioports(void) int i; for (i = 0; i < ARRAY_SIZE(mpc8560_ads_pins); i++) { - struct cpm_pin *pin = &mpc8560_ads_pins[i]; + const struct cpm_pin *pin = &mpc8560_ads_pins[i]; cpm2_set_pin(pin->port, pin->pin, pin->flags); } -- cgit v1.2.3 From 06f35b4ba658ec9a447a5406a574258aaab1ba8d Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Wed, 16 Apr 2008 13:53:06 -0400 Subject: [POWERPC] 86xx: mark functions static, other minor cleanups Cleanups as suggested by Stephen Rothwell and Dale Farnsworth, which incudes marking a bunch of functions static and add a vendor prefix to the compat node check for uniqueness. Signed-off-by: Paul Gortmaker Signed-off-by: Kumar Gala --- arch/powerpc/platforms/86xx/mpc8610_hpcd.c | 4 ++-- arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c index 0b07485641fe..18b8ebe930d5 100644 --- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c +++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c @@ -52,7 +52,7 @@ static int __init mpc8610_declare_of_platform_devices(void) } machine_device_initcall(mpc86xx_hpcd, mpc8610_declare_of_platform_devices); -void __init +static void __init mpc86xx_hpcd_init_irq(void) { struct mpic *mpic1; @@ -200,7 +200,7 @@ static int __init mpc86xx_hpcd_probe(void) return 0; } -long __init +static long __init mpc86xx_time_init(void) { unsigned int temp; diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c index cfbe8c52e263..0764032e85aa 100644 --- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c @@ -55,7 +55,7 @@ static void mpc86xx_8259_cascade(unsigned int irq, struct irq_desc *desc) } #endif /* CONFIG_PCI */ -void __init +static void __init mpc86xx_hpcn_init_irq(void) { struct mpic *mpic1; @@ -162,7 +162,7 @@ mpc86xx_hpcn_setup_arch(void) } -void +static void mpc86xx_hpcn_show_cpuinfo(struct seq_file *m) { struct device_node *root; @@ -190,13 +190,13 @@ static int __init mpc86xx_hpcn_probe(void) { unsigned long root = of_get_flat_dt_root(); - if (of_flat_dt_is_compatible(root, "mpc86xx")) + if (of_flat_dt_is_compatible(root, "fsl,mpc8641hpcn")) return 1; /* Looks good */ return 0; } -long __init +static long __init mpc86xx_time_init(void) { unsigned int temp; -- cgit v1.2.3 From 16787b430dde9431445fd0874409adbb26558a2e Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Wed, 16 Apr 2008 13:53:07 -0400 Subject: [POWERPC] 86xx: mpc86xx_hpcn - Temporarily accept old dts node identifier. As suggested by Timur Tabi, we match on the old compat node ID for one version and warn accordingly. If we don't do this, we plunge people who try to use an old DTB into silent boot death with no clear indication of what the problem is. This patch should be removed at the beginning of the 2.6.27 dev cycle. It is only meant to ease the transition in the short term. Signed-off-by: Paul Gortmaker Signed-off-by: Kumar Gala --- arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c index 0764032e85aa..f947f555fd46 100644 --- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c @@ -193,6 +193,12 @@ static int __init mpc86xx_hpcn_probe(void) if (of_flat_dt_is_compatible(root, "fsl,mpc8641hpcn")) return 1; /* Looks good */ + /* Be nice and don't give silent boot death. Delete this in 2.6.27 */ + if (of_flat_dt_is_compatible(root, "mpc86xx")) { + pr_warning("WARNING: your dts/dtb is old. You must update before the next kernel release\n"); + return 1; + } + return 0; } -- cgit v1.2.3 From 1a9ebc0cd2b3bb4450834e564722630fbc40611b Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Wed, 9 Apr 2008 17:59:25 +0400 Subject: [POWERPC] 83xx: mpc8315 - fix USB UTMI Host setup Currently USB Host isn't functional on the MPC8315E boards, for two reasons as described below. MPC8315 Reference Manual says: "The USB DR unit must have the same clock ratio as the encryption core unit, unless one of them has its clock disabled." The encryption core also drives I2C clock, so it is enabled and is equal to 01. That means USBDRCM should be 01 here. Plus, according to MPC8315E-RDB schematics, USB unit consumes CLK_IN clock from the 24.00MHz oscillator, which means we must adjust REFSEL bits as well. p.s. Idially we should rework whole 83xx/usb.c code, in two steps: 1. Move SCCR code to the U-Boot; 2. Implement fsl,usb-clock property in the device tree, so usb.c could decide what clock exactly to use on per-board basis. Though, today we're not in a hurry since there is just one 8315e board out there. Signed-off-by: Anton Vorontsov Signed-off-by: Kumar Gala --- arch/powerpc/platforms/83xx/mpc83xx.h | 2 ++ arch/powerpc/platforms/83xx/usb.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h index 68065e62fc3d..88a3b5cabb18 100644 --- a/arch/powerpc/platforms/83xx/mpc83xx.h +++ b/arch/powerpc/platforms/83xx/mpc83xx.h @@ -16,6 +16,7 @@ #define MPC83XX_SCCR_USB_DRCM_10 0x00200000 #define MPC8315_SCCR_USB_MASK 0x00c00000 #define MPC8315_SCCR_USB_DRCM_11 0x00c00000 +#define MPC8315_SCCR_USB_DRCM_01 0x00400000 #define MPC837X_SCCR_USB_DRCM_11 0x00c00000 /* system i/o configuration register low */ @@ -37,6 +38,7 @@ /* USB Control Register */ #define FSL_USB2_CONTROL_OFFS 0x500 #define CONTROL_UTMI_PHY_EN 0x00000200 +#define CONTROL_REFSEL_24MHZ 0x00000040 #define CONTROL_REFSEL_48MHZ 0x00000080 #define CONTROL_PHY_CLK_SEL_ULPI 0x00000400 #define CONTROL_OTG_PORT 0x00000020 diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c index 471fdd8f4108..64bcf0a33c71 100644 --- a/arch/powerpc/platforms/83xx/usb.c +++ b/arch/powerpc/platforms/83xx/usb.c @@ -129,7 +129,7 @@ int mpc831x_usb_cfg(void) if (immr_node && of_device_is_compatible(immr_node, "fsl,mpc8315-immr")) clrsetbits_be32(immap + MPC83XX_SCCR_OFFS, MPC8315_SCCR_USB_MASK, - MPC8315_SCCR_USB_DRCM_11); + MPC8315_SCCR_USB_DRCM_01); else clrsetbits_be32(immap + MPC83XX_SCCR_OFFS, MPC83XX_SCCR_USB_MASK, @@ -164,9 +164,15 @@ int mpc831x_usb_cfg(void) /* Using on-chip PHY */ if (prop && (!strcmp(prop, "utmi_wide") || !strcmp(prop, "utmi"))) { - /* Set UTMI_PHY_EN, REFSEL to 48MHZ */ + u32 refsel; + + if (of_device_is_compatible(immr_node, "fsl,mpc8315-immr")) + refsel = CONTROL_REFSEL_24MHZ; + else + refsel = CONTROL_REFSEL_48MHZ; + /* Set UTMI_PHY_EN and REFSEL */ out_be32(usb_regs + FSL_USB2_CONTROL_OFFS, - CONTROL_UTMI_PHY_EN | CONTROL_REFSEL_48MHZ); + CONTROL_UTMI_PHY_EN | refsel); /* Using external UPLI PHY */ } else if (prop && !strcmp(prop, "ulpi")) { /* Set PHY_CLK_SEL to ULPI */ -- cgit v1.2.3 From 032ace7e17f141a5cf350e4ec0c5bf4f5faf1c49 Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Tue, 1 Apr 2008 17:42:25 +1100 Subject: [POWERPC] Move xics_setup_8259_cascade() into platforms/pseries/setup.c The code in xics.c to setup the i8259 cascaded irq handler is not really xics specific, so move it into setup.c - we will clean this up further in a subsequent patch. Signed-off-by: Michael Ellerman Acked-by: Benjamin Herrenschmidt Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/setup.c | 53 +++++++++++++++++++++++++++++++++- arch/powerpc/platforms/pseries/xics.c | 48 ------------------------------ arch/powerpc/platforms/pseries/xics.h | 3 -- 3 files changed, 52 insertions(+), 52 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index fccca89ee04e..bef4f683285d 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -124,6 +124,51 @@ void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc) desc->chip->eoi(irq); } +static void __init xics_setup_8259_cascade(void) +{ + struct device_node *np, *old, *found = NULL; + int cascade, naddr; + const u32 *addrp; + unsigned long intack = 0; + + for_each_node_by_type(np, "interrupt-controller") + if (of_device_is_compatible(np, "chrp,iic")) { + found = np; + break; + } + if (found == NULL) { + printk(KERN_DEBUG "xics: no ISA interrupt controller\n"); + return; + } + cascade = irq_of_parse_and_map(found, 0); + if (cascade == NO_IRQ) { + printk(KERN_ERR "xics: failed to map cascade interrupt"); + return; + } + pr_debug("xics: cascade mapped to irq %d\n", cascade); + + for (old = of_node_get(found); old != NULL ; old = np) { + np = of_get_parent(old); + of_node_put(old); + if (np == NULL) + break; + if (strcmp(np->name, "pci") != 0) + continue; + addrp = of_get_property(np, "8259-interrupt-acknowledge", NULL); + if (addrp == NULL) + continue; + naddr = of_n_addr_cells(np); + intack = addrp[naddr-1]; + if (naddr > 1) + intack |= ((unsigned long)addrp[naddr-2]) << 32; + } + if (intack) + printk(KERN_DEBUG "xics: PCI 8259 intack at 0x%016lx\n", intack); + i8259_init(found, intack); + of_node_put(found); + set_irq_chained_handler(cascade, pseries_8259_cascade); +} + static void __init pseries_mpic_init_IRQ(void) { struct device_node *np, *old, *cascade = NULL; @@ -203,6 +248,12 @@ static void __init pseries_mpic_init_IRQ(void) set_irq_chained_handler(cascade_irq, pseries_8259_cascade); } +static void __init pseries_xics_init_IRQ(void) +{ + xics_init_IRQ(); + xics_setup_8259_cascade(); +} + static void pseries_lpar_enable_pmcs(void) { unsigned long set, reset; @@ -232,7 +283,7 @@ static void __init pseries_discover_pic(void) smp_init_pseries_mpic(); return; } else if (strstr(typep, "ppc-xicp")) { - ppc_md.init_IRQ = xics_init_IRQ; + ppc_md.init_IRQ = pseries_xics_init_IRQ; setup_kexec_cpu_down_xics(); smp_init_pseries_xics(); return; diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c index a977f200db89..c3f05d4aff4d 100644 --- a/arch/powerpc/platforms/pseries/xics.c +++ b/arch/powerpc/platforms/pseries/xics.c @@ -655,52 +655,6 @@ static void __init xics_init_one_node(struct device_node *np, } } - -static void __init xics_setup_8259_cascade(void) -{ - struct device_node *np, *old, *found = NULL; - int cascade, naddr; - const u32 *addrp; - unsigned long intack = 0; - - for_each_node_by_type(np, "interrupt-controller") - if (of_device_is_compatible(np, "chrp,iic")) { - found = np; - break; - } - if (found == NULL) { - printk(KERN_DEBUG "xics: no ISA interrupt controller\n"); - return; - } - cascade = irq_of_parse_and_map(found, 0); - if (cascade == NO_IRQ) { - printk(KERN_ERR "xics: failed to map cascade interrupt"); - return; - } - pr_debug("xics: cascade mapped to irq %d\n", cascade); - - for (old = of_node_get(found); old != NULL ; old = np) { - np = of_get_parent(old); - of_node_put(old); - if (np == NULL) - break; - if (strcmp(np->name, "pci") != 0) - continue; - addrp = of_get_property(np, "8259-interrupt-acknowledge", NULL); - if (addrp == NULL) - continue; - naddr = of_n_addr_cells(np); - intack = addrp[naddr-1]; - if (naddr > 1) - intack |= ((unsigned long)addrp[naddr-2]) << 32; - } - if (intack) - printk(KERN_DEBUG "xics: PCI 8259 intack at 0x%016lx\n", intack); - i8259_init(found, intack); - of_node_put(found); - set_irq_chained_handler(cascade, pseries_8259_cascade); -} - void __init xics_init_IRQ(void) { struct device_node *np; @@ -733,8 +687,6 @@ void __init xics_init_IRQ(void) xics_setup_cpu(); - xics_setup_8259_cascade(); - ppc64_boot_msg(0x21, "XICS Done"); } diff --git a/arch/powerpc/platforms/pseries/xics.h b/arch/powerpc/platforms/pseries/xics.h index c26bcff47b6d..1c5321ae8f2f 100644 --- a/arch/powerpc/platforms/pseries/xics.h +++ b/arch/powerpc/platforms/pseries/xics.h @@ -28,7 +28,4 @@ struct xics_ipi_struct { extern struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned; -struct irq_desc; -extern void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc); - #endif /* _POWERPC_KERNEL_XICS_H */ -- cgit v1.2.3 From 30d6ad251b5dcf497a266c4dc7d38fcde7185422 Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Tue, 1 Apr 2008 17:42:25 +1100 Subject: [POWERPC] Turn xics_setup_8259_cascade() into a generic pseries_setup_i8259_cascade() Remove the xics references from xics_setup_8259_cascade(), and merge the good bits from the almost identical logic in pseries_mpic_init_IRQ(). Signed-off-by: Michael Ellerman Acked-by: Benjamin Herrenschmidt Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/setup.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index bef4f683285d..eb079521fbf1 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -124,28 +124,32 @@ void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc) desc->chip->eoi(irq); } -static void __init xics_setup_8259_cascade(void) +static void __init pseries_setup_i8259_cascade(void) { struct device_node *np, *old, *found = NULL; - int cascade, naddr; + unsigned int cascade; const u32 *addrp; unsigned long intack = 0; + int naddr; - for_each_node_by_type(np, "interrupt-controller") + for_each_node_by_type(np, "interrupt-controller") { if (of_device_is_compatible(np, "chrp,iic")) { found = np; break; } + } + if (found == NULL) { - printk(KERN_DEBUG "xics: no ISA interrupt controller\n"); + printk(KERN_DEBUG "pic: no ISA interrupt controller\n"); return; } + cascade = irq_of_parse_and_map(found, 0); if (cascade == NO_IRQ) { - printk(KERN_ERR "xics: failed to map cascade interrupt"); + printk(KERN_ERR "pic: failed to map cascade interrupt"); return; } - pr_debug("xics: cascade mapped to irq %d\n", cascade); + pr_debug("pic: cascade mapped to irq %d\n", cascade); for (old = of_node_get(found); old != NULL ; old = np) { np = of_get_parent(old); @@ -163,7 +167,7 @@ static void __init xics_setup_8259_cascade(void) intack |= ((unsigned long)addrp[naddr-2]) << 32; } if (intack) - printk(KERN_DEBUG "xics: PCI 8259 intack at 0x%016lx\n", intack); + printk(KERN_DEBUG "pic: PCI 8259 intack at 0x%016lx\n", intack); i8259_init(found, intack); of_node_put(found); set_irq_chained_handler(cascade, pseries_8259_cascade); @@ -251,7 +255,7 @@ static void __init pseries_mpic_init_IRQ(void) static void __init pseries_xics_init_IRQ(void) { xics_init_IRQ(); - xics_setup_8259_cascade(); + pseries_setup_i8259_cascade(); } static void pseries_lpar_enable_pmcs(void) -- cgit v1.2.3 From f01567d6d5688f8f613cd23da31aaf02d9538525 Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Tue, 1 Apr 2008 17:42:26 +1100 Subject: [POWERPC] Use pseries_setup_i8259_cascade() in pseries_mpic_init_IRQ() pseries_mpic_init_IRQ() implements the same logic as the xics code did to find the i8259 cascade irq. Now that we've pulled that logic out into pseries_setup_i8259_cascade() we can use it in the mpic code. Signed-off-by: Michael Ellerman Acked-by: Benjamin Herrenschmidt Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/setup.c | 43 ++-------------------------------- 1 file changed, 2 insertions(+), 41 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index eb079521fbf1..f66aa9c3b135 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -175,12 +175,9 @@ static void __init pseries_setup_i8259_cascade(void) static void __init pseries_mpic_init_IRQ(void) { - struct device_node *np, *old, *cascade = NULL; - const unsigned int *addrp; - unsigned long intack = 0; + struct device_node *np; const unsigned int *opprop; unsigned long openpic_addr = 0; - unsigned int cascade_irq; int naddr, n, i, opplen; struct mpic *mpic; @@ -213,43 +210,7 @@ static void __init pseries_mpic_init_IRQ(void) mpic_init(mpic); /* Look for cascade */ - for_each_node_by_type(np, "interrupt-controller") - if (of_device_is_compatible(np, "chrp,iic")) { - cascade = np; - break; - } - if (cascade == NULL) - return; - - cascade_irq = irq_of_parse_and_map(cascade, 0); - if (cascade_irq == NO_IRQ) { - printk(KERN_ERR "mpic: failed to map cascade interrupt"); - return; - } - - /* Check ACK type */ - for (old = of_node_get(cascade); old != NULL ; old = np) { - np = of_get_parent(old); - of_node_put(old); - if (np == NULL) - break; - if (strcmp(np->name, "pci") != 0) - continue; - addrp = of_get_property(np, "8259-interrupt-acknowledge", - NULL); - if (addrp == NULL) - continue; - naddr = of_n_addr_cells(np); - intack = addrp[naddr-1]; - if (naddr > 1) - intack |= ((unsigned long)addrp[naddr-2]) << 32; - } - if (intack) - printk(KERN_DEBUG "mpic: PCI 8259 intack at 0x%016lx\n", - intack); - i8259_init(cascade, intack); - of_node_put(cascade); - set_irq_chained_handler(cascade_irq, pseries_8259_cascade); + pseries_setup_i8259_cascade(); } static void __init pseries_xics_init_IRQ(void) -- cgit v1.2.3 From 1af9fa8994a049359c2bb9093a2f33775e28e7ea Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Tue, 1 Apr 2008 17:42:27 +1100 Subject: [POWERPC] Simplify xics direct/lpar irq_host setup The xics code currently has a direct and lpar variant of xics_host_map, the only difference being which irq_chip they use. If we remember which irq_chip we're using we can combine these two routines. That also allows us to have a single irq_host_ops instead of two. Signed-off-by: Michael Ellerman Acked-by: Benjamin Herrenschmidt Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/xics.c | 39 +++++++++++------------------------ 1 file changed, 12 insertions(+), 27 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c index c3f05d4aff4d..43df53c30aa0 100644 --- a/arch/powerpc/platforms/pseries/xics.c +++ b/arch/powerpc/platforms/pseries/xics.c @@ -516,6 +516,8 @@ static struct irq_chip xics_pic_lpar = { .set_affinity = xics_set_affinity }; +/* Points to the irq_chip we're actually using */ +static struct irq_chip *xics_irq_chip; static int xics_host_match(struct irq_host *h, struct device_node *node) { @@ -526,23 +528,13 @@ static int xics_host_match(struct irq_host *h, struct device_node *node) return !of_device_is_compatible(node, "chrp,iic"); } -static int xics_host_map_direct(struct irq_host *h, unsigned int virq, - irq_hw_number_t hw) +static int xics_host_map(struct irq_host *h, unsigned int virq, + irq_hw_number_t hw) { - pr_debug("xics: map_direct virq %d, hwirq 0x%lx\n", virq, hw); + pr_debug("xics: map virq %d, hwirq 0x%lx\n", virq, hw); get_irq_desc(virq)->status |= IRQ_LEVEL; - set_irq_chip_and_handler(virq, &xics_pic_direct, handle_fasteoi_irq); - return 0; -} - -static int xics_host_map_lpar(struct irq_host *h, unsigned int virq, - irq_hw_number_t hw) -{ - pr_debug("xics: map_direct virq %d, hwirq 0x%lx\n", virq, hw); - - get_irq_desc(virq)->status |= IRQ_LEVEL; - set_irq_chip_and_handler(virq, &xics_pic_lpar, handle_fasteoi_irq); + set_irq_chip_and_handler(virq, xics_irq_chip, handle_fasteoi_irq); return 0; } @@ -561,27 +553,20 @@ static int xics_host_xlate(struct irq_host *h, struct device_node *ct, return 0; } -static struct irq_host_ops xics_host_direct_ops = { +static struct irq_host_ops xics_host_ops = { .match = xics_host_match, - .map = xics_host_map_direct, - .xlate = xics_host_xlate, -}; - -static struct irq_host_ops xics_host_lpar_ops = { - .match = xics_host_match, - .map = xics_host_map_lpar, + .map = xics_host_map, .xlate = xics_host_xlate, }; static void __init xics_init_host(void) { - struct irq_host_ops *ops; - if (firmware_has_feature(FW_FEATURE_LPAR)) - ops = &xics_host_lpar_ops; + xics_irq_chip = &xics_pic_lpar; else - ops = &xics_host_direct_ops; - xics_host = irq_alloc_host(NULL, IRQ_HOST_MAP_TREE, 0, ops, + xics_irq_chip = &xics_pic_direct; + + xics_host = irq_alloc_host(NULL, IRQ_HOST_MAP_TREE, 0, &xics_host_ops, XICS_IRQ_SPURIOUS); BUG_ON(xics_host == NULL); irq_set_default_host(xics_host); -- cgit v1.2.3