LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* mpc5200 timer3 Interrupts stopped working
From: bennett78 @ 2006-02-24 15:59 UTC (permalink / raw)
  To: linuxppc-embedded


[-- Attachment #1.1: Type: text/plain, Size: 3303 bytes --]

Help, how do I debug timer3 Interrupts?  My driver was working and then 
interrupts
stopped coming (most likely blocked).  I have a driver that is very 
similar to
     linuxppc_2_4_devel/drivers/char/pp01_ad64.c
I have attached the complete driver (et.c)

/ # insmod et
ET Display Driver v0.1 loaded ET_TIN irq 16

et_init 00 intr->per_mask  1bfffc00
et_init 10 intr->ctrl      00c01001
et_init 14 intr->main_mask 00010e00
et_init 24 intr->enc_stat  00000001
et_init 28 intr->crit_stat 00000000
et_init 2c intr->main_stat 00002000
et_init 30 intr->per_stat  00000000
et_init 38 intr->per_error 00000000

/ # cat /proc/interrupts
           CPU0
 16:          0  MPC5xxx Edge      et Trubine
 23:       1049  MPC5xxx Edge      eth_xmit
 24:       2468  MPC5xxx Edge      eth_recv
 39:         51  MPC5xxx Edge      serial
 40:          0  MPC5xxx Edge      serial
 43:         69  MPC5xxx Edge      eth_err
BAD:          0

with a pulse train on timer3 input "et_interrupt" no longer gets
called.

code snippets
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#define ET_TIN         3   // Turbine PULSE IN

static void et_interrupt (int irq, void *dev_id, struct pt_regs * regs)
{
    int port = ET_IRQ_TO_PORT(irq);
    unsigned long stat;

    printk(KERN_INFO "et_interrupt IRQ %d port %d main_stat %x gpt.sr %x 
\n",
                        irq, port, intr->main_status, gpt[port].sr );

    if( port == ET_TIN ) {
        // Clear pending interrupt
        stat = in_be32(&gpt[port].sr) & 0xffff;
        out_be32(&gpt[port].sr,  MPC5xxx_GPT_SR_CAPT);
        printk(KERN_INFO "et_int irq=%d port=%d stat %0lx \n", irq, 
port, stat);
        // wake_up_interruptible(&et_wait);
    } else {
        printk(KERN_ERR ET_MSG "Unexpected IRQ %d received", irq);
    }
    spin_lock (&et_lock);
    turbine_per = in_be32(&gpt[port].sr) >> 16;
    spin_unlock (&et_lock);
}


static int __init et_init (void)
....
if (request_irq(ET_PORT_TO_IRQ(ET_TIN), et_interrupt, 0, "et Trubine", 
NULL)) {
            printk(KERN_ERR ET_MSG "couldn't register interrupts\n");
            goto abort_remove_proc;
    }
out_be32(&gpt[ET_TIN].cir, (   66<<16) | 1 );  /* prescale(16), 
period(16)  */
out_be32(&gpt[ET_TIN].emsr,
        MPC5xxx_GPT_EMSR_INP_CAPTURE
      | MPC5xxx_GPT_EMSR_ICT_FALLING
      | MPC5xxx_GPT_EMSR_INT_ENABLE);
...
printk(KERN_INFO "ET Display Driver v%s loaded ET_TIN irq %d\n",
        ET_VERSION, ET_PORT_TO_IRQ(ET_TIN) );

    //broke with or without the following
    intr->main_mask &= ~(0x000000ff);   /* enable timer ints */

    printk(KERN_INFO "et_init 00 intr->per_mask  %08x\n", intr->per_mask);
    printk(KERN_INFO "et_init 10 intr->ctrl      %08x\n", intr->ctrl);
    printk(KERN_INFO "et_init 14 intr->main_mask %08x\n", intr->main_mask);
    printk(KERN_INFO "et_init 24 intr->enc_stat  %08x\n", intr->enc_status);
    printk(KERN_INFO "et_init 28 intr->crit_stat %08x\n", 
intr->crit_status);
    printk(KERN_INFO "et_init 2c intr->main_stat %08x\n", 
intr->main_status);
    printk(KERN_INFO "et_init 30 intr->per_stat  %08x\n", intr->per_status);
    printk(KERN_INFO "et_init 38 intr->per_error %08x\n", intr->per_error);

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
thanks in advance for any help,

Frank Bennett

*//*




[-- Attachment #1.2: Type: text/html, Size: 5932 bytes --]

[-- Attachment #2: et.c --]
[-- Type: text/x-c, Size: 11242 bytes --]

/*
 * et.c - Driver for EMCO Timers 
 *
 * 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.
 * 
 * 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 <linux/module.h>
#include <linux/config.h>
#include <linux/version.h>
#include <linux/types.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/config.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/proc_fs.h>

#include <asm/uaccess.h>
#include <asm/types.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <asm/mpc5xxx.h>
#include <asm/emco_et.h>

#define CONFIG_PPC_5xxx_IPBFREQ 66000

#define	ET_VERSION	"0.1"
#define ET_NAME	"et"
#define ET_MSG	"et: "

#undef ET_EXCLUSIVE_OPEN

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Frank Bennett");
MODULE_DESCRIPTION("Emco Timers Driver");

#define ET_MAJOR	190
static int major = ET_MAJOR;
MODULE_PARM(major,"i");
MODULE_PARM_DESC(major, "Device major number (default=190)");

static struct mpc5xxx_gpt  *gpt    = (struct mpc5xxx_gpt  *)MPC5xxx_GPT;
// static struct mpc5xxx_gpio *gpio   = (struct mpc5xxx_gpio *)MPC5xxx_GPIO;
static struct mpc5xxx_intr *intr   = (struct mpc5xxx_intr *)MPC5xxx_INTR;
static unsigned long turbine_per;
static DECLARE_WAIT_QUEUE_HEAD(et_wait);

/*
 * ET timer related definitions:
 *
 */
#define ET_POUT        0   // Pulse Out
#define ET_KP_ACTIVE   1   // not KeyPad active (low) IN see gui.c
#define ET_TDIR        2   // Turbine DIR IN
#define ET_TIN         3   // Turbine PULSE IN
#define ET_52k         4   // start SAR convert
#define ET_RLY1        5   // RELAY 1 active low OUT
#define ET_RLY2        6   // RELAY 2 active low OUT
#define ET_BKL         7   // LCD Backlite OUT

#define ET_DELAY_US		10 /* in micro-seconds */

#define ET_PORT_TO_IRQ(port) (13 + port)
#define ET_IRQ_TO_PORT(irq)  (irq - 13)

#ifdef ET_EXCLUSICE_OPEN
static char et_is_open = 0;
#endif

static spinlock_t et_lock = SPIN_LOCK_UNLOCKED;

static void et_interrupt (int irq, void *dev_id, struct pt_regs * regs)
{	
    int port = ET_IRQ_TO_PORT(irq);
	unsigned long stat;

	printk(KERN_INFO "et_interrupt IRQ %d port %d main_stat %x gpt.sr %x \n", 
	 		  			irq, port, intr->main_status, gpt[port].sr ); 

    if( port == ET_TIN ) {
		// Clear pending interrupt 
		stat = in_be32(&gpt[port].sr) & 0xffff;
    	out_be32(&gpt[port].sr,  MPC5xxx_GPT_SR_CAPT);
    	printk(KERN_INFO "et_int irq=%d port=%d stat %0lx \n", irq, port, stat); 
		// wake_up_interruptible(&et_wait);
    } else {		
		printk(KERN_ERR ET_MSG "Unexpected IRQ %d received", irq); 
    }
	spin_lock (&et_lock);
	turbine_per = in_be32(&gpt[port].sr) >> 16;
	spin_unlock (&et_lock);
}

#ifdef CONFIG_PROC_FS
static int et_read_proc(char *page, char **start, off_t off,
                          int count, int *eof, void *data)
{
    *eof = 1;
    return count;
}

static int et_write_proc(struct file *file, const char *buffer,
			   unsigned long count, void *data)
{    
    if (count > 128)
		return -EINVAL;

    return count;
}
#endif

/*
 * Device file operations
 */

static int et_open(struct inode *inode, struct file *file)
{
#ifdef ET_EXCLUSICE_OPEN
    if (et_is_open != 0)
		return -EBUSY;
    et_is_open = 1;
#endif
	spin_lock_irq (&et_lock);
	turbine_per = 0L;
	spin_unlock_irq (&et_lock);
    return 0;
}

static int et_close(struct inode *inode, struct file *file)
{
#ifdef ET_EXCLUSICE_OPEN
    et_is_open = 0;
#endif
    return 0;
}

static int et_write (struct file *file, u8 *buf, 
			  size_t count, loff_t *ppos)
{
    printk(KERN_DEBUG "  et_write \n" );
	return 0;
} 

static size_t et_read (struct file *file, char *buf, 
			 size_t count, loff_t *ppos)
{
    DECLARE_WAITQUEUE(wait, current);
    unsigned long data;
    ssize_t retval;

    printk(KERN_DEBUG "  et_read \n" );

    if (count != sizeof (unsigned int) && count != sizeof (unsigned long))
        return -EINVAL;

//    add_wait_queue(&et_wait, &wait);

    while (1) {
        __set_current_state(TASK_INTERRUPTIBLE);
        spin_lock_irq (&et_lock);
        data = turbine_per;
        turbine_per = 0L;
        spin_unlock_irq (&et_lock);

        if (data != 0)
            break;

        if (file->f_flags & O_NONBLOCK) {
            retval = -EAGAIN;
            goto out;
        }
        if (signal_pending(current)) {
            retval = -ERESTARTSYS;
            goto out;
        }
        schedule();
    }
    if (count == sizeof(unsigned int))
        retval = put_user(data, (unsigned int *)buf);
    else
        retval = put_user(data, (unsigned long *)buf);
    if (!retval)
        retval = count;
 out:
    current->state = TASK_RUNNING;
//    remove_wait_queue(&et_wait, &wait);

    return retval;
}

static int et_ioctl (struct inode *inode, struct file *file, 
		      unsigned int cmd, unsigned long arg)
{
	unsigned long data;

	// printk(KERN_DEBUG "et_ioctl %04x %08lx\n", cmd, arg);
	switch (cmd) {
	case ET_POUT:
	case ET_52k:
	case ET_BKL: 
	case ET_RLY1: 
	case ET_RLY2:
		out_be32(&gpt[cmd].cr,  (arg & 0xffff0000) |1);  /* width, update_now */
    	out_be32(&gpt[cmd].cir, ((CONFIG_PPC_5xxx_IPBFREQ / 1000) << 16) | (arg&0xffff) ); // prescale, period
		break;
	case ET_TIN: 
		data = turbine_per;
		turbine_per = 0L;
		return copy_to_user((void *)arg, &data, sizeof data) ? -EFAULT : 0;
		break;
	case ET_TDIR:
	case ET_KP_ACTIVE: 
		data = (gpt[cmd].sr & MPC5xxx_GPT_SR_PIN)>>8;
		return copy_to_user((void *)arg, &data, sizeof data) ? -EFAULT : 0;

	//case ET_RLY1: 
	//case ET_RLY2:
	//	if( arg == 1L)
	//		out_be32(&gpt[cmd].emsr, MPC5xxx_GPT_EMSR_OUTPUT_1 | MPC5xxx_GPT_EMSR_INTERNAL);
	//	else
	//		out_be32(&gpt[cmd].emsr, MPC5xxx_GPT_EMSR_OUTPUT_0 | MPC5xxx_GPT_EMSR_INTERNAL);
	//	break;
	}
    return 0;
}

static struct file_operations et_fops = {
    owner: 		THIS_MODULE,
    open:  		et_open,
    release:  	et_close,
    read: 		et_read,
    write: 		et_write,
    ioctl: 		et_ioctl,
};

static void et_init_gpt(void)
{
	unsigned int per;

    /* Pulse Out   -      Timer 0 */
    out_be32(&gpt[ET_POUT].emsr, 
        MPC5xxx_GPT_EMSR_PWM | MPC5xxx_GPT_EMSR_CE | MPC5xxx_GPT_EMSR_CONTINOUS);

	/* Turbine in  - GPIO Timer 1 */
	turbine_per = 0L;
    out_be32(&gpt[ET_TIN].cir, (   66<<16) | 1 );  /* prescale(16), period(16)  */
    out_be32(&gpt[ET_TIN].emsr,
        MPC5xxx_GPT_EMSR_INP_CAPTURE | MPC5xxx_GPT_EMSR_ICT_FALLING | MPC5xxx_GPT_EMSR_INT_ENABLE);

	/* Turbine dir - GPIO Timer 2 */
    out_be32(&gpt[ET_TDIR].emsr,
        MPC5xxx_GPT_EMSR_INP_CAPTURE | MPC5xxx_GPT_EMSR_ICT_FALLING );

	/* 52k ref     - GPIO Timer 3 */
	per = 40 ; // 40 usec
    out_be32(&gpt[ET_52k].cr,  (per/2)<<16  | 1);     /* width, update_now */
    out_be32(&gpt[ET_52k].cir, (    33<<16) | per );  /* prescale(16), period(16)  */
    out_be32(&gpt[ET_52k].emsr,
         MPC5xxx_GPT_EMSR_PWM | MPC5xxx_GPT_EMSR_CE | MPC5xxx_GPT_EMSR_CONTINOUS);

	/* KP_active  - GPIO Timer 4 */
    out_be32(&gpt[ET_KP_ACTIVE].emsr,
        MPC5xxx_GPT_EMSR_INP_CAPTURE | MPC5xxx_GPT_EMSR_ICT_FALLING );

	/* Relay 1    - GPIO Timer 5 */
    out_be32(&gpt[ET_RLY1].emsr,
        MPC5xxx_GPT_EMSR_PWM | MPC5xxx_GPT_EMSR_CE | MPC5xxx_GPT_EMSR_CONTINOUS);
    //		MPC5xxx_GPT_EMSR_OUTPUT_1 | MPC5xxx_GPT_EMSR_INTERNAL);

	/* Relay 2    - GPIO Timer 5 */
    out_be32(&gpt[ET_RLY2].emsr,
        MPC5xxx_GPT_EMSR_PWM | MPC5xxx_GPT_EMSR_CE | MPC5xxx_GPT_EMSR_CONTINOUS);
 	//		MPC5xxx_GPT_EMSR_OUTPUT_1 | MPC5xxx_GPT_EMSR_INTERNAL);


	/* LCD BL Lite- GPIO Timer 7 */
	per = 4000 ; // 4 msec
    out_be32(&gpt[ET_BKL].cr,  (per/4)<<16  | 1);     /* width, update_now */
    out_be32(&gpt[ET_BKL].cir, (    66<<16) | per );  /* prescale(16), period(16)  */
    out_be32(&gpt[ET_BKL].emsr,
         MPC5xxx_GPT_EMSR_PWM | MPC5xxx_GPT_EMSR_CE | MPC5xxx_GPT_EMSR_CONTINOUS);
}

static int __init et_init (void)
{
#ifdef CONFIG_PROC_FS
    struct proc_dir_entry * proc;
#endif
    int ret = -ENODEV;
	
    ret = register_chrdev(ET_MAJOR, ET_NAME, &et_fops);
    if (ret < 0) {
		printk(KERN_ERR ET_MSG "Couldn't register " ET_NAME " driver\n");
		goto abort;
    }
    if (major == 0)
		major = ret;   /* dynamic */

#ifdef CONFIG_PROC_FS
    proc = create_proc_entry(ET_NAME, S_IFREG | S_IRUGO, NULL);
    if (proc == NULL) {
		printk(KERN_ERR ET_MSG "failed to create /proc/"ET_NAME"\n");
		goto abort_unregister;
    }
    proc->read_proc  = et_read_proc;
    proc->write_proc = et_write_proc;
#endif

	if (request_irq(ET_PORT_TO_IRQ(ET_TIN), et_interrupt, 0, "et Trubine", NULL)) {
			printk(KERN_ERR ET_MSG "couldn't register interrupts\n");
			goto abort_remove_proc;
    }
	et_init_gpt();

    printk(KERN_INFO "ET Display Driver v%s loaded ET_TIN irq %d\n", 
		ET_VERSION, ET_PORT_TO_IRQ(ET_TIN) );

	intr->main_mask &= ~(0x000000ff);	/* enable timer ints */
    printk(KERN_INFO "et_init 00 intr->per_mask  %08x\n", intr->per_mask);
    printk(KERN_INFO "et_init 10 intr->ctrl      %08x\n", intr->ctrl);
    printk(KERN_INFO "et_init 14 intr->main_mask %08x\n", intr->main_mask);
    printk(KERN_INFO "et_init 24 intr->enc_stat  %08x\n", intr->enc_status);
    printk(KERN_INFO "et_init 28 intr->crit_stat %08x\n", intr->crit_status);
    printk(KERN_INFO "et_init 2c intr->main_stat %08x\n", intr->main_status);
    printk(KERN_INFO "et_init 30 intr->per_stat  %08x\n", intr->per_status);
    printk(KERN_INFO "et_init 38 intr->per_error %08x\n", intr->per_error);

	sti();

/*
    volatile u32        per_mask;    // INTR + 0x00 
    volatile u32        per_pri1;    // INTR + 0x04
    volatile u32        per_pri2;    // INTR + 0x08
    volatile u32        per_pri3;    // INTR + 0x0c
    volatile u32        ctrl;        // INTR + 0x10
    volatile u32        main_mask;   // INTR + 0x14
    volatile u32        main_pri1;   // INTR + 0x18
    volatile u32        main_pri2;   // INTR + 0x1c
    volatile u32        reserved1;   // INTR + 0x20
    volatile u32        enc_status;  // INTR + 0x24
    volatile u32        crit_status; // INTR + 0x28
    volatile u32        main_status; // INTR + 0x2c
    volatile u32        per_status;  // INTR + 0x30
    volatile u32        reserved2;   // INTR + 0x34
    volatile u32        per_error;   // INTR + 0x38
*/

    return 0;
	
 abort_remove_proc:
    remove_proc_entry(ET_NAME,  NULL);
 abort_unregister:
    unregister_chrdev(major, ET_NAME);	
 abort:
    return ret;
}

static void __devexit et_cleanup (void)
{
    free_irq(ET_PORT_TO_IRQ(ET_TIN), NULL);
    remove_proc_entry(ET_NAME,  NULL);
    unregister_chrdev(major, ET_NAME);
    printk(KERN_INFO "ET Display Driver v%s unloaded\n", ET_VERSION);
}

EXPORT_NO_SYMBOLS;

module_init(et_init)
module_exit(et_cleanup)


^ permalink raw reply

* Re: Membership stats (Was: Re: merge these lists?)
From: Kumar Gala @ 2006-02-24 16:34 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linuxppc-dev, linuxppc64-dev
In-Reply-To: <20060208110718.57e9f9f5.sfr@canb.auug.org.au>

On Wed, 8 Feb 2006, Stephen Rothwell wrote:

> On Wed, 8 Feb 2006 11:01:50 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> >
> > Yes, "a sysadmin" could do that.  However, those that are
> > subscribed with different addresses on each list will end
> > up subscribed twice and those who have changed their preferences on
> > the abondoned list will have fix them as well.
> 
> Just for interest:
> 
> 	members of linuxppc-dev		473
> 	members of linuxppc64-dev	264
> 	common				 98
> 
> But, as I said, "common" above does not count those who have different
> addresses subscribed to each list.

Where did we leave on with this?  I was about to request that 
marc.theaimsgroup.com start archiving some of the ppc lists but figured 
doing it after we merged lists would be better.

- kumar

^ permalink raw reply

* Re: boot failure on lite5200b board
From: Dale Farnsworth @ 2006-02-24 16:48 UTC (permalink / raw)
  To: lijianggan, linuxppc-embedded
In-Reply-To: <84A109BF918D934CB46ACF33BCE187C002D54D7B@mail02.student.main.ntu.edu.sg>

>From article <84A109BF918D934CB46ACF33BCE187C002D54D7B@mail02.student.main.ntu.edu.sg>:
> I have actually tried both kernel with both console configurations. It =
> gave the same output, thus I presume that the problem lies somewhere =
> else. I attached the log to this email.=20
> 
> the board is Lite5200B Version 1.0. Which .config file do you want?
> 
> Sylvain, we have ordered a debugging set but we are still waiting for =
> delivery, the leaking time is said to be one month, tant pis. And the =
> log I attached here are booting from a higher address (0x500000).
> 
> My current u-boot args:
> 
> setconsole=setenv bootargs console=ttyPSC0, 115200n8 console=tty1

This is incorrect.  There can be no space before the baud rate,
and I don't think you want console=tty1.

-Dale

^ permalink raw reply

* [PATCH] powerpc: Fix mem= cmdline handling on arch/powerpc for !MULTIPLATFORM
From: Kumar Gala @ 2006-02-24 16:54 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, Linus Torvalds, linux-kernel

mem= command line option was being ignored in arch/powerpc if we were not
a CONFIG_MULTIPLATFORM (which is handled via prom_init stub). The initial
command line extraction and parsing needed to be moved earlier in the boot
process and have code to actual parse mem= and do something about it.

Also, fixed a compile warning in the file.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

---
commit 625f68c82bae16c53f684c5512b0176c243c6068
tree 5657155434c9a44fa9ee3e0329756e354daf4845
parent 820ac48b82821c6d38747ea49f98aeca05ca2e2b
author Kumar Gala <galak@kernel.crashing.org> Fri, 24 Feb 2006 11:03:12 -0600
committer Kumar Gala <galak@kernel.crashing.org> Fri, 24 Feb 2006 11:03:12 -0600

 arch/powerpc/kernel/prom.c |   54 +++++++++++++++++++++++++++++++-------------
 1 files changed, 38 insertions(+), 16 deletions(-)

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 294832a..6dbd217 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -816,8 +816,6 @@ void __init unflatten_device_tree(void)
 {
 	unsigned long start, mem, size;
 	struct device_node **allnextp = &allnodes;
-	char *p = NULL;
-	int l = 0;
 
 	DBG(" -> unflatten_device_tree()\n");
 
@@ -857,19 +855,6 @@ void __init unflatten_device_tree(void)
 	if (of_chosen == NULL)
 		of_chosen = of_find_node_by_path("/chosen@0");
 
-	/* Retreive command line */
-	if (of_chosen != NULL) {
-		p = (char *)get_property(of_chosen, "bootargs", &l);
-		if (p != NULL && l > 0)
-			strlcpy(cmd_line, p, min(l, COMMAND_LINE_SIZE));
-	}
-#ifdef CONFIG_CMDLINE
-	if (l == 0 || (l == 1 && (*p) == 0))
-		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
-#endif /* CONFIG_CMDLINE */
-
-	DBG("Command line is: %s\n", cmd_line);
-
 	DBG(" <- unflatten_device_tree()\n");
 }
 
@@ -940,6 +925,8 @@ static int __init early_init_dt_scan_cho
 {
 	u32 *prop;
 	unsigned long *lprop;
+	unsigned long l;
+	char *p;
 
 	DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
 
@@ -1004,6 +991,41 @@ static int __init early_init_dt_scan_cho
                crashk_res.end = crashk_res.start + *lprop - 1;
 #endif
 
+	/* Retreive command line */
+ 	p = of_get_flat_dt_prop(node, "bootargs", &l);
+	if (p != NULL && l > 0)
+		strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
+
+#ifdef CONFIG_CMDLINE
+	if (l == 0 || (l == 1 && (*p) == 0))
+		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
+#endif /* CONFIG_CMDLINE */
+
+	DBG("Command line is: %s\n", cmd_line);
+
+	if (strstr(cmd_line, "mem=")) {
+		char *p, *q;
+		unsigned long maxmem = 0;
+
+		for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) {
+			q = p + 4;
+			if (p > cmd_line && p[-1] != ' ')
+				continue;
+			maxmem = simple_strtoul(q, &q, 0);
+			if (*q == 'k' || *q == 'K') {
+				maxmem <<= 10;
+				++q;
+			} else if (*q == 'm' || *q == 'M') {
+				maxmem <<= 20;
+				++q;
+			} else if (*q == 'g' || *q == 'G') {
+				maxmem <<= 30;
+				++q;
+			}
+		}
+		memory_limit = maxmem;
+	}
+
 	/* break now */
 	return 1;
 }
@@ -1124,7 +1146,7 @@ static void __init early_reserve_mem(voi
 			size_32 = *(reserve_map_32++);
 			if (size_32 == 0)
 				break;
-			DBG("reserving: %lx -> %lx\n", base_32, size_32);
+			DBG("reserving: %x -> %x\n", base_32, size_32);
 			lmb_reserve(base_32, size_32);
 		}
 		return;

^ permalink raw reply related

* Re: boot failure on lite5200b board
From: John Rigby @ 2006-02-24 17:17 UTC (permalink / raw)
  To: #LI JIANGGAN#; +Cc: linuxppc-embedded
In-Reply-To: <84A109BF918D934CB46ACF33BCE187C002D54D7B@mail02.student.main.ntu.edu.sg>

I don't think your syntax for appending to an env variable is correct:

try:
set bootargs $(bootargs) ...appended stuff...
instead of:
set bootargs env bootargs ...appended stuff....

Also to see what bootargs is actually set to after all the nested
commands, add a printenv just before the bootm

On 2/23/06, #LI JIANGGAN# <lijianggan@pmail.ntu.edu.sg> wrote:
>
>
> I have actually tried both kernel with both console configurations. It ga=
ve
> the same output, thus I presume that the problem lies somewhere else. I
> attached the log to this email.
>
>  the board is Lite5200B Version 1.0. Which .config file do you want?
>
>  Sylvain, we have ordered a debugging set but we are still waiting for
> delivery, the leaking time is said to be one month, tant pis. And the log=
 I
> attached here are booting from a higher address (0x500000).
>
>  My current u-boot args:
>  Autostarting. Press any key to abort..
>
>  Hit any key to stop autoboot:  0
>  =3D> printenv
>  baudrate=3D115200
>  autoload=3Dno
>  ethact=3DFEC ETHERNET
>  flshroot=3Droot=3D/dev/mtdblock2 rw
>  ethaddr=3D00:01:9F:00:27:2F
>  preboot=3Decho; echo Autostarting. Press any key to abort..; echo
>  bootdelay=3D5
>  hostname=3Dicecube
>  bootfile=3DMPC5200/uImage
>  nv=3Dnfsroot root=3D/dev/nfs rw nfsroot=3D10.190.3.113:/opt/eldk/rootfs
>  ip=3Dip=3D10.190.3.144:10.190.3.103:10.190.3.103:255.255.240.0:icecube::=
off
>  nfsroot=3Droot=3D/dev/nfs rw nfsroot=3D10.190.3.103:/opt/eldk-4-0/rootfs
>  bootcmd=3Drun net_nfs
>  filesize=3D546
>  fileaddr=3D500000
>  netmask=3D255.255.240.0
>  ipaddr=3D10.190.3.144
>  serverip=3D10.190.3.103
>  setconsole=3Dsetenv bootargs console=3DttyPSC0, 115200n8 console=3Dtty1
>  rootfs=3Droot=3D/dev/nfs rw nfsroot=3D10.190.3.103:/opt/eldk-4-0/rootfs
>  bootargs=3Denv bootargs root=3D/dev/nfs rw
> nfsroot=3D10.190.3.103:/opt/eldk-4-0/rootfs
> ip=3D10.190.3.144:10.190.3.103:10.190.3.103:255.255.240.0:icecube::off
>  flash_nfs=3Drun setconsole nfsargs addip;bootm
>  net_nfs=3Dtftp 500000 MPC5200/uImage;run setconsole nfsargs addip;bootm
>  nfsargs=3Dsetenv bootargs env bootargs root=3D/dev/nfs rw
> nfsroot=3D10.190.3.103:/opt/eldk-4-0/rootfs
> ip=3D10.190.3.144:10.190.3.103:10.190.3.103:255.255.240.0:icecube::offroo=
t=3D/dev/nfs
> rw
>  addip=3Dsetenv bootargs env bootargs root=3D/dev/nfs rw
> nfsroot=3D10.190.3.103:/opt/eldk-4-0/rootfs
> ip=3D10.190.3.144:10.190.3.103:10.190.3.103:255.255.240.0:icecube::off
>  ramargs=3Dsetenv bootargs root=3D/dev/ram rw
>  console=3Dconsole=3DttyS0,115200n8 console=3Dtty1
>  stdin=3Dserial
>  stdout=3Dserial
>  stderr=3Dserial
>
>  Environment size: 1472/65532 bytes
>  =3D>
>
>
>
>
>  USING Sylvain's KERNEL:
>
>  U-Boot 1.1.3 (Feb  6 2006 - 09:56:46)
>
>  CPU:   MPC5200 v2.2 at 462 MHz
>         Bus 132 MHz, IPB 132 MHz, PCI 33 MHz
>  Board: Freescale MPC5200 (Lite5200B)
>  I2C:   85 kHz, ready
>  DRAM:  256 MB
>  FLASH: 32 MB
>  PCI:   Bus Dev VenId DevId Class Int
>          00  1a  1057  5809  0680  00
>  In:    serial
>  Out:   serial
>  Err:   serial
>  Net:   FEC ETHERNET
>  IDE:   Bus 0: OK
>    Device 0: not available
>    Device 1: not available
>
>  Autostarting. Press any key to abort..
>
>  Hit any key to stop autoboot:  0
>  Using FEC ETHERNET device
>  TFTP from server 10.190.3.103; our IP address is 10.190.3.144
>  Filename 'MPC5200/uImage'.
>  Load address: 0x500000
>  Loading: ###############################################################=
##
>           ###############################################################=
#
>  done
>  Bytes transferred =3D 658114 (a0ac2 hex)
>  ## Booting image at 00500000 ...
>     Image Name:   Linux-2.6.16-rc1
>     Image Type:   PowerPC Linux Kernel Image (gzip compressed)
>     Data Size:    658050 Bytes =3D 642.6 kB
>     Load Address: 00000000
>     Entry Point:  00000000
>     Verifying Checksum ... OK
>     Uncompressing Kernel Image ... OK
>  id mach(): done
>  MMU:enter
>  MMU:hw init
>  MMU:mapin
>  MMU:setio
>  MMU:exit
>  setup_arch: enter
>  setup_arch: bootmem
>  arch: exit
>
>
>
>  USING KERNEL FROM Freescale:
>
>  U-Boot 1.1.3 (Feb  6 2006 - 09:56:46)
>
>  CPU:   MPC5200 v2.2 at 462 MHz
>         Bus 132 MHz, IPB 132 MHz, PCI 33 MHz
>  Board: Freescale MPC5200 (Lite5200B)
>  I2C:   85 kHz, ready
>  DRAM:  256 MB
>  FLASH: 32 MB
>  PCI:   Bus Dev VenId DevId Class Int
>          00  1a  1057  5809  0680  00
>  In:    serial
>  Out:   serial
>  Err:   serial
>  Net:   FEC ETHERNET
>  IDE:   Bus 0: OK
>    Device 0: not available
>    Device 1: not available
>
>  Autostarting. Press any key to abort..
>
>  Hit any key to stop autoboot:  0
>  Using FEC ETHERNET device
>  TFTP from server 10.190.3.103; our IP address is 10.190.3.144
>  Filename 'MPC5200/uImage'.
>  Load address: 0x500000
>  Loading: ###############################################################=
##
>           ###############################################################=
##
>           ###############################################################=
##
>           ###############################################################=
##
>           ###################################
>  done
>  Bytes transferred =3D 1510143 (170aff hex)
>  ## Booting image at 00500000 ...
>     Image Name:   Linux-2.6.11.7
>     Image Type:   PowerPC Linux Kernel Image (gzip compressed)
>     Data Size:    1510079 Bytes =3D  1.4 MB
>     Load Address: 00000000
>     Entry Point:  00000000
>     Verifying Checksum ... OK
>     Uncompressing Kernel Image ... OK
>  id mach(): done
>  MMU:enter
>  MMU:hw init
>  MMU:mapin
>  MMU:setio
>  MMU:exit
>  setup_arch: enter
>  setup_arch: bootmem
>  ocp: exit
>  arch: exit
>
>
>
>
>  -----Original Message-----
>  From: John Rigby [mailto:jcrigby@gmail.com]
>  Sent: Fri 2/24/2006 0:18
>  To: #LI JIANGGAN#
>  Subject: Re: boot failure on lite5200b board
>
>  If you are using Sylvain's kernel you need to set console=3DttyPSC0.  If=
 you
> are
>  using a kernel from Freescale then you need to set console=3DttyS0.
>
>  Also what rev of the board do you have?
>
>
>
>  On 2/23/06, #LI JIANGGAN# <lijianggan@pmail.ntu.edu.sg> wrote:
>  >
>  >
>  > Thank you Jos=E9 Mar=EDa and Andrey for your advices, however the prob=
lem
>  > remains. I've tried setting the console (though I remember that our
> previous
>  > lite5200 board was working fine on kernel 2.4 without setting the
> console);
>  > meantime, I've set the booting image to 0x500000; I have also tried us=
ing
>  > the kernel image come together with the BSP, it's always the same erro=
r.
>  >
>  >  Sylvain, I've actually using your kernel source, the compiled image i=
s
>  > around 700k (compared to the 1.4M image from the BSP), but it doesn't
> solve
>  > the problem. So I presume that the problem is lying somewhere else.
>  >
>  >  A SNAPSHOT OF THE BOOTING MESSAGES:
>  >
>  >
>  >  U-Boot 1.1.3 (Feb  6 2006 - 09:56:46)
>  >
>  >  CPU:   MPC5200 v2.2 at 462 MHz
>  >         Bus 132 MHz, IPB 132 MHz, PCI 33 MHz
>  >  Board: Freescale MPC5200 (Lite5200B)
>  >  I2C:   85 kHz, ready
>  >  DRAM:  256 MB
>  >  FLASH: 32 MB
>  >  PCI:   Bus Dev VenId DevId Class Int
>  >          00  1a  1057  5809  0680  00
>  >  In:    serial
>  >  Out:   serial
>  >  Err:   serial
>  >  Net:   FEC ETHERNET
>  >  IDE:   Bus 0: OK
>  >    Device 0: not available
>  >    Device 1: not available
>  >
>  >  Autostarting. Press any key to abort..
>  >
>  >  Hit any key to stop autoboot:  0
>  >  Using FEC ETHERNET device
>  >  TFTP from server 10.190.3.103; our IP address is 10.190.3.144
>  >  Filename 'MPC5200/uImage'.
>  >  Load address: 0x100000
>  >  Loading:
>  > #################################################################
>  >
>  > ################################################################
>  >  done
>  >  Bytes transferred =3D 658114 (a0ac2 hex)
>  >  ## Booting image at 00100000 ...
>  >     Image Name:   Linux-2.6.16-rc1
>  >     Image Type:   PowerPC Linux Kernel Image (gzip compressed)
>  >     Data Size:    658050 Bytes =3D 642.6 kB
>  >     Load Address: 00000000
>  >     Entry Point:  00000000
>  >     Verifying Checksum ... OK
>  >     Uncompressing Kernel Image ... OK
>  >  id mach(): done
>  >  MMU:enter
>  >  MMU:hw init
>  >  MMU:mapin
>  >  MMU:setio
>  >  MMU:exit
>  >  setup_arch: enter
>  >  setup_arch: bootmem
>  >  arch: exit
>  >
>  >
>  >  I am wondering whether it's a kernel problem or more likely to be a
> problem
>  > lying with the U-boot. It seems to hang when executing setup_arch()
>  > function, or maybe there is sth else behind the wall?
>  >
>  >  Regards,
>  >  Jianggan LI
>  >
>  >
>  >
>  >
>  >  -----Original Message-----
>  >  From: Sylvain Munaut [mailto:tnt@246tNt.com]
>  >  Sent: Thu 2/23/2006 15:38
>  >  To: #LI JIANGGAN#
>  >  Cc: linuxppc-embedded@ozlabs.org
>  >  Subject: Re: boot failure on lite5200b board
>  >
>  >  #LI JIANGGAN# wrote:
>  >  > Hello all,
>  >  >
>  >  > For my end-of-study project, I am working on an embedded system wit=
h
>  >  > reference of freescale's lite5200b reference board. I was trying to
> boot
>  >  > Linux 2.6.15 on the board (with the fec and bestcomm corrected).
> however
>  >  > the booting was stuck at the following stage:
>  >
>  >  In addition to what has already been said (use a higher address for t=
he
>  >  image and don't forget console=3DttyPSC0 in kernel command line), mak=
e
>  >  sure you use the kernel from my git tree, it contains a few patches f=
rom
>  >  John Rigby to add support for the lite5200b.
>  >
>  >  Please report if it works, I've not been able to test those myself si=
nce
>  >  i'm still on lite5200.
>  >
>  >
>  >          Sylvain
>  >
>  >
>  >
>  >
>  >
>  >
>  > _______________________________________________
>  > Linuxppc-embedded mailing list
>  > Linuxppc-embedded@ozlabs.org
>  > https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>  >
>  >
>
>
>
>
>

^ permalink raw reply

* Re: [PATCH] ppc32: handle Book E debug exceptions on kernel stack
From: Dale Farnsworth @ 2006-02-24 18:52 UTC (permalink / raw)
  To: David Gibson; +Cc: Paul Mackerras, linuxppc-embedded
In-Reply-To: <20060223234945.GB25101@localhost.localdomain>

On Fri, Feb 24, 2006 at 10:49:45AM +1100, David Gibson wrote:
> On Wed, Feb 22, 2006 at 10:19:54PM -0600, Kumar Gala wrote:
> > On Tue, 14 Feb 2006, Dale Farnsworth wrote:
> > 
> > > From: Dale Farnsworth <dale@farnsworth.org>
> > > 
> > > On PPC Book E processsors, we currently handle debug
> > > exceptions on the critical exception stack (debug stack
> > > for E200).  This causes problems with the kgdb single
> > > step handler, which calls smp_processor_id() and spin_lock(),
> > > which reference current_thread_info(), which only works when
> > > we are on the kernel stack.
> > > 
> > > We address this by switching to the kernel stack early while
> > > handling debug exceptions.  Note that the entry values of r10
> > > and r11 are still saved on the critical exception (or debug) stack.
> > > 
> > > Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
> > > 
> > 
> > Paul,
> > 
> > We were wondering if you or David remember why a specific critical
> > exception stack was added in the 40x port from 2.4 to 2.6?
> 
> I don't, in any detail.  But did it have to do with a possible race
> with a critical exception in just the wrong part of the normal
> exception exit path.  ISTR BenH was worried about something in that
> area.

There's a race between a critical exception and the normal exception
entry path.  If a normal exception occurs in user mode and then a
critical exception occurs before the normal exception handler has set
r1 to the kernel stack area, we end up with r1 containing the user sp,
though the critical exception occurred in kernel mode.

I haven't yet come up with a way to detect this case and reliably use
the kernel stack on a critical exception.

-Dale

^ permalink raw reply

* Re: [PATCH] powerpc: Fix mem= cmdline handling on arch/powerpc for !MULTIPLATFORM
From: Segher Boessenkool @ 2006-02-24 21:04 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev, Linus Torvalds, linux-kernel
In-Reply-To: <Pine.LNX.4.44.0602241054090.2981-100000@gate.crashing.org>

I can confirm this works on systems with "real" OF, too.  Furthermore,
the patch looks sane to me.

Acked-by: Segher Boessenkool <segher@kernel.crashing.org>

> mem= command line option was being ignored in arch/powerpc if we were 
> not
> a CONFIG_MULTIPLATFORM (which is handled via prom_init stub). The 
> initial
> command line extraction and parsing needed to be moved earlier in the 
> boot
> process and have code to actual parse mem= and do something about it.
>
> Also, fixed a compile warning in the file.
>
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
>
> ---
> commit 625f68c82bae16c53f684c5512b0176c243c6068
> tree 5657155434c9a44fa9ee3e0329756e354daf4845
> parent 820ac48b82821c6d38747ea49f98aeca05ca2e2b
> author Kumar Gala <galak@kernel.crashing.org> Fri, 24 Feb 2006 
> 11:03:12 -0600
> committer Kumar Gala <galak@kernel.crashing.org> Fri, 24 Feb 2006 
> 11:03:12 -0600
>
>  arch/powerpc/kernel/prom.c |   54 
> +++++++++++++++++++++++++++++++-------------
>  1 files changed, 38 insertions(+), 16 deletions(-)
>
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 294832a..6dbd217 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -816,8 +816,6 @@ void __init unflatten_device_tree(void)
>  {
>  	unsigned long start, mem, size;
>  	struct device_node **allnextp = &allnodes;
> -	char *p = NULL;
> -	int l = 0;
>
>  	DBG(" -> unflatten_device_tree()\n");
>
> @@ -857,19 +855,6 @@ void __init unflatten_device_tree(void)
>  	if (of_chosen == NULL)
>  		of_chosen = of_find_node_by_path("/chosen@0");
>
> -	/* Retreive command line */
> -	if (of_chosen != NULL) {
> -		p = (char *)get_property(of_chosen, "bootargs", &l);
> -		if (p != NULL && l > 0)
> -			strlcpy(cmd_line, p, min(l, COMMAND_LINE_SIZE));
> -	}
> -#ifdef CONFIG_CMDLINE
> -	if (l == 0 || (l == 1 && (*p) == 0))
> -		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> -#endif /* CONFIG_CMDLINE */
> -
> -	DBG("Command line is: %s\n", cmd_line);
> -
>  	DBG(" <- unflatten_device_tree()\n");
>  }
>
> @@ -940,6 +925,8 @@ static int __init early_init_dt_scan_cho
>  {
>  	u32 *prop;
>  	unsigned long *lprop;
> +	unsigned long l;
> +	char *p;
>
>  	DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
>
> @@ -1004,6 +991,41 @@ static int __init early_init_dt_scan_cho
>                 crashk_res.end = crashk_res.start + *lprop - 1;
>  #endif
>
> +	/* Retreive command line */
> + 	p = of_get_flat_dt_prop(node, "bootargs", &l);
> +	if (p != NULL && l > 0)
> +		strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
> +
> +#ifdef CONFIG_CMDLINE
> +	if (l == 0 || (l == 1 && (*p) == 0))
> +		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> +#endif /* CONFIG_CMDLINE */
> +
> +	DBG("Command line is: %s\n", cmd_line);
> +
> +	if (strstr(cmd_line, "mem=")) {
> +		char *p, *q;
> +		unsigned long maxmem = 0;
> +
> +		for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) {
> +			q = p + 4;
> +			if (p > cmd_line && p[-1] != ' ')
> +				continue;
> +			maxmem = simple_strtoul(q, &q, 0);
> +			if (*q == 'k' || *q == 'K') {
> +				maxmem <<= 10;
> +				++q;
> +			} else if (*q == 'm' || *q == 'M') {
> +				maxmem <<= 20;
> +				++q;
> +			} else if (*q == 'g' || *q == 'G') {
> +				maxmem <<= 30;
> +				++q;
> +			}
> +		}
> +		memory_limit = maxmem;
> +	}
> +
>  	/* break now */
>  	return 1;
>  }
> @@ -1124,7 +1146,7 @@ static void __init early_reserve_mem(voi
>  			size_32 = *(reserve_map_32++);
>  			if (size_32 == 0)
>  				break;
> -			DBG("reserving: %lx -> %lx\n", base_32, size_32);
> +			DBG("reserving: %x -> %x\n", base_32, size_32);
>  			lmb_reserve(base_32, size_32);
>  		}
>  		return;
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>

^ permalink raw reply

* Re: [PATCH] powerpc: Fix mem= cmdline handling on arch/powerpc for !MULTIPLATFORM
From: Michael Ellerman @ 2006-02-24 22:27 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Linus Torvalds, linux-kernel
In-Reply-To: <Pine.LNX.4.44.0602241054090.2981-100000@gate.crashing.org>

[-- Attachment #1: Type: text/plain, Size: 1876 bytes --]

Hi Kumar,

On Sat, 25 Feb 2006 03:54, Kumar Gala wrote:
> mem= command line option was being ignored in arch/powerpc if we were not
> a CONFIG_MULTIPLATFORM (which is handled via prom_init stub). The initial
> command line extraction and parsing needed to be moved earlier in the boot
> process and have code to actual parse mem= and do something about it.

> @@ -1004,6 +991,41 @@ static int __init early_init_dt_scan_cho
>                 crashk_res.end = crashk_res.start + *lprop - 1;
>  #endif
>
> +	/* Retreive command line */
> + 	p = of_get_flat_dt_prop(node, "bootargs", &l);
> +	if (p != NULL && l > 0)
> +		strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
> +
> +#ifdef CONFIG_CMDLINE
> +	if (l == 0 || (l == 1 && (*p) == 0))
> +		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> +#endif /* CONFIG_CMDLINE */
> +
> +	DBG("Command line is: %s\n", cmd_line);
> +
> +	if (strstr(cmd_line, "mem=")) {
> +		char *p, *q;
> +		unsigned long maxmem = 0;
> +
> +		for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) {
> +			q = p + 4;
> +			if (p > cmd_line && p[-1] != ' ')
> +				continue;
> +			maxmem = simple_strtoul(q, &q, 0);
> +			if (*q == 'k' || *q == 'K') {
> +				maxmem <<= 10;
> +				++q;
> +			} else if (*q == 'm' || *q == 'M') {
> +				maxmem <<= 20;
> +				++q;
> +			} else if (*q == 'g' || *q == 'G') {
> +				maxmem <<= 30;
> +				++q;
> +			}
> +		}
> +		memory_limit = maxmem;
> +	}
> +

Why not make the mem= parsing an early_param() handler and then call 
parse_early_param() here?

And I think a switch would be easier to read for the K/M/G handling.

cheers

-- 
Michael Ellerman
IBM OzLabs

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH] powerpc: Fix mem= cmdline handling on arch/powerpc for !MULTIPLATFORM
From: Kumar Gala @ 2006-02-24 22:43 UTC (permalink / raw)
  To: michael; +Cc: linuxppc-dev, Linus Torvalds, linux-kernel
In-Reply-To: <200602250927.36954.michael@ellerman.id.au>


On Feb 24, 2006, at 4:27 PM, Michael Ellerman wrote:

> Hi Kumar,
>
> On Sat, 25 Feb 2006 03:54, Kumar Gala wrote:
>> mem= command line option was being ignored in arch/powerpc if we  
>> were not
>> a CONFIG_MULTIPLATFORM (which is handled via prom_init stub). The  
>> initial
>> command line extraction and parsing needed to be moved earlier in  
>> the boot
>> process and have code to actual parse mem= and do something about it.
>
>> @@ -1004,6 +991,41 @@ static int __init early_init_dt_scan_cho
>>                 crashk_res.end = crashk_res.start + *lprop - 1;
>>  #endif
>>
>> +	/* Retreive command line */
>> + 	p = of_get_flat_dt_prop(node, "bootargs", &l);
>> +	if (p != NULL && l > 0)
>> +		strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
>> +
>> +#ifdef CONFIG_CMDLINE
>> +	if (l == 0 || (l == 1 && (*p) == 0))
>> +		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
>> +#endif /* CONFIG_CMDLINE */
>> +
>> +	DBG("Command line is: %s\n", cmd_line);
>> +
>> +	if (strstr(cmd_line, "mem=")) {
>> +		char *p, *q;
>> +		unsigned long maxmem = 0;
>> +
>> +		for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) {
>> +			q = p + 4;
>> +			if (p > cmd_line && p[-1] != ' ')
>> +				continue;
>> +			maxmem = simple_strtoul(q, &q, 0);
>> +			if (*q == 'k' || *q == 'K') {
>> +				maxmem <<= 10;
>> +				++q;
>> +			} else if (*q == 'm' || *q == 'M') {
>> +				maxmem <<= 20;
>> +				++q;
>> +			} else if (*q == 'g' || *q == 'G') {
>> +				maxmem <<= 30;
>> +				++q;
>> +			}
>> +		}
>> +		memory_limit = maxmem;
>> +	}
>> +
>
> Why not make the mem= parsing an early_param() handler and then call
> parse_early_param() here?

This would put constraints on the early_param()'s that I dont think  
we should impose.

> And I think a switch would be easier to read for the K/M/G handling.

I should probably use memparse() now that I've found it :)

- k

^ permalink raw reply

* Re: mpc5200 timer3 Interrupts stopped working
From: bennett78 @ 2006-02-24 22:49 UTC (permalink / raw)
  To: Frank Bennett; +Cc: linuxppc-embedded
In-Reply-To: <43FF2D69.3030902@digis.net>

[-- Attachment #1: Type: text/plain, Size: 3715 bytes --]

bennett78 wrote:

> Help, how do I debug timer3 Interrupts?  My driver was working and 
> then interrupts

Never mind H/W problem...the J27 jumper on the 5200Lite was missing.  I 
did get a change to
review arch/ppc/kernel/mpc5xxx-pic.c & my interrupt masks settings!

Sorry for the thread interrupt!

Frank Bennett

> stopped coming (most likely blocked).  I have a driver that is very 
> similar to
>      linuxppc_2_4_devel/drivers/char/pp01_ad64.c
> I have attached the complete driver (et.c)
>
> / # insmod et
> ET Display Driver v0.1 loaded ET_TIN irq 16
>
> et_init 00 intr->per_mask  1bfffc00
> et_init 10 intr->ctrl      00c01001
> et_init 14 intr->main_mask 00010e00
> et_init 24 intr->enc_stat  00000001
> et_init 28 intr->crit_stat 00000000
> et_init 2c intr->main_stat 00002000
> et_init 30 intr->per_stat  00000000
> et_init 38 intr->per_error 00000000
>
> / # cat /proc/interrupts
>            CPU0
>  16:          0  MPC5xxx Edge      et Trubine
>  23:       1049  MPC5xxx Edge      eth_xmit
>  24:       2468  MPC5xxx Edge      eth_recv
>  39:         51  MPC5xxx Edge      serial
>  40:          0  MPC5xxx Edge      serial
>  43:         69  MPC5xxx Edge      eth_err
> BAD:          0
>
> with a pulse train on timer3 input "et_interrupt" no longer gets
> called.
>
> code snippets
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> #define ET_TIN         3   // Turbine PULSE IN
>
> static void et_interrupt (int irq, void *dev_id, struct pt_regs * regs)
> {
>     int port = ET_IRQ_TO_PORT(irq);
>     unsigned long stat;
>
>     printk(KERN_INFO "et_interrupt IRQ %d port %d main_stat %x gpt.sr 
> %x \n",
>                         irq, port, intr->main_status, gpt[port].sr );
>
>     if( port == ET_TIN ) {
>         // Clear pending interrupt
>         stat = in_be32(&gpt[port].sr) & 0xffff;
>         out_be32(&gpt[port].sr,  MPC5xxx_GPT_SR_CAPT);
>         printk(KERN_INFO "et_int irq=%d port=%d stat %0lx \n", irq, 
> port, stat);
>         // wake_up_interruptible(&et_wait);
>     } else {
>         printk(KERN_ERR ET_MSG "Unexpected IRQ %d received", irq);
>     }
>     spin_lock (&et_lock);
>     turbine_per = in_be32(&gpt[port].sr) >> 16;
>     spin_unlock (&et_lock);
> }
>
>
> static int __init et_init (void)
> ....
> if (request_irq(ET_PORT_TO_IRQ(ET_TIN), et_interrupt, 0, "et Trubine", 
> NULL)) {
>             printk(KERN_ERR ET_MSG "couldn't register interrupts\n");
>             goto abort_remove_proc;
>     }
> out_be32(&gpt[ET_TIN].cir, (   66<<16) | 1 );  /* prescale(16), 
> period(16)  */
> out_be32(&gpt[ET_TIN].emsr,
>         MPC5xxx_GPT_EMSR_INP_CAPTURE
>       | MPC5xxx_GPT_EMSR_ICT_FALLING
>       | MPC5xxx_GPT_EMSR_INT_ENABLE);
> ...
> printk(KERN_INFO "ET Display Driver v%s loaded ET_TIN irq %d\n",
>         ET_VERSION, ET_PORT_TO_IRQ(ET_TIN) );
>
>     //broke with or without the following
>     intr->main_mask &= ~(0x000000ff);   /* enable timer ints */
>
>     printk(KERN_INFO "et_init 00 intr->per_mask  %08x\n", intr->per_mask);
>     printk(KERN_INFO "et_init 10 intr->ctrl      %08x\n", intr->ctrl);
>     printk(KERN_INFO "et_init 14 intr->main_mask %08x\n", 
> intr->main_mask);
>     printk(KERN_INFO "et_init 24 intr->enc_stat  %08x\n", 
> intr->enc_status);
>     printk(KERN_INFO "et_init 28 intr->crit_stat %08x\n", 
> intr->crit_status);
>     printk(KERN_INFO "et_init 2c intr->main_stat %08x\n", 
> intr->main_status);
>     printk(KERN_INFO "et_init 30 intr->per_stat  %08x\n", 
> intr->per_status);
>     printk(KERN_INFO "et_init 38 intr->per_error %08x\n", 
> intr->per_error);
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> thanks in advance for any help,
>
> Frank Bennett
>

[-- Attachment #2: Type: text/html, Size: 6339 bytes --]

^ permalink raw reply

* [PATCH][UPDATE] powerpc: Fix mem= cmdline handling on arch/powerpc for !MULTIPLATFORM
From: Kumar Gala @ 2006-02-24 23:14 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, Linus Torvalds, linux-kernel
In-Reply-To: <815A460C-BAB0-4770-8357-68136D31EDC3@kernel.crashing.org>

mem= command line option was being ignored in arch/powerpc if we were not
a CONFIG_MULTIPLATFORM (which is handled via prom_init stub). The initial
command line extraction and parsing needed to be moved earlier in the boot
process and have code to actual parse mem= and do something about it.

Also, fixed a compile warning in the file.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

---
commit a49869ffbf01f3998523357c85f7b55a6d064cda
tree efd39700c07ac02cb6216ebf8d6d0d2adf7be36a
parent 820ac48b82821c6d38747ea49f98aeca05ca2e2b
author Kumar Gala <galak@kernel.crashing.org> Fri, 24 Feb 2006 17:08:54 -0600
committer Kumar Gala <galak@kernel.crashing.org> Fri, 24 Feb 2006 17:08:54 -0600

 arch/powerpc/kernel/prom.c |   42 ++++++++++++++++++++++++++----------------
 1 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 294832a..670654b 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -816,8 +816,6 @@ void __init unflatten_device_tree(void)
 {
 	unsigned long start, mem, size;
 	struct device_node **allnextp = &allnodes;
-	char *p = NULL;
-	int l = 0;
 
 	DBG(" -> unflatten_device_tree()\n");
 
@@ -857,19 +855,6 @@ void __init unflatten_device_tree(void)
 	if (of_chosen == NULL)
 		of_chosen = of_find_node_by_path("/chosen@0");
 
-	/* Retreive command line */
-	if (of_chosen != NULL) {
-		p = (char *)get_property(of_chosen, "bootargs", &l);
-		if (p != NULL && l > 0)
-			strlcpy(cmd_line, p, min(l, COMMAND_LINE_SIZE));
-	}
-#ifdef CONFIG_CMDLINE
-	if (l == 0 || (l == 1 && (*p) == 0))
-		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
-#endif /* CONFIG_CMDLINE */
-
-	DBG("Command line is: %s\n", cmd_line);
-
 	DBG(" <- unflatten_device_tree()\n");
 }
 
@@ -940,6 +925,8 @@ static int __init early_init_dt_scan_cho
 {
 	u32 *prop;
 	unsigned long *lprop;
+	unsigned long l;
+	char *p;
 
 	DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
 
@@ -1004,6 +991,29 @@ static int __init early_init_dt_scan_cho
                crashk_res.end = crashk_res.start + *lprop - 1;
 #endif
 
+	/* Retreive command line */
+ 	p = of_get_flat_dt_prop(node, "bootargs", &l);
+	if (p != NULL && l > 0)
+		strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
+
+#ifdef CONFIG_CMDLINE
+	if (l == 0 || (l == 1 && (*p) == 0))
+		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
+#endif /* CONFIG_CMDLINE */
+
+	DBG("Command line is: %s\n", cmd_line);
+
+	if (strstr(cmd_line, "mem=")) {
+		char *p, *q;
+
+		for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) {
+			q = p + 4;
+			if (p > cmd_line && p[-1] != ' ')
+				continue;
+			memory_limit = memparse(q, &q);
+		}
+	}
+
 	/* break now */
 	return 1;
 }
@@ -1124,7 +1134,7 @@ static void __init early_reserve_mem(voi
 			size_32 = *(reserve_map_32++);
 			if (size_32 == 0)
 				break;
-			DBG("reserving: %lx -> %lx\n", base_32, size_32);
+			DBG("reserving: %x -> %x\n", base_32, size_32);
 			lmb_reserve(base_32, size_32);
 		}
 		return;

^ permalink raw reply related

* Re: [PATCH] powerpc: Fix mem= cmdline handling on arch/powerpc for !MULTIPLATFORM
From: Michael Ellerman @ 2006-02-24 23:25 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev, Linus Torvalds, linux-kernel
In-Reply-To: <815A460C-BAB0-4770-8357-68136D31EDC3@kernel.crashing.org>

[-- Attachment #1: Type: text/plain, Size: 2482 bytes --]

On Sat, 25 Feb 2006 09:43, Kumar Gala wrote:
> On Feb 24, 2006, at 4:27 PM, Michael Ellerman wrote:
> > Hi Kumar,
> >
> > On Sat, 25 Feb 2006 03:54, Kumar Gala wrote:
> >> mem= command line option was being ignored in arch/powerpc if we
> >> were not
> >> a CONFIG_MULTIPLATFORM (which is handled via prom_init stub). The
> >> initial
> >> command line extraction and parsing needed to be moved earlier in
> >> the boot
> >> process and have code to actual parse mem= and do something about it.
> >>
> >> @@ -1004,6 +991,41 @@ static int __init early_init_dt_scan_cho
> >>                 crashk_res.end = crashk_res.start + *lprop - 1;
> >>  #endif
> >>
> >> +	/* Retreive command line */
> >> + 	p = of_get_flat_dt_prop(node, "bootargs", &l);
> >> +	if (p != NULL && l > 0)
> >> +		strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
> >> +
> >> +#ifdef CONFIG_CMDLINE
> >> +	if (l == 0 || (l == 1 && (*p) == 0))
> >> +		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> >> +#endif /* CONFIG_CMDLINE */
> >> +
> >> +	DBG("Command line is: %s\n", cmd_line);
> >> +
> >> +	if (strstr(cmd_line, "mem=")) {
> >> +		char *p, *q;
> >> +		unsigned long maxmem = 0;
> >> +
> >> +		for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) {
> >> +			q = p + 4;
> >> +			if (p > cmd_line && p[-1] != ' ')
> >> +				continue;
> >> +			maxmem = simple_strtoul(q, &q, 0);
> >> +			if (*q == 'k' || *q == 'K') {
> >> +				maxmem <<= 10;
> >> +				++q;
> >> +			} else if (*q == 'm' || *q == 'M') {
> >> +				maxmem <<= 20;
> >> +				++q;
> >> +			} else if (*q == 'g' || *q == 'G') {
> >> +				maxmem <<= 30;
> >> +				++q;
> >> +			}
> >> +		}
> >> +		memory_limit = maxmem;
> >> +	}
> >> +
> >
> > Why not make the mem= parsing an early_param() handler and then call
> > parse_early_param() here?
>
> This would put constraints on the early_param()'s that I dont think
> we should impose.

All they should really be doing is parsing the string and setting some 
variables, so that seems reasonable to me. Is there anything in particular?

> > And I think a switch would be easier to read for the K/M/G handling.
>
> I should probably use memparse() now that I've found it :)

Even better.

cheers

-- 
Michael Ellerman
IBM OzLabs

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH] powerpc: Fix mem= cmdline handling on arch/powerpc for !MULTIPLATFORM
From: Kumar Gala @ 2006-02-24 23:18 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Linus Torvalds, linux-kernel
In-Reply-To: <200602251025.55741.michael@ellerman.id.au>

On Sat, 25 Feb 2006, Michael Ellerman wrote:

> On Sat, 25 Feb 2006 09:43, Kumar Gala wrote:
> > On Feb 24, 2006, at 4:27 PM, Michael Ellerman wrote:
> > > Hi Kumar,
> > >
> > > On Sat, 25 Feb 2006 03:54, Kumar Gala wrote:
> > >> mem= command line option was being ignored in arch/powerpc if we
> > >> were not
> > >> a CONFIG_MULTIPLATFORM (which is handled via prom_init stub). The
> > >> initial
> > >> command line extraction and parsing needed to be moved earlier in
> > >> the boot
> > >> process and have code to actual parse mem= and do something about it.
> > >>
> > >> @@ -1004,6 +991,41 @@ static int __init early_init_dt_scan_cho
> > >>                 crashk_res.end = crashk_res.start + *lprop - 1;
> > >>  #endif
> > >>
> > >> +	/* Retreive command line */
> > >> + 	p = of_get_flat_dt_prop(node, "bootargs", &l);
> > >> +	if (p != NULL && l > 0)
> > >> +		strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
> > >> +
> > >> +#ifdef CONFIG_CMDLINE
> > >> +	if (l == 0 || (l == 1 && (*p) == 0))
> > >> +		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> > >> +#endif /* CONFIG_CMDLINE */
> > >> +
> > >> +	DBG("Command line is: %s\n", cmd_line);
> > >> +
> > >> +	if (strstr(cmd_line, "mem=")) {
> > >> +		char *p, *q;
> > >> +		unsigned long maxmem = 0;
> > >> +
> > >> +		for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) {
> > >> +			q = p + 4;
> > >> +			if (p > cmd_line && p[-1] != ' ')
> > >> +				continue;
> > >> +			maxmem = simple_strtoul(q, &q, 0);
> > >> +			if (*q == 'k' || *q == 'K') {
> > >> +				maxmem <<= 10;
> > >> +				++q;
> > >> +			} else if (*q == 'm' || *q == 'M') {
> > >> +				maxmem <<= 20;
> > >> +				++q;
> > >> +			} else if (*q == 'g' || *q == 'G') {
> > >> +				maxmem <<= 30;
> > >> +				++q;
> > >> +			}
> > >> +		}
> > >> +		memory_limit = maxmem;
> > >> +	}
> > >> +
> > >
> > > Why not make the mem= parsing an early_param() handler and then call
> > > parse_early_param() here?
> >
> > This would put constraints on the early_param()'s that I dont think
> > we should impose.
> 
> All they should really be doing is parsing the string and setting some 
> variables, so that seems reasonable to me. Is there anything in particular?

If you ever had to do some memory allocation as part of the parsing that 
might be an issue, since we haven't setup the LMB at that point.

- kumar

^ permalink raw reply

* Re: [PATCH] powerpc: Fix mem= cmdline handling on arch/powerpc for !MULTIPLATFORM
From: Michael Ellerman @ 2006-02-25  0:12 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Linus Torvalds, linux-kernel
In-Reply-To: <Pine.LNX.4.44.0602241717340.11527-100000@gate.crashing.org>

[-- Attachment #1: Type: text/plain, Size: 3048 bytes --]

On Sat, 25 Feb 2006 10:18, Kumar Gala wrote:
> On Sat, 25 Feb 2006, Michael Ellerman wrote:
> > On Sat, 25 Feb 2006 09:43, Kumar Gala wrote:
> > > On Feb 24, 2006, at 4:27 PM, Michael Ellerman wrote:
> > > > Hi Kumar,
> > > >
> > > > On Sat, 25 Feb 2006 03:54, Kumar Gala wrote:
> > > >> mem= command line option was being ignored in arch/powerpc if we
> > > >> were not
> > > >> a CONFIG_MULTIPLATFORM (which is handled via prom_init stub). The
> > > >> initial
> > > >> command line extraction and parsing needed to be moved earlier in
> > > >> the boot
> > > >> process and have code to actual parse mem= and do something about
> > > >> it.
> > > >>
> > > >> @@ -1004,6 +991,41 @@ static int __init early_init_dt_scan_cho
> > > >>                 crashk_res.end = crashk_res.start + *lprop - 1;
> > > >>  #endif
> > > >>
> > > >> +	/* Retreive command line */
> > > >> + 	p = of_get_flat_dt_prop(node, "bootargs", &l);
> > > >> +	if (p != NULL && l > 0)
> > > >> +		strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
> > > >> +
> > > >> +#ifdef CONFIG_CMDLINE
> > > >> +	if (l == 0 || (l == 1 && (*p) == 0))
> > > >> +		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> > > >> +#endif /* CONFIG_CMDLINE */
> > > >> +
> > > >> +	DBG("Command line is: %s\n", cmd_line);
> > > >> +
> > > >> +	if (strstr(cmd_line, "mem=")) {
> > > >> +		char *p, *q;
> > > >> +		unsigned long maxmem = 0;
> > > >> +
> > > >> +		for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) {
> > > >> +			q = p + 4;
> > > >> +			if (p > cmd_line && p[-1] != ' ')
> > > >> +				continue;
> > > >> +			maxmem = simple_strtoul(q, &q, 0);
> > > >> +			if (*q == 'k' || *q == 'K') {
> > > >> +				maxmem <<= 10;
> > > >> +				++q;
> > > >> +			} else if (*q == 'm' || *q == 'M') {
> > > >> +				maxmem <<= 20;
> > > >> +				++q;
> > > >> +			} else if (*q == 'g' || *q == 'G') {
> > > >> +				maxmem <<= 30;
> > > >> +				++q;
> > > >> +			}
> > > >> +		}
> > > >> +		memory_limit = maxmem;
> > > >> +	}
> > > >> +
> > > >
> > > > Why not make the mem= parsing an early_param() handler and then call
> > > > parse_early_param() here?
> > >
> > > This would put constraints on the early_param()'s that I dont think
> > > we should impose.
> >
> > All they should really be doing is parsing the string and setting some
> > variables, so that seems reasonable to me. Is there anything in
> > particular?
>
> If you ever had to do some memory allocation as part of the parsing that
> might be an issue, since we haven't setup the LMB at that point.

Sure, but I think it's reasonable to say "don't allocate memory in an 
early_param handler", it is an _early_ param after all. But I guess we'll 
have to agree to disagree until someone else chimes in with an opinion :)

cheers

-- 
Michael Ellerman
IBM OzLabs

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* [PATCH] processes stuck forever in __do_get_xsec
From: Olaf Hering @ 2006-02-25 10:27 UTC (permalink / raw)
  To: linuxppc-dev, Benjamin Herrenschmidt


64bit processes loop forever in __do_get_xsec, r8 is loaded, but r4 is compared.
Also, gdb doesnt understand __do_get_xsec and __get_datapage.

No idea if my change is correct.

(gdb) info registers
r0             0x1      1
r1             0xfffff8587c0    17592178018240
r2             0x40000661448    4398053200968
r3             0x102000 1056768
r4             0x4400116315df5  1196273318321653
r5             0x14cb69f61f48246        93650487927407174
r6             0x4400116315df2  1196273318321650
r7             0x3      3
r8             0x3644   13892
r9             0x4ae52fab6fd92  1317571323690386
r10            0x0      0
r11            0xfffff8588b0    17592178018480
r12            0x40000599648    4398052382280
r13            0x400000321c0    4398046716352
r14            0xfffff85c644    17592178034244
r15            0x400000c0de8    4398047301096
r16            0x67     103
r17            0x23     35
r18            0x338    824
r19            0x0      0
r20            0x4      4
r21            0x1017b350       269988688
r22            0x102604c0       270927040
r23            0xfffff858950    17592178018640
r24            0x101f35a0       270480800
r25            0x40000249598    4398048908696
r26            0xfffff85c5d0    17592178034128
r27            0x0      0
r28            0x40000223928    4398048753960
r29            0x35ac5  219845
r30            0x0      0
r31            0xfffff8588b0    17592178018480
pc             0x1005f4 1050100
cr             0x48022224       1208099364
lr             0x100464 1049700
ctr            0x100450 1049680
xer            0x0      0

(gdb) bt
#0  0x00000000001005f4 in __kernel_clock_getres ()
#1  0x0000000000100464 in __kernel_gettimeofday ()
#2  0x0000040000599648 in .__gettimeofday_internal () from /lib64/power5/libc.so.6
#3  0x00000400002acef4 in .rpmswNow () from /usr/lib64/librpmio-4.4.so
#4  0x00000400002acf74 in .rpmswExit () from /usr/lib64/librpmio-4.4.so
#5  0x000004000014f244 in .rpmdbAdd () from /usr/lib64/librpmdb-4.4.so
#6  0x0000040000072f80 in .rpmpsmStage () from /usr/lib64/librpm-4.4.so
#7  0x0000040000074254 in .rpmpsmStage () from /usr/lib64/librpm-4.4.so
#8  0x00000400000739ec in .rpmpsmStage () from /usr/lib64/librpm-4.4.so
#9  0x0000040000074254 in .rpmpsmStage () from /usr/lib64/librpm-4.4.so
#10 0x00000400000732d8 in .rpmpsmStage () from /usr/lib64/librpm-4.4.so
#11 0x000004000009fed4 in .rpmtsRun () from /usr/lib64/librpm-4.4.so
#12 0x0000040000089208 in .rpmInstall () from /usr/lib64/librpm-4.4.so
#13 0x0000000010004f30 in ?? ()
#14 0x220004224d502053 in ?? ()
#15 0x000004000003d010 in ?? () from /usr/lib64/librpm-4.4.so
#16 0x0000000000000000 in ?? ()

(gdb) disassemble __kernel_gettimeofday
Dump of assembler code for function __kernel_gettimeofday:
0x0000000000100450 <__kernel_gettimeofday+0>:   mflr    r12
0x0000000000100454 <__kernel_gettimeofday+4>:   mr      r11,r3
0x0000000000100458 <__kernel_gettimeofday+8>:   mr      r10,r4
0x000000000010045c <__kernel_gettimeofday+12>:  bl      0x10063c <__kernel_clock_getres+136>
0x0000000000100460 <__kernel_gettimeofday+16>:  bl      0x1005f4 <__kernel_clock_getres+64>
0x0000000000100464 <__kernel_gettimeofday+20>:  lis     r7,15
0x0000000000100468 <__kernel_gettimeofday+24>:  ori     r7,r7,16960
0x000000000010046c <__kernel_gettimeofday+28>:  rldicl  r5,r4,44,20
0x0000000000100470 <__kernel_gettimeofday+32>:  rldicr  r6,r5,20,43
0x0000000000100474 <__kernel_gettimeofday+36>:  std     r5,0(r11)
0x0000000000100478 <__kernel_gettimeofday+40>:  subf    r0,r6,r4
0x000000000010047c <__kernel_gettimeofday+44>:  mulld   r0,r0,r7
0x0000000000100480 <__kernel_gettimeofday+48>:  rldicl  r0,r0,44,20
0x0000000000100484 <__kernel_gettimeofday+52>:  cmpldi  r10,0
0x0000000000100488 <__kernel_gettimeofday+56>:  std     r0,8(r11)
0x000000000010048c <__kernel_gettimeofday+60>:  beq-    0x1004a0 <__kernel_gettimeofday+80>
0x0000000000100490 <__kernel_gettimeofday+64>:  lwz     r4,88(r3)
0x0000000000100494 <__kernel_gettimeofday+68>:  lwz     r5,92(r3)
0x0000000000100498 <__kernel_gettimeofday+72>:  stw     r4,0(r10)
0x000000000010049c <__kernel_gettimeofday+76>:  stw     r5,4(r10)
0x00000000001004a0 <__kernel_gettimeofday+80>:  mtlr    r12
0x00000000001004a4 <__kernel_gettimeofday+84>:  crclr   so
0x00000000001004a8 <__kernel_gettimeofday+88>:  li      r3,0
0x00000000001004ac <__kernel_gettimeofday+92>:  blr

(gdb) disassemble __kernel_clock_getres
Dump of assembler code for function __kernel_clock_getres:
0x00000000001005b4 <__kernel_clock_getres+0>:   cmpwi   r3,0
0x00000000001005b8 <__kernel_clock_getres+4>:   cmpwi   cr1,r3,1
0x00000000001005bc <__kernel_clock_getres+8>:   cror    eq,eq,4*cr1+eq
0x00000000001005c0 <__kernel_clock_getres+12>:  bne-    0x1005e8 <__kernel_clock_getres+52>
0x00000000001005c4 <__kernel_clock_getres+16>:  li      r3,0
0x00000000001005c8 <__kernel_clock_getres+20>:  cmplwi  r4,0
0x00000000001005cc <__kernel_clock_getres+24>:  crclr   so
0x00000000001005d0 <__kernel_clock_getres+28>:  beqlr   
0x00000000001005d4 <__kernel_clock_getres+32>:  lis     r5,152
0x00000000001005d8 <__kernel_clock_getres+36>:  ori     r5,r5,38528
0x00000000001005dc <__kernel_clock_getres+40>:  std     r3,0(r4)
0x00000000001005e0 <__kernel_clock_getres+44>:  std     r5,8(r4)
0x00000000001005e4 <__kernel_clock_getres+48>:  blr
0x00000000001005e8 <__kernel_clock_getres+52>:  li      r0,247
0x00000000001005ec <__kernel_clock_getres+56>:  sc      
0x00000000001005f0 <__kernel_clock_getres+60>:  blr
0x00000000001005f4 <__kernel_clock_getres+64>:  ld      r8,80(r3)
0x00000000001005f8 <__kernel_clock_getres+68>:  andi.   r0,r4,1
0x00000000001005fc <__kernel_clock_getres+72>:  bne-    0x1005f4 <__kernel_clock_getres+64>
0x0000000000100600 <__kernel_clock_getres+76>:  xor     r0,r4,r4
0x0000000000100604 <__kernel_clock_getres+80>:  add     r3,r3,r0
0x0000000000100608 <__kernel_clock_getres+84>:  mftb    r7
0x000000000010060c <__kernel_clock_getres+88>:  ld      r9,48(r3)
0x0000000000100610 <__kernel_clock_getres+92>:  subf    r7,r9,r7
0x0000000000100614 <__kernel_clock_getres+96>:  ld      r5,64(r3)
0x0000000000100618 <__kernel_clock_getres+100>: mulhdu  r7,r7,r5
0x000000000010061c <__kernel_clock_getres+104>: ld      r6,72(r3)
0x0000000000100620 <__kernel_clock_getres+108>: add     r4,r6,r7
0x0000000000100624 <__kernel_clock_getres+112>: xor     r0,r4,r4
0x0000000000100628 <__kernel_clock_getres+116>: add     r3,r3,r0
0x000000000010062c <__kernel_clock_getres+120>: ld      r0,80(r3)
0x0000000000100630 <__kernel_clock_getres+124>: cmpld   r0,r8
0x0000000000100634 <__kernel_clock_getres+128>: bne-    0x1005f4 <__kernel_clock_getres+64>
0x0000000000100638 <__kernel_clock_getres+132>: blr
0x000000000010063c <__kernel_clock_getres+136>: mflr    r0
0x0000000000100640 <__kernel_clock_getres+140>: bcl-    20,4*cr7+so,0x100648 <__kernel_datapage_offset+4>


Signed-off-by: Olaf Hering <olh@suse.de>

 arch/powerpc/kernel/vdso64/gettimeofday.S |    1 +
 1 files changed, 1 insertion(+)

Index: linux-2.6.16-rc4-olh/arch/powerpc/kernel/vdso64/gettimeofday.S
===================================================================
--- linux-2.6.16-rc4-olh.orig/arch/powerpc/kernel/vdso64/gettimeofday.S
+++ linux-2.6.16-rc4-olh/arch/powerpc/kernel/vdso64/gettimeofday.S
@@ -225,6 +225,7 @@ V_FUNCTION_BEGIN(__do_get_xsec)
   .cfi_startproc
 	/* check for update count & load values */
 1:	ld	r8,CFG_TB_UPDATE_COUNT(r3)
+	mr	r4,r8
 	andi.	r0,r4,1			/* pending update ? loop */
 	bne-	1b
 	xor	r0,r4,r4		/* create dependency */

^ permalink raw reply

* Data Cache Write-through
From: Sewook Wee @ 2006-02-25 10:44 UTC (permalink / raw)
  To: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 505 bytes --]

Hello all,

I am Sewook Wee at Stanford University.
For the research purpose, I am hacking the linux kernel (version 2.4.30) for
The PPC405 in Virtex II Pro Xilinx FPGA.
What I want to do is make Data Cache policy to be write-through, not
write-back.
I changed the DCWR Value in the arch/ppc/mm/44x_mmu.c, but seems it does not
work.

I hope some of you have decent idea to make it happen.

Thanks.

--
Sewook Wee
  weese@stanford.edu
  Computer System Laboratory
  Stanford University

[-- Attachment #2: Type: text/html, Size: 742 bytes --]

^ permalink raw reply

* Data Cache Write Through
From: Sewook Wee @ 2006-02-25 10:58 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 509 bytes --]

Hello all,

I am Sewook Wee at Stanford University.
For the research purpose, I am hacking the linux kernel (version 2.4.30) for
The PPC405 in Virtex II Pro Xilinx FPGA.
What I want to do is make Data Cache policy to be write-through, not
write-back.
I changed the DCWR Value in the arch/ppc/mm/44x_mmu.c, but seems it does not
work.

I hope some of you have decent idea to make it happen.

Thanks.



--
Sewook Wee
  weese@stanford.edu
  Computer System Laboratory
  Stanford University

[-- Attachment #2: Type: text/html, Size: 749 bytes --]

^ permalink raw reply

* [PATCH] powerpc: vdso 64bits gettimeofday bug
From: Benjamin Herrenschmidt @ 2006-02-25 21:09 UTC (permalink / raw)
  To: Andrew Morton, Linus Torvalds
  Cc: Greg KH, linuxppc-dev list, Olaf Hering, linuxppc64-dev,
	David Woodhouse

A bug in the assembly code of the vdso can cause gettimeofday() to hang
or to return incorrect results. The wrong register was used to test for
pending updates of the calibration variables and to create a dependency
for subsequent loads. This fixes it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

Might be worth applying to the stable series too and/or distro kernels
2.6.15 and later

--- linux-work.orig/arch/powerpc/kernel/vdso64/gettimeofday.S	2006-02-26 08:02:57.000000000 +1100
+++ linux-work/arch/powerpc/kernel/vdso64/gettimeofday.S	2006-02-26 08:04:23.000000000 +1100
@@ -225,9 +225,9 @@
   .cfi_startproc
 	/* check for update count & load values */
 1:	ld	r8,CFG_TB_UPDATE_COUNT(r3)
-	andi.	r0,r4,1			/* pending update ? loop */
+	andi.	r0,r8,1			/* pending update ? loop */
 	bne-	1b
-	xor	r0,r4,r4		/* create dependency */
+	xor	r0,r8,r8		/* create dependency */
 	add	r3,r3,r0
 
 	/* Get TB & offset it */

^ permalink raw reply

* Re: [PATCH] processes stuck forever in __do_get_xsec
From: Benjamin Herrenschmidt @ 2006-02-25 21:09 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linuxppc-dev
In-Reply-To: <20060225102730.GA17550@suse.de>

On Sat, 2006-02-25 at 11:27 +0100, Olaf Hering wrote:
> 64bit processes loop forever in __do_get_xsec, r8 is loaded, but r4 is compared.
> Also, gdb doesnt understand __do_get_xsec and __get_datapage.
> 
> No idea if my change is correct.

Good catch ! I send a better patch for it.

Ben.

^ permalink raw reply

* Re: [PATCH] ppc32: handle Book E debug exceptions on kernel stack
From: Paul Mackerras @ 2006-02-26  2:42 UTC (permalink / raw)
  To: Dale Farnsworth; +Cc: linuxppc-embedded, David Gibson
In-Reply-To: <20060224185251.GA9084@xyzzy.farnsworth.org>

Dale Farnsworth writes:

> There's a race between a critical exception and the normal exception
> entry path.  If a normal exception occurs in user mode and then a
> critical exception occurs before the normal exception handler has set
> r1 to the kernel stack area, we end up with r1 containing the user sp,
> though the critical exception occurred in kernel mode.

That's a separate problem from what we were discussing, which is why
program_check_exception is entered with interrupts disabled.

> I haven't yet come up with a way to detect this case and reliably use
> the kernel stack on a critical exception.

One way to solve this is to put the kernel stack pointer in some SPRGn
when exiting to usermode, and on critical exceptions, use that SPRGn
for the kernel stack if it is non-zero.  In the exception entry path
(for both normal and critical exceptions) put 0 in it once r1 has been
set up with a valid kernel stack pointer.  This also works if you have
to call firmware such as RTAS which runs in kernel mode but may put
arbitrary values in r1.

Paul.

^ permalink raw reply

* Re: [PPC,SOUND] Fix audio gpio state detection
From: Olaf Hering @ 2006-02-26 17:39 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: alsa-devel, Ben Collins, linuxppc-dev
In-Reply-To: <1139783738.5247.54.camel@localhost.localdomain>

 On Mon, Feb 13, Benjamin Herrenschmidt wrote:

> On Sat, 2006-02-11 at 17:10 +0100, Andreas Schwab wrote:
> > When booting with line out or headphone plugged, you won't hear anything.
> > The problem is that after reset all channels are muted, but the actual
> > value of the gpio port doesn't exactly match the active_val settings as
> > expected by check_audio_gpio.  For example, the line_mute port is set to
> > 7, but check_audio_gpio would expect 0xd or 0xf, thus its return value
> > indicates that it is not active, even though it is.  AFAICS only looking
> > at the low bit is enough to determine whether the port is active.
> > 
> > Signed-off-by: Andreas Schwab <schwab@suse.de>
> > 
> > Index: linux-2.6.16-rc2/sound/ppc/tumbler.c
> > ===================================================================
> > --- linux-2.6.16-rc2.orig/sound/ppc/tumbler.c	2006-02-03 19:43:50.000000000 +0100
> > +++ linux-2.6.16-rc2/sound/ppc/tumbler.c	2006-02-11 03:46:30.000000000 +0100
> > @@ -207,7 +207,7 @@ static int check_audio_gpio(struct pmac_
> >  
> >  	ret = do_gpio_read(gp);
> >  
> > -	return (ret & 0xd) == (gp->active_val & 0xd);
> > +	return (ret & 0x1) == (gp->active_val & 0x1);
> >  }
> >  
> >  static int read_audio_gpio(struct pmac_gpio *gp)

This (sort of) breaks PowerMac3,4 (69 (PowerMac G4 Silver)). I have to
force it on up to now, but with this patch the internal speaker will not
work with or without my patch to force it on.

I get these values:

check_audio_gpio gp c040fc14 addr 0000006f ret 00000007
check_audio_gpio gp c040fbfc addr 00000070 ret 00000004

With speakers plugged in, both give 0x07

/proc/device-tree/pci@f2000000/mac-io@17/gpio@50:
linux,device     cfdc7808
name             "gpio"
linux,phandle    ff90fcd0
reg              00000050 00000030
built-in        
device_type      "gpio"

/proc/device-tree/pci@f2000000/mac-io@17/gpio@50/extint-gpio16:
name             "extint-gpio16"
linux,phandle    ff910a00
interrupt-parent ff90fa80
interrupts       0000003e 00000000
AAPL,address     80000068
built-in        
one-wire-bus     "speaker-id"
AAPL,driver-name ".DallasDriver"
compatible       "keywest-gpio16"
device_type      "extint-gpio16"

/proc/device-tree/pci@f2000000/mac-io@17/gpio@50/extint-gpio15:
name             "extint-gpio15"
linux,phandle    ff9107f8
interrupt-parent ff90fa80
interrupts       0000003d 00000000
AAPL,address     80000067
built-in        
compatible       "keywest-gpio15"
device_type      "extint-gpio15"

/proc/device-tree/pci@f2000000/mac-io@17/gpio@50/gpio11:
name             "gpio11"
linux,phandle    ff9105f8
AAPL,address     80000075
built-in        
audio-gpio-active-state 00000000
audio-gpio       "audio-hw-reset"
compatible       "keywest-11"
device_type      "gpio11"

/proc/device-tree/pci@f2000000/mac-io@17/gpio@50/gpio6:
name             "gpio6"
linux,phandle    ff910400
AAPL,address     80000070
built-in        
audio-gpio-active-state 00000000
audio-gpio       "amp-mute"
compatible       "keywest-6"
device_type      "gpio6"

/proc/device-tree/pci@f2000000/mac-io@17/gpio@50/gpio5:
name             "gpio5"
linux,phandle    ff910208
AAPL,address     8000006f
built-in        
audio-gpio-active-state 00000000
audio-gpio       "headphone-mute"
compatible       "keywest-5"
device_type      "gpio5"

/proc/device-tree/pci@f2000000/mac-io@17/gpio@50/programmer-switch:
name             "programmer-switch"
linux,phandle    ff910058
interrupt-parent ff90fa80
interrupts       00000037 00000000
built-in        
device_type      "programmer-switch"

/proc/device-tree/pci@f2000000/mac-io@17/gpio@50/extint-gpio1:
name             "extint-gpio1"
linux,phandle    ff90fe38
AAPL,interrupt-priorities 00000001
interrupt-parent ff90fa80
interrupts       0000002f 00000001
built-in        
compatible       "keywest-gpio1"
device_type      "extint-gpio1"

^ permalink raw reply

* Re: [Alsa-devel] Re: [PPC,SOUND] Fix audio gpio state detection
From: Olaf Hering @ 2006-02-26 19:26 UTC (permalink / raw)
  To: Lee Revell; +Cc: linuxppc-dev, alsa-devel, Ben Collins
In-Reply-To: <1140981558.24141.112.camel@mindpipe>

 On Sun, Feb 26, Lee Revell wrote:

> Argh, /proc abuse... "historical reasons" presumably?

No, the way it works.

^ permalink raw reply

* Re: [Alsa-devel] Re: [PPC,SOUND] Fix audio gpio state detection
From: Lee Revell @ 2006-02-26 19:19 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linuxppc-dev, alsa-devel, Ben Collins
In-Reply-To: <20060226173908.GA4871@suse.de>

On Sun, 2006-02-26 at 18:39 +0100, Olaf Hering wrote:
> /proc/device-tree/pci@f2000000/mac-io@17/gpio@50:
> linux,device     cfdc7808
> name             "gpio"
> linux,phandle    ff90fcd0
> reg              00000050 00000030
> built-in        
> device_type      "gpio"
> 

Argh, /proc abuse... "historical reasons" presumably?

Lee

^ permalink raw reply

* Re: [PATCH] powerpc: Fix mem= cmdline handling on arch/powerpc for !MULTIPLATFORM
From: Dave Hansen @ 2006-02-26 20:38 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev, Linus Torvalds, linux-kernel
In-Reply-To: <Pine.LNX.4.44.0602241054090.2981-100000@gate.crashing.org>

On Fri, 2006-02-24 at 10:54 -0600, Kumar Gala wrote:
> +       if (strstr(cmd_line, "mem=")) {
> +               char *p, *q;
> +               unsigned long maxmem = 0;
> +
> +               for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) {
> +                       q = p + 4;
> +                       if (p > cmd_line && p[-1] != ' ')
> +                               continue;
> +                       maxmem = simple_strtoul(q, &q, 0);
> +                       if (*q == 'k' || *q == 'K') {
> +                               maxmem <<= 10;
> +                               ++q;
> +                       } else if (*q == 'm' || *q == 'M') {
> +                               maxmem <<= 20;
> +                               ++q;
> +                       } else if (*q == 'g' || *q == 'G') {
> +                               maxmem <<= 30;
> +                               ++q;
> +                       }
> +               }
> +               memory_limit = maxmem;
> +       } 

You may want to check out lib/cmdline.c's memparse() function.  I think
it does this for you.

-- Dave

^ permalink raw reply

* unsubscribe
From: shrisha.prasad @ 2006-02-27  4:10 UTC (permalink / raw)
  To: Linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: Type: text/html, Size: 0 bytes --]

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox