* glibc-2.5 test suite hangs/crashes the machine
From: Fabio Massimo Di Nitto @ 2006-10-27 5:56 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras
Cc: linuxppc-dev, Jeff Bailey, Ben Collins
Hi everybody,
i am in the process of bootstrapping the new toolchain for ubuntu and I am
hitting a problem building glibc-2.5 on ppc.
This behaviour has been reproduced on 2.6.15/2.6.17 and 2.6.19-rc2 (where the
machine crashes) and with ppc32 and ppc64 kernels.
A hard reboot of the machine is required to get rid of the Zl processes hanging
around that keep spinning the CPU at 100%.
I did place sources here: http://people.ubuntu.com/~fabbione/benh/
but i start to believe it is a kernel bug we are exploiting only now.
Any hint or help for what to look for would be extremely appreciated.
Thanks
Fabio
--
I'm going to make him an offer he can't refuse.
^ permalink raw reply
* Re: [PATCH] General CHRP/MPC5K2 platform support patch
From: Benjamin Herrenschmidt @ 2006-10-27 3:28 UTC (permalink / raw)
To: Grant Likely; +Cc: akpm, sl, linuxppc-dev, linuxppc-embedded, sha
In-Reply-To: <528646bc0610261300s3e93e53fk5732990089b68d35@mail.gmail.com>
On Thu, 2006-10-26 at 14:00 -0600, Grant Likely wrote:
> My comments are satisfied
>
> Acked-by: Grant Likely <grant.likely@secretlab.ca>
Nack.
The irq code doesn't properly use the genirq infrastructure. It's not
setting flow handlers, not implementing set_irq_type, not using the new
mask/unmask instead of the toplevel enable/disable...
Ben.
> On 10/26/06, Nicolas DET <nd@bplan-gmbh.de> wrote:
> > Grant Likely wrote:
> >
> > >> +
> > >> +struct device_node *find_mpc52xx_pic(void)
> > >> +{
> > >> + struct device_node *dev;
> > >> + const char *piccompatible_list[] =
> > >> + {
> > >> + "mpc5200-interrupt-controller",
> > >> + "mpc52xx-interrupt-controller",
> > >> + "mpc52xx-pic",
> > >> + "mpc5200-pic",
> > >> + "5200-interrupt-controller",
> > >> + "52xx-interrupt-controller",
> > >> + "52xx-pic",
> > >> + "5200-pic",
> > >> + NULL
> > >> + };
> > >
> > > Considering Efika is the *only* CHRP 52xx board out there at the
> > > moment, and only a handful of embedded folks trying to move it to
> > > arch/powerpc, surely we can come to an agreement now on what this
> > > thing is named. :)
> > >
> > >
> >
> > Done
> >
> >
> >
> >
> > --- a/arch/powerpc/sysdev/Makefile 2006-10-25 19:07:24.000000000 +0200
> > +++ b/arch/powerpc/sysdev/Makefile 2006-10-26 11:38:02.000000000 +0200
> > @@ -13,6 +13,7 @@ obj-$(CONFIG_FSL_SOC) += fsl_soc.o
> > obj-$(CONFIG_PPC_TODC) += todc.o
> > obj-$(CONFIG_TSI108_BRIDGE) += tsi108_pci.o tsi108_dev.o
> > obj-$(CONFIG_QUICC_ENGINE) += qe_lib/
> > +obj-$(CONFIG_PPC_MPC52xx_PIC) += mpc52xx_pic.o
> >
> > ifeq ($(CONFIG_PPC_MERGE),y)
> > obj-$(CONFIG_PPC_I8259) += i8259.o
> > --- a/arch/powerpc/sysdev/mpc52xx_pic.c 1970-01-01 01:00:00.000000000 +0100
> > +++ b/arch/powerpc/sysdev/mpc52xx_pic.c 2006-10-26 21:32:05.000000000 +0200
> > @@ -0,0 +1,363 @@
> > +/*
> > + * arch/powerpc/sysdev/mpc52xx_pic.c
> > + *
> > + * Programmable Interrupt Controller functions for the Freescale MPC52xx
> > + * embedded CPU.
> > + * Modified for CHRP Efika 5K2
> > + *
> > + * Maintainer : Sylvain Munaut <tnt@246tNt.com>
> > + *
> > + * Based on (well, mostly copied from) the code from the 2.4 kernel by
> > + * Dale Farnsworth <dfarnsworth@mvista.com> and Kent Borg.
> > + *
> > + * Copyright (C) 2004 Sylvain Munaut <tnt@246tNt.com>
> > + * Copyright (C) 2003 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 <linux/stddef.h>
> > +#include <linux/init.h>
> > +#include <linux/sched.h>
> > +#include <linux/signal.h>
> > +#include <linux/stddef.h>
> > +#include <linux/delay.h>
> > +#include <linux/irq.h>
> > +
> > +#include <asm/io.h>
> > +#include <asm/processor.h>
> > +#include <asm/system.h>
> > +#include <asm/irq.h>
> > +#include <asm/prom.h>
> > +
> > +#include <asm/mpc52xx.h>
> > +
> > +static struct mpc52xx_intr __iomem *intr;
> > +static struct mpc52xx_sdma __iomem *sdma;
> > +
> > +static struct irq_host *mpc52xx_irqhost = NULL;
> > +
> > +static void mpc52xx_ic_disable(unsigned int virq)
> > +{
> > + u32 val;
> > + int irq;
> > +
> > + irq = irq_map[virq].hwirq;
> > +
> > + pr_debug("%s: irq=%d\n", __func__, irq);
> > +
> > + if (irq == MPC52xx_IRQ0) {
> > + val = in_be32(&intr->ctrl);
> > + val &= ~(1 << 11);
> > + out_be32(&intr->ctrl, val);
> > + } else if (irq < MPC52xx_IRQ1) {
> > + BUG();
> > + } else if (irq <= MPC52xx_IRQ3) {
> > + val = in_be32(&intr->ctrl);
> > + val &= ~(1 << (10 - (irq - MPC52xx_IRQ1)));
> > + out_be32(&intr->ctrl, val);
> > + } else if (irq < MPC52xx_SDMA_IRQ_BASE) {
> > + val = in_be32(&intr->main_mask);
> > + val |= 1 << (16 - (irq - MPC52xx_MAIN_IRQ_BASE));
> > + out_be32(&intr->main_mask, val);
> > + } else if (irq < MPC52xx_PERP_IRQ_BASE) {
> > + val = in_be32(&sdma->IntMask);
> > + val |= 1 << (irq - MPC52xx_SDMA_IRQ_BASE);
> > + out_be32(&sdma->IntMask, val);
> > + } else {
> > + val = in_be32(&intr->per_mask);
> > + val |= 1 << (31 - (irq - MPC52xx_PERP_IRQ_BASE));
> > + out_be32(&intr->per_mask, val);
> > + }
> > +}
> > +
> > +static void mpc52xx_ic_enable(unsigned int virq)
> > +{
> > + u32 val;
> > + int irq;
> > +
> > + irq = irq_map[virq].hwirq;
> > +
> > + pr_debug("%s: irq=%d\n", __func__, irq);
> > +
> > + if (irq == MPC52xx_IRQ0) {
> > + val = in_be32(&intr->ctrl);
> > + val |= 1 << 11;
> > + out_be32(&intr->ctrl, val);
> > + } else if (irq < MPC52xx_IRQ1) {
> > + BUG();
> > + } else if (irq <= MPC52xx_IRQ3) {
> > + val = in_be32(&intr->ctrl);
> > + val |= 1 << (10 - (irq - MPC52xx_IRQ1));
> > + out_be32(&intr->ctrl, val);
> > + } else if (irq < MPC52xx_SDMA_IRQ_BASE) {
> > + val = in_be32(&intr->main_mask);
> > + val &= ~(1 << (16 - (irq - MPC52xx_MAIN_IRQ_BASE)));
> > + out_be32(&intr->main_mask, val);
> > + } else if (irq < MPC52xx_PERP_IRQ_BASE) {
> > + val = in_be32(&sdma->IntMask);
> > + val &= ~(1 << (irq - MPC52xx_SDMA_IRQ_BASE));
> > + out_be32(&sdma->IntMask, val);
> > + } else {
> > + val = in_be32(&intr->per_mask);
> > + val &= ~(1 << (31 - (irq - MPC52xx_PERP_IRQ_BASE)));
> > + out_be32(&intr->per_mask, val);
> > + }
> > +}
> > +
> > +static void mpc52xx_ic_ack(unsigned int virq)
> > +{
> > + u32 val;
> > + int irq;
> > +
> > + irq = irq_map[virq].hwirq;
> > +
> > + pr_debug("%s: irq=%d\n", __func__, irq);
> > +
> > + /*
> > + * Only some irqs are reset here, others in interrupting hardware.
> > + */
> > +
> > + switch (irq) {
> > + case MPC52xx_IRQ0:
> > + val = in_be32(&intr->ctrl);
> > + val |= 0x08000000;
> > + out_be32(&intr->ctrl, val);
> > + break;
> > + case MPC52xx_CCS_IRQ:
> > + val = in_be32(&intr->enc_status);
> > + val |= 0x00000400;
> > + out_be32(&intr->enc_status, val);
> > + break;
> > + case MPC52xx_IRQ1:
> > + val = in_be32(&intr->ctrl);
> > + val |= 0x04000000;
> > + out_be32(&intr->ctrl, val);
> > + break;
> > + case MPC52xx_IRQ2:
> > + val = in_be32(&intr->ctrl);
> > + val |= 0x02000000;
> > + out_be32(&intr->ctrl, val);
> > + break;
> > + case MPC52xx_IRQ3:
> > + val = in_be32(&intr->ctrl);
> > + val |= 0x01000000;
> > + out_be32(&intr->ctrl, val);
> > + break;
> > + default:
> > + if (irq >= MPC52xx_SDMA_IRQ_BASE
> > + && irq < (MPC52xx_SDMA_IRQ_BASE + MPC52xx_SDMA_IRQ_NUM)) {
> > + out_be32(&sdma->IntPend,
> > + 1 << (irq - MPC52xx_SDMA_IRQ_BASE));
> > + }
> > +
> > + break;
> > + }
> > +
> > +}
> > +
> > +static void mpc52xx_ic_disable_and_ack(unsigned int irq)
> > +{
> > + mpc52xx_ic_disable(irq);
> > + mpc52xx_ic_ack(irq);
> > +}
> > +
> > +static void mpc52xx_ic_end(unsigned int irq)
> > +{
> > + if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
> > + mpc52xx_ic_enable(irq);
> > +}
> > +
> > +static struct irq_chip mpc52xx_irqchip = {
> > + .name = " MPC52xx ",
> > + .enable = mpc52xx_ic_enable,
> > + .disable = mpc52xx_ic_disable,
> > + .ack = mpc52xx_ic_disable_and_ack,
> > + .end = mpc52xx_ic_end,
> > +};
> > +
> > +extern struct device_node *find_mpc52xx_pic(void);
> > +static int mpc52xx_irqhost_match(struct irq_host *h, struct device_node *node)
> > +{
> > + pr_debug("%s: %p vs %p\n", __func__, find_mpc52xx_pic(), node);
> > + return find_mpc52xx_pic() == node;
> > +}
> > +
> > +static int mpc52xx_irqhost_xlate(struct irq_host *h, struct device_node *ct,
> > + u32 * intspec, unsigned int intsize,
> > + irq_hw_number_t * out_hwirq,
> > + unsigned int *out_flags)
> > +{
> > + static unsigned char map_senses[4] = {
> > + IRQ_TYPE_LEVEL_HIGH,
> > + IRQ_TYPE_EDGE_FALLING,
> > + IRQ_TYPE_EDGE_RISING,
> > + IRQ_TYPE_LEVEL_LOW,
> > + };
> > +
> > + int intrvect_l1;
> > + int intrvect_l2;
> > + int intrvect_type;
> > + int intrvect_linux;
> > +
> > + pr_debug("%s:\n", __func__);
> > +
> > + if (intsize != 3)
> > + return -1;
> > +
> > + intrvect_l1 = (int)intspec[0];
> > + intrvect_l2 = (int)intspec[1];
> > + intrvect_type = (int)intspec[2];
> > +
> > + pr_debug("l1=%d, l2=%d, type=%d\n", intrvect_l1, intrvect_l2,
> > + intrvect_type);
> > +
> > + switch (intrvect_l1) {
> > + case 0: /* Critical */
> > + intrvect_linux = MPC52xx_CRIT_IRQ_BASE;
> > + break;
> > +
> > + case 1: /* Main */
> > + intrvect_linux = MPC52xx_MAIN_IRQ_BASE;
> > + break;
> > +
> > + case 2: /* Periph */
> > + intrvect_linux = MPC52xx_PERP_IRQ_BASE;
> > + break;
> > +
> > + case 3: /* Bestcomm */
> > + intrvect_linux = MPC52xx_SDMA_IRQ_BASE;
> > + break;
> > +
> > + default:
> > + if (printk_ratelimit())
> > + printk(KERN_ERR "Wrong L1 interrupt vector (%d)\n",
> > + intrvect_l1);
> > +
> > + return -1;
> > + }
> > +
> > + intrvect_linux += intrvect_l2;
> > +
> > + pr_debug("return %d\n", intrvect_linux);
> > +
> > + *out_hwirq = intrvect_linux;
> > + *out_flags = map_senses[intrvect_type];
> > +
> > + return 0;
> > +
> > +}
> > +
> > +int mpc52xx_irqhost_map(struct irq_host *h, unsigned int virq,
> > + irq_hw_number_t hw)
> > +{
> > + pr_debug("%s: v=%d, hw=%d\n", __func__, virq, (int)hw);
> > +
> > + return 0;
> > +}
> > +
> > +void mpc52xx_irqhost_unmap(struct irq_host *h, unsigned int virq)
> > +{
> > + pr_debug("%s: v=%d\n", __func__, virq);
> > +}
> > +
> > +static struct irq_host_ops mpc52xx_irqhost_ops = {
> > + .match = mpc52xx_irqhost_match,
> > + .xlate = mpc52xx_irqhost_xlate,
> > + .map = mpc52xx_irqhost_map,
> > + .unmap = mpc52xx_irqhost_unmap,
> > +};
> > +
> > +void __init mpc52xx_init_irq(void)
> > +{
> > + int i;
> > + u32 intr_ctrl;
> > +
> > + /* Remap the necessary zones */
> > + intr = ioremap(MPC52xx_PA(MPC52xx_INTR_OFFSET), MPC52xx_INTR_SIZE);
> > + sdma = ioremap(MPC52xx_PA(MPC52xx_SDMA_OFFSET), MPC52xx_SDMA_SIZE);
> > +
> > + if ((intr == NULL) || (sdma == NULL))
> > + panic("Can't ioremap PIC/SDMA register or init_irq !");
> > +
> > + /* Disable all interrupt sources. */
> > + out_be32(&sdma->IntPend, 0xffffffff); /* 1 means clear pending */
> > + out_be32(&sdma->IntMask, 0xffffffff); /* 1 means disabled */
> > + out_be32(&intr->per_mask, 0x7ffffc00); /* 1 means disabled */
> > + out_be32(&intr->main_mask, 0x00010fff); /* 1 means disabled */
> > + intr_ctrl = in_be32(&intr->ctrl);
> > + intr_ctrl &= 0x00ff0000; /* Keeps IRQ[0-3] config */
> > + intr_ctrl |= 0x0f000000 | /* clear IRQ 0-3 */
> > + 0x00001000 | /* MEE master external enable */
> > + 0x00000000 | /* 0 means disable IRQ 0-3 */
> > + 0x00000001; /* CEb route critical normally */
> > + out_be32(&intr->ctrl, intr_ctrl);
> > +
> > + /* Zero a bunch of the priority settings. */
> > + out_be32(&intr->per_pri1, 0);
> > + out_be32(&intr->per_pri2, 0);
> > + out_be32(&intr->per_pri3, 0);
> > + out_be32(&intr->main_pri1, 0);
> > + out_be32(&intr->main_pri2, 0);
> > + /* Initialize irq_desc[i].handler's with mpc52xx_ic. */
> > + for (i = 0; i < NR_IRQS; i++) {
> > + irq_desc[i].chip = &mpc52xx_irqchip;
> > + irq_desc[i].status = IRQ_LEVEL;
> > +
> > + }
> > +
> > +#define IRQn_MODE(intr_ctrl,irq) (((intr_ctrl) >> (22-(i<<1))) & 0x03)
> > + for (i = 0; i < 4; i++) {
> > + int mode;
> > + mode = IRQn_MODE(intr_ctrl, i);
> > + if ((mode == 0x1) || (mode == 0x2))
> > + irq_desc[i ? MPC52xx_IRQ1 + i -
> > + 1 : MPC52xx_IRQ0].status = 0;
> > + }
> > +
> > + /*
> > + * As last step, add an irq host to translate the real
> > + * hw irq information provided by the ofw to linux virq
> > + */
> > +
> > + mpc52xx_irqhost =
> > + irq_alloc_host(IRQ_HOST_MAP_LINEAR, NR_IRQS, &mpc52xx_irqhost_ops,
> > + -1);
> > + pr_debug("%s: mpc52xx_irqhost =%p\n", __func__, mpc52xx_irqhost);
> > +}
> > +
> > +unsigned int mpc52xx_get_irq(void)
> > +{
> > + u32 status;
> > + int virq;
> > + int irq = NO_IRQ_IGNORE;
> > +
> > + status = in_be32(&intr->enc_status);
> > + if (status & 0x00000400) { /* critical */
> > + irq = (status >> 8) & 0x3;
> > + if (irq == 2) /* high priority peripheral */
> > + goto peripheral;
> > + irq += MPC52xx_CRIT_IRQ_BASE;
> > + } else if (status & 0x00200000) { /* main */
> > + irq = (status >> 16) & 0x1f;
> > + if (irq == 4) /* low priority peripheral */
> > + goto peripheral;
> > + irq += MPC52xx_MAIN_IRQ_BASE;
> > + } else if (status & 0x20000000) { /* peripheral */
> > + peripheral:
> > + irq = (status >> 24) & 0x1f;
> > + if (irq == 0) { /* bestcomm */
> > + status = in_be32(&sdma->IntPend);
> > + irq = ffs(status) + MPC52xx_SDMA_IRQ_BASE - 1;
> > + } else
> > + irq += MPC52xx_PERP_IRQ_BASE;
> > +
> > + }
> > +
> > + virq = irq_linear_revmap(mpc52xx_irqhost, irq);
> > + pr_debug("%s: irq=%d -> %d\n", __func__, irq, virq);
> > +
> > + return virq;
> > +}
> > --- a/arch/powerpc/Kconfig 2006-10-25 19:07:23.000000000 +0200
> > +++ b/arch/powerpc/Kconfig 2006-10-26 18:55:58.000000000 +0200
> > @@ -384,6 +384,11 @@ config PPC_CHRP
> > select PPC_RTAS
> > select PPC_MPC106
> > select PPC_UDBG_16550
> > + select PPC_MPC52xx_PIC
> > + default y
> > +
> > +config PPC_MPC52xx_PIC
> > + bool
> > default y
> >
> > config PPC_PMAC
> > --- a/arch/powerpc/platforms/chrp/setup.c 2006-10-25 19:07:23.000000000 +0200
> > +++ b/arch/powerpc/platforms/chrp/setup.c 2006-10-26 21:47:29.000000000 +0200
> > @@ -51,6 +51,7 @@
> > #include <asm/mpic.h>
> > #include <asm/rtas.h>
> > #include <asm/xmon.h>
> > +#include <asm/mpc52xx.h>
> >
> > #include "chrp.h"
> >
> > @@ -435,6 +436,44 @@ static struct irqaction xmon_irqaction =
> > };
> > #endif
> >
> > +
> > +struct device_node *find_mpc52xx_pic(void)
> > +{
> > + struct device_node *dev;
> > + const char *piccompatible_list[] =
> > + {
> > + "mpc5200-pic",
> > + NULL
> > + };
> > +
> > + /* Look for an MPC52xx interrupt controller */
> > + for_each_node_by_type(dev, "interrupt-controller")
> > + {
> > + const char **piccompatible_entry = piccompatible_list;
> > +
> > + for(piccompatible_entry = piccompatible_list; *piccompatible_entry; piccompatible_entry++ )
> > + {
> > + if (device_is_compatible(dev, *piccompatible_entry ))
> > + return dev;
> > + }
> > + }
> > +
> > + return NULL;
> > +}
> > +
> > +static int __init chrp_find_mpc52xx_pic(void)
> > +{
> > + if (find_mpc52xx_pic())
> > + {
> > + printk(KERN_INFO "Found MPC52xx Interrupt Controller\n");
> > + ppc_md.get_irq = mpc52xx_get_irq;
> > + mpc52xx_init_irq();
> > + return 0;
> > + }
> > +
> > + return -ENODEV;
> > +}
> > +
> > static void __init chrp_find_8259(void)
> > {
> > struct device_node *np, *pic = NULL;
> > @@ -473,8 +512,11 @@ static void __init chrp_find_8259(void)
> > break;
> > }
> > if (np == NULL)
> > - printk(KERN_WARNING "Cannot find PCI interrupt acknowledge"
> > - " address, polling\n");
> > + {
> > + printk(KERN_WARNING "Cannot find PCI/i8259 interrupt acknowledge"
> > + " Fix your tree!\n");
> > + return;
> > + }
> >
> > i8259_init(pic, chrp_int_ack);
> > if (ppc_md.get_irq == NULL)
> > @@ -494,6 +536,8 @@ void __init chrp_init_IRQ(void)
> > #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON)
> > struct device_node *kbd;
> > #endif
> > +
> > + chrp_find_mpc52xx_pic();
> > chrp_find_openpic();
> > chrp_find_8259();
> >
> >
> >
> >
> >
>
>
^ permalink raw reply
* Re: [PATCH 2.6.19-rc3 1/2] ehea: kzalloc GFP_ATOMIC fix
From: Andrew Morton @ 2006-10-27 3:13 UTC (permalink / raw)
To: Jan-Bernd Themann
Cc: Thomas Klein, Jeff Garzik, Jan-Bernd Themann, netdev,
linux-kernel, linux-ppc, Christoph Raisch, Marcus Eder
In-Reply-To: <200610251311.43009.ossthema@de.ibm.com>
On Wed, 25 Oct 2006 13:11:42 +0200
Jan-Bernd Themann <ossthema@de.ibm.com> wrote:
> This patch fixes kzalloc parameters (GFP_ATOMIC instead of GFP_KERNEL)
why?
^ permalink raw reply
* Re: [PATCH] General CHRP/MPC5K2 platform support patch
From: Benjamin Herrenschmidt @ 2006-10-27 3:08 UTC (permalink / raw)
To: Sylvain Munaut; +Cc: akpm, sl, linuxppc-dev, linuxppc-embedded, sha
In-Reply-To: <4540F659.9070409@246tNt.com>
On Thu, 2006-10-26 at 19:54 +0200, Sylvain Munaut wrote:
> Hi Nicolas,
>
>
> I don't have much to add to what's already been posted, so here's a
> couple of details,
> mainly compatibility concerns with the legacy arch/ppc tree.
I'd rather not clobber the code to be compatible with arch/ppc... once
52xx is ported over, I'm happy to completely drop support for arch/ppc
52xx. If we want to keep dual support for a while and we are changing
APIs too much, we can just fork the drivers for a kernel version of two
until we are confident enough to drop the arch/ppc version.
> > diff -uprN a/include/asm-ppc/mpc52xx.h b/include/asm-ppc/mpc52xx.h
> > --- a/include/asm-ppc/mpc52xx.h 2006-10-25 19:07:48.000000000 +0200
> > +++ b/include/asm-ppc/mpc52xx.h 2006-10-25 19:11:55.000000000 +0200
> > @@ -119,7 +119,7 @@ enum ppc_sys_devices {
> > #define MPC52xx_SDMA_IRQ_NUM 17
> > #define MPC52xx_PERP_IRQ_NUM 23
> >
> > -#define MPC52xx_CRIT_IRQ_BASE 1
> > +#define MPC52xx_CRIT_IRQ_BASE 0
> As explained in IRC, I'm not sure about this.
> I was previously talked into applying this to avoid using interrupt
> number 0. In the LITE5200 IRQ0 is used for PCI. It's interrupt number
> is equal to MPC52xx_CRIT_IRQ_BASE and if it's 0 some drivers just don't
> work.
arch/powerpc has completely virtualized interrupt numbering. The
"hardware" numbers supported by a given interrupt controller are
generally not visible to a driver and can have any value including 0.
The system will assign virtual numbers when interrupts are "mapped" and
those will never be 0.
> That's when using the arch/ppc code. Apparently this is no longer an
> issue in arch/powerpc (someone to confirm and explain me why ? I would guess
> the irq_linear_revmap thingie ), but can a "standard" lite5200 be booted
> in a arch/powerpc kernel ?
Once the code has been ported over :-)
> So if no critical, I would postpone that change until it's confirmed
> a lite5200 can boot ...
It's not been ported yet I presume. Anyway, as I said, we shouldn't
bother too much about what is in arch/ppc. If we think we are changing
things in a conflicting way, then we should fork the drivers and
includes (you can have the same include in both asm-ppc and asm-powerpc,
the one matching you building ARCH will be used and they can have
different definitions).
> > -extern int mpc52xx_get_irq(void);
> > +extern unsigned int mpc52xx_get_irq(void);
> Mmmh, the one in arch/ppc is not unsigned but I guess the warning is fine.
We should instead create a new mpc52xx.h in include/asm-powerpc and
leave arch/ppc alone
> Finally, some triviality : The patch adds some space on empty lines. Also,
> the indentation is sometimes done with space and sometimes with space ...
Yeah, I've noticed that the patch is fairly whitespace damaged. It's
also incorrect in many ways concerning the hooking to genirq, I'm
surprised it works at all in fact.
It might be useful if somebody got me one of those boards (either efika
or lite5200b) so I can do some proper rework of that stuff.
Ben.
^ permalink raw reply
* Re: [PATCH] General CHRP/MPC5K2 platform support patch
From: Benjamin Herrenschmidt @ 2006-10-27 3:03 UTC (permalink / raw)
To: Sylvain Munaut; +Cc: akpm, linuxppc-embedded, sl, linuxppc-dev, sha
In-Reply-To: <4540F16E.2050305@246tNt.com>
> Since the bestcomm init is in a module, a different module could be
> implemented,
> (like bestcomm-chrp5k2.ko) that instead of clearing SRAM and doing
> everything
> from scrtch, would rely on the bootloader more. This would allow
> "custom" tasks
> to be marked as "don't touch". So if the bootloader want to load
> something that
> will not be altered by the linux driver (for whatever reason ...)
I don't think we should have two different modules.
We are talking here about arch/powerpc where the presence of a
device-tree is mandatory. Thus, we should rely on that and define
something based on that.
In any case, I strongly think a single module with a single API should
be able to deal with all the cases we need to define for loading the
tasks. As I defined in a separate email, that includes wether the tasks
are preloaded, provided as a blob in the device-tree (possibly via the
zImage wrapper, and thus still in the kernel tree), or hard coded in the
kernel driver (I don't like that solution though).
It's mostly a matter on how the thing initializes anyway. Once it's up
and running, the code path should be identical.
> However, for the tasks like FEC and ATA and everything supported in the
> kernel
> natively, I would still recommend reload the task code (anyway the
> driver is gonna
> reset the task and everything ...) Trying to reuse the microcode loaded
> by the
> bootloader is not a great idea IMHO. (Imagine, the fec driver is changed
> to use
> the latest microcode, but the bootloader is not ... both have to be in
> perfect sync ...)
Is there some versionning available with the microcode ? I'm afraid
there might not be (since that whole bestcomm business seems to be
immune to good ideas from whoever design the whole chip), but that would
be useful. I agree that having the task code coming from the firmware
might not be the best idea if there is no versionning, but it nicely
solves some of the problems related to distributing "binary blobs" ...
I'm sure debian would have issues with bestcomm code shipped with the
kernel....
If no versionning is available we might want to create one ourselves,
via a wiki possibly and one person (you ?) responsible for distributing
the "releases" and assigning them versions...
At which point, the device-tree can contain version information along
with the task code or pointers to the code in sram.
> We would still have to compare the internal FDT and the preloaded one
> though since
> they have to match ...
Ben.
^ permalink raw reply
* Re: [PATCH] General CHRP/MPC5K2 platform support patch
From: Benjamin Herrenschmidt @ 2006-10-27 2:57 UTC (permalink / raw)
To: John Rigby; +Cc: akpm, linuxppc-embedded, sl, linuxppc-dev, sha
In-Reply-To: <4b73d43f0610261017s38cdc78fn23ea07113bf8c0fc@mail.gmail.com>
On Thu, 2006-10-26 at 11:17 -0600, John Rigby wrote:
> >
> > * mpc5k2_bestcomm.c (& helpers): I've been in contact with others people
> > using bestcomm and please to see the development was still active. I'm
> > already using latest code on my board but this is not include in this
> > patch. Indeed, it needs some changes for ARCH=powerpc. Moreover, we have
> > a different approach for the tasks. I'll be pleased to work with the
> > bestcomm folks.
> >
>
> So you preload the bestcomm task code in your boot loader? Do those
> of us using other bootloaders still have the option of loading the
> task code later in linux?
>
> What api are you using? Sylvain's proposed one based on Dale's with
> some additions from me? Or have you come up with your own?
I think we need to look into 3 options for the bestcomm task code:
- Preloaded by the firmware
- In the device-tree but not preloaded
- In the kernel
Though we might want to completely dismiss the 3rd option and decide
that it has to be in the device-tree, wether it's provided by the
zImage wrapper, or by the firmware.
Do you see any other case ?
So we need to define the content of the various device nodes for those
3 cases. The 3rd case is easy: probably nothing to put there, purely an
in-kernel thing, unless the bestcomm task IDs related to a given cell
are always the same.
The two first ones are similar, with the exception that the "blob" is in
one case preloaded (thus we provide a property telling where it is in
the sram) and in the other case, the blob is in the DT itself, thus we
have a bit of "bootstrap" code that loads it. In both cases, tasks IDs
are known and thus the device-tree might contain the necessary binding
informations.
Now, in any case, the "drivers" need a way to link to their respective
"tasks". That is, the function drivers (FEC, ...) need to use functions
provided by the "bestcomm" driver to setup and use tasks. In order to do
that the function drivers need to provide enough information of course
to allow the bestcomm to properly find out the tasks.
That's why my idea is that we associate to "known" bestcomm tasks a name
(a string), for example, "fec-tx" and "fec-rx" and the function drivers
pass their device-node to the bestcomm drivers. The Bestcomm "driver"
can then look into the device-tree node for a property "bestcomm-task-%
s" where %s is the task "name", containing the task informations (ID,
position in a table, whatever, I don't remember the details, it's up to
you guys to define something).
That property can then be in the device own node, in the bestcomm node,
or absent in the case where the whole bestcom ucode is embedded in the
kernel itself, in which case the driver has an internal table to resolve
that, but I wonder if we shouldn't make madantory to at least have it in
the device-tree and thus ignore that case 3...
Ben.
^ permalink raw reply
* Re: [PATCH] General CHRP/MPC5K2 platform support patch
From: Benjamin Herrenschmidt @ 2006-10-27 2:49 UTC (permalink / raw)
To: Nicolas DET; +Cc: akpm, sl, linuxppc-dev, linuxppc-embedded, sha
In-Reply-To: <4540EB0E.2090000@bplan-gmbh.de>
Any reason why this is not static nor __init ? :
> +struct device_node *find_mpc52xx_pic(void)
> +{
> + struct device_node *dev;
> + const char *piccompatible_list[] =
> + {
> + "mpc5200-interrupt-controller",
> + "mpc52xx-interrupt-controller",
> + "mpc52xx-pic",
> + "mpc5200-pic",
> + "5200-interrupt-controller",
> + "52xx-interrupt-controller",
> + "52xx-pic",
> + "5200-pic",
> + NULL
> + };
> +
> + /* Look for an MPC52xx interrupt controller */
> + for_each_node_by_type(dev, "interrupt-controller")
> + {
> + const char **piccompatible_entry = piccompatible_list;
> +
> + for(piccompatible_entry = piccompatible_list; *piccompatible_entry; piccompatible_entry++ )
> + {
> + if (device_is_compatible(dev, *piccompatible_entry ))
> + return dev;
> + }
> + }
> +
> + return NULL;
> +}
> +
> +static int __init chrp_find_mpc52xx_pic(void)
> +{
> + if (find_mpc52xx_pic())
> + {
> + printk(KERN_INFO "Found MPC52xx Interrupt Controller\n");
> + ppc_md.get_irq = mpc52xx_get_irq;
> + mpc52xx_init_irq();
> + return 0;
> + }
> +
> + return -ENODEV;
> +}
I'm not sure I see any point in splitting in two functions like that
> static void __init chrp_find_8259(void)
> {
> struct device_node *np, *pic = NULL;
> @@ -473,8 +519,11 @@ static void __init chrp_find_8259(void)
> break;
> }
> if (np == NULL)
> - printk(KERN_WARNING "Cannot find PCI interrupt acknowledge"
> - " address, polling\n");
> + {
> + printk(KERN_WARNING "Cannot find PCI/i8259 interrupt acknowledge"
> + " Fix your tree!\n");
> + return;
> + }
Unrelated changes/fix, should probably be in a separate patch.
Cheers,
Ben.
^ permalink raw reply
* Re: [PATCH/RFC] Allow CONFIG_OF_FLAT_TREE to boot a non-arch/powerpc kernel
From: Grant Likely @ 2006-10-27 2:37 UTC (permalink / raw)
To: Vitaly Bordug, linuxppc-dev, Kumar Gala, Matthew McClintock, jdl
In-Reply-To: <528646bc0610261411y2bd7522co9693b33d8ddab5cd@mail.gmail.com>
BBTW, considering that this is a u-boot patch; sorry for posting this
here linuxppc-dev instead of u-boot-users.
g.
On 10/26/06, Grant Likely <grant.likely@secretlab.ca> wrote:
> BTW, can someone please actually test this w/ a arch/powerpc kernel?
> I've only got a lite5200b to play with, and it isn't ported yet. :)
>
> g.
>
> On 10/26/06, Grant Likely <grant.likely@secretlab.ca> wrote:
> > This patch allows an arch/ppc kernel to be booted by just passing 1 or 2
> > arguments to bootm. It removes the getenv("disable_of") test that used
> > to be used for this purpose.
> >
> > Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> > ---
> > common/cmd_bootm.c | 52 ++++++++++++++++++++--------------------------------
> > 1 files changed, 20 insertions(+), 32 deletions(-)
> >
> > diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
> > index 3091a58..07a9f12 100644
> > --- a/common/cmd_bootm.c
> > +++ b/common/cmd_bootm.c
> > @@ -833,10 +833,6 @@ #endif
> > printf ("ERROR: flat device tree size does not agree with image\n");
> > return;
> > }
> > -
> > - } else if (getenv("disable_of") == NULL) {
> > - printf ("ERROR: bootm needs flat device tree as third argument\n");
> > - return;
> > }
> > #endif
> > if (!data) {
> > @@ -913,23 +909,11 @@ #endif /* CONFIG_HW_WATCHDOG || CONFIG_W
> >
> > SHOW_BOOT_PROGRESS (15);
> >
> > -#ifndef CONFIG_OF_FLAT_TREE
> > -
> > #if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
> > unlock_ram_in_cache();
> > #endif
> >
> > - /*
> > - * Linux Kernel Parameters:
> > - * r3: ptr to board info data
> > - * r4: initrd_start or 0 if no initrd
> > - * r5: initrd_end - unused if r4 is 0
> > - * r6: Start of command line string
> > - * r7: End of command line string
> > - */
> > - (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
> > -
> > -#else /* CONFIG_OF_FLAT_TREE */
> > +#ifdef CONFIG_OF_FLAT_TREE
> > /* move of_flat_tree if needed */
> > if (of_data) {
> > ulong of_start, of_len;
> > @@ -949,29 +933,33 @@ #else /* CONFIG_OF_FLAT_TREE */
> > memmove ((void *)of_start, (void *)of_data, of_len);
> > }
> >
> > - ft_setup(of_flat_tree, kbd, initrd_start, initrd_end);
> > - /* ft_dump_blob(of_flat_tree); */
> > -
> > -#if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
> > - unlock_ram_in_cache();
> > + /*
> > + * Linux Kernel Parameters (passing board info data):
> > + * r3: ptr to board info data
> > + * r4: initrd_start or 0 if no initrd
> > + * r5: initrd_end - unused if r4 is 0
> > + * r6: Start of command line string
> > + * r7: End of command line string
> > + */
> > +#ifdef CONFIG_OF_FLAT_TREE
> > + if (!of_flat_tree) /* no device tree; boot old style */
> > #endif
> > + (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
> > + /* does not return */
> > +
> > /*
> > - * Linux Kernel Parameters:
> > + * Linux Kernel Parameters (passing device tree):
> > * r3: ptr to OF flat tree, followed by the board info data
> > * r4: physical pointer to the kernel itself
> > * r5: NULL
> > * r6: NULL
> > * r7: NULL
> > */
> > - if (getenv("disable_of") != NULL)
> > - (*kernel) ((bd_t *)of_flat_tree, initrd_start, initrd_end,
> > - cmd_start, cmd_end);
> > - else {
> > - ft_setup(of_flat_tree, kbd, initrd_start, initrd_end);
> > - /* ft_dump_blob(of_flat_tree); */
> > - (*kernel) ((bd_t *)of_flat_tree, (ulong)kernel, 0, 0, 0);
> > - }
> > -#endif /* CONFIG_OF_FLAT_TREE */
> > + ft_setup(of_flat_tree, kbd, initrd_start, initrd_end);
> > + /* ft_dump_blob(of_flat_tree); */
> > +
> > + (*kernel) ((bd_t *)of_flat_tree, (ulong)kernel, 0, 0, 0);
> > +#endif
> > }
> > #endif /* CONFIG_PPC */
> >
> > --
> > 1.4.3.rc2.g0503
> >
> >
>
>
> --
> Grant Likely, B.Sc. P.Eng.
> Secret Lab Technologies Ltd.
> grant.likely@secretlab.ca
> (403) 399-0195
>
--
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
^ permalink raw reply
* Building new FEC code on 8xx with 2.6.17 kernel
From: Robin Gilks @ 2006-10-27 1:41 UTC (permalink / raw)
To: ppc embedded list
Greetings
Just having a first stab at building for an 859T based product so I
assume I'll be using the new FEC driver. I'm getting two unresolved
references as follows:
drivers/built-in.o: In function
`fec_8xx_init':fec_main.c:(.init.text+0x1a40): undefined reference to
`fec_8xx_platform_init'
drivers/built-in.o: In function
`fec_8xx_cleanup':fec_main.c:(.exit.text+0x39c): undefined reference to
`fec_8xx_platform_cleanup'
No big deal as I can see an example for the netta platform (whatever
that is) that defines these functions and I can hack that to suit my
hardware - what I can't find is where CONFIG_NETTA is defined. I can't
find it in any Kconfig file, and I want to use the same mechanism for
selecting my platform.
Any ideas? (or is FEC still broken on CPM1 processors)
Cheers
--
Robin
=======================================================================
This email, including any attachments, is only for the intended
addressee. It is subject to copyright, is confidential and may be
the subject of legal or other privilege, none of which is waived or
lost by reason of this transmission.
If the receiver is not the intended addressee, please accept our
apologies, notify us by return, delete all copies and perform no
other act on the email.
Unfortunately, we cannot warrant that the email has not been
altered or corrupted during transmission.
=======================================================================
^ permalink raw reply
* Re: [PATCH 2/3] Create compat_sys_migrate_pages
From: Stephen Rothwell @ 2006-10-27 0:28 UTC (permalink / raw)
To: Christoph Lameter; +Cc: linux-mm, ppc-dev, paulus, LKML, ak
In-Reply-To: <Pine.LNX.4.64.0610261158130.2802@schroedinger.engr.sgi.com>
[-- Attachment #1: Type: text/plain, Size: 1272 bytes --]
On Thu, 26 Oct 2006 12:00:30 -0700 (PDT) Christoph Lameter <clameter@sgi.com> wrote:
>
> On Thu, 26 Oct 2006, Stephen Rothwell wrote:
>
> > This is needed on bigendian 64bit architectures. The obvious way to do
> > this (taking the other compat_ routines in this file as examples) is to
> > use compat_alloc_user_space and copy the bitmasks back there, however you
> > cannot call compat_alloc_user_space twice for a single system call and
> > this method saves two copies of the bitmasks.
>
> Well this means also that sys_mbind and sys_set_mempolicy are also
> broken because these functions also use get_nodes().
No they aren't because they have compat routines that convert the bitmaps
before calling the "normal" syscall. They, importantly, only use
compat_alloc_user_space once each.
> Fixing get_nodes() to do the proper thing would fix all of these
> without having to touch sys_migrate_pages or creating a compat_ function
> (which usually is placed in kernel/compat.c)
You need the compat_ version of the syscalls to know if you were called
from a 32bit application in order to know if you may need to fixup the
bitmaps that are passed from/to user mode.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: [PATCH 2/3] Create compat_sys_migrate_pages
From: Arnd Bergmann @ 2006-10-26 23:04 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linux-mm, ppc-dev, paulus, LKML, ak
In-Reply-To: <20061026135759.7cf2cd5c.sfr@canb.auug.org.au>
On Thursday 26 October 2006 05:57, Stephen Rothwell wrote:
> OOPS, forgot to add a couple of fixes. =A0Replacement of 2/3 only ...
Ok, so forget my reply to that.
Arnd <><
^ permalink raw reply
* Re: [PATCH 2/3] Create compat_sys_migrate_pages
From: Arnd Bergmann @ 2006-10-26 23:03 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linux-mm, ppc-dev, paulus, LKML, ak
In-Reply-To: <20061026133305.b0db54e6.sfr@canb.auug.org.au>
T24gVGh1cnNkYXkgMjYgT2N0b2JlciAyMDA2IDA1OjMzLCBTdGVwaGVuIFJvdGh3ZWxsIHdyb3Rl
Ogo+ICthc21saW5rYWdlIGxvbmcgY29tcGF0X3N5c19taWdyYXRlX3BhZ2VzKGNvbXBhdF9waWRf
dCBwaWQsCj4gK6CgoKCgoKCgoKCgoKCgoKCgoKCgoKCgY29tcGF0X3Vsb25nX3QgbWF4bm9kZSwK
PiAroKCgoKCgoKCgoKCgoKCgoKCgoKCgoKBjb25zdCBjb21wYXRfdWxvbmdfdCBfX3VzZXIgKm9s
ZF9ub2RlcywKPiAroKCgoKCgoKCgoKCgoKCgoKCgoKCgoKBjb25zdCBjb21wYXRfdWxvbmdfdCBf
X3VzZXIgKm5ld19ub2RlcykKPiArewo+ICugoKCgoKCgbm9kZW1hc2tfdCBvbGQ7Cj4gK6CgoKCg
oKBub2RlbWFza190IG5ldzsKPiAroKCgoKCgoGludCBlcnI7Cj4gKwo+ICugoKCgoKCgZXJyID0g
Z2V0X25vZGVzKCZvbGQsIG9sZF9ub2RlcywgbWF4bm9kZSk7Cj4gK6CgoKCgoKBpZiAoZXJyKQo+
ICugoKCgoKCgoKCgoKCgoKByZXR1cm4gZXJyOwo+ICsKPiAroKCgoKCgoGVyciA9IGdldF9ub2Rl
cygmbmV3LCBuZXdfbm9kZXMsIG1heG5vZGUpOwoKSSBndWVzcyB5b3Ugd2FudCB0byBjYWxsIGNv
bXBhdF9nZXRfbm9kZXMsIG5vdCBnZXRfbm9kZXMgaGVyZSwKcmlnaHQ/CgoJQXJuZCA8PjwK
^ permalink raw reply
* Re: [RFC] bootwrapper: prevent fdt from being overwritten by kernel
From: Mark A. Greer @ 2006-10-26 22:56 UTC (permalink / raw)
To: Mark A. Greer; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <20061026225045.GA19839@mag.az.mvista.com>
On Thu, Oct 26, 2006 at 03:50:45PM -0700, Mark A. Greer wrote:
> diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c
> index 234bb5b..4927c17 100644
> --- a/arch/powerpc/boot/main.c
> +++ b/arch/powerpc/boot/main.c
> @@ -169,7 +169,7 @@ static int is_elf32(void *hdr)
> return 1;
> }
>
> -static void prep_kernel(unsigned long *a1, unsigned long *a2)
> +static void get_elfheader(void)
> {
> int len;
>
> @@ -186,11 +186,13 @@ static void prep_kernel(unsigned long *a
> sizeof(elfheader));
>
> if (!is_elf64(elfheader) && !is_elf32(elfheader)) {
> - printf("Error: not a valid PPC32 or PPC64 ELF file!\n\r");
> exit();
> }
> - if (platform_ops.image_hdr)
> - platform_ops.image_hdr(elfheader);
> +}
> +
> +static void prep_kernel(unsigned long *a1, unsigned long *a2)
> +{
> + int len;
Oops, the "if (!is_elf64(elfheader) && !is_elf32(elfheader)) {"
check should stay in prep_kernel.
Mark
^ permalink raw reply
* [RFC] bootwrapper: prevent fdt from being overwritten by kernel
From: Mark A. Greer @ 2006-10-26 22:50 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
Paul,
If the fdt that's wrapped in a zImage isn't edited, it will still be
sitting in the zImage when the kernel boots
(i.e., at 0x400000 + <some offset into the zImage>).
That's okay until you get a large enough kernel (e.g., initramfs)
which will overwrite the fdt when the kernel is relocated to 0.
To handle that, I changed the sandpoint.c:platform_init() to base the
simple_alloc heap at the greater of either the end of the zImage or the end
of the kernel once its decompressed & relocated to 0. It then copies
the dtb to an area allocated by simple_alloc so I know its safe from
being overwritten.
In addition, I moved the vmlinux elf header decompress code from
prep_kernel() to its own routine and called it before platform_init.
I then pass the elf header ptr into platform_init. That way,
platform_init can figure out where the end of the kernel will
be and put the dtb beyond it. The OF code can now change
claim_base in platform_init instead of needing the platform_ops.image_hdr
hook.
Here is the patch that I'm talking about with the sandpoint piece there
for your reference.
If you're okay with the approach, let me know and I'll submit a real patch.
Mark
---
main.c | 14 +++++++++-----
of.c | 29 +++++++++++++----------------
ops.h | 4 ++--
sandpoint.c | 31 ++++++++++++++++++++++++++++---
4 files changed, 52 insertions(+), 26 deletions(-)
---
diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c
index 234bb5b..4927c17 100644
--- a/arch/powerpc/boot/main.c
+++ b/arch/powerpc/boot/main.c
@@ -169,7 +169,7 @@ static int is_elf32(void *hdr)
return 1;
}
-static void prep_kernel(unsigned long *a1, unsigned long *a2)
+static void get_elfheader(void)
{
int len;
@@ -186,11 +186,13 @@ static void prep_kernel(unsigned long *a
sizeof(elfheader));
if (!is_elf64(elfheader) && !is_elf32(elfheader)) {
- printf("Error: not a valid PPC32 or PPC64 ELF file!\n\r");
exit();
}
- if (platform_ops.image_hdr)
- platform_ops.image_hdr(elfheader);
+}
+
+static void prep_kernel(unsigned long *a1, unsigned long *a2)
+{
+ int len;
/* We need to alloc the memsize plus the file offset since gzip
* will expand the header (file offset), then the kernel, then
@@ -297,7 +299,9 @@ void start(unsigned long a1, unsigned lo
memset(&dt_ops, 0, sizeof(dt_ops));
memset(&console_ops, 0, sizeof(console_ops));
- if (platform_init(promptr, _dtb_start, _dtb_end))
+ get_elfheader();
+
+ if (platform_init(promptr, elfheader, _dtb_start, _dtb_end))
exit();
if (console_ops.open && (console_ops.open() < 0))
exit();
diff --git a/arch/powerpc/boot/of.c b/arch/powerpc/boot/of.c
index 0182f38..8a81212 100644
--- a/arch/powerpc/boot/of.c
+++ b/arch/powerpc/boot/of.c
@@ -194,20 +194,6 @@ #endif
return (void *)addr;
}
-static void of_image_hdr(const void *hdr)
-{
- const Elf64_Ehdr *elf64 = hdr;
-
- if (elf64->e_ident[EI_CLASS] == ELFCLASS64) {
- /*
- * Maintain a "magic" minimum address. This keeps some older
- * firmware platforms running.
- */
- if (claim_base < PROG_START)
- claim_base = PROG_START;
- }
-}
-
static void of_exit(void)
{
call_prom("exit", 0, 0);
@@ -256,9 +242,11 @@ static void of_console_write(char *buf,
call_prom("write", 3, 1, of_stdout_handle, buf, len);
}
-int platform_init(void *promptr, char *dt_blob_start, char *dt_blob_end)
+int platform_init(void *promptr, const void *elfhdr, char *dt_blob_start,
+ char *dt_blob_end)
{
- platform_ops.image_hdr = of_image_hdr;
+ const Elf64_Ehdr *elf64 = elfhdr;
+
platform_ops.malloc = of_try_claim;
platform_ops.exit = of_exit;
@@ -270,5 +258,14 @@ int platform_init(void *promptr, char *d
console_ops.write = of_console_write;
prom = (int (*)(void *))promptr;
+
+ if (elf64->e_ident[EI_CLASS] == ELFCLASS64) {
+ /*
+ * Maintain a "magic" minimum address. This keeps some older
+ * firmware platforms running.
+ */
+ if (claim_base < PROG_START)
+ claim_base = PROG_START;
+ }
return 0;
}
diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h
index 59832fb..97ca5d7 100644
--- a/arch/powerpc/boot/ops.h
+++ b/arch/powerpc/boot/ops.h
@@ -20,7 +20,6 @@ #define MAX_PROP_LEN 256 /* What should
/* Platform specific operations */
struct platform_ops {
void (*fixups)(void);
- void (*image_hdr)(const void *);
void * (*malloc)(u32 size);
void (*free)(void *ptr);
void * (*realloc)(void *ptr, unsigned long size);
@@ -59,7 +58,8 @@ struct serial_console_data {
void (*close)(void);
};
-int platform_init(void *promptr, char *dt_blob_start, char *dt_blob_end);
+int platform_init(void *promptr, const void *elfhdr, char *dt_blob_start,
+ char *dt_blob_end);
int ft_init(void *dt_blob, unsigned int max_size, unsigned int max_find_device);
int serial_console_init(void);
int ns16550_console_init(void *devp, struct serial_console_data *scdp);
diff --git a/arch/powerpc/boot/sandpoint.c b/arch/powerpc/boot/sandpoint.c
index 496cafd..61217c4 100644
--- a/arch/powerpc/boot/sandpoint.c
+++ b/arch/powerpc/boot/sandpoint.c
@@ -12,6 +12,8 @@
#include <stdarg.h>
#include <stddef.h>
#include "types.h"
+#include "elf.h"
+#include "page.h"
#include "string.h"
#include "stdio.h"
#include "io.h"
@@ -139,17 +141,40 @@ static void sandpoint_reset(void)
#define HEAP_SIZE (16*MB)
-int platform_init(void *promptr, char *dt_blob_start, char *dt_blob_end)
+int platform_init(void *promptr, const void *elfhdr, char *dt_blob_start,
+ char *dt_blob_end)
{
+ const Elf32_Ehdr *elf32 = elfhdr;
+ Elf32_Phdr *elf32ph = (Elf32_Phdr *)((unsigned long)elf32
+ + elf32->e_phoff);
+ char *heap_start, *dtb;
int dt_size = dt_blob_end - dt_blob_start;
if (dt_size <= 0) /* No fdt */
goto err_out;
- if ((unsigned)simple_alloc_init(_end, HEAP_SIZE, 2*KB, 16) > (32*MB))
+ if (elf32->e_ident[EI_CLASS] != ELFCLASS32)
goto err_out;
- if (ft_init(dt_blob_start, dt_size, 16))
+ /* Start heap after end of the zImage or end of the kernel,
+ * whichever is higher. That's so things allocated by
+ * simple_alloc won't overwrite any part of the zImage or
+ * get overwritten when the early kernel code relocates
+ * the kernel to 0.
+ */
+ heap_start = (char *)_ALIGN(elf32ph->p_memsz + elf32ph->p_offset, 4096);
+ heap_start = max(heap_start, (char *)_end);
+
+ if ((unsigned)simple_alloc_init(heap_start, HEAP_SIZE, 2*KB, 16)
+ > (32*MB))
+ goto err_out;
+
+ /* Relocate dtb to safe area past end of zImage & kernel */
+ dtb = malloc(dt_size);
+ if (!dtb)
+ goto err_out;
+ memmove(dtb, dt_blob_start, dt_size);
+ if (ft_init(dtb, dt_size, 16))
goto err_out;
platform_ops.fixups = sandpoint_fixups;
^ permalink raw reply related
* Re: CPM2 SCC/SMC break handling broken
From: Ricardo Scop @ 2006-10-26 21:18 UTC (permalink / raw)
To: Laurent Pinchart, linuxppc-embedded
In-Reply-To: <200610261002.44688.laurent.pinchart@tbox.biz>
On Thursday 26 October 2006 06:02, Laurent Pinchart wrote:
> Hi everybody,
>
> I need to generate a break on a CPM2 SMC serial port (same issue with S=
CC
> serial ports).
>
> The tcsendbreak() man page states that the function should generate a b=
reak
> between 250ms and 500ms, but testing showed that the break is one chara=
cter
> long (10 bits in 8N1 mode).
[snip]
> CPM_CR_STOP_TX is documented to generate a break of BRKCR characters. T=
he
> BRKCR register is initialized to 1, so only 1 break character is sent,
> which won't last between 250ms and 500ms.
[snip]
> Could anyone think of a proper solution which would not disturb the oth=
er
> drivers too much ?
Well, one could always set the BRKCR parameter to the maximum number of b=
reak=20
characters permitted by it's size, since the break condition will anyway =
end=20
as soon as the RESTART TX command is issued as a consequence of the=20
tty->driver->break_ctl(tty, 0) call. But I did not test this.
HTH,
--=20
Ricardo Scop.
\|/
___ -*-
(@ @)/|\
/ V \| R SCOP Consult.
/( )\ Linux-based communications
--^^---^^+------------------------------
rscop@matrix.com.br
+55 51 999-36-777
Porto Alegre, RS - BRazil
--
P. S.: "If you have any trouble sounding condescending, find a Unix user =
to
show you how it's done." -- Scott Adams, creator of "Dilbert"
^ permalink raw reply
* [PATCH/RFC] Allow CONFIG_OF_FLAT_TREE to boot a non-arch/powerpc kernel
From: Grant Likely @ 2006-10-26 21:08 UTC (permalink / raw)
To: Vitaly Bordug, linuxppc-dev, Kumar Gala, Matthew McClintock, jdl
This patch allows an arch/ppc kernel to be booted by just passing 1 or 2
arguments to bootm. It removes the getenv("disable_of") test that used
to be used for this purpose.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
common/cmd_bootm.c | 52 ++++++++++++++++++++--------------------------------
1 files changed, 20 insertions(+), 32 deletions(-)
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 3091a58..07a9f12 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -833,10 +833,6 @@ #endif
printf ("ERROR: flat device tree size does not agree with image\n");
return;
}
-
- } else if (getenv("disable_of") == NULL) {
- printf ("ERROR: bootm needs flat device tree as third argument\n");
- return;
}
#endif
if (!data) {
@@ -913,23 +909,11 @@ #endif /* CONFIG_HW_WATCHDOG || CONFIG_W
SHOW_BOOT_PROGRESS (15);
-#ifndef CONFIG_OF_FLAT_TREE
-
#if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
unlock_ram_in_cache();
#endif
- /*
- * Linux Kernel Parameters:
- * r3: ptr to board info data
- * r4: initrd_start or 0 if no initrd
- * r5: initrd_end - unused if r4 is 0
- * r6: Start of command line string
- * r7: End of command line string
- */
- (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
-
-#else /* CONFIG_OF_FLAT_TREE */
+#ifdef CONFIG_OF_FLAT_TREE
/* move of_flat_tree if needed */
if (of_data) {
ulong of_start, of_len;
@@ -949,29 +933,33 @@ #else /* CONFIG_OF_FLAT_TREE */
memmove ((void *)of_start, (void *)of_data, of_len);
}
- ft_setup(of_flat_tree, kbd, initrd_start, initrd_end);
- /* ft_dump_blob(of_flat_tree); */
-
-#if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
- unlock_ram_in_cache();
+ /*
+ * Linux Kernel Parameters (passing board info data):
+ * r3: ptr to board info data
+ * r4: initrd_start or 0 if no initrd
+ * r5: initrd_end - unused if r4 is 0
+ * r6: Start of command line string
+ * r7: End of command line string
+ */
+#ifdef CONFIG_OF_FLAT_TREE
+ if (!of_flat_tree) /* no device tree; boot old style */
#endif
+ (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
+ /* does not return */
+
/*
- * Linux Kernel Parameters:
+ * Linux Kernel Parameters (passing device tree):
* r3: ptr to OF flat tree, followed by the board info data
* r4: physical pointer to the kernel itself
* r5: NULL
* r6: NULL
* r7: NULL
*/
- if (getenv("disable_of") != NULL)
- (*kernel) ((bd_t *)of_flat_tree, initrd_start, initrd_end,
- cmd_start, cmd_end);
- else {
- ft_setup(of_flat_tree, kbd, initrd_start, initrd_end);
- /* ft_dump_blob(of_flat_tree); */
- (*kernel) ((bd_t *)of_flat_tree, (ulong)kernel, 0, 0, 0);
- }
-#endif /* CONFIG_OF_FLAT_TREE */
+ ft_setup(of_flat_tree, kbd, initrd_start, initrd_end);
+ /* ft_dump_blob(of_flat_tree); */
+
+ (*kernel) ((bd_t *)of_flat_tree, (ulong)kernel, 0, 0, 0);
+#endif
}
#endif /* CONFIG_PPC */
--
1.4.3.rc2.g0503
^ permalink raw reply related
* Re: [PATCH/RFC] Allow CONFIG_OF_FLAT_TREE to boot a non-arch/powerpc kernel
From: Grant Likely @ 2006-10-26 21:11 UTC (permalink / raw)
To: Vitaly Bordug, linuxppc-dev, Kumar Gala, Matthew McClintock, jdl
In-Reply-To: <11618969241015-git-send-email-grant.likely@secretlab.ca>
BTW, can someone please actually test this w/ a arch/powerpc kernel?
I've only got a lite5200b to play with, and it isn't ported yet. :)
g.
On 10/26/06, Grant Likely <grant.likely@secretlab.ca> wrote:
> This patch allows an arch/ppc kernel to be booted by just passing 1 or 2
> arguments to bootm. It removes the getenv("disable_of") test that used
> to be used for this purpose.
>
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
> common/cmd_bootm.c | 52 ++++++++++++++++++++--------------------------------
> 1 files changed, 20 insertions(+), 32 deletions(-)
>
> diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
> index 3091a58..07a9f12 100644
> --- a/common/cmd_bootm.c
> +++ b/common/cmd_bootm.c
> @@ -833,10 +833,6 @@ #endif
> printf ("ERROR: flat device tree size does not agree with image\n");
> return;
> }
> -
> - } else if (getenv("disable_of") == NULL) {
> - printf ("ERROR: bootm needs flat device tree as third argument\n");
> - return;
> }
> #endif
> if (!data) {
> @@ -913,23 +909,11 @@ #endif /* CONFIG_HW_WATCHDOG || CONFIG_W
>
> SHOW_BOOT_PROGRESS (15);
>
> -#ifndef CONFIG_OF_FLAT_TREE
> -
> #if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
> unlock_ram_in_cache();
> #endif
>
> - /*
> - * Linux Kernel Parameters:
> - * r3: ptr to board info data
> - * r4: initrd_start or 0 if no initrd
> - * r5: initrd_end - unused if r4 is 0
> - * r6: Start of command line string
> - * r7: End of command line string
> - */
> - (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
> -
> -#else /* CONFIG_OF_FLAT_TREE */
> +#ifdef CONFIG_OF_FLAT_TREE
> /* move of_flat_tree if needed */
> if (of_data) {
> ulong of_start, of_len;
> @@ -949,29 +933,33 @@ #else /* CONFIG_OF_FLAT_TREE */
> memmove ((void *)of_start, (void *)of_data, of_len);
> }
>
> - ft_setup(of_flat_tree, kbd, initrd_start, initrd_end);
> - /* ft_dump_blob(of_flat_tree); */
> -
> -#if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
> - unlock_ram_in_cache();
> + /*
> + * Linux Kernel Parameters (passing board info data):
> + * r3: ptr to board info data
> + * r4: initrd_start or 0 if no initrd
> + * r5: initrd_end - unused if r4 is 0
> + * r6: Start of command line string
> + * r7: End of command line string
> + */
> +#ifdef CONFIG_OF_FLAT_TREE
> + if (!of_flat_tree) /* no device tree; boot old style */
> #endif
> + (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
> + /* does not return */
> +
> /*
> - * Linux Kernel Parameters:
> + * Linux Kernel Parameters (passing device tree):
> * r3: ptr to OF flat tree, followed by the board info data
> * r4: physical pointer to the kernel itself
> * r5: NULL
> * r6: NULL
> * r7: NULL
> */
> - if (getenv("disable_of") != NULL)
> - (*kernel) ((bd_t *)of_flat_tree, initrd_start, initrd_end,
> - cmd_start, cmd_end);
> - else {
> - ft_setup(of_flat_tree, kbd, initrd_start, initrd_end);
> - /* ft_dump_blob(of_flat_tree); */
> - (*kernel) ((bd_t *)of_flat_tree, (ulong)kernel, 0, 0, 0);
> - }
> -#endif /* CONFIG_OF_FLAT_TREE */
> + ft_setup(of_flat_tree, kbd, initrd_start, initrd_end);
> + /* ft_dump_blob(of_flat_tree); */
> +
> + (*kernel) ((bd_t *)of_flat_tree, (ulong)kernel, 0, 0, 0);
> +#endif
> }
> #endif /* CONFIG_PPC */
>
> --
> 1.4.3.rc2.g0503
>
>
--
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
^ permalink raw reply
* Re: [PATCH] General CHRP/MPC5K2 platform support patch
From: Sylvain Munaut @ 2006-10-26 20:51 UTC (permalink / raw)
To: Grant Likely; +Cc: akpm, sl, linuxppc-dev, linuxppc-embedded, sha
In-Reply-To: <528646bc0610261300s3e93e53fk5732990089b68d35@mail.gmail.com>
FWIW, Looks good to me too.
Acked-by: Sylvain Munaut <tnt@246tNt.com>
It will need some changes when we'll get rid of the need to stay compatible
with arch/ppc. This will hopefully be soon and getting this in should help
get things moving imho.
Sylvain
Grant Likely wrote:
> My comments are satisfied
>
> Acked-by: Grant Likely <grant.likely@secretlab.ca>
>
> On 10/26/06, Nicolas DET <nd@bplan-gmbh.de> wrote:
>> Grant Likely wrote:
>>
>> >> +
>> >> +struct device_node *find_mpc52xx_pic(void)
>> >> +{
>> >> + struct device_node *dev;
>> >> + const char *piccompatible_list[] =
>> >> + {
>> >> + "mpc5200-interrupt-controller",
>> >> + "mpc52xx-interrupt-controller",
>> >> + "mpc52xx-pic",
>> >> + "mpc5200-pic",
>> >> + "5200-interrupt-controller",
>> >> + "52xx-interrupt-controller",
>> >> + "52xx-pic",
>> >> + "5200-pic",
>> >> + NULL
>> >> + };
>> >
>> > Considering Efika is the *only* CHRP 52xx board out there at the
>> > moment, and only a handful of embedded folks trying to move it to
>> > arch/powerpc, surely we can come to an agreement now on what this
>> > thing is named. :)
>> >
>> >
>>
>> Done
>>
>>
>>
>>
>> --- a/arch/powerpc/sysdev/Makefile 2006-10-25 19:07:24.000000000
>> +0200
>> +++ b/arch/powerpc/sysdev/Makefile 2006-10-26 11:38:02.000000000
>> +0200
>> @@ -13,6 +13,7 @@ obj-$(CONFIG_FSL_SOC) += fsl_soc.o
>> obj-$(CONFIG_PPC_TODC) += todc.o
>> obj-$(CONFIG_TSI108_BRIDGE) += tsi108_pci.o tsi108_dev.o
>> obj-$(CONFIG_QUICC_ENGINE) += qe_lib/
>> +obj-$(CONFIG_PPC_MPC52xx_PIC) += mpc52xx_pic.o
>>
>> ifeq ($(CONFIG_PPC_MERGE),y)
>> obj-$(CONFIG_PPC_I8259) += i8259.o
>> --- a/arch/powerpc/sysdev/mpc52xx_pic.c 1970-01-01 01:00:00.000000000
>> +0100
>> +++ b/arch/powerpc/sysdev/mpc52xx_pic.c 2006-10-26 21:32:05.000000000
>> +0200
>> @@ -0,0 +1,363 @@
>> +/*
>> + * arch/powerpc/sysdev/mpc52xx_pic.c
>> + *
>> + * Programmable Interrupt Controller functions for the Freescale
>> MPC52xx
>> + * embedded CPU.
>> + * Modified for CHRP Efika 5K2
>> + *
>> + * Maintainer : Sylvain Munaut <tnt@246tNt.com>
>> + *
>> + * Based on (well, mostly copied from) the code from the 2.4 kernel by
>> + * Dale Farnsworth <dfarnsworth@mvista.com> and Kent Borg.
>> + *
>> + * Copyright (C) 2004 Sylvain Munaut <tnt@246tNt.com>
>> + * Copyright (C) 2003 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 <linux/stddef.h>
>> +#include <linux/init.h>
>> +#include <linux/sched.h>
>> +#include <linux/signal.h>
>> +#include <linux/stddef.h>
>> +#include <linux/delay.h>
>> +#include <linux/irq.h>
>> +
>> +#include <asm/io.h>
>> +#include <asm/processor.h>
>> +#include <asm/system.h>
>> +#include <asm/irq.h>
>> +#include <asm/prom.h>
>> +
>> +#include <asm/mpc52xx.h>
>> +
>> +static struct mpc52xx_intr __iomem *intr;
>> +static struct mpc52xx_sdma __iomem *sdma;
>> +
>> +static struct irq_host *mpc52xx_irqhost = NULL;
>> +
>> +static void mpc52xx_ic_disable(unsigned int virq)
>> +{
>> + u32 val;
>> + int irq;
>> +
>> + irq = irq_map[virq].hwirq;
>> +
>> + pr_debug("%s: irq=%d\n", __func__, irq);
>> +
>> + if (irq == MPC52xx_IRQ0) {
>> + val = in_be32(&intr->ctrl);
>> + val &= ~(1 << 11);
>> + out_be32(&intr->ctrl, val);
>> + } else if (irq < MPC52xx_IRQ1) {
>> + BUG();
>> + } else if (irq <= MPC52xx_IRQ3) {
>> + val = in_be32(&intr->ctrl);
>> + val &= ~(1 << (10 - (irq - MPC52xx_IRQ1)));
>> + out_be32(&intr->ctrl, val);
>> + } else if (irq < MPC52xx_SDMA_IRQ_BASE) {
>> + val = in_be32(&intr->main_mask);
>> + val |= 1 << (16 - (irq - MPC52xx_MAIN_IRQ_BASE));
>> + out_be32(&intr->main_mask, val);
>> + } else if (irq < MPC52xx_PERP_IRQ_BASE) {
>> + val = in_be32(&sdma->IntMask);
>> + val |= 1 << (irq - MPC52xx_SDMA_IRQ_BASE);
>> + out_be32(&sdma->IntMask, val);
>> + } else {
>> + val = in_be32(&intr->per_mask);
>> + val |= 1 << (31 - (irq - MPC52xx_PERP_IRQ_BASE));
>> + out_be32(&intr->per_mask, val);
>> + }
>> +}
>> +
>> +static void mpc52xx_ic_enable(unsigned int virq)
>> +{
>> + u32 val;
>> + int irq;
>> +
>> + irq = irq_map[virq].hwirq;
>> +
>> + pr_debug("%s: irq=%d\n", __func__, irq);
>> +
>> + if (irq == MPC52xx_IRQ0) {
>> + val = in_be32(&intr->ctrl);
>> + val |= 1 << 11;
>> + out_be32(&intr->ctrl, val);
>> + } else if (irq < MPC52xx_IRQ1) {
>> + BUG();
>> + } else if (irq <= MPC52xx_IRQ3) {
>> + val = in_be32(&intr->ctrl);
>> + val |= 1 << (10 - (irq - MPC52xx_IRQ1));
>> + out_be32(&intr->ctrl, val);
>> + } else if (irq < MPC52xx_SDMA_IRQ_BASE) {
>> + val = in_be32(&intr->main_mask);
>> + val &= ~(1 << (16 - (irq - MPC52xx_MAIN_IRQ_BASE)));
>> + out_be32(&intr->main_mask, val);
>> + } else if (irq < MPC52xx_PERP_IRQ_BASE) {
>> + val = in_be32(&sdma->IntMask);
>> + val &= ~(1 << (irq - MPC52xx_SDMA_IRQ_BASE));
>> + out_be32(&sdma->IntMask, val);
>> + } else {
>> + val = in_be32(&intr->per_mask);
>> + val &= ~(1 << (31 - (irq - MPC52xx_PERP_IRQ_BASE)));
>> + out_be32(&intr->per_mask, val);
>> + }
>> +}
>> +
>> +static void mpc52xx_ic_ack(unsigned int virq)
>> +{
>> + u32 val;
>> + int irq;
>> +
>> + irq = irq_map[virq].hwirq;
>> +
>> + pr_debug("%s: irq=%d\n", __func__, irq);
>> +
>> + /*
>> + * Only some irqs are reset here, others in interrupting
>> hardware.
>> + */
>> +
>> + switch (irq) {
>> + case MPC52xx_IRQ0:
>> + val = in_be32(&intr->ctrl);
>> + val |= 0x08000000;
>> + out_be32(&intr->ctrl, val);
>> + break;
>> + case MPC52xx_CCS_IRQ:
>> + val = in_be32(&intr->enc_status);
>> + val |= 0x00000400;
>> + out_be32(&intr->enc_status, val);
>> + break;
>> + case MPC52xx_IRQ1:
>> + val = in_be32(&intr->ctrl);
>> + val |= 0x04000000;
>> + out_be32(&intr->ctrl, val);
>> + break;
>> + case MPC52xx_IRQ2:
>> + val = in_be32(&intr->ctrl);
>> + val |= 0x02000000;
>> + out_be32(&intr->ctrl, val);
>> + break;
>> + case MPC52xx_IRQ3:
>> + val = in_be32(&intr->ctrl);
>> + val |= 0x01000000;
>> + out_be32(&intr->ctrl, val);
>> + break;
>> + default:
>> + if (irq >= MPC52xx_SDMA_IRQ_BASE
>> + && irq < (MPC52xx_SDMA_IRQ_BASE +
>> MPC52xx_SDMA_IRQ_NUM)) {
>> + out_be32(&sdma->IntPend,
>> + 1 << (irq - MPC52xx_SDMA_IRQ_BASE));
>> + }
>> +
>> + break;
>> + }
>> +
>> +}
>> +
>> +static void mpc52xx_ic_disable_and_ack(unsigned int irq)
>> +{
>> + mpc52xx_ic_disable(irq);
>> + mpc52xx_ic_ack(irq);
>> +}
>> +
>> +static void mpc52xx_ic_end(unsigned int irq)
>> +{
>> + if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
>> + mpc52xx_ic_enable(irq);
>> +}
>> +
>> +static struct irq_chip mpc52xx_irqchip = {
>> + .name = " MPC52xx ",
>> + .enable = mpc52xx_ic_enable,
>> + .disable = mpc52xx_ic_disable,
>> + .ack = mpc52xx_ic_disable_and_ack,
>> + .end = mpc52xx_ic_end,
>> +};
>> +
>> +extern struct device_node *find_mpc52xx_pic(void);
>> +static int mpc52xx_irqhost_match(struct irq_host *h, struct
>> device_node *node)
>> +{
>> + pr_debug("%s: %p vs %p\n", __func__, find_mpc52xx_pic(), node);
>> + return find_mpc52xx_pic() == node;
>> +}
>> +
>> +static int mpc52xx_irqhost_xlate(struct irq_host *h, struct
>> device_node *ct,
>> + u32 * intspec, unsigned int intsize,
>> + irq_hw_number_t * out_hwirq,
>> + unsigned int *out_flags)
>> +{
>> + static unsigned char map_senses[4] = {
>> + IRQ_TYPE_LEVEL_HIGH,
>> + IRQ_TYPE_EDGE_FALLING,
>> + IRQ_TYPE_EDGE_RISING,
>> + IRQ_TYPE_LEVEL_LOW,
>> + };
>> +
>> + int intrvect_l1;
>> + int intrvect_l2;
>> + int intrvect_type;
>> + int intrvect_linux;
>> +
>> + pr_debug("%s:\n", __func__);
>> +
>> + if (intsize != 3)
>> + return -1;
>> +
>> + intrvect_l1 = (int)intspec[0];
>> + intrvect_l2 = (int)intspec[1];
>> + intrvect_type = (int)intspec[2];
>> +
>> + pr_debug("l1=%d, l2=%d, type=%d\n", intrvect_l1, intrvect_l2,
>> + intrvect_type);
>> +
>> + switch (intrvect_l1) {
>> + case 0: /* Critical */
>> + intrvect_linux = MPC52xx_CRIT_IRQ_BASE;
>> + break;
>> +
>> + case 1: /* Main */
>> + intrvect_linux = MPC52xx_MAIN_IRQ_BASE;
>> + break;
>> +
>> + case 2: /* Periph */
>> + intrvect_linux = MPC52xx_PERP_IRQ_BASE;
>> + break;
>> +
>> + case 3: /* Bestcomm */
>> + intrvect_linux = MPC52xx_SDMA_IRQ_BASE;
>> + break;
>> +
>> + default:
>> + if (printk_ratelimit())
>> + printk(KERN_ERR "Wrong L1 interrupt vector
>> (%d)\n",
>> + intrvect_l1);
>> +
>> + return -1;
>> + }
>> +
>> + intrvect_linux += intrvect_l2;
>> +
>> + pr_debug("return %d\n", intrvect_linux);
>> +
>> + *out_hwirq = intrvect_linux;
>> + *out_flags = map_senses[intrvect_type];
>> +
>> + return 0;
>> +
>> +}
>> +
>> +int mpc52xx_irqhost_map(struct irq_host *h, unsigned int virq,
>> + irq_hw_number_t hw)
>> +{
>> + pr_debug("%s: v=%d, hw=%d\n", __func__, virq, (int)hw);
>> +
>> + return 0;
>> +}
>> +
>> +void mpc52xx_irqhost_unmap(struct irq_host *h, unsigned int virq)
>> +{
>> + pr_debug("%s: v=%d\n", __func__, virq);
>> +}
>> +
>> +static struct irq_host_ops mpc52xx_irqhost_ops = {
>> + .match = mpc52xx_irqhost_match,
>> + .xlate = mpc52xx_irqhost_xlate,
>> + .map = mpc52xx_irqhost_map,
>> + .unmap = mpc52xx_irqhost_unmap,
>> +};
>> +
>> +void __init mpc52xx_init_irq(void)
>> +{
>> + int i;
>> + u32 intr_ctrl;
>> +
>> + /* Remap the necessary zones */
>> + intr = ioremap(MPC52xx_PA(MPC52xx_INTR_OFFSET),
>> MPC52xx_INTR_SIZE);
>> + sdma = ioremap(MPC52xx_PA(MPC52xx_SDMA_OFFSET),
>> MPC52xx_SDMA_SIZE);
>> +
>> + if ((intr == NULL) || (sdma == NULL))
>> + panic("Can't ioremap PIC/SDMA register or init_irq !");
>> +
>> + /* Disable all interrupt sources. */
>> + out_be32(&sdma->IntPend, 0xffffffff); /* 1 means clear
>> pending */
>> + out_be32(&sdma->IntMask, 0xffffffff); /* 1 means disabled */
>> + out_be32(&intr->per_mask, 0x7ffffc00); /* 1 means disabled */
>> + out_be32(&intr->main_mask, 0x00010fff); /* 1 means disabled */
>> + intr_ctrl = in_be32(&intr->ctrl);
>> + intr_ctrl &= 0x00ff0000; /* Keeps IRQ[0-3] config */
>> + intr_ctrl |= 0x0f000000 | /* clear IRQ 0-3 */
>> + 0x00001000 | /* MEE master external enable */
>> + 0x00000000 | /* 0 means disable IRQ 0-3 */
>> + 0x00000001; /* CEb route critical normally */
>> + out_be32(&intr->ctrl, intr_ctrl);
>> +
>> + /* Zero a bunch of the priority settings. */
>> + out_be32(&intr->per_pri1, 0);
>> + out_be32(&intr->per_pri2, 0);
>> + out_be32(&intr->per_pri3, 0);
>> + out_be32(&intr->main_pri1, 0);
>> + out_be32(&intr->main_pri2, 0);
>> + /* Initialize irq_desc[i].handler's with mpc52xx_ic. */
>> + for (i = 0; i < NR_IRQS; i++) {
>> + irq_desc[i].chip = &mpc52xx_irqchip;
>> + irq_desc[i].status = IRQ_LEVEL;
>> +
>> + }
>> +
>> +#define IRQn_MODE(intr_ctrl,irq) (((intr_ctrl) >> (22-(i<<1))) & 0x03)
>> + for (i = 0; i < 4; i++) {
>> + int mode;
>> + mode = IRQn_MODE(intr_ctrl, i);
>> + if ((mode == 0x1) || (mode == 0x2))
>> + irq_desc[i ? MPC52xx_IRQ1 + i -
>> + 1 : MPC52xx_IRQ0].status = 0;
>> + }
>> +
>> + /*
>> + * As last step, add an irq host to translate the real
>> + * hw irq information provided by the ofw to linux virq
>> + */
>> +
>> + mpc52xx_irqhost =
>> + irq_alloc_host(IRQ_HOST_MAP_LINEAR, NR_IRQS,
>> &mpc52xx_irqhost_ops,
>> + -1);
>> + pr_debug("%s: mpc52xx_irqhost =%p\n", __func__,
>> mpc52xx_irqhost);
>> +}
>> +
>> +unsigned int mpc52xx_get_irq(void)
>> +{
>> + u32 status;
>> + int virq;
>> + int irq = NO_IRQ_IGNORE;
>> +
>> + status = in_be32(&intr->enc_status);
>> + if (status & 0x00000400) { /* critical */
>> + irq = (status >> 8) & 0x3;
>> + if (irq == 2) /* high priority peripheral */
>> + goto peripheral;
>> + irq += MPC52xx_CRIT_IRQ_BASE;
>> + } else if (status & 0x00200000) { /* main */
>> + irq = (status >> 16) & 0x1f;
>> + if (irq == 4) /* low priority peripheral */
>> + goto peripheral;
>> + irq += MPC52xx_MAIN_IRQ_BASE;
>> + } else if (status & 0x20000000) { /* peripheral */
>> + peripheral:
>> + irq = (status >> 24) & 0x1f;
>> + if (irq == 0) { /* bestcomm */
>> + status = in_be32(&sdma->IntPend);
>> + irq = ffs(status) + MPC52xx_SDMA_IRQ_BASE - 1;
>> + } else
>> + irq += MPC52xx_PERP_IRQ_BASE;
>> +
>> + }
>> +
>> + virq = irq_linear_revmap(mpc52xx_irqhost, irq);
>> + pr_debug("%s: irq=%d -> %d\n", __func__, irq, virq);
>> +
>> + return virq;
>> +}
>> --- a/arch/powerpc/Kconfig 2006-10-25 19:07:23.000000000 +0200
>> +++ b/arch/powerpc/Kconfig 2006-10-26 18:55:58.000000000 +0200
>> @@ -384,6 +384,11 @@ config PPC_CHRP
>> select PPC_RTAS
>> select PPC_MPC106
>> select PPC_UDBG_16550
>> + select PPC_MPC52xx_PIC
>> + default y
>> +
>> +config PPC_MPC52xx_PIC
>> + bool
>> default y
>>
>> config PPC_PMAC
>> --- a/arch/powerpc/platforms/chrp/setup.c 2006-10-25
>> 19:07:23.000000000 +0200
>> +++ b/arch/powerpc/platforms/chrp/setup.c 2006-10-26
>> 21:47:29.000000000 +0200
>> @@ -51,6 +51,7 @@
>> #include <asm/mpic.h>
>> #include <asm/rtas.h>
>> #include <asm/xmon.h>
>> +#include <asm/mpc52xx.h>
>>
>> #include "chrp.h"
>>
>> @@ -435,6 +436,44 @@ static struct irqaction xmon_irqaction =
>> };
>> #endif
>>
>> +
>> +struct device_node *find_mpc52xx_pic(void)
>> +{
>> + struct device_node *dev;
>> + const char *piccompatible_list[] =
>> + {
>> + "mpc5200-pic",
>> + NULL
>> + };
>> +
>> + /* Look for an MPC52xx interrupt controller */
>> + for_each_node_by_type(dev, "interrupt-controller")
>> + {
>> + const char **piccompatible_entry = piccompatible_list;
>> +
>> + for(piccompatible_entry = piccompatible_list;
>> *piccompatible_entry; piccompatible_entry++ )
>> + {
>> + if (device_is_compatible(dev,
>> *piccompatible_entry ))
>> + return dev;
>> + }
>> + }
>> +
>> + return NULL;
>> +}
>> +
>> +static int __init chrp_find_mpc52xx_pic(void)
>> +{
>> + if (find_mpc52xx_pic())
>> + {
>> + printk(KERN_INFO "Found MPC52xx Interrupt
>> Controller\n");
>> + ppc_md.get_irq = mpc52xx_get_irq;
>> + mpc52xx_init_irq();
>> + return 0;
>> + }
>> +
>> + return -ENODEV;
>> +}
>> +
>> static void __init chrp_find_8259(void)
>> {
>> struct device_node *np, *pic = NULL;
>> @@ -473,8 +512,11 @@ static void __init chrp_find_8259(void)
>> break;
>> }
>> if (np == NULL)
>> - printk(KERN_WARNING "Cannot find PCI interrupt
>> acknowledge"
>> - " address, polling\n");
>> + {
>> + printk(KERN_WARNING "Cannot find PCI/i8259 interrupt
>> acknowledge"
>> + " Fix your tree!\n");
>> + return;
>> + }
>>
>> i8259_init(pic, chrp_int_ack);
>> if (ppc_md.get_irq == NULL)
>> @@ -494,6 +536,8 @@ void __init chrp_init_IRQ(void)
>> #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON)
>> struct device_node *kbd;
>> #endif
>> +
>> + chrp_find_mpc52xx_pic();
>> chrp_find_openpic();
>> chrp_find_8259();
>>
>>
>>
>>
>>
>
>
^ permalink raw reply
* Re: status of mpc52xx with arch=powerpc?
From: Sylvain Munaut @ 2006-10-26 20:48 UTC (permalink / raw)
To: Grant Likely; +Cc: linuxppc-embedded
In-Reply-To: <528646bc0610261336i61521af3y3a5f134bb8c2f8da@mail.gmail.com>
Grant Likely wrote:
> On 10/26/06, John Rigby <jcrigby@gmail.com> wrote:
>> Does Bestcomm dma belong in here somewhere?
>
> I don't think so for embedded targets; but I may be wrong. Of course;
> I think the kernel should be responsible for setting up the bestcomm
> tasks. If a spec is defined for how firmware could preload bestcomm
> tasks, then maybe.
Yes, we discussed that on IRC.
For I got from it would be something like that :
We would use the API we worked earlier on (Dale, Andrey, John, ...).
To add support of fw preloaded task :
- The bestcomm.ko module would be used when bestcomm is completely
controlled by the kernel
- A different module but with the same exported function would be used
when the fw has a part to play in the init. That allows to customize a bunch
of the sdma init / sram mapping ...
- All the other code (task helpers / the .h / the driver api) would be
exactly
the same.
- Currently the task support code (the arch/ppc/syslib/fec.c for example in
the current code) does this :
struct sdma_task *tsk;
tsk = sdma_task_alloc(queue_len, sizeof(struct sdma_fec_bd));
if (!tsk)
return NULL;
To reuse the preloaded task, it would be changed to
tsk = sdma_task_find_by_name("fec", 0);
if (!tsk)
tsk = sdma_task_alloc("fec", 0, queue_len, sizeof(struct
sdma_fec_bd));
if (!tsk)
return NULL;
So the bestcomm modules maintain a list with all task loaded with a name and
a index attribute. (The index would be used when there is multiple
device with
the same name, like "psc". We could use names like "psc1", "psc2". But that
would imply string manipulation to "create" the name string ;)
In the case of the "classic" (kernel handles it all), the table of task
is just
initially empty. But for the "custom" case, it's filled with whatever
the fw has
passed as infos.
Sylvain
^ permalink raw reply
* Re: Kernel hangs in console_init()
From: Becky Bruce @ 2006-10-26 20:36 UTC (permalink / raw)
To: wei.li4; +Cc: linuxppc-embedded
In-Reply-To: <4540FC2D.6000403@freescale.com>
On Oct 26, 2006, at 1:19 PM, Scott Wood wrote:
> wei.li4@elf.mcgill.ca wrote:
>> Hi All,
>>
>> I am working on linux 2.6.18-rc2 with my mpc875 demo board, I used
>> Debugger LEDs to find that kernel stopped in:
>> while (call < __con_initcall_end) {
>> (*call)();
>> call++;
>> }
>> which is in console_init() of tty_io.c, what kind of problem could
>> be?
>> What's the means of 'bctrl' instruction that I found in its
>> assembler?
>
> It's an indirect function call (i.e. the (*call)(); line) to the
> address
> specified in the CTR register. You need to find out the value of
> *call
> in order to figure out which function is failing. There are probably
> only a small number of possibilities that are actually configured into
> your kernel (look for console_initcall in files that get built for
> your
> target).
>
> -Scott
Wei,
For future reference, bctrl is not an instruction, but a simplified
mnemonic. Simplified mnemonics are there to make it easier to read
and write assembly code; for example, you can write "bctrl" instead
of "bcctrl 20,0". These are all listed in appendix F of the
Programming Environments Manual for 32-bit implementations of the
PowerPC Architecture.
You won't find these instructions in the index of the manual, so
whenever you run into an "instruction" that you don't find listed in
the main part of the manual, try appendix F and hopefully that will
help.
Cheers,
B
^ permalink raw reply
* Re: status of mpc52xx with arch=powerpc?
From: Grant Likely @ 2006-10-26 20:36 UTC (permalink / raw)
To: John Rigby; +Cc: linuxppc-embedded
In-Reply-To: <4b73d43f0610261307sd0668d1x6e535880a46e71d3@mail.gmail.com>
On 10/26/06, John Rigby <jcrigby@gmail.com> wrote:
> Does Bestcomm dma belong in here somewhere?
I don't think so for embedded targets; but I may be wrong. Of course;
I think the kernel should be responsible for setting up the bestcomm
tasks. If a spec is defined for how firmware could preload bestcomm
tasks, then maybe.
g.
--
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
^ permalink raw reply
* Re: [1/2] build failure for E500 CPUs w/ CONFIG_OPROFLE=y
From: Sergei Shtylyov @ 2006-10-26 20:32 UTC (permalink / raw)
To: Vitaly Wool; +Cc: linuxppc-dev list, oprofile-list
In-Reply-To: <1161894389.2820.14.camel@barja>
Hello.
Vitaly Wool wrote:
> Hello Kumar,
>>This makes sense to me since we are just increasing kernel code size
>>for code we would never use for an FSL_BOOKE part if we do it the
>>other way. I dont think its that much more messy with the ifdef's.
> Okay, if you're fine with this patch, is it possible that you include it
> into your tree?
>>If you want to do the other cleanup as well I've got no issue with
>>that, but we really should NOT build in support for 7450 into a
>>FSL_BOOKE kernel when reasonably avoidable.
> That's fine with me.
> As of the cleanups, well... looks to me some more patches will follow
> soon, kinda bugfixing ones rather than cleanups first :)
The most funny/stupd thing is that the patch existed since May but it never
went in:
http://patchwork.ozlabs.org/linuxppc/patch?id=5531
> Thanks,
> Vitaly
WBR, Sergei
^ permalink raw reply
* Re: [1/2] build failure for E500 CPUs w/ CONFIG_OPROFLE=y
From: Vitaly Wool @ 2006-10-26 20:26 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev list, oprofile-list
In-Reply-To: <4A3EAE00-3647-4B72-8CDF-ED6E0ADEC910@kernel.crashing.org>
Hello Kumar,
> This makes sense to me since we are just increasing kernel code size
> for code we would never use for an FSL_BOOKE part if we do it the
> other way. I dont think its that much more messy with the ifdef's.
Okay, if you're fine with this patch, is it possible that you include it
into your tree?
> If you want to do the other cleanup as well I've got no issue with
> that, but we really should NOT build in support for 7450 into a
> FSL_BOOKE kernel when reasonably avoidable.
That's fine with me.
As of the cleanups, well... looks to me some more patches will follow
soon, kinda bugfixing ones rather than cleanups first :)
Thanks,
Vitaly
^ permalink raw reply
* fix up the bd_info address
From: Vitaly Bordug @ 2006-10-26 20:17 UTC (permalink / raw)
To: Grant Likely; +Cc: linuxppc-dev@ozlabs.org
[-- Attachment #1.1: Type: text/plain, Size: 317 bytes --]
Hi,
The patch is attached. It is applied after Matt's bootm stuff. I was going to send it through u-boot list when
all the things around FDT will arrive there. It used to fix the problem booting the bd_t kernel on FDT u-boot.
Just as reference for now.
Signed-off-by: Vitaly Bordug <vbordug@ru.mvista.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: fix_bd_info_address.patch --]
[-- Type: text/x-patch; name=fix_bd_info_address.patch, Size: 783 bytes --]
Patch fixes the address of the board info passed to kernel when OF tree is disabled.
---
common/cmd_bootm.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index f1c0eb4..eb59817 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -836,8 +836,12 @@ #endif
(*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
#else
- ft_setup(of_flat_tree, kbd, initrd_start, initrd_end);
- /* ft_dump_blob(of_flat_tree); */
+ if (getenv("disable_of") != NULL)
+ of_flat_tree = kbd;
+ else {
+ ft_setup(of_flat_tree, kbd, initrd_start, initrd_end);
+ /* ft_dump_blob(of_flat_tree); */
+ }
#if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
unlock_ram_in_cache();
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply related
* Re: status of mpc52xx with arch=powerpc?
From: John Rigby @ 2006-10-26 20:07 UTC (permalink / raw)
To: Grant Likely; +Cc: linuxppc-embedded
In-Reply-To: <528646bc0610242325m45fa610egb47f118f5f4f6f5e@mail.gmail.com>
Does Bestcomm dma belong in here somewhere?
On 10/25/06, Grant Likely <grant.likely@secretlab.ca> wrote:
> On 10/24/06, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> > Can you send me your .dts ?
>
> Here you go; for discussion purposes only! :)
>
> This is pretty rough stuff, and it haven't even got to the point of
> using it to boot a kernel. But if it's a starting point to figure out
> what the 52xx device tree should look like then go to it!
>
> g.
>
>
> --
> Grant Likely, B.Sc. P.Eng.
> Secret Lab Technologies Ltd.
> grant.likely@secretlab.ca
> (403) 399-0195
>
>
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>
>
>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox