LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 0/2] RFC: Port Virtex-II Pro code to use the platform bus
From: Grant Likely @ 2005-09-11  6:57 UTC (permalink / raw)
  To: linuxppc-embedded
In-Reply-To: <528646bc0509100033167dae7f@mail.gmail.com>

BTW, I'll be out of town and computer-free until Sept. 19, so I won't
answer any comments until then.

Cheers,
g.

On 9/10/05, Grant Likely <glikely@gmail.com> wrote:
> Here is my work to date to bring the V2Pro port over to the platform
> bus.  I don't expect these to be accepted as-is, but I'm looking for
> comments before I get it polished.
>=20
> Should apply cleanly against 2.6.13 (but may require the TLB patch first)
> http://patchwork.ozlabs.org/linuxppc/patch?id=3D2058
>=20
> Patch 1: changes from the ML300 perspective.  I temporarly don't have
> access to an ML300 so this is untested (but it compiles).  Could
> somebody please test this for me?
>=20
> Patch 2: example patch for another V2PRO based board.  This isn't
> really acceptable for mainline because it's not based on a reference
> or published FPGA design, but it shows the work required to bring up
> another board.  It also shines some light on what code should be
> common between all V2Pro ports (which I'm working on).  This one runs
> on a 2VP4-FG456 eval board (pls ignore all the references to 2VP30).
>

^ permalink raw reply

* eBay Team : It is a problem with your eBay user !
From: aw-confirm @ 2005-09-10  3:25 UTC (permalink / raw)
  To: linuxppc-dev

[-- Attachment #1: Type: text/html, Size: 8045 bytes --]

^ permalink raw reply

* Re: Time for linuxpowerpc-dev?
From: Tom Rini @ 2005-09-10 16:27 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc64-dev, linuxppc-dev
In-Reply-To: <200509091225.45440.michael@ellerman.id.au>

On Fri, Sep 09, 2005 at 12:25:45PM +1000, Michael Ellerman wrote:

> With the arch's merging, and all this cross-posting maddness, is it time to 
> start a linuxpowerpc-dev mailing list?

Nah, cross posting is best, until the merge is done and we can just kill
ppc64*.

-- 
Tom Rini
http://gate.crashing.org/~trini/

^ permalink raw reply

* Re: [PATCH 2/4] arch/ppc: Replace custom macro with isdigit()
From: Tom Rini @ 2005-09-10 16:23 UTC (permalink / raw)
  To: Tobias Klauser; +Cc: akpm, kernel-janitors, linuxppc-dev
In-Reply-To: <20050910121633.GC1218@neon.tklauser.home>

On Sat, Sep 10, 2005 at 02:16:33PM +0200, Tobias Klauser wrote:

> Replace the custom is_digit() macro with isdigit() from <linux/ctype.h>
> 
> Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>

NAK, in the boot code we don't want to be adding dependanies on external
things without good reason to.

-- 
Tom Rini
http://gate.crashing.org/~trini/

^ permalink raw reply

* [PATCH] powerpc: Move arch/ppc*/oprofile/Kconfig to arch/powerpc
From: Stephen Rothwell @ 2005-09-10 16:04 UTC (permalink / raw)
  To: paulus; +Cc: ppc64-dev, ppc-dev

These files are identical.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---

 arch/powerpc/oprofile/Kconfig |   23 +++++++++++++++++++++++
 arch/ppc/Kconfig              |    2 +-
 arch/ppc/oprofile/Kconfig     |   23 -----------------------
 arch/ppc64/Kconfig            |    2 +-
 arch/ppc64/oprofile/Kconfig   |   23 -----------------------
 5 files changed, 25 insertions(+), 48 deletions(-)
 create mode 100644 arch/powerpc/oprofile/Kconfig
 delete mode 100644 arch/ppc/oprofile/Kconfig
 delete mode 100644 arch/ppc64/oprofile/Kconfig

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

8e32b39f684cae2125255e8c93faa2b45f8ffc58
diff --git a/arch/powerpc/oprofile/Kconfig b/arch/powerpc/oprofile/Kconfig
new file mode 100644
--- /dev/null
+++ b/arch/powerpc/oprofile/Kconfig
@@ -0,0 +1,23 @@
+
+menu "Profiling support"
+	depends on EXPERIMENTAL
+
+config PROFILING
+	bool "Profiling support (EXPERIMENTAL)"
+	help
+	  Say Y here to enable the extended profiling support mechanisms used
+	  by profilers such as OProfile.
+
+
+config OPROFILE
+	tristate "OProfile system profiling (EXPERIMENTAL)"
+	depends on PROFILING
+	help
+	  OProfile is a profiling system capable of profiling the
+	  whole system, include the kernel, kernel modules, libraries,
+	  and applications.
+
+	  If unsure, say N.
+
+endmenu
+
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -1363,7 +1363,7 @@ endmenu
 
 source "lib/Kconfig"
 
-source "arch/ppc/oprofile/Kconfig"
+source "arch/powerpc/oprofile/Kconfig"
 
 source "arch/ppc/Kconfig.debug"
 
diff --git a/arch/ppc/oprofile/Kconfig b/arch/ppc/oprofile/Kconfig
deleted file mode 100644
--- a/arch/ppc/oprofile/Kconfig
+++ /dev/null
@@ -1,23 +0,0 @@
-
-menu "Profiling support"
-	depends on EXPERIMENTAL
-
-config PROFILING
-	bool "Profiling support (EXPERIMENTAL)"
-	help
-	  Say Y here to enable the extended profiling support mechanisms used
-	  by profilers such as OProfile.
-
-
-config OPROFILE
-	tristate "OProfile system profiling (EXPERIMENTAL)"
-	depends on PROFILING
-	help
-	  OProfile is a profiling system capable of profiling the
-	  whole system, include the kernel, kernel modules, libraries,
-	  and applications.
-
-	  If unsure, say N.
-
-endmenu
-
diff --git a/arch/ppc64/Kconfig b/arch/ppc64/Kconfig
--- a/arch/ppc64/Kconfig
+++ b/arch/ppc64/Kconfig
@@ -465,7 +465,7 @@ config VIOPATH
 	depends on VIOCONS || VIODASD || VIOCD || VIOTAPE || VETH
 	default y
 
-source "arch/ppc64/oprofile/Kconfig"
+source "arch/powerpc/oprofile/Kconfig"
 
 source "arch/ppc64/Kconfig.debug"
 
diff --git a/arch/ppc64/oprofile/Kconfig b/arch/ppc64/oprofile/Kconfig
deleted file mode 100644
--- a/arch/ppc64/oprofile/Kconfig
+++ /dev/null
@@ -1,23 +0,0 @@
-
-menu "Profiling support"
-	depends on EXPERIMENTAL
-
-config PROFILING
-	bool "Profiling support (EXPERIMENTAL)"
-	help
-	  Say Y here to enable the extended profiling support mechanisms used
-	  by profilers such as OProfile.
-	  
-
-config OPROFILE
-	tristate "OProfile system profiling (EXPERIMENTAL)"
-	depends on PROFILING
-	help
-	  OProfile is a profiling system capable of profiling the
-	  whole system, include the kernel, kernel modules, libraries,
-	  and applications.
-
-	  If unsure, say N.
-
-endmenu
-

^ permalink raw reply

* Re: Serial driver problem from 2.6.12 kernel
From: goog long @ 2005-09-10 15:30 UTC (permalink / raw)
  To: Mark A. Greer; +Cc: linuxppc-dev
In-Reply-To: <20050909213220.GC5034@mag.az.mvista.com>

I cat /proc/interrupt and see the receiving interrupts
number increases, but the driver can only receive big
messages. Therefore, you first option is right. The
mpsc reciever will not timeout. I changed max_idle to
40 and it works perfect. Thanks a lot Mark.

cecolong

--- "Mark A. Greer" <mgreer@mvista.com> wrote:

> On Fri, Sep 09, 2005 at 08:17:14AM -0700, goog long
> wrote:
> > Hi all,
> > 
> > I backported MPSC driver from 2.6.12 to my kernel
> > 2.6.10. However, the driver can send characters,
> but
> > cannot receive any characters. Have anyone seen
> this
> > before?
> > 
> > Please also send your feedback to
> cecolong@yahoo.com
> 
> Hmm, a little sparse on info here so its hard to
> guess.
> 
> The mpsc driver is very much influenced by the
> platform_data that you
> pass to it (since there are so many options).  One
> possibility
> is that you have the max_idle platform_data field
> set to 0 which means
> that the mpsc reciever will not timeout and
> therefore the mpsc will not
> pass to the driver whatever you've typed until your
> receive buffer fills up
> (which you may not have done in your testing).  Try
> a max_idle value of 40
> which seems to work fine for me.  Another
> possibility, of course, is that
> you passed in the wrong irq in the platform_data and
> therefore are not
> getting recieving interrupts.
> 
> Mark
> 



	
		
______________________________________________________
Click here to donate to the Hurricane Katrina relief effort.
http://store.yahoo.com/redcross-donate3/

^ permalink raw reply

* [PATCH] powerpc: Move arch/ppc*/kernel/vecemu.c to arch/powerpc
From: Stephen Rothwell @ 2005-09-10 15:26 UTC (permalink / raw)
  To: paulus; +Cc: ppc64-dev, ppc-dev

This file is the same in both architectures so create
arch/powerpc/kernel and move it there.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---

 arch/powerpc/kernel/vecemu.c |  345 ++++++++++++++++++++++++++++++++++++++++++
 arch/ppc/kernel/Makefile     |    2 
 arch/ppc/kernel/vecemu.c     |  345 ------------------------------------------
 arch/ppc64/kernel/Makefile   |    3 
 arch/ppc64/kernel/vecemu.c   |  346 ------------------------------------------
 5 files changed, 350 insertions(+), 691 deletions(-)
 create mode 100644 arch/powerpc/kernel/vecemu.c
 delete mode 100644 arch/ppc/kernel/vecemu.c
 delete mode 100644 arch/ppc64/kernel/vecemu.c

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

995d61476dbab834c4e915b0c00d2f21d7cbec31
diff --git a/arch/powerpc/kernel/vecemu.c b/arch/powerpc/kernel/vecemu.c
new file mode 100644
--- /dev/null
+++ b/arch/powerpc/kernel/vecemu.c
@@ -0,0 +1,345 @@
+/*
+ * Routines to emulate some Altivec/VMX instructions, specifically
+ * those that can trap when given denormalized operands in Java mode.
+ */
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/sched.h>
+#include <asm/ptrace.h>
+#include <asm/processor.h>
+#include <asm/uaccess.h>
+
+/* Functions in vector.S */
+extern void vaddfp(vector128 *dst, vector128 *a, vector128 *b);
+extern void vsubfp(vector128 *dst, vector128 *a, vector128 *b);
+extern void vmaddfp(vector128 *dst, vector128 *a, vector128 *b, vector128 *c);
+extern void vnmsubfp(vector128 *dst, vector128 *a, vector128 *b, vector128 *c);
+extern void vrefp(vector128 *dst, vector128 *src);
+extern void vrsqrtefp(vector128 *dst, vector128 *src);
+extern void vexptep(vector128 *dst, vector128 *src);
+
+static unsigned int exp2s[8] = {
+	0x800000,
+	0x8b95c2,
+	0x9837f0,
+	0xa5fed7,
+	0xb504f3,
+	0xc5672a,
+	0xd744fd,
+	0xeac0c7
+};
+
+/*
+ * Computes an estimate of 2^x.  The `s' argument is the 32-bit
+ * single-precision floating-point representation of x.
+ */
+static unsigned int eexp2(unsigned int s)
+{
+	int exp, pwr;
+	unsigned int mant, frac;
+
+	/* extract exponent field from input */
+	exp = ((s >> 23) & 0xff) - 127;
+	if (exp > 7) {
+		/* check for NaN input */
+		if (exp == 128 && (s & 0x7fffff) != 0)
+			return s | 0x400000;	/* return QNaN */
+		/* 2^-big = 0, 2^+big = +Inf */
+		return (s & 0x80000000)? 0: 0x7f800000;	/* 0 or +Inf */
+	}
+	if (exp < -23)
+		return 0x3f800000;	/* 1.0 */
+
+	/* convert to fixed point integer in 9.23 representation */
+	pwr = (s & 0x7fffff) | 0x800000;
+	if (exp > 0)
+		pwr <<= exp;
+	else
+		pwr >>= -exp;
+	if (s & 0x80000000)
+		pwr = -pwr;
+
+	/* extract integer part, which becomes exponent part of result */
+	exp = (pwr >> 23) + 126;
+	if (exp >= 254)
+		return 0x7f800000;
+	if (exp < -23)
+		return 0;
+
+	/* table lookup on top 3 bits of fraction to get mantissa */
+	mant = exp2s[(pwr >> 20) & 7];
+
+	/* linear interpolation using remaining 20 bits of fraction */
+	asm("mulhwu %0,%1,%2" : "=r" (frac)
+	    : "r" (pwr << 12), "r" (0x172b83ff));
+	asm("mulhwu %0,%1,%2" : "=r" (frac) : "r" (frac), "r" (mant));
+	mant += frac;
+
+	if (exp >= 0)
+		return mant + (exp << 23);
+
+	/* denormalized result */
+	exp = -exp;
+	mant += 1 << (exp - 1);
+	return mant >> exp;
+}
+
+/*
+ * Computes an estimate of log_2(x).  The `s' argument is the 32-bit
+ * single-precision floating-point representation of x.
+ */
+static unsigned int elog2(unsigned int s)
+{
+	int exp, mant, lz, frac;
+
+	exp = s & 0x7f800000;
+	mant = s & 0x7fffff;
+	if (exp == 0x7f800000) {	/* Inf or NaN */
+		if (mant != 0)
+			s |= 0x400000;	/* turn NaN into QNaN */
+		return s;
+	}
+	if ((exp | mant) == 0)		/* +0 or -0 */
+		return 0xff800000;	/* return -Inf */
+
+	if (exp == 0) {
+		/* denormalized */
+		asm("cntlzw %0,%1" : "=r" (lz) : "r" (mant));
+		mant <<= lz - 8;
+		exp = (-118 - lz) << 23;
+	} else {
+		mant |= 0x800000;
+		exp -= 127 << 23;
+	}
+
+	if (mant >= 0xb504f3) {				/* 2^0.5 * 2^23 */
+		exp |= 0x400000;			/* 0.5 * 2^23 */
+		asm("mulhwu %0,%1,%2" : "=r" (mant)
+		    : "r" (mant), "r" (0xb504f334));	/* 2^-0.5 * 2^32 */
+	}
+	if (mant >= 0x9837f0) {				/* 2^0.25 * 2^23 */
+		exp |= 0x200000;			/* 0.25 * 2^23 */
+		asm("mulhwu %0,%1,%2" : "=r" (mant)
+		    : "r" (mant), "r" (0xd744fccb));	/* 2^-0.25 * 2^32 */
+	}
+	if (mant >= 0x8b95c2) {				/* 2^0.125 * 2^23 */
+		exp |= 0x100000;			/* 0.125 * 2^23 */
+		asm("mulhwu %0,%1,%2" : "=r" (mant)
+		    : "r" (mant), "r" (0xeac0c6e8));	/* 2^-0.125 * 2^32 */
+	}
+	if (mant > 0x800000) {				/* 1.0 * 2^23 */
+		/* calculate (mant - 1) * 1.381097463 */
+		/* 1.381097463 == 0.125 / (2^0.125 - 1) */
+		asm("mulhwu %0,%1,%2" : "=r" (frac)
+		    : "r" ((mant - 0x800000) << 1), "r" (0xb0c7cd3a));
+		exp += frac;
+	}
+	s = exp & 0x80000000;
+	if (exp != 0) {
+		if (s)
+			exp = -exp;
+		asm("cntlzw %0,%1" : "=r" (lz) : "r" (exp));
+		lz = 8 - lz;
+		if (lz > 0)
+			exp >>= lz;
+		else if (lz < 0)
+			exp <<= -lz;
+		s += ((lz + 126) << 23) + exp;
+	}
+	return s;
+}
+
+#define VSCR_SAT	1
+
+static int ctsxs(unsigned int x, int scale, unsigned int *vscrp)
+{
+	int exp, mant;
+
+	exp = (x >> 23) & 0xff;
+	mant = x & 0x7fffff;
+	if (exp == 255 && mant != 0)
+		return 0;		/* NaN -> 0 */
+	exp = exp - 127 + scale;
+	if (exp < 0)
+		return 0;		/* round towards zero */
+	if (exp >= 31) {
+		/* saturate, unless the result would be -2^31 */
+		if (x + (scale << 23) != 0xcf000000)
+			*vscrp |= VSCR_SAT;
+		return (x & 0x80000000)? 0x80000000: 0x7fffffff;
+	}
+	mant |= 0x800000;
+	mant = (mant << 7) >> (30 - exp);
+	return (x & 0x80000000)? -mant: mant;
+}
+
+static unsigned int ctuxs(unsigned int x, int scale, unsigned int *vscrp)
+{
+	int exp;
+	unsigned int mant;
+
+	exp = (x >> 23) & 0xff;
+	mant = x & 0x7fffff;
+	if (exp == 255 && mant != 0)
+		return 0;		/* NaN -> 0 */
+	exp = exp - 127 + scale;
+	if (exp < 0)
+		return 0;		/* round towards zero */
+	if (x & 0x80000000) {
+		/* negative => saturate to 0 */
+		*vscrp |= VSCR_SAT;
+		return 0;
+	}
+	if (exp >= 32) {
+		/* saturate */
+		*vscrp |= VSCR_SAT;
+		return 0xffffffff;
+	}
+	mant |= 0x800000;
+	mant = (mant << 8) >> (31 - exp);
+	return mant;
+}
+
+/* Round to floating integer, towards 0 */
+static unsigned int rfiz(unsigned int x)
+{
+	int exp;
+
+	exp = ((x >> 23) & 0xff) - 127;
+	if (exp == 128 && (x & 0x7fffff) != 0)
+		return x | 0x400000;	/* NaN -> make it a QNaN */
+	if (exp >= 23)
+		return x;		/* it's an integer already (or Inf) */
+	if (exp < 0)
+		return x & 0x80000000;	/* |x| < 1.0 rounds to 0 */
+	return x & ~(0x7fffff >> exp);
+}
+
+/* Round to floating integer, towards +/- Inf */
+static unsigned int rfii(unsigned int x)
+{
+	int exp, mask;
+
+	exp = ((x >> 23) & 0xff) - 127;
+	if (exp == 128 && (x & 0x7fffff) != 0)
+		return x | 0x400000;	/* NaN -> make it a QNaN */
+	if (exp >= 23)
+		return x;		/* it's an integer already (or Inf) */
+	if ((x & 0x7fffffff) == 0)
+		return x;		/* +/-0 -> +/-0 */
+	if (exp < 0)
+		/* 0 < |x| < 1.0 rounds to +/- 1.0 */
+		return (x & 0x80000000) | 0x3f800000;
+	mask = 0x7fffff >> exp;
+	/* mantissa overflows into exponent - that's OK,
+	   it can't overflow into the sign bit */
+	return (x + mask) & ~mask;
+}
+
+/* Round to floating integer, to nearest */
+static unsigned int rfin(unsigned int x)
+{
+	int exp, half;
+
+	exp = ((x >> 23) & 0xff) - 127;
+	if (exp == 128 && (x & 0x7fffff) != 0)
+		return x | 0x400000;	/* NaN -> make it a QNaN */
+	if (exp >= 23)
+		return x;		/* it's an integer already (or Inf) */
+	if (exp < -1)
+		return x & 0x80000000;	/* |x| < 0.5 -> +/-0 */
+	if (exp == -1)
+		/* 0.5 <= |x| < 1.0 rounds to +/- 1.0 */
+		return (x & 0x80000000) | 0x3f800000;
+	half = 0x400000 >> exp;
+	/* add 0.5 to the magnitude and chop off the fraction bits */
+	return (x + half) & ~(0x7fffff >> exp);
+}
+
+int emulate_altivec(struct pt_regs *regs)
+{
+	unsigned int instr, i;
+	unsigned int va, vb, vc, vd;
+	vector128 *vrs;
+
+	if (get_user(instr, (unsigned int __user *) regs->nip))
+		return -EFAULT;
+	if ((instr >> 26) != 4)
+		return -EINVAL;		/* not an altivec instruction */
+	vd = (instr >> 21) & 0x1f;
+	va = (instr >> 16) & 0x1f;
+	vb = (instr >> 11) & 0x1f;
+	vc = (instr >> 6) & 0x1f;
+
+	vrs = current->thread.vr;
+	switch (instr & 0x3f) {
+	case 10:
+		switch (vc) {
+		case 0:	/* vaddfp */
+			vaddfp(&vrs[vd], &vrs[va], &vrs[vb]);
+			break;
+		case 1:	/* vsubfp */
+			vsubfp(&vrs[vd], &vrs[va], &vrs[vb]);
+			break;
+		case 4:	/* vrefp */
+			vrefp(&vrs[vd], &vrs[vb]);
+			break;
+		case 5:	/* vrsqrtefp */
+			vrsqrtefp(&vrs[vd], &vrs[vb]);
+			break;
+		case 6:	/* vexptefp */
+			for (i = 0; i < 4; ++i)
+				vrs[vd].u[i] = eexp2(vrs[vb].u[i]);
+			break;
+		case 7:	/* vlogefp */
+			for (i = 0; i < 4; ++i)
+				vrs[vd].u[i] = elog2(vrs[vb].u[i]);
+			break;
+		case 8:		/* vrfin */
+			for (i = 0; i < 4; ++i)
+				vrs[vd].u[i] = rfin(vrs[vb].u[i]);
+			break;
+		case 9:		/* vrfiz */
+			for (i = 0; i < 4; ++i)
+				vrs[vd].u[i] = rfiz(vrs[vb].u[i]);
+			break;
+		case 10:	/* vrfip */
+			for (i = 0; i < 4; ++i) {
+				u32 x = vrs[vb].u[i];
+				x = (x & 0x80000000)? rfiz(x): rfii(x);
+				vrs[vd].u[i] = x;
+			}
+			break;
+		case 11:	/* vrfim */
+			for (i = 0; i < 4; ++i) {
+				u32 x = vrs[vb].u[i];
+				x = (x & 0x80000000)? rfii(x): rfiz(x);
+				vrs[vd].u[i] = x;
+			}
+			break;
+		case 14:	/* vctuxs */
+			for (i = 0; i < 4; ++i)
+				vrs[vd].u[i] = ctuxs(vrs[vb].u[i], va,
+						&current->thread.vscr.u[3]);
+			break;
+		case 15:	/* vctsxs */
+			for (i = 0; i < 4; ++i)
+				vrs[vd].u[i] = ctsxs(vrs[vb].u[i], va,
+						&current->thread.vscr.u[3]);
+			break;
+		default:
+			return -EINVAL;
+		}
+		break;
+	case 46:	/* vmaddfp */
+		vmaddfp(&vrs[vd], &vrs[va], &vrs[vb], &vrs[vc]);
+		break;
+	case 47:	/* vnmsubfp */
+		vnmsubfp(&vrs[vd], &vrs[va], &vrs[vb], &vrs[vc]);
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	return 0;
+}
diff --git a/arch/ppc/kernel/Makefile b/arch/ppc/kernel/Makefile
--- a/arch/ppc/kernel/Makefile
+++ b/arch/ppc/kernel/Makefile
@@ -36,3 +36,5 @@ ifndef CONFIG_MATH_EMULATION
 obj-$(CONFIG_8xx)		+= softemu8xx.o
 endif
 
+# These are here while we do the architecture merge
+vecemu-y			+= ../../powerpc/kernel/vecemu.o
diff --git a/arch/ppc/kernel/vecemu.c b/arch/ppc/kernel/vecemu.c
deleted file mode 100644
--- a/arch/ppc/kernel/vecemu.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- * Routines to emulate some Altivec/VMX instructions, specifically
- * those that can trap when given denormalized operands in Java mode.
- */
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/sched.h>
-#include <asm/ptrace.h>
-#include <asm/processor.h>
-#include <asm/uaccess.h>
-
-/* Functions in vector.S */
-extern void vaddfp(vector128 *dst, vector128 *a, vector128 *b);
-extern void vsubfp(vector128 *dst, vector128 *a, vector128 *b);
-extern void vmaddfp(vector128 *dst, vector128 *a, vector128 *b, vector128 *c);
-extern void vnmsubfp(vector128 *dst, vector128 *a, vector128 *b, vector128 *c);
-extern void vrefp(vector128 *dst, vector128 *src);
-extern void vrsqrtefp(vector128 *dst, vector128 *src);
-extern void vexptep(vector128 *dst, vector128 *src);
-
-static unsigned int exp2s[8] = {
-	0x800000,
-	0x8b95c2,
-	0x9837f0,
-	0xa5fed7,
-	0xb504f3,
-	0xc5672a,
-	0xd744fd,
-	0xeac0c7
-};
-
-/*
- * Computes an estimate of 2^x.  The `s' argument is the 32-bit
- * single-precision floating-point representation of x.
- */
-static unsigned int eexp2(unsigned int s)
-{
-	int exp, pwr;
-	unsigned int mant, frac;
-
-	/* extract exponent field from input */
-	exp = ((s >> 23) & 0xff) - 127;
-	if (exp > 7) {
-		/* check for NaN input */
-		if (exp == 128 && (s & 0x7fffff) != 0)
-			return s | 0x400000;	/* return QNaN */
-		/* 2^-big = 0, 2^+big = +Inf */
-		return (s & 0x80000000)? 0: 0x7f800000;	/* 0 or +Inf */
-	}
-	if (exp < -23)
-		return 0x3f800000;	/* 1.0 */
-
-	/* convert to fixed point integer in 9.23 representation */
-	pwr = (s & 0x7fffff) | 0x800000;
-	if (exp > 0)
-		pwr <<= exp;
-	else
-		pwr >>= -exp;
-	if (s & 0x80000000)
-		pwr = -pwr;
-
-	/* extract integer part, which becomes exponent part of result */
-	exp = (pwr >> 23) + 126;
-	if (exp >= 254)
-		return 0x7f800000;
-	if (exp < -23)
-		return 0;
-
-	/* table lookup on top 3 bits of fraction to get mantissa */
-	mant = exp2s[(pwr >> 20) & 7];
-
-	/* linear interpolation using remaining 20 bits of fraction */
-	asm("mulhwu %0,%1,%2" : "=r" (frac)
-	    : "r" (pwr << 12), "r" (0x172b83ff));
-	asm("mulhwu %0,%1,%2" : "=r" (frac) : "r" (frac), "r" (mant));
-	mant += frac;
-
-	if (exp >= 0)
-		return mant + (exp << 23);
-
-	/* denormalized result */
-	exp = -exp;
-	mant += 1 << (exp - 1);
-	return mant >> exp;
-}
-
-/*
- * Computes an estimate of log_2(x).  The `s' argument is the 32-bit
- * single-precision floating-point representation of x.
- */
-static unsigned int elog2(unsigned int s)
-{
-	int exp, mant, lz, frac;
-
-	exp = s & 0x7f800000;
-	mant = s & 0x7fffff;
-	if (exp == 0x7f800000) {	/* Inf or NaN */
-		if (mant != 0)
-			s |= 0x400000;	/* turn NaN into QNaN */
-		return s;
-	}
-	if ((exp | mant) == 0)		/* +0 or -0 */
-		return 0xff800000;	/* return -Inf */
-
-	if (exp == 0) {
-		/* denormalized */
-		asm("cntlzw %0,%1" : "=r" (lz) : "r" (mant));
-		mant <<= lz - 8;
-		exp = (-118 - lz) << 23;
-	} else {
-		mant |= 0x800000;
-		exp -= 127 << 23;
-	}
-
-	if (mant >= 0xb504f3) {				/* 2^0.5 * 2^23 */
-		exp |= 0x400000;			/* 0.5 * 2^23 */
-		asm("mulhwu %0,%1,%2" : "=r" (mant)
-		    : "r" (mant), "r" (0xb504f334));	/* 2^-0.5 * 2^32 */
-	}
-	if (mant >= 0x9837f0) {				/* 2^0.25 * 2^23 */
-		exp |= 0x200000;			/* 0.25 * 2^23 */
-		asm("mulhwu %0,%1,%2" : "=r" (mant)
-		    : "r" (mant), "r" (0xd744fccb));	/* 2^-0.25 * 2^32 */
-	}
-	if (mant >= 0x8b95c2) {				/* 2^0.125 * 2^23 */
-		exp |= 0x100000;			/* 0.125 * 2^23 */
-		asm("mulhwu %0,%1,%2" : "=r" (mant)
-		    : "r" (mant), "r" (0xeac0c6e8));	/* 2^-0.125 * 2^32 */
-	}
-	if (mant > 0x800000) {				/* 1.0 * 2^23 */
-		/* calculate (mant - 1) * 1.381097463 */
-		/* 1.381097463 == 0.125 / (2^0.125 - 1) */
-		asm("mulhwu %0,%1,%2" : "=r" (frac)
-		    : "r" ((mant - 0x800000) << 1), "r" (0xb0c7cd3a));
-		exp += frac;
-	}
-	s = exp & 0x80000000;
-	if (exp != 0) {
-		if (s)
-			exp = -exp;
-		asm("cntlzw %0,%1" : "=r" (lz) : "r" (exp));
-		lz = 8 - lz;
-		if (lz > 0)
-			exp >>= lz;
-		else if (lz < 0)
-			exp <<= -lz;
-		s += ((lz + 126) << 23) + exp;
-	}
-	return s;
-}
-
-#define VSCR_SAT	1
-
-static int ctsxs(unsigned int x, int scale, unsigned int *vscrp)
-{
-	int exp, mant;
-
-	exp = (x >> 23) & 0xff;
-	mant = x & 0x7fffff;
-	if (exp == 255 && mant != 0)
-		return 0;		/* NaN -> 0 */
-	exp = exp - 127 + scale;
-	if (exp < 0)
-		return 0;		/* round towards zero */
-	if (exp >= 31) {
-		/* saturate, unless the result would be -2^31 */
-		if (x + (scale << 23) != 0xcf000000)
-			*vscrp |= VSCR_SAT;
-		return (x & 0x80000000)? 0x80000000: 0x7fffffff;
-	}
-	mant |= 0x800000;
-	mant = (mant << 7) >> (30 - exp);
-	return (x & 0x80000000)? -mant: mant;
-}
-
-static unsigned int ctuxs(unsigned int x, int scale, unsigned int *vscrp)
-{
-	int exp;
-	unsigned int mant;
-
-	exp = (x >> 23) & 0xff;
-	mant = x & 0x7fffff;
-	if (exp == 255 && mant != 0)
-		return 0;		/* NaN -> 0 */
-	exp = exp - 127 + scale;
-	if (exp < 0)
-		return 0;		/* round towards zero */
-	if (x & 0x80000000) {
-		/* negative => saturate to 0 */
-		*vscrp |= VSCR_SAT;
-		return 0;
-	}
-	if (exp >= 32) {
-		/* saturate */
-		*vscrp |= VSCR_SAT;
-		return 0xffffffff;
-	}
-	mant |= 0x800000;
-	mant = (mant << 8) >> (31 - exp);
-	return mant;
-}
-
-/* Round to floating integer, towards 0 */
-static unsigned int rfiz(unsigned int x)
-{
-	int exp;
-
-	exp = ((x >> 23) & 0xff) - 127;
-	if (exp == 128 && (x & 0x7fffff) != 0)
-		return x | 0x400000;	/* NaN -> make it a QNaN */
-	if (exp >= 23)
-		return x;		/* it's an integer already (or Inf) */
-	if (exp < 0)
-		return x & 0x80000000;	/* |x| < 1.0 rounds to 0 */
-	return x & ~(0x7fffff >> exp);
-}
-
-/* Round to floating integer, towards +/- Inf */
-static unsigned int rfii(unsigned int x)
-{
-	int exp, mask;
-
-	exp = ((x >> 23) & 0xff) - 127;
-	if (exp == 128 && (x & 0x7fffff) != 0)
-		return x | 0x400000;	/* NaN -> make it a QNaN */
-	if (exp >= 23)
-		return x;		/* it's an integer already (or Inf) */
-	if ((x & 0x7fffffff) == 0)
-		return x;		/* +/-0 -> +/-0 */
-	if (exp < 0)
-		/* 0 < |x| < 1.0 rounds to +/- 1.0 */
-		return (x & 0x80000000) | 0x3f800000;
-	mask = 0x7fffff >> exp;
-	/* mantissa overflows into exponent - that's OK,
-	   it can't overflow into the sign bit */
-	return (x + mask) & ~mask;
-}
-
-/* Round to floating integer, to nearest */
-static unsigned int rfin(unsigned int x)
-{
-	int exp, half;
-
-	exp = ((x >> 23) & 0xff) - 127;
-	if (exp == 128 && (x & 0x7fffff) != 0)
-		return x | 0x400000;	/* NaN -> make it a QNaN */
-	if (exp >= 23)
-		return x;		/* it's an integer already (or Inf) */
-	if (exp < -1)
-		return x & 0x80000000;	/* |x| < 0.5 -> +/-0 */
-	if (exp == -1)
-		/* 0.5 <= |x| < 1.0 rounds to +/- 1.0 */
-		return (x & 0x80000000) | 0x3f800000;
-	half = 0x400000 >> exp;
-	/* add 0.5 to the magnitude and chop off the fraction bits */
-	return (x + half) & ~(0x7fffff >> exp);
-}
-
-int emulate_altivec(struct pt_regs *regs)
-{
-	unsigned int instr, i;
-	unsigned int va, vb, vc, vd;
-	vector128 *vrs;
-
-	if (get_user(instr, (unsigned int __user *) regs->nip))
-		return -EFAULT;
-	if ((instr >> 26) != 4)
-		return -EINVAL;		/* not an altivec instruction */
-	vd = (instr >> 21) & 0x1f;
-	va = (instr >> 16) & 0x1f;
-	vb = (instr >> 11) & 0x1f;
-	vc = (instr >> 6) & 0x1f;
-
-	vrs = current->thread.vr;
-	switch (instr & 0x3f) {
-	case 10:
-		switch (vc) {
-		case 0:	/* vaddfp */
-			vaddfp(&vrs[vd], &vrs[va], &vrs[vb]);
-			break;
-		case 1:	/* vsubfp */
-			vsubfp(&vrs[vd], &vrs[va], &vrs[vb]);
-			break;
-		case 4:	/* vrefp */
-			vrefp(&vrs[vd], &vrs[vb]);
-			break;
-		case 5:	/* vrsqrtefp */
-			vrsqrtefp(&vrs[vd], &vrs[vb]);
-			break;
-		case 6:	/* vexptefp */
-			for (i = 0; i < 4; ++i)
-				vrs[vd].u[i] = eexp2(vrs[vb].u[i]);
-			break;
-		case 7:	/* vlogefp */
-			for (i = 0; i < 4; ++i)
-				vrs[vd].u[i] = elog2(vrs[vb].u[i]);
-			break;
-		case 8:		/* vrfin */
-			for (i = 0; i < 4; ++i)
-				vrs[vd].u[i] = rfin(vrs[vb].u[i]);
-			break;
-		case 9:		/* vrfiz */
-			for (i = 0; i < 4; ++i)
-				vrs[vd].u[i] = rfiz(vrs[vb].u[i]);
-			break;
-		case 10:	/* vrfip */
-			for (i = 0; i < 4; ++i) {
-				u32 x = vrs[vb].u[i];
-				x = (x & 0x80000000)? rfiz(x): rfii(x);
-				vrs[vd].u[i] = x;
-			}
-			break;
-		case 11:	/* vrfim */
-			for (i = 0; i < 4; ++i) {
-				u32 x = vrs[vb].u[i];
-				x = (x & 0x80000000)? rfii(x): rfiz(x);
-				vrs[vd].u[i] = x;
-			}
-			break;
-		case 14:	/* vctuxs */
-			for (i = 0; i < 4; ++i)
-				vrs[vd].u[i] = ctuxs(vrs[vb].u[i], va,
-						&current->thread.vscr.u[3]);
-			break;
-		case 15:	/* vctsxs */
-			for (i = 0; i < 4; ++i)
-				vrs[vd].u[i] = ctsxs(vrs[vb].u[i], va,
-						&current->thread.vscr.u[3]);
-			break;
-		default:
-			return -EINVAL;
-		}
-		break;
-	case 46:	/* vmaddfp */
-		vmaddfp(&vrs[vd], &vrs[va], &vrs[vb], &vrs[vc]);
-		break;
-	case 47:	/* vnmsubfp */
-		vnmsubfp(&vrs[vd], &vrs[va], &vrs[vb], &vrs[vc]);
-		break;
-	default:
-		return -EINVAL;
-	}
-
-	return 0;
-}
diff --git a/arch/ppc64/kernel/Makefile b/arch/ppc64/kernel/Makefile
--- a/arch/ppc64/kernel/Makefile
+++ b/arch/ppc64/kernel/Makefile
@@ -83,3 +83,6 @@ ifeq ($(CONFIG_PPC_ISERIES),y)
 arch/ppc64/kernel/head.o: arch/ppc64/kernel/lparmap.s
 AFLAGS_head.o += -Iarch/ppc64/kernel
 endif
+
+# These are here while we do the architecture merge
+vecemu-y			+= ../../powerpc/kernel/vecemu.o
diff --git a/arch/ppc64/kernel/vecemu.c b/arch/ppc64/kernel/vecemu.c
deleted file mode 100644
--- a/arch/ppc64/kernel/vecemu.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * Routines to emulate some Altivec/VMX instructions, specifically
- * those that can trap when given denormalized operands in Java mode.
- */
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/sched.h>
-#include <asm/ptrace.h>
-#include <asm/processor.h>
-#include <asm/uaccess.h>
-
-/* Functions in vector.S */
-extern void vaddfp(vector128 *dst, vector128 *a, vector128 *b);
-extern void vsubfp(vector128 *dst, vector128 *a, vector128 *b);
-extern void vmaddfp(vector128 *dst, vector128 *a, vector128 *b, vector128 *c);
-extern void vnmsubfp(vector128 *dst, vector128 *a, vector128 *b, vector128 *c);
-extern void vrefp(vector128 *dst, vector128 *src);
-extern void vrsqrtefp(vector128 *dst, vector128 *src);
-extern void vexptep(vector128 *dst, vector128 *src);
-
-static unsigned int exp2s[8] = {
-	0x800000,
-	0x8b95c2,
-	0x9837f0,
-	0xa5fed7,
-	0xb504f3,
-	0xc5672a,
-	0xd744fd,
-	0xeac0c7
-};
-
-/*
- * Computes an estimate of 2^x.  The `s' argument is the 32-bit
- * single-precision floating-point representation of x.
- */
-static unsigned int eexp2(unsigned int s)
-{
-	int exp, pwr;
-	unsigned int mant, frac;
-
-	/* extract exponent field from input */
-	exp = ((s >> 23) & 0xff) - 127;
-	if (exp > 7) {
-		/* check for NaN input */
-		if (exp == 128 && (s & 0x7fffff) != 0)
-			return s | 0x400000;	/* return QNaN */
-		/* 2^-big = 0, 2^+big = +Inf */
-		return (s & 0x80000000)? 0: 0x7f800000;	/* 0 or +Inf */
-	}
-	if (exp < -23)
-		return 0x3f800000;	/* 1.0 */
-
-	/* convert to fixed point integer in 9.23 representation */
-	pwr = (s & 0x7fffff) | 0x800000;
-	if (exp > 0)
-		pwr <<= exp;
-	else
-		pwr >>= -exp;
-	if (s & 0x80000000)
-		pwr = -pwr;
-
-	/* extract integer part, which becomes exponent part of result */
-	exp = (pwr >> 23) + 126;
-	if (exp >= 254)
-		return 0x7f800000;
-	if (exp < -23)
-		return 0;
-
-	/* table lookup on top 3 bits of fraction to get mantissa */
-	mant = exp2s[(pwr >> 20) & 7];
-
-	/* linear interpolation using remaining 20 bits of fraction */
-	asm("mulhwu %0,%1,%2" : "=r" (frac)
-	    : "r" (pwr << 12), "r" (0x172b83ff));
-	asm("mulhwu %0,%1,%2" : "=r" (frac) : "r" (frac), "r" (mant));
-	mant += frac;
-
-	if (exp >= 0)
-		return mant + (exp << 23);
-
-	/* denormalized result */
-	exp = -exp;
-	mant += 1 << (exp - 1);
-	return mant >> exp;
-}
-
-/*
- * Computes an estimate of log_2(x).  The `s' argument is the 32-bit
- * single-precision floating-point representation of x.
- */
-static unsigned int elog2(unsigned int s)
-{
-	int exp, mant, lz, frac;
-
-	exp = s & 0x7f800000;
-	mant = s & 0x7fffff;
-	if (exp == 0x7f800000) {	/* Inf or NaN */
-		if (mant != 0)
-			s |= 0x400000;	/* turn NaN into QNaN */
-		return s;
-	}
-	if ((exp | mant) == 0)		/* +0 or -0 */
-		return 0xff800000;	/* return -Inf */
-
-	if (exp == 0) {
-		/* denormalized */
-		asm("cntlzw %0,%1" : "=r" (lz) : "r" (mant));
-		mant <<= lz - 8;
-		exp = (-118 - lz) << 23;
-	} else {
-		mant |= 0x800000;
-		exp -= 127 << 23;
-	}
-
-	if (mant >= 0xb504f3) {				/* 2^0.5 * 2^23 */
-		exp |= 0x400000;			/* 0.5 * 2^23 */
-		asm("mulhwu %0,%1,%2" : "=r" (mant)
-		    : "r" (mant), "r" (0xb504f334));	/* 2^-0.5 * 2^32 */
-	}
-	if (mant >= 0x9837f0) {				/* 2^0.25 * 2^23 */
-		exp |= 0x200000;			/* 0.25 * 2^23 */
-		asm("mulhwu %0,%1,%2" : "=r" (mant)
-		    : "r" (mant), "r" (0xd744fccb));	/* 2^-0.25 * 2^32 */
-	}
-	if (mant >= 0x8b95c2) {				/* 2^0.125 * 2^23 */
-		exp |= 0x100000;			/* 0.125 * 2^23 */
-		asm("mulhwu %0,%1,%2" : "=r" (mant)
-		    : "r" (mant), "r" (0xeac0c6e8));	/* 2^-0.125 * 2^32 */
-	}
-	if (mant > 0x800000) {				/* 1.0 * 2^23 */
-		/* calculate (mant - 1) * 1.381097463 */
-		/* 1.381097463 == 0.125 / (2^0.125 - 1) */
-		asm("mulhwu %0,%1,%2" : "=r" (frac)
-		    : "r" ((mant - 0x800000) << 1), "r" (0xb0c7cd3a));
-		exp += frac;
-	}
-	s = exp & 0x80000000;
-	if (exp != 0) {
-		if (s)
-			exp = -exp;
-		asm("cntlzw %0,%1" : "=r" (lz) : "r" (exp));
-		lz = 8 - lz;
-		if (lz > 0)
-			exp >>= lz;
-		else if (lz < 0)
-			exp <<= -lz;
-		s += ((lz + 126) << 23) + exp;
-	}
-	return s;
-}
-
-#define VSCR_SAT	1
-
-static int ctsxs(unsigned int x, int scale, unsigned int *vscrp)
-{
-	int exp, mant;
-
-	exp = (x >> 23) & 0xff;
-	mant = x & 0x7fffff;
-	if (exp == 255 && mant != 0)
-		return 0;		/* NaN -> 0 */
-	exp = exp - 127 + scale;
-	if (exp < 0)
-		return 0;		/* round towards zero */
-	if (exp >= 31) {
-		/* saturate, unless the result would be -2^31 */
-		if (x + (scale << 23) != 0xcf000000)
-			*vscrp |= VSCR_SAT;
-		return (x & 0x80000000)? 0x80000000: 0x7fffffff;
-	}
-	mant |= 0x800000;
-	mant = (mant << 7) >> (30 - exp);
-	return (x & 0x80000000)? -mant: mant;
-}
-
-static unsigned int ctuxs(unsigned int x, int scale, unsigned int *vscrp)
-{
-	int exp;
-	unsigned int mant;
-
-	exp = (x >> 23) & 0xff;
-	mant = x & 0x7fffff;
-	if (exp == 255 && mant != 0)
-		return 0;		/* NaN -> 0 */
-	exp = exp - 127 + scale;
-	if (exp < 0)
-		return 0;		/* round towards zero */
-	if (x & 0x80000000) {
-		/* negative => saturate to 0 */
-		*vscrp |= VSCR_SAT;
-		return 0;
-	}
-	if (exp >= 32) {
-		/* saturate */
-		*vscrp |= VSCR_SAT;
-		return 0xffffffff;
-	}
-	mant |= 0x800000;
-	mant = (mant << 8) >> (31 - exp);
-	return mant;
-}
-
-/* Round to floating integer, towards 0 */
-static unsigned int rfiz(unsigned int x)
-{
-	int exp;
-
-	exp = ((x >> 23) & 0xff) - 127;
-	if (exp == 128 && (x & 0x7fffff) != 0)
-		return x | 0x400000;	/* NaN -> make it a QNaN */
-	if (exp >= 23)
-		return x;		/* it's an integer already (or Inf) */
-	if (exp < 0)
-		return x & 0x80000000;	/* |x| < 1.0 rounds to 0 */
-	return x & ~(0x7fffff >> exp);
-}
-
-/* Round to floating integer, towards +/- Inf */
-static unsigned int rfii(unsigned int x)
-{
-	int exp, mask;
-
-	exp = ((x >> 23) & 0xff) - 127;
-	if (exp == 128 && (x & 0x7fffff) != 0)
-		return x | 0x400000;	/* NaN -> make it a QNaN */
-	if (exp >= 23)
-		return x;		/* it's an integer already (or Inf) */
-	if ((x & 0x7fffffff) == 0)
-		return x;		/* +/-0 -> +/-0 */
-	if (exp < 0)
-		/* 0 < |x| < 1.0 rounds to +/- 1.0 */
-		return (x & 0x80000000) | 0x3f800000;
-	mask = 0x7fffff >> exp;
-	/* mantissa overflows into exponent - that's OK,
-	   it can't overflow into the sign bit */
-	return (x + mask) & ~mask;
-}
-
-/* Round to floating integer, to nearest */
-static unsigned int rfin(unsigned int x)
-{
-	int exp, half;
-
-	exp = ((x >> 23) & 0xff) - 127;
-	if (exp == 128 && (x & 0x7fffff) != 0)
-		return x | 0x400000;	/* NaN -> make it a QNaN */
-	if (exp >= 23)
-		return x;		/* it's an integer already (or Inf) */
-	if (exp < -1)
-		return x & 0x80000000;	/* |x| < 0.5 -> +/-0 */
-	if (exp == -1)
-		/* 0.5 <= |x| < 1.0 rounds to +/- 1.0 */
-		return (x & 0x80000000) | 0x3f800000;
-	half = 0x400000 >> exp;
-	/* add 0.5 to the magnitude and chop off the fraction bits */
-	return (x + half) & ~(0x7fffff >> exp);
-}
-
-int
-emulate_altivec(struct pt_regs *regs)
-{
-	unsigned int instr, i;
-	unsigned int va, vb, vc, vd;
-	vector128 *vrs;
-
-	if (get_user(instr, (unsigned int __user *) regs->nip))
-		return -EFAULT;
-	if ((instr >> 26) != 4)
-		return -EINVAL;		/* not an altivec instruction */
-	vd = (instr >> 21) & 0x1f;
-	va = (instr >> 16) & 0x1f;
-	vb = (instr >> 11) & 0x1f;
-	vc = (instr >> 6) & 0x1f;
-
-	vrs = current->thread.vr;
-	switch (instr & 0x3f) {
-	case 10:
-		switch (vc) {
-		case 0:	/* vaddfp */
-			vaddfp(&vrs[vd], &vrs[va], &vrs[vb]);
-			break;
-		case 1:	/* vsubfp */
-			vsubfp(&vrs[vd], &vrs[va], &vrs[vb]);
-			break;
-		case 4:	/* vrefp */
-			vrefp(&vrs[vd], &vrs[vb]);
-			break;
-		case 5:	/* vrsqrtefp */
-			vrsqrtefp(&vrs[vd], &vrs[vb]);
-			break;
-		case 6:	/* vexptefp */
-			for (i = 0; i < 4; ++i)
-				vrs[vd].u[i] = eexp2(vrs[vb].u[i]);
-			break;
-		case 7:	/* vlogefp */
-			for (i = 0; i < 4; ++i)
-				vrs[vd].u[i] = elog2(vrs[vb].u[i]);
-			break;
-		case 8:		/* vrfin */
-			for (i = 0; i < 4; ++i)
-				vrs[vd].u[i] = rfin(vrs[vb].u[i]);
-			break;
-		case 9:		/* vrfiz */
-			for (i = 0; i < 4; ++i)
-				vrs[vd].u[i] = rfiz(vrs[vb].u[i]);
-			break;
-		case 10:	/* vrfip */
-			for (i = 0; i < 4; ++i) {
-				u32 x = vrs[vb].u[i];
-				x = (x & 0x80000000)? rfiz(x): rfii(x);
-				vrs[vd].u[i] = x;
-			}
-			break;
-		case 11:	/* vrfim */
-			for (i = 0; i < 4; ++i) {
-				u32 x = vrs[vb].u[i];
-				x = (x & 0x80000000)? rfii(x): rfiz(x);
-				vrs[vd].u[i] = x;
-			}
-			break;
-		case 14:	/* vctuxs */
-			for (i = 0; i < 4; ++i)
-				vrs[vd].u[i] = ctuxs(vrs[vb].u[i], va,
-						&current->thread.vscr.u[3]);
-			break;
-		case 15:	/* vctsxs */
-			for (i = 0; i < 4; ++i)
-				vrs[vd].u[i] = ctsxs(vrs[vb].u[i], va,
-						&current->thread.vscr.u[3]);
-			break;
-		default:
-			return -EINVAL;
-		}
-		break;
-	case 46:	/* vmaddfp */
-		vmaddfp(&vrs[vd], &vrs[va], &vrs[vb], &vrs[vc]);
-		break;
-	case 47:	/* vnmsubfp */
-		vnmsubfp(&vrs[vd], &vrs[va], &vrs[vb], &vrs[vc]);
-		break;
-	default:
-		return -EINVAL;
-	}
-
-	return 0;
-}

^ permalink raw reply

* [PATCH] powerpc: Merge include/asm-ppc*/a.out.h into include/asm-powerpc
From: Stephen Rothwell @ 2005-09-10 15:10 UTC (permalink / raw)
  To: paulus; +Cc: ppc64-dev, ppc-dev

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---

 include/asm-powerpc/a.out.h |   36 ++++++++++++++++++++++++++++++++++++
 include/asm-ppc/a.out.h     |   26 --------------------------
 include/asm-ppc64/a.out.h   |   39 ---------------------------------------
 3 files changed, 36 insertions(+), 65 deletions(-)
 create mode 100644 include/asm-powerpc/a.out.h
 delete mode 100644 include/asm-ppc/a.out.h
 delete mode 100644 include/asm-ppc64/a.out.h

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

dba4294fb3e51dc6f30e1f6252a5e0ae583db91f
diff --git a/include/asm-powerpc/a.out.h b/include/asm-powerpc/a.out.h
new file mode 100644
--- /dev/null
+++ b/include/asm-powerpc/a.out.h
@@ -0,0 +1,36 @@
+#ifndef _ASM_POWERPC_A_OUT_H
+#define _ASM_POWERPC_A_OUT_H
+
+struct exec
+{
+	unsigned long a_info;	/* Use macros N_MAGIC, etc for access */
+	unsigned a_text;	/* length of text, in bytes */
+	unsigned a_data;	/* length of data, in bytes */
+	unsigned a_bss;		/* length of uninitialized data area for file, in bytes */
+	unsigned a_syms;	/* length of symbol table data in file, in bytes */
+	unsigned a_entry;	/* start address */
+	unsigned a_trsize;	/* length of relocation info for text, in bytes */
+	unsigned a_drsize;	/* length of relocation info for data, in bytes */
+};
+
+#define N_TRSIZE(a)	((a).a_trsize)
+#define N_DRSIZE(a)	((a).a_drsize)
+#define N_SYMSIZE(a)	((a).a_syms)
+
+#ifdef __KERNEL__
+#ifdef __powerpc64__
+
+#define STACK_TOP_USER64 TASK_SIZE_USER64
+#define STACK_TOP_USER32 TASK_SIZE_USER32
+
+#define STACK_TOP (test_thread_flag(TIF_32BIT) ? \
+		   STACK_TOP_USER32 : STACK_TOP_USER64)
+
+#else /* __powerpc64__ */
+
+#define STACK_TOP TASK_SIZE
+
+#endif /* __powerpc64__ */
+#endif /* __KERNEL__ */
+
+#endif /* _ASM_POWERPC_A_OUT_H */
diff --git a/include/asm-ppc/a.out.h b/include/asm-ppc/a.out.h
deleted file mode 100644
--- a/include/asm-ppc/a.out.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef __PPC_A_OUT_H__
-#define __PPC_A_OUT_H__
-
-/* grabbed from the intel stuff  */
-#define STACK_TOP TASK_SIZE
-
-
-struct exec
-{
-  unsigned long a_info;		/* Use macros N_MAGIC, etc for access */
-  unsigned a_text;		/* length of text, in bytes */
-  unsigned a_data;		/* length of data, in bytes */
-  unsigned a_bss;		/* length of uninitialized data area for file, in bytes */
-  unsigned a_syms;		/* length of symbol table data in file, in bytes */
-  unsigned a_entry;		/* start address */
-  unsigned a_trsize;		/* length of relocation info for text, in bytes */
-  unsigned a_drsize;		/* length of relocation info for data, in bytes */
-};
-
-
-#define N_TRSIZE(a)	((a).a_trsize)
-#define N_DRSIZE(a)	((a).a_drsize)
-#define N_SYMSIZE(a)	((a).a_syms)
-
-
-#endif
diff --git a/include/asm-ppc64/a.out.h b/include/asm-ppc64/a.out.h
deleted file mode 100644
--- a/include/asm-ppc64/a.out.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef __PPC64_A_OUT_H__
-#define __PPC64_A_OUT_H__
-
-/*
- * c 2001 PPC 64 Team, IBM Corp
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-
-struct exec
-{
-	unsigned long a_info;	/* Use macros N_MAGIC, etc for access */
-	unsigned a_text;	/* length of text, in bytes */
-	unsigned a_data;	/* length of data, in bytes */
-	unsigned a_bss;		/* length of uninitialized data area for file, in bytes */
-	unsigned a_syms;	/* length of symbol table data in file, in bytes */
-	unsigned a_entry;	/* start address */
-	unsigned a_trsize;	/* length of relocation info for text, in bytes */
-	unsigned a_drsize;	/* length of relocation info for data, in bytes */
-};
-
-#define N_TRSIZE(a)	((a).a_trsize)
-#define N_DRSIZE(a)	((a).a_drsize)
-#define N_SYMSIZE(a)	((a).a_syms)
-
-#ifdef __KERNEL__
-
-#define STACK_TOP_USER64 TASK_SIZE_USER64
-#define STACK_TOP_USER32 TASK_SIZE_USER32
-
-#define STACK_TOP (test_thread_flag(TIF_32BIT) ? \
-		   STACK_TOP_USER32 : STACK_TOP_USER64)
-
-#endif /* __KERNEL__ */
-
-#endif /* __PPC64_A_OUT_H__ */

^ permalink raw reply

* [PATCH] powerpc: Move include3 to arch/$(ARCH)/include
From: Stephen Rothwell @ 2005-09-10 14:00 UTC (permalink / raw)
  To: Linus; +Cc: ppc64-dev, ppc-dev

This is less troublesome and makes more sense.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---

 arch/ppc/Makefile   |   16 +++++++++-------
 arch/ppc64/Makefile |   13 +++++++------
 2 files changed, 16 insertions(+), 13 deletions(-)

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

ed5a6c627c4bd12f2030318abb62e2c26e11113b
diff --git a/arch/ppc/Makefile b/arch/ppc/Makefile
--- a/arch/ppc/Makefile
+++ b/arch/ppc/Makefile
@@ -21,13 +21,14 @@ CC		:= $(CC) -m32
 endif
 
 LDFLAGS_vmlinux	:= -Ttext $(KERNELLOAD) -Bstatic
-CPPFLAGS	+= -Iarch/$(ARCH) -Iinclude3
+# The -Iarch/$(ARCH)/include is temporary while we are merging
+CPPFLAGS	+= -Iarch/$(ARCH) -Iarch/$(ARCH)/include
 AFLAGS		+= -Iarch/$(ARCH)
 CFLAGS		+= -Iarch/$(ARCH) -msoft-float -pipe \
 		-ffixed-r2 -mmultiple
 CPP		= $(CC) -E $(CFLAGS)
 # Temporary hack until we have migrated to asm-powerpc
-LINUXINCLUDE    += -Iinclude3
+LINUXINCLUDE    += -Iarch/$(ARCH)/include
 
 CHECKFLAGS	+= -D__powerpc__
 
@@ -103,15 +104,16 @@ endef
 
 archclean:
 	$(Q)$(MAKE) $(clean)=arch/ppc/boot
-	$(Q)rm -rf include3
+	# Temporary hack until we have migrated to asm-powerpc
+	$(Q)rm -rf arch/$(ARCH)/include
 
 prepare: checkbin
 
 # Temporary hack until we have migrated to asm-powerpc
-include/asm: include3/asm
-include3/asm:
-	$(Q)if [ ! -d include3 ]; then mkdir -p include3; fi
-	$(Q)ln -fsn $(srctree)/include/asm-powerpc include3/asm
+include/asm: arch/$(ARCH)/include/asm
+arch/$(ARCH)/include/asm:
+	$(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi
+	$(Q)ln -fsn $(srctree)/include/asm-powerpc arch/$(ARCH)/include/asm
 
 # Use the file '.tmp_gas_check' for binutils tests, as gas won't output
 # to stdout and these checks are run even on install targets.
diff --git a/arch/ppc64/Makefile b/arch/ppc64/Makefile
--- a/arch/ppc64/Makefile
+++ b/arch/ppc64/Makefile
@@ -56,7 +56,7 @@ LDFLAGS_vmlinux	:= -Bstatic -e $(KERNELL
 CFLAGS		+= -msoft-float -pipe -mminimal-toc -mtraceback=none \
 		   -mcall-aixdesc
 # Temporary hack until we have migrated to asm-powerpc
-CPPFLAGS	+= -Iinclude3
+CPPFLAGS	+= -Iarch/$(ARCH)/include
 
 GCC_VERSION     := $(call cc-version)
 GCC_BROKEN_VEC	:= $(shell if [ $(GCC_VERSION) -lt 0400 ] ; then echo "y"; fi ;)
@@ -115,14 +115,15 @@ all: $(KBUILD_IMAGE)
 
 archclean:
 	$(Q)$(MAKE) $(clean)=$(boot)
-	$(Q)rm -rf include3
+	# Temporary hack until we have migrated to asm-powerpc
+	$(Q)rm -rf arch/$(ARCH)/include
 
 
 # Temporary hack until we have migrated to asm-powerpc
-include/asm: include3/asm
-include3/asm:
-	$(Q)if [ ! -d include3 ]; then mkdir -p include3; fi;
-	$(Q)ln -fsn $(srctree)/include/asm-powerpc include3/asm
+include/asm: arch/$(ARCH)/include/asm
+arch/$(ARCH)/include/asm:
+	$(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi
+	$(Q)ln -fsn $(srctree)/include/asm-powerpc arch/$(ARCH)/include/asm
 
 define archhelp
   echo  '  zImage.vmode        - Compressed kernel image (arch/$(ARCH)/boot/zImage.vmode)'

^ permalink raw reply

* Re: PATCH ppc Merge asm-ppc*/posix_types.h
From: Paul Mackerras @ 2005-09-10 13:30 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linuxppc-dev, linuxppc64-dev
In-Reply-To: <20050910201222.6861b172.sfr@canb.auug.org.au>

Stephen Rothwell writes:

> On 32 bit, int == long, so the last three could be removed from the ifdef
> by making them {unsigned }long ...

Yeah, I tried changing those to unsigned long once, long ago, and ran
into problems because this header gets used in userspace, and gcc
seems to have a fixed idea that size_t is unsigned int on ppc32.
I think we should leave it as unsigned int.

Paul.

^ permalink raw reply

* Re: [PATCH 2/4] arch/ppc: Replace custom macro with isdigit()
From: Paul Mackerras @ 2005-09-10 13:26 UTC (permalink / raw)
  To: Tobias Klauser; +Cc: akpm, kernel-janitors, linuxppc-dev, trini
In-Reply-To: <20050910121633.GC1218@neon.tklauser.home>

Tobias Klauser writes:

> Replace the custom is_digit() macro with isdigit() from <linux/ctype.h>

NAK.  No point pulling in 256 bytes of _ctype array when all we use it
for is two '0' <= c <= '9' comparisons.

In fact Tom Rini maintains this code, so it's his opinion that counts.

Paul.

^ permalink raw reply

* Re: PATCH ppc Merge asm-ppc*/posix_types.h
From: jdl @ 2005-09-10 12:52 UTC (permalink / raw)
  To: linuxppc-dev, linuxppc64-dev

> On Fri, 09 Sep 2005 16:43:52 -0500 jdl at freescale.com wrote:
> >
> > +#ifdef __powerpc64__
> > +typedef unsigned long	__kernel_nlink_t;
> > +typedef int             __kernel_ipc_pid_t;
> > +typedef unsigned long	__kernel_size_t;
> > +typedef long		__kernel_ssize_t;
> > +typedef unsigned long	__kernel_old_dev_t;
> > +#else
> > +typedef unsigned short	__kernel_nlink_t;
> > +typedef short		__kernel_ipc_pid_t;
> > +typedef unsigned int	__kernel_size_t;
> > +typedef int		__kernel_ssize_t;
> > +typedef unsigned int	__kernel_old_dev_t;
> > +#endif
> 
> On 32 bit, int == long, so the last three could be removed from the ifdef
> by making them {unsigned }long ...

Yeah, I tried that too.  In the ppc32 tree, it just starts looking
nasty all over the place:

      CC      drivers/pci/pci-driver.o
    fs/proc/base.c: In function `seccomp_write':
    fs/proc/base.c:932: warning: comparison of distinct pointer types lacks a cast
    net/sunrpc/svcsock.c: In function `svc_sendto':
    net/sunrpc/svcsock.c:424: warning: unsigned int format, size_t arg (arg 4)
    net/sunrpc/svcsock.c: In function `svc_recvfrom':
    net/sunrpc/svcsock.c:477: warning: unsigned int format, size_t arg (arg 4)

Lots of others just like it:

      CC      lib/klist.o
    net/core/dev.c: In function `dev_ifsioc':
    net/core/dev.c:2293: warning: comparison of distinct pointer types lacks a cast
    net/core/dev.c:2304: warning: comparison of distinct pointer types lacks a cast

Pick your favorite subsystem! :-)

I opted to maintain current breakage rather than try to
fix anything and introduce new breakage. :-)

I think that the approach we're taking here of placing
the related-but-differing-by-a-__powerpc64__ concepts as
close to each other as possible is a good one.  In particular
it calls attention to it, and causes people to wonder "Why
is _that_ there?  Why don't we just combine it like so..."
And we probably should.  It is just biting off more than
we likely should at this step.  Later, yes.

jdl

PS -Sorry about breaking threading; different MUA here.

^ permalink raw reply

* [PATCH 2/4] arch/ppc: Replace custom macro with isdigit()
From: Tobias Klauser @ 2005-09-10 12:16 UTC (permalink / raw)
  To: kernel-janitors; +Cc: akpm, linuxppc-dev

Replace the custom is_digit() macro with isdigit() from <linux/ctype.h>

Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>

---

 arch/ppc/boot/common/misc-common.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff -urpN -X dontdiff linux-2.6.13/arch/ppc/boot/common/misc-common.c linux-2.6.13~macro_removal/arch/ppc/boot/common/misc-common.c
--- linux-2.6.13/arch/ppc/boot/common/misc-common.c	2005-08-29 01:41:01.000000000 +0200
+++ linux-2.6.13~macro_removal/arch/ppc/boot/common/misc-common.c	2005-09-10 12:38:31.000000000 +0200
@@ -16,6 +16,7 @@
 
 #include <stdarg.h>	/* for va_ bits */
 #include <linux/config.h>
+#include <linux/ctype.h>
 #include <linux/string.h>
 #include <linux/zlib.h>
 #include "nonstdio.h"
@@ -301,8 +302,6 @@ _printk(char const *fmt, ...)
 	return;
 }
 
-#define is_digit(c) ((c >= '0') && (c <= '9'))
-
 void
 _vprintk(void(*putc)(const char), const char *fmt0, va_list ap)
 {
@@ -329,7 +328,7 @@ _vprintk(void(*putc)(const char), const 
 			{
 				zero_fill = FALSE;
 			}
-			while (is_digit(c))
+			while (isdigit(c))
 			{
 				left_prec = (left_prec * 10) + (c - '0');
 				c = *fmt0++;
@@ -338,7 +337,7 @@ _vprintk(void(*putc)(const char), const 
 			{
 				c = *fmt0++;
 				zero_fill++;
-				while (is_digit(c))
+				while (isdigit(c))
 				{
 					right_prec = (right_prec * 10) + (c - '0');
 					c = *fmt0++;

^ permalink raw reply

* [PATCH] ppc32: support hotplug cpu on powermacs
From: Paul Mackerras @ 2005-09-10 11:13 UTC (permalink / raw)
  To: torvalds; +Cc: akpm, linuxppc-dev

This allows cpus to be off-lined on 32-bit SMP powermacs.  When a cpu
is off-lined, it is put into sleep mode with interrupts disabled.  It
can be on-lined again by asserting its soft-reset pin, which is
connected to a GPIO pin.

With this I can off-line the second cpu in my dual G4 powermac, which
means that I can then suspend the machine (the suspend/resume code
refuses to suspend if more than one cpu is online, and making it cope
with multiple cpus is surprisingly messy).

Signed-off-by: Paul Mackerras <paulus@samba.org>
---
diff -urN linux-2.6/arch/ppc/Kconfig test/arch/ppc/Kconfig
--- linux-2.6/arch/ppc/Kconfig	2005-09-10 09:25:11.000000000 +1000
+++ test/arch/ppc/Kconfig	2005-09-10 19:48:24.000000000 +1000
@@ -265,6 +265,15 @@
 
 	  If in doubt, say Y here.
 
+config HOTPLUG_CPU
+	bool "Support for enabling/disabling CPUs"
+	depends on SMP && HOTPLUG && EXPERIMENTAL && PPC_PMAC
+	---help---
+	  Say Y here to be able to disable and re-enable individual
+	  CPUs at runtime on SMP machines.
+
+	  Say N if you are unsure.
+
 source arch/ppc/platforms/4xx/Kconfig
 source arch/ppc/platforms/85xx/Kconfig
 
diff -urN linux-2.6/arch/ppc/kernel/head.S test/arch/ppc/kernel/head.S
--- linux-2.6/arch/ppc/kernel/head.S	2005-09-10 09:25:11.000000000 +1000
+++ test/arch/ppc/kernel/head.S	2005-09-10 19:48:24.000000000 +1000
@@ -1023,23 +1023,21 @@
         andc    r4,r4,r3
         mtspr   SPRN_HID0,r4
         sync
-        bl      gemini_prom_init
         b       __secondary_start
 #endif /* CONFIG_GEMINI */
-	.globl	__secondary_start_psurge
-__secondary_start_psurge:
-	li	r24,1			/* cpu # */
-	b	__secondary_start_psurge99
-	.globl	__secondary_start_psurge2
-__secondary_start_psurge2:
-	li	r24,2			/* cpu # */
-	b	__secondary_start_psurge99
-	.globl	__secondary_start_psurge3
-__secondary_start_psurge3:
-	li	r24,3			/* cpu # */
-	b	__secondary_start_psurge99
-__secondary_start_psurge99:
-	/* we come in here with IR=0 and DR=1, and DBAT 0
+
+	.globl	__secondary_start_pmac_0
+__secondary_start_pmac_0:
+	/* NB the entries for cpus 0, 1, 2 must each occupy 8 bytes. */
+	li	r24,0
+	b	1f
+	li	r24,1
+	b	1f
+	li	r24,2
+	b	1f
+	li	r24,3
+1:
+	/* on powersurge, we come in here with IR=0 and DR=1, and DBAT 0
 	   set to map the 0xf0000000 - 0xffffffff region */
 	mfmsr	r0
 	rlwinm	r0,r0,0,28,26		/* clear DR (0x10) */
diff -urN linux-2.6/arch/ppc/kernel/idle.c test/arch/ppc/kernel/idle.c
--- linux-2.6/arch/ppc/kernel/idle.c	2005-04-26 15:37:55.000000000 +1000
+++ test/arch/ppc/kernel/idle.c	2005-09-10 19:48:24.000000000 +1000
@@ -22,6 +22,7 @@
 #include <linux/ptrace.h>
 #include <linux/slab.h>
 #include <linux/sysctl.h>
+#include <linux/cpu.h>
 
 #include <asm/pgtable.h>
 #include <asm/uaccess.h>
@@ -35,6 +36,7 @@
 void default_idle(void)
 {
 	void (*powersave)(void);
+	int cpu = smp_processor_id();
 
 	powersave = ppc_md.power_save;
 
@@ -44,7 +46,7 @@
 #ifdef CONFIG_SMP
 		else {
 			set_thread_flag(TIF_POLLING_NRFLAG);
-			while (!need_resched())
+			while (!need_resched() && !cpu_is_offline(cpu))
 				barrier();
 			clear_thread_flag(TIF_POLLING_NRFLAG);
 		}
@@ -52,6 +54,8 @@
 	}
 	if (need_resched())
 		schedule();
+	if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING)
+		cpu_die();
 }
 
 /*
diff -urN linux-2.6/arch/ppc/kernel/smp.c test/arch/ppc/kernel/smp.c
--- linux-2.6/arch/ppc/kernel/smp.c	2005-04-26 15:37:55.000000000 +1000
+++ test/arch/ppc/kernel/smp.c	2005-09-10 19:48:24.000000000 +1000
@@ -45,6 +45,7 @@
 cpumask_t cpu_possible_map;
 int smp_hw_index[NR_CPUS];
 struct thread_info *secondary_ti;
+static struct task_struct *idle_tasks[NR_CPUS];
 
 EXPORT_SYMBOL(cpu_online_map);
 EXPORT_SYMBOL(cpu_possible_map);
@@ -286,7 +287,8 @@
 
 void __init smp_prepare_cpus(unsigned int max_cpus)
 {
-	int num_cpus, i;
+	int num_cpus, i, cpu;
+	struct task_struct *p;
 
 	/* Fixup boot cpu */
         smp_store_cpu_info(smp_processor_id());
@@ -308,6 +310,17 @@
 
 	if (smp_ops->space_timers)
 		smp_ops->space_timers(num_cpus);
+
+	for_each_cpu(cpu) {
+		if (cpu == smp_processor_id())
+			continue;
+		/* create a process for the processor */
+		p = fork_idle(cpu);
+		if (IS_ERR(p))
+			panic("failed fork for CPU %u: %li", cpu, PTR_ERR(p));
+		p->thread_info->cpu = cpu;
+		idle_tasks[cpu] = p;
+	}
 }
 
 void __devinit smp_prepare_boot_cpu(void)
@@ -334,12 +347,17 @@
 	set_dec(tb_ticks_per_jiffy);
 	cpu_callin_map[cpu] = 1;
 
-	printk("CPU %i done callin...\n", cpu);
+	printk("CPU %d done callin...\n", cpu);
 	smp_ops->setup_cpu(cpu);
-	printk("CPU %i done setup...\n", cpu);
-	local_irq_enable();
+	printk("CPU %d done setup...\n", cpu);
 	smp_ops->take_timebase();
-	printk("CPU %i done timebase take...\n", cpu);
+	printk("CPU %d done timebase take...\n", cpu);
+
+	spin_lock(&call_lock);
+	cpu_set(cpu, cpu_online_map);
+	spin_unlock(&call_lock);
+
+	local_irq_enable();
 
 	cpu_idle();
 	return 0;
@@ -347,17 +365,11 @@
 
 int __cpu_up(unsigned int cpu)
 {
-	struct task_struct *p;
 	char buf[32];
 	int c;
 
-	/* create a process for the processor */
-	/* only regs.msr is actually used, and 0 is OK for it */
-	p = fork_idle(cpu);
-	if (IS_ERR(p))
-		panic("failed fork for CPU %u: %li", cpu, PTR_ERR(p));
-	secondary_ti = p->thread_info;
-	p->thread_info->cpu = cpu;
+	secondary_ti = idle_tasks[cpu]->thread_info;
+	mb();
 
 	/*
 	 * There was a cache flush loop here to flush the cache
@@ -389,7 +401,11 @@
 	printk("Processor %d found.\n", cpu);
 
 	smp_ops->give_timebase();
-	cpu_set(cpu, cpu_online_map);
+
+	/* Wait until cpu puts itself in the online map */
+	while (!cpu_online(cpu))
+		cpu_relax();
+
 	return 0;
 }
 
diff -urN linux-2.6/arch/ppc/platforms/pmac_sleep.S test/arch/ppc/platforms/pmac_sleep.S
--- linux-2.6/arch/ppc/platforms/pmac_sleep.S	2005-09-10 09:25:11.000000000 +1000
+++ test/arch/ppc/platforms/pmac_sleep.S	2005-09-10 19:48:24.000000000 +1000
@@ -161,6 +161,8 @@
 	addi r3,r3,sleep_storage@l
 	stw r5,0(r3)
 
+	.globl	low_cpu_die
+low_cpu_die:
 	/* Flush & disable all caches */
 	bl	flush_disable_caches
 
diff -urN linux-2.6/arch/ppc/platforms/pmac_smp.c test/arch/ppc/platforms/pmac_smp.c
--- linux-2.6/arch/ppc/platforms/pmac_smp.c	2005-04-26 15:37:55.000000000 +1000
+++ test/arch/ppc/platforms/pmac_smp.c	2005-09-10 19:48:24.000000000 +1000
@@ -33,6 +33,7 @@
 #include <linux/spinlock.h>
 #include <linux/errno.h>
 #include <linux/hardirq.h>
+#include <linux/cpu.h>
 
 #include <asm/ptrace.h>
 #include <asm/atomic.h>
@@ -55,9 +56,7 @@
  * Powersurge (old powermac SMP) support.
  */
 
-extern void __secondary_start_psurge(void);
-extern void __secondary_start_psurge2(void);	/* Temporary horrible hack */
-extern void __secondary_start_psurge3(void);	/* Temporary horrible hack */
+extern void __secondary_start_pmac_0(void);
 
 /* Addresses for powersurge registers */
 #define HAMMERHEAD_BASE		0xf8000000
@@ -119,7 +118,7 @@
 static unsigned int pri_tb_hi, pri_tb_lo;
 static unsigned int pri_tb_stamp;
 
-static void __init core99_init_caches(int cpu)
+static void __devinit core99_init_caches(int cpu)
 {
 	if (!cpu_has_feature(CPU_FTR_L2CR))
 		return;
@@ -346,7 +345,7 @@
 
 static void __init smp_psurge_kick_cpu(int nr)
 {
-	void (*start)(void) = __secondary_start_psurge;
+	unsigned long start = __pa(__secondary_start_pmac_0) + nr * 8;
 	unsigned long a;
 
 	/* may need to flush here if secondary bats aren't setup */
@@ -356,17 +355,7 @@
 
 	if (ppc_md.progress) ppc_md.progress("smp_psurge_kick_cpu", 0x353);
 
-	/* setup entry point of secondary processor */
-	switch (nr) {
-	case 2:
-		start = __secondary_start_psurge2;
-		break;
-	case 3:
-		start = __secondary_start_psurge3;
-		break;
-	}
-
-	out_be32(psurge_start, __pa(start));
+	out_be32(psurge_start, start);
 	mb();
 
 	psurge_set_ipi(nr);
@@ -500,14 +489,14 @@
 	return ncpus;
 }
 
-static void __init smp_core99_kick_cpu(int nr)
+static void __devinit smp_core99_kick_cpu(int nr)
 {
 	unsigned long save_vector, new_vector;
 	unsigned long flags;
 
 	volatile unsigned long *vector
 		 = ((volatile unsigned long *)(KERNELBASE+0x100));
-	if (nr < 1 || nr > 3)
+	if (nr < 0 || nr > 3)
 		return;
 	if (ppc_md.progress) ppc_md.progress("smp_core99_kick_cpu", 0x346);
 
@@ -518,19 +507,9 @@
 	save_vector = *vector;
 
 	/* Setup fake reset vector that does	
-	 *   b __secondary_start_psurge - KERNELBASE
+	 *   b __secondary_start_pmac_0 + nr*8 - KERNELBASE
 	 */
-	switch(nr) {
-		case 1:
-			new_vector = (unsigned long)__secondary_start_psurge;
-			break;
-		case 2:
-			new_vector = (unsigned long)__secondary_start_psurge2;
-			break;
-		case 3:
-			new_vector = (unsigned long)__secondary_start_psurge3;
-			break;
-	}
+	new_vector = (unsigned long) __secondary_start_pmac_0 + nr * 8;
 	*vector = 0x48000002 + new_vector - KERNELBASE;
 
 	/* flush data cache and inval instruction cache */
@@ -554,7 +533,7 @@
 	if (ppc_md.progress) ppc_md.progress("smp_core99_kick_cpu done", 0x347);
 }
 
-static void __init smp_core99_setup_cpu(int cpu_nr)
+static void __devinit smp_core99_setup_cpu(int cpu_nr)
 {
 	/* Setup L2/L3 */
 	if (cpu_nr != 0)
@@ -668,3 +647,47 @@
 	.give_timebase	= smp_core99_give_timebase,
 	.take_timebase	= smp_core99_take_timebase,
 };
+
+#ifdef CONFIG_HOTPLUG_CPU
+
+int __cpu_disable(void)
+{
+	cpu_clear(smp_processor_id(), cpu_online_map);
+
+	/* XXX reset cpu affinity here */
+	openpic_set_priority(0xf);
+	asm volatile("mtdec %0" : : "r" (0x7fffffff));
+	mb();
+	udelay(20);
+	asm volatile("mtdec %0" : : "r" (0x7fffffff));
+	return 0;
+}
+
+extern void low_cpu_die(void) __attribute__((noreturn)); /* in pmac_sleep.S */
+static int cpu_dead[NR_CPUS];
+
+void cpu_die(void)
+{
+	local_irq_disable();
+	cpu_dead[smp_processor_id()] = 1;
+	mb();
+	low_cpu_die();
+}
+
+void __cpu_die(unsigned int cpu)
+{
+	int timeout;
+
+	timeout = 1000;
+	while (!cpu_dead[cpu]) {
+		if (--timeout == 0) {
+			printk("CPU %u refused to die!\n", cpu);
+			break;
+		}
+		msleep(1);
+	}
+	cpu_callin_map[cpu] = 0;
+	cpu_dead[cpu] = 0;
+}
+
+#endif
diff -urN linux-2.6/include/asm-ppc/smp.h test/include/asm-ppc/smp.h
--- linux-2.6/include/asm-ppc/smp.h	2005-06-24 13:39:01.000000000 +1000
+++ test/include/asm-ppc/smp.h	2005-09-10 20:06:39.000000000 +1000
@@ -41,6 +41,10 @@
 struct pt_regs;
 extern void smp_message_recv(int, struct pt_regs *);
 
+extern int __cpu_disable(void);
+extern void __cpu_die(unsigned int cpu);
+extern void cpu_die(void) __attribute__((noreturn));
+
 #define NO_PROC_ID		0xFF            /* No processor magic marker */
 #define PROC_CHANGE_PENALTY	20
 
@@ -64,6 +68,8 @@
 
 #else /* !(CONFIG_SMP) */
 
+static inline void cpu_die(void) { }
+
 #endif /* !(CONFIG_SMP) */
 
 #endif /* !(_PPC_SMP_H) */

^ permalink raw reply

* [PATCH] ppc32: Kill init on unhandled synchronous signals
From: Paul Mackerras @ 2005-09-10 11:13 UTC (permalink / raw)
  To: torvalds; +Cc: akpm, linuxppc-dev

This is a patch that I have had in my tree for ages.  If init causes
an exception that raises a signal, such as a SIGSEGV, SIGILL or
SIGFPE, and it hasn't registered a handler for it, we don't deliver
the signal, since init doesn't get any signals that it doesn't have a
handler for.  But that means that we just return to userland and
generate the same exception again immediately.  With this patch we
print a message and kill init in this situation.

This is very useful when you have a bug in the kernel that means that
init doesn't get as far as executing its first instruction. :)
Without this patch the system hangs when it gets to starting the
userland init; with it you at least get a message giving you a clue
about what has gone wrong.

Signed-off-by: Paul Mackerras <paulus@samba.org>
---
diff -urx .git linux-2.6/arch/ppc/kernel/traps.c test/arch/ppc/kernel/traps.c
--- linux-2.6/arch/ppc/kernel/traps.c	2005-09-10 09:25:11.000000000 +1000
+++ test/arch/ppc/kernel/traps.c	2005-09-10 19:34:18.000000000 +1000
@@ -118,6 +118,28 @@
 	info.si_code = code;
 	info.si_addr = (void __user *) addr;
 	force_sig_info(signr, &info, current);
+
+	/*
+	 * Init gets no signals that it doesn't have a handler for.
+	 * That's all very well, but if it has caused a synchronous
+	 * exception and we ignore the resulting signal, it will just
+	 * generate the same exception over and over again and we get
+	 * nowhere.  Better to kill it and let the kernel panic.
+	 */
+	if (current->pid == 1) {
+		__sighandler_t handler;
+
+		spin_lock_irq(&current->sighand->siglock);
+		handler = current->sighand->action[signr-1].sa.sa_handler;
+		spin_unlock_irq(&current->sighand->siglock);
+		if (handler == SIG_DFL) {
+			/* init has generated a synchronous exception
+			   and it doesn't have a handler for the signal */
+			printk(KERN_CRIT "init has generated signal %d "
+			       "but has no handler for it\n", signr);
+			do_exit(signr);
+		}
+	}
 }
 
 /*
diff -urx .git linux-2.6/arch/ppc/mm/fault.c test/arch/ppc/mm/fault.c
--- linux-2.6/arch/ppc/mm/fault.c	2005-04-26 15:37:55.000000000 +1000
+++ test/arch/ppc/mm/fault.c	2005-09-10 19:34:19.000000000 +1000
@@ -278,11 +278,7 @@
 
 	/* User mode accesses cause a SIGSEGV */
 	if (user_mode(regs)) {
-		info.si_signo = SIGSEGV;
-		info.si_errno = 0;
-		info.si_code = code;
-		info.si_addr = (void __user *) address;
-		force_sig_info(SIGSEGV, &info, current);
+		_exception(SIGSEGV, regs, code, address);
 		return 0;
 	}
 
diff -urx .git linux-2.6/include/asm-ppc/system.h test/include/asm-ppc/system.h
--- linux-2.6/include/asm-ppc/system.h	2005-09-07 08:51:40.000000000 +1000
+++ test/include/asm-ppc/system.h	2005-09-10 19:34:49.000000000 +1000
@@ -88,6 +88,7 @@
 extern int do_page_fault(struct pt_regs *, unsigned long, unsigned long);
 extern void bad_page_fault(struct pt_regs *, unsigned long, int);
 extern void die(const char *, struct pt_regs *, long);
+extern void _exception(int, struct pt_regs *, int, unsigned long);
 #ifdef CONFIG_BOOKE_WDT
 extern u32 booke_wdt_enabled;
 extern u32 booke_wdt_period;

^ permalink raw reply

* Re: PATCH ppc Merge asm-ppc*/posix_types.h
From: Stephen Rothwell @ 2005-09-10 10:12 UTC (permalink / raw)
  To: jdl; +Cc: linuxppc-dev, linuxppc64-dev
In-Reply-To: <E1EDqf2-0001Rh-Da@jdl.com>

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

On Fri, 09 Sep 2005 16:43:52 -0500 jdl@freescale.com wrote:
>
> +#ifdef __powerpc64__
> +typedef unsigned long  	__kernel_nlink_t;
> +typedef int             __kernel_ipc_pid_t;
> +typedef unsigned long	__kernel_size_t;
> +typedef long		__kernel_ssize_t;
> +typedef unsigned long	__kernel_old_dev_t;
> +#else
> +typedef unsigned short	__kernel_nlink_t;
> +typedef short		__kernel_ipc_pid_t;
> +typedef unsigned int	__kernel_size_t;
> +typedef int		__kernel_ssize_t;
> +typedef unsigned int	__kernel_old_dev_t;
> +#endif

On 32 bit, int == long, so the last three could be removed from the ifdef
by making them {unsigned }long ...

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

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

^ permalink raw reply

* [PATCH 2/2] Add support for MEMEC 2VP30-FF1152 eval board with simple FPGA design
From: Grant Likely @ 2005-09-10  7:37 UTC (permalink / raw)
  To: linuxppc-embedded

Here is an example port to another V2PRO based board.

This patch is for information only and is NOT suitable for submission up to
mainline

---

 arch/ppc/boot/simple/embed_config.c                |   12 +-
 arch/ppc/platforms/4xx/Kconfig                     |    9 +
 arch/ppc/platforms/4xx/Makefile                    |    1=20
 arch/ppc/platforms/4xx/memec_2vp30.c               |  157 ++++++++++++++++=
++++
 arch/ppc/platforms/4xx/memec_2vp30.h               |   47 ++++++
 arch/ppc/platforms/4xx/memec_2vp30_devices.c       |   59 ++++++++
 arch/ppc/platforms/4xx/xparameters/xparameters.h   |   29 ++++
 .../4xx/xparameters/xparameters_memec_2vp30.h      |  100 +++++++++++++++
 include/asm-ppc/ibm4xx.h                           |    4 +
 9 files changed, 410 insertions(+), 8 deletions(-)
 create mode 100644 arch/ppc/platforms/4xx/memec_2vp30.c
 create mode 100644 arch/ppc/platforms/4xx/memec_2vp30.h
 create mode 100644 arch/ppc/platforms/4xx/memec_2vp30_devices.c
 create mode 100644 arch/ppc/platforms/4xx/xparameters/xparameters_memec_2v=
p30.h

5f6cd89ad6b695ac30c18dff79c9054f66979899
diff --git a/arch/ppc/boot/simple/embed_config.c
b/arch/ppc/boot/simple/embed_config.c
--- a/arch/ppc/boot/simple/embed_config.c
+++ b/arch/ppc/boot/simple/embed_config.c
@@ -745,7 +745,7 @@ embed_config(bd_t **bdp)
 }
 #endif /* WILLOW */
=20
-#ifdef CONFIG_XILINX_ML300
+#ifdef CONFIG_VIRTEX_II_PRO
 void
 embed_config(bd_t ** bdp)
 {
@@ -775,14 +775,14 @@ embed_config(bd_t ** bdp)
=20
 =09bd =3D &bdinfo;
 =09*bdp =3D bd;
-=09bd->bi_memsize =3D XPAR_DDR_0_SIZE;
-=09bd->bi_intfreq =3D XPAR_CORE_CLOCK_FREQ_HZ;
-=09bd->bi_busfreq =3D XPAR_PLB_CLOCK_FREQ_HZ;
-=09bd->bi_pci_busfreq =3D XPAR_PCI_0_CLOCK_FREQ_HZ;
+=09bd->bi_memsize =3D V2PRO_BI_MEMSIZE;
+=09bd->bi_intfreq =3D V2PRO_BI_INTFREQ;
+=09bd->bi_busfreq =3D V2PRO_BI_BUSFREQ;
+=09bd->bi_pci_busfreq =3D V2PRO_BI_PCI_BUSFREQ;
 =09timebase_period_ns =3D 1000000000 / bd->bi_tbfreq;
 =09/* see bi_tbfreq definition in arch/ppc/platforms/4xx/xilinx_ml300.h */
 }
-#endif /* CONFIG_XILINX_ML300 */
+#endif /* CONFIG_VIRTEX_II_PRO */
=20
 #ifdef CONFIG_IBM_OPENBIOS
 /* This could possibly work for all treeboot roms.
diff --git a/arch/ppc/platforms/4xx/Kconfig b/arch/ppc/platforms/4xx/Kconfi=
g
--- a/arch/ppc/platforms/4xx/Kconfig
+++ b/arch/ppc/platforms/4xx/Kconfig
@@ -67,6 +67,11 @@ config XILINX_ML300
 =09help
 =09  This option enables support for the Xilinx ML300 evaluation board.
=20
+config MEMEC_2VP30
+=09bool "MEMEC 2VP30 Eval Board"
+=09help
+=09  This option enables support for the MEMEC 2VP30-FF1152 eval board.
+
 endchoice
=20
 choice
@@ -203,7 +208,7 @@ config 405GPR
=20
 config VIRTEX_II_PRO
 =09bool
-=09depends on XILINX_ML300
+=09depends on XILINX_ML300 || MEMEC_2VP30
 =09default y
=20
 config VIRTEX_II_PRO_TLB_FIX
@@ -229,7 +234,7 @@ config STB03xxx
=20
 config EMBEDDEDBOOT
 =09bool
-=09depends on EP405 || XILINX_ML300
+=09depends on EP405 || XILINX_ML300 || MEMEC_2VP30
 =09default y
=20
 config IBM_OPENBIOS
diff --git a/arch/ppc/platforms/4xx/Makefile b/arch/ppc/platforms/4xx/Makef=
ile
--- a/arch/ppc/platforms/4xx/Makefile
+++ b/arch/ppc/platforms/4xx/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_REDWOOD_6)=09=09+=3D redwood6.o
 obj-$(CONFIG_SYCAMORE)=09=09+=3D sycamore.o
 obj-$(CONFIG_WALNUT)=09=09+=3D walnut.o
 obj-$(CONFIG_XILINX_ML300)=09+=3D xilinx_ml300.o xilinx_ml300_devices.o
+obj-$(CONFIG_MEMEC_2VP30)=09+=3D memec_2vp30.o memec_2vp30_devices.o
=20
 obj-$(CONFIG_405GP)=09=09+=3D ibm405gp.o
 obj-$(CONFIG_REDWOOD_5)=09=09+=3D ibmstb4.o
diff --git a/arch/ppc/platforms/4xx/memec_2vp30.c
b/arch/ppc/platforms/4xx/memec_2vp30.c
new file mode 100644
--- /dev/null
+++ b/arch/ppc/platforms/4xx/memec_2vp30.c
@@ -0,0 +1,157 @@
+/*
+ * arch/ppc/platforms/4xx/memec_2vp30.c
+ *
+ * MEMEC 2VP30-FF1152 evaluation board initialization
+ *
+ * Author: MontaVista Software, Inc.
+ *         source@mvista.com
+ *
+ * 2002-2004 (c) MontaVista Software, Inc.  This file is licensed under th=
e
+ * terms of the GNU General Public License version 2.  This program is lic=
ensed
+ * "as is" without any warranty of any kind, whether express or implied.
+ */
+
+#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/irq.h>
+#include <linux/tty.h>
+#include <linux/serial.h>
+#include <linux/serial_core.h>
+#include <linux/serial_8250.h>
+#include <linux/serialP.h>
+#include <asm/io.h>
+#include <asm/machdep.h>
+#include <asm/ppc_sys.h>
+
+#include <syslib/gen550.h>
+#include "xparameters/xparameters.h"
+
+/*
+ * As an overview of how the following functions (platform_init,
+ * memec_map_io, memec_setup_arch and memec_init_IRQ) fit into the
+ * kernel startup procedure, here's a call tree:
+ *
+ * start_here=09=09=09=09=09arch/ppc/kernel/head_4xx.S
+ *  early_init=09=09=09=09=09arch/ppc/kernel/setup.c
+ *  machine_init=09=09=09=09arch/ppc/kernel/setup.c
+ *    platform_init=09=09=09=09this file
+ *      ppc4xx_init=09=09=09=09arch/ppc/syslib/ppc4xx_setup.c
+ *        parse_bootinfo
+ *          find_bootinfo
+ *        "setup some default ppc_md pointers"
+ *  MMU_init=09=09=09=09=09arch/ppc/mm/init.c
+ *    *ppc_md.setup_io_mappings =3D=3D memec_map_io=09this file
+ *      ppc4xx_map_io=09=09=09=09arch/ppc/syslib/ppc4xx_setup.c
+ *  start_kernel=09=09=09=09init/main.c
+ *    setup_arch=09=09=09=09arch/ppc/kernel/setup.c
+ * #if defined(CONFIG_KGDB)
+ *      *ppc_md.kgdb_map_scc() =3D=3D gen550_kgdb_map_scc
+ * #endif
+ *      *ppc_md.setup_arch =3D=3D memec_setup_arch=09this file
+ *        ppc4xx_setup_arch=09=09=09arch/ppc/syslib/ppc4xx_setup.c
+ *          ppc4xx_find_bridges=09=09=09arch/ppc/syslib/ppc405_pci.c
+ *    init_IRQ=09=09=09=09=09arch/ppc/kernel/irq.c
+ *      *ppc_md.init_IRQ =3D=3D memec_init_IRQ=09this file
+ *        ppc4xx_init_IRQ=09=09=09arch/ppc/syslib/ppc4xx_setup.c
+ *          ppc4xx_pic_init=09=09=09arch/ppc/syslib/xilinx_pic.c
+ */
+
+#if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
+
+static volatile unsigned *powerdown_base =3D
+    (volatile unsigned *) XPAR_POWER_0_POWERDOWN_BASEADDR;
+
+static void
+xilinx_power_off(void)
+{
+=09local_irq_disable();
+=09out_be32(powerdown_base, XPAR_POWER_0_POWERDOWN_VALUE);
+=09while (1) ;
+}
+#endif
+
+void __init
+memec_map_io(void)
+{
+=09ppc4xx_map_io();
+
+#if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
+=09powerdown_base =3D ioremap((unsigned long) powerdown_base,
+=09=09=09=09 XPAR_POWER_0_POWERDOWN_HIGHADDR -
+=09=09=09=09 XPAR_POWER_0_POWERDOWN_BASEADDR + 1);
+#endif
+}
+
+#ifdef CONFIG_SERIAL_8250
+static void __init
+memec_early_serial_map(void)
+{
+#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
+=09struct uart_port serial_req;
+#endif
+=09struct plat_serial8250_port *pdata;
+=09int i =3D 0;
+
+=09pdata =3D (struct plat_serial8250_port *) ppc_sys_get_pdata(V2PRO_UART)=
;
+=09while(pdata && pdata->flags)
+=09{
+=09=09pdata->membase =3D ioremap(pdata->mapbase, 0x100);
+
+#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
+=09=09memset(&serial_req, 0, sizeof(serial_req));
+=09=09serial_req.mapbase=09=3D pdata->mapbase;
+=09=09serial_req.membase=09=3D pdata->membase;
+=09=09serial_req.irq=09=09=3D pdata->irq;
+=09=09serial_req.uartclk=09=3D pdata->uartclk;
+=09=09serial_req.regshift=09=3D pdata->regshift;
+=09=09serial_req.iotype=09=3D pdata->iotype;
+=09=09serial_req.flags=09=3D pdata->flags;
+=09=09gen550_init(i, &serial_req);
+#endif
+=09=09pdata++;
+=09=09i++;
+=09}
+}
+#endif /* CONFIG_SERIAL_8250 */
+
+void __init
+memec_setup_arch(void)
+{
+#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_KGDB)
+=09memec_early_serial_map();
+#endif
+
+=09ppc4xx_setup_arch();=09/* calls ppc4xx_find_bridges() */
+
+=09/* Identify the system */
+=09printk(KERN_INFO "Xilinx Virtex-II Pro port\n");
+}
+
+/* Called after board_setup_irq from ppc4xx_init_IRQ(). */
+void __init
+memec_init_irq(void)
+{
+=09ppc4xx_init_IRQ();
+}
+
+void __init
+platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
+=09      unsigned long r6, unsigned long r7)
+{
+=09ppc4xx_init(r3, r4, r5, r6, r7);
+
+=09identify_ppc_sys_by_id(mfspr(SPRN_PVR));
+
+=09ppc_md.setup_arch =3D memec_setup_arch;
+=09ppc_md.setup_io_mappings =3D memec_map_io;
+=09ppc_md.init_IRQ =3D memec_init_irq;
+
+#if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
+=09ppc_md.power_off =3D xilinx_power_off;
+#endif
+
+#ifdef CONFIG_KGDB
+=09ppc_md.early_serial_map =3D memec_early_serial_map;
+#endif
+}
+
diff --git a/arch/ppc/platforms/4xx/memec_2vp30.h
b/arch/ppc/platforms/4xx/memec_2vp30.h
new file mode 100644
--- /dev/null
+++ b/arch/ppc/platforms/4xx/memec_2vp30.h
@@ -0,0 +1,47 @@
+/*
+ * arch/ppc/platforms/4xx/memec_2vp30.h
+ *
+ * Include file that defines the MEMEC 2VP30-FF1152 evaluation board
+ *
+ * Author: MontaVista Software, Inc.
+ *         source@mvista.com
+ *
+ * 2002-2004 (c) MontaVista Software, Inc.  This file is licensed under th=
e
+ * terms of the GNU General Public License version 2.  This program is lic=
ensed
+ * "as is" without any warranty of any kind, whether express or implied.
+ */
+
+#ifdef __KERNEL__
+#ifndef __ASM_MEMEC_2VP30_H__
+#define __ASM_MEMEC_2VP30_H__
+
+/* MEMEC 2VP30 has a Xilinx Virtex-II Pro processor */
+#include <platforms/4xx/virtex-ii_pro.h>
+
+#ifndef __ASSEMBLY__
+
+#include <linux/types.h>
+
+typedef struct board_info {
+=09unsigned int=09 bi_memsize;=09=09/* DRAM installed, in bytes */
+=09unsigned char=09 bi_enetaddr[6];=09/* Local Ethernet MAC address */
+=09unsigned int=09 bi_intfreq;=09=09/* Processor speed, in Hz */
+=09unsigned int=09 bi_busfreq;=09=09/* PLB Bus speed, in Hz */
+=09unsigned int=09 bi_pci_busfreq;=09/* PCI Bus speed, in Hz */
+} bd_t;
+
+/* Some 4xx parts use a different timebase frequency from the internal clo=
ck.
+*/
+#define bi_tbfreq bi_intfreq
+
+#endif /* !__ASSEMBLY__ */
+
+/* We don't need anything mapped.  Size of zero will accomplish that. */
+#define PPC4xx_ONB_IO_PADDR=090u
+#define PPC4xx_ONB_IO_VADDR=090u
+#define PPC4xx_ONB_IO_SIZE=090u
+
+#define PPC4xx_MACHINE_NAME "MEMEC 2VP30-FF1152 eval board"
+
+#endif /* __ASM_MEMEC_2VP30_H__ */
+#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/memec_2vp30_devices.c
b/arch/ppc/platforms/4xx/memec_2vp30_devices.c
new file mode 100644
--- /dev/null
+++ b/arch/ppc/platforms/4xx/memec_2vp30_devices.c
@@ -0,0 +1,59 @@
+/*
+ * arch/ppc/platforms/4xx/memec_2vp30_devices.c
+ *
+ * Virtex-II Pro Device descriptions
+ *
+ * Maintainer: Grant Likely <grant.likely@gdcanada.com>
+ *
+ * Copyright 2005 General Dynamics Canada Ltd.
+ * Copyright 2005 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify i=
t
+ * under  the terms of  the GNU General  Public License as published by th=
e
+ * Free Software Foundation;  either version 2 of the  License, or (at you=
r
+ * option) any later version.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/serial_8250.h>
+#include <asm/ppc_sys.h>
+#include "virtex-ii_pro.h"
+#include "xparameters/xparameters.h"
+
+struct plat_serial8250_port serial_platform_data[] =3D {
+=09{
+=09=09.mapbase  =3D XPAR_RS232_BASEADDR + 0x1003,
+=09=09.irq=09  =3D XPAR_OPB_INTC_0_RS232_IP2INTC_IRPT_INTR,
+=09=09.iotype=09  =3D UPIO_MEM,
+=09=09.uartclk  =3D XPAR_XUARTNS550_CLOCK_HZ,
+=09=09.flags=09  =3D UPF_BOOT_AUTOCONF,
+=09=09.regshift =3D 2,
+=09},
+=09{ }, /* terminated by empty record */
+};
+
+struct platform_device ppc_sys_platform_devices[] =3D {
+=09[V2PRO_UART] =3D {
+=09=09.name=09=09=3D "serial8250",
+=09=09.id=09=09=3D 0,
+=09=09.dev.platform_data =3D serial_platform_data,
+=09},
+};
+
+struct ppc_sys_spec *cur_ppc_sys_spec;
+struct ppc_sys_spec ppc_sys_specs[] =3D {
+=09{
+=09=09/* Only one entry, always assume the same design */
+=09=09.ppc_sys_name=09=3D "MEMEC 2VP30-FF1152 eval board",
+=09=09.mask =09=09=3D 0x00000000,
+=09=09.value =09=09=3D 0x00000000,
+=09=09.num_devices=09=3D 1,
+=09=09.device_list=09=3D (enum ppc_sys_devices[])
+=09=09{
+=09=09=09V2PRO_UART,
+=09=09},
+=09},
+};
+
diff --git a/arch/ppc/platforms/4xx/xparameters/xparameters.h
b/arch/ppc/platforms/4xx/xparameters/xparameters.h
--- a/arch/ppc/platforms/4xx/xparameters/xparameters.h
+++ b/arch/ppc/platforms/4xx/xparameters/xparameters.h
@@ -31,6 +31,12 @@
 #if defined(CONFIG_XILINX_ML300)
   #include "xparameters_ml300.h"
=20
+  /* Setup for board information structure */
+  #define V2PRO_BI_MEMSIZE              XPAR_DDR_0_SIZE
+  #define V2PRO_BI_INTFREQ              XPAR_CORE_CLOCK_FREQ_HZ
+  #define V2PRO_BI_BUSFREQ              XPAR_PLB_CLOCK_FREQ_HZ
+  #define V2PRO_BI_PCI_BUSFREQ          XPAR_PCI_0_CLOCK_FREQ_HZ
+
   /* Values for setting up interrupt controller */
   #define V2PRO_XINTC_USE_DCR           XPAR_XINTC_USE_DCR
   #define V2PRO_INTC_BASEADDR           XPAR_INTC_0_BASEADDR
@@ -45,6 +51,29 @@
         .iomem_reg_shift =3D 2,                                           =
\
         .io_type         =3D SERIAL_IO_MEM,                               =
\
   },
+#elif defined(CONFIG_MEMEC_2VP30)
+  #include "xparameters_memec_2vp30.h"
+
+  /* Setup for board information structure */
+  #define V2PRO_BI_MEMSIZE              (XPAR_SDRAM_8MX32_HIGHADDR+1)
+  #define V2PRO_BI_INTFREQ              XPAR_CPU_PPC405_CORE_CLOCK_FREQ_HZ
+  #define V2PRO_BI_BUSFREQ              XPAR_XUARTNS550_CLOCK_HZ
+  #define V2PRO_BI_PCI_BUSFREQ          0
+
+  /* Values for setting up interrupt controller */
+  #define V2PRO_XINTC_USE_DCR           XPAR_XINTC_USE_DCR
+  #define V2PRO_INTC_BASEADDR           XPAR_OPB_INTC_0_BASEADDR
+  #define V2PRO_INTC_KIND_OF_INTR       XPAR_OPB_INTC_0_KIND_OF_INTR
+
+  /* zImage serial port definitions */
+  #define SERIAL_PORT_DFNS {                                            \
+        .baud_base       =3D XPAR_XUARTNS550_CLOCK_HZ/16,                 =
\
+        .irq             =3D XPAR_OPB_INTC_0_RS232_IP2INTC_IRPT_INTR,     =
\
+        .flags           =3D ASYNC_BOOT_AUTOCONF,                         =
\
+        .iomem_base      =3D (u8 *)XPAR_RS232_BASEADDR + 0x1003,          =
\
+        .iomem_reg_shift =3D 2,                                           =
\
+        .io_type         =3D SERIAL_IO_MEM,                               =
\
+  },
 #else
   /* Add other board xparameter includes here before the #else */
   #error No *_xparameters.h file included
diff --git a/arch/ppc/platforms/4xx/xparameters/xparameters_memec_2vp30.h
b/arch/ppc/platforms/4xx/xparameters/xparameters_memec_2vp30.h
new file mode 100644
--- /dev/null
+++ b/arch/ppc/platforms/4xx/xparameters/xparameters_memec_2vp30.h
@@ -0,0 +1,100 @@
+
+/*******************************************************************
+*
+* CAUTION: This file is automatically generated by libgen.
+* Version: Xilinx EDK 7.1 EDK_H.10.4
+* DO NOT EDIT.
+*
+* Copyright (c) 2005 Xilinx, Inc.  All rights reserved.=20
+*=20
+* Description: Driver parameters
+*
+*******************************************************************/
+
+#define STDIN_BASEADDRESS 0x40400000
+#define STDOUT_BASEADDRESS 0x40400000
+
+/******************************************************************/
+
+#define XPAR_XUARTNS550_NUM_INSTANCES 1
+#define XPAR_XUARTNS550_CLOCK_HZ 100000000
+#define XPAR_RS232_BASEADDR 0x40400000
+#define XPAR_RS232_HIGHADDR 0x4040FFFF
+#define XPAR_RS232_DEVICE_ID 0
+
+/******************************************************************/
+
+#define XPAR_XGPIO_NUM_INSTANCES 2
+#define XPAR_LEDS_4BIT_BASEADDR 0x40020000
+#define XPAR_LEDS_4BIT_HIGHADDR 0x4002FFFF
+#define XPAR_LEDS_4BIT_DEVICE_ID 0
+#define XPAR_LEDS_4BIT_INTERRUPT_PRESENT 0
+#define XPAR_LEDS_4BIT_IS_DUAL 0
+#define XPAR_PUSH_BUTTONS_3BIT_BASEADDR 0x40000000
+#define XPAR_PUSH_BUTTONS_3BIT_HIGHADDR 0x4000FFFF
+#define XPAR_PUSH_BUTTONS_3BIT_DEVICE_ID 1
+#define XPAR_PUSH_BUTTONS_3BIT_INTERRUPT_PRESENT 1
+#define XPAR_PUSH_BUTTONS_3BIT_IS_DUAL 0
+
+/******************************************************************/
+
+#define XPAR_XSYSACE_MEM_WIDTH 16
+#define XPAR_XSYSACE_NUM_INSTANCES 1
+#define XPAR_SYSACE_COMPACTFLASH_BASEADDR 0x41800000
+#define XPAR_SYSACE_COMPACTFLASH_HIGHADDR 0x4180FFFF
+#define XPAR_SYSACE_COMPACTFLASH_DEVICE_ID 0
+#define XPAR_SYSACE_COMPACTFLASH_MEM_WIDTH 16
+
+/******************************************************************/
+
+#define XPAR_INTC_MAX_NUM_INTR_INPUTS 4
+#define XPAR_XINTC_HAS_IPR 1
+#define XPAR_XINTC_USE_DCR 0
+#define XPAR_XINTC_NUM_INSTANCES 1
+#define XPAR_OPB_INTC_0_BASEADDR 0x41200000
+#define XPAR_OPB_INTC_0_HIGHADDR 0x4120FFFF
+#define XPAR_OPB_INTC_0_DEVICE_ID 0
+#define XPAR_OPB_INTC_0_KIND_OF_INTR 0x00000000
+
+/******************************************************************/
+
+#define XPAR_INTC_SINGLE_BASEADDR 0x41200000
+#define XPAR_INTC_SINGLE_HIGHADDR 0x4120FFFF
+#define XPAR_INTC_SINGLE_DEVICE_ID XPAR_OPB_INTC_0_DEVICE_ID
+#define XPAR_ETHERNET_MAC_IP2INTC_IRPT_MASK 0X000001
+#define XPAR_OPB_INTC_0_ETHERNET_MAC_IP2INTC_IRPT_INTR 0
+#define XPAR_PUSH_BUTTONS_3BIT_IP2INTC_IRPT_MASK 0X000002
+#define XPAR_OPB_INTC_0_PUSH_BUTTONS_3BIT_IP2INTC_IRPT_INTR 1
+#define XPAR_SYSACE_COMPACTFLASH_SYSACE_IRQ_MASK 0X000004
+#define XPAR_OPB_INTC_0_SYSACE_COMPACTFLASH_SYSACE_IRQ_INTR 2
+#define XPAR_RS232_IP2INTC_IRPT_MASK 0X000008
+#define XPAR_OPB_INTC_0_RS232_IP2INTC_IRPT_INTR 3
+
+/******************************************************************/
+
+#define XPAR_XEMAC_NUM_INSTANCES 1
+#define XPAR_ETHERNET_MAC_BASEADDR 0x80400000
+#define XPAR_ETHERNET_MAC_HIGHADDR 0x8040FFFF
+#define XPAR_ETHERNET_MAC_DEVICE_ID 0
+#define XPAR_ETHERNET_MAC_ERR_COUNT_EXIST 1
+#define XPAR_ETHERNET_MAC_DMA_PRESENT 1
+#define XPAR_ETHERNET_MAC_MII_EXIST 1
+#define XPAR_ETHERNET_MAC_CAM_EXIST 0
+#define XPAR_ETHERNET_MAC_JUMBO_EXIST 0
+
+/******************************************************************/
+
+#define XPAR_SDRAM_8MX32_BASEADDR 0x00000000
+#define XPAR_SDRAM_8MX32_HIGHADDR 0x01FFFFFF
+
+/******************************************************************/
+
+#define XPAR_PLB_BRAM_IF_CNTLR_1_BASEADDR 0xffffc000
+#define XPAR_PLB_BRAM_IF_CNTLR_1_HIGHADDR 0xffffffff
+
+/******************************************************************/
+
+#define XPAR_CPU_PPC405_CORE_CLOCK_FREQ_HZ 300000000
+
+/******************************************************************/
+
diff --git a/include/asm-ppc/ibm4xx.h b/include/asm-ppc/ibm4xx.h
--- a/include/asm-ppc/ibm4xx.h
+++ b/include/asm-ppc/ibm4xx.h
@@ -63,6 +63,10 @@
 #include <platforms/4xx/xilinx_ml300.h>
 #endif
=20
+#if defined(CONFIG_MEMEC_2VP30)
+#include <platforms/4xx/memec_2vp30.h>
+#endif
+
 #ifndef __ASSEMBLY__
=20
 #ifdef CONFIG_40x

^ permalink raw reply

* [PATCH 1/2] Move Virtex-II Pro / ML300 port over to the platform bus.
From: Grant Likely @ 2005-09-10  7:36 UTC (permalink / raw)
  To: linuxppc-embedded

This is a large patch that moves the ML300 to the platform bus.

It also isolates most of the linux tree from changes to the xparameters.h
file.  Ultimately, the goal is to move everything over to the flattened
device tree for telling the kernel about devices.  That way xparameters.h
can go away entirely for the kernel proper.  (Isolated to the bootloader)

This patch will be split up into smaller parts before submitting to mainlin=
e

Comments are appreciated.

---

 arch/ppc/Kconfig.debug                           |    2 -
 arch/ppc/boot/common/ns16550.c                   |   15 ++++
 arch/ppc/boot/simple/embed_config.c              |    3 +
 arch/ppc/platforms/4xx/Kconfig                   |    5 -
 arch/ppc/platforms/4xx/Makefile                  |    3 -
 arch/ppc/platforms/4xx/virtex-ii_pro.c           |   60 ------------------
 arch/ppc/platforms/4xx/virtex-ii_pro.h           |   74 ++----------------=
----
 arch/ppc/platforms/4xx/xilinx_ml300.c            |   60 +++++++++++-------
 arch/ppc/platforms/4xx/xilinx_ml300.h            |    2 -
 arch/ppc/platforms/4xx/xilinx_ml300_devices.c    |   71 ++++++++++++++++++=
+++
 arch/ppc/platforms/4xx/xparameters/xparameters.h |   51 +++++++++++++++
 arch/ppc/syslib/Makefile                         |    2 -
 arch/ppc/syslib/gen550_dbg.c                     |    2 +
 arch/ppc/syslib/xilinx_pic.c                     |   12 ++--
 include/asm-ppc/ppc_sys.h                        |    2 +
 include/asm-ppc/xparameters.h                    |   18 -----
 16 files changed, 196 insertions(+), 186 deletions(-)
 delete mode 100644 arch/ppc/platforms/4xx/virtex-ii_pro.c
 create mode 100644 arch/ppc/platforms/4xx/xilinx_ml300_devices.c
 create mode 100644 arch/ppc/platforms/4xx/xparameters/xparameters.h
 delete mode 100644 include/asm-ppc/xparameters.h

c434b6a7edfa498ed01ee9c3677e687bad87d805
diff --git a/arch/ppc/Kconfig.debug b/arch/ppc/Kconfig.debug
--- a/arch/ppc/Kconfig.debug
+++ b/arch/ppc/Kconfig.debug
@@ -66,7 +66,7 @@ config SERIAL_TEXT_DEBUG
=20
 config PPC_OCP
 =09bool
-=09depends on IBM_OCP || XILINX_OCP
+=09depends on IBM_OCP
 =09default y
=20
 endmenu
diff --git a/arch/ppc/boot/common/ns16550.c b/arch/ppc/boot/common/ns16550.=
c
--- a/arch/ppc/boot/common/ns16550.c
+++ b/arch/ppc/boot/common/ns16550.c
@@ -11,6 +11,10 @@
 #include "nonstdio.h"
 #include "serial.h"
=20
+#if defined(CONFIG_VIRTEX_II_PRO)
+#include <platforms/4xx/xparameters/xparameters.h>
+#endif
+
 #define SERIAL_BAUD=099600
=20
 extern unsigned long ISA_io;
@@ -25,6 +29,7 @@ unsigned long serial_init(int chan, void
 {
 =09unsigned long com_port;
 =09unsigned char lcr, dlm;
+=09unsigned long baud_base;
=20
 =09/* We need to find out which type io we're expecting.  If it's
 =09 * 'SERIAL_IO_PORT', we get an offset from the isa_io_base.
@@ -43,6 +48,12 @@ unsigned long serial_init(int chan, void
=20
 =09/* How far apart the registers are. */
 =09shift =3D rs_table[chan].iomem_reg_shift;
+=09baud_base =3D rs_table[chan].baud_base;
+#if defined(BASE_BAUD)
+=09if (!baud_base)
+=09=09baud_base =3D BASE_BAUD;
+#endif
+
 =09
 =09/* save the LCR */
 =09lcr =3D inb(com_port + (UART_LCR << shift));
@@ -62,9 +73,9 @@ unsigned long serial_init(int chan, void
 =09else {
 =09=09/* Input clock. */
 =09=09outb(com_port + (UART_DLL << shift),
-=09=09     (BASE_BAUD / SERIAL_BAUD) & 0xFF);
+=09=09     (baud_base / SERIAL_BAUD) & 0xFF);
 =09=09outb(com_port + (UART_DLM << shift),
-=09=09     (BASE_BAUD / SERIAL_BAUD) >> 8);
+=09=09     (baud_base / SERIAL_BAUD) >> 8);
 =09=09/* 8 data, 1 stop, no parity */
 =09=09outb(com_port + (UART_LCR << shift), 0x03);
 =09=09/* RTS/DTR */
diff --git a/arch/ppc/boot/simple/embed_config.c
b/arch/ppc/boot/simple/embed_config.c
--- a/arch/ppc/boot/simple/embed_config.c
+++ b/arch/ppc/boot/simple/embed_config.c
@@ -21,6 +21,9 @@
 #ifdef CONFIG_40x
 #include <asm/io.h>
 #endif
+#ifdef CONFIG_VIRTEX_II_PRO
+#include <platforms/4xx/xparameters/xparameters.h>
+#endif
 extern unsigned long timebase_period_ns;
=20
 /* For those boards that don't provide one.
diff --git a/arch/ppc/platforms/4xx/Kconfig b/arch/ppc/platforms/4xx/Kconfi=
g
--- a/arch/ppc/platforms/4xx/Kconfig
+++ b/arch/ppc/platforms/4xx/Kconfig
@@ -212,11 +212,6 @@ config VIRTEX_II_PRO_TLB_FIX
 =09  It is safe to say Y here, but there is a performance impact.
 =09  Say N if unsure.
=20
-config XILINX_OCP
-=09bool
-=09depends on VIRTEX_II_PRO
-=09default y
-
 config STB03xxx
 =09bool
 =09depends on REDWOOD_5 || REDWOOD_6
diff --git a/arch/ppc/platforms/4xx/Makefile b/arch/ppc/platforms/4xx/Makef=
ile
--- a/arch/ppc/platforms/4xx/Makefile
+++ b/arch/ppc/platforms/4xx/Makefile
@@ -14,7 +14,7 @@ obj-$(CONFIG_REDWOOD_5)=09=09+=3D redwood5.o
 obj-$(CONFIG_REDWOOD_6)=09=09+=3D redwood6.o
 obj-$(CONFIG_SYCAMORE)=09=09+=3D sycamore.o
 obj-$(CONFIG_WALNUT)=09=09+=3D walnut.o
-obj-$(CONFIG_XILINX_ML300)=09+=3D xilinx_ml300.o
+obj-$(CONFIG_XILINX_ML300)=09+=3D xilinx_ml300.o xilinx_ml300_devices.o
=20
 obj-$(CONFIG_405GP)=09=09+=3D ibm405gp.o
 obj-$(CONFIG_REDWOOD_5)=09=09+=3D ibmstb4.o
@@ -26,4 +26,3 @@ obj-$(CONFIG_440GX)=09=09+=3D ibm440gx.o
 obj-$(CONFIG_440SP)=09=09+=3D ibm440sp.o
 obj-$(CONFIG_405EP)=09=09+=3D ibm405ep.o
 obj-$(CONFIG_405GPR)=09=09+=3D ibm405gpr.o
-obj-$(CONFIG_VIRTEX_II_PRO)=09+=3D virtex-ii_pro.o
diff --git a/arch/ppc/platforms/4xx/virtex-ii_pro.c
b/arch/ppc/platforms/4xx/virtex-ii_pro.c
deleted file mode 100644
--- a/arch/ppc/platforms/4xx/virtex-ii_pro.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * arch/ppc/platforms/4xx/virtex-ii_pro.c
- *
- * Author: MontaVista Software, Inc.
- *         source@mvista.com
- *
- * 2002-2004 (c) MontaVista Software, Inc.  This file is licensed under th=
e
- * terms of the GNU General Public License version 2.  This program is lic=
ensed
- * "as is" without any warranty of any kind, whether express or implied.
- */
-
-#include <linux/config.h>
-#include <linux/init.h>
-#include <asm/ocp.h>
-#include "virtex-ii_pro.h"
-
-/* Have OCP take care of the serial ports. */
-struct ocp_def core_ocp[] =3D {
-#ifdef XPAR_UARTNS550_0_BASEADDR
-=09{ .vendor=09=3D OCP_VENDOR_XILINX,
-=09  .function=09=3D OCP_FUNC_16550,
-=09  .index=09=3D 0,
-=09  .paddr=09=3D XPAR_UARTNS550_0_BASEADDR,
-=09  .irq=09=09=3D XPAR_INTC_0_UARTNS550_0_VEC_ID,
-=09  .pm=09=09=3D OCP_CPM_NA
-=09},
-#ifdef XPAR_UARTNS550_1_BASEADDR
-=09{ .vendor=09=3D OCP_VENDOR_XILINX,
-=09  .function=09=3D OCP_FUNC_16550,
-=09  .index=09=3D 1,
-=09  .paddr=09=3D XPAR_UARTNS550_1_BASEADDR,
-=09  .irq=09=09=3D XPAR_INTC_0_UARTNS550_1_VEC_ID,
-=09  .pm=09=09=3D OCP_CPM_NA
-=09},
-#ifdef XPAR_UARTNS550_2_BASEADDR
-=09{ .vendor=09=3D OCP_VENDOR_XILINX,
-=09  .function=09=3D OCP_FUNC_16550,
-=09  .index=09=3D 2,
-=09  .paddr=09=3D XPAR_UARTNS550_2_BASEADDR,
-=09  .irq=09=09=3D XPAR_INTC_0_UARTNS550_2_VEC_ID,
-=09  .pm=09=09=3D OCP_CPM_NA
-=09},
-#ifdef XPAR_UARTNS550_3_BASEADDR
-=09{ .vendor=09=3D OCP_VENDOR_XILINX,
-=09  .function=09=3D OCP_FUNC_16550,
-=09  .index=09=3D 3,
-=09  .paddr=09=3D XPAR_UARTNS550_3_BASEADDR,
-=09  .irq=09=09=3D XPAR_INTC_0_UARTNS550_3_VEC_ID,
-=09  .pm=09=09=3D OCP_CPM_NA
-=09},
-#ifdef XPAR_UARTNS550_4_BASEADDR
-#error Edit this file to add more devices.
-#endif=09=09=09/* 4 */
-#endif=09=09=09/* 3 */
-#endif=09=09=09/* 2 */
-#endif=09=09=09/* 1 */
-#endif=09=09=09/* 0 */
-=09{ .vendor=09=3D OCP_VENDOR_INVALID
-=09}
-};
diff --git a/arch/ppc/platforms/4xx/virtex-ii_pro.h
b/arch/ppc/platforms/4xx/virtex-ii_pro.h
--- a/arch/ppc/platforms/4xx/virtex-ii_pro.h
+++ b/arch/ppc/platforms/4xx/virtex-ii_pro.h
@@ -15,84 +15,26 @@
 #ifndef __ASM_VIRTEXIIPRO_H__
 #define __ASM_VIRTEXIIPRO_H__
=20
-#include <linux/config.h>
-#include <asm/xparameters.h>
-
 /* serial defines */
=20
 #define RS_TABLE_SIZE  4=09/* change this and add more devices below
 =09=09=09=09   if you have more then 4 16x50 UARTs */
=20
-#define BASE_BAUD=09=09(XPAR_UARTNS550_0_CLOCK_FREQ_HZ/16)
-
-/* The serial ports in the Virtex-II Pro have each I/O byte in the
- * LSByte of a word.  This means that iomem_reg_shift needs to be 2 to
- * change the byte offsets into word offsets.  In addition the base
- * addresses need to have 3 added to them to get to the LSByte.
+/* Ugly, ugly, ugly! BASE_BAUD defined here to keep 8250.c happy.
  */
-#define STD_UART_OP(num)=09=09=09=09=09=09 \
-=09{ 0, BASE_BAUD, 0, XPAR_INTC_0_UARTNS550_##num##_VEC_ID,=09 \
-=09=09ASYNC_BOOT_AUTOCONF,=09=09 =09=09=09 \
-=09=09.iomem_base =3D (u8 *)XPAR_UARTNS550_##num##_BASEADDR + 3, \
-=09=09.iomem_reg_shift =3D 2,=09=09=09=09=09 \
-=09=09.io_type =3D SERIAL_IO_MEM},
-
-#if defined(XPAR_INTC_0_UARTNS550_0_VEC_ID)
-#define ML300_UART0 STD_UART_OP(0)
-#else
-#define ML300_UART0
-#endif
-
-#if defined(XPAR_INTC_0_UARTNS550_1_VEC_ID)
-#define ML300_UART1 STD_UART_OP(1)
-#else
-#define ML300_UART1
+#if !defined(BASE_BAUD)
+ #define BASE_BAUD=09=09(0) /* dummy value; not used */
 #endif
=20
-#if defined(XPAR_INTC_0_UARTNS550_2_VEC_ID)
-#define ML300_UART2 STD_UART_OP(2)
-#else
-#define ML300_UART2
-#endif
+#ifndef __ASSEMBLY__
=20
-#if defined(XPAR_INTC_0_UARTNS550_3_VEC_ID)
-#define ML300_UART3 STD_UART_OP(3)
-#else
-#define ML300_UART3
-#endif
+/* Device type enumeration for platform bus definitions */
+enum ppc_sys_devices {
+=09V2PRO_UART,
+};
=20
-#if defined(XPAR_INTC_0_UARTNS550_4_VEC_ID)
-#error Edit this file to add more devices.
-#elif defined(XPAR_INTC_0_UARTNS550_3_VEC_ID)
-#define NR_SER_PORTS=094
-#elif defined(XPAR_INTC_0_UARTNS550_2_VEC_ID)
-#define NR_SER_PORTS=093
-#elif defined(XPAR_INTC_0_UARTNS550_1_VEC_ID)
-#define NR_SER_PORTS=092
-#elif defined(XPAR_INTC_0_UARTNS550_0_VEC_ID)
-#define NR_SER_PORTS=091
-#else
-#define NR_SER_PORTS=090
 #endif
=20
-#if defined(CONFIG_UART0_TTYS0)
-#define SERIAL_PORT_DFNS=09\
-=09ML300_UART0=09=09\
-=09ML300_UART1=09=09\
-=09ML300_UART2=09=09\
-=09ML300_UART3
-#endif
-
-#if defined(CONFIG_UART0_TTYS1)
-#define SERIAL_PORT_DFNS=09\
-=09ML300_UART1=09=09\
-=09ML300_UART0=09=09\
-=09ML300_UART2=09=09\
-=09ML300_UART3
-#endif
-
-#define DCRN_CPMFR_BASE=090
-
 #include <asm/ibm405.h>
=20
 #endif=09=09=09=09/* __ASM_VIRTEXIIPRO_H__ */
diff --git a/arch/ppc/platforms/4xx/xilinx_ml300.c
b/arch/ppc/platforms/4xx/xilinx_ml300.c
--- a/arch/ppc/platforms/4xx/xilinx_ml300.c
+++ b/arch/ppc/platforms/4xx/xilinx_ml300.c
@@ -17,12 +17,14 @@
 #include <linux/tty.h>
 #include <linux/serial.h>
 #include <linux/serial_core.h>
+#include <linux/serial_8250.h>
 #include <linux/serialP.h>
 #include <asm/io.h>
 #include <asm/machdep.h>
-#include <asm/ocp.h>
+#include <asm/ppc_sys.h>
=20
-#include <platforms/4xx/virtex-ii_pro.h>=09/* for NR_SER_PORTS */
+#include <syslib/gen550.h>
+#include "xparameters/xparameters.h"
=20
 /*
  * As an overview of how the following functions (platform_init,
@@ -80,38 +82,46 @@ ml300_map_io(void)
 #endif
 }
=20
+#ifdef CONFIG_SERIAL_8250
 static void __init
 ml300_early_serial_map(void)
 {
-#ifdef CONFIG_SERIAL_8250
-=09struct serial_state old_ports[] =3D { SERIAL_PORT_DFNS };
-=09struct uart_port port;
-=09int i;
-
-=09/* Setup ioremapped serial port access */
-=09for (i =3D 0; i < ARRAY_SIZE(old_ports); i++ ) {
-=09=09memset(&port, 0, sizeof(port));
-=09=09port.membase =3D ioremap((phys_addr_t)(old_ports[i].iomem_base), 16)=
;
-=09=09port.irq =3D old_ports[i].irq;
-=09=09port.uartclk =3D old_ports[i].baud_base * 16;
-=09=09port.regshift =3D old_ports[i].iomem_reg_shift;
-=09=09port.iotype =3D SERIAL_IO_MEM;
-=09=09port.flags =3D ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
-=09=09port.line =3D i;
-
-=09=09if (early_serial_setup(&port) !=3D 0) {
-=09=09=09printk("Early serial init of port %d failed\n", i);
-=09=09}
+#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
+=09struct uart_port serial_req;
+#endif
+=09struct plat_serial8250_port *pdata;
+=09int i =3D 0;
+
+=09pdata =3D (struct plat_serial8250_port *) ppc_sys_get_pdata(V2PRO_UART)=
;
+=09while(pdata && pdata->flags)
+=09{
+=09=09pdata->membase =3D ioremap(pdata->mapbase, 0x100);
+
+#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
+=09=09memset(&serial_req, 0, sizeof(serial_req));
+=09=09serial_req.mapbase=09=3D pdata->mapbase;
+=09=09serial_req.membase=09=3D pdata->membase;
+=09=09serial_req.irq=09=09=3D pdata->irq;
+=09=09serial_req.uartclk=09=3D pdata->uartclk;
+=09=09serial_req.regshift=09=3D pdata->regshift;
+=09=09serial_req.iotype=09=3D pdata->iotype;
+=09=09serial_req.flags=09=3D pdata->flags;
+=09=09gen550_init(i, &serial_req);
+#endif
+=09=09pdata++;
+=09=09i++;
 =09}
-#endif /* CONFIG_SERIAL_8250 */
 }
+#endif /* CONFIG_SERIAL_8250 */
=20
 void __init
 ml300_setup_arch(void)
 {
-=09ppc4xx_setup_arch();=09/* calls ppc4xx_find_bridges() */
-
+#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_KGDB)
 =09ml300_early_serial_map();
+#endif
+
+=09ppc4xx_setup_arch();=09/* calls ppc4xx_find_bridges() */
=20
 =09/* Identify the system */
 =09printk(KERN_INFO "Xilinx Virtex-II Pro port\n");
@@ -131,6 +141,8 @@ platform_init(unsigned long r3, unsigned
 {
 =09ppc4xx_init(r3, r4, r5, r6, r7);
=20
+=09identify_ppc_sys_by_id(mfspr(SPRN_PVR));
+
 =09ppc_md.setup_arch =3D ml300_setup_arch;
 =09ppc_md.setup_io_mappings =3D ml300_map_io;
 =09ppc_md.init_IRQ =3D ml300_init_irq;
diff --git a/arch/ppc/platforms/4xx/xilinx_ml300.h
b/arch/ppc/platforms/4xx/xilinx_ml300.h
--- a/arch/ppc/platforms/4xx/xilinx_ml300.h
+++ b/arch/ppc/platforms/4xx/xilinx_ml300.h
@@ -41,7 +41,7 @@ typedef struct board_info {
 #define PPC4xx_ONB_IO_VADDR=090u
 #define PPC4xx_ONB_IO_SIZE=090u
=20
-#define PPC4xx_MACHINE_NAME "Xilinx ML300"
+#define PPC4xx_MACHINE_NAME "Xilinx ML300 Reference System"
=20
 #endif /* __ASM_XILINX_ML300_H__ */
 #endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/xilinx_ml300_devices.c
b/arch/ppc/platforms/4xx/xilinx_ml300_devices.c
new file mode 100644
--- /dev/null
+++ b/arch/ppc/platforms/4xx/xilinx_ml300_devices.c
@@ -0,0 +1,71 @@
+/*
+ * arch/ppc/syslib/virtex2pro_devices.c
+ *
+ * Virtex-II Pro Device descriptions
+ *
+ * Maintainer: Grant Likely <grant.likely@gdcanada.com>
+ *
+ * Copyright 2005 General Dynamics Canada Ltd.
+ * Copyright 2005 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify i=
t
+ * under  the terms of  the GNU General  Public License as published by th=
e
+ * Free Software Foundation;  either version 2 of the  License, or (at you=
r
+ * option) any later version.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/serial_8250.h>
+#include <asm/ppc_sys.h>
+#include "virtex-ii_pro.h"
+#include "xparameters/xparameters.h"
+
+struct plat_serial8250_port serial_platform_data[] =3D {
+#ifdef XPAR_OPB_UART16550_0_BASEADDR
+=09{
+=09=09.mapbase  =3D XPAR_OPB_UART16550_0_BASEADDR + 3,
+=09=09.irq=09  =3D XPAR_DCR_INTC_0_OPB_UART16550_0_IP2INTC_IRPT_INTR,
+=09=09.iotype=09  =3D UPIO_MEM,
+=09=09.uartclk  =3D XPAR_XUARTNS550_CLOCK_HZ,
+=09=09.flags=09  =3D UPF_BOOT_AUTOCONF,
+=09=09.regshift =3D 2,
+=09},
+#endif
+#ifdef XPAR_OPB_UART16550_1_BASEADDR
+=09{
+=09=09.mapbase  =3D XPAR_OPB_UART16550_1_BASEADDR + 3,
+=09=09.irq=09  =3D XPAR_DCR_INTC_0_OPB_UART16550_1_IP2INTC_IRPT_INTR,
+=09=09.iotype=09  =3D UPIO_MEM,
+=09=09.uartclk  =3D XPAR_XUARTNS550_CLOCK_HZ,
+=09=09.flags=09  =3D UPF_BOOT_AUTOCONF,
+=09=09.regshift =3D 2,
+=09},
+#endif
+=09{ }, /* terminated by empty record */
+};
+
+struct platform_device ppc_sys_platform_devices[] =3D {
+=09[V2PRO_UART] =3D {
+=09=09.name=09=09=3D "serial8250",
+=09=09.id=09=09=3D 0,
+=09=09.dev.platform_data =3D serial_platform_data,
+=09},
+};
+
+struct ppc_sys_spec *cur_ppc_sys_spec;
+struct ppc_sys_spec ppc_sys_specs[] =3D {
+=09{
+=09=09/* Only one entry, always assume the same design */
+=09=09.ppc_sys_name=09=3D "Xilinx ML300 Reference Design",
+=09=09.mask =09=09=3D 0x00000000,
+=09=09.value =09=09=3D 0x00000000,
+=09=09.num_devices=09=3D 1,
+=09=09.device_list=09=3D (enum ppc_sys_devices[])
+=09=09{
+=09=09=09V2PRO_UART,
+=09=09},
+=09},
+};
+
diff --git a/arch/ppc/platforms/4xx/xparameters/xparameters.h
b/arch/ppc/platforms/4xx/xparameters/xparameters.h
new file mode 100644
--- /dev/null
+++ b/arch/ppc/platforms/4xx/xparameters/xparameters.h
@@ -0,0 +1,51 @@
+/*
+ * arch/ppc/platforms/4xx/xparameters/xparameters.h
+ *
+ * This file includes the correct xparameters.h for the CONFIG'ed board
+ *
+ * Authors:
+ *    Grant C. Likely, glikely@gmail.com
+ *    MontaVista Software, Inc. source@mvista.com
+ *
+ * 2005 (c) Grant C. Likely, glikely@gmail.com
+ * 2004 (c) MontaVista Software, Inc.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of an=
y
+ * kind, whether express or implied.
+ */
+
+/*
+ * This file has three purposes:
+ * 1. Include the correct xparameters.h for the configured design
+ * 2. Translate design specific macros from xparam to common names
+ * 3. Provide a SERIAL_PORT_DFNS macro to setup up very early serial ports
+ *    zImage debug.  Later serial ports are advertised via the platform bu=
s
+ *
+ * The xparameters.h file is the pristine copy generated from Xilinx EDK
+ * toolset.  If you need to make changes, make the changes in this file
+ * rather than modifying the generated file.  That way if the design chang=
es
+ * then you just need to drop in the new xparameters.h
+ */
+
+#if defined(CONFIG_XILINX_ML300)
+  #include "xparameters_ml300.h"
+
+  /* Values for setting up interrupt controller */
+  #define V2PRO_XINTC_USE_DCR           XPAR_XINTC_USE_DCR
+  #define V2PRO_INTC_BASEADDR           XPAR_INTC_0_BASEADDR
+  #define V2PRO_INTC_KIND_OF_INTR       XPAR_INTC_0_KIND_OF_INTR
+
+  /* zImage serial port definitions */
+  #define SERIAL_PORT_DFNS {                                            \
+        .baud_base       =3D XPAR_XUARTNS550_CLOCK_HZ/16,                 =
\
+        .irq             =3D XPAR_DCR_INTC_0_OPB_UART16550_0_IP2INTC_IRPT_=
INTR, \
+        .flags           =3D ASYNC_BOOT_AUTOCONF,                         =
\
+        .iomem_base      =3D (u8 *)XPAR_OPB_UART16550_0_BASEADDR + 3,     =
\
+        .iomem_reg_shift =3D 2,                                           =
\
+        .io_type         =3D SERIAL_IO_MEM,                               =
\
+  },
+#else
+  /* Add other board xparameter includes here before the #else */
+  #error No *_xparameters.h file included
+#endif
diff --git a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile
--- a/arch/ppc/syslib/Makefile
+++ b/arch/ppc/syslib/Makefile
@@ -17,7 +17,7 @@ obj-$(CONFIG_440GX)=09=09+=3D ibm440gx_common.
 obj-$(CONFIG_440SP)=09=09+=3D ibm440gx_common.o ibm440sp_common.o
 ifeq ($(CONFIG_4xx),y)
 ifeq ($(CONFIG_VIRTEX_II_PRO),y)
-obj-$(CONFIG_40x)=09=09+=3D xilinx_pic.o
+obj-$(CONFIG_40x)=09=09+=3D xilinx_pic.o ppc_sys.o
 else
 ifeq ($(CONFIG_403),y)
 obj-$(CONFIG_40x)=09=09+=3D ppc403_pic.o
diff --git a/arch/ppc/syslib/gen550_dbg.c b/arch/ppc/syslib/gen550_dbg.c
--- a/arch/ppc/syslib/gen550_dbg.c
+++ b/arch/ppc/syslib/gen550_dbg.c
@@ -155,6 +155,8 @@ serial_close(unsigned long com_port)
 void
 gen550_init(int i, struct uart_port *serial_req)
 {
+=09if (i > RS_TABLE_SIZE)
+=09=09return;
 =09rs_table[i].io_type =3D serial_req->iotype;
 =09rs_table[i].port =3D serial_req->iobase;
 =09rs_table[i].iomem_base =3D serial_req->membase;
diff --git a/arch/ppc/syslib/xilinx_pic.c b/arch/ppc/syslib/xilinx_pic.c
--- a/arch/ppc/syslib/xilinx_pic.c
+++ b/arch/ppc/syslib/xilinx_pic.c
@@ -15,7 +15,7 @@
 #include <linux/init.h>
 #include <linux/irq.h>
 #include <asm/io.h>
-#include <asm/xparameters.h>
+#include <platforms/4xx/xparameters/xparameters.h>
 #include <asm/ibm4xx.h>
=20
 /* No one else should require these constants, so define them locally here=
. */
@@ -122,14 +122,14 @@ ppc4xx_pic_init(void)
 #error NR_IRQS > 32 not supported
 #endif
=20
-#if XPAR_XINTC_USE_DCR =3D=3D 0
-=09intc =3D ioremap(XPAR_INTC_0_BASEADDR, 32);
+#if V2PRO_XINTC_USE_DCR =3D=3D 0
+=09intc =3D ioremap(V2PRO_INTC_BASEADDR, 32);
=20
 =09printk(KERN_INFO "Xilinx INTC #0 at 0x%08lX mapped to 0x%08lX\n",
-=09       (unsigned long) XPAR_INTC_0_BASEADDR, (unsigned long) intc);
+=09       (unsigned long) V2PRO_INTC_BASEADDR, (unsigned long) intc);
 #else
 =09printk(KERN_INFO "Xilinx INTC #0 at 0x%08lX (DCR)\n",
-=09       (unsigned long) XPAR_INTC_0_BASEADDR);
+=09       (unsigned long) V2PRO_INTC_BASEADDR);
 #endif
=20
 =09/*
@@ -149,7 +149,7 @@ ppc4xx_pic_init(void)
 =09for (i =3D 0; i < NR_IRQS; ++i) {
 =09=09irq_desc[i].handler =3D &xilinx_intc;
=20
-=09=09if (XPAR_INTC_0_KIND_OF_INTR & (0x00000001 << i))
+=09=09if (V2PRO_INTC_KIND_OF_INTR & (0x00000001 << i))
 =09=09=09irq_desc[i].status &=3D ~IRQ_LEVEL;
 =09=09else
 =09=09=09irq_desc[i].status |=3D IRQ_LEVEL;
diff --git a/include/asm-ppc/ppc_sys.h b/include/asm-ppc/ppc_sys.h
--- a/include/asm-ppc/ppc_sys.h
+++ b/include/asm-ppc/ppc_sys.h
@@ -29,6 +29,8 @@
 #include <asm/mpc52xx.h>
 #elif defined(CONFIG_MPC10X_BRIDGE)
 #include <asm/mpc10x.h>
+#elif defined(CONFIG_VIRTEX_II_PRO)
+#include <platforms/4xx/virtex-ii_pro.h>
 #else
 #error "need definition of ppc_sys_devices"
 #endif
diff --git a/include/asm-ppc/xparameters.h b/include/asm-ppc/xparameters.h
deleted file mode 100644
--- a/include/asm-ppc/xparameters.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * include/asm-ppc/xparameters.h
- *
- * This file includes the correct xparameters.h for the CONFIG'ed board
- *
- * Author: MontaVista Software, Inc.
- *         source@mvista.com
- *
- * 2004 (c) MontaVista Software, Inc.  This file is licensed under the ter=
ms
- * of the GNU General Public License version 2.  This program is licensed
- * "as is" without any warranty of any kind, whether express or implied.
- */
-
-#include <linux/config.h>
-
-#if defined(CONFIG_XILINX_ML300)
-#include <platforms/4xx/xparameters/xparameters_ml300.h>
-#endif

^ permalink raw reply

* [PATCH 0/2] RFC: Port Virtex-II Pro code to use the platform bus
From: Grant Likely @ 2005-09-10  7:33 UTC (permalink / raw)
  To: linuxppc-embedded

Here is my work to date to bring the V2Pro port over to the platform
bus.  I don't expect these to be accepted as-is, but I'm looking for
comments before I get it polished.

Should apply cleanly against 2.6.13 (but may require the TLB patch first)
http://patchwork.ozlabs.org/linuxppc/patch?id=3D2058

Patch 1: changes from the ML300 perspective.  I temporarly don't have
access to an ML300 so this is untested (but it compiles).  Could
somebody please test this for me?

Patch 2: example patch for another V2PRO based board.  This isn't
really acceptable for mainline because it's not based on a reference
or published FPGA design, but it shows the work required to bring up
another board.  It also shines some light on what code should be
common between all V2Pro ports (which I'm working on).  This one runs
on a 2VP4-FG456 eval board (pls ignore all the references to 2VP30).

^ permalink raw reply

* Re: cpu features testing 32 vs 64 bit
From: Benjamin Herrenschmidt @ 2005-09-09 22:19 UTC (permalink / raw)
  To: Kumar Gala
  Cc: linuxppc-dev, linuxppc64-dev, linuxppc-embedded,
	pantelis.antoniou
In-Reply-To: <D8DEC759-EAB9-457F-AF7B-A10D6593B27A@freescale.com>


> 
> I think she lost the I in ICACHE... its a power5 only feature at this  
> point.

And good old 601 too :) It has a unified cache. We could make a common
feature bit for these.

Ben.

^ permalink raw reply

* PATCH ppc Merge asm-ppc*/posix_types.h
From: jdl @ 2005-09-09 21:43 UTC (permalink / raw)
  To: linuxppc-dev, linuxppc64-dev

Merge asm-ppc/posix_types.h and asm-ppc64/posix_types.h.


 include/asm-powerpc/posix_types.h |  129 +++++++++++++++++++++++++++++++++++++
 include/asm-ppc/posix_types.h     |  111 --------------------------------
 include/asm-ppc64/posix_types.h   |  119 ----------------------------------
 3 files changed, 129 insertions(+), 230 deletions(-)


Signed-off-by: Jon Loeliger <jdl@freescale.com>
Signed-off-by: Kumar Gala <kumar.gala@freescale.com>
---


diff --git a/include/asm-powerpc/posix_types.h b/include/asm-powerpc/posix_types.h
new file mode 100644
--- /dev/null
+++ b/include/asm-powerpc/posix_types.h
@@ -0,0 +1,129 @@
+#ifndef _ASM_POWERPC_POSIX_TYPES_H
+#define _ASM_POWERPC_POSIX_TYPES_H
+
+/*
+ * This file is generally used by user-level software, so you need to
+ * be a little careful about namespace pollution etc.  Also, we cannot
+ * assume GCC is being used.
+ */
+
+typedef unsigned long	__kernel_ino_t;
+typedef unsigned int	__kernel_mode_t;
+typedef long		__kernel_off_t;
+typedef int		__kernel_pid_t;
+typedef unsigned int	__kernel_uid_t;
+typedef unsigned int	__kernel_gid_t;
+typedef long		__kernel_ptrdiff_t;
+typedef long		__kernel_time_t;
+typedef long		__kernel_clock_t;
+typedef int		__kernel_timer_t;
+typedef int		__kernel_clockid_t;
+typedef long		__kernel_suseconds_t;
+typedef int		__kernel_daddr_t;
+typedef char *		__kernel_caddr_t;
+typedef unsigned short	__kernel_uid16_t;
+typedef unsigned short	__kernel_gid16_t;
+typedef unsigned int	__kernel_uid32_t;
+typedef unsigned int	__kernel_gid32_t;
+typedef unsigned int	__kernel_old_uid_t;
+typedef unsigned int	__kernel_old_gid_t;
+
+#ifdef __powerpc64__
+typedef unsigned long  	__kernel_nlink_t;
+typedef int             __kernel_ipc_pid_t;
+typedef unsigned long	__kernel_size_t;
+typedef long		__kernel_ssize_t;
+typedef unsigned long	__kernel_old_dev_t;
+#else
+typedef unsigned short	__kernel_nlink_t;
+typedef short		__kernel_ipc_pid_t;
+typedef unsigned int	__kernel_size_t;
+typedef int		__kernel_ssize_t;
+typedef unsigned int	__kernel_old_dev_t;
+#endif
+
+#ifdef __powerpc64__
+typedef long long	__kernel_loff_t;
+#else
+#ifdef __GNUC__
+typedef long long	__kernel_loff_t;
+#endif
+#endif
+
+typedef struct {
+	int	val[2];
+} __kernel_fsid_t;
+
+#ifndef __GNUC__
+
+#define	__FD_SET(d, set)	((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
+#define	__FD_CLR(d, set)	((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
+#define	__FD_ISSET(d, set)	(((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) != 0)
+#define	__FD_ZERO(set)	\
+  ((void) memset ((__ptr_t) (set), 0, sizeof (__kernel_fd_set)))
+
+#else /* __GNUC__ */
+
+#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) \
+    || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 0)
+/* With GNU C, use inline functions instead so args are evaluated only once: */
+
+#undef __FD_SET
+static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
+{
+	unsigned long _tmp = fd / __NFDBITS;
+	unsigned long _rem = fd % __NFDBITS;
+	fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
+}
+
+#undef __FD_CLR
+static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
+{
+	unsigned long _tmp = fd / __NFDBITS;
+	unsigned long _rem = fd % __NFDBITS;
+	fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
+}
+
+#undef __FD_ISSET
+static __inline__ int __FD_ISSET(unsigned long fd, __kernel_fd_set *p)
+{ 
+	unsigned long _tmp = fd / __NFDBITS;
+	unsigned long _rem = fd % __NFDBITS;
+	return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
+}
+
+/*
+ * This will unroll the loop for the normal constant case (8 ints,
+ * for a 256-bit fd_set)
+ */
+#undef __FD_ZERO
+static __inline__ void __FD_ZERO(__kernel_fd_set *p)
+{
+	unsigned long *tmp = (unsigned long *)p->fds_bits;
+	int i;
+
+	if (__builtin_constant_p(__FDSET_LONGS)) {
+		switch (__FDSET_LONGS) {
+		      case 16:
+			tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0;
+			tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0;
+
+		      case 8:
+			tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
+
+		      case 4:
+			tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
+			return;
+		}
+	}
+	i = __FDSET_LONGS;
+	while (i) {
+		i--;
+		*tmp = 0;
+		tmp++;
+	}
+}
+
+#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
+#endif /* __GNUC__ */
+#endif /* _ASM_POWERPC_POSIX_TYPES_H */
diff --git a/include/asm-ppc/posix_types.h b/include/asm-ppc/posix_types.h
deleted file mode 100644
--- a/include/asm-ppc/posix_types.h
+++ /dev/null
@@ -1,111 +0,0 @@
-#ifndef _PPC_POSIX_TYPES_H
-#define _PPC_POSIX_TYPES_H
-
-/*
- * This file is generally used by user-level software, so you need to
- * be a little careful about namespace pollution etc.  Also, we cannot
- * assume GCC is being used.
- */
-
-typedef unsigned long	__kernel_ino_t;
-typedef unsigned int	__kernel_mode_t;
-typedef unsigned short	__kernel_nlink_t;
-typedef long		__kernel_off_t;
-typedef int		__kernel_pid_t;
-typedef unsigned int	__kernel_uid_t;
-typedef unsigned int	__kernel_gid_t;
-typedef unsigned int	__kernel_size_t;
-typedef int		__kernel_ssize_t;
-typedef long		__kernel_ptrdiff_t;
-typedef long		__kernel_time_t;
-typedef long		__kernel_suseconds_t;
-typedef long		__kernel_clock_t;
-typedef int		__kernel_timer_t;
-typedef int		__kernel_clockid_t;
-typedef int		__kernel_daddr_t;
-typedef char *		__kernel_caddr_t;
-typedef short             __kernel_ipc_pid_t;
-typedef unsigned short	__kernel_uid16_t;
-typedef unsigned short	__kernel_gid16_t;
-typedef unsigned int	__kernel_uid32_t;
-typedef unsigned int	__kernel_gid32_t;
-
-typedef unsigned int	__kernel_old_uid_t;
-typedef unsigned int	__kernel_old_gid_t;
-typedef unsigned int	__kernel_old_dev_t;
-
-#ifdef __GNUC__
-typedef long long	__kernel_loff_t;
-#endif
-
-typedef struct {
-	int	val[2];
-} __kernel_fsid_t;
-
-#ifndef __GNUC__
-
-#define	__FD_SET(d, set)	((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
-#define	__FD_CLR(d, set)	((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
-#define	__FD_ISSET(d, set)	((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
-#define	__FD_ZERO(set)	\
-  ((void) memset ((__ptr_t) (set), 0, sizeof (__kernel_fd_set)))
-
-#else /* __GNUC__ */
-
-#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) \
-    || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 0)
-/* With GNU C, use inline functions instead so args are evaluated only once: */
-
-#undef __FD_SET
-static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
-{
-	unsigned long _tmp = fd / __NFDBITS;
-	unsigned long _rem = fd % __NFDBITS;
-	fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
-}
-
-#undef __FD_CLR
-static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
-{
-	unsigned long _tmp = fd / __NFDBITS;
-	unsigned long _rem = fd % __NFDBITS;
-	fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
-}
-
-#undef __FD_ISSET
-static __inline__ int __FD_ISSET(unsigned long fd, __kernel_fd_set *p)
-{
-	unsigned long _tmp = fd / __NFDBITS;
-	unsigned long _rem = fd % __NFDBITS;
-	return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
-}
-
-/*
- * This will unroll the loop for the normal constant case (8 ints,
- * for a 256-bit fd_set)
- */
-#undef __FD_ZERO
-static __inline__ void __FD_ZERO(__kernel_fd_set *p)
-{
-	unsigned int *tmp = (unsigned int *)p->fds_bits;
-	int i;
-
-	if (__builtin_constant_p(__FDSET_LONGS)) {
-		switch (__FDSET_LONGS) {
-			case 8:
-				tmp[0] = 0; tmp[1] = 0; tmp[2] = 0; tmp[3] = 0;
-				tmp[4] = 0; tmp[5] = 0; tmp[6] = 0; tmp[7] = 0;
-				return;
-		}
-	}
-	i = __FDSET_LONGS;
-	while (i) {
-		i--;
-		*tmp = 0;
-		tmp++;
-	}
-}
-
-#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
-#endif /* __GNUC__ */
-#endif /* _PPC_POSIX_TYPES_H */
diff --git a/include/asm-ppc64/posix_types.h b/include/asm-ppc64/posix_types.h
deleted file mode 100644
--- a/include/asm-ppc64/posix_types.h
+++ /dev/null
@@ -1,119 +0,0 @@
-#ifndef _PPC64_POSIX_TYPES_H
-#define _PPC64_POSIX_TYPES_H
-
-/*
- * This file is generally used by user-level software, so you need to
- * be a little careful about namespace pollution etc.  Also, we cannot
- * assume GCC is being used.
- *
- * 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.
- */
-
-typedef unsigned long	__kernel_ino_t;
-typedef unsigned long  	__kernel_nlink_t;
-typedef unsigned int	__kernel_mode_t;
-typedef long		__kernel_off_t;
-typedef long long	__kernel_loff_t;
-typedef int		__kernel_pid_t;
-typedef int             __kernel_ipc_pid_t;
-typedef unsigned int	__kernel_uid_t;
-typedef unsigned int	__kernel_gid_t;
-typedef unsigned long	__kernel_size_t;
-typedef long		__kernel_ssize_t;
-typedef long		__kernel_ptrdiff_t;
-typedef long		__kernel_time_t;
-typedef int		__kernel_timer_t;
-typedef int		__kernel_clockid_t;
-typedef long		__kernel_suseconds_t;
-typedef long		__kernel_clock_t;
-typedef int		__kernel_daddr_t;
-typedef char *		__kernel_caddr_t;
-typedef unsigned short	__kernel_uid16_t;
-typedef unsigned short	__kernel_gid16_t;
-typedef unsigned int	__kernel_uid32_t;
-typedef unsigned int	__kernel_gid32_t;
-
-typedef unsigned int	__kernel_old_uid_t;
-typedef unsigned int	__kernel_old_gid_t;
-typedef unsigned long	__kernel_old_dev_t;
-
-typedef struct {
-	int	val[2];
-} __kernel_fsid_t;
-
-#ifndef __GNUC__
-
-#define	__FD_SET(d, set)	((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
-#define	__FD_CLR(d, set)	((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
-#define	__FD_ISSET(d, set)	(((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) != 0)
-#define	__FD_ZERO(set)	\
-  ((void) memset ((__ptr_t) (set), 0, sizeof (__kernel_fd_set)))
-
-#else /* __GNUC__ */
-
-#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) \
-    || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 0)
-/* With GNU C, use inline functions instead so args are evaluated only once: */
-
-#undef __FD_SET
-static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
-{
-	unsigned long _tmp = fd / __NFDBITS;
-	unsigned long _rem = fd % __NFDBITS;
-	fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
-}
-
-#undef __FD_CLR
-static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
-{
-	unsigned long _tmp = fd / __NFDBITS;
-	unsigned long _rem = fd % __NFDBITS;
-	fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
-}
-
-#undef __FD_ISSET
-static __inline__ int __FD_ISSET(unsigned long fd, __kernel_fd_set *p)
-{ 
-	unsigned long _tmp = fd / __NFDBITS;
-	unsigned long _rem = fd % __NFDBITS;
-	return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
-}
-
-/*
- * This will unroll the loop for the normal constant case (8 ints,
- * for a 256-bit fd_set)
- */
-#undef __FD_ZERO
-static __inline__ void __FD_ZERO(__kernel_fd_set *p)
-{
-	unsigned long *tmp = (unsigned long *)p->fds_bits;
-	int i;
-
-	if (__builtin_constant_p(__FDSET_LONGS)) {
-		switch (__FDSET_LONGS) {
-		      case 16:
-			tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0;
-			tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0;
-
-		      case 8:
-			tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
-
-		      case 4:
-			tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
-			return;
-		}
-	}
-	i = __FDSET_LONGS;
-	while (i) {
-		i--;
-		*tmp = 0;
-		tmp++;
-	}
-}
-
-#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
-#endif /* __GNUC__ */
-#endif /* _PPC64_POSIX_TYPES_H */

^ permalink raw reply

* Re: Serial driver problem from 2.6.12 kernel
From: Mark A. Greer @ 2005-09-09 21:32 UTC (permalink / raw)
  To: goog long; +Cc: linuxppc-dev
In-Reply-To: <20050909151714.68070.qmail@web33410.mail.mud.yahoo.com>

On Fri, Sep 09, 2005 at 08:17:14AM -0700, goog long wrote:
> Hi all,
> 
> I backported MPSC driver from 2.6.12 to my kernel
> 2.6.10. However, the driver can send characters, but
> cannot receive any characters. Have anyone seen this
> before?
> 
> Please also send your feedback to cecolong@yahoo.com

Hmm, a little sparse on info here so its hard to guess.

The mpsc driver is very much influenced by the platform_data that you
pass to it (since there are so many options).  One possibility
is that you have the max_idle platform_data field set to 0 which means
that the mpsc reciever will not timeout and therefore the mpsc will not
pass to the driver whatever you've typed until your receive buffer fills up
(which you may not have done in your testing).  Try a max_idle value of 40
which seems to work fine for me.  Another possibility, of course, is that
you passed in the wrong irq in the platform_data and therefore are not
getting recieving interrupts.

Mark

^ permalink raw reply

* Re: Marvell MV64360 interrupt question
From: Mark A. Greer @ 2005-09-09 21:18 UTC (permalink / raw)
  To: Dale Farnsworth; +Cc: linuxppc-embedded
In-Reply-To: <20050909204955.GA15260@xyzzy.farnsworth.org>

On Fri, Sep 09, 2005 at 01:49:55PM -0700, Dale Farnsworth wrote:
> On Fri, Sep 09, 2005 at 08:20:20PM +0000, Walter L. Wimer III wrote:
> > On Fri, 2005-09-09 at 12:27 -0700, Dale Farnsworth wrote:
> > > 
> > > No additional locking is necessary.  In fact, it seems to me that the 32-bit
> > > register reads and writes are already atomic and all of the locking using
> > > mv64x60_lock is superfluous.
> > 
> > Ah ha.  mv64x60.h also defines an mv64x60_modify() function that isn't
> > intrinsically atomic, so it needs the spinlock.  That in turn requires
> > mv64x60_read() and mv64x60_write() to play along too.
> 
> Yes, the lock is needed for mv64x60_modify(), mv64x60_write().  I still
> don't think it's needed for mv64x60_read().

IMHO, the mv64x60_read/write/modify routines should be deleted and the
locking + I/O done explicitly.  That makes it more obvious, more
efficient in places where there are multiple writes, etc. in a row (not
as much grabbing/releasing of the spinlock), and is the preferred way to do
things in linux.

A few times now, I almost started to do that...looked at it and went off
to do something else.  :)  Yes, I'm lazy.  Yes, I should do it.
Eventually, I will (however, if you want to, I won't complain ;).

Mark

^ permalink raw reply

* Re: Marvell MV64360 interrupt question
From: Dale Farnsworth @ 2005-09-09 20:49 UTC (permalink / raw)
  To: linuxppc-embedded
In-Reply-To: <1126297220.21092.45.camel@excalibur.timesys.com>

On Fri, Sep 09, 2005 at 08:20:20PM +0000, Walter L. Wimer III wrote:
> On Fri, 2005-09-09 at 12:27 -0700, Dale Farnsworth wrote:
> > 
> > No additional locking is necessary.  In fact, it seems to me that the 32-bit
> > register reads and writes are already atomic and all of the locking using
> > mv64x60_lock is superfluous.
> 
> Ah ha.  mv64x60.h also defines an mv64x60_modify() function that isn't
> intrinsically atomic, so it needs the spinlock.  That in turn requires
> mv64x60_read() and mv64x60_write() to play along too.

Yes, the lock is needed for mv64x60_modify(), mv64x60_write().  I still
don't think it's needed for mv64x60_read().

-Dale

^ permalink raw reply

* Re: Marvell MV64360 interrupt question
From: Walter L. Wimer III @ 2005-09-09 20:20 UTC (permalink / raw)
  To: Linux PPC Embedded list
In-Reply-To: <20050909192739.GA5171@xyzzy.farnsworth.org>

On Fri, 2005-09-09 at 12:27 -0700, Dale Farnsworth wrote:
> 
> No additional locking is necessary.  In fact, it seems to me that the 32-bit
> register reads and writes are already atomic and all of the locking using
> mv64x60_lock is superfluous.

Ah ha.  mv64x60.h also defines an mv64x60_modify() function that isn't
intrinsically atomic, so it needs the spinlock.  That in turn requires
mv64x60_read() and mv64x60_write() to play along too.

At least in the general case....



Walt

^ 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