* Re: Marvell MV64360 interrupt question
From: Brian Waite @ 2005-09-12 13:05 UTC (permalink / raw)
To: linuxppc-embedded
In-Reply-To: <20050909211819.GB5034@mag.az.mvista.com>
On Friday 09 September 2005 5:18 pm, Mark A. Greer wrote:
> 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.
Unless somthing has changed, on the get_irq case, the interrupts are only
handled by CPU0. At least that is the way all the platforms have handled it
in the past. I'd be wary of distributing across other cpus until you really
look at the enet and mpsc drivers. I don't know of any races off the top of
my head, but this code was tested and developed with boards only handling
IRQs on one processor.
> > >
> > > 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.
mv64360_read() need not be locked. The data is intrinsicly stale by the time
the read has completed. The action on the Marvell to write the register is
atomic, so you will not get partial reads, thus the data is only accurate at
the instant it is read. By the time code sees it, the data, is not accurate.
Mark is right, locking must be abstracted. The basic r/w functions should do
locking whatsoever, it is a performance hit on SMP and has no benefit.
mv64360_modify() is right out. It should never have been included (no insult
intended Mark), because it appears to have the same behavior (ie atomicity)
as the mv64360_{read,write}() but it does not. I say the the IO be locked and
bit twiddled explicity by the user.
Just my 2 cents.
Thanks
Brian
>
> 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
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
^ permalink raw reply
* RE: A bug in div64.s
From: Liu Fred-a18596 @ 2005-09-12 10:05 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
Hello, Paul,
Thank you very much. Your code is really cool.
Best regards,
Fred
-----Original Message-----
From: Paul Mackerras [mailto:paulus@samba.org]
Sent: Monday, September 12, 2005 4:26 PM
To: Liu Fred-a18596
Cc: linuxppc-dev@ozlabs.org
Subject: Re: A bug in div64.s
Liu Fred-a18596 writes:
> I found there was a bug in arch/ppc/lib/div64.s.
>
> The original div64_32() function would produce a zero divide
> exception in case of div64_32(0x100000000, 0xFFFFFFFF).
Thanks for pointing this out.
> Here is the bug-fixed new div64_32()function.
A patch would have been more helpful, so we could see immediately what
you have changed. Also, notes (or outlook or whatever mail program
you are using) has completely munged all the spacing of the code you
posted.
Anyway, I have some comments on your proposed fix:
> addc. r9,r4,r10 # rounding up (so the estimate cannot
I understand that the add that I had here can overflow in the case you
pointed out, so we need to preserve the carry. But why did you use
"addc." rather than "addc" ?
> mfxer r12 #
>
> rlwinm. r12, r12, 3, 31, 31 # XER[CA]
>
> cmpwi r12, 1 # carry ?
>
> bne 5f
>
> ori r9, r9, 0x1 # carry !
I think just "addze r9,r9" would do instead of these 5 instructions,
wouldn't it?
Paul.
^ permalink raw reply
* Re: A bug in div64.s
From: Paul Mackerras @ 2005-09-12 8:26 UTC (permalink / raw)
To: Liu Fred-a18596; +Cc: linuxppc-dev
In-Reply-To: <AD266326EC54D9118CE700110A9E2BE2069F5B90@zch07exm01.corp.mot.com>
Liu Fred-a18596 writes:
> I found there was a bug in arch/ppc/lib/div64.s.
>
> The original div64_32() function would produce a zero divide
> exception in case of div64_32(0x100000000, 0xFFFFFFFF).
Thanks for pointing this out.
> Here is the bug-fixed new div64_32()function.
A patch would have been more helpful, so we could see immediately what
you have changed. Also, notes (or outlook or whatever mail program
you are using) has completely munged all the spacing of the code you
posted.
Anyway, I have some comments on your proposed fix:
> addc. r9,r4,r10 # rounding up (so the estimate cannot
I understand that the add that I had here can overflow in the case you
pointed out, so we need to preserve the carry. But why did you use
"addc." rather than "addc" ?
> mfxer r12 #
>
> rlwinm. r12, r12, 3, 31, 31 # XER[CA]
>
> cmpwi r12, 1 # carry ?
>
> bne 5f
>
> ori r9, r9, 0x1 # carry !
I think just "addze r9,r9" would do instead of these 5 instructions,
wouldn't it?
Paul.
^ permalink raw reply
* Building Linux kernel with GCC 3.4.3 fails
From: IGOR LURI @ 2005-09-12 7:02 UTC (permalink / raw)
To: linuxppc-embedded
[-- Attachment #1: Type: text/plain, Size: 768 bytes --]
Hi all
I have a MPC5200 Lite evaluation board and I use uClibc buildroot
to build toolchain and root file system.
If I build toolchain using binutils 2.16.1 and gcc 3.4.3, 3.4.4 or 3.3.6,
I can`t build u-boot and kernel properly.
With binutils version 2.14.90.0.8 and GCC 3.4.3,
I can build u-boot correctly, and it works. But I can´t boot a Linux kernel
compiled with this gcc, when Linux is booting it crashes with a segmentation fault.
However, if I use gcc 2.95.4 and binutils 2.12.1 to build u-boot and kernel, everything works.
I want to use gcc version 3.x . What version of binutils and gcc should I use to build u-boot and Linux kernel properly?
Have someone use buildroot with to obtain a toolchain for PowerPC?
-Igor
[-- Attachment #2: Type: text/html, Size: 2052 bytes --]
^ permalink raw reply
* A bug in div64.s
From: Liu Fred-a18596 @ 2005-09-12 7:21 UTC (permalink / raw)
To: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 3533 bytes --]
Hello, Greetings,
I found there was a bug in arch/ppc/lib/div64.s.
The original div64_32() function would produce a zero divide exception in case of div64_32(0x100000000, 0xFFFFFFFF).
Here is the bug-fixed new div64_32()function.
==============================================
/*
* Divide a 64-bit unsigned number by a 32-bit unsigned number.
* This routine assumes that the top 32 bits of the dividend are
* non-zero to start with.
* On entry, r3 points to the dividend, which get overwritten with
* the 64-bit quotient, and r4 contains the divisor.
* On exit, r3 contains the remainder.
*
* Copyright (C) 2002 Paul Mackerras, IBM Corp.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <asm/ppc_asm.h>
#include <asm/processor.h>
_GLOBAL(__div64_32)
lwz r5,0(r3) # get the dividend into r5/r6
lwz r6,4(r3)
cmplw r5,r4
li r7,0
li r8,0
blt 1f
divwu r7,r5,r4 # if dividend.hi >= divisor,
mullw r0,r7,r4 # quotient.hi = dividend.hi / divisor
subf. r5,r0,r5 # dividend.hi %= divisor
beq 3f
1: mr r11,r5 # here dividend.hi != 0
andis. r0,r5,0xc000
bne 2f
cntlzw r0,r5 # we are shifting the dividend right
li r10,-1 # to make it < 2^32, and shifting
srw r10,r10,r0 # the divisor right the same amount,
addc. r9,r4,r10 # rounding up (so the estimate cannot
andc r11,r6,r10 # ever be too large, only too small)
andc r9,r9,r10
mfxer r12 #
rlwinm. r12, r12, 3, 31, 31 # XER[CA]
cmpwi r12, 1 # carry ?
bne 5f
ori r9, r9, 0x1 # carry !
5:
or r11,r5,r11
rotlw r9,r9,r0
rotlw r11,r11,r0
divwu r11,r11,r9 # then we divide the shifted quantities
2: mullw r10,r11,r4 # to get an estimate of the quotient,
mulhwu r9,r11,r4 # multiply the estimate by the divisor,
subfc r6,r10,r6 # take the product from the divisor,
add r8,r8,r11 # and add the estimate to the accumulated
subfe. r5,r9,r5 # quotient
bne 1b
3: cmplw r6,r4
blt 4f
divwu r0,r6,r4 # perform the remaining 32-bit division
mullw r10,r0,r4 # and get the remainder
add r8,r8,r0
subf r6,r10,r6
4: stw r7,0(r3) # return the quotient in *r3
stw r8,4(r3)
mr r3,r6 # return the remainder in r3
blr
=================================================
BR,
Fred
[-- Attachment #2: Type: text/html, Size: 19979 bytes --]
^ permalink raw reply
* Re: newbie question : how to register for a new interrupt
From: Arthur Othieno @ 2005-09-11 17:41 UTC (permalink / raw)
To: Nuguru Susheel; +Cc: linuxppc-embedded
In-Reply-To: <1126102465.14131.16.camel@localhost.localdomain>
On Wed, Sep 07, 2005 at 02:14:25PM +0000, Nuguru Susheel wrote:
> Hi all,
>
> I have written an service routine for handling the GPIO_WAKEUP
> interrupt PSC2_4 pin (MPC5200 Core), but I donno how to register this
> routine into the kernel.
request_irq/free_irq() are what you're looking for.
See include/linux/interrupt.h for the details.
Arthur
^ permalink raw reply
* Msn Messenger 7.0 update now available
From: MSN @ 2005-09-07 20:46 UTC (permalink / raw)
To: linuxppc-dev
[-- Attachment #1: Type: text/html, Size: 17181 bytes --]
^ permalink raw reply
* 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,
+ ¤t->thread.vscr.u[3]);
+ break;
+ case 15: /* vctsxs */
+ for (i = 0; i < 4; ++i)
+ vrs[vd].u[i] = ctsxs(vrs[vb].u[i], va,
+ ¤t->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,
- ¤t->thread.vscr.u[3]);
- break;
- case 15: /* vctsxs */
- for (i = 0; i < 4; ++i)
- vrs[vd].u[i] = ctsxs(vrs[vb].u[i], va,
- ¤t->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,
- ¤t->thread.vscr.u[3]);
- break;
- case 15: /* vctsxs */
- for (i = 0; i < 4; ++i)
- vrs[vd].u[i] = ctsxs(vrs[vb].u[i], va,
- ¤t->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(¤t->sighand->siglock);
+ handler = current->sighand->action[signr-1].sa.sa_handler;
+ spin_unlock_irq(¤t->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
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox