LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] Make lparcfg.c work when both iseries and pseries are selected
From: Nathan Lynch @ 2006-06-28  4:05 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: ppc-dev, paulus
In-Reply-To: <20060628115728.17f1a04d.sfr@canb.auug.org.au>

Stephen Rothwell wrote:
>  static ssize_t lparcfg_write(struct file *file, const char __user * buf,
>  			     size_t count, loff_t * off)
>  {
> +	ssize_t retval = -ENOMEM;
> +#ifdef CONFIG_PPC_PSERIES
>  	char *kbuf;
>  	char *tmp;
>  	u64 new_entitled, *new_entitled_ptr = &new_entitled;
> @@ -479,8 +476,6 @@ static ssize_t lparcfg_write(struct file
>  	unsigned long resource;
>  	u8 current_weight;
>  
> -	ssize_t retval = -ENOMEM;
> -
>  	kbuf = kmalloc(count, GFP_KERNEL);
>  	if (!kbuf)
>  		goto out;
> @@ -546,11 +541,10 @@ static ssize_t lparcfg_write(struct file
>  
>  out:
>  	kfree(kbuf);
> +#endif				/* CONFIG_PPC_PSERIES */
>  	return retval;
>  }

Erm... this is kind of gross, and will return -ENOMEM on iSeries when
it should really return -ENOSYS (I think).

Would it be over-engineering to have an lparcfg_ops struct, with
lparcfg_read and lparcfg_write methods (and the latter would be null
on iSeries)?  All the additional #ifdeffery doesn't really improve
the readability of this code IMO.

^ permalink raw reply

* Re: Using bestcomm in an external module (MPC5200B to be exact)
From: John Rigby @ 2006-06-28  4:08 UTC (permalink / raw)
  To: Sylvain Munaut; +Cc: linuxppc-embedded
In-Reply-To: <20060620211529.vjpk2lsxakn4088s@webmail.bluenox.com>

Yes I know its the work of many people,  calling it your was just an
abbreviation.

The latest ltib isn't based on your latest but then again your latest
was never public:).

So is your git tree uptodate?  If so then I will look at putting
together some patches to it.  I have an ata update and also an ac97
driver.  My goal is to have the best version in the public and ltib
just a copy of it.

On 6/20/06, Sylvain Munaut <tnt@246tnt.com> wrote:
>
> > -----Original Message-----
> > From: John Rigby [mailto:jcrigby@gmail.com]
> > Sent: Monday, June 19, 2006 2:33 PM
> > To: Trueskew
> > Cc: Andrey Volkov; linuxppc-embedded@ozlabs.org
> > Subject: Re: Using bestcomm in an external module (MPC5200B to be exact)
> >
> > The next LTIB bsp for 5200b will use the Sylvain's bestcomm api.
>
> Cool ;) But it's far from being my whole work. The foundation and a good
> cleanup pass comes from Dale and Andrey respectiverly.
>
> Be sure to use the latest one I sent you though ;p
> BTW, I guess that means your fine with my last modifications ?
>
>
>     Sylvain
>
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
>

^ permalink raw reply

* [PATCH] powerpc: Do a bit more cpu init cleanups (v2)
From: Olof Johansson @ 2006-06-28  4:38 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20060627192206.GB5130@pb15.lixom.net>

Cleanup CPU inits a bit more, Geoff Levand already did some earlier.

* Rename cpu_setup_power4.S to cpu_setup_ppc970.S
* Move CPU state save to cpu_setup, since cpu_setup is done
  on cpu 0 on 64-bit and save is never done more than once.
* Rename __restore_cpu_setup to __restore_cpu_ppc970 and add
  function pointers to the cputable to use instead. Powermac always
  has 970 so no need to check there.
* Rename __970_cpu_preinit to __cpu_preinit_ppc970 and check PVR before
  calling it instead of in it, it's too early to use cputable here.
* Rename pSeries_secondary_smp_init to generic_secondary_smp_init since
  everyone but powermac and iSeries use it.


Signed-off-by: Olof Johansson <olof@lixom.net>


Index: linux-2.6/arch/powerpc/kernel/Makefile
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/Makefile
+++ linux-2.6/arch/powerpc/kernel/Makefile
@@ -16,7 +16,7 @@ obj-y				:= semaphore.o cputable.o ptrac
 obj-y				+= vdso32/
 obj-$(CONFIG_PPC64)		+= setup_64.o binfmt_elf32.o sys_ppc32.o \
 				   signal_64.o ptrace32.o \
-				   paca.o cpu_setup_power4.o \
+				   paca.o cpu_setup_ppc970.o \
 				   firmware.o sysfs.o
 obj-$(CONFIG_PPC64)		+= vdso64/
 obj-$(CONFIG_ALTIVEC)		+= vecemu.o vector.o
Index: linux-2.6/arch/powerpc/kernel/cpu_setup_power4.S
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/cpu_setup_power4.S
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * This file contains low level CPU setup functions.
- *    Copyright (C) 2003 Benjamin Herrenschmidt (benh@kernel.crashing.org)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- *
- */
-
-#include <linux/config.h>
-#include <asm/processor.h>
-#include <asm/page.h>
-#include <asm/cputable.h>
-#include <asm/ppc_asm.h>
-#include <asm/asm-offsets.h>
-#include <asm/cache.h>
-
-_GLOBAL(__970_cpu_preinit)
-	/*
-	 * Do nothing if not running in HV mode
-	 */
-	mfmsr	r0
-	rldicl.	r0,r0,4,63
-	beqlr
-
-	/*
-	 * Deal only with PPC970 and PPC970FX.
-	 */
-	mfspr	r0,SPRN_PVR
-	srwi	r0,r0,16
-	cmpwi	r0,0x39
-	beq	1f
-	cmpwi	r0,0x3c
-	beq	1f
-	cmpwi	r0,0x44
-	bnelr
-1:
-
-	/* Make sure HID4:rm_ci is off before MMU is turned off, that large
-	 * pages are enabled with HID4:61 and clear HID5:DCBZ_size and
-	 * HID5:DCBZ32_ill
-	 */
-	li	r0,0
-	mfspr	r3,SPRN_HID4
-	rldimi	r3,r0,40,23	/* clear bit 23 (rm_ci) */
-	rldimi	r3,r0,2,61	/* clear bit 61 (lg_pg_en) */
-	sync
-	mtspr	SPRN_HID4,r3
-	isync
-	sync
-	mfspr	r3,SPRN_HID5
-	rldimi	r3,r0,6,56	/* clear bits 56 & 57 (DCBZ*) */
-	sync
-	mtspr	SPRN_HID5,r3
-	isync
-	sync
-
-	/* Setup some basic HID1 features */
-	mfspr	r0,SPRN_HID1
-	li	r3,0x1200		/* enable i-fetch cacheability */
-	sldi	r3,r3,44		/* and prefetch */
-	or	r0,r0,r3
-	mtspr	SPRN_HID1,r0
-	mtspr	SPRN_HID1,r0
-	isync
-
-	/* Clear HIOR */
-	li	r0,0
-	sync
-	mtspr	SPRN_HIOR,0		/* Clear interrupt prefix */
-	isync
-	blr
-
-_GLOBAL(__setup_cpu_ppc970)
-	mfspr	r0,SPRN_HID0
-	li	r11,5			/* clear DOZE and SLEEP */
-	rldimi	r0,r11,52,8		/* set NAP and DPM */
-	mtspr	SPRN_HID0,r0
-	mfspr	r0,SPRN_HID0
-	mfspr	r0,SPRN_HID0
-	mfspr	r0,SPRN_HID0
-	mfspr	r0,SPRN_HID0
-	mfspr	r0,SPRN_HID0
-	mfspr	r0,SPRN_HID0
-	sync
-	isync
-	blr
-
-/* Definitions for the table use to save CPU states */
-#define CS_HID0		0
-#define CS_HID1		8
-#define	CS_HID4		16
-#define CS_HID5		24
-#define CS_SIZE		32
-
-	.data
-	.balign	L1_CACHE_BYTES,0
-cpu_state_storage:
-	.space	CS_SIZE
-	.balign	L1_CACHE_BYTES,0
-	.text
-
-/* Called in normal context to backup CPU 0 state. This
- * does not include cache settings. This function is also
- * called for machine sleep. This does not include the MMU
- * setup, BATs, etc... but rather the "special" registers
- * like HID0, HID1, HID4, etc...
- */
-_GLOBAL(__save_cpu_setup)
-	/* Some CR fields are volatile, we back it up all */
-	mfcr	r7
-
-	/* Get storage ptr */
-	LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
-
-	/* We only deal with 970 for now */
-	mfspr	r0,SPRN_PVR
-	srwi	r0,r0,16
-	cmpwi	r0,0x39
-	beq	1f
-	cmpwi	r0,0x3c
-	beq	1f
-	cmpwi	r0,0x44
-	bne	2f
-
-1:	/* Save HID0,1,4 and 5 */
-	mfspr	r3,SPRN_HID0
-	std	r3,CS_HID0(r5)
-	mfspr	r3,SPRN_HID1
-	std	r3,CS_HID1(r5)
-	mfspr	r3,SPRN_HID4
-	std	r3,CS_HID4(r5)
-	mfspr	r3,SPRN_HID5
-	std	r3,CS_HID5(r5)
-
-2:
-	mtcr	r7
-	blr
-
-/* Called with no MMU context (typically MSR:IR/DR off) to
- * restore CPU state as backed up by the previous
- * function. This does not include cache setting
- */
-_GLOBAL(__restore_cpu_setup)
-	/* Get storage ptr (FIXME when using anton reloc as we
-	 * are running with translation disabled here
-	 */
-	LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
-
-	/* We only deal with 970 for now */
-	mfspr	r0,SPRN_PVR
-	srwi	r0,r0,16
-	cmpwi	r0,0x39
-	beq	1f
-	cmpwi	r0,0x3c
-	beq	1f
-	cmpwi	r0,0x44
-	bnelr
-
-1:	/* Before accessing memory, we make sure rm_ci is clear */
-	li	r0,0
-	mfspr	r3,SPRN_HID4
-	rldimi	r3,r0,40,23	/* clear bit 23 (rm_ci) */
-	sync
-	mtspr	SPRN_HID4,r3
-	isync
-	sync
-
-	/* Clear interrupt prefix */
-	li	r0,0
-	sync
-	mtspr	SPRN_HIOR,0
-	isync
-
-	/* Restore HID0 */
-	ld	r3,CS_HID0(r5)
-	sync
-	isync
-	mtspr	SPRN_HID0,r3
-	mfspr	r3,SPRN_HID0
-	mfspr	r3,SPRN_HID0
-	mfspr	r3,SPRN_HID0
-	mfspr	r3,SPRN_HID0
-	mfspr	r3,SPRN_HID0
-	mfspr	r3,SPRN_HID0
-	sync
-	isync
-
-	/* Restore HID1 */
-	ld	r3,CS_HID1(r5)
-	sync
-	isync
-	mtspr	SPRN_HID1,r3
-	mtspr	SPRN_HID1,r3
-	sync
-	isync
-
-	/* Restore HID4 */
-	ld	r3,CS_HID4(r5)
-	sync
-	isync
-	mtspr	SPRN_HID4,r3
-	sync
-	isync
-
-	/* Restore HID5 */
-	ld	r3,CS_HID5(r5)
-	sync
-	isync
-	mtspr	SPRN_HID5,r3
-	sync
-	isync
-	blr
-
Index: linux-2.6/arch/powerpc/kernel/cpu_setup_ppc970.S
===================================================================
--- /dev/null
+++ linux-2.6/arch/powerpc/kernel/cpu_setup_ppc970.S
@@ -0,0 +1,175 @@
+/*
+ * This file contains low level CPU setup functions.
+ *    Copyright (C) 2003 Benjamin Herrenschmidt (benh@kernel.crashing.org)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ */
+
+#include <linux/config.h>
+#include <asm/processor.h>
+#include <asm/page.h>
+#include <asm/cputable.h>
+#include <asm/ppc_asm.h>
+#include <asm/asm-offsets.h>
+#include <asm/cache.h>
+
+_GLOBAL(__cpu_preinit_ppc970)
+	/* Do nothing if not running in HV mode */
+	mfmsr	r0
+	rldicl.	r0,r0,4,63
+	beqlr
+
+	/* Make sure HID4:rm_ci is off before MMU is turned off, that large
+	 * pages are enabled with HID4:61 and clear HID5:DCBZ_size and
+	 * HID5:DCBZ32_ill
+	 */
+	li	r0,0
+	mfspr	r3,SPRN_HID4
+	rldimi	r3,r0,40,23	/* clear bit 23 (rm_ci) */
+	rldimi	r3,r0,2,61	/* clear bit 61 (lg_pg_en) */
+	sync
+	mtspr	SPRN_HID4,r3
+	isync
+	sync
+	mfspr	r3,SPRN_HID5
+	rldimi	r3,r0,6,56	/* clear bits 56 & 57 (DCBZ*) */
+	sync
+	mtspr	SPRN_HID5,r3
+	isync
+	sync
+
+	/* Setup some basic HID1 features */
+	mfspr	r0,SPRN_HID1
+	li	r3,0x1200		/* enable i-fetch cacheability */
+	sldi	r3,r3,44		/* and prefetch */
+	or	r0,r0,r3
+	mtspr	SPRN_HID1,r0
+	mtspr	SPRN_HID1,r0
+	isync
+
+	/* Clear HIOR */
+	li	r0,0
+	sync
+	mtspr	SPRN_HIOR,0		/* Clear interrupt prefix */
+	isync
+	blr
+
+/* Definitions for the table use to save CPU states */
+#define CS_HID0		0
+#define CS_HID1		8
+#define	CS_HID4		16
+#define CS_HID5		24
+#define CS_SIZE		32
+
+	.data
+	.balign	L1_CACHE_BYTES,0
+cpu_state_storage:
+	.space	CS_SIZE
+	.balign	L1_CACHE_BYTES,0
+	.text
+
+
+_GLOBAL(__setup_cpu_ppc970)
+	/* Do nothing if not running in HV mode */
+	mfmsr	r0
+	rldicl.	r0,r0,4,63
+	beqlr
+
+	mfspr	r0,SPRN_HID0
+	li	r11,5			/* clear DOZE and SLEEP */
+	rldimi	r0,r11,52,8		/* set NAP and DPM */
+	mtspr	SPRN_HID0,r0
+	mfspr	r0,SPRN_HID0
+	mfspr	r0,SPRN_HID0
+	mfspr	r0,SPRN_HID0
+	mfspr	r0,SPRN_HID0
+	mfspr	r0,SPRN_HID0
+	mfspr	r0,SPRN_HID0
+	sync
+	isync
+
+	/* Save away cpu state */
+	LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
+
+	/* Save HID0,1,4 and 5 */
+	mfspr	r3,SPRN_HID0
+	std	r3,CS_HID0(r5)
+	mfspr	r3,SPRN_HID1
+	std	r3,CS_HID1(r5)
+	mfspr	r3,SPRN_HID4
+	std	r3,CS_HID4(r5)
+	mfspr	r3,SPRN_HID5
+	std	r3,CS_HID5(r5)
+
+	blr
+
+/* Called with no MMU context (typically MSR:IR/DR off) to
+ * restore CPU state as backed up by the previous
+ * function. This does not include cache setting
+ */
+_GLOBAL(__restore_cpu_ppc970)
+	/* Do nothing if not running in HV mode */
+	mfmsr	r0
+	rldicl.	r0,r0,4,63
+	beqlr
+
+	LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
+	/* Before accessing memory, we make sure rm_ci is clear */
+	li	r0,0
+	mfspr	r3,SPRN_HID4
+	rldimi	r3,r0,40,23	/* clear bit 23 (rm_ci) */
+	sync
+	mtspr	SPRN_HID4,r3
+	isync
+	sync
+
+	/* Clear interrupt prefix */
+	li	r0,0
+	sync
+	mtspr	SPRN_HIOR,0
+	isync
+
+	/* Restore HID0 */
+	ld	r3,CS_HID0(r5)
+	sync
+	isync
+	mtspr	SPRN_HID0,r3
+	mfspr	r3,SPRN_HID0
+	mfspr	r3,SPRN_HID0
+	mfspr	r3,SPRN_HID0
+	mfspr	r3,SPRN_HID0
+	mfspr	r3,SPRN_HID0
+	mfspr	r3,SPRN_HID0
+	sync
+	isync
+
+	/* Restore HID1 */
+	ld	r3,CS_HID1(r5)
+	sync
+	isync
+	mtspr	SPRN_HID1,r3
+	mtspr	SPRN_HID1,r3
+	sync
+	isync
+
+	/* Restore HID4 */
+	ld	r3,CS_HID4(r5)
+	sync
+	isync
+	mtspr	SPRN_HID4,r3
+	sync
+	isync
+
+	/* Restore HID5 */
+	ld	r3,CS_HID5(r5)
+	sync
+	isync
+	mtspr	SPRN_HID5,r3
+	sync
+	isync
+	blr
+
Index: linux-2.6/arch/powerpc/kernel/head_64.S
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/head_64.S
+++ linux-2.6/arch/powerpc/kernel/head_64.S
@@ -152,7 +152,7 @@ _GLOBAL(__secondary_hold)
 	bne	100b
 
 #if defined(CONFIG_SMP) || defined(CONFIG_KEXEC)
-	LOAD_REG_IMMEDIATE(r4, .pSeries_secondary_smp_init)
+	LOAD_REG_IMMEDIATE(r4, .generic_secondary_smp_init)
 	mtctr	r4
 	mr	r3,r24
 	bctr
@@ -1473,18 +1473,25 @@ fwnmi_data_area:
         . = 0x8000
 
 /*
- * On pSeries, secondary processors spin in the following code.
+ * On pSeries and most other platforms, secondary processors spin
+ * in the following code.
  * At entry, r3 = this processor's number (physical cpu id)
  */
-_GLOBAL(pSeries_secondary_smp_init)
+_GLOBAL(generic_secondary_smp_init)
 	mr	r24,r3
 	
 	/* turn on 64-bit mode */
 	bl	.enable_64b_mode
 	isync
 
-	/* Copy some CPU settings from CPU 0 */
-	bl	.__restore_cpu_setup
+	LOAD_REG_IMMEDIATE(r4, cur_cpu_spec)
+	ld	r5, CPU_SPEC_RESTORE(r4)
+	cmpdi	0,r5,0
+	beq	1f
+	ld	r5,0(r5)
+	mtctr	r5
+	bctrl
+1:
 
 	/* Set up a paca value for this processor. Since we have the
 	 * physical cpu id in r24, we need to search the pacas to find
@@ -1600,7 +1607,16 @@ _GLOBAL(__start_initialization_multiplat
 	bl	.enable_64b_mode
 
 	/* Setup some critical 970 SPRs before switching MMU off */
-	bl	.__970_cpu_preinit
+	mfspr	r0,SPRN_PVR
+	srwi	r0,r0,16
+	cmpwi	r0,0x39		/* 970 */
+	beq	1f
+	cmpwi	r0,0x3c		/* 970FX */
+	beq	1f
+	cmpwi	r0,0x44		/* 970MP */
+	bne	2f
+1:	bl	.__cpu_preinit_ppc970
+2:
 
 	/* cpu # */
 	li	r24,0
@@ -1771,7 +1787,7 @@ _GLOBAL(pmac_secondary_start)
 	isync
 
 	/* Copy some CPU settings from CPU 0 */
-	bl	.__restore_cpu_setup
+	bl	.__restore_cpu_ppc970
 
 	/* pSeries do that early though I don't think we really need it */
 	mfmsr	r3
@@ -1921,12 +1937,6 @@ _STATIC(start_here_multiplatform)
 	mr	r5,r26
 	bl	.identify_cpu
 
-	/* Save some low level config HIDs of CPU0 to be copied to
-	 * other CPUs later on, or used for suspend/resume
-	 */
-	bl	.__save_cpu_setup
-	sync
-
 	/* Do very early kernel initializations, including initial hash table,
 	 * stab and slb setup before we turn on relocation.	*/
 
Index: linux-2.6/arch/powerpc/platforms/cell/smp.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/smp.c
+++ linux-2.6/arch/powerpc/platforms/cell/smp.c
@@ -58,7 +58,7 @@
  */
 static cpumask_t of_spin_map;
 
-extern void pSeries_secondary_smp_init(unsigned long);
+extern void generic_secondary_smp_init(unsigned long);
 
 /**
  * smp_startup_cpu() - start the given cpu
@@ -75,7 +75,7 @@ static inline int __devinit smp_startup_
 {
 	int status;
 	unsigned long start_here = __pa((u32)*((unsigned long *)
-					       pSeries_secondary_smp_init));
+					       generic_secondary_smp_init));
 	unsigned int pcpu;
 	int start_cpu;
 
Index: linux-2.6/arch/powerpc/platforms/pseries/smp.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/pseries/smp.c
+++ linux-2.6/arch/powerpc/platforms/pseries/smp.c
@@ -63,7 +63,7 @@
  */
 static cpumask_t of_spin_map;
 
-extern void pSeries_secondary_smp_init(unsigned long);
+extern void generic_secondary_smp_init(unsigned long);
 
 #ifdef CONFIG_HOTPLUG_CPU
 
@@ -271,7 +271,7 @@ static inline int __devinit smp_startup_
 {
 	int status;
 	unsigned long start_here = __pa((u32)*((unsigned long *)
-					       pSeries_secondary_smp_init));
+					       generic_secondary_smp_init));
 	unsigned int pcpu;
 	int start_cpu;
 
Index: linux-2.6/arch/powerpc/kernel/asm-offsets.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/asm-offsets.c
+++ linux-2.6/arch/powerpc/kernel/asm-offsets.c
@@ -241,6 +241,7 @@ int main(void)
 	DEFINE(CPU_SPEC_PVR_VALUE, offsetof(struct cpu_spec, pvr_value));
 	DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features));
 	DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup));
+	DEFINE(CPU_SPEC_RESTORE, offsetof(struct cpu_spec, cpu_restore));
 
 #ifndef CONFIG_PPC64
 	DEFINE(pbe_address, offsetof(struct pbe, address));
Index: linux-2.6/arch/powerpc/kernel/cputable.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/cputable.c
+++ linux-2.6/arch/powerpc/kernel/cputable.c
@@ -40,7 +40,10 @@ extern void __setup_cpu_7400(unsigned lo
 extern void __setup_cpu_7410(unsigned long offset, struct cpu_spec* spec);
 extern void __setup_cpu_745x(unsigned long offset, struct cpu_spec* spec);
 #endif /* CONFIG_PPC32 */
+#ifdef CONFIG_PPC64
 extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec);
+extern void __restore_cpu_ppc970(void);
+#endif /* CONFIG_PPC64 */
 
 /* This table only contains "desktop" CPUs, it need to be filled with embedded
  * ones as well...
@@ -185,6 +188,7 @@ struct cpu_spec	cpu_specs[] = {
 		.dcache_bsize		= 128,
 		.num_pmcs		= 8,
 		.cpu_setup		= __setup_cpu_ppc970,
+		.cpu_restore		= __restore_cpu_ppc970,
 		.oprofile_cpu_type	= "ppc64/970",
 		.oprofile_type		= PPC_OPROFILE_POWER4,
 		.platform		= "ppc970",
@@ -200,6 +204,7 @@ struct cpu_spec	cpu_specs[] = {
 		.dcache_bsize		= 128,
 		.num_pmcs		= 8,
 		.cpu_setup		= __setup_cpu_ppc970,
+		.cpu_restore		= __restore_cpu_ppc970,
 		.oprofile_cpu_type	= "ppc64/970",
 		.oprofile_type		= PPC_OPROFILE_POWER4,
 		.platform		= "ppc970",
@@ -215,6 +220,7 @@ struct cpu_spec	cpu_specs[] = {
 		.dcache_bsize		= 128,
 		.num_pmcs		= 8,
 		.cpu_setup		= __setup_cpu_ppc970,
+		.cpu_restore		= __restore_cpu_ppc970,
 		.oprofile_cpu_type	= "ppc64/970",
 		.oprofile_type		= PPC_OPROFILE_POWER4,
 		.platform		= "ppc970",
Index: linux-2.6/include/asm-powerpc/cputable.h
===================================================================
--- linux-2.6.orig/include/asm-powerpc/cputable.h
+++ linux-2.6/include/asm-powerpc/cputable.h
@@ -65,6 +65,8 @@ struct cpu_spec {
 	 * BHT, SPD, etc... from head.S before branching to identify_machine
 	 */
 	cpu_setup_t	cpu_setup;
+	/* Used to restore cpu setup on secondary processors and at resume */
+	void		(*cpu_restore)(void);
 
 	/* Used by oprofile userspace to select the right counters */
 	char		*oprofile_cpu_type;

^ permalink raw reply

* Re: [PATCH] powerpc: support ibm,extended-*-frequency properties
From: Kumar Gala @ 2006-06-28  4:48 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: linuxppc-dev, paulus
In-Reply-To: <20060620084726.GC30974@krispykreme>


On Jun 20, 2006, at 3:47 AM, Anton Blanchard wrote:

>
> Support the ibm,extended-*-frequency properties found in recent POWER5
> firmware:
>
> cpus/PowerPC,POWER5@0/clock-frequency
>                  59aa5880 (1504336000)
> cpus/PowerPC,POWER5@0/ibm,extended-clock-frequency
>                  00000000 59aa5880
> cpus/PowerPC,POWER5@0/timebase-frequency
>                  0b354b10 (188042000)
> cpus/PowerPC,POWER5@0/ibm,extended-timebase-frequency
>                  00000000 0b354b10
>
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
>
> Index: build/arch/powerpc/kernel/time.c
> ===================================================================
> --- build.orig/arch/powerpc/kernel/time.c	2006-06-20  
> 11:55:34.000000000 +1000
> +++ build/arch/powerpc/kernel/time.c	2006-06-20 18:25:35.000000000  
> +1000
> @@ -857,42 +857,50 @@ int do_settimeofday(struct timespec *tv)
>
>  EXPORT_SYMBOL(do_settimeofday);
>
> -void __init generic_calibrate_decr(void)
> +static int __init get_freq(char *name, int cells, unsigned long *val)
>  {
>  	struct device_node *cpu;
>  	unsigned int *fp;
> -	int node_found;
> +	int found = 0;
>
> -	/*
> -	 * The cpu node should have a timebase-frequency property
> -	 * to tell us the rate at which the decrementer counts.
> -	 */
> +	/* The cpu node should have timebase and clock frequency  
> properties */
>  	cpu = of_find_node_by_type(NULL, "cpu");
>
> -	ppc_tb_freq = DEFAULT_TB_FREQ;		/* hardcoded default */
> -	node_found = 0;
>  	if (cpu) {
> -		fp = (unsigned int *)get_property(cpu, "timebase-frequency",
> -						  NULL);
> +		fp = (unsigned int *)get_property(cpu, name, NULL);
>  		if (fp) {
> -			node_found = 1;
> -			ppc_tb_freq = *fp;
> +			found = 1;
> +			*val = 0;
> +			while (cells--)
> +				*val = (*val << 32) | *fp++;

Is it reasonable for cells to be greater than 1 on a 32-bit system?   
If not, ok to protect this with a CONFIG_PPC64

>  		}
> +
> +		of_node_put(cpu);
>  	}
> -	if (!node_found)
> +
> +	return found;
> +}
> +
> +void __init generic_calibrate_decr(void)
> +{
> +	ppc_tb_freq = DEFAULT_TB_FREQ;		/* hardcoded default */
> +
> +	if (!get_freq("ibm,extended-timebase-frequency", 2, &ppc_tb_freq) &&
> +	    !get_freq("timebase-frequency", 1, &ppc_tb_freq)) {
> +
>  		printk(KERN_ERR "WARNING: Estimating decrementer frequency "
>  				"(not found)\n");
> +	}
>
> -	ppc_proc_freq = DEFAULT_PROC_FREQ;
> -	node_found = 0;
> -	if (cpu) {
> -		fp = (unsigned int *)get_property(cpu, "clock-frequency",
> -						  NULL);
> -		if (fp) {
> -			node_found = 1;
> -			ppc_proc_freq = *fp;
> -		}
> +	ppc_proc_freq = DEFAULT_PROC_FREQ;	/* hardcoded default */
> +
> +	if (!get_freq("ibm,extended-clock-frequency", 2, &ppc_proc_freq) &&
> +	    !get_freq("clock-frequency", 1, &ppc_proc_freq)) {
> +
> +		printk(KERN_ERR "WARNING: Estimating processor frequency "
> +				"(not found)\n");
>  	}
> +
>  #ifdef CONFIG_BOOKE
>  	/* Set the time base to zero */
>  	mtspr(SPRN_TBWL, 0);
> @@ -904,11 +912,6 @@ void __init generic_calibrate_decr(void)
>  	/* Enable decrementer interrupt */
>  	mtspr(SPRN_TCR, TCR_DIE);
>  #endif
> -	if (!node_found)
> -		printk(KERN_ERR "WARNING: Estimating processor frequency "
> -				"(not found)\n");
> -
> -	of_node_put(cpu);
>  }
>
>  unsigned long get_boot_time(void)
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

^ permalink raw reply

* RE: MPC8548 PCIe / PCI support with BSP MPC8548CDS 02/24/2006
From: Zhang Wei-r63237 @ 2006-06-28  5:27 UTC (permalink / raw)
  To: Florian Boelstler, linuxppc-embedded

> We did the hardware fix described in the BSP user's manual to 
> make PCIe work (according to the manual section 2.1, step 3).
> I.e.
>   1) removed R193 and R194 on the carrier card (rev 1.2)
>   2) removed RN1 on the CPU daughter card
>   2a) connected pad3 of RN1 to pin3 of U12 (IRQ0)
>   2b) connected pad2 of RN1 to pin4 of U12 (IRQ1)
> 
> Does this fix the interrupt polarity problem (as well)?

Yes, I think so. You can plug a PCIe ethernet card to test it. 

> 
> We applied the provided kernel patch as well.
> IMHO that patch just moves the local PCIe root-complex 
> "out-of-space" so no detection of that one occurs any more.
> This is what actually happens when "lspci" is run.
> 
> However we still don't see any devices behind the PCIe switch 
> (e.g. a transparent PLX8516). It seems that the enumeration 
> process (traversing through the bus hierarchy) in the kernel 
> is somehow disabled.

:-), Maybe it's need more study. Could you enable the DEBUG and post the kernel verbose message?

> Bottom line: Only one device accessible at all on the PCIe port.
> 
> Any further ideas?
> 
> Thanks,
> 
>    Florian
> 
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
> 

^ permalink raw reply

* patches applied to powerpc.git
From: Paul Mackerras @ 2006-06-28  5:35 UTC (permalink / raw)
  To: linuxppc-dev

The following patches have just been pushed to the powerpc.git
repository ("master" branch).  I'll ask Linus to pull them tomorrow
unless I hear any objections.  If you have patches that you want
upstream that aren't listed, bug me or the appropriate platform
maintainer about them.

Paul.

 arch/powerpc/Kconfig                       |    8 +
 arch/powerpc/Kconfig.debug                 |    9 +
 arch/powerpc/configs/cell_defconfig        |    7 +
 arch/powerpc/kernel/Makefile               |    3 
 arch/powerpc/kernel/cpu_setup_power4.S     |   14 ++
 arch/powerpc/kernel/crash.c                |  147 +++++++++++++++---
 arch/powerpc/kernel/head_64.S              |   51 ++----
 arch/powerpc/kernel/iommu.c                |   30 ++++
 arch/powerpc/kernel/machine_kexec_64.c     |    4 -
 arch/powerpc/kernel/misc.S                 |  203 +++++++++++++++++++++++++
 arch/powerpc/kernel/misc_32.S              |  156 --------------------
 arch/powerpc/kernel/misc_64.S              |  223 +---------------------------
 arch/powerpc/kernel/paca.c                 |    1 
 arch/powerpc/kernel/prom.c                 |   48 ++++--
 arch/powerpc/kernel/rtas.c                 |  119 +++++++++++++--
 arch/powerpc/kernel/setup_64.c             |   19 +-
 arch/powerpc/kernel/traps.c                |   27 ++-
 arch/powerpc/kernel/udbg.c                 |    7 +
 arch/powerpc/mm/hash_native_64.c           |    3 
 arch/powerpc/mm/hash_utils_64.c            |  106 +++++--------
 arch/powerpc/platforms/86xx/Kconfig        |    6 -
 arch/powerpc/platforms/86xx/Makefile       |    3 
 arch/powerpc/platforms/86xx/mpc8641_hpcn.h |    1 
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    1 
 arch/powerpc/platforms/86xx/mpc86xx_smp.c  |    1 
 arch/powerpc/platforms/86xx/pci.c          |    1 
 arch/powerpc/platforms/cell/Kconfig        |    2 
 arch/powerpc/platforms/cell/setup.c        |   16 +-
 arch/powerpc/platforms/cell/spu_base.c     |    8 +
 arch/powerpc/platforms/cell/spufs/file.c   |   10 +
 arch/powerpc/platforms/cell/spufs/switch.c |    6 +
 arch/powerpc/platforms/iseries/htab.c      |    4 -
 arch/powerpc/platforms/iseries/lpevents.c  |   55 ++++---
 arch/powerpc/platforms/iseries/proc.c      |    1 
 arch/powerpc/platforms/iseries/setup.c     |   19 --
 arch/powerpc/platforms/maple/setup.c       |    7 -
 arch/powerpc/platforms/powermac/setup.c    |    9 -
 arch/powerpc/platforms/pseries/iommu.c     |   33 ++++
 arch/powerpc/platforms/pseries/lpar.c      |    4 -
 arch/powerpc/platforms/pseries/setup.c     |   10 +
 drivers/ide/Kconfig                        |    9 +
 drivers/ide/ppc/pmac.c                     |  125 ----------------
 drivers/macintosh/Kconfig                  |   12 ++
 drivers/macintosh/Makefile                 |    1 
 drivers/macintosh/via-pmu-led.c            |  144 ++++++++++++++++++
 include/asm-powerpc/cputable.h             |   48 +++---
 include/asm-powerpc/iseries/it_lp_queue.h  |   40 +++--
 include/asm-powerpc/kdump.h                |    2 
 include/asm-powerpc/kexec.h                |    9 +
 include/asm-powerpc/machdep.h              |    2 
 include/asm-powerpc/mmu.h                  |    1 
 include/asm-powerpc/mpc86xx.h              |    1 
 include/asm-powerpc/rtas.h                 |    3 
 include/asm-powerpc/time.h                 |    6 +
 include/asm-powerpc/udbg.h                 |    3 
 kernel/kexec.c                             |    6 -
 56 files changed, 936 insertions(+), 858 deletions(-)
 create mode 100644 arch/powerpc/kernel/misc.S
 create mode 100644 drivers/macintosh/via-pmu-led.c

Andrew Morton:
      [POWERPC] powerpc: kconfig warning fix

Arnd Bergmann:
      [POWERPC] spufs: fix class0 interrupt assignment

Benjamin Herrenschmidt:
      [POWERPC] spufs: map mmio space as guarded into user space
      [POWERPC] spufs: fix MFC command queue purge

David Wilder:
      [POWERPC] Add the use of the firmware soft-reset-nmi to kdump.

Geoff Levand:
      [POWERPC] spufs: fix memory hotplug dependency

Haren Myneni:
      [POWERPC] kdump: Reserve the existing TCE mappings left by the first kernel

Jimi Xenidis:
      [POWERPC] Don't access HID registers if running on a Hypervisor.
      [POWERPC] Skip the "copy down" of the kernel if it is already at zero.

Johannes Berg:
      [POWERPC] Convert powermac ide blink to new led infrastructure

Jon Loeliger:
      [POWERPC] Remove redundant PPC_86XX check.
      [POWERPC] Move I8259 selection under MPC8641HPCN board
      [POWERPC] Remove redundant STD_MMU selection.
      [POWERPC] Remove obsolete #include <linux/config.h>.

Michael Ellerman:
      [POWERPC] Remove remaining iSeries debugger cruft
      [POWERPC] Export flat device tree via debugfs for debugging
      [POWERPC] powerpc: Initialise ppc_md htab pointers earlier
      [POWERPC] Use ppc_md.hpte_insert() in htab_bolt_mapping()
      [POWERPC] Make kexec_setup() a regular initcall
      [POWERPC] Setup the boot cpu's paca pointer in C rather than asm
      [POWERPC] Make rtas_call() safe if RTAS hasn't been initialised
      [POWERPC] Move RTAS exports next to their declarations
      [POWERPC] Setup RTAS values earlier, to enable rtas_call() earlier
      [POWERPC] Add udbg support for RTAS console
      [POWERPC] Enable the RTAS udbg console on IBM Cell Blade
      [POWERPC] Enable XMON in cell_defconfig

Paul Mackerras:
      [POWERPC] Simplify the code defining the 64-bit CPU features
      [POWERPC] Make sure we select CONFIG_NEW_LEDS if ADB_PMU_LED is set

Stephen Rothwell:
      [POWERPC] Clean up it_lp_queue.h
      [POWERPC] update asm-powerpc/time.h
      [POWERPC] Remove unused function call_with_mmu_off
      [POWERPC] Consolidate some of kernel/misc*.S

^ permalink raw reply

* Please pull from 'for_paulus' branch of powerpc
From: Kumar Gala @ 2006-06-28  6:01 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, linux-kernel

Please pull from 'for_paulus' branch of
master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git

to receive the following updates:

 arch/powerpc/kernel/cputable.c             |   12 --
 arch/powerpc/platforms/86xx/mpc86xx.h      |    8 +
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |  128 +++++++++++++++++++++++++--
 arch/powerpc/platforms/86xx/mpc86xx_smp.c  |    9 -
 arch/powerpc/platforms/86xx/pci.c          |  136 +----------------------------
 include/asm-powerpc/mpc86xx.h              |    4 
 6 files changed, 138 insertions(+), 159 deletions(-)

Kumar Gala:
      powerpc: minor cleanups for mpc86xx

diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 1c11488..abf7d42 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -722,18 +722,6 @@ #if CLASSIC_PPC
 		.oprofile_type		= PPC_OPROFILE_G4,
 		.platform		= "ppc7450",
 	},
-        {       /* 8641 */
-               .pvr_mask               = 0xffffffff,
-               .pvr_value              = 0x80040010,
-               .cpu_name               = "8641",
-               .cpu_features           = CPU_FTRS_7447A,
-               .cpu_user_features      = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP,
-               .icache_bsize           = 32,
-               .dcache_bsize           = 32,
-               .num_pmcs               = 6,
-               .cpu_setup              = __setup_cpu_745x
-        },
-
 	{	/* 82xx (8240, 8245, 8260 are all 603e cores) */
 		.pvr_mask		= 0x7fff0000,
 		.pvr_value		= 0x00810000,
diff --git a/arch/powerpc/platforms/86xx/mpc86xx.h b/arch/powerpc/platforms/86xx/mpc86xx.h
index e3c9e4f..2834462 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx.h
+++ b/arch/powerpc/platforms/86xx/mpc86xx.h
@@ -15,11 +15,13 @@ #define __MPC86XX_H__
  * mpc86xx_* files. Mostly for use by mpc86xx_setup().
  */
 
-extern int __init add_bridge(struct device_node *dev);
+extern int add_bridge(struct device_node *dev);
 
-extern void __init setup_indirect_pcie(struct pci_controller *hose,
+extern int mpc86xx_exclude_device(u_char bus, u_char devfn);
+
+extern void setup_indirect_pcie(struct pci_controller *hose,
 				       u32 cfg_addr, u32 cfg_data);
-extern void __init setup_indirect_pcie_nomap(struct pci_controller *hose,
+extern void setup_indirect_pcie_nomap(struct pci_controller *hose,
 					     void __iomem *cfg_addr,
 					     void __iomem *cfg_data);
 
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 483c21d..ac7f418 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -36,6 +36,7 @@ #include <asm/mpic.h>
 #include <sysdev/fsl_soc.h>
 
 #include "mpc86xx.h"
+#include "mpc8641_hpcn.h"
 
 #ifndef CONFIG_PCI
 unsigned long isa_io_base = 0;
@@ -186,17 +187,130 @@ mpc86xx_map_irq(struct pci_dev *dev, uns
 	return PCI_IRQ_TABLE_LOOKUP + I8259_OFFSET;
 }
 
+static void __devinit quirk_ali1575(struct pci_dev *dev)
+{
+	unsigned short temp;
+
+	/*
+	 * ALI1575 interrupts route table setup:
+	 *
+	 * IRQ pin   IRQ#
+	 * PIRQA ---- 3
+	 * PIRQB ---- 4
+	 * PIRQC ---- 5
+	 * PIRQD ---- 6
+	 * PIRQE ---- 9
+	 * PIRQF ---- 10
+	 * PIRQG ---- 11
+	 * PIRQH ---- 12
+	 *
+	 * interrupts for PCI slot0 -- PIRQA / PIRQB / PIRQC / PIRQD
+	 *                PCI slot1 -- PIRQB / PIRQC / PIRQD / PIRQA
+	 */
+	pci_write_config_dword(dev, 0x48, 0xb9317542);
+
+	/* USB 1.1 OHCI controller 1, interrupt: PIRQE */
+	pci_write_config_byte(dev, 0x86, 0x0c);
+
+	/* USB 1.1 OHCI controller 2, interrupt: PIRQF */
+	pci_write_config_byte(dev, 0x87, 0x0d);
+
+	/* USB 1.1 OHCI controller 3, interrupt: PIRQH */
+	pci_write_config_byte(dev, 0x88, 0x0f);
+
+	/* USB 2.0 controller, interrupt: PIRQ7 */
+	pci_write_config_byte(dev, 0x74, 0x06);
+
+	/* Audio controller, interrupt: PIRQE */
+	pci_write_config_byte(dev, 0x8a, 0x0c);
+
+	/* Modem controller, interrupt: PIRQF */
+	pci_write_config_byte(dev, 0x8b, 0x0d);
+
+	/* HD audio controller, interrupt: PIRQG */
+	pci_write_config_byte(dev, 0x8c, 0x0e);
+
+	/* Serial ATA interrupt: PIRQD */
+	pci_write_config_byte(dev, 0x8d, 0x0b);
+
+	/* SMB interrupt: PIRQH */
+	pci_write_config_byte(dev, 0x8e, 0x0f);
+
+	/* PMU ACPI SCI interrupt: PIRQH */
+	pci_write_config_byte(dev, 0x8f, 0x0f);
+
+	/* Primary PATA IDE IRQ: 14
+	 * Secondary PATA IDE IRQ: 15
+	 */
+	pci_write_config_byte(dev, 0x44, 0x3d);
+	pci_write_config_byte(dev, 0x75, 0x0f);
+
+	/* Set IRQ14 and IRQ15 to legacy IRQs */
+	pci_read_config_word(dev, 0x46, &temp);
+	temp |= 0xc000;
+	pci_write_config_word(dev, 0x46, temp);
+
+	/* Set i8259 interrupt trigger
+	 * IRQ 3:  Level
+	 * IRQ 4:  Level
+	 * IRQ 5:  Level
+	 * IRQ 6:  Level
+	 * IRQ 7:  Level
+	 * IRQ 9:  Level
+	 * IRQ 10: Level
+	 * IRQ 11: Level
+	 * IRQ 12: Level
+	 * IRQ 14: Edge
+	 * IRQ 15: Edge
+	 */
+	outb(0xfa, 0x4d0);
+	outb(0x1e, 0x4d1);
+}
 
-int
-mpc86xx_exclude_device(u_char bus, u_char devfn)
+static void __devinit quirk_uli5288(struct pci_dev *dev)
 {
-#if !defined(CONFIG_PCI)
-	if (bus == 0 && PCI_SLOT(devfn) == 0)
-		return PCIBIOS_DEVICE_NOT_FOUND;
-#endif
+	unsigned char c;
+
+	pci_read_config_byte(dev,0x83,&c);
+	c |= 0x80;
+	pci_write_config_byte(dev, 0x83, c);
+
+	pci_write_config_byte(dev, 0x09, 0x01);
+	pci_write_config_byte(dev, 0x0a, 0x06);
+
+	pci_read_config_byte(dev,0x83,&c);
+	c &= 0x7f;
+	pci_write_config_byte(dev, 0x83, c);
 
-	return PCIBIOS_SUCCESSFUL;
+	pci_read_config_byte(dev,0x84,&c);
+	c |= 0x01;
+	pci_write_config_byte(dev, 0x84, c);
 }
+
+static void __devinit quirk_uli5229(struct pci_dev *dev)
+{
+	unsigned short temp;
+	pci_write_config_word(dev, 0x04, 0x0405);
+	pci_read_config_word(dev, 0x4a, &temp);
+	temp |= 0x1000;
+	pci_write_config_word(dev, 0x4a, temp);
+}
+
+static void __devinit early_uli5249(struct pci_dev *dev)
+{
+	unsigned char temp;
+	pci_write_config_word(dev, 0x04, 0x0007);
+	pci_read_config_byte(dev, 0x7c, &temp);
+	pci_write_config_byte(dev, 0x7c, 0x80);
+	pci_write_config_byte(dev, 0x09, 0x01);
+	pci_write_config_byte(dev, 0x7c, temp);
+	dev->class |= 0x1;
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, quirk_ali1575);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, 0x5249, early_uli5249);
 #endif /* CONFIG_PCI */
 
 
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_smp.c b/arch/powerpc/platforms/86xx/mpc86xx_smp.c
index 944ec4b..9cca3d1 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_smp.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_smp.c
@@ -34,8 +34,8 @@ extern unsigned long __secondary_hold_ac
 static void __init
 smp_86xx_release_core(int nr)
 {
-	void *mcm_vaddr;
-	unsigned long vaddr, pcr;
+	__be32 __iomem *mcm_vaddr;
+	unsigned long pcr;
 
 	if (nr < 0 || nr >= NR_CPUS)
 		return;
@@ -45,10 +45,9 @@ smp_86xx_release_core(int nr)
 	 */
 	mcm_vaddr = ioremap(get_immrbase() + MPC86xx_MCM_OFFSET,
 			    MPC86xx_MCM_SIZE);
-	vaddr = (unsigned long)mcm_vaddr +  MCM_PORT_CONFIG_OFFSET;
-	pcr = in_be32((volatile unsigned *)vaddr);
+	pcr = in_be32(mcm_vaddr + (MCM_PORT_CONFIG_OFFSET >> 2));
 	pcr |= 1 << (nr + 24);
-	out_be32((volatile unsigned *)vaddr, pcr);
+	out_be32(mcm_vaddr + (MCM_PORT_CONFIG_OFFSET >> 2), pcr);
 }
 
 
diff --git a/arch/powerpc/platforms/86xx/pci.c b/arch/powerpc/platforms/86xx/pci.c
index 5180df7..0d8b340 100644
--- a/arch/powerpc/platforms/86xx/pci.c
+++ b/arch/powerpc/platforms/86xx/pci.c
@@ -122,15 +122,12 @@ static void __init setup_pcie_atmu(struc
 static void __init
 mpc86xx_setup_pcie(struct pci_controller *hose, u32 pcie_offset, u32 pcie_size)
 {
-	volatile struct ccsr_pex *pcie;
 	u16 cmd;
 	unsigned int temps;
 
 	DBG("PCIE host controller register offset 0x%08x, size 0x%08x.\n",
 			pcie_offset, pcie_size);
 
-	pcie = ioremap(pcie_offset, pcie_size);
-
 	early_read_config_word(hose, 0, 0, PCI_COMMAND, &cmd);
 	cmd |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY
 	    | PCI_COMMAND_IO;
@@ -144,6 +141,14 @@ mpc86xx_setup_pcie(struct pci_controller
 	early_write_config_dword(hose, 0, 0, PCI_PRIMARY_BUS, temps);
 }
 
+int mpc86xx_exclude_device(u_char bus, u_char devfn)
+{
+	if (bus == 0 && PCI_SLOT(devfn) == 0)
+		return PCIBIOS_DEVICE_NOT_FOUND;
+
+	return PCIBIOS_SUCCESSFUL;
+}
+
 int __init add_bridge(struct device_node *dev)
 {
 	int len;
@@ -198,128 +203,3 @@ int __init add_bridge(struct device_node
 
 	return 0;
 }
-
-static void __devinit quirk_ali1575(struct pci_dev *dev)
-{
-	unsigned short temp;
-
-	/*
-	 * ALI1575 interrupts route table setup:
-	 *
-	 * IRQ pin   IRQ#
-	 * PIRQA ---- 3
-	 * PIRQB ---- 4
-	 * PIRQC ---- 5
-	 * PIRQD ---- 6
-	 * PIRQE ---- 9
-	 * PIRQF ---- 10
-	 * PIRQG ---- 11
-	 * PIRQH ---- 12
-	 *
-	 * interrupts for PCI slot0 -- PIRQA / PIRQB / PIRQC / PIRQD
-	 *                PCI slot1 -- PIRQB / PIRQC / PIRQD / PIRQA
-	 */
-	pci_write_config_dword(dev, 0x48, 0xb9317542);
-
-	/* USB 1.1 OHCI controller 1, interrupt: PIRQE */
-	pci_write_config_byte(dev, 0x86, 0x0c);
-
-	/* USB 1.1 OHCI controller 2, interrupt: PIRQF */
-	pci_write_config_byte(dev, 0x87, 0x0d);
-
-	/* USB 1.1 OHCI controller 3, interrupt: PIRQH */
-	pci_write_config_byte(dev, 0x88, 0x0f);
-
-	/* USB 2.0 controller, interrupt: PIRQ7 */
-	pci_write_config_byte(dev, 0x74, 0x06);
-
-	/* Audio controller, interrupt: PIRQE */
-	pci_write_config_byte(dev, 0x8a, 0x0c);
-
-	/* Modem controller, interrupt: PIRQF */
-	pci_write_config_byte(dev, 0x8b, 0x0d);
-
-	/* HD audio controller, interrupt: PIRQG */
-	pci_write_config_byte(dev, 0x8c, 0x0e);
-
-	/* Serial ATA interrupt: PIRQD */
-	pci_write_config_byte(dev, 0x8d, 0x0b);
-
-	/* SMB interrupt: PIRQH */
-	pci_write_config_byte(dev, 0x8e, 0x0f);
-
-	/* PMU ACPI SCI interrupt: PIRQH */
-	pci_write_config_byte(dev, 0x8f, 0x0f);
-
-	/* Primary PATA IDE IRQ: 14
-	 * Secondary PATA IDE IRQ: 15
-	 */
-	pci_write_config_byte(dev, 0x44, 0x3d);
-	pci_write_config_byte(dev, 0x75, 0x0f);
-
-	/* Set IRQ14 and IRQ15 to legacy IRQs */
-	pci_read_config_word(dev, 0x46, &temp);
-	temp |= 0xc000;
-	pci_write_config_word(dev, 0x46, temp);
-
-	/* Set i8259 interrupt trigger
-	 * IRQ 3:  Level
-	 * IRQ 4:  Level
-	 * IRQ 5:  Level
-	 * IRQ 6:  Level
-	 * IRQ 7:  Level
-	 * IRQ 9:  Level
-	 * IRQ 10: Level
-	 * IRQ 11: Level
-	 * IRQ 12: Level
-	 * IRQ 14: Edge
-	 * IRQ 15: Edge
-	 */
-	outb(0xfa, 0x4d0);
-	outb(0x1e, 0x4d1);
-}
-
-static void __devinit quirk_uli5288(struct pci_dev *dev)
-{
-	unsigned char c;
-
-	pci_read_config_byte(dev,0x83,&c);
-	c |= 0x80;
-	pci_write_config_byte(dev, 0x83, c);
-
-	pci_write_config_byte(dev, 0x09, 0x01);
-	pci_write_config_byte(dev, 0x0a, 0x06);
-
-	pci_read_config_byte(dev,0x83,&c);
-	c &= 0x7f;
-	pci_write_config_byte(dev, 0x83, c);
-
-	pci_read_config_byte(dev,0x84,&c);
-	c |= 0x01;
-	pci_write_config_byte(dev, 0x84, c);
-}
-
-static void __devinit quirk_uli5229(struct pci_dev *dev)
-{
-	unsigned short temp;
-	pci_write_config_word(dev, 0x04, 0x0405);
-	pci_read_config_word(dev, 0x4a, &temp);
-	temp |= 0x1000;
-	pci_write_config_word(dev, 0x4a, temp);
-}
-
-static void __devinit early_uli5249(struct pci_dev *dev)
-{
-	unsigned char temp;
-	pci_write_config_word(dev, 0x04, 0x0007);
-	pci_read_config_byte(dev, 0x7c, &temp);
-	pci_write_config_byte(dev, 0x7c, 0x80);
-	pci_write_config_byte(dev, 0x09, 0x01);
-	pci_write_config_byte(dev, 0x7c, temp);
-	dev->class |= 0x1;
-}
-
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, quirk_ali1575);
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
-DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, 0x5249, early_uli5249);
diff --git a/include/asm-powerpc/mpc86xx.h b/include/asm-powerpc/mpc86xx.h
index d0a6718..00d72a7 100644
--- a/include/asm-powerpc/mpc86xx.h
+++ b/include/asm-powerpc/mpc86xx.h
@@ -20,10 +20,6 @@ #include <asm/mmu.h>
 
 #ifdef CONFIG_PPC_86xx
 
-#ifdef CONFIG_MPC8641_HPCN
-#include <platforms/86xx/mpc8641_hpcn.h>
-#endif
-
 #define _IO_BASE        isa_io_base
 #define _ISA_MEM_BASE   isa_mem_base
 #ifdef CONFIG_PCI

^ permalink raw reply related

* Re: [PATCH] Make lparcfg.c work when both iseries and pseries are selected
From: Stephen Rothwell @ 2006-06-28  6:19 UTC (permalink / raw)
  To: Nathan Lynch; +Cc: linuxppc-dev, paulus
In-Reply-To: <20060628040539.GW16029@localdomain>

Hi Nathan,

On Tue, 27 Jun 2006 23:05:40 -0500 Nathan Lynch <ntl@pobox.com> wrote:
>
> Stephen Rothwell wrote:
> >  static ssize_t lparcfg_write(struct file *file, const char __user * buf,
> >  			     size_t count, loff_t * off)
> >  {
> > +	ssize_t retval = -ENOMEM;
> > +#ifdef CONFIG_PPC_PSERIES
	.
	.
	.
> > +#endif				/* CONFIG_PPC_PSERIES */
> >  	return retval;
> >  }
> 
> Erm... this is kind of gross, and will return -ENOMEM on iSeries when
> it should really return -ENOSYS (I think).

lparcfg_write will never be called on iSeries.  The function just needs to
exist to satisfy a conditional reference further down.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply

* RE: Please pull from 'for_paulus' branch of powerpc
From: Zhang Wei-r63237 @ 2006-06-28  6:26 UTC (permalink / raw)
  To: Kumar Gala, Paul Mackerras; +Cc: linuxppc-dev, linux-kernel

Hi, Kumar,

Why moving these codes from pci.c to mpc86xx_hpcn.c? It's not must be.
These functions relate to PCI device of MPC8641D HPCn platform. 
And we can also see the 'DECLARE_PCI_FIXUP_HEADER()' declaration in pci.c of Powermac platform.

Best Regards,
Zhang Wei

> -----Original Message-----
> From: linuxppc-dev-bounces+wei.zhang=freescale.com@ozlabs.org 
> [mailto:linuxppc-dev-bounces+wei.zhang=freescale.com@ozlabs.or
> g] On Behalf Of Kumar Gala
> Sent: Wednesday, June 28, 2006 2:01 PM
> To: Paul Mackerras
> Cc: linuxppc-dev@ozlabs.org; linux-kernel@vger.kernel.org
> Subject: Please pull from 'for_paulus' branch of powerpc
> 
> Please pull from 'for_paulus' branch of
> master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git
> 
> to receive the following updates:
> 
>  arch/powerpc/kernel/cputable.c             |   12 --
>  arch/powerpc/platforms/86xx/mpc86xx.h      |    8 +
>  arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |  128 
> +++++++++++++++++++++++++--
>  arch/powerpc/platforms/86xx/mpc86xx_smp.c  |    9 -
>  arch/powerpc/platforms/86xx/pci.c          |  136 
> +----------------------------
>  include/asm-powerpc/mpc86xx.h              |    4 
>  6 files changed, 138 insertions(+), 159 deletions(-)
> 
> Kumar Gala:
>       powerpc: minor cleanups for mpc86xx
> 
> diff --git a/arch/powerpc/kernel/cputable.c 
> b/arch/powerpc/kernel/cputable.c index 1c11488..abf7d42 100644
> --- a/arch/powerpc/kernel/cputable.c
> +++ b/arch/powerpc/kernel/cputable.c
> @@ -722,18 +722,6 @@ #if CLASSIC_PPC
>  		.oprofile_type		= PPC_OPROFILE_G4,
>  		.platform		= "ppc7450",
>  	},
> -        {       /* 8641 */
> -               .pvr_mask               = 0xffffffff,
> -               .pvr_value              = 0x80040010,
> -               .cpu_name               = "8641",
> -               .cpu_features           = CPU_FTRS_7447A,
> -               .cpu_user_features      = COMMON_USER | 
> PPC_FEATURE_HAS_ALTIVEC_COMP,
> -               .icache_bsize           = 32,
> -               .dcache_bsize           = 32,
> -               .num_pmcs               = 6,
> -               .cpu_setup              = __setup_cpu_745x
> -        },
> -
>  	{	/* 82xx (8240, 8245, 8260 are all 603e cores) */
>  		.pvr_mask		= 0x7fff0000,
>  		.pvr_value		= 0x00810000,
> diff --git a/arch/powerpc/platforms/86xx/mpc86xx.h 
> b/arch/powerpc/platforms/86xx/mpc86xx.h
> index e3c9e4f..2834462 100644
> --- a/arch/powerpc/platforms/86xx/mpc86xx.h
> +++ b/arch/powerpc/platforms/86xx/mpc86xx.h
> @@ -15,11 +15,13 @@ #define __MPC86XX_H__
>   * mpc86xx_* files. Mostly for use by mpc86xx_setup().
>   */
>  
> -extern int __init add_bridge(struct device_node *dev);
> +extern int add_bridge(struct device_node *dev);
>  
> -extern void __init setup_indirect_pcie(struct pci_controller *hose,
> +extern int mpc86xx_exclude_device(u_char bus, u_char devfn);
> +
> +extern void setup_indirect_pcie(struct pci_controller *hose,
>  				       u32 cfg_addr, u32 
> cfg_data); -extern void __init 
> setup_indirect_pcie_nomap(struct pci_controller *hose,
> +extern void setup_indirect_pcie_nomap(struct pci_controller *hose,
>  					     void __iomem *cfg_addr,
>  					     void __iomem *cfg_data);
>  
> diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c 
> b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
> index 483c21d..ac7f418 100644
> --- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
> +++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
> @@ -36,6 +36,7 @@ #include <asm/mpic.h>
>  #include <sysdev/fsl_soc.h>
>  
>  #include "mpc86xx.h"
> +#include "mpc8641_hpcn.h"
>  
>  #ifndef CONFIG_PCI
>  unsigned long isa_io_base = 0;
> @@ -186,17 +187,130 @@ mpc86xx_map_irq(struct pci_dev *dev, uns
>  	return PCI_IRQ_TABLE_LOOKUP + I8259_OFFSET;  }
>  
> +static void __devinit quirk_ali1575(struct pci_dev *dev) {
> +	unsigned short temp;
> +
> +	/*
> +	 * ALI1575 interrupts route table setup:
> +	 *
> +	 * IRQ pin   IRQ#
> +	 * PIRQA ---- 3
> +	 * PIRQB ---- 4
> +	 * PIRQC ---- 5
> +	 * PIRQD ---- 6
> +	 * PIRQE ---- 9
> +	 * PIRQF ---- 10
> +	 * PIRQG ---- 11
> +	 * PIRQH ---- 12
> +	 *
> +	 * interrupts for PCI slot0 -- PIRQA / PIRQB / PIRQC / PIRQD
> +	 *                PCI slot1 -- PIRQB / PIRQC / PIRQD / PIRQA
> +	 */
> +	pci_write_config_dword(dev, 0x48, 0xb9317542);
> +
> +	/* USB 1.1 OHCI controller 1, interrupt: PIRQE */
> +	pci_write_config_byte(dev, 0x86, 0x0c);
> +
> +	/* USB 1.1 OHCI controller 2, interrupt: PIRQF */
> +	pci_write_config_byte(dev, 0x87, 0x0d);
> +
> +	/* USB 1.1 OHCI controller 3, interrupt: PIRQH */
> +	pci_write_config_byte(dev, 0x88, 0x0f);
> +
> +	/* USB 2.0 controller, interrupt: PIRQ7 */
> +	pci_write_config_byte(dev, 0x74, 0x06);
> +
> +	/* Audio controller, interrupt: PIRQE */
> +	pci_write_config_byte(dev, 0x8a, 0x0c);
> +
> +	/* Modem controller, interrupt: PIRQF */
> +	pci_write_config_byte(dev, 0x8b, 0x0d);
> +
> +	/* HD audio controller, interrupt: PIRQG */
> +	pci_write_config_byte(dev, 0x8c, 0x0e);
> +
> +	/* Serial ATA interrupt: PIRQD */
> +	pci_write_config_byte(dev, 0x8d, 0x0b);
> +
> +	/* SMB interrupt: PIRQH */
> +	pci_write_config_byte(dev, 0x8e, 0x0f);
> +
> +	/* PMU ACPI SCI interrupt: PIRQH */
> +	pci_write_config_byte(dev, 0x8f, 0x0f);
> +
> +	/* Primary PATA IDE IRQ: 14
> +	 * Secondary PATA IDE IRQ: 15
> +	 */
> +	pci_write_config_byte(dev, 0x44, 0x3d);
> +	pci_write_config_byte(dev, 0x75, 0x0f);
> +
> +	/* Set IRQ14 and IRQ15 to legacy IRQs */
> +	pci_read_config_word(dev, 0x46, &temp);
> +	temp |= 0xc000;
> +	pci_write_config_word(dev, 0x46, temp);
> +
> +	/* Set i8259 interrupt trigger
> +	 * IRQ 3:  Level
> +	 * IRQ 4:  Level
> +	 * IRQ 5:  Level
> +	 * IRQ 6:  Level
> +	 * IRQ 7:  Level
> +	 * IRQ 9:  Level
> +	 * IRQ 10: Level
> +	 * IRQ 11: Level
> +	 * IRQ 12: Level
> +	 * IRQ 14: Edge
> +	 * IRQ 15: Edge
> +	 */
> +	outb(0xfa, 0x4d0);
> +	outb(0x1e, 0x4d1);
> +}
>  
> -int
> -mpc86xx_exclude_device(u_char bus, u_char devfn)
> +static void __devinit quirk_uli5288(struct pci_dev *dev)
>  {
> -#if !defined(CONFIG_PCI)
> -	if (bus == 0 && PCI_SLOT(devfn) == 0)
> -		return PCIBIOS_DEVICE_NOT_FOUND;
> -#endif
> +	unsigned char c;
> +
> +	pci_read_config_byte(dev,0x83,&c);
> +	c |= 0x80;
> +	pci_write_config_byte(dev, 0x83, c);
> +
> +	pci_write_config_byte(dev, 0x09, 0x01);
> +	pci_write_config_byte(dev, 0x0a, 0x06);
> +
> +	pci_read_config_byte(dev,0x83,&c);
> +	c &= 0x7f;
> +	pci_write_config_byte(dev, 0x83, c);
>  
> -	return PCIBIOS_SUCCESSFUL;
> +	pci_read_config_byte(dev,0x84,&c);
> +	c |= 0x01;
> +	pci_write_config_byte(dev, 0x84, c);
>  }
> +
> +static void __devinit quirk_uli5229(struct pci_dev *dev) {
> +	unsigned short temp;
> +	pci_write_config_word(dev, 0x04, 0x0405);
> +	pci_read_config_word(dev, 0x4a, &temp);
> +	temp |= 0x1000;
> +	pci_write_config_word(dev, 0x4a, temp); }
> +
> +static void __devinit early_uli5249(struct pci_dev *dev) {
> +	unsigned char temp;
> +	pci_write_config_word(dev, 0x04, 0x0007);
> +	pci_read_config_byte(dev, 0x7c, &temp);
> +	pci_write_config_byte(dev, 0x7c, 0x80);
> +	pci_write_config_byte(dev, 0x09, 0x01);
> +	pci_write_config_byte(dev, 0x7c, temp);
> +	dev->class |= 0x1;
> +}
> +
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, quirk_ali1575); 
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288); 
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229); 
> +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, 0x5249, early_uli5249);
>  #endif /* CONFIG_PCI */
>  
>  
> diff --git a/arch/powerpc/platforms/86xx/mpc86xx_smp.c 
> b/arch/powerpc/platforms/86xx/mpc86xx_smp.c
> index 944ec4b..9cca3d1 100644
> --- a/arch/powerpc/platforms/86xx/mpc86xx_smp.c
> +++ b/arch/powerpc/platforms/86xx/mpc86xx_smp.c
> @@ -34,8 +34,8 @@ extern unsigned long __secondary_hold_ac  
> static void __init  smp_86xx_release_core(int nr)  {
> -	void *mcm_vaddr;
> -	unsigned long vaddr, pcr;
> +	__be32 __iomem *mcm_vaddr;
> +	unsigned long pcr;
>  
>  	if (nr < 0 || nr >= NR_CPUS)
>  		return;
> @@ -45,10 +45,9 @@ smp_86xx_release_core(int nr)
>  	 */
>  	mcm_vaddr = ioremap(get_immrbase() + MPC86xx_MCM_OFFSET,
>  			    MPC86xx_MCM_SIZE);
> -	vaddr = (unsigned long)mcm_vaddr +  MCM_PORT_CONFIG_OFFSET;
> -	pcr = in_be32((volatile unsigned *)vaddr);
> +	pcr = in_be32(mcm_vaddr + (MCM_PORT_CONFIG_OFFSET >> 2));
>  	pcr |= 1 << (nr + 24);
> -	out_be32((volatile unsigned *)vaddr, pcr);
> +	out_be32(mcm_vaddr + (MCM_PORT_CONFIG_OFFSET >> 2), pcr);
>  }
>  
>  
> diff --git a/arch/powerpc/platforms/86xx/pci.c 
> b/arch/powerpc/platforms/86xx/pci.c
> index 5180df7..0d8b340 100644
> --- a/arch/powerpc/platforms/86xx/pci.c
> +++ b/arch/powerpc/platforms/86xx/pci.c
> @@ -122,15 +122,12 @@ static void __init 
> setup_pcie_atmu(struc  static void __init  
> mpc86xx_setup_pcie(struct pci_controller *hose, u32 
> pcie_offset, u32 pcie_size)  {
> -	volatile struct ccsr_pex *pcie;
>  	u16 cmd;
>  	unsigned int temps;
>  
>  	DBG("PCIE host controller register offset 0x%08x, size 
> 0x%08x.\n",
>  			pcie_offset, pcie_size);
>  
> -	pcie = ioremap(pcie_offset, pcie_size);
> -
>  	early_read_config_word(hose, 0, 0, PCI_COMMAND, &cmd);
>  	cmd |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | 
> PCI_COMMAND_MEMORY
>  	    | PCI_COMMAND_IO;
> @@ -144,6 +141,14 @@ mpc86xx_setup_pcie(struct pci_controller
>  	early_write_config_dword(hose, 0, 0, PCI_PRIMARY_BUS, temps);  }
>  
> +int mpc86xx_exclude_device(u_char bus, u_char devfn) {
> +	if (bus == 0 && PCI_SLOT(devfn) == 0)
> +		return PCIBIOS_DEVICE_NOT_FOUND;
> +
> +	return PCIBIOS_SUCCESSFUL;
> +}
> +
>  int __init add_bridge(struct device_node *dev)  {
>  	int len;
> @@ -198,128 +203,3 @@ int __init add_bridge(struct device_node
>  
>  	return 0;
>  }
> -
> -static void __devinit quirk_ali1575(struct pci_dev *dev) -{
> -	unsigned short temp;
> -
> -	/*
> -	 * ALI1575 interrupts route table setup:
> -	 *
> -	 * IRQ pin   IRQ#
> -	 * PIRQA ---- 3
> -	 * PIRQB ---- 4
> -	 * PIRQC ---- 5
> -	 * PIRQD ---- 6
> -	 * PIRQE ---- 9
> -	 * PIRQF ---- 10
> -	 * PIRQG ---- 11
> -	 * PIRQH ---- 12
> -	 *
> -	 * interrupts for PCI slot0 -- PIRQA / PIRQB / PIRQC / PIRQD
> -	 *                PCI slot1 -- PIRQB / PIRQC / PIRQD / PIRQA
> -	 */
> -	pci_write_config_dword(dev, 0x48, 0xb9317542);
> -
> -	/* USB 1.1 OHCI controller 1, interrupt: PIRQE */
> -	pci_write_config_byte(dev, 0x86, 0x0c);
> -
> -	/* USB 1.1 OHCI controller 2, interrupt: PIRQF */
> -	pci_write_config_byte(dev, 0x87, 0x0d);
> -
> -	/* USB 1.1 OHCI controller 3, interrupt: PIRQH */
> -	pci_write_config_byte(dev, 0x88, 0x0f);
> -
> -	/* USB 2.0 controller, interrupt: PIRQ7 */
> -	pci_write_config_byte(dev, 0x74, 0x06);
> -
> -	/* Audio controller, interrupt: PIRQE */
> -	pci_write_config_byte(dev, 0x8a, 0x0c);
> -
> -	/* Modem controller, interrupt: PIRQF */
> -	pci_write_config_byte(dev, 0x8b, 0x0d);
> -
> -	/* HD audio controller, interrupt: PIRQG */
> -	pci_write_config_byte(dev, 0x8c, 0x0e);
> -
> -	/* Serial ATA interrupt: PIRQD */
> -	pci_write_config_byte(dev, 0x8d, 0x0b);
> -
> -	/* SMB interrupt: PIRQH */
> -	pci_write_config_byte(dev, 0x8e, 0x0f);
> -
> -	/* PMU ACPI SCI interrupt: PIRQH */
> -	pci_write_config_byte(dev, 0x8f, 0x0f);
> -
> -	/* Primary PATA IDE IRQ: 14
> -	 * Secondary PATA IDE IRQ: 15
> -	 */
> -	pci_write_config_byte(dev, 0x44, 0x3d);
> -	pci_write_config_byte(dev, 0x75, 0x0f);
> -
> -	/* Set IRQ14 and IRQ15 to legacy IRQs */
> -	pci_read_config_word(dev, 0x46, &temp);
> -	temp |= 0xc000;
> -	pci_write_config_word(dev, 0x46, temp);
> -
> -	/* Set i8259 interrupt trigger
> -	 * IRQ 3:  Level
> -	 * IRQ 4:  Level
> -	 * IRQ 5:  Level
> -	 * IRQ 6:  Level
> -	 * IRQ 7:  Level
> -	 * IRQ 9:  Level
> -	 * IRQ 10: Level
> -	 * IRQ 11: Level
> -	 * IRQ 12: Level
> -	 * IRQ 14: Edge
> -	 * IRQ 15: Edge
> -	 */
> -	outb(0xfa, 0x4d0);
> -	outb(0x1e, 0x4d1);
> -}
> -
> -static void __devinit quirk_uli5288(struct pci_dev *dev) -{
> -	unsigned char c;
> -
> -	pci_read_config_byte(dev,0x83,&c);
> -	c |= 0x80;
> -	pci_write_config_byte(dev, 0x83, c);
> -
> -	pci_write_config_byte(dev, 0x09, 0x01);
> -	pci_write_config_byte(dev, 0x0a, 0x06);
> -
> -	pci_read_config_byte(dev,0x83,&c);
> -	c &= 0x7f;
> -	pci_write_config_byte(dev, 0x83, c);
> -
> -	pci_read_config_byte(dev,0x84,&c);
> -	c |= 0x01;
> -	pci_write_config_byte(dev, 0x84, c);
> -}
> -
> -static void __devinit quirk_uli5229(struct pci_dev *dev) -{
> -	unsigned short temp;
> -	pci_write_config_word(dev, 0x04, 0x0405);
> -	pci_read_config_word(dev, 0x4a, &temp);
> -	temp |= 0x1000;
> -	pci_write_config_word(dev, 0x4a, temp);
> -}
> -
> -static void __devinit early_uli5249(struct pci_dev *dev) -{
> -	unsigned char temp;
> -	pci_write_config_word(dev, 0x04, 0x0007);
> -	pci_read_config_byte(dev, 0x7c, &temp);
> -	pci_write_config_byte(dev, 0x7c, 0x80);
> -	pci_write_config_byte(dev, 0x09, 0x01);
> -	pci_write_config_byte(dev, 0x7c, temp);
> -	dev->class |= 0x1;
> -}
> -
> -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, 
> quirk_ali1575); -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 
> 0x5288, quirk_uli5288); 
> -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, 
> quirk_uli5229); -DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, 
> 0x5249, early_uli5249); diff --git 
> a/include/asm-powerpc/mpc86xx.h 
> b/include/asm-powerpc/mpc86xx.h index d0a6718..00d72a7 100644
> --- a/include/asm-powerpc/mpc86xx.h
> +++ b/include/asm-powerpc/mpc86xx.h
> @@ -20,10 +20,6 @@ #include <asm/mmu.h>
>  
>  #ifdef CONFIG_PPC_86xx
>  
> -#ifdef CONFIG_MPC8641_HPCN
> -#include <platforms/86xx/mpc8641_hpcn.h> -#endif
> -
>  #define _IO_BASE        isa_io_base
>  #define _ISA_MEM_BASE   isa_mem_base
>  #ifdef CONFIG_PCI
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
> 

^ permalink raw reply

* RE: patches applied to powerpc.git
From: Zang Roy-r61911 @ 2006-06-28  7:14 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, linux-kernel-owner

Hi, Paul

	I have submitted the "v2" version for mpc7448hpc2 board support in arch/powerpc/platforms/embedded6xx.
	I  have not got any suggestion, since I submitted the code.
	In this submission I have addressed all the issues brought up in the "v1" submission. 
	So could you help me merge the patches into your git tree ? If there is any comment about the code, please let me know.
	Thanks a lot!

Roy 

> 
> The following patches have just been pushed to the 
> powerpc.git repository ("master" branch).  I'll ask Linus to 
> pull them tomorrow unless I hear any objections.  If you have 
> patches that you want upstream that aren't listed, bug me or 
> the appropriate platform maintainer about them.
> 
> Paul.
> 
>  arch/powerpc/Kconfig                       |    8 +
>  arch/powerpc/Kconfig.debug                 |    9 +
>  arch/powerpc/configs/cell_defconfig        |    7 +
>  arch/powerpc/kernel/Makefile               |    3 
>  arch/powerpc/kernel/cpu_setup_power4.S     |   14 ++
>  arch/powerpc/kernel/crash.c                |  147 +++++++++++++++---
>  arch/powerpc/kernel/head_64.S              |   51 ++----
>  arch/powerpc/kernel/iommu.c                |   30 ++++
>  arch/powerpc/kernel/machine_kexec_64.c     |    4 -
>  arch/powerpc/kernel/misc.S                 |  203 
> +++++++++++++++++++++++++
>  arch/powerpc/kernel/misc_32.S              |  156 
> --------------------
>  arch/powerpc/kernel/misc_64.S              |  223 
> +---------------------------
>  arch/powerpc/kernel/paca.c                 |    1 
>  arch/powerpc/kernel/prom.c                 |   48 ++++--
>  arch/powerpc/kernel/rtas.c                 |  119 +++++++++++++--
>  arch/powerpc/kernel/setup_64.c             |   19 +-
>  arch/powerpc/kernel/traps.c                |   27 ++-
>  arch/powerpc/kernel/udbg.c                 |    7 +
>  arch/powerpc/mm/hash_native_64.c           |    3 
>  arch/powerpc/mm/hash_utils_64.c            |  106 +++++--------
>  arch/powerpc/platforms/86xx/Kconfig        |    6 -
>  arch/powerpc/platforms/86xx/Makefile       |    3 
>  arch/powerpc/platforms/86xx/mpc8641_hpcn.h |    1 
>  arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    1 
>  arch/powerpc/platforms/86xx/mpc86xx_smp.c  |    1 
>  arch/powerpc/platforms/86xx/pci.c          |    1 
>  arch/powerpc/platforms/cell/Kconfig        |    2 
>  arch/powerpc/platforms/cell/setup.c        |   16 +-
>  arch/powerpc/platforms/cell/spu_base.c     |    8 +
>  arch/powerpc/platforms/cell/spufs/file.c   |   10 +
>  arch/powerpc/platforms/cell/spufs/switch.c |    6 +
>  arch/powerpc/platforms/iseries/htab.c      |    4 -
>  arch/powerpc/platforms/iseries/lpevents.c  |   55 ++++---
>  arch/powerpc/platforms/iseries/proc.c      |    1 
>  arch/powerpc/platforms/iseries/setup.c     |   19 --
>  arch/powerpc/platforms/maple/setup.c       |    7 -
>  arch/powerpc/platforms/powermac/setup.c    |    9 -
>  arch/powerpc/platforms/pseries/iommu.c     |   33 ++++
>  arch/powerpc/platforms/pseries/lpar.c      |    4 -
>  arch/powerpc/platforms/pseries/setup.c     |   10 +
>  drivers/ide/Kconfig                        |    9 +
>  drivers/ide/ppc/pmac.c                     |  125 ----------------
>  drivers/macintosh/Kconfig                  |   12 ++
>  drivers/macintosh/Makefile                 |    1 
>  drivers/macintosh/via-pmu-led.c            |  144 ++++++++++++++++++
>  include/asm-powerpc/cputable.h             |   48 +++---
>  include/asm-powerpc/iseries/it_lp_queue.h  |   40 +++--
>  include/asm-powerpc/kdump.h                |    2 
>  include/asm-powerpc/kexec.h                |    9 +
>  include/asm-powerpc/machdep.h              |    2 
>  include/asm-powerpc/mmu.h                  |    1 
>  include/asm-powerpc/mpc86xx.h              |    1 
>  include/asm-powerpc/rtas.h                 |    3 
>  include/asm-powerpc/time.h                 |    6 +
>  include/asm-powerpc/udbg.h                 |    3 
>  kernel/kexec.c                             |    6 -
>  56 files changed, 936 insertions(+), 858 deletions(-)  
> create mode 100644 arch/powerpc/kernel/misc.S  create mode 
> 100644 drivers/macintosh/via-pmu-led.c
> 
> Andrew Morton:
>       [POWERPC] powerpc: kconfig warning fix
> 
> Arnd Bergmann:
>       [POWERPC] spufs: fix class0 interrupt assignment
> 
> Benjamin Herrenschmidt:
>       [POWERPC] spufs: map mmio space as guarded into user space
>       [POWERPC] spufs: fix MFC command queue purge
> 
> David Wilder:
>       [POWERPC] Add the use of the firmware soft-reset-nmi to kdump.
> 
> Geoff Levand:
>       [POWERPC] spufs: fix memory hotplug dependency
> 
> Haren Myneni:
>       [POWERPC] kdump: Reserve the existing TCE mappings left 
> by the first kernel
> 
> Jimi Xenidis:
>       [POWERPC] Don't access HID registers if running on a Hypervisor.
>       [POWERPC] Skip the "copy down" of the kernel if it is 
> already at zero.
> 
> Johannes Berg:
>       [POWERPC] Convert powermac ide blink to new led infrastructure
> 
> Jon Loeliger:
>       [POWERPC] Remove redundant PPC_86XX check.
>       [POWERPC] Move I8259 selection under MPC8641HPCN board
>       [POWERPC] Remove redundant STD_MMU selection.
>       [POWERPC] Remove obsolete #include <linux/config.h>.
> 
> Michael Ellerman:
>       [POWERPC] Remove remaining iSeries debugger cruft
>       [POWERPC] Export flat device tree via debugfs for debugging
>       [POWERPC] powerpc: Initialise ppc_md htab pointers earlier
>       [POWERPC] Use ppc_md.hpte_insert() in htab_bolt_mapping()
>       [POWERPC] Make kexec_setup() a regular initcall
>       [POWERPC] Setup the boot cpu's paca pointer in C rather than asm
>       [POWERPC] Make rtas_call() safe if RTAS hasn't been initialised
>       [POWERPC] Move RTAS exports next to their declarations
>       [POWERPC] Setup RTAS values earlier, to enable 
> rtas_call() earlier
>       [POWERPC] Add udbg support for RTAS console
>       [POWERPC] Enable the RTAS udbg console on IBM Cell Blade
>       [POWERPC] Enable XMON in cell_defconfig
> 
> Paul Mackerras:
>       [POWERPC] Simplify the code defining the 64-bit CPU features
>       [POWERPC] Make sure we select CONFIG_NEW_LEDS if 
> ADB_PMU_LED is set
> 
> Stephen Rothwell:
>       [POWERPC] Clean up it_lp_queue.h
>       [POWERPC] update asm-powerpc/time.h
>       [POWERPC] Remove unused function call_with_mmu_off
>       [POWERPC] Consolidate some of kernel/misc*.S
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
> 

^ permalink raw reply

* Re: [PATCH] Make lparcfg.c work when both iseries and pseries are selected
From: Nathan Lynch @ 2006-06-28  7:29 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linuxppc-dev, paulus
In-Reply-To: <20060628161903.7767131f.sfr@canb.auug.org.au>

Stephen Rothwell wrote:
> Hi Nathan,
> 
> On Tue, 27 Jun 2006 23:05:40 -0500 Nathan Lynch <ntl@pobox.com> wrote:
> >
> > Stephen Rothwell wrote:
> > >  static ssize_t lparcfg_write(struct file *file, const char __user * buf,
> > >  			     size_t count, loff_t * off)
> > >  {
> > > +	ssize_t retval = -ENOMEM;
> > > +#ifdef CONFIG_PPC_PSERIES
> 	.
> 	.
> 	.
> > > +#endif				/* CONFIG_PPC_PSERIES */
> > >  	return retval;
> > >  }
> > 
> > Erm... this is kind of gross, and will return -ENOMEM on iSeries when
> > it should really return -ENOSYS (I think).
> 
> lparcfg_write will never be called on iSeries.  The function just needs to
> exist to satisfy a conditional reference further down.

Okay.  Well, my earlier comment regarding readability still stands,
and I think is bolstered somewhat by this explanation ;)

^ permalink raw reply

* how to get individual patches
From: David H. Lynch Jr. @ 2006-06-28  7:49 UTC (permalink / raw)
  To: linuxppc-embedded
In-Reply-To: <20060627212448.7d048b7a@White64>


    The bsp I am working on works with 2.6.16.21 but fails with 2.6.17.
   
    How can I find the individual patches that make up the transition
from 2.6.16.21 to 2.6.17 ?

    I guess I can use interdiff to create single patch to go from
2.6.16.21 to 2.6.17 but I am really looking to get all the individual
patches so I can try to isolate exactly
    what is giving me trouble.

-- 
Dave Lynch 					  	    DLA Systems
Software Development:  				         Embedded Linux
717.627.3770 	       dhlii@dlasys.net 	  http://www.dlasys.net
fax: 1.253.369.9244 			           Cell: 1.717.587.7774
Over 25 years' experience in platforms, languages, and technologies too numerous to list.

"Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction."
Albert Einstein

^ permalink raw reply

* Re: Can anyone tell me if it is a bug of the ELDK4.0?
From: Wolfgang Denk @ 2006-06-28  7:51 UTC (permalink / raw)
  To: Denny; +Cc: linuxppc-embedded
In-Reply-To: <44A1E115.000001.12247@bj163app13.163.com>

In message <44A1E115.000001.12247@bj163app13.163.com> you wrote:
> 
>      I failed to compile the uboot on my 440GP platform, I set the compile switch as "-m440 -mcpu=440",

Don't do this, then. The  ELDK  will  automatically  set  approproate
compiler  options  as  needed,  depending  on  your  setting  of  the
CROSS_COMPILE variable.

All this is documented in the manual.

Just follow the instructions.


Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Half of the people in the world are below average.

^ permalink raw reply

* snd-aoa issues & fixes
From: Benjamin Herrenschmidt @ 2006-06-28  8:01 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linuxppc-dev list

So I've been trying to fix snd-aoa for the G5s and found a few issues...
I think I got most of it right, however I don't have any sound... I hear
"clacs" when I toggle the mutes pretty much as expected and I see
interrupts counting when playing sound but there is no actual sound in
the speaker. I've verified that snd-powermac works on the same machine
(PowerMac7,3 with tas codec). I've been toying with all the controls
available in alsamixer, it didn't help. Sounds to me that there is
nothing going out of the tas... maybe some mixer control that is not
quite right, duno

- Redefinition of various FCR related bits in i2s-control. I've fixed
that in the patch and used existing definitions. However, we still have
a problem that we don't properly lock with pmac_feature for access to
these. We need to either expose new feature calls now that we are
upstream or expose the pmac_feature spinlock

- I noticed you don't call pmac_feature and don't set bits in FCR3
etc... (enabling the 18Mhz clock for example). Is that normal ? You
don't use that clock ? That's the only difference in FCR content that
I've been able to spot between snd-powermac and snd-aoa but hacking it
doesn't seem to make much difference.

- The fabric stuff needs a bit of cleanup... You seem to be fond of
defining lotsa struct's :) Even when they don't contain much :) Triggers
another problem below

- I've had a crash with built-in snd-aoa at boot... The problem is that
when built-in, there is no enforced ordering between module_init() calls
except for link order... What happens here is that soundbus is last in
the Makefile, thus we try to register soundbus devices before we
register the bus type. I fixes that in the patch both by putting
soundbus first in the Make

- If i2sbus is loaded after the codec and fabric, the codec fails to
initialize. I haven't tried to debug that one

- The dmesg output could use some cleanup :)

- The driver is trying to access non existing codecs on the i2c bus,
that's a pretty bad idea.

I think we need to change the codec probe phase dramatically: 

  1 - codec drivers register the i2c thingy as normal
  2 - i2c kicks in, they do the current device-node and/or i2c bus name
check and register
      themselves with the core. They do not try to touch the hardware at
this point
  3 - fabric kicks in (or was already there). It checks the list of
codecs registered when
      loaded and gets notified of new ones added. If codec matches the
layout, then codec
      init is called
  4 - codec init called by fabric. That is where we try to tap the
hardware. Might fail in
      which case the fabric doesn't try to use the codec

(That is, there is a global list of registered codecs at the core, and a
list of "active" codecs in the fabric or bus, whatever...)

Here's my current patch:

Index: linux-snd-aoa/sound/aoa/soundbus/i2sbus/i2sbus-core.c
===================================================================
--- linux-snd-aoa.orig/sound/aoa/soundbus/i2sbus/i2sbus-core.c	2006-06-26 12:29:38.000000000 +1000
+++ linux-snd-aoa/sound/aoa/soundbus/i2sbus/i2sbus-core.c	2006-06-28 16:10:27.000000000 +1000
@@ -7,13 +7,16 @@
  */
 
 #include <linux/module.h>
-#include <asm/macio.h>
-#include <asm/dbdma.h>
 #include <linux/pci.h>
 #include <linux/interrupt.h>
+#include <linux/dma-mapping.h>
+
 #include <sound/driver.h>
 #include <sound/core.h>
-#include <linux/dma-mapping.h>
+
+#include <asm/macio.h>
+#include <asm/dbdma.h>
+
 #include "../soundbus.h"
 #include "i2sbus.h"
 
@@ -24,6 +27,12 @@ MODULE_DESCRIPTION("Apple Soundbus: I2S 
  * string that macio puts into the relevant device */
 MODULE_ALIAS("of:Ni2sTi2sC");
 
+static int force;
+module_param(force, int, 0444);
+MODULE_PARM_DESC(force, "Force loading i2sbus even when"
+		 " no layout-id property is present");
+
+
 static struct of_device_id i2sbus_match[] = {
 	{ .name = "i2s" },
 	{ }
@@ -73,7 +82,7 @@ static void i2sbus_release_dev(struct de
  	if (i2sdev->intfregs) iounmap(i2sdev->intfregs);
  	if (i2sdev->out.dbdma) iounmap(i2sdev->out.dbdma);
  	if (i2sdev->in.dbdma) iounmap(i2sdev->in.dbdma);
-	for (i=0;i<3;i++)
+	for (i = aoa_resource_i2smmio; i <= aoa_resource_rxdbdma; i++)
 		if (i2sdev->allocated_resource[i])
 			release_and_free_resource(i2sdev->allocated_resource[i]);
 	free_dbdma_descriptor_ring(i2sdev, &i2sdev->out.dbdma_ring);
@@ -101,10 +110,49 @@ static irqreturn_t i2sbus_bus_intr(int i
 	return IRQ_HANDLED;
 }
 
-static int force;
-module_param(force, int, 0444);
-MODULE_PARM_DESC(force, "Force loading i2sbus even when"
-			" no layout-id property is present");
+/*
+ * XXX FIXME: We have to test the layout_id's here to get the proper way
+ * of mapping in various registers, thanks to bugs in Apple device-trees.
+ * Ideally, that should be handled by the layout fabric but doing so would
+ * require a little bit of shuffling around
+ */
+static int i2sbus_get_and_fixup_rsrc(struct device_node *np, int index,
+				     int layout, struct resource *res)
+{
+	struct device_node *parent;
+	int pindex, rc = -ENXIO;
+	u32 *reg;
+
+	/* Machines with layout 76 and 36 (K2 based) have a weird device
+	 * tree what we need to special case.
+	 * Normal machines just fetch the resource from the i2s-X node.
+	 * Darwin further divides normal machines into old and new layouts
+	 * with a subtely different code path but that doesn't seem necessary
+	 * in practice, they just bloated it. In addition, even on our K2
+	 * case the i2s-modem node, if we ever want to handle it, uses the
+	 * normal layout
+	 */
+	if (layout != 76 && layout != 36)
+		return of_address_to_resource(np, index, res);
+
+	parent = of_get_parent(np);
+	pindex = (index == aoa_resource_i2smmio) ? 0 : 1;
+	rc = of_address_to_resource(parent, pindex, res);
+	if (rc)
+		goto bail;
+	reg = (u32 *)get_property(np, "reg", NULL);
+	if (reg == NULL) {
+		rc = -ENXIO;
+		goto bail;
+	}
+	res->start += reg[index * 2];
+	res->end = res->start + reg[index * 2 + 1] - 1;
+	printk("i2sbus rsrc %d -> %lx..%lx\n", index,
+	       res->start, res->end);
+ bail:
+	of_node_put(parent);
+	return rc;
+}
 
 /* FIXME: look at device node refcounting */
 static int i2sbus_add_dev(struct macio_dev *macio,
@@ -113,7 +161,8 @@ static int i2sbus_add_dev(struct macio_d
 {
 	struct i2sbus_dev *dev;
 	struct device_node *child = NULL, *sound = NULL;
-	int i;
+	struct resource *r;
+	int i, layout = 0;
 	static const char *rnames[] = { "i2sbus: %s (control)",
 					"i2sbus: %s (tx)",
 					"i2sbus: %s (rx)" };
@@ -147,8 +196,9 @@ static int i2sbus_add_dev(struct macio_d
 		u32 *layout_id;
 		layout_id = (u32*) get_property(sound, "layout-id", NULL);
 		if (layout_id) {
+			layout = *layout_id;
 			snprintf(dev->sound.modalias, 32,
-				 "sound-layout-%d", *layout_id);
+				 "sound-layout-%d", layout);
 			force = 1;
 		}
 	}
@@ -180,20 +230,28 @@ static int i2sbus_add_dev(struct macio_d
 
 	for (i=0;i<3;i++) {
 		dev->interrupts[i] = -1;
-		snprintf(dev->rnames[i], sizeof(dev->rnames[i]), rnames[i], np->name);
+		snprintf(dev->rnames[i], sizeof(dev->rnames[i]), rnames[i],
+			 np->name);
 	}
 	for (i=0;i<3;i++) {
-		if (request_irq(np->intrs[i].line, ints[i], 0, dev->rnames[i], dev))
+		if (request_irq(np->intrs[i].line, ints[i], 0, dev->rnames[i],
+				dev))
 			goto err;
 		dev->interrupts[i] = np->intrs[i].line;
 	}
 
-	for (i=0;i<3;i++) {
-		if (of_address_to_resource(np, i, &dev->resources[i]))
+	/* Resource handling is problematic as some device-trees contain
+	 * useless crap (ugh ugh ugh). We work around that here by calling
+	 * specific functions for calculating the appropriate resources.
+	 */
+	for (i = aoa_resource_i2smmio; i <= aoa_resource_rxdbdma; i++) {
+		if (i2sbus_get_and_fixup_rsrc(np,i,layout,&dev->resources[i]))
 			goto err;
-		/* if only we could use our resource dev->resources[i]...
+
+		/* If only we could use our resource dev->resources[i]...
 		 * but request_resource doesn't know about parents and
-		 * contained resources... */
+		 * contained resources...
+		 */
 		dev->allocated_resource[i] = 
 			request_mem_region(dev->resources[i].start,
 					   dev->resources[i].end -
@@ -205,12 +263,12 @@ static int i2sbus_add_dev(struct macio_d
 		}
 	}
 	/* should do sanity checking here about length of them */
-	dev->intfregs = ioremap(dev->resources[0].start,
-				dev->resources[0].end-dev->resources[0].start+1);
-	dev->out.dbdma = ioremap(dev->resources[1].start,
-			 	 dev->resources[1].end-dev->resources[1].start+1);
-	dev->in.dbdma = ioremap(dev->resources[2].start,
-				dev->resources[2].end-dev->resources[2].start+1);
+	r = &dev->resources[aoa_resource_i2smmio];
+	dev->intfregs = ioremap(r->start, r->end - r->start + 1);
+	r = &dev->resources[aoa_resource_txdbdma];
+	dev->out.dbdma = ioremap(r->start, r->end - r->start + 1);
+	r = &dev->resources[aoa_resource_rxdbdma];
+	dev->in.dbdma = ioremap(r->start, r->end - r->start + 1);
 	if (!dev->intfregs || !dev->out.dbdma || !dev->in.dbdma)
 		goto err;
 
Index: linux-snd-aoa/sound/aoa/soundbus/i2sbus/i2sbus.h
===================================================================
--- linux-snd-aoa.orig/sound/aoa/soundbus/i2sbus/i2sbus.h	2006-06-26 12:29:38.000000000 +1000
+++ linux-snd-aoa/sound/aoa/soundbus/i2sbus/i2sbus.h	2006-06-28 15:16:40.000000000 +1000
@@ -7,20 +7,22 @@
  */
 #ifndef __I2SBUS_H
 #define __I2SBUS_H
-#include <asm/dbdma.h>
 #include <linux/interrupt.h>
-#include <sound/pcm.h>
 #include <linux/spinlock.h>
 #include <linux/mutex.h>
+
+#include <sound/pcm.h>
+
 #include <asm/prom.h>
+#include <asm/pmac_feature.h>
+#include <asm/dbdma.h>
+
 #include "i2sbus-interface.h"
-#include "i2sbus-control.h"
 #include "../soundbus.h"
 
 struct i2sbus_control {
-	volatile struct i2s_control_regs __iomem *controlregs;
-	struct resource rsrc;
 	struct list_head list;
+	struct macio_chip *macio;
 };
 
 #define MAX_DBDMA_COMMANDS	32
@@ -45,6 +47,12 @@ struct pcm_info {
 	volatile struct dbdma_regs __iomem *dbdma;
 };
 
+enum {
+	aoa_resource_i2smmio = 0,
+	aoa_resource_txdbdma,
+	aoa_resource_rxdbdma,
+};
+
 struct i2sbus_dev {
 	struct soundbus_dev sound;
 	struct macio_dev *macio;
Index: linux-snd-aoa/sound/aoa/soundbus/i2sbus/i2sbus-control.c
===================================================================
--- linux-snd-aoa.orig/sound/aoa/soundbus/i2sbus/i2sbus-control.c	2006-06-26 12:29:38.000000000 +1000
+++ linux-snd-aoa/sound/aoa/soundbus/i2sbus/i2sbus-control.c	2006-06-28 16:09:44.000000000 +1000
@@ -6,12 +6,16 @@
  * GPL v2, can be found in COPYING.
  */
 
-#include <asm/io.h>
+#include <linux/kernel.h>
 #include <linux/delay.h>
+
+#include <asm/io.h>
 #include <asm/prom.h>
 #include <asm/macio.h>
 #include <asm/pmac_feature.h>
 #include <asm/pmac_pfunc.h>
+#include <asm/keylargo.h>
+
 #include "i2sbus.h"
 
 int i2sbus_control_init(struct macio_dev* dev, struct i2sbus_control **c)
@@ -22,26 +26,12 @@ int i2sbus_control_init(struct macio_dev
 
 	INIT_LIST_HEAD(&(*c)->list);
 
-	if (of_address_to_resource(dev->ofdev.node, 0, &(*c)->rsrc))
-		goto err;
-	/* we really should be using feature calls instead of mapping
-	 * these registers. It's safe for now since no one else is
-	 * touching them... */
-	(*c)->controlregs = ioremap((*c)->rsrc.start,
-				    sizeof(struct i2s_control_regs));
-	if (!(*c)->controlregs)
-		goto err;
-
+	(*c)->macio = dev->bus->chip;
 	return 0;
- err:
-	kfree(*c);
-	*c = NULL;
-	return -ENODEV;
 }
 
 void i2sbus_control_destroy(struct i2sbus_control *c)
 {
-	iounmap(c->controlregs);
 	kfree(c);
 }
 
@@ -93,19 +83,20 @@ int i2sbus_control_enable(struct i2sbus_
 			  struct i2sbus_dev *i2sdev)
 {
 	struct pmf_args args = { .count = 0 };
-	int cc;
+	struct macio_chip *macio = c->macio;
 
 	if (i2sdev->enable)
 		return pmf_call_one(i2sdev->enable, &args);
 
+	printk("i2sbus_control_enable fallback\n");
+	if (macio == NULL || macio->base == NULL)
+		return -ENODEV;
 	switch (i2sdev->bus_number) {
 	case 0:
-		cc = in_le32(&c->controlregs->cell_control);
-		out_le32(&c->controlregs->cell_control, cc | CTRL_CLOCK_INTF_0_ENABLE);
+		MACIO_BIS(KEYLARGO_FCR1, KL1_I2S0_ENABLE);
 		break;
 	case 1:
-		cc = in_le32(&c->controlregs->cell_control);
-		out_le32(&c->controlregs->cell_control, cc | CTRL_CLOCK_INTF_1_ENABLE);
+		MACIO_BIS(KEYLARGO_FCR1, KL1_I2S1_ENABLE);
 		break;
 	default:
 		return -ENODEV;
@@ -118,7 +109,7 @@ int i2sbus_control_cell(struct i2sbus_co
 			int enable)
 {
 	struct pmf_args args = { .count = 0 };
-	int cc;
+	struct macio_chip *macio = c->macio;
 
 	switch (enable) {
 	case 0:
@@ -133,18 +124,22 @@ int i2sbus_control_cell(struct i2sbus_co
 		printk(KERN_ERR "i2sbus: INVALID CELL ENABLE VALUE\n");
 		return -ENODEV;
 	}
+
+	printk("i2sbus_control_cell fallback\n");
+	if (macio == NULL || macio->base == NULL)
+		return -ENODEV;
 	switch (i2sdev->bus_number) {
 	case 0:
-		cc = in_le32(&c->controlregs->cell_control);
-		cc &= ~CTRL_CLOCK_CELL_0_ENABLE;
-		cc |= enable * CTRL_CLOCK_CELL_0_ENABLE;
-		out_le32(&c->controlregs->cell_control, cc);
+		if (enable)
+			MACIO_BIS(KEYLARGO_FCR1, KL1_I2S0_CELL_ENABLE);
+		else
+			MACIO_BIC(KEYLARGO_FCR1, KL1_I2S0_CELL_ENABLE);
 		break;
 	case 1:
-		cc = in_le32(&c->controlregs->cell_control);
-		cc &= ~CTRL_CLOCK_CELL_1_ENABLE;
-		cc |= enable * CTRL_CLOCK_CELL_1_ENABLE;
-		out_le32(&c->controlregs->cell_control, cc);
+		if (enable)
+			MACIO_BIS(KEYLARGO_FCR1, KL1_I2S1_CELL_ENABLE);
+		else
+			MACIO_BIC(KEYLARGO_FCR1, KL1_I2S1_CELL_ENABLE);
 		break;
 	default:
 		return -ENODEV;
@@ -157,7 +152,7 @@ int i2sbus_control_clock(struct i2sbus_c
 			 int enable)
 {
 	struct pmf_args args = { .count = 0 };
-	int cc;
+	struct macio_chip *macio = c->macio;
 
 	switch (enable) {
 	case 0:
@@ -172,18 +167,22 @@ int i2sbus_control_clock(struct i2sbus_c
 		printk(KERN_ERR "i2sbus: INVALID CLOCK ENABLE VALUE\n");
 		return -ENODEV;
 	}
+
+	printk("i2sbus_control_clock fallback\n");
+	if (macio == NULL || macio->base == NULL)
+		return -ENODEV;
 	switch (i2sdev->bus_number) {
 	case 0:
-		cc = in_le32(&c->controlregs->cell_control);
-		cc &= ~CTRL_CLOCK_CLOCK_0_ENABLE;
-		cc |= enable * CTRL_CLOCK_CLOCK_0_ENABLE;
-		out_le32(&c->controlregs->cell_control, cc);
+		if (enable)
+			MACIO_BIS(KEYLARGO_FCR1, KL1_I2S0_CLK_ENABLE_BIT);
+		else
+			MACIO_BIC(KEYLARGO_FCR1, KL1_I2S0_CLK_ENABLE_BIT);
 		break;
 	case 1:
-		cc = in_le32(&c->controlregs->cell_control);
-		cc &= ~CTRL_CLOCK_CLOCK_1_ENABLE;
-		cc |= enable * CTRL_CLOCK_CLOCK_1_ENABLE;
-		out_le32(&c->controlregs->cell_control, cc);
+		if (enable)
+			MACIO_BIS(KEYLARGO_FCR1, KL1_I2S1_CLK_ENABLE_BIT);
+		else
+			MACIO_BIC(KEYLARGO_FCR1, KL1_I2S1_CLK_ENABLE_BIT);
 		break;
 	default:
 		return -ENODEV;
Index: linux-snd-aoa/sound/aoa/soundbus/i2sbus/i2sbus-control.h
===================================================================
--- linux-snd-aoa.orig/sound/aoa/soundbus/i2sbus/i2sbus-control.h	2006-06-26 12:29:38.000000000 +1000
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,37 +0,0 @@
-/*
- * i2sbus driver -- bus register definitions
- *
- * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
- *
- * GPL v2, can be found in COPYING.
- */
-#ifndef __I2SBUS_CONTROLREGS_H
-#define __I2SBUS_CONTROLREGS_H
-
-/* i2s control registers, at least what we know about them */
-
-#define __PAD(m,n) u8 __pad##m[n]
-#define _PAD(line, n) __PAD(line, n)
-#define PAD(n) _PAD(__LINE__, (n))
-struct i2s_control_regs {
-	PAD(0x38);
-	__le32 fcr0;		/* 0x38 (unknown) */
-	__le32 cell_control;	/* 0x3c (fcr1) */
-	__le32 fcr2;		/* 0x40 (unknown) */
-	__le32 fcr3;		/* 0x44 (fcr3) */
-	__le32 clock_control;	/* 0x48 (unknown) */
-	PAD(4);
-	/* total size: 0x50 bytes */
-}  __attribute__((__packed__));
-
-#define CTRL_CLOCK_CELL_0_ENABLE	(1<<10)
-#define CTRL_CLOCK_CLOCK_0_ENABLE	(1<<12)
-#define CTRL_CLOCK_SWRESET_0		(1<<11)
-#define CTRL_CLOCK_INTF_0_ENABLE	(1<<13)
-
-#define CTRL_CLOCK_CELL_1_ENABLE	(1<<17)
-#define CTRL_CLOCK_CLOCK_1_ENABLE	(1<<18)
-#define CTRL_CLOCK_SWRESET_1		(1<<19)
-#define CTRL_CLOCK_INTF_1_ENABLE	(1<<20)
-
-#endif /* __I2SBUS_CONTROLREGS_H */
Index: linux-snd-aoa/sound/aoa/Makefile
===================================================================
--- linux-snd-aoa.orig/sound/aoa/Makefile	2006-06-26 12:29:38.000000000 +1000
+++ linux-snd-aoa/sound/aoa/Makefile	2006-06-28 15:51:55.000000000 +1000
@@ -1,4 +1,4 @@
 obj-$(CONFIG_SND_AOA) += core/
+obj-$(CONFIG_SND_AOA_SOUNDBUS) += soundbus/
 obj-$(CONFIG_SND_AOA) += codecs/
 obj-$(CONFIG_SND_AOA) += fabrics/
-obj-$(CONFIG_SND_AOA_SOUNDBUS) += soundbus/
Index: linux-snd-aoa/sound/aoa/codecs/snd-aoa-codec-onyx.c
===================================================================
--- linux-snd-aoa.orig/sound/aoa/codecs/snd-aoa-codec-onyx.c	2006-06-26 12:29:38.000000000 +1000
+++ linux-snd-aoa/sound/aoa/codecs/snd-aoa-codec-onyx.c	2006-06-28 15:37:17.000000000 +1000
@@ -1080,6 +1080,7 @@ static int onyx_i2c_detach(struct i2c_cl
 	struct onyx *onyx = container_of(client, struct onyx, i2c);
 	int err;
 
+	printk("onyx_i2c_detach...\n");
 	if ((err = i2c_detach_client(client)))
 		return err;
 	aoa_codec_unregister(&onyx->codec);
Index: linux-snd-aoa/sound/aoa/soundbus/core.c
===================================================================
--- linux-snd-aoa.orig/sound/aoa/soundbus/core.c	2006-06-26 12:29:38.000000000 +1000
+++ linux-snd-aoa/sound/aoa/soundbus/core.c	2006-06-28 16:00:35.000000000 +1000
@@ -194,16 +194,6 @@ static struct bus_type soundbus_bus_type
 	.dev_attrs	= soundbus_dev_attrs,
 };
 
-static int __init soundbus_init(void)
-{
-	return bus_register(&soundbus_bus_type);
-}
-
-static void __exit soundbus_exit(void)
-{
-	bus_unregister(&soundbus_bus_type);
-}
-
 int soundbus_add_one(struct soundbus_dev *dev)
 {
 	static int devcount;
@@ -246,5 +236,15 @@ void soundbus_unregister_driver(struct s
 }
 EXPORT_SYMBOL_GPL(soundbus_unregister_driver);
 
-module_init(soundbus_init);
+static int __init soundbus_init(void)
+{
+	return bus_register(&soundbus_bus_type);
+}
+
+static void __exit soundbus_exit(void)
+{
+	bus_unregister(&soundbus_bus_type);
+}
+
+subsys_initcall(soundbus_init);
 module_exit(soundbus_exit);

^ permalink raw reply

* Re: how to get individual patches
From: Alex Zeffertt @ 2006-06-28  8:32 UTC (permalink / raw)
  To: dhlii, linuxppc-embedded
In-Reply-To: <44A23488.7030606@dlasys.net>

David H. Lynch Jr. wrote:
>     The bsp I am working on works with 2.6.16.21 but fails with 2.6.17.
>    
>     How can I find the individual patches that make up the transition
> from 2.6.16.21 to 2.6.17 ?
> 
>     I guess I can use interdiff to create single patch to go from
> 2.6.16.21 to 2.6.17 but I am really looking to get all the individual
> patches so I can try to isolate exactly
>     what is giving me trouble.
> 

For diffs of individual files between official kernel releases you can
use

	http://www.linuxhq.com/kernel/

It's really good!

Alex

^ permalink raw reply

* Re: how to get individual patches
From: Grant Likely @ 2006-06-28  9:09 UTC (permalink / raw)
  To: dhlii; +Cc: linuxppc-embedded
In-Reply-To: <44A23488.7030606@dlasys.net>

On 6/28/06, David H. Lynch Jr. <dhlii@dlasys.net> wrote:
>
>     The bsp I am working on works with 2.6.16.21 but fails with 2.6.17.
>
>     How can I find the individual patches that make up the transition
> from 2.6.16.21 to 2.6.17 ?

Unfortunately, there isn't a direct line between .16.21 and .17 which
makes it complicated.  Does your bsp work with .16?  If so; you can
use the 'git bisect' command to figure out exactly where the
regression occured.

If it doesn't work on .16; you can do a bisect between .16 and .16.21
to figure out what patch is missing between .16 and .17.

$ git bisect good v2.6.16
$ git bisect bad           # the head of the tree
compile, test, etc.
$ git bisect good|bad    # depends on whether it works or not
compile, test, etc
$ git bisect good|bad    # you get the idea... repeat until it's narrowed down
$ git log                          # see where you are in the git tree.

Cheers,
g.

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

^ permalink raw reply

* [PATCH] powerpc: Do a bit more cpu init cleanups (v3)
From: Olof Johansson @ 2006-06-28  9:30 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20060628043822.GE5130@pb15.lixom.net>

Last patch had two problems:

* cur_cpu_spec isn't available that early for processors that are
  started from prom_init, so call it after release instead of before
* Fumbled with the assembly

It's a wonder that it booted on powermac (which it did).

New version below:




Cleanup CPU inits a bit more, Geoff Levand already did some earlier.

* Rename cpu_setup_power4.S to cpu_setup_ppc970.S
* Move CPU state save to cpu_setup, since cpu_setup is only ever done
  on cpu 0 on 64-bit and save is never done more than once.
* Rename __restore_cpu_setup to __restore_cpu_ppc970 and add
  function pointers to the cputable to use instead. Powermac always
  has 970 so no need to check there. Call it a bit later so we have
  cputables set up properly.
* Rename __970_cpu_preinit to __cpu_preinit_ppc970 and check PVR before
  calling it instead of in it, it's too early to use cputable.
* Rename pSeries_secondary_smp_init to generic_secondary_smp_init since
  everyone but powermac and iSeries use it.


Signed-off-by: Olof Johansson <olof@lixom.net>


Index: linux-2.6/arch/powerpc/kernel/Makefile
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/Makefile
+++ linux-2.6/arch/powerpc/kernel/Makefile
@@ -16,7 +16,7 @@ obj-y				:= semaphore.o cputable.o ptrac
 obj-y				+= vdso32/
 obj-$(CONFIG_PPC64)		+= setup_64.o binfmt_elf32.o sys_ppc32.o \
 				   signal_64.o ptrace32.o \
-				   paca.o cpu_setup_power4.o \
+				   paca.o cpu_setup_ppc970.o \
 				   firmware.o sysfs.o
 obj-$(CONFIG_PPC64)		+= vdso64/
 obj-$(CONFIG_ALTIVEC)		+= vecemu.o vector.o
Index: linux-2.6/arch/powerpc/kernel/cpu_setup_power4.S
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/cpu_setup_power4.S
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * This file contains low level CPU setup functions.
- *    Copyright (C) 2003 Benjamin Herrenschmidt (benh@kernel.crashing.org)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- *
- */
-
-#include <linux/config.h>
-#include <asm/processor.h>
-#include <asm/page.h>
-#include <asm/cputable.h>
-#include <asm/ppc_asm.h>
-#include <asm/asm-offsets.h>
-#include <asm/cache.h>
-
-_GLOBAL(__970_cpu_preinit)
-	/*
-	 * Do nothing if not running in HV mode
-	 */
-	mfmsr	r0
-	rldicl.	r0,r0,4,63
-	beqlr
-
-	/*
-	 * Deal only with PPC970 and PPC970FX.
-	 */
-	mfspr	r0,SPRN_PVR
-	srwi	r0,r0,16
-	cmpwi	r0,0x39
-	beq	1f
-	cmpwi	r0,0x3c
-	beq	1f
-	cmpwi	r0,0x44
-	bnelr
-1:
-
-	/* Make sure HID4:rm_ci is off before MMU is turned off, that large
-	 * pages are enabled with HID4:61 and clear HID5:DCBZ_size and
-	 * HID5:DCBZ32_ill
-	 */
-	li	r0,0
-	mfspr	r3,SPRN_HID4
-	rldimi	r3,r0,40,23	/* clear bit 23 (rm_ci) */
-	rldimi	r3,r0,2,61	/* clear bit 61 (lg_pg_en) */
-	sync
-	mtspr	SPRN_HID4,r3
-	isync
-	sync
-	mfspr	r3,SPRN_HID5
-	rldimi	r3,r0,6,56	/* clear bits 56 & 57 (DCBZ*) */
-	sync
-	mtspr	SPRN_HID5,r3
-	isync
-	sync
-
-	/* Setup some basic HID1 features */
-	mfspr	r0,SPRN_HID1
-	li	r3,0x1200		/* enable i-fetch cacheability */
-	sldi	r3,r3,44		/* and prefetch */
-	or	r0,r0,r3
-	mtspr	SPRN_HID1,r0
-	mtspr	SPRN_HID1,r0
-	isync
-
-	/* Clear HIOR */
-	li	r0,0
-	sync
-	mtspr	SPRN_HIOR,0		/* Clear interrupt prefix */
-	isync
-	blr
-
-_GLOBAL(__setup_cpu_ppc970)
-	mfspr	r0,SPRN_HID0
-	li	r11,5			/* clear DOZE and SLEEP */
-	rldimi	r0,r11,52,8		/* set NAP and DPM */
-	mtspr	SPRN_HID0,r0
-	mfspr	r0,SPRN_HID0
-	mfspr	r0,SPRN_HID0
-	mfspr	r0,SPRN_HID0
-	mfspr	r0,SPRN_HID0
-	mfspr	r0,SPRN_HID0
-	mfspr	r0,SPRN_HID0
-	sync
-	isync
-	blr
-
-/* Definitions for the table use to save CPU states */
-#define CS_HID0		0
-#define CS_HID1		8
-#define	CS_HID4		16
-#define CS_HID5		24
-#define CS_SIZE		32
-
-	.data
-	.balign	L1_CACHE_BYTES,0
-cpu_state_storage:
-	.space	CS_SIZE
-	.balign	L1_CACHE_BYTES,0
-	.text
-
-/* Called in normal context to backup CPU 0 state. This
- * does not include cache settings. This function is also
- * called for machine sleep. This does not include the MMU
- * setup, BATs, etc... but rather the "special" registers
- * like HID0, HID1, HID4, etc...
- */
-_GLOBAL(__save_cpu_setup)
-	/* Some CR fields are volatile, we back it up all */
-	mfcr	r7
-
-	/* Get storage ptr */
-	LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
-
-	/* We only deal with 970 for now */
-	mfspr	r0,SPRN_PVR
-	srwi	r0,r0,16
-	cmpwi	r0,0x39
-	beq	1f
-	cmpwi	r0,0x3c
-	beq	1f
-	cmpwi	r0,0x44
-	bne	2f
-
-1:	/* Save HID0,1,4 and 5 */
-	mfspr	r3,SPRN_HID0
-	std	r3,CS_HID0(r5)
-	mfspr	r3,SPRN_HID1
-	std	r3,CS_HID1(r5)
-	mfspr	r3,SPRN_HID4
-	std	r3,CS_HID4(r5)
-	mfspr	r3,SPRN_HID5
-	std	r3,CS_HID5(r5)
-
-2:
-	mtcr	r7
-	blr
-
-/* Called with no MMU context (typically MSR:IR/DR off) to
- * restore CPU state as backed up by the previous
- * function. This does not include cache setting
- */
-_GLOBAL(__restore_cpu_setup)
-	/* Get storage ptr (FIXME when using anton reloc as we
-	 * are running with translation disabled here
-	 */
-	LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
-
-	/* We only deal with 970 for now */
-	mfspr	r0,SPRN_PVR
-	srwi	r0,r0,16
-	cmpwi	r0,0x39
-	beq	1f
-	cmpwi	r0,0x3c
-	beq	1f
-	cmpwi	r0,0x44
-	bnelr
-
-1:	/* Before accessing memory, we make sure rm_ci is clear */
-	li	r0,0
-	mfspr	r3,SPRN_HID4
-	rldimi	r3,r0,40,23	/* clear bit 23 (rm_ci) */
-	sync
-	mtspr	SPRN_HID4,r3
-	isync
-	sync
-
-	/* Clear interrupt prefix */
-	li	r0,0
-	sync
-	mtspr	SPRN_HIOR,0
-	isync
-
-	/* Restore HID0 */
-	ld	r3,CS_HID0(r5)
-	sync
-	isync
-	mtspr	SPRN_HID0,r3
-	mfspr	r3,SPRN_HID0
-	mfspr	r3,SPRN_HID0
-	mfspr	r3,SPRN_HID0
-	mfspr	r3,SPRN_HID0
-	mfspr	r3,SPRN_HID0
-	mfspr	r3,SPRN_HID0
-	sync
-	isync
-
-	/* Restore HID1 */
-	ld	r3,CS_HID1(r5)
-	sync
-	isync
-	mtspr	SPRN_HID1,r3
-	mtspr	SPRN_HID1,r3
-	sync
-	isync
-
-	/* Restore HID4 */
-	ld	r3,CS_HID4(r5)
-	sync
-	isync
-	mtspr	SPRN_HID4,r3
-	sync
-	isync
-
-	/* Restore HID5 */
-	ld	r3,CS_HID5(r5)
-	sync
-	isync
-	mtspr	SPRN_HID5,r3
-	sync
-	isync
-	blr
-
Index: linux-2.6/arch/powerpc/kernel/cpu_setup_ppc970.S
===================================================================
--- /dev/null
+++ linux-2.6/arch/powerpc/kernel/cpu_setup_ppc970.S
@@ -0,0 +1,175 @@
+/*
+ * This file contains low level CPU setup functions.
+ *    Copyright (C) 2003 Benjamin Herrenschmidt (benh@kernel.crashing.org)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ */
+
+#include <linux/config.h>
+#include <asm/processor.h>
+#include <asm/page.h>
+#include <asm/cputable.h>
+#include <asm/ppc_asm.h>
+#include <asm/asm-offsets.h>
+#include <asm/cache.h>
+
+_GLOBAL(__cpu_preinit_ppc970)
+	/* Do nothing if not running in HV mode */
+	mfmsr	r0
+	rldicl.	r0,r0,4,63
+	beqlr
+
+	/* Make sure HID4:rm_ci is off before MMU is turned off, that large
+	 * pages are enabled with HID4:61 and clear HID5:DCBZ_size and
+	 * HID5:DCBZ32_ill
+	 */
+	li	r0,0
+	mfspr	r3,SPRN_HID4
+	rldimi	r3,r0,40,23	/* clear bit 23 (rm_ci) */
+	rldimi	r3,r0,2,61	/* clear bit 61 (lg_pg_en) */
+	sync
+	mtspr	SPRN_HID4,r3
+	isync
+	sync
+	mfspr	r3,SPRN_HID5
+	rldimi	r3,r0,6,56	/* clear bits 56 & 57 (DCBZ*) */
+	sync
+	mtspr	SPRN_HID5,r3
+	isync
+	sync
+
+	/* Setup some basic HID1 features */
+	mfspr	r0,SPRN_HID1
+	li	r3,0x1200		/* enable i-fetch cacheability */
+	sldi	r3,r3,44		/* and prefetch */
+	or	r0,r0,r3
+	mtspr	SPRN_HID1,r0
+	mtspr	SPRN_HID1,r0
+	isync
+
+	/* Clear HIOR */
+	li	r0,0
+	sync
+	mtspr	SPRN_HIOR,0		/* Clear interrupt prefix */
+	isync
+	blr
+
+/* Definitions for the table use to save CPU states */
+#define CS_HID0		0
+#define CS_HID1		8
+#define	CS_HID4		16
+#define CS_HID5		24
+#define CS_SIZE		32
+
+	.data
+	.balign	L1_CACHE_BYTES,0
+cpu_state_storage:
+	.space	CS_SIZE
+	.balign	L1_CACHE_BYTES,0
+	.text
+
+
+_GLOBAL(__setup_cpu_ppc970)
+	/* Do nothing if not running in HV mode */
+	mfmsr	r0
+	rldicl.	r0,r0,4,63
+	beqlr
+
+	mfspr	r0,SPRN_HID0
+	li	r11,5			/* clear DOZE and SLEEP */
+	rldimi	r0,r11,52,8		/* set NAP and DPM */
+	mtspr	SPRN_HID0,r0
+	mfspr	r0,SPRN_HID0
+	mfspr	r0,SPRN_HID0
+	mfspr	r0,SPRN_HID0
+	mfspr	r0,SPRN_HID0
+	mfspr	r0,SPRN_HID0
+	mfspr	r0,SPRN_HID0
+	sync
+	isync
+
+	/* Save away cpu state */
+	LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
+
+	/* Save HID0,1,4 and 5 */
+	mfspr	r3,SPRN_HID0
+	std	r3,CS_HID0(r5)
+	mfspr	r3,SPRN_HID1
+	std	r3,CS_HID1(r5)
+	mfspr	r3,SPRN_HID4
+	std	r3,CS_HID4(r5)
+	mfspr	r3,SPRN_HID5
+	std	r3,CS_HID5(r5)
+
+	blr
+
+/* Called with no MMU context (typically MSR:IR/DR off) to
+ * restore CPU state as backed up by the previous
+ * function. This does not include cache setting
+ */
+_GLOBAL(__restore_cpu_ppc970)
+	/* Do nothing if not running in HV mode */
+	mfmsr	r0
+	rldicl.	r0,r0,4,63
+	beqlr
+
+	LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
+	/* Before accessing memory, we make sure rm_ci is clear */
+	li	r0,0
+	mfspr	r3,SPRN_HID4
+	rldimi	r3,r0,40,23	/* clear bit 23 (rm_ci) */
+	sync
+	mtspr	SPRN_HID4,r3
+	isync
+	sync
+
+	/* Clear interrupt prefix */
+	li	r0,0
+	sync
+	mtspr	SPRN_HIOR,0
+	isync
+
+	/* Restore HID0 */
+	ld	r3,CS_HID0(r5)
+	sync
+	isync
+	mtspr	SPRN_HID0,r3
+	mfspr	r3,SPRN_HID0
+	mfspr	r3,SPRN_HID0
+	mfspr	r3,SPRN_HID0
+	mfspr	r3,SPRN_HID0
+	mfspr	r3,SPRN_HID0
+	mfspr	r3,SPRN_HID0
+	sync
+	isync
+
+	/* Restore HID1 */
+	ld	r3,CS_HID1(r5)
+	sync
+	isync
+	mtspr	SPRN_HID1,r3
+	mtspr	SPRN_HID1,r3
+	sync
+	isync
+
+	/* Restore HID4 */
+	ld	r3,CS_HID4(r5)
+	sync
+	isync
+	mtspr	SPRN_HID4,r3
+	sync
+	isync
+
+	/* Restore HID5 */
+	ld	r3,CS_HID5(r5)
+	sync
+	isync
+	mtspr	SPRN_HID5,r3
+	sync
+	isync
+	blr
+
Index: linux-2.6/arch/powerpc/kernel/head_64.S
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/head_64.S
+++ linux-2.6/arch/powerpc/kernel/head_64.S
@@ -152,7 +152,7 @@ _GLOBAL(__secondary_hold)
 	bne	100b
 
 #if defined(CONFIG_SMP) || defined(CONFIG_KEXEC)
-	LOAD_REG_IMMEDIATE(r4, .pSeries_secondary_smp_init)
+	LOAD_REG_IMMEDIATE(r4, .generic_secondary_smp_init)
 	mtctr	r4
 	mr	r3,r24
 	bctr
@@ -1473,19 +1473,17 @@ fwnmi_data_area:
         . = 0x8000
 
 /*
- * On pSeries, secondary processors spin in the following code.
+ * On pSeries and most other platforms, secondary processors spin
+ * in the following code.
  * At entry, r3 = this processor's number (physical cpu id)
  */
-_GLOBAL(pSeries_secondary_smp_init)
+_GLOBAL(generic_secondary_smp_init)
 	mr	r24,r3
 	
 	/* turn on 64-bit mode */
 	bl	.enable_64b_mode
 	isync
 
-	/* Copy some CPU settings from CPU 0 */
-	bl	.__restore_cpu_setup
-
 	/* Set up a paca value for this processor. Since we have the
 	 * physical cpu id in r24, we need to search the pacas to find
 	 * which logical id maps to our physical one.
@@ -1511,15 +1509,28 @@ _GLOBAL(pSeries_secondary_smp_init)
 					/* start.			 */
 	sync
 
-	/* Create a temp kernel stack for use before relocation is on.	*/
+#ifndef CONFIG_SMP
+	b	3b			/* Never go on non-SMP		 */
+#else
+	cmpwi	0,r23,0
+	beq	3b			/* Loop until told to go	 */
+
+	/* See if we need to call a cpu state restore handler */
+	LOAD_REG_IMMEDIATE(r23, cur_cpu_spec)
+	ld	r23,0(r23)
+	ld	r23,CPU_SPEC_RESTORE(r23)
+	cmpdi	0,r23,0
+	beq	4f
+	ld	r23,0(r23)
+	mtctr	r23
+	bctrl
+
+4:	/* Create a temp kernel stack for use before relocation is on.	*/
 	ld	r1,PACAEMERGSP(r13)
 	subi	r1,r1,STACK_FRAME_OVERHEAD
 
-	cmpwi	0,r23,0
-#ifdef CONFIG_SMP
-	bne	.__secondary_start
+	b	.__secondary_start
 #endif
-	b 	3b			/* Loop until told to go	 */
 
 #ifdef CONFIG_PPC_ISERIES
 _STATIC(__start_initialization_iSeries)
@@ -1600,7 +1611,16 @@ _GLOBAL(__start_initialization_multiplat
 	bl	.enable_64b_mode
 
 	/* Setup some critical 970 SPRs before switching MMU off */
-	bl	.__970_cpu_preinit
+	mfspr	r0,SPRN_PVR
+	srwi	r0,r0,16
+	cmpwi	r0,0x39		/* 970 */
+	beq	1f
+	cmpwi	r0,0x3c		/* 970FX */
+	beq	1f
+	cmpwi	r0,0x44		/* 970MP */
+	bne	2f
+1:	bl	.__cpu_preinit_ppc970
+2:
 
 	/* cpu # */
 	li	r24,0
@@ -1771,7 +1791,7 @@ _GLOBAL(pmac_secondary_start)
 	isync
 
 	/* Copy some CPU settings from CPU 0 */
-	bl	.__restore_cpu_setup
+	bl	.__restore_cpu_ppc970
 
 	/* pSeries do that early though I don't think we really need it */
 	mfmsr	r3
@@ -1921,12 +1941,6 @@ _STATIC(start_here_multiplatform)
 	mr	r5,r26
 	bl	.identify_cpu
 
-	/* Save some low level config HIDs of CPU0 to be copied to
-	 * other CPUs later on, or used for suspend/resume
-	 */
-	bl	.__save_cpu_setup
-	sync
-
 	/* Do very early kernel initializations, including initial hash table,
 	 * stab and slb setup before we turn on relocation.	*/
 
Index: linux-2.6/arch/powerpc/platforms/cell/smp.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/smp.c
+++ linux-2.6/arch/powerpc/platforms/cell/smp.c
@@ -58,7 +58,7 @@
  */
 static cpumask_t of_spin_map;
 
-extern void pSeries_secondary_smp_init(unsigned long);
+extern void generic_secondary_smp_init(unsigned long);
 
 /**
  * smp_startup_cpu() - start the given cpu
@@ -75,7 +75,7 @@ static inline int __devinit smp_startup_
 {
 	int status;
 	unsigned long start_here = __pa((u32)*((unsigned long *)
-					       pSeries_secondary_smp_init));
+					       generic_secondary_smp_init));
 	unsigned int pcpu;
 	int start_cpu;
 
Index: linux-2.6/arch/powerpc/platforms/pseries/smp.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/pseries/smp.c
+++ linux-2.6/arch/powerpc/platforms/pseries/smp.c
@@ -63,7 +63,7 @@
  */
 static cpumask_t of_spin_map;
 
-extern void pSeries_secondary_smp_init(unsigned long);
+extern void generic_secondary_smp_init(unsigned long);
 
 #ifdef CONFIG_HOTPLUG_CPU
 
@@ -271,7 +271,7 @@ static inline int __devinit smp_startup_
 {
 	int status;
 	unsigned long start_here = __pa((u32)*((unsigned long *)
-					       pSeries_secondary_smp_init));
+					       generic_secondary_smp_init));
 	unsigned int pcpu;
 	int start_cpu;
 
Index: linux-2.6/arch/powerpc/kernel/asm-offsets.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/asm-offsets.c
+++ linux-2.6/arch/powerpc/kernel/asm-offsets.c
@@ -241,6 +241,7 @@ int main(void)
 	DEFINE(CPU_SPEC_PVR_VALUE, offsetof(struct cpu_spec, pvr_value));
 	DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features));
 	DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup));
+	DEFINE(CPU_SPEC_RESTORE, offsetof(struct cpu_spec, cpu_restore));
 
 #ifndef CONFIG_PPC64
 	DEFINE(pbe_address, offsetof(struct pbe, address));
Index: linux-2.6/arch/powerpc/kernel/cputable.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/cputable.c
+++ linux-2.6/arch/powerpc/kernel/cputable.c
@@ -40,7 +40,10 @@ extern void __setup_cpu_7400(unsigned lo
 extern void __setup_cpu_7410(unsigned long offset, struct cpu_spec* spec);
 extern void __setup_cpu_745x(unsigned long offset, struct cpu_spec* spec);
 #endif /* CONFIG_PPC32 */
+#ifdef CONFIG_PPC64
 extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec);
+extern void __restore_cpu_ppc970(void);
+#endif /* CONFIG_PPC64 */
 
 /* This table only contains "desktop" CPUs, it need to be filled with embedded
  * ones as well...
@@ -185,6 +188,7 @@ struct cpu_spec	cpu_specs[] = {
 		.dcache_bsize		= 128,
 		.num_pmcs		= 8,
 		.cpu_setup		= __setup_cpu_ppc970,
+		.cpu_restore		= __restore_cpu_ppc970,
 		.oprofile_cpu_type	= "ppc64/970",
 		.oprofile_type		= PPC_OPROFILE_POWER4,
 		.platform		= "ppc970",
@@ -200,6 +204,7 @@ struct cpu_spec	cpu_specs[] = {
 		.dcache_bsize		= 128,
 		.num_pmcs		= 8,
 		.cpu_setup		= __setup_cpu_ppc970,
+		.cpu_restore		= __restore_cpu_ppc970,
 		.oprofile_cpu_type	= "ppc64/970",
 		.oprofile_type		= PPC_OPROFILE_POWER4,
 		.platform		= "ppc970",
@@ -215,6 +220,7 @@ struct cpu_spec	cpu_specs[] = {
 		.dcache_bsize		= 128,
 		.num_pmcs		= 8,
 		.cpu_setup		= __setup_cpu_ppc970,
+		.cpu_restore		= __restore_cpu_ppc970,
 		.oprofile_cpu_type	= "ppc64/970",
 		.oprofile_type		= PPC_OPROFILE_POWER4,
 		.platform		= "ppc970",
Index: linux-2.6/include/asm-powerpc/cputable.h
===================================================================
--- linux-2.6.orig/include/asm-powerpc/cputable.h
+++ linux-2.6/include/asm-powerpc/cputable.h
@@ -36,6 +36,7 @@
 struct cpu_spec;
 
 typedef	void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec);
+typedef	void (*cpu_restore_t)(void);
 
 enum powerpc_oprofile_type {
 	PPC_OPROFILE_INVALID = 0,
@@ -65,6 +66,8 @@ struct cpu_spec {
 	 * BHT, SPD, etc... from head.S before branching to identify_machine
 	 */
 	cpu_setup_t	cpu_setup;
+	/* Used to restore cpu setup on secondary processors and at resume */
+	cpu_restore_t	cpu_restore;
 
 	/* Used by oprofile userspace to select the right counters */
 	char		*oprofile_cpu_type;

^ permalink raw reply

* Re: [PATCH] convert powermac ide blink to new led infrastructure
From: Johannes Berg @ 2006-06-28  9:43 UTC (permalink / raw)
  To: Richard Purdie; +Cc: linuxppc-dev list
In-Reply-To: <1151487483.15913.11.camel@localhost.localdomain>

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

Richard,

Thanks for the explanation. I'll respin the patch to implement caching.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 793 bytes --]

^ permalink raw reply

* [PATCH] powerpc: U4 DART improvements
From: Olof Johansson @ 2006-06-28  9:50 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

Better late than never...

Respin based on previous comment. Only remaining issue last time was an
extra mb() that I've taken out.


---

Implement single-entry TLB invalidations in the U4 DART.

Simple benchmarking with loopback flood pings of various sizes show that
the previous flush-all code will spend ~5% of the time in flush, while
the new selective invalidations will spend about an order of magnitude
less in the same code path.

This could possibly mean that invalidations larger than, say, 16
entries would better be handled in bulk, but until we have a workload
that actually shows problems or bottlenecks let's keep doing single
invalidations at all mapping sizes.

Signed-off-by: Olof Johansson <olof@lixom.net>


Index: linux-2.6/arch/powerpc/sysdev/dart.h
===================================================================
--- linux-2.6.orig/arch/powerpc/sysdev/dart.h
+++ linux-2.6/arch/powerpc/sysdev/dart.h
@@ -47,8 +47,12 @@
 /* U4 registers */
 #define DART_BASE_U4_BASE_MASK	0xffffff
 #define DART_BASE_U4_BASE_SHIFT	0
-#define DART_CNTL_U4_FLUSHTLB	0x20000000
 #define DART_CNTL_U4_ENABLE	0x80000000
+#define DART_CNTL_U4_IONE	0x40000000
+#define DART_CNTL_U4_FLUSHTLB	0x20000000
+#define DART_CNTL_U4_IDLE	0x10000000
+#define DART_CNTL_U4_PAR_EN	0x08000000
+#define DART_CNTL_U4_IONE_MASK	0x07ffffff
 #define DART_SIZE_U4_SIZE_MASK	0x1fff
 #define DART_SIZE_U4_SIZE_SHIFT	0
 
Index: linux-2.6/arch/powerpc/sysdev/dart_iommu.c
===================================================================
--- linux-2.6.orig/arch/powerpc/sysdev/dart_iommu.c
+++ linux-2.6/arch/powerpc/sysdev/dart_iommu.c
@@ -101,8 +101,8 @@ retry:
 	if (l == (1L << limit)) {
 		if (limit < 4) {
 			limit++;
-		        reg = DART_IN(DART_CNTL);
-		        reg &= ~inv_bit;
+			reg = DART_IN(DART_CNTL);
+			reg &= ~inv_bit;
 			DART_OUT(DART_CNTL, reg);
 			goto retry;
 		} else
@@ -111,11 +111,39 @@ retry:
 	}
 }
 
+static inline void dart_tlb_invalidate_one(unsigned long bus_rpn)
+{
+	unsigned int reg;
+	unsigned int l, limit;
+
+	reg = DART_CNTL_U4_ENABLE | DART_CNTL_U4_IONE |
+		(bus_rpn & DART_CNTL_U4_IONE_MASK);
+	DART_OUT(DART_CNTL, reg);
+
+	limit = 0;
+wait_more:
+	l = 0;
+	while ((DART_IN(DART_CNTL) & DART_CNTL_U4_IONE) && l < (1L << limit)) {
+		rmb();
+		l++;
+	}
+
+	if (l == (1L << limit)) {
+		if (limit < 4) {
+			limit++;
+			goto wait_more;
+		} else
+			panic("DART: TLB did not flush after waiting a long "
+			      "time. Buggy U4 ?");
+	}
+}
+
 static void dart_flush(struct iommu_table *tbl)
 {
-	if (dart_dirty)
+	if (dart_dirty) {
 		dart_tlb_invalidate_all();
-	dart_dirty = 0;
+		dart_dirty = 0;
+	}
 }
 
 static void dart_build(struct iommu_table *tbl, long index,
@@ -124,6 +152,7 @@ static void dart_build(struct iommu_tabl
 {
 	unsigned int *dp;
 	unsigned int rpn;
+	long l;
 
 	DBG("dart: build at: %lx, %lx, addr: %x\n", index, npages, uaddr);
 
@@ -135,7 +164,8 @@ static void dart_build(struct iommu_tabl
 	/* On U3, all memory is contigous, so we can move this
 	 * out of the loop.
 	 */
-	while (npages--) {
+	l = npages;
+	while (l--) {
 		rpn = virt_to_abs(uaddr) >> DART_PAGE_SHIFT;
 
 		*(dp++) = DARTMAP_VALID | (rpn & DARTMAP_RPNMASK);
@@ -143,7 +173,14 @@ static void dart_build(struct iommu_tabl
 		uaddr += DART_PAGE_SIZE;
 	}
 
-	dart_dirty = 1;
+	if (dart_is_u4) {
+		rpn = index;
+		mb(); /* make sure all updates have reached memory */
+		while (npages--)
+			dart_tlb_invalidate_one(rpn++);
+	} else {
+		dart_dirty = 1;
+	}
 }
 
 

^ permalink raw reply

* Re: [PATCH] convert powermac ide blink to new led infrastructure
From: Richard Purdie @ 2006-06-28  9:38 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linuxppc-dev list
In-Reply-To: <1151429483.597.12.camel@localhost>

On Tue, 2006-06-27 at 19:31 +0200, Johannes Berg wrote:
> > Looks good. Only one nit: in pmu_led_set(), you should be able to test
> > if the requested state is identical to the current one and do nothing
> > without taking the lock no ?
> > 
> > Or does the upper level LED infrastructure takes care of it ?
> 
> I don't know, Richard? But yeah, I can do that too.

The core doesn't do that. In some cases setting the LED is easier and
cheaper than checking a cached value. If setting the LED state is
expensive, it would be simple enough to implement value caching in the
driver.

Part of the problem is also that we provide several values to the driver
(brightness, power, blanking, device specific parameters) and it needs
to combine those values in a way that is only meaningful to the specific
driver.

Richard

^ permalink raw reply

* MPC852T help me for: Oops: kernel access of bad area, sig: 11
From: SETTE AGOSTINO - technolabs @ 2006-06-28 10:01 UTC (permalink / raw)
  To: linuxppc-embedded

Dear,

Here is my problem,

Our environment is:

OS:       Linux-2.4.20
platform: MPC852T

Oops: kernel access of bad area, sig: 11
NIP: C000D440 XER: 00000000 LR: C00BB040 SP: C06BDE50 REGS: c06bdda0
TRAP: 0300    Tainted: P
MSR: 00009032 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 11
DAR: 0000205D, DSISR: 000000E4
TASK =3D c06bc000[181] 'L5420' Last syscall: 78
last math 00000000 last altivec 00000000
GPR00: 00000000 C06BDE50 C06BC000 C0D074E0 00002059 0000003C C0D074DC
00000007
GPR08: 00000001 0000003C 00000000 C0D07520 82004084 101B3AF8 3052816C
C3120000
GPR16: C311CB04 C311C8D8 C311C754 C0170000 C3120000 C311CB30 00000001
C0169DA0
GPR24: F0000E00 0000205D C0F58400 0000003C 00000040 C2080100 C0F58200
C0F50360
Call backtrace:
C00BAF8C C00BABC8 C0005848 C3119448 C3119918 C00047A8 100D8AC0
100D6718 100C370C 100674AC 100639E4 1005ED18 10042638 10010E28
1003AC34 1000DA34 100361EC 0FED34A4 0FED32D0 0FFCFEE4 0FD5F590
Kernel panic: Aiee, killing interrupt handler!
In interrupt handler - not syncing
 <0>Rebooting in 180 seconds..

How to debug and correct it? Plese help me!

Thanks a lot!
-------------------------------------------

Best Regards

Agostino Sette

^ permalink raw reply

* Re: 2.6.17-mm2
From: Andrew Morton @ 2006-06-28 10:42 UTC (permalink / raw)
  To: Martin J. Bligh, Jeremy Fitzhardinge
  Cc: linuxppc64-dev, linux-kernel, mbligh, mbligh
In-Reply-To: <44A150C9.7020809@mbligh.org>

On Tue, 27 Jun 2006 08:37:45 -0700
"Martin J. Bligh" <mbligh@mbligh.org> wrote:

> SMP NR_CPUS=32 NUMA
> Modules linked in:
> NIP: C0000000000A311C LR: C0000000000A30D4 CTR: C0000000000A3024
> REGS: c0000007725b38d0 TRAP: 0300   Not tainted  (2.6.17-mm3-autokern1)
> MSR: 8000000000001032 <ME,IR,DR>  CR: 28224424  XER: 00000000
> DAR: 000000077BCC6180, DSISR: 0000000040000000
> TASK = c00000002fc74670[29812] 'cp' THREAD: c0000007725b0000 CPU: 2
> GPR00: 0000000000000000 C0000007725B3B50 C00000000063B828 C00000001E303EC0
> GPR04: 0000000000000010 0000000000000000 0000000000000000 FFFFFFFFFFFFFFFD
> GPR08: 0000000000000001 0000000000000000 000000077BCC6180 0000000000000000
> GPR12: 0000000000000000 C00000000051FF80 0000000000000000 0000000000000001
> GPR16: 0000000000000000 0000000000000004 0000000000020000 0000000000000000
> GPR20: 0000000000000000 0000000000000000 C0000007759F9D00 0000000000000000
> GPR24: 0000000000000E42 0000000000000000 000000000000474A C00000001E30F300
> GPR28: 0000000000000000 0000000000000000 C000000000537288 C00000001E303E80
> NIP [C0000000000A311C] .s_show+0xf8/0x364
> LR [C0000000000A30D4] .s_show+0xb0/0x364
> Call Trace:
> [C0000007725B3B50] [C0000000000A3334] .s_show+0x310/0x364 (unreliable)
> [C0000007725B3C20] [C0000000000D5E84] .seq_read+0x2f4/0x450
> [C0000007725B3D00] [C0000000000AADF8] .vfs_read+0xe0/0x1b4
> [C0000007725B3D90] [C0000000000AAFD4] .sys_read+0x54/0x98
> [C0000007725B3E30] [C00000000000871C] syscall_exit+0x0/0x40

This is caused by the vsprintf() changes.  Right now, if you do

	snprintf(buf, 4, "1111111111111");

the memory at `buf' gets [31 31 31 31 00], which is not good.

This'll plug it, but I didn't check very hard whether it still has any
off-by-ones, or if breaks the intent of Jeremy's patch.  I think it's OK..

--- a/lib/vsprintf.c~c
+++ a/lib/vsprintf.c
@@ -259,7 +259,9 @@ int vsnprintf(char *buf, size_t size, co
 	int len;
 	unsigned long long num;
 	int i, base;
-	char *str, *end, c;
+	char *str;		/* Where we're writing to */
+	char *end;		/* The last byte we can write to */
+	char c;
 	const char *s;
 
 	int flags;		/* flags to number() */
@@ -283,12 +285,12 @@ int vsnprintf(char *buf, size_t size, co
 	}
 
 	str = buf;
-	end = buf + size;
+	end = buf + size - 1;
 
 	/* Make sure end is always >= buf */
-	if (end < buf) {
+	if (end < buf - 1) {
 		end = ((void *) ~0ull);
-		size = end - buf;
+		size = end - buf + 1;
 	}
 
 	for (; *fmt ; ++fmt) {
_

^ permalink raw reply

* Re: 2.6.17-mm2
From: Andrew Morton @ 2006-06-28 10:47 UTC (permalink / raw)
  To: mbligh, jeremy, mbligh, linux-kernel, apw, linuxppc64-dev
In-Reply-To: <20060628034215.c3008299.akpm@osdl.org>

On Wed, 28 Jun 2006 03:42:15 -0700
Andrew Morton <akpm@osdl.org> wrote:

> his is caused by the vsprintf() changes.  Right now, if you do
> 
> 	snprintf(buf, 4, "1111111111111");
> 
> the memory at `buf' gets [31 31 31 31 00], which is not good.
> 
> This'll plug it, but I didn't check very hard whether it still has any
> off-by-ones, or if breaks the intent of Jeremy's patch.  I think it's OK..

That diff was against an older kernel and doesn't apply.  This is against
mainline:

--- a/lib/vsprintf.c~vsnprintf-fix
+++ a/lib/vsprintf.c
@@ -259,7 +259,9 @@ int vsnprintf(char *buf, size_t size, co
 	int len;
 	unsigned long long num;
 	int i, base;
-	char *str, *end, c;
+	char *str;		/* Where we're writing to */
+	char *end;		/* The last byte we can write to */
+	char c;
 	const char *s;
 
 	int flags;		/* flags to number() */
@@ -283,12 +285,12 @@ int vsnprintf(char *buf, size_t size, co
 	}
 
 	str = buf;
-	end = buf + size;
+	end = buf + size - 1;
 
 	/* Make sure end is always >= buf */
-	if (end < buf) {
+	if (end < buf - 1) {
 		end = ((void *)-1);
-		size = end - buf;
+		size = end - buf + 1;
 	}
 
 	for (; *fmt ; ++fmt) {
@@ -494,7 +496,6 @@ int vsnprintf(char *buf, size_t size, co
 	/* the trailing null byte doesn't count towards the total */
 	return str-buf;
 }
-
 EXPORT_SYMBOL(vsnprintf);
 
 /**
_

^ permalink raw reply

* Re: [PATCH] powerpc: support ibm,extended-*-frequency properties
From: Segher Boessenkool @ 2006-06-28 11:15 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev, paulus, Anton Blanchard
In-Reply-To: <0107ED1F-B674-48C3-AA07-BDF9FD2F7678@kernel.crashing.org>

> Is it reasonable for cells to be greater than 1 on a 32-bit system?

Yes.


Segher

^ permalink raw reply

* Re: [PATCH] powerpc: support ibm,extended-*-frequency properties
From: Anton Blanchard @ 2006-06-28 11:28 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev, paulus
In-Reply-To: <D0B9DD42-E1D3-48E3-A90A-8F8B5718852F@kernel.crashing.org>

 
> Could you also allow the regular "timebase-frequency" property
> to consist of two cells, with the same semantics?  That's what
> some other systems do.  Hey, it'd simplify this code, if anything :-)
> 
> In fact, some kernel code already does this if I'm not mistaken
> (the Cell port, perhaps?)

Yeah it seems reasonable to just use the property size, I'll submit an
incremental patch for that.

Anton

^ 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