* Re: [PATCH] powerpc: Do a bit more cpu init cleanups
From: Benjamin Herrenschmidt @ 2006-06-27 23:07 UTC (permalink / raw)
To: Olof Johansson; +Cc: linuxppc-dev, paulus
In-Reply-To: <20060627225401.GC5130@pb15.lixom.net>
On Tue, 2006-06-27 at 15:54 -0700, Olof Johansson wrote:
> On Wed, Jun 28, 2006 at 08:20:48AM +1000, Benjamin Herrenschmidt wrote:
> > On Tue, 2006-06-27 at 12:22 -0700, Olof Johansson wrote:
> > > Cleanup CPU inits a bit more, Geoff Levand already did some earlier.
> > >
> > > * Rename cpu_setup_power4.S to cpu_setup_ppc970.S
> >
> > > * Move CPU state save to cpu_setup, since cpu_setup is only ever done
> > > on cpu 0 on 64-bit.
> >
> > Nah, keep that one separate, will be needed as soon as we start doing
> > some sleep/wake stuff for ppc64
>
> Why? I can see having to restore the settings on wake, but not doing a
> brand new cpu_setup.
No, a new save, not setup.
> > > * Rename __restore_cpu_setup to __restore_cpu_setup_ppc970 since it's
> > > only actually doing anything there, and check before calling instead
> > > of in the function (no check needed on powermac).
> >
> > I'd like to keep a generic save/restore.. that or we put then in
> > cputable.
>
> Keep? There never was one. :)
There is one for 32 bits :)
> Since restore is called very first thing in smp secondary init, we don't
> have cputable available.
We could easily
Ben.
^ permalink raw reply
* Re: [PATCH] powerpc: Do a bit more cpu init cleanups
From: Olof Johansson @ 2006-06-27 23:48 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, paulus
In-Reply-To: <1151449661.2350.106.camel@localhost.localdomain>
On Wed, Jun 28, 2006 at 09:07:41AM +1000, Benjamin Herrenschmidt wrote:
> On Tue, 2006-06-27 at 15:54 -0700, Olof Johansson wrote:
> > On Wed, Jun 28, 2006 at 08:20:48AM +1000, Benjamin Herrenschmidt wrote:
> > > On Tue, 2006-06-27 at 12:22 -0700, Olof Johansson wrote:
> > > > Cleanup CPU inits a bit more, Geoff Levand already did some earlier.
> > > >
> > > > * Rename cpu_setup_power4.S to cpu_setup_ppc970.S
> > >
> > > > * Move CPU state save to cpu_setup, since cpu_setup is only ever done
> > > > on cpu 0 on 64-bit.
> > >
> > > Nah, keep that one separate, will be needed as soon as we start doing
> > > some sleep/wake stuff for ppc64
> >
> > Why? I can see having to restore the settings on wake, but not doing a
> > brand new cpu_setup.
>
> No, a new save, not setup.
I prefer to join them for now. I'm not convinced resaving is the best way
to go for sleep/wake, HID defaults are saved during boot. If other bits
have been flipped, chances are there's higher-level code that needs to
be aware and do things on resume anyway, and they can just set the bit
again there (i.e. platform suspend/resume handlers).
So, I prefer to keep the change as-is until there's code that shows the
neccessity of having it the other way.
> > > > * Rename __restore_cpu_setup to __restore_cpu_setup_ppc970 since it's
> > > > only actually doing anything there, and check before calling instead
> > > > of in the function (no check needed on powermac).
> > >
> > > I'd like to keep a generic save/restore.. that or we put then in
> > > cputable.
> >
> > Keep? There never was one. :)
>
> There is one for 32 bits :)
I didn't change any 32-bit code, so it's still there! :) (see below)
> > Since restore is called very first thing in smp secondary init, we don't
> > have cputable available.
>
> We could easily
Yeah, on second look it wouldn't be hard. I'll add it to the cputable
and use those pointers. It'll get rid of one of the PVR checks too.
-Olof
^ permalink raw reply
* Re: [PATCH] Assume we're on cpu 0 in early boot
From: Paul Mackerras @ 2006-06-28 1:42 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev, Arnd Bergmann
In-Reply-To: <20060627040036.469B767B28@ozlabs.org>
Michael Ellerman writes:
> There's a small period early in boot where we don't know which cpu we're
> running on. That's ok, except that it means we have no paca, or more
> correctly that our paca pointer points somewhere random.
>
> So that we can safely call things like smp_processor_id(), we need a paca,
> so just assume we're on cpu 0. No code should _write_ to the paca before
> we've set the correct one up.
OK, but why not just do a setup_paca(0) at the start of early_setup(),
in C code? You can also remove the redundant paca setting in
start_here_common() in head_64.S.
Paul.
^ permalink raw reply
* [PATCH] Clean up it_lp_queue.h
From: Stephen Rothwell @ 2006-06-28 1:49 UTC (permalink / raw)
To: paulus; +Cc: ppc-dev
No more StudlyCaps.
Remove from a couple of places it is no longer needed.
Use C style comments.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
arch/powerpc/kernel/paca.c | 1 -
arch/powerpc/platforms/iseries/lpevents.c | 55 +++++++++++++++--------------
arch/powerpc/platforms/iseries/proc.c | 1 -
include/asm-powerpc/iseries/it_lp_queue.h | 40 +++++++++++----------
4 files changed, 48 insertions(+), 49 deletions(-)
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index f505a88..a0bb354 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -16,7 +16,6 @@ #include <asm/processor.h>
#include <asm/ptrace.h>
#include <asm/page.h>
#include <asm/lppaca.h>
-#include <asm/iseries/it_lp_queue.h>
#include <asm/iseries/it_lp_reg_save.h>
#include <asm/paca.h>
diff --git a/arch/powerpc/platforms/iseries/lpevents.c b/arch/powerpc/platforms/iseries/lpevents.c
index 8ca7b93..2a9f81e 100644
--- a/arch/powerpc/platforms/iseries/lpevents.c
+++ b/arch/powerpc/platforms/iseries/lpevents.c
@@ -51,20 +51,21 @@ static unsigned lpEventHandlerPaths[HvLp
static struct HvLpEvent * get_next_hvlpevent(void)
{
struct HvLpEvent * event;
- event = (struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr;
+ event = (struct HvLpEvent *)hvlpevent_queue.hq_current_event;
if (hvlpevent_is_valid(event)) {
/* rmb() needed only for weakly consistent machines (regatta) */
rmb();
/* Set pointer to next potential event */
- hvlpevent_queue.xSlicCurEventPtr += ((event->xSizeMinus1 +
- LpEventAlign) / LpEventAlign) * LpEventAlign;
+ hvlpevent_queue.hq_current_event += ((event->xSizeMinus1 +
+ IT_LP_EVENT_ALIGN) / IT_LP_EVENT_ALIGN) *
+ IT_LP_EVENT_ALIGN;
/* Wrap to beginning if no room at end */
- if (hvlpevent_queue.xSlicCurEventPtr >
- hvlpevent_queue.xSlicLastValidEventPtr) {
- hvlpevent_queue.xSlicCurEventPtr =
- hvlpevent_queue.xSlicEventStackPtr;
+ if (hvlpevent_queue.hq_current_event >
+ hvlpevent_queue.hq_last_event) {
+ hvlpevent_queue.hq_current_event =
+ hvlpevent_queue.hq_event_stack;
}
} else {
event = NULL;
@@ -82,10 +83,10 @@ int hvlpevent_is_pending(void)
if (smp_processor_id() >= spread_lpevents)
return 0;
- next_event = (struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr;
+ next_event = (struct HvLpEvent *)hvlpevent_queue.hq_current_event;
return hvlpevent_is_valid(next_event) ||
- hvlpevent_queue.xPlicOverflowIntPending;
+ hvlpevent_queue.hq_overflow_pending;
}
static void hvlpevent_clear_valid(struct HvLpEvent * event)
@@ -95,18 +96,18 @@ static void hvlpevent_clear_valid(struct
* ie. on 64-byte boundaries.
*/
struct HvLpEvent *tmp;
- unsigned extra = ((event->xSizeMinus1 + LpEventAlign) /
- LpEventAlign) - 1;
+ unsigned extra = ((event->xSizeMinus1 + IT_LP_EVENT_ALIGN) /
+ IT_LP_EVENT_ALIGN) - 1;
switch (extra) {
case 3:
- tmp = (struct HvLpEvent*)((char*)event + 3 * LpEventAlign);
+ tmp = (struct HvLpEvent*)((char*)event + 3 * IT_LP_EVENT_ALIGN);
hvlpevent_invalidate(tmp);
case 2:
- tmp = (struct HvLpEvent*)((char*)event + 2 * LpEventAlign);
+ tmp = (struct HvLpEvent*)((char*)event + 2 * IT_LP_EVENT_ALIGN);
hvlpevent_invalidate(tmp);
case 1:
- tmp = (struct HvLpEvent*)((char*)event + 1 * LpEventAlign);
+ tmp = (struct HvLpEvent*)((char*)event + 1 * IT_LP_EVENT_ALIGN);
hvlpevent_invalidate(tmp);
}
@@ -120,7 +121,7 @@ void process_hvlpevents(struct pt_regs *
struct HvLpEvent * event;
/* If we have recursed, just return */
- if (!spin_trylock(&hvlpevent_queue.lock))
+ if (!spin_trylock(&hvlpevent_queue.hq_lock))
return;
for (;;) {
@@ -148,17 +149,17 @@ void process_hvlpevents(struct pt_regs *
printk(KERN_INFO "Unexpected Lp Event type=%d\n", event->xType );
hvlpevent_clear_valid(event);
- } else if (hvlpevent_queue.xPlicOverflowIntPending)
+ } else if (hvlpevent_queue.hq_overflow_pending)
/*
* No more valid events. If overflow events are
* pending process them
*/
- HvCallEvent_getOverflowLpEvents(hvlpevent_queue.xIndex);
+ HvCallEvent_getOverflowLpEvents(hvlpevent_queue.hq_index);
else
break;
}
- spin_unlock(&hvlpevent_queue.lock);
+ spin_unlock(&hvlpevent_queue.hq_lock);
}
static int set_spread_lpevents(char *str)
@@ -184,20 +185,20 @@ void setup_hvlpevent_queue(void)
{
void *eventStack;
- spin_lock_init(&hvlpevent_queue.lock);
+ spin_lock_init(&hvlpevent_queue.hq_lock);
/* Allocate a page for the Event Stack. */
- eventStack = alloc_bootmem_pages(LpEventStackSize);
- memset(eventStack, 0, LpEventStackSize);
+ eventStack = alloc_bootmem_pages(IT_LP_EVENT_STACK_SIZE);
+ memset(eventStack, 0, IT_LP_EVENT_STACK_SIZE);
/* Invoke the hypervisor to initialize the event stack */
- HvCallEvent_setLpEventStack(0, eventStack, LpEventStackSize);
+ HvCallEvent_setLpEventStack(0, eventStack, IT_LP_EVENT_STACK_SIZE);
- hvlpevent_queue.xSlicEventStackPtr = (char *)eventStack;
- hvlpevent_queue.xSlicCurEventPtr = (char *)eventStack;
- hvlpevent_queue.xSlicLastValidEventPtr = (char *)eventStack +
- (LpEventStackSize - LpEventMaxSize);
- hvlpevent_queue.xIndex = 0;
+ hvlpevent_queue.hq_event_stack = eventStack;
+ hvlpevent_queue.hq_current_event = eventStack;
+ hvlpevent_queue.hq_last_event = (char *)eventStack +
+ (IT_LP_EVENT_STACK_SIZE - IT_LP_EVENT_MAX_SIZE);
+ hvlpevent_queue.hq_index = 0;
}
/* Register a handler for an LpEvent type */
diff --git a/arch/powerpc/platforms/iseries/proc.c b/arch/powerpc/platforms/iseries/proc.c
index e68b6b5..c241413 100644
--- a/arch/powerpc/platforms/iseries/proc.c
+++ b/arch/powerpc/platforms/iseries/proc.c
@@ -24,7 +24,6 @@ #include <asm/paca.h>
#include <asm/processor.h>
#include <asm/time.h>
#include <asm/lppaca.h>
-#include <asm/iseries/it_lp_queue.h>
#include <asm/iseries/hv_call_xm.h>
#include "processor_vpd.h"
diff --git a/include/asm-powerpc/iseries/it_lp_queue.h b/include/asm-powerpc/iseries/it_lp_queue.h
index b7c6fc1..284c5a7 100644
--- a/include/asm-powerpc/iseries/it_lp_queue.h
+++ b/include/asm-powerpc/iseries/it_lp_queue.h
@@ -29,20 +29,20 @@ #include <asm/ptrace.h>
struct HvLpEvent;
-#define ITMaxLpQueues 8
+#define IT_LP_MAX_QUEUES 8
-#define NotUsed 0 // Queue will not be used by PLIC
-#define DedicatedIo 1 // Queue dedicated to IO processor specified
-#define DedicatedLp 2 // Queue dedicated to LP specified
-#define Shared 3 // Queue shared for both IO and LP
+#define IT_LP_NOT_USED 0 /* Queue will not be used by PLIC */
+#define IT_LP_DEDICATED_IO 1 /* Queue dedicated to IO processor specified */
+#define IT_LP_DEDICATED_LP 2 /* Queue dedicated to LP specified */
+#define IT_LP_SHARED 3 /* Queue shared for both IO and LP */
-#define LpEventStackSize 4096
-#define LpEventMaxSize 256
-#define LpEventAlign 64
+#define IT_LP_EVENT_STACK_SIZE 4096
+#define IT_LP_EVENT_MAX_SIZE 256
+#define IT_LP_EVENT_ALIGN 64
struct hvlpevent_queue {
/*
- * The xSlicCurEventPtr is the pointer to the next event stack entry
+ * The hq_current_event is the pointer to the next event stack entry
* that will become valid. The OS must peek at this entry to determine
* if it is valid. PLIC will set the valid indicator as the very last
* store into that entry.
@@ -52,23 +52,23 @@ struct hvlpevent_queue {
* location again.
*
* If the event stack fills and there are overflow events, then PLIC
- * will set the xPlicOverflowIntPending flag in which case the OS will
+ * will set the hq_overflow_pending flag in which case the OS will
* have to fetch the additional LP events once they have drained the
* event stack.
*
* The first 16-bytes are known by both the OS and PLIC. The remainder
* of the cache line is for use by the OS.
*/
- u8 xPlicOverflowIntPending;// 0x00 Overflow events are pending
- u8 xPlicStatus; // 0x01 DedicatedIo or DedicatedLp or NotUsed
- u16 xSlicLogicalProcIndex; // 0x02 Logical Proc Index for correlation
- u8 xPlicRsvd[12]; // 0x04
- char *xSlicCurEventPtr; // 0x10
- char *xSlicLastValidEventPtr; // 0x18
- char *xSlicEventStackPtr; // 0x20
- u8 xIndex; // 0x28 unique sequential index.
- u8 xSlicRsvd[3]; // 0x29-2b
- spinlock_t lock;
+ u8 hq_overflow_pending; /* 0x00 Overflow events are pending */
+ u8 hq_status; /* 0x01 DedicatedIo or DedicatedLp or NotUsed */
+ u16 hq_proc_index; /* 0x02 Logical Proc Index for correlation */
+ u8 hq_reserved1[12]; /* 0x04 */
+ char *hq_current_event; /* 0x10 */
+ char *hq_last_event; /* 0x18 */
+ char *hq_event_stack; /* 0x20 */
+ u8 hq_index; /* 0x28 unique sequential index. */
+ u8 hq_reserved2[3]; /* 0x29-2b */
+ spinlock_t hq_lock;
};
extern struct hvlpevent_queue hvlpevent_queue;
--
1.4.0
^ permalink raw reply related
* [PATCH] update asm-powerpc/time.h
From: Stephen Rothwell @ 2006-06-28 1:51 UTC (permalink / raw)
To: paulus; +Cc: ppc-dev
If we ever build a combined kernel including iSeries, then this will
be needed.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
include/asm-powerpc/time.h | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h
index 912118d..db8a57e 100644
--- a/include/asm-powerpc/time.h
+++ b/include/asm-powerpc/time.h
@@ -19,8 +19,9 @@ #include <linux/types.h>
#include <linux/percpu.h>
#include <asm/processor.h>
-#ifdef CONFIG_PPC64
+#ifdef CONFIG_PPC_ISERIES
#include <asm/paca.h>
+#include <asm/firmware.h>
#include <asm/iseries/hv_call.h>
#endif
@@ -178,7 +179,8 @@ #else
#ifdef CONFIG_PPC_ISERIES
int cur_dec;
- if (get_lppaca()->shared_proc) {
+ if (firmware_has_feature(FW_FEATURE_ISERIES) &&
+ get_lppaca()->shared_proc) {
get_lppaca()->virtual_decr = val;
cur_dec = get_dec();
if (cur_dec > val)
--
1.3.3.g16a4
^ permalink raw reply related
* [PATCH] Remove unused function call_with_mmu_off
From: Stephen Rothwell @ 2006-06-28 1:53 UTC (permalink / raw)
To: paulus; +Cc: ppc-dev
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
arch/powerpc/kernel/misc_64.S | 42 -----------------------------------------
1 files changed, 0 insertions(+), 42 deletions(-)
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index e8883d4..6bf4a46 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -101,48 +101,6 @@ _GLOBAL(call___do_IRQ)
blr
#endif /* CONFIG_IRQSTACKS */
- /*
- * To be called by C code which needs to do some operations with MMU
- * disabled. Note that interrupts have to be disabled by the caller
- * prior to calling us. The code called _MUST_ be in the RMO of course
- * and part of the linear mapping as we don't attempt to translate the
- * stack pointer at all. The function is called with the stack switched
- * to this CPU emergency stack
- *
- * prototype is void *call_with_mmu_off(void *func, void *data);
- *
- * the called function is expected to be of the form
- *
- * void *called(void *data);
- */
-_GLOBAL(call_with_mmu_off)
- mflr r0 /* get link, save it on stackframe */
- std r0,16(r1)
- mr r1,r5 /* save old stack ptr */
- ld r1,PACAEMERGSP(r13) /* get emerg. stack */
- subi r1,r1,STACK_FRAME_OVERHEAD
- std r0,16(r1) /* save link on emerg. stack */
- std r5,0(r1) /* save old stack ptr in backchain */
- ld r3,0(r3) /* get to real function ptr (assume same TOC) */
- bl 2f /* we need LR to return, continue at label 2 */
-
- ld r0,16(r1) /* we return here from the call, get LR and */
- ld r1,0(r1) /* .. old stack ptr */
- mtspr SPRN_SRR0,r0 /* and get back to virtual mode with these */
- mfmsr r4
- ori r4,r4,MSR_IR|MSR_DR
- mtspr SPRN_SRR1,r4
- rfid
-
-2: mtspr SPRN_SRR0,r3 /* coming from above, enter real mode */
- mr r3,r4 /* get parameter */
- mfmsr r0
- ori r0,r0,MSR_IR|MSR_DR
- xori r0,r0,MSR_IR|MSR_DR
- mtspr SPRN_SRR1,r0
- rfid
-
-
.section ".toc","aw"
PPC64_CACHES:
.tc ppc64_caches[TC],ppc64_caches
--
1.4.0
^ permalink raw reply related
* [PATCH] Consolidate some of kernel/misc*.S
From: Stephen Rothwell @ 2006-06-28 1:55 UTC (permalink / raw)
To: paulus; +Cc: ppc-dev
There were some common functions (mainly i/o).
Also some small white space cleanups and remove a couple of small unused
functions.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
arch/powerpc/kernel/Makefile | 3 -
arch/powerpc/kernel/misc.S | 203 +++++++++++++++++++++++++++++++++++++++++
arch/powerpc/kernel/misc_32.S | 156 --------------------------------
arch/powerpc/kernel/misc_64.S | 181 +------------------------------------
4 files changed, 209 insertions(+), 334 deletions(-)
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 803858e..814f242 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -50,7 +50,8 @@ extra-$(CONFIG_FSL_BOOKE) := head_fsl_bo
extra-$(CONFIG_8xx) := head_8xx.o
extra-y += vmlinux.lds
-obj-y += time.o prom.o traps.o setup-common.o udbg.o
+obj-y += time.o prom.o traps.o setup-common.o \
+ udbg.o misc.o
obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o
obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o
obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o
diff --git a/arch/powerpc/kernel/misc.S b/arch/powerpc/kernel/misc.S
new file mode 100644
index 0000000..fc23040
--- /dev/null
+++ b/arch/powerpc/kernel/misc.S
@@ -0,0 +1,203 @@
+/*
+ * This file contains miscellaneous low-level functions.
+ * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
+ *
+ * Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
+ * and Paul Mackerras.
+ *
+ * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com)
+ * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
+ *
+ * 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>
+
+ .text
+
+#ifdef CONFIG_PPC64
+#define IN_SYNC twi 0,r5,0; isync
+#define EIEIO_32
+#define SYNC_64 sync
+#else /* CONFIG_PPC32 */
+#define IN_SYNC
+#define EIEIO_32 eieio
+#define SYNC_64
+#endif
+/*
+ * Returns (address we are running at) - (address we were linked at)
+ * for use before the text and data are mapped to KERNELBASE.
+ */
+
+_GLOBAL(reloc_offset)
+ mflr r0
+ bl 1f
+1: mflr r3
+ LOAD_REG_IMMEDIATE(r4,1b)
+ subf r3,r4,r3
+ mtlr r0
+ blr
+
+/*
+ * add_reloc_offset(x) returns x + reloc_offset().
+ */
+_GLOBAL(add_reloc_offset)
+ mflr r0
+ bl 1f
+1: mflr r5
+ LOAD_REG_IMMEDIATE(r4,1b)
+ subf r5,r4,r5
+ add r3,r3,r5
+ mtlr r0
+ blr
+
+/*
+ * I/O string operations
+ *
+ * insb(port, buf, len)
+ * outsb(port, buf, len)
+ * insw(port, buf, len)
+ * outsw(port, buf, len)
+ * insl(port, buf, len)
+ * outsl(port, buf, len)
+ * insw_ns(port, buf, len)
+ * outsw_ns(port, buf, len)
+ * insl_ns(port, buf, len)
+ * outsl_ns(port, buf, len)
+ *
+ * The *_ns versions don't do byte-swapping.
+ */
+_GLOBAL(_insb)
+ cmpwi 0,r5,0
+ mtctr r5
+ subi r4,r4,1
+ blelr-
+00: lbz r5,0(r3)
+ eieio
+ stbu r5,1(r4)
+ bdnz 00b
+ IN_SYNC
+ blr
+
+_GLOBAL(_outsb)
+ cmpwi 0,r5,0
+ mtctr r5
+ subi r4,r4,1
+ blelr-
+00: lbzu r5,1(r4)
+ stb r5,0(r3)
+ EIEIO_32
+ bdnz 00b
+ SYNC_64
+ blr
+
+_GLOBAL(_insw)
+ cmpwi 0,r5,0
+ mtctr r5
+ subi r4,r4,2
+ blelr-
+00: lhbrx r5,0,r3
+ eieio
+ sthu r5,2(r4)
+ bdnz 00b
+ IN_SYNC
+ blr
+
+_GLOBAL(_outsw)
+ cmpwi 0,r5,0
+ mtctr r5
+ subi r4,r4,2
+ blelr-
+00: lhzu r5,2(r4)
+ EIEIO_32
+ sthbrx r5,0,r3
+ bdnz 00b
+ SYNC_64
+ blr
+
+_GLOBAL(_insl)
+ cmpwi 0,r5,0
+ mtctr r5
+ subi r4,r4,4
+ blelr-
+00: lwbrx r5,0,r3
+ eieio
+ stwu r5,4(r4)
+ bdnz 00b
+ IN_SYNC
+ blr
+
+_GLOBAL(_outsl)
+ cmpwi 0,r5,0
+ mtctr r5
+ subi r4,r4,4
+ blelr-
+00: lwzu r5,4(r4)
+ stwbrx r5,0,r3
+ EIEIO_32
+ bdnz 00b
+ SYNC_64
+ blr
+
+#ifdef CONFIG_PPC32
+_GLOBAL(__ide_mm_insw)
+#endif
+_GLOBAL(_insw_ns)
+ cmpwi 0,r5,0
+ mtctr r5
+ subi r4,r4,2
+ blelr-
+00: lhz r5,0(r3)
+ eieio
+ sthu r5,2(r4)
+ bdnz 00b
+ IN_SYNC
+ blr
+
+#ifdef CONFIG_PPC32
+_GLOBAL(__ide_mm_outsw)
+#endif
+_GLOBAL(_outsw_ns)
+ cmpwi 0,r5,0
+ mtctr r5
+ subi r4,r4,2
+ blelr-
+00: lhzu r5,2(r4)
+ sth r5,0(r3)
+ EIEIO_32
+ bdnz 00b
+ SYNC_64
+ blr
+
+#ifdef CONFIG_PPC32
+_GLOBAL(__ide_mm_insl)
+#endif
+_GLOBAL(_insl_ns)
+ cmpwi 0,r5,0
+ mtctr r5
+ subi r4,r4,4
+ blelr-
+00: lwz r5,0(r3)
+ eieio
+ stwu r5,4(r4)
+ bdnz 00b
+ IN_SYNC
+ blr
+
+#ifdef CONFIG_PPC32
+_GLOBAL(__ide_mm_outsl)
+#endif
+_GLOBAL(_outsl_ns)
+ cmpwi 0,r5,0
+ mtctr r5
+ subi r4,r4,4
+ blelr-
+00: lwzu r5,4(r4)
+ stw r5,0(r3)
+ EIEIO_32
+ bdnz 00b
+ SYNC_64
+ blr
+
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 01d3916..c74774e 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -61,32 +61,6 @@ _GLOBAL(mulhdu)
blr
/*
- * Returns (address we're running at) - (address we were linked at)
- * for use before the text and data are mapped to KERNELBASE.
- */
-_GLOBAL(reloc_offset)
- mflr r0
- bl 1f
-1: mflr r3
- LOAD_REG_IMMEDIATE(r4,1b)
- subf r3,r4,r3
- mtlr r0
- blr
-
-/*
- * add_reloc_offset(x) returns x + reloc_offset().
- */
-_GLOBAL(add_reloc_offset)
- mflr r0
- bl 1f
-1: mflr r5
- LOAD_REG_IMMEDIATE(r4,1b)
- subf r5,r4,r5
- add r3,r3,r5
- mtlr r0
- blr
-
-/*
* sub_reloc_offset(x) returns x - reloc_offset().
*/
_GLOBAL(sub_reloc_offset)
@@ -781,136 +755,6 @@ _GLOBAL(atomic_set_mask)
blr
/*
- * I/O string operations
- *
- * insb(port, buf, len)
- * outsb(port, buf, len)
- * insw(port, buf, len)
- * outsw(port, buf, len)
- * insl(port, buf, len)
- * outsl(port, buf, len)
- * insw_ns(port, buf, len)
- * outsw_ns(port, buf, len)
- * insl_ns(port, buf, len)
- * outsl_ns(port, buf, len)
- *
- * The *_ns versions don't do byte-swapping.
- */
-_GLOBAL(_insb)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,1
- blelr-
-00: lbz r5,0(r3)
- eieio
- stbu r5,1(r4)
- bdnz 00b
- blr
-
-_GLOBAL(_outsb)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,1
- blelr-
-00: lbzu r5,1(r4)
- stb r5,0(r3)
- eieio
- bdnz 00b
- blr
-
-_GLOBAL(_insw)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,2
- blelr-
-00: lhbrx r5,0,r3
- eieio
- sthu r5,2(r4)
- bdnz 00b
- blr
-
-_GLOBAL(_outsw)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,2
- blelr-
-00: lhzu r5,2(r4)
- eieio
- sthbrx r5,0,r3
- bdnz 00b
- blr
-
-_GLOBAL(_insl)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,4
- blelr-
-00: lwbrx r5,0,r3
- eieio
- stwu r5,4(r4)
- bdnz 00b
- blr
-
-_GLOBAL(_outsl)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,4
- blelr-
-00: lwzu r5,4(r4)
- stwbrx r5,0,r3
- eieio
- bdnz 00b
- blr
-
-_GLOBAL(__ide_mm_insw)
-_GLOBAL(_insw_ns)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,2
- blelr-
-00: lhz r5,0(r3)
- eieio
- sthu r5,2(r4)
- bdnz 00b
- blr
-
-_GLOBAL(__ide_mm_outsw)
-_GLOBAL(_outsw_ns)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,2
- blelr-
-00: lhzu r5,2(r4)
- sth r5,0(r3)
- eieio
- bdnz 00b
- blr
-
-_GLOBAL(__ide_mm_insl)
-_GLOBAL(_insl_ns)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,4
- blelr-
-00: lwz r5,0(r3)
- eieio
- stwu r5,4(r4)
- bdnz 00b
- blr
-
-_GLOBAL(__ide_mm_outsl)
-_GLOBAL(_outsl_ns)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,4
- blelr-
-00: lwzu r5,4(r4)
- stw r5,0(r3)
- eieio
- bdnz 00b
- blr
-
-/*
* Extended precision shifts.
*
* Updated to be valid for shift counts from 0 to 63 inclusive.
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 6bf4a46..580891c 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -1,14 +1,12 @@
/*
- * arch/powerpc/kernel/misc64.S
- *
* This file contains miscellaneous low-level functions.
* Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
*
* Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
* and Paul Mackerras.
* Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com)
- * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
- *
+ * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
+ *
* 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
@@ -30,41 +28,10 @@ #include <asm/thread_info.h>
.text
-/*
- * Returns (address we are running at) - (address we were linked at)
- * for use before the text and data are mapped to KERNELBASE.
- */
-
-_GLOBAL(reloc_offset)
- mflr r0
- bl 1f
-1: mflr r3
- LOAD_REG_IMMEDIATE(r4,1b)
- subf r3,r4,r3
- mtlr r0
- blr
-
-/*
- * add_reloc_offset(x) returns x + reloc_offset().
- */
-_GLOBAL(add_reloc_offset)
- mflr r0
- bl 1f
-1: mflr r5
- LOAD_REG_IMMEDIATE(r4,1b)
- subf r5,r4,r5
- add r3,r3,r5
- mtlr r0
- blr
-
_GLOBAL(get_msr)
mfmsr r3
blr
-_GLOBAL(get_dar)
- mfdar r3
- blr
-
_GLOBAL(get_srr0)
mfsrr0 r3
blr
@@ -72,10 +39,6 @@ _GLOBAL(get_srr0)
_GLOBAL(get_srr1)
mfsrr1 r3
blr
-
-_GLOBAL(get_sp)
- mr r3,r1
- blr
#ifdef CONFIG_IRQSTACKS
_GLOBAL(call_do_softirq)
@@ -281,144 +244,6 @@ _GLOBAL(__flush_dcache_icache)
bdnz 1b
isync
blr
-
-/*
- * I/O string operations
- *
- * insb(port, buf, len)
- * outsb(port, buf, len)
- * insw(port, buf, len)
- * outsw(port, buf, len)
- * insl(port, buf, len)
- * outsl(port, buf, len)
- * insw_ns(port, buf, len)
- * outsw_ns(port, buf, len)
- * insl_ns(port, buf, len)
- * outsl_ns(port, buf, len)
- *
- * The *_ns versions don't do byte-swapping.
- */
-_GLOBAL(_insb)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,1
- blelr-
-00: lbz r5,0(r3)
- eieio
- stbu r5,1(r4)
- bdnz 00b
- twi 0,r5,0
- isync
- blr
-
-_GLOBAL(_outsb)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,1
- blelr-
-00: lbzu r5,1(r4)
- stb r5,0(r3)
- bdnz 00b
- sync
- blr
-
-_GLOBAL(_insw)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,2
- blelr-
-00: lhbrx r5,0,r3
- eieio
- sthu r5,2(r4)
- bdnz 00b
- twi 0,r5,0
- isync
- blr
-
-_GLOBAL(_outsw)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,2
- blelr-
-00: lhzu r5,2(r4)
- sthbrx r5,0,r3
- bdnz 00b
- sync
- blr
-
-_GLOBAL(_insl)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,4
- blelr-
-00: lwbrx r5,0,r3
- eieio
- stwu r5,4(r4)
- bdnz 00b
- twi 0,r5,0
- isync
- blr
-
-_GLOBAL(_outsl)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,4
- blelr-
-00: lwzu r5,4(r4)
- stwbrx r5,0,r3
- bdnz 00b
- sync
- blr
-
-/* _GLOBAL(ide_insw) now in drivers/ide/ide-iops.c */
-_GLOBAL(_insw_ns)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,2
- blelr-
-00: lhz r5,0(r3)
- eieio
- sthu r5,2(r4)
- bdnz 00b
- twi 0,r5,0
- isync
- blr
-
-/* _GLOBAL(ide_outsw) now in drivers/ide/ide-iops.c */
-_GLOBAL(_outsw_ns)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,2
- blelr-
-00: lhzu r5,2(r4)
- sth r5,0(r3)
- bdnz 00b
- sync
- blr
-
-_GLOBAL(_insl_ns)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,4
- blelr-
-00: lwz r5,0(r3)
- eieio
- stwu r5,4(r4)
- bdnz 00b
- twi 0,r5,0
- isync
- blr
-
-_GLOBAL(_outsl_ns)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,4
- blelr-
-00: lwzu r5,4(r4)
- stw r5,0(r3)
- bdnz 00b
- sync
- blr
/*
* identify_cpu and calls setup_cpu
@@ -563,6 +388,7 @@ _GLOBAL(real_writeb)
blr
#endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE) */
+#ifdef CONFIG_CPU_FREQ_PMAC64
/*
* SCOM access functions for 970 (FX only for now)
*
@@ -631,6 +457,7 @@ _GLOBAL(scom970_write)
/* restore interrupts */
mtmsrd r5,1
blr
+#endif /* CONFIG_CPU_FREQ_PMAC64 */
/*
--
1.4.0
^ permalink raw reply related
* [PATCH] Make lparcfg.c work when both iseries and pseries are selected
From: Stephen Rothwell @ 2006-06-28 1:57 UTC (permalink / raw)
To: paulus; +Cc: ppc-dev
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
arch/powerpc/kernel/lparcfg.c | 69 +++++++++++++++++++----------------------
1 files changed, 32 insertions(+), 37 deletions(-)
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index c02deaa..bcc358d 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -45,11 +45,9 @@ #define MODULE_NAME "lparcfg"
static struct proc_dir_entry *proc_ppc64_lparcfg;
#define LPARCFG_BUFF_SIZE 4096
-#ifdef CONFIG_PPC_ISERIES
-
/*
- * For iSeries legacy systems, the PPA purr function is available from the
- * emulated_time_base field in the paca.
+ * Track sum of all purrs across all processors. This is used to further
+ * calculate usage values by different applications
*/
static unsigned long get_purr(void)
{
@@ -57,30 +55,30 @@ static unsigned long get_purr(void)
int cpu;
for_each_possible_cpu(cpu) {
- sum_purr += lppaca[cpu].emulated_time_base;
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ sum_purr += lppaca[cpu].emulated_time_base;
+ else {
+ struct cpu_usage *cu;
-#ifdef PURR_DEBUG
- printk(KERN_INFO "get_purr for cpu (%d) has value (%ld) \n",
- cpu, lppaca[cpu].emulated_time_base);
-#endif
+ cu = &per_cpu(cpu_usage_array, cpu);
+ sum_purr += cu->current_tb;
+ }
}
return sum_purr;
}
-#define lparcfg_write NULL
+#ifdef CONFIG_PPC_ISERIES
/*
* Methods used to fetch LPAR data when running on an iSeries platform.
*/
-static int lparcfg_data(struct seq_file *m, void *v)
+static int iseries_lparcfg_data(struct seq_file *m, void *v)
{
unsigned long pool_id, lp_index;
int shared, entitled_capacity, max_entitled_capacity;
int processors, max_processors;
unsigned long purr = get_purr();
- seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS);
-
shared = (int)(get_lppaca()->shared_proc);
seq_printf(m, "serial_number=%c%c%c%c%c%c%c\n",
e2a(xItExtVpdPanel.mfgID[2]),
@@ -213,22 +211,6 @@ static void h_pic(unsigned long *pool_id
log_plpar_hcall_return(rc, "H_PIC");
}
-/* Track sum of all purrs across all processors. This is used to further */
-/* calculate usage values by different applications */
-
-static unsigned long get_purr(void)
-{
- unsigned long sum_purr = 0;
- int cpu;
- struct cpu_usage *cu;
-
- for_each_possible_cpu(cpu) {
- cu = &per_cpu(cpu_usage_array, cpu);
- sum_purr += cu->current_tb;
- }
- return sum_purr;
-}
-
#define SPLPAR_CHARACTERISTICS_TOKEN 20
#define SPLPAR_MAXLENGTH 1026*(sizeof(char))
@@ -333,7 +315,7 @@ #endif
return count;
}
-static int lparcfg_data(struct seq_file *m, void *v)
+static int pseries_lparcfg_data(struct seq_file *m, void *v)
{
int partition_potential_processors;
int partition_active_processors;
@@ -354,8 +336,6 @@ static int lparcfg_data(struct seq_file
lp_index = *lp_index_ptr;
}
- seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS);
-
seq_printf(m, "serial_number=%s\n", system_id);
seq_printf(m, "system_type=%s\n", model);
@@ -456,6 +436,21 @@ static int lparcfg_data(struct seq_file
return 0;
}
+#endif /* CONFIG_PPC_PSERIES */
+
+static int lparcfg_data(struct seq_file *m, void *v)
+{
+ seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS);
+
+#ifdef CONFIG_PPC_ISERIES
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ return iseries_lparcfg_data(m, v);
+#endif
+#ifdef CONFIG_PPC_PSERIES
+ return pseries_lparcfg_data(m, v);
+#endif
+}
+
/*
* Interface for changing system parameters (variable capacity weight
* and entitled capacity). Format of input is "param_name=value";
@@ -469,6 +464,8 @@ static int lparcfg_data(struct seq_file
static ssize_t lparcfg_write(struct file *file, const char __user * buf,
size_t count, loff_t * off)
{
+ ssize_t retval = -ENOMEM;
+#ifdef CONFIG_PPC_PSERIES
char *kbuf;
char *tmp;
u64 new_entitled, *new_entitled_ptr = &new_entitled;
@@ -479,8 +476,6 @@ static ssize_t lparcfg_write(struct file
unsigned long resource;
u8 current_weight;
- ssize_t retval = -ENOMEM;
-
kbuf = kmalloc(count, GFP_KERNEL);
if (!kbuf)
goto out;
@@ -546,11 +541,10 @@ static ssize_t lparcfg_write(struct file
out:
kfree(kbuf);
+#endif /* CONFIG_PPC_PSERIES */
return retval;
}
-#endif /* CONFIG_PPC_PSERIES */
-
static int lparcfg_open(struct inode *inode, struct file *file)
{
return single_open(file, lparcfg_data, NULL);
@@ -569,7 +563,8 @@ int __init lparcfg_init(void)
mode_t mode = S_IRUSR | S_IRGRP | S_IROTH;
/* Allow writing if we have FW_FEATURE_SPLPAR */
- if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
+ if (firmware_has_feature(FW_FEATURE_SPLPAR) &&
+ !firmware_has_feature(FW_FEATURE_ISERIES)) {
lparcfg_fops.write = lparcfg_write;
mode |= S_IWUSR;
}
--
1.4.0
^ permalink raw reply related
* Can anyone tell me if it is a bug of the ELDK4.0?
From: Denny @ 2006-06-28 1:53 UTC (permalink / raw)
To: linuxppc-embedded, wolfgangdenk
In-Reply-To: <e7rcok$fe9$1@sea.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1687 bytes --]
Hi,
I failed to compile the uboot on my 440GP platform, I set the compile switch as "-m440 -mcpu=440",
But the interest thing is when I change the switch to "-m405 -mcpu=440", I can compile my uboot successfully, why?
Also I find all the instructions are existed both in user manual of PPC_405 and PPC440.
make[1]: Leaving directory `/opt/glacier_boot/post/cpu'
ppc_4xx-gcc -Wa,-gstabs -D__ASSEMBLY__ -g -Os -fPIC -ffixed-r14 -meabi -fno-strict-aliasing -D__KERNEL__ -DTEXT_BASE=0xFFC40000 -I/opt/glacier_boot/include -fno-builtin -ffreestanding -nostdinc -isystem /opt/eldk4.0/usr/bin/../lib/gcc/powerpc-linux/4.0.0/include -pipe -DCONFIG_PPC -D__powerpc__ -DCONFIG_4xx -ffixed-r2 -ffixed-r29 -mstring -Wa,-m440 -mcpu=440 -msoft-float -c -o cpu/ppc4xx/start.o /opt/glacier_boot/cpu/ppc4xx/start.S
/opt/glacier_boot/cpu/ppc4xx/start.S: Assembler messages:
/opt/glacier_boot/cpu/ppc4xx/start.S:996: Error: Unrecognized opcode: `mfdccr'
/opt/glacier_boot/cpu/ppc4xx/start.S:998: Error: Unrecognized opcode: `mtdccr'
/opt/glacier_boot/cpu/ppc4xx/start.S:1016: Error: Unrecognized opcode: `mtdccr'
/opt/glacier_boot/cpu/ppc4xx/start.S:1027: Error: Unrecognized opcode: `mticcr'
/opt/glacier_boot/cpu/ppc4xx/start.S:1033: Error: Unrecognized opcode: `mticcr'
/opt/glacier_boot/cpu/ppc4xx/start.S:1039: Error: Unrecognized opcode: `mficcr'
/opt/glacier_boot/cpu/ppc4xx/start.S:1050: Error: Unrecognized opcode: `mtdccr'
/opt/glacier_boot/cpu/ppc4xx/start.S:1059: Error: Unrecognized opcode: `mtdccr'
/opt/glacier_boot/cpu/ppc4xx/start.S:1064: Error: Unrecognized opcode: `mfdccr'
make: *** [cpu/ppc4xx/start.o] Error 1
[root@localhost glacier_boot]#
[-- Attachment #2: Type: text/html, Size: 2473 bytes --]
^ permalink raw reply
* Re: [PATCH] Assume we're on cpu 0 in early boot
From: Michael Ellerman @ 2006-06-28 2:11 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, Arnd Bergmann
In-Reply-To: <17569.56937.308576.848377@cargo.ozlabs.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 945 bytes --]
On Wed, 2006-06-28 at 11:42 +1000, Paul Mackerras wrote:
> Michael Ellerman writes:
>
> > There's a small period early in boot where we don't know which cpu we're
> > running on. That's ok, except that it means we have no paca, or more
> > correctly that our paca pointer points somewhere random.
> >
> > So that we can safely call things like smp_processor_id(), we need a paca,
> > so just assume we're on cpu 0. No code should _write_ to the paca before
> > we've set the correct one up.
>
> OK, but why not just do a setup_paca(0) at the start of early_setup(),
> in C code? You can also remove the redundant paca setting in
> start_here_common() in head_64.S.
Yep, duh. New patch RSN.
cheers
--
Michael Ellerman
IBM OzLabs
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 191 bytes --]
^ permalink raw reply
* [PATCH] Assume we're on cpu 0 in early boot
From: Michael Ellerman @ 2006-06-28 3:18 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, Arnd Bergmann
In-Reply-To: <17569.56937.308576.848377@cargo.ozlabs.ibm.com>
There's a small period early in boot where we don't know which cpu we're
running on. That's ok, except that it means we have no paca, or more
correctly that our paca pointer points somewhere random.
So that we can safely call things like smp_processor_id(), we need a paca,
so just assume we're on cpu 0. No code should _write_ to the paca before
we've set the correct one up.
We setup the proper paca after we've scanned the flat device tree in
early_setup(), so there's no need to do it again in start_here_common.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
arch/powerpc/kernel/head_64.S | 11 -----------
arch/powerpc/kernel/setup_64.c | 3 +++
2 files changed, 3 insertions(+), 11 deletions(-)
Index: to-merge/arch/powerpc/kernel/head_64.S
===================================================================
--- to-merge.orig/arch/powerpc/kernel/head_64.S
+++ to-merge/arch/powerpc/kernel/head_64.S
@@ -1602,9 +1602,6 @@ _GLOBAL(__start_initialization_multiplat
/* Setup some critical 970 SPRs before switching MMU off */
bl .__970_cpu_preinit
- /* cpu # */
- li r24,0
-
/* Switch off MMU if not already */
LOAD_REG_IMMEDIATE(r4, .__after_prom_start - KERNELBASE)
add r4,r4,r30
@@ -1962,14 +1959,6 @@ _STATIC(start_here_common)
li r3,0
bl .do_cpu_ftr_fixups
- LOAD_REG_IMMEDIATE(r26, boot_cpuid)
- lwz r26,0(r26)
-
- LOAD_REG_IMMEDIATE(r24, paca) /* Get base vaddr of paca array */
- mulli r13,r26,PACA_SIZE /* Calculate vaddr of right paca */
- add r13,r13,r24 /* for this processor. */
- mtspr SPRN_SPRG3,r13
-
/* ptr to current */
LOAD_REG_IMMEDIATE(r4, init_task)
std r4,PACACURRENT(r13)
Index: to-merge/arch/powerpc/kernel/setup_64.c
===================================================================
--- to-merge.orig/arch/powerpc/kernel/setup_64.c
+++ to-merge/arch/powerpc/kernel/setup_64.c
@@ -177,6 +177,9 @@ void __init setup_paca(int cpu)
void __init early_setup(unsigned long dt_ptr)
{
+ /* Assume we're on cpu 0 for now. Don't write to the paca yet! */
+ setup_paca(0);
+
/* Enable early debugging if any specified (see udbg.h) */
udbg_early_init();
^ permalink raw reply
* Re: [PATCH] Make lparcfg.c work when both iseries and pseries are selected
From: Nathan Lynch @ 2006-06-28 4:05 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: ppc-dev, paulus
In-Reply-To: <20060628115728.17f1a04d.sfr@canb.auug.org.au>
Stephen Rothwell wrote:
> static ssize_t lparcfg_write(struct file *file, const char __user * buf,
> size_t count, loff_t * off)
> {
> + ssize_t retval = -ENOMEM;
> +#ifdef CONFIG_PPC_PSERIES
> char *kbuf;
> char *tmp;
> u64 new_entitled, *new_entitled_ptr = &new_entitled;
> @@ -479,8 +476,6 @@ static ssize_t lparcfg_write(struct file
> unsigned long resource;
> u8 current_weight;
>
> - ssize_t retval = -ENOMEM;
> -
> kbuf = kmalloc(count, GFP_KERNEL);
> if (!kbuf)
> goto out;
> @@ -546,11 +541,10 @@ static ssize_t lparcfg_write(struct file
>
> out:
> kfree(kbuf);
> +#endif /* CONFIG_PPC_PSERIES */
> return retval;
> }
Erm... this is kind of gross, and will return -ENOMEM on iSeries when
it should really return -ENOSYS (I think).
Would it be over-engineering to have an lparcfg_ops struct, with
lparcfg_read and lparcfg_write methods (and the latter would be null
on iSeries)? All the additional #ifdeffery doesn't really improve
the readability of this code IMO.
^ permalink raw reply
* Re: Using bestcomm in an external module (MPC5200B to be exact)
From: John Rigby @ 2006-06-28 4:08 UTC (permalink / raw)
To: Sylvain Munaut; +Cc: linuxppc-embedded
In-Reply-To: <20060620211529.vjpk2lsxakn4088s@webmail.bluenox.com>
Yes I know its the work of many people, calling it your was just an
abbreviation.
The latest ltib isn't based on your latest but then again your latest
was never public:).
So is your git tree uptodate? If so then I will look at putting
together some patches to it. I have an ata update and also an ac97
driver. My goal is to have the best version in the public and ltib
just a copy of it.
On 6/20/06, Sylvain Munaut <tnt@246tnt.com> wrote:
>
> > -----Original Message-----
> > From: John Rigby [mailto:jcrigby@gmail.com]
> > Sent: Monday, June 19, 2006 2:33 PM
> > To: Trueskew
> > Cc: Andrey Volkov; linuxppc-embedded@ozlabs.org
> > Subject: Re: Using bestcomm in an external module (MPC5200B to be exact)
> >
> > The next LTIB bsp for 5200b will use the Sylvain's bestcomm api.
>
> Cool ;) But it's far from being my whole work. The foundation and a good
> cleanup pass comes from Dale and Andrey respectiverly.
>
> Be sure to use the latest one I sent you though ;p
> BTW, I guess that means your fine with my last modifications ?
>
>
> Sylvain
>
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
>
^ permalink raw reply
* [PATCH] powerpc: Do a bit more cpu init cleanups (v2)
From: Olof Johansson @ 2006-06-28 4:38 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20060627192206.GB5130@pb15.lixom.net>
Cleanup CPU inits a bit more, Geoff Levand already did some earlier.
* Rename cpu_setup_power4.S to cpu_setup_ppc970.S
* Move CPU state save to cpu_setup, since cpu_setup is done
on cpu 0 on 64-bit and save is never done more than once.
* Rename __restore_cpu_setup to __restore_cpu_ppc970 and add
function pointers to the cputable to use instead. Powermac always
has 970 so no need to check there.
* Rename __970_cpu_preinit to __cpu_preinit_ppc970 and check PVR before
calling it instead of in it, it's too early to use cputable here.
* Rename pSeries_secondary_smp_init to generic_secondary_smp_init since
everyone but powermac and iSeries use it.
Signed-off-by: Olof Johansson <olof@lixom.net>
Index: linux-2.6/arch/powerpc/kernel/Makefile
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/Makefile
+++ linux-2.6/arch/powerpc/kernel/Makefile
@@ -16,7 +16,7 @@ obj-y := semaphore.o cputable.o ptrac
obj-y += vdso32/
obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \
signal_64.o ptrace32.o \
- paca.o cpu_setup_power4.o \
+ paca.o cpu_setup_ppc970.o \
firmware.o sysfs.o
obj-$(CONFIG_PPC64) += vdso64/
obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o
Index: linux-2.6/arch/powerpc/kernel/cpu_setup_power4.S
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/cpu_setup_power4.S
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * This file contains low level CPU setup functions.
- * Copyright (C) 2003 Benjamin Herrenschmidt (benh@kernel.crashing.org)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- *
- */
-
-#include <linux/config.h>
-#include <asm/processor.h>
-#include <asm/page.h>
-#include <asm/cputable.h>
-#include <asm/ppc_asm.h>
-#include <asm/asm-offsets.h>
-#include <asm/cache.h>
-
-_GLOBAL(__970_cpu_preinit)
- /*
- * Do nothing if not running in HV mode
- */
- mfmsr r0
- rldicl. r0,r0,4,63
- beqlr
-
- /*
- * Deal only with PPC970 and PPC970FX.
- */
- mfspr r0,SPRN_PVR
- srwi r0,r0,16
- cmpwi r0,0x39
- beq 1f
- cmpwi r0,0x3c
- beq 1f
- cmpwi r0,0x44
- bnelr
-1:
-
- /* Make sure HID4:rm_ci is off before MMU is turned off, that large
- * pages are enabled with HID4:61 and clear HID5:DCBZ_size and
- * HID5:DCBZ32_ill
- */
- li r0,0
- mfspr r3,SPRN_HID4
- rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */
- rldimi r3,r0,2,61 /* clear bit 61 (lg_pg_en) */
- sync
- mtspr SPRN_HID4,r3
- isync
- sync
- mfspr r3,SPRN_HID5
- rldimi r3,r0,6,56 /* clear bits 56 & 57 (DCBZ*) */
- sync
- mtspr SPRN_HID5,r3
- isync
- sync
-
- /* Setup some basic HID1 features */
- mfspr r0,SPRN_HID1
- li r3,0x1200 /* enable i-fetch cacheability */
- sldi r3,r3,44 /* and prefetch */
- or r0,r0,r3
- mtspr SPRN_HID1,r0
- mtspr SPRN_HID1,r0
- isync
-
- /* Clear HIOR */
- li r0,0
- sync
- mtspr SPRN_HIOR,0 /* Clear interrupt prefix */
- isync
- blr
-
-_GLOBAL(__setup_cpu_ppc970)
- mfspr r0,SPRN_HID0
- li r11,5 /* clear DOZE and SLEEP */
- rldimi r0,r11,52,8 /* set NAP and DPM */
- mtspr SPRN_HID0,r0
- mfspr r0,SPRN_HID0
- mfspr r0,SPRN_HID0
- mfspr r0,SPRN_HID0
- mfspr r0,SPRN_HID0
- mfspr r0,SPRN_HID0
- mfspr r0,SPRN_HID0
- sync
- isync
- blr
-
-/* Definitions for the table use to save CPU states */
-#define CS_HID0 0
-#define CS_HID1 8
-#define CS_HID4 16
-#define CS_HID5 24
-#define CS_SIZE 32
-
- .data
- .balign L1_CACHE_BYTES,0
-cpu_state_storage:
- .space CS_SIZE
- .balign L1_CACHE_BYTES,0
- .text
-
-/* Called in normal context to backup CPU 0 state. This
- * does not include cache settings. This function is also
- * called for machine sleep. This does not include the MMU
- * setup, BATs, etc... but rather the "special" registers
- * like HID0, HID1, HID4, etc...
- */
-_GLOBAL(__save_cpu_setup)
- /* Some CR fields are volatile, we back it up all */
- mfcr r7
-
- /* Get storage ptr */
- LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
-
- /* We only deal with 970 for now */
- mfspr r0,SPRN_PVR
- srwi r0,r0,16
- cmpwi r0,0x39
- beq 1f
- cmpwi r0,0x3c
- beq 1f
- cmpwi r0,0x44
- bne 2f
-
-1: /* Save HID0,1,4 and 5 */
- mfspr r3,SPRN_HID0
- std r3,CS_HID0(r5)
- mfspr r3,SPRN_HID1
- std r3,CS_HID1(r5)
- mfspr r3,SPRN_HID4
- std r3,CS_HID4(r5)
- mfspr r3,SPRN_HID5
- std r3,CS_HID5(r5)
-
-2:
- mtcr r7
- blr
-
-/* Called with no MMU context (typically MSR:IR/DR off) to
- * restore CPU state as backed up by the previous
- * function. This does not include cache setting
- */
-_GLOBAL(__restore_cpu_setup)
- /* Get storage ptr (FIXME when using anton reloc as we
- * are running with translation disabled here
- */
- LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
-
- /* We only deal with 970 for now */
- mfspr r0,SPRN_PVR
- srwi r0,r0,16
- cmpwi r0,0x39
- beq 1f
- cmpwi r0,0x3c
- beq 1f
- cmpwi r0,0x44
- bnelr
-
-1: /* Before accessing memory, we make sure rm_ci is clear */
- li r0,0
- mfspr r3,SPRN_HID4
- rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */
- sync
- mtspr SPRN_HID4,r3
- isync
- sync
-
- /* Clear interrupt prefix */
- li r0,0
- sync
- mtspr SPRN_HIOR,0
- isync
-
- /* Restore HID0 */
- ld r3,CS_HID0(r5)
- sync
- isync
- mtspr SPRN_HID0,r3
- mfspr r3,SPRN_HID0
- mfspr r3,SPRN_HID0
- mfspr r3,SPRN_HID0
- mfspr r3,SPRN_HID0
- mfspr r3,SPRN_HID0
- mfspr r3,SPRN_HID0
- sync
- isync
-
- /* Restore HID1 */
- ld r3,CS_HID1(r5)
- sync
- isync
- mtspr SPRN_HID1,r3
- mtspr SPRN_HID1,r3
- sync
- isync
-
- /* Restore HID4 */
- ld r3,CS_HID4(r5)
- sync
- isync
- mtspr SPRN_HID4,r3
- sync
- isync
-
- /* Restore HID5 */
- ld r3,CS_HID5(r5)
- sync
- isync
- mtspr SPRN_HID5,r3
- sync
- isync
- blr
-
Index: linux-2.6/arch/powerpc/kernel/cpu_setup_ppc970.S
===================================================================
--- /dev/null
+++ linux-2.6/arch/powerpc/kernel/cpu_setup_ppc970.S
@@ -0,0 +1,175 @@
+/*
+ * This file contains low level CPU setup functions.
+ * Copyright (C) 2003 Benjamin Herrenschmidt (benh@kernel.crashing.org)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ */
+
+#include <linux/config.h>
+#include <asm/processor.h>
+#include <asm/page.h>
+#include <asm/cputable.h>
+#include <asm/ppc_asm.h>
+#include <asm/asm-offsets.h>
+#include <asm/cache.h>
+
+_GLOBAL(__cpu_preinit_ppc970)
+ /* Do nothing if not running in HV mode */
+ mfmsr r0
+ rldicl. r0,r0,4,63
+ beqlr
+
+ /* Make sure HID4:rm_ci is off before MMU is turned off, that large
+ * pages are enabled with HID4:61 and clear HID5:DCBZ_size and
+ * HID5:DCBZ32_ill
+ */
+ li r0,0
+ mfspr r3,SPRN_HID4
+ rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */
+ rldimi r3,r0,2,61 /* clear bit 61 (lg_pg_en) */
+ sync
+ mtspr SPRN_HID4,r3
+ isync
+ sync
+ mfspr r3,SPRN_HID5
+ rldimi r3,r0,6,56 /* clear bits 56 & 57 (DCBZ*) */
+ sync
+ mtspr SPRN_HID5,r3
+ isync
+ sync
+
+ /* Setup some basic HID1 features */
+ mfspr r0,SPRN_HID1
+ li r3,0x1200 /* enable i-fetch cacheability */
+ sldi r3,r3,44 /* and prefetch */
+ or r0,r0,r3
+ mtspr SPRN_HID1,r0
+ mtspr SPRN_HID1,r0
+ isync
+
+ /* Clear HIOR */
+ li r0,0
+ sync
+ mtspr SPRN_HIOR,0 /* Clear interrupt prefix */
+ isync
+ blr
+
+/* Definitions for the table use to save CPU states */
+#define CS_HID0 0
+#define CS_HID1 8
+#define CS_HID4 16
+#define CS_HID5 24
+#define CS_SIZE 32
+
+ .data
+ .balign L1_CACHE_BYTES,0
+cpu_state_storage:
+ .space CS_SIZE
+ .balign L1_CACHE_BYTES,0
+ .text
+
+
+_GLOBAL(__setup_cpu_ppc970)
+ /* Do nothing if not running in HV mode */
+ mfmsr r0
+ rldicl. r0,r0,4,63
+ beqlr
+
+ mfspr r0,SPRN_HID0
+ li r11,5 /* clear DOZE and SLEEP */
+ rldimi r0,r11,52,8 /* set NAP and DPM */
+ mtspr SPRN_HID0,r0
+ mfspr r0,SPRN_HID0
+ mfspr r0,SPRN_HID0
+ mfspr r0,SPRN_HID0
+ mfspr r0,SPRN_HID0
+ mfspr r0,SPRN_HID0
+ mfspr r0,SPRN_HID0
+ sync
+ isync
+
+ /* Save away cpu state */
+ LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
+
+ /* Save HID0,1,4 and 5 */
+ mfspr r3,SPRN_HID0
+ std r3,CS_HID0(r5)
+ mfspr r3,SPRN_HID1
+ std r3,CS_HID1(r5)
+ mfspr r3,SPRN_HID4
+ std r3,CS_HID4(r5)
+ mfspr r3,SPRN_HID5
+ std r3,CS_HID5(r5)
+
+ blr
+
+/* Called with no MMU context (typically MSR:IR/DR off) to
+ * restore CPU state as backed up by the previous
+ * function. This does not include cache setting
+ */
+_GLOBAL(__restore_cpu_ppc970)
+ /* Do nothing if not running in HV mode */
+ mfmsr r0
+ rldicl. r0,r0,4,63
+ beqlr
+
+ LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
+ /* Before accessing memory, we make sure rm_ci is clear */
+ li r0,0
+ mfspr r3,SPRN_HID4
+ rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */
+ sync
+ mtspr SPRN_HID4,r3
+ isync
+ sync
+
+ /* Clear interrupt prefix */
+ li r0,0
+ sync
+ mtspr SPRN_HIOR,0
+ isync
+
+ /* Restore HID0 */
+ ld r3,CS_HID0(r5)
+ sync
+ isync
+ mtspr SPRN_HID0,r3
+ mfspr r3,SPRN_HID0
+ mfspr r3,SPRN_HID0
+ mfspr r3,SPRN_HID0
+ mfspr r3,SPRN_HID0
+ mfspr r3,SPRN_HID0
+ mfspr r3,SPRN_HID0
+ sync
+ isync
+
+ /* Restore HID1 */
+ ld r3,CS_HID1(r5)
+ sync
+ isync
+ mtspr SPRN_HID1,r3
+ mtspr SPRN_HID1,r3
+ sync
+ isync
+
+ /* Restore HID4 */
+ ld r3,CS_HID4(r5)
+ sync
+ isync
+ mtspr SPRN_HID4,r3
+ sync
+ isync
+
+ /* Restore HID5 */
+ ld r3,CS_HID5(r5)
+ sync
+ isync
+ mtspr SPRN_HID5,r3
+ sync
+ isync
+ blr
+
Index: linux-2.6/arch/powerpc/kernel/head_64.S
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/head_64.S
+++ linux-2.6/arch/powerpc/kernel/head_64.S
@@ -152,7 +152,7 @@ _GLOBAL(__secondary_hold)
bne 100b
#if defined(CONFIG_SMP) || defined(CONFIG_KEXEC)
- LOAD_REG_IMMEDIATE(r4, .pSeries_secondary_smp_init)
+ LOAD_REG_IMMEDIATE(r4, .generic_secondary_smp_init)
mtctr r4
mr r3,r24
bctr
@@ -1473,18 +1473,25 @@ fwnmi_data_area:
. = 0x8000
/*
- * On pSeries, secondary processors spin in the following code.
+ * On pSeries and most other platforms, secondary processors spin
+ * in the following code.
* At entry, r3 = this processor's number (physical cpu id)
*/
-_GLOBAL(pSeries_secondary_smp_init)
+_GLOBAL(generic_secondary_smp_init)
mr r24,r3
/* turn on 64-bit mode */
bl .enable_64b_mode
isync
- /* Copy some CPU settings from CPU 0 */
- bl .__restore_cpu_setup
+ LOAD_REG_IMMEDIATE(r4, cur_cpu_spec)
+ ld r5, CPU_SPEC_RESTORE(r4)
+ cmpdi 0,r5,0
+ beq 1f
+ ld r5,0(r5)
+ mtctr r5
+ bctrl
+1:
/* Set up a paca value for this processor. Since we have the
* physical cpu id in r24, we need to search the pacas to find
@@ -1600,7 +1607,16 @@ _GLOBAL(__start_initialization_multiplat
bl .enable_64b_mode
/* Setup some critical 970 SPRs before switching MMU off */
- bl .__970_cpu_preinit
+ mfspr r0,SPRN_PVR
+ srwi r0,r0,16
+ cmpwi r0,0x39 /* 970 */
+ beq 1f
+ cmpwi r0,0x3c /* 970FX */
+ beq 1f
+ cmpwi r0,0x44 /* 970MP */
+ bne 2f
+1: bl .__cpu_preinit_ppc970
+2:
/* cpu # */
li r24,0
@@ -1771,7 +1787,7 @@ _GLOBAL(pmac_secondary_start)
isync
/* Copy some CPU settings from CPU 0 */
- bl .__restore_cpu_setup
+ bl .__restore_cpu_ppc970
/* pSeries do that early though I don't think we really need it */
mfmsr r3
@@ -1921,12 +1937,6 @@ _STATIC(start_here_multiplatform)
mr r5,r26
bl .identify_cpu
- /* Save some low level config HIDs of CPU0 to be copied to
- * other CPUs later on, or used for suspend/resume
- */
- bl .__save_cpu_setup
- sync
-
/* Do very early kernel initializations, including initial hash table,
* stab and slb setup before we turn on relocation. */
Index: linux-2.6/arch/powerpc/platforms/cell/smp.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/smp.c
+++ linux-2.6/arch/powerpc/platforms/cell/smp.c
@@ -58,7 +58,7 @@
*/
static cpumask_t of_spin_map;
-extern void pSeries_secondary_smp_init(unsigned long);
+extern void generic_secondary_smp_init(unsigned long);
/**
* smp_startup_cpu() - start the given cpu
@@ -75,7 +75,7 @@ static inline int __devinit smp_startup_
{
int status;
unsigned long start_here = __pa((u32)*((unsigned long *)
- pSeries_secondary_smp_init));
+ generic_secondary_smp_init));
unsigned int pcpu;
int start_cpu;
Index: linux-2.6/arch/powerpc/platforms/pseries/smp.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/pseries/smp.c
+++ linux-2.6/arch/powerpc/platforms/pseries/smp.c
@@ -63,7 +63,7 @@
*/
static cpumask_t of_spin_map;
-extern void pSeries_secondary_smp_init(unsigned long);
+extern void generic_secondary_smp_init(unsigned long);
#ifdef CONFIG_HOTPLUG_CPU
@@ -271,7 +271,7 @@ static inline int __devinit smp_startup_
{
int status;
unsigned long start_here = __pa((u32)*((unsigned long *)
- pSeries_secondary_smp_init));
+ generic_secondary_smp_init));
unsigned int pcpu;
int start_cpu;
Index: linux-2.6/arch/powerpc/kernel/asm-offsets.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/asm-offsets.c
+++ linux-2.6/arch/powerpc/kernel/asm-offsets.c
@@ -241,6 +241,7 @@ int main(void)
DEFINE(CPU_SPEC_PVR_VALUE, offsetof(struct cpu_spec, pvr_value));
DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features));
DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup));
+ DEFINE(CPU_SPEC_RESTORE, offsetof(struct cpu_spec, cpu_restore));
#ifndef CONFIG_PPC64
DEFINE(pbe_address, offsetof(struct pbe, address));
Index: linux-2.6/arch/powerpc/kernel/cputable.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/cputable.c
+++ linux-2.6/arch/powerpc/kernel/cputable.c
@@ -40,7 +40,10 @@ extern void __setup_cpu_7400(unsigned lo
extern void __setup_cpu_7410(unsigned long offset, struct cpu_spec* spec);
extern void __setup_cpu_745x(unsigned long offset, struct cpu_spec* spec);
#endif /* CONFIG_PPC32 */
+#ifdef CONFIG_PPC64
extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec);
+extern void __restore_cpu_ppc970(void);
+#endif /* CONFIG_PPC64 */
/* This table only contains "desktop" CPUs, it need to be filled with embedded
* ones as well...
@@ -185,6 +188,7 @@ struct cpu_spec cpu_specs[] = {
.dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_ppc970,
+ .cpu_restore = __restore_cpu_ppc970,
.oprofile_cpu_type = "ppc64/970",
.oprofile_type = PPC_OPROFILE_POWER4,
.platform = "ppc970",
@@ -200,6 +204,7 @@ struct cpu_spec cpu_specs[] = {
.dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_ppc970,
+ .cpu_restore = __restore_cpu_ppc970,
.oprofile_cpu_type = "ppc64/970",
.oprofile_type = PPC_OPROFILE_POWER4,
.platform = "ppc970",
@@ -215,6 +220,7 @@ struct cpu_spec cpu_specs[] = {
.dcache_bsize = 128,
.num_pmcs = 8,
.cpu_setup = __setup_cpu_ppc970,
+ .cpu_restore = __restore_cpu_ppc970,
.oprofile_cpu_type = "ppc64/970",
.oprofile_type = PPC_OPROFILE_POWER4,
.platform = "ppc970",
Index: linux-2.6/include/asm-powerpc/cputable.h
===================================================================
--- linux-2.6.orig/include/asm-powerpc/cputable.h
+++ linux-2.6/include/asm-powerpc/cputable.h
@@ -65,6 +65,8 @@ struct cpu_spec {
* BHT, SPD, etc... from head.S before branching to identify_machine
*/
cpu_setup_t cpu_setup;
+ /* Used to restore cpu setup on secondary processors and at resume */
+ void (*cpu_restore)(void);
/* Used by oprofile userspace to select the right counters */
char *oprofile_cpu_type;
^ permalink raw reply
* Re: [PATCH] powerpc: support ibm,extended-*-frequency properties
From: Kumar Gala @ 2006-06-28 4:48 UTC (permalink / raw)
To: Anton Blanchard; +Cc: linuxppc-dev, paulus
In-Reply-To: <20060620084726.GC30974@krispykreme>
On Jun 20, 2006, at 3:47 AM, Anton Blanchard wrote:
>
> Support the ibm,extended-*-frequency properties found in recent POWER5
> firmware:
>
> cpus/PowerPC,POWER5@0/clock-frequency
> 59aa5880 (1504336000)
> cpus/PowerPC,POWER5@0/ibm,extended-clock-frequency
> 00000000 59aa5880
> cpus/PowerPC,POWER5@0/timebase-frequency
> 0b354b10 (188042000)
> cpus/PowerPC,POWER5@0/ibm,extended-timebase-frequency
> 00000000 0b354b10
>
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
>
> Index: build/arch/powerpc/kernel/time.c
> ===================================================================
> --- build.orig/arch/powerpc/kernel/time.c 2006-06-20
> 11:55:34.000000000 +1000
> +++ build/arch/powerpc/kernel/time.c 2006-06-20 18:25:35.000000000
> +1000
> @@ -857,42 +857,50 @@ int do_settimeofday(struct timespec *tv)
>
> EXPORT_SYMBOL(do_settimeofday);
>
> -void __init generic_calibrate_decr(void)
> +static int __init get_freq(char *name, int cells, unsigned long *val)
> {
> struct device_node *cpu;
> unsigned int *fp;
> - int node_found;
> + int found = 0;
>
> - /*
> - * The cpu node should have a timebase-frequency property
> - * to tell us the rate at which the decrementer counts.
> - */
> + /* The cpu node should have timebase and clock frequency
> properties */
> cpu = of_find_node_by_type(NULL, "cpu");
>
> - ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */
> - node_found = 0;
> if (cpu) {
> - fp = (unsigned int *)get_property(cpu, "timebase-frequency",
> - NULL);
> + fp = (unsigned int *)get_property(cpu, name, NULL);
> if (fp) {
> - node_found = 1;
> - ppc_tb_freq = *fp;
> + found = 1;
> + *val = 0;
> + while (cells--)
> + *val = (*val << 32) | *fp++;
Is it reasonable for cells to be greater than 1 on a 32-bit system?
If not, ok to protect this with a CONFIG_PPC64
> }
> +
> + of_node_put(cpu);
> }
> - if (!node_found)
> +
> + return found;
> +}
> +
> +void __init generic_calibrate_decr(void)
> +{
> + ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */
> +
> + if (!get_freq("ibm,extended-timebase-frequency", 2, &ppc_tb_freq) &&
> + !get_freq("timebase-frequency", 1, &ppc_tb_freq)) {
> +
> printk(KERN_ERR "WARNING: Estimating decrementer frequency "
> "(not found)\n");
> + }
>
> - ppc_proc_freq = DEFAULT_PROC_FREQ;
> - node_found = 0;
> - if (cpu) {
> - fp = (unsigned int *)get_property(cpu, "clock-frequency",
> - NULL);
> - if (fp) {
> - node_found = 1;
> - ppc_proc_freq = *fp;
> - }
> + ppc_proc_freq = DEFAULT_PROC_FREQ; /* hardcoded default */
> +
> + if (!get_freq("ibm,extended-clock-frequency", 2, &ppc_proc_freq) &&
> + !get_freq("clock-frequency", 1, &ppc_proc_freq)) {
> +
> + printk(KERN_ERR "WARNING: Estimating processor frequency "
> + "(not found)\n");
> }
> +
> #ifdef CONFIG_BOOKE
> /* Set the time base to zero */
> mtspr(SPRN_TBWL, 0);
> @@ -904,11 +912,6 @@ void __init generic_calibrate_decr(void)
> /* Enable decrementer interrupt */
> mtspr(SPRN_TCR, TCR_DIE);
> #endif
> - if (!node_found)
> - printk(KERN_ERR "WARNING: Estimating processor frequency "
> - "(not found)\n");
> -
> - of_node_put(cpu);
> }
>
> unsigned long get_boot_time(void)
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
^ permalink raw reply
* RE: MPC8548 PCIe / PCI support with BSP MPC8548CDS 02/24/2006
From: Zhang Wei-r63237 @ 2006-06-28 5:27 UTC (permalink / raw)
To: Florian Boelstler, linuxppc-embedded
> We did the hardware fix described in the BSP user's manual to
> make PCIe work (according to the manual section 2.1, step 3).
> I.e.
> 1) removed R193 and R194 on the carrier card (rev 1.2)
> 2) removed RN1 on the CPU daughter card
> 2a) connected pad3 of RN1 to pin3 of U12 (IRQ0)
> 2b) connected pad2 of RN1 to pin4 of U12 (IRQ1)
>
> Does this fix the interrupt polarity problem (as well)?
Yes, I think so. You can plug a PCIe ethernet card to test it.
>
> We applied the provided kernel patch as well.
> IMHO that patch just moves the local PCIe root-complex
> "out-of-space" so no detection of that one occurs any more.
> This is what actually happens when "lspci" is run.
>
> However we still don't see any devices behind the PCIe switch
> (e.g. a transparent PLX8516). It seems that the enumeration
> process (traversing through the bus hierarchy) in the kernel
> is somehow disabled.
:-), Maybe it's need more study. Could you enable the DEBUG and post the kernel verbose message?
> Bottom line: Only one device accessible at all on the PCIe port.
>
> Any further ideas?
>
> Thanks,
>
> Florian
>
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>
^ permalink raw reply
* patches applied to powerpc.git
From: Paul Mackerras @ 2006-06-28 5:35 UTC (permalink / raw)
To: linuxppc-dev
The following patches have just been pushed to the powerpc.git
repository ("master" branch). I'll ask Linus to pull them tomorrow
unless I hear any objections. If you have patches that you want
upstream that aren't listed, bug me or the appropriate platform
maintainer about them.
Paul.
arch/powerpc/Kconfig | 8 +
arch/powerpc/Kconfig.debug | 9 +
arch/powerpc/configs/cell_defconfig | 7 +
arch/powerpc/kernel/Makefile | 3
arch/powerpc/kernel/cpu_setup_power4.S | 14 ++
arch/powerpc/kernel/crash.c | 147 +++++++++++++++---
arch/powerpc/kernel/head_64.S | 51 ++----
arch/powerpc/kernel/iommu.c | 30 ++++
arch/powerpc/kernel/machine_kexec_64.c | 4 -
arch/powerpc/kernel/misc.S | 203 +++++++++++++++++++++++++
arch/powerpc/kernel/misc_32.S | 156 --------------------
arch/powerpc/kernel/misc_64.S | 223 +---------------------------
arch/powerpc/kernel/paca.c | 1
arch/powerpc/kernel/prom.c | 48 ++++--
arch/powerpc/kernel/rtas.c | 119 +++++++++++++--
arch/powerpc/kernel/setup_64.c | 19 +-
arch/powerpc/kernel/traps.c | 27 ++-
arch/powerpc/kernel/udbg.c | 7 +
arch/powerpc/mm/hash_native_64.c | 3
arch/powerpc/mm/hash_utils_64.c | 106 +++++--------
arch/powerpc/platforms/86xx/Kconfig | 6 -
arch/powerpc/platforms/86xx/Makefile | 3
arch/powerpc/platforms/86xx/mpc8641_hpcn.h | 1
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 1
arch/powerpc/platforms/86xx/mpc86xx_smp.c | 1
arch/powerpc/platforms/86xx/pci.c | 1
arch/powerpc/platforms/cell/Kconfig | 2
arch/powerpc/platforms/cell/setup.c | 16 +-
arch/powerpc/platforms/cell/spu_base.c | 8 +
arch/powerpc/platforms/cell/spufs/file.c | 10 +
arch/powerpc/platforms/cell/spufs/switch.c | 6 +
arch/powerpc/platforms/iseries/htab.c | 4 -
arch/powerpc/platforms/iseries/lpevents.c | 55 ++++---
arch/powerpc/platforms/iseries/proc.c | 1
arch/powerpc/platforms/iseries/setup.c | 19 --
arch/powerpc/platforms/maple/setup.c | 7 -
arch/powerpc/platforms/powermac/setup.c | 9 -
arch/powerpc/platforms/pseries/iommu.c | 33 ++++
arch/powerpc/platforms/pseries/lpar.c | 4 -
arch/powerpc/platforms/pseries/setup.c | 10 +
drivers/ide/Kconfig | 9 +
drivers/ide/ppc/pmac.c | 125 ----------------
drivers/macintosh/Kconfig | 12 ++
drivers/macintosh/Makefile | 1
drivers/macintosh/via-pmu-led.c | 144 ++++++++++++++++++
include/asm-powerpc/cputable.h | 48 +++---
include/asm-powerpc/iseries/it_lp_queue.h | 40 +++--
include/asm-powerpc/kdump.h | 2
include/asm-powerpc/kexec.h | 9 +
include/asm-powerpc/machdep.h | 2
include/asm-powerpc/mmu.h | 1
include/asm-powerpc/mpc86xx.h | 1
include/asm-powerpc/rtas.h | 3
include/asm-powerpc/time.h | 6 +
include/asm-powerpc/udbg.h | 3
kernel/kexec.c | 6 -
56 files changed, 936 insertions(+), 858 deletions(-)
create mode 100644 arch/powerpc/kernel/misc.S
create mode 100644 drivers/macintosh/via-pmu-led.c
Andrew Morton:
[POWERPC] powerpc: kconfig warning fix
Arnd Bergmann:
[POWERPC] spufs: fix class0 interrupt assignment
Benjamin Herrenschmidt:
[POWERPC] spufs: map mmio space as guarded into user space
[POWERPC] spufs: fix MFC command queue purge
David Wilder:
[POWERPC] Add the use of the firmware soft-reset-nmi to kdump.
Geoff Levand:
[POWERPC] spufs: fix memory hotplug dependency
Haren Myneni:
[POWERPC] kdump: Reserve the existing TCE mappings left by the first kernel
Jimi Xenidis:
[POWERPC] Don't access HID registers if running on a Hypervisor.
[POWERPC] Skip the "copy down" of the kernel if it is already at zero.
Johannes Berg:
[POWERPC] Convert powermac ide blink to new led infrastructure
Jon Loeliger:
[POWERPC] Remove redundant PPC_86XX check.
[POWERPC] Move I8259 selection under MPC8641HPCN board
[POWERPC] Remove redundant STD_MMU selection.
[POWERPC] Remove obsolete #include <linux/config.h>.
Michael Ellerman:
[POWERPC] Remove remaining iSeries debugger cruft
[POWERPC] Export flat device tree via debugfs for debugging
[POWERPC] powerpc: Initialise ppc_md htab pointers earlier
[POWERPC] Use ppc_md.hpte_insert() in htab_bolt_mapping()
[POWERPC] Make kexec_setup() a regular initcall
[POWERPC] Setup the boot cpu's paca pointer in C rather than asm
[POWERPC] Make rtas_call() safe if RTAS hasn't been initialised
[POWERPC] Move RTAS exports next to their declarations
[POWERPC] Setup RTAS values earlier, to enable rtas_call() earlier
[POWERPC] Add udbg support for RTAS console
[POWERPC] Enable the RTAS udbg console on IBM Cell Blade
[POWERPC] Enable XMON in cell_defconfig
Paul Mackerras:
[POWERPC] Simplify the code defining the 64-bit CPU features
[POWERPC] Make sure we select CONFIG_NEW_LEDS if ADB_PMU_LED is set
Stephen Rothwell:
[POWERPC] Clean up it_lp_queue.h
[POWERPC] update asm-powerpc/time.h
[POWERPC] Remove unused function call_with_mmu_off
[POWERPC] Consolidate some of kernel/misc*.S
^ permalink raw reply
* Please pull from 'for_paulus' branch of powerpc
From: Kumar Gala @ 2006-06-28 6:01 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, linux-kernel
Please pull from 'for_paulus' branch of
master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git
to receive the following updates:
arch/powerpc/kernel/cputable.c | 12 --
arch/powerpc/platforms/86xx/mpc86xx.h | 8 +
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 128 +++++++++++++++++++++++++--
arch/powerpc/platforms/86xx/mpc86xx_smp.c | 9 -
arch/powerpc/platforms/86xx/pci.c | 136 +----------------------------
include/asm-powerpc/mpc86xx.h | 4
6 files changed, 138 insertions(+), 159 deletions(-)
Kumar Gala:
powerpc: minor cleanups for mpc86xx
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 1c11488..abf7d42 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -722,18 +722,6 @@ #if CLASSIC_PPC
.oprofile_type = PPC_OPROFILE_G4,
.platform = "ppc7450",
},
- { /* 8641 */
- .pvr_mask = 0xffffffff,
- .pvr_value = 0x80040010,
- .cpu_name = "8641",
- .cpu_features = CPU_FTRS_7447A,
- .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP,
- .icache_bsize = 32,
- .dcache_bsize = 32,
- .num_pmcs = 6,
- .cpu_setup = __setup_cpu_745x
- },
-
{ /* 82xx (8240, 8245, 8260 are all 603e cores) */
.pvr_mask = 0x7fff0000,
.pvr_value = 0x00810000,
diff --git a/arch/powerpc/platforms/86xx/mpc86xx.h b/arch/powerpc/platforms/86xx/mpc86xx.h
index e3c9e4f..2834462 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx.h
+++ b/arch/powerpc/platforms/86xx/mpc86xx.h
@@ -15,11 +15,13 @@ #define __MPC86XX_H__
* mpc86xx_* files. Mostly for use by mpc86xx_setup().
*/
-extern int __init add_bridge(struct device_node *dev);
+extern int add_bridge(struct device_node *dev);
-extern void __init setup_indirect_pcie(struct pci_controller *hose,
+extern int mpc86xx_exclude_device(u_char bus, u_char devfn);
+
+extern void setup_indirect_pcie(struct pci_controller *hose,
u32 cfg_addr, u32 cfg_data);
-extern void __init setup_indirect_pcie_nomap(struct pci_controller *hose,
+extern void setup_indirect_pcie_nomap(struct pci_controller *hose,
void __iomem *cfg_addr,
void __iomem *cfg_data);
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 483c21d..ac7f418 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -36,6 +36,7 @@ #include <asm/mpic.h>
#include <sysdev/fsl_soc.h>
#include "mpc86xx.h"
+#include "mpc8641_hpcn.h"
#ifndef CONFIG_PCI
unsigned long isa_io_base = 0;
@@ -186,17 +187,130 @@ mpc86xx_map_irq(struct pci_dev *dev, uns
return PCI_IRQ_TABLE_LOOKUP + I8259_OFFSET;
}
+static void __devinit quirk_ali1575(struct pci_dev *dev)
+{
+ unsigned short temp;
+
+ /*
+ * ALI1575 interrupts route table setup:
+ *
+ * IRQ pin IRQ#
+ * PIRQA ---- 3
+ * PIRQB ---- 4
+ * PIRQC ---- 5
+ * PIRQD ---- 6
+ * PIRQE ---- 9
+ * PIRQF ---- 10
+ * PIRQG ---- 11
+ * PIRQH ---- 12
+ *
+ * interrupts for PCI slot0 -- PIRQA / PIRQB / PIRQC / PIRQD
+ * PCI slot1 -- PIRQB / PIRQC / PIRQD / PIRQA
+ */
+ pci_write_config_dword(dev, 0x48, 0xb9317542);
+
+ /* USB 1.1 OHCI controller 1, interrupt: PIRQE */
+ pci_write_config_byte(dev, 0x86, 0x0c);
+
+ /* USB 1.1 OHCI controller 2, interrupt: PIRQF */
+ pci_write_config_byte(dev, 0x87, 0x0d);
+
+ /* USB 1.1 OHCI controller 3, interrupt: PIRQH */
+ pci_write_config_byte(dev, 0x88, 0x0f);
+
+ /* USB 2.0 controller, interrupt: PIRQ7 */
+ pci_write_config_byte(dev, 0x74, 0x06);
+
+ /* Audio controller, interrupt: PIRQE */
+ pci_write_config_byte(dev, 0x8a, 0x0c);
+
+ /* Modem controller, interrupt: PIRQF */
+ pci_write_config_byte(dev, 0x8b, 0x0d);
+
+ /* HD audio controller, interrupt: PIRQG */
+ pci_write_config_byte(dev, 0x8c, 0x0e);
+
+ /* Serial ATA interrupt: PIRQD */
+ pci_write_config_byte(dev, 0x8d, 0x0b);
+
+ /* SMB interrupt: PIRQH */
+ pci_write_config_byte(dev, 0x8e, 0x0f);
+
+ /* PMU ACPI SCI interrupt: PIRQH */
+ pci_write_config_byte(dev, 0x8f, 0x0f);
+
+ /* Primary PATA IDE IRQ: 14
+ * Secondary PATA IDE IRQ: 15
+ */
+ pci_write_config_byte(dev, 0x44, 0x3d);
+ pci_write_config_byte(dev, 0x75, 0x0f);
+
+ /* Set IRQ14 and IRQ15 to legacy IRQs */
+ pci_read_config_word(dev, 0x46, &temp);
+ temp |= 0xc000;
+ pci_write_config_word(dev, 0x46, temp);
+
+ /* Set i8259 interrupt trigger
+ * IRQ 3: Level
+ * IRQ 4: Level
+ * IRQ 5: Level
+ * IRQ 6: Level
+ * IRQ 7: Level
+ * IRQ 9: Level
+ * IRQ 10: Level
+ * IRQ 11: Level
+ * IRQ 12: Level
+ * IRQ 14: Edge
+ * IRQ 15: Edge
+ */
+ outb(0xfa, 0x4d0);
+ outb(0x1e, 0x4d1);
+}
-int
-mpc86xx_exclude_device(u_char bus, u_char devfn)
+static void __devinit quirk_uli5288(struct pci_dev *dev)
{
-#if !defined(CONFIG_PCI)
- if (bus == 0 && PCI_SLOT(devfn) == 0)
- return PCIBIOS_DEVICE_NOT_FOUND;
-#endif
+ unsigned char c;
+
+ pci_read_config_byte(dev,0x83,&c);
+ c |= 0x80;
+ pci_write_config_byte(dev, 0x83, c);
+
+ pci_write_config_byte(dev, 0x09, 0x01);
+ pci_write_config_byte(dev, 0x0a, 0x06);
+
+ pci_read_config_byte(dev,0x83,&c);
+ c &= 0x7f;
+ pci_write_config_byte(dev, 0x83, c);
- return PCIBIOS_SUCCESSFUL;
+ pci_read_config_byte(dev,0x84,&c);
+ c |= 0x01;
+ pci_write_config_byte(dev, 0x84, c);
}
+
+static void __devinit quirk_uli5229(struct pci_dev *dev)
+{
+ unsigned short temp;
+ pci_write_config_word(dev, 0x04, 0x0405);
+ pci_read_config_word(dev, 0x4a, &temp);
+ temp |= 0x1000;
+ pci_write_config_word(dev, 0x4a, temp);
+}
+
+static void __devinit early_uli5249(struct pci_dev *dev)
+{
+ unsigned char temp;
+ pci_write_config_word(dev, 0x04, 0x0007);
+ pci_read_config_byte(dev, 0x7c, &temp);
+ pci_write_config_byte(dev, 0x7c, 0x80);
+ pci_write_config_byte(dev, 0x09, 0x01);
+ pci_write_config_byte(dev, 0x7c, temp);
+ dev->class |= 0x1;
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, quirk_ali1575);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, 0x5249, early_uli5249);
#endif /* CONFIG_PCI */
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_smp.c b/arch/powerpc/platforms/86xx/mpc86xx_smp.c
index 944ec4b..9cca3d1 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_smp.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_smp.c
@@ -34,8 +34,8 @@ extern unsigned long __secondary_hold_ac
static void __init
smp_86xx_release_core(int nr)
{
- void *mcm_vaddr;
- unsigned long vaddr, pcr;
+ __be32 __iomem *mcm_vaddr;
+ unsigned long pcr;
if (nr < 0 || nr >= NR_CPUS)
return;
@@ -45,10 +45,9 @@ smp_86xx_release_core(int nr)
*/
mcm_vaddr = ioremap(get_immrbase() + MPC86xx_MCM_OFFSET,
MPC86xx_MCM_SIZE);
- vaddr = (unsigned long)mcm_vaddr + MCM_PORT_CONFIG_OFFSET;
- pcr = in_be32((volatile unsigned *)vaddr);
+ pcr = in_be32(mcm_vaddr + (MCM_PORT_CONFIG_OFFSET >> 2));
pcr |= 1 << (nr + 24);
- out_be32((volatile unsigned *)vaddr, pcr);
+ out_be32(mcm_vaddr + (MCM_PORT_CONFIG_OFFSET >> 2), pcr);
}
diff --git a/arch/powerpc/platforms/86xx/pci.c b/arch/powerpc/platforms/86xx/pci.c
index 5180df7..0d8b340 100644
--- a/arch/powerpc/platforms/86xx/pci.c
+++ b/arch/powerpc/platforms/86xx/pci.c
@@ -122,15 +122,12 @@ static void __init setup_pcie_atmu(struc
static void __init
mpc86xx_setup_pcie(struct pci_controller *hose, u32 pcie_offset, u32 pcie_size)
{
- volatile struct ccsr_pex *pcie;
u16 cmd;
unsigned int temps;
DBG("PCIE host controller register offset 0x%08x, size 0x%08x.\n",
pcie_offset, pcie_size);
- pcie = ioremap(pcie_offset, pcie_size);
-
early_read_config_word(hose, 0, 0, PCI_COMMAND, &cmd);
cmd |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY
| PCI_COMMAND_IO;
@@ -144,6 +141,14 @@ mpc86xx_setup_pcie(struct pci_controller
early_write_config_dword(hose, 0, 0, PCI_PRIMARY_BUS, temps);
}
+int mpc86xx_exclude_device(u_char bus, u_char devfn)
+{
+ if (bus == 0 && PCI_SLOT(devfn) == 0)
+ return PCIBIOS_DEVICE_NOT_FOUND;
+
+ return PCIBIOS_SUCCESSFUL;
+}
+
int __init add_bridge(struct device_node *dev)
{
int len;
@@ -198,128 +203,3 @@ int __init add_bridge(struct device_node
return 0;
}
-
-static void __devinit quirk_ali1575(struct pci_dev *dev)
-{
- unsigned short temp;
-
- /*
- * ALI1575 interrupts route table setup:
- *
- * IRQ pin IRQ#
- * PIRQA ---- 3
- * PIRQB ---- 4
- * PIRQC ---- 5
- * PIRQD ---- 6
- * PIRQE ---- 9
- * PIRQF ---- 10
- * PIRQG ---- 11
- * PIRQH ---- 12
- *
- * interrupts for PCI slot0 -- PIRQA / PIRQB / PIRQC / PIRQD
- * PCI slot1 -- PIRQB / PIRQC / PIRQD / PIRQA
- */
- pci_write_config_dword(dev, 0x48, 0xb9317542);
-
- /* USB 1.1 OHCI controller 1, interrupt: PIRQE */
- pci_write_config_byte(dev, 0x86, 0x0c);
-
- /* USB 1.1 OHCI controller 2, interrupt: PIRQF */
- pci_write_config_byte(dev, 0x87, 0x0d);
-
- /* USB 1.1 OHCI controller 3, interrupt: PIRQH */
- pci_write_config_byte(dev, 0x88, 0x0f);
-
- /* USB 2.0 controller, interrupt: PIRQ7 */
- pci_write_config_byte(dev, 0x74, 0x06);
-
- /* Audio controller, interrupt: PIRQE */
- pci_write_config_byte(dev, 0x8a, 0x0c);
-
- /* Modem controller, interrupt: PIRQF */
- pci_write_config_byte(dev, 0x8b, 0x0d);
-
- /* HD audio controller, interrupt: PIRQG */
- pci_write_config_byte(dev, 0x8c, 0x0e);
-
- /* Serial ATA interrupt: PIRQD */
- pci_write_config_byte(dev, 0x8d, 0x0b);
-
- /* SMB interrupt: PIRQH */
- pci_write_config_byte(dev, 0x8e, 0x0f);
-
- /* PMU ACPI SCI interrupt: PIRQH */
- pci_write_config_byte(dev, 0x8f, 0x0f);
-
- /* Primary PATA IDE IRQ: 14
- * Secondary PATA IDE IRQ: 15
- */
- pci_write_config_byte(dev, 0x44, 0x3d);
- pci_write_config_byte(dev, 0x75, 0x0f);
-
- /* Set IRQ14 and IRQ15 to legacy IRQs */
- pci_read_config_word(dev, 0x46, &temp);
- temp |= 0xc000;
- pci_write_config_word(dev, 0x46, temp);
-
- /* Set i8259 interrupt trigger
- * IRQ 3: Level
- * IRQ 4: Level
- * IRQ 5: Level
- * IRQ 6: Level
- * IRQ 7: Level
- * IRQ 9: Level
- * IRQ 10: Level
- * IRQ 11: Level
- * IRQ 12: Level
- * IRQ 14: Edge
- * IRQ 15: Edge
- */
- outb(0xfa, 0x4d0);
- outb(0x1e, 0x4d1);
-}
-
-static void __devinit quirk_uli5288(struct pci_dev *dev)
-{
- unsigned char c;
-
- pci_read_config_byte(dev,0x83,&c);
- c |= 0x80;
- pci_write_config_byte(dev, 0x83, c);
-
- pci_write_config_byte(dev, 0x09, 0x01);
- pci_write_config_byte(dev, 0x0a, 0x06);
-
- pci_read_config_byte(dev,0x83,&c);
- c &= 0x7f;
- pci_write_config_byte(dev, 0x83, c);
-
- pci_read_config_byte(dev,0x84,&c);
- c |= 0x01;
- pci_write_config_byte(dev, 0x84, c);
-}
-
-static void __devinit quirk_uli5229(struct pci_dev *dev)
-{
- unsigned short temp;
- pci_write_config_word(dev, 0x04, 0x0405);
- pci_read_config_word(dev, 0x4a, &temp);
- temp |= 0x1000;
- pci_write_config_word(dev, 0x4a, temp);
-}
-
-static void __devinit early_uli5249(struct pci_dev *dev)
-{
- unsigned char temp;
- pci_write_config_word(dev, 0x04, 0x0007);
- pci_read_config_byte(dev, 0x7c, &temp);
- pci_write_config_byte(dev, 0x7c, 0x80);
- pci_write_config_byte(dev, 0x09, 0x01);
- pci_write_config_byte(dev, 0x7c, temp);
- dev->class |= 0x1;
-}
-
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, quirk_ali1575);
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
-DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, 0x5249, early_uli5249);
diff --git a/include/asm-powerpc/mpc86xx.h b/include/asm-powerpc/mpc86xx.h
index d0a6718..00d72a7 100644
--- a/include/asm-powerpc/mpc86xx.h
+++ b/include/asm-powerpc/mpc86xx.h
@@ -20,10 +20,6 @@ #include <asm/mmu.h>
#ifdef CONFIG_PPC_86xx
-#ifdef CONFIG_MPC8641_HPCN
-#include <platforms/86xx/mpc8641_hpcn.h>
-#endif
-
#define _IO_BASE isa_io_base
#define _ISA_MEM_BASE isa_mem_base
#ifdef CONFIG_PCI
^ permalink raw reply related
* Re: [PATCH] Make lparcfg.c work when both iseries and pseries are selected
From: Stephen Rothwell @ 2006-06-28 6:19 UTC (permalink / raw)
To: Nathan Lynch; +Cc: linuxppc-dev, paulus
In-Reply-To: <20060628040539.GW16029@localdomain>
Hi Nathan,
On Tue, 27 Jun 2006 23:05:40 -0500 Nathan Lynch <ntl@pobox.com> wrote:
>
> Stephen Rothwell wrote:
> > static ssize_t lparcfg_write(struct file *file, const char __user * buf,
> > size_t count, loff_t * off)
> > {
> > + ssize_t retval = -ENOMEM;
> > +#ifdef CONFIG_PPC_PSERIES
.
.
.
> > +#endif /* CONFIG_PPC_PSERIES */
> > return retval;
> > }
>
> Erm... this is kind of gross, and will return -ENOMEM on iSeries when
> it should really return -ENOSYS (I think).
lparcfg_write will never be called on iSeries. The function just needs to
exist to satisfy a conditional reference further down.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
^ permalink raw reply
* RE: Please pull from 'for_paulus' branch of powerpc
From: Zhang Wei-r63237 @ 2006-06-28 6:26 UTC (permalink / raw)
To: Kumar Gala, Paul Mackerras; +Cc: linuxppc-dev, linux-kernel
Hi, Kumar,
Why moving these codes from pci.c to mpc86xx_hpcn.c? It's not must be.
These functions relate to PCI device of MPC8641D HPCn platform.
And we can also see the 'DECLARE_PCI_FIXUP_HEADER()' declaration in pci.c of Powermac platform.
Best Regards,
Zhang Wei
> -----Original Message-----
> From: linuxppc-dev-bounces+wei.zhang=freescale.com@ozlabs.org
> [mailto:linuxppc-dev-bounces+wei.zhang=freescale.com@ozlabs.or
> g] On Behalf Of Kumar Gala
> Sent: Wednesday, June 28, 2006 2:01 PM
> To: Paul Mackerras
> Cc: linuxppc-dev@ozlabs.org; linux-kernel@vger.kernel.org
> Subject: Please pull from 'for_paulus' branch of powerpc
>
> Please pull from 'for_paulus' branch of
> master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git
>
> to receive the following updates:
>
> arch/powerpc/kernel/cputable.c | 12 --
> arch/powerpc/platforms/86xx/mpc86xx.h | 8 +
> arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 128
> +++++++++++++++++++++++++--
> arch/powerpc/platforms/86xx/mpc86xx_smp.c | 9 -
> arch/powerpc/platforms/86xx/pci.c | 136
> +----------------------------
> include/asm-powerpc/mpc86xx.h | 4
> 6 files changed, 138 insertions(+), 159 deletions(-)
>
> Kumar Gala:
> powerpc: minor cleanups for mpc86xx
>
> diff --git a/arch/powerpc/kernel/cputable.c
> b/arch/powerpc/kernel/cputable.c index 1c11488..abf7d42 100644
> --- a/arch/powerpc/kernel/cputable.c
> +++ b/arch/powerpc/kernel/cputable.c
> @@ -722,18 +722,6 @@ #if CLASSIC_PPC
> .oprofile_type = PPC_OPROFILE_G4,
> .platform = "ppc7450",
> },
> - { /* 8641 */
> - .pvr_mask = 0xffffffff,
> - .pvr_value = 0x80040010,
> - .cpu_name = "8641",
> - .cpu_features = CPU_FTRS_7447A,
> - .cpu_user_features = COMMON_USER |
> PPC_FEATURE_HAS_ALTIVEC_COMP,
> - .icache_bsize = 32,
> - .dcache_bsize = 32,
> - .num_pmcs = 6,
> - .cpu_setup = __setup_cpu_745x
> - },
> -
> { /* 82xx (8240, 8245, 8260 are all 603e cores) */
> .pvr_mask = 0x7fff0000,
> .pvr_value = 0x00810000,
> diff --git a/arch/powerpc/platforms/86xx/mpc86xx.h
> b/arch/powerpc/platforms/86xx/mpc86xx.h
> index e3c9e4f..2834462 100644
> --- a/arch/powerpc/platforms/86xx/mpc86xx.h
> +++ b/arch/powerpc/platforms/86xx/mpc86xx.h
> @@ -15,11 +15,13 @@ #define __MPC86XX_H__
> * mpc86xx_* files. Mostly for use by mpc86xx_setup().
> */
>
> -extern int __init add_bridge(struct device_node *dev);
> +extern int add_bridge(struct device_node *dev);
>
> -extern void __init setup_indirect_pcie(struct pci_controller *hose,
> +extern int mpc86xx_exclude_device(u_char bus, u_char devfn);
> +
> +extern void setup_indirect_pcie(struct pci_controller *hose,
> u32 cfg_addr, u32
> cfg_data); -extern void __init
> setup_indirect_pcie_nomap(struct pci_controller *hose,
> +extern void setup_indirect_pcie_nomap(struct pci_controller *hose,
> void __iomem *cfg_addr,
> void __iomem *cfg_data);
>
> diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
> b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
> index 483c21d..ac7f418 100644
> --- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
> +++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
> @@ -36,6 +36,7 @@ #include <asm/mpic.h>
> #include <sysdev/fsl_soc.h>
>
> #include "mpc86xx.h"
> +#include "mpc8641_hpcn.h"
>
> #ifndef CONFIG_PCI
> unsigned long isa_io_base = 0;
> @@ -186,17 +187,130 @@ mpc86xx_map_irq(struct pci_dev *dev, uns
> return PCI_IRQ_TABLE_LOOKUP + I8259_OFFSET; }
>
> +static void __devinit quirk_ali1575(struct pci_dev *dev) {
> + unsigned short temp;
> +
> + /*
> + * ALI1575 interrupts route table setup:
> + *
> + * IRQ pin IRQ#
> + * PIRQA ---- 3
> + * PIRQB ---- 4
> + * PIRQC ---- 5
> + * PIRQD ---- 6
> + * PIRQE ---- 9
> + * PIRQF ---- 10
> + * PIRQG ---- 11
> + * PIRQH ---- 12
> + *
> + * interrupts for PCI slot0 -- PIRQA / PIRQB / PIRQC / PIRQD
> + * PCI slot1 -- PIRQB / PIRQC / PIRQD / PIRQA
> + */
> + pci_write_config_dword(dev, 0x48, 0xb9317542);
> +
> + /* USB 1.1 OHCI controller 1, interrupt: PIRQE */
> + pci_write_config_byte(dev, 0x86, 0x0c);
> +
> + /* USB 1.1 OHCI controller 2, interrupt: PIRQF */
> + pci_write_config_byte(dev, 0x87, 0x0d);
> +
> + /* USB 1.1 OHCI controller 3, interrupt: PIRQH */
> + pci_write_config_byte(dev, 0x88, 0x0f);
> +
> + /* USB 2.0 controller, interrupt: PIRQ7 */
> + pci_write_config_byte(dev, 0x74, 0x06);
> +
> + /* Audio controller, interrupt: PIRQE */
> + pci_write_config_byte(dev, 0x8a, 0x0c);
> +
> + /* Modem controller, interrupt: PIRQF */
> + pci_write_config_byte(dev, 0x8b, 0x0d);
> +
> + /* HD audio controller, interrupt: PIRQG */
> + pci_write_config_byte(dev, 0x8c, 0x0e);
> +
> + /* Serial ATA interrupt: PIRQD */
> + pci_write_config_byte(dev, 0x8d, 0x0b);
> +
> + /* SMB interrupt: PIRQH */
> + pci_write_config_byte(dev, 0x8e, 0x0f);
> +
> + /* PMU ACPI SCI interrupt: PIRQH */
> + pci_write_config_byte(dev, 0x8f, 0x0f);
> +
> + /* Primary PATA IDE IRQ: 14
> + * Secondary PATA IDE IRQ: 15
> + */
> + pci_write_config_byte(dev, 0x44, 0x3d);
> + pci_write_config_byte(dev, 0x75, 0x0f);
> +
> + /* Set IRQ14 and IRQ15 to legacy IRQs */
> + pci_read_config_word(dev, 0x46, &temp);
> + temp |= 0xc000;
> + pci_write_config_word(dev, 0x46, temp);
> +
> + /* Set i8259 interrupt trigger
> + * IRQ 3: Level
> + * IRQ 4: Level
> + * IRQ 5: Level
> + * IRQ 6: Level
> + * IRQ 7: Level
> + * IRQ 9: Level
> + * IRQ 10: Level
> + * IRQ 11: Level
> + * IRQ 12: Level
> + * IRQ 14: Edge
> + * IRQ 15: Edge
> + */
> + outb(0xfa, 0x4d0);
> + outb(0x1e, 0x4d1);
> +}
>
> -int
> -mpc86xx_exclude_device(u_char bus, u_char devfn)
> +static void __devinit quirk_uli5288(struct pci_dev *dev)
> {
> -#if !defined(CONFIG_PCI)
> - if (bus == 0 && PCI_SLOT(devfn) == 0)
> - return PCIBIOS_DEVICE_NOT_FOUND;
> -#endif
> + unsigned char c;
> +
> + pci_read_config_byte(dev,0x83,&c);
> + c |= 0x80;
> + pci_write_config_byte(dev, 0x83, c);
> +
> + pci_write_config_byte(dev, 0x09, 0x01);
> + pci_write_config_byte(dev, 0x0a, 0x06);
> +
> + pci_read_config_byte(dev,0x83,&c);
> + c &= 0x7f;
> + pci_write_config_byte(dev, 0x83, c);
>
> - return PCIBIOS_SUCCESSFUL;
> + pci_read_config_byte(dev,0x84,&c);
> + c |= 0x01;
> + pci_write_config_byte(dev, 0x84, c);
> }
> +
> +static void __devinit quirk_uli5229(struct pci_dev *dev) {
> + unsigned short temp;
> + pci_write_config_word(dev, 0x04, 0x0405);
> + pci_read_config_word(dev, 0x4a, &temp);
> + temp |= 0x1000;
> + pci_write_config_word(dev, 0x4a, temp); }
> +
> +static void __devinit early_uli5249(struct pci_dev *dev) {
> + unsigned char temp;
> + pci_write_config_word(dev, 0x04, 0x0007);
> + pci_read_config_byte(dev, 0x7c, &temp);
> + pci_write_config_byte(dev, 0x7c, 0x80);
> + pci_write_config_byte(dev, 0x09, 0x01);
> + pci_write_config_byte(dev, 0x7c, temp);
> + dev->class |= 0x1;
> +}
> +
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, quirk_ali1575);
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
> +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, 0x5249, early_uli5249);
> #endif /* CONFIG_PCI */
>
>
> diff --git a/arch/powerpc/platforms/86xx/mpc86xx_smp.c
> b/arch/powerpc/platforms/86xx/mpc86xx_smp.c
> index 944ec4b..9cca3d1 100644
> --- a/arch/powerpc/platforms/86xx/mpc86xx_smp.c
> +++ b/arch/powerpc/platforms/86xx/mpc86xx_smp.c
> @@ -34,8 +34,8 @@ extern unsigned long __secondary_hold_ac
> static void __init smp_86xx_release_core(int nr) {
> - void *mcm_vaddr;
> - unsigned long vaddr, pcr;
> + __be32 __iomem *mcm_vaddr;
> + unsigned long pcr;
>
> if (nr < 0 || nr >= NR_CPUS)
> return;
> @@ -45,10 +45,9 @@ smp_86xx_release_core(int nr)
> */
> mcm_vaddr = ioremap(get_immrbase() + MPC86xx_MCM_OFFSET,
> MPC86xx_MCM_SIZE);
> - vaddr = (unsigned long)mcm_vaddr + MCM_PORT_CONFIG_OFFSET;
> - pcr = in_be32((volatile unsigned *)vaddr);
> + pcr = in_be32(mcm_vaddr + (MCM_PORT_CONFIG_OFFSET >> 2));
> pcr |= 1 << (nr + 24);
> - out_be32((volatile unsigned *)vaddr, pcr);
> + out_be32(mcm_vaddr + (MCM_PORT_CONFIG_OFFSET >> 2), pcr);
> }
>
>
> diff --git a/arch/powerpc/platforms/86xx/pci.c
> b/arch/powerpc/platforms/86xx/pci.c
> index 5180df7..0d8b340 100644
> --- a/arch/powerpc/platforms/86xx/pci.c
> +++ b/arch/powerpc/platforms/86xx/pci.c
> @@ -122,15 +122,12 @@ static void __init
> setup_pcie_atmu(struc static void __init
> mpc86xx_setup_pcie(struct pci_controller *hose, u32
> pcie_offset, u32 pcie_size) {
> - volatile struct ccsr_pex *pcie;
> u16 cmd;
> unsigned int temps;
>
> DBG("PCIE host controller register offset 0x%08x, size
> 0x%08x.\n",
> pcie_offset, pcie_size);
>
> - pcie = ioremap(pcie_offset, pcie_size);
> -
> early_read_config_word(hose, 0, 0, PCI_COMMAND, &cmd);
> cmd |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER |
> PCI_COMMAND_MEMORY
> | PCI_COMMAND_IO;
> @@ -144,6 +141,14 @@ mpc86xx_setup_pcie(struct pci_controller
> early_write_config_dword(hose, 0, 0, PCI_PRIMARY_BUS, temps); }
>
> +int mpc86xx_exclude_device(u_char bus, u_char devfn) {
> + if (bus == 0 && PCI_SLOT(devfn) == 0)
> + return PCIBIOS_DEVICE_NOT_FOUND;
> +
> + return PCIBIOS_SUCCESSFUL;
> +}
> +
> int __init add_bridge(struct device_node *dev) {
> int len;
> @@ -198,128 +203,3 @@ int __init add_bridge(struct device_node
>
> return 0;
> }
> -
> -static void __devinit quirk_ali1575(struct pci_dev *dev) -{
> - unsigned short temp;
> -
> - /*
> - * ALI1575 interrupts route table setup:
> - *
> - * IRQ pin IRQ#
> - * PIRQA ---- 3
> - * PIRQB ---- 4
> - * PIRQC ---- 5
> - * PIRQD ---- 6
> - * PIRQE ---- 9
> - * PIRQF ---- 10
> - * PIRQG ---- 11
> - * PIRQH ---- 12
> - *
> - * interrupts for PCI slot0 -- PIRQA / PIRQB / PIRQC / PIRQD
> - * PCI slot1 -- PIRQB / PIRQC / PIRQD / PIRQA
> - */
> - pci_write_config_dword(dev, 0x48, 0xb9317542);
> -
> - /* USB 1.1 OHCI controller 1, interrupt: PIRQE */
> - pci_write_config_byte(dev, 0x86, 0x0c);
> -
> - /* USB 1.1 OHCI controller 2, interrupt: PIRQF */
> - pci_write_config_byte(dev, 0x87, 0x0d);
> -
> - /* USB 1.1 OHCI controller 3, interrupt: PIRQH */
> - pci_write_config_byte(dev, 0x88, 0x0f);
> -
> - /* USB 2.0 controller, interrupt: PIRQ7 */
> - pci_write_config_byte(dev, 0x74, 0x06);
> -
> - /* Audio controller, interrupt: PIRQE */
> - pci_write_config_byte(dev, 0x8a, 0x0c);
> -
> - /* Modem controller, interrupt: PIRQF */
> - pci_write_config_byte(dev, 0x8b, 0x0d);
> -
> - /* HD audio controller, interrupt: PIRQG */
> - pci_write_config_byte(dev, 0x8c, 0x0e);
> -
> - /* Serial ATA interrupt: PIRQD */
> - pci_write_config_byte(dev, 0x8d, 0x0b);
> -
> - /* SMB interrupt: PIRQH */
> - pci_write_config_byte(dev, 0x8e, 0x0f);
> -
> - /* PMU ACPI SCI interrupt: PIRQH */
> - pci_write_config_byte(dev, 0x8f, 0x0f);
> -
> - /* Primary PATA IDE IRQ: 14
> - * Secondary PATA IDE IRQ: 15
> - */
> - pci_write_config_byte(dev, 0x44, 0x3d);
> - pci_write_config_byte(dev, 0x75, 0x0f);
> -
> - /* Set IRQ14 and IRQ15 to legacy IRQs */
> - pci_read_config_word(dev, 0x46, &temp);
> - temp |= 0xc000;
> - pci_write_config_word(dev, 0x46, temp);
> -
> - /* Set i8259 interrupt trigger
> - * IRQ 3: Level
> - * IRQ 4: Level
> - * IRQ 5: Level
> - * IRQ 6: Level
> - * IRQ 7: Level
> - * IRQ 9: Level
> - * IRQ 10: Level
> - * IRQ 11: Level
> - * IRQ 12: Level
> - * IRQ 14: Edge
> - * IRQ 15: Edge
> - */
> - outb(0xfa, 0x4d0);
> - outb(0x1e, 0x4d1);
> -}
> -
> -static void __devinit quirk_uli5288(struct pci_dev *dev) -{
> - unsigned char c;
> -
> - pci_read_config_byte(dev,0x83,&c);
> - c |= 0x80;
> - pci_write_config_byte(dev, 0x83, c);
> -
> - pci_write_config_byte(dev, 0x09, 0x01);
> - pci_write_config_byte(dev, 0x0a, 0x06);
> -
> - pci_read_config_byte(dev,0x83,&c);
> - c &= 0x7f;
> - pci_write_config_byte(dev, 0x83, c);
> -
> - pci_read_config_byte(dev,0x84,&c);
> - c |= 0x01;
> - pci_write_config_byte(dev, 0x84, c);
> -}
> -
> -static void __devinit quirk_uli5229(struct pci_dev *dev) -{
> - unsigned short temp;
> - pci_write_config_word(dev, 0x04, 0x0405);
> - pci_read_config_word(dev, 0x4a, &temp);
> - temp |= 0x1000;
> - pci_write_config_word(dev, 0x4a, temp);
> -}
> -
> -static void __devinit early_uli5249(struct pci_dev *dev) -{
> - unsigned char temp;
> - pci_write_config_word(dev, 0x04, 0x0007);
> - pci_read_config_byte(dev, 0x7c, &temp);
> - pci_write_config_byte(dev, 0x7c, 0x80);
> - pci_write_config_byte(dev, 0x09, 0x01);
> - pci_write_config_byte(dev, 0x7c, temp);
> - dev->class |= 0x1;
> -}
> -
> -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575,
> quirk_ali1575); -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL,
> 0x5288, quirk_uli5288);
> -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229,
> quirk_uli5229); -DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL,
> 0x5249, early_uli5249); diff --git
> a/include/asm-powerpc/mpc86xx.h
> b/include/asm-powerpc/mpc86xx.h index d0a6718..00d72a7 100644
> --- a/include/asm-powerpc/mpc86xx.h
> +++ b/include/asm-powerpc/mpc86xx.h
> @@ -20,10 +20,6 @@ #include <asm/mmu.h>
>
> #ifdef CONFIG_PPC_86xx
>
> -#ifdef CONFIG_MPC8641_HPCN
> -#include <platforms/86xx/mpc8641_hpcn.h> -#endif
> -
> #define _IO_BASE isa_io_base
> #define _ISA_MEM_BASE isa_mem_base
> #ifdef CONFIG_PCI
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>
^ permalink raw reply
* RE: patches applied to powerpc.git
From: Zang Roy-r61911 @ 2006-06-28 7:14 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, linux-kernel-owner
Hi, Paul
I have submitted the "v2" version for mpc7448hpc2 board support in arch/powerpc/platforms/embedded6xx.
I have not got any suggestion, since I submitted the code.
In this submission I have addressed all the issues brought up in the "v1" submission.
So could you help me merge the patches into your git tree ? If there is any comment about the code, please let me know.
Thanks a lot!
Roy
>
> The following patches have just been pushed to the
> powerpc.git repository ("master" branch). I'll ask Linus to
> pull them tomorrow unless I hear any objections. If you have
> patches that you want upstream that aren't listed, bug me or
> the appropriate platform maintainer about them.
>
> Paul.
>
> arch/powerpc/Kconfig | 8 +
> arch/powerpc/Kconfig.debug | 9 +
> arch/powerpc/configs/cell_defconfig | 7 +
> arch/powerpc/kernel/Makefile | 3
> arch/powerpc/kernel/cpu_setup_power4.S | 14 ++
> arch/powerpc/kernel/crash.c | 147 +++++++++++++++---
> arch/powerpc/kernel/head_64.S | 51 ++----
> arch/powerpc/kernel/iommu.c | 30 ++++
> arch/powerpc/kernel/machine_kexec_64.c | 4 -
> arch/powerpc/kernel/misc.S | 203
> +++++++++++++++++++++++++
> arch/powerpc/kernel/misc_32.S | 156
> --------------------
> arch/powerpc/kernel/misc_64.S | 223
> +---------------------------
> arch/powerpc/kernel/paca.c | 1
> arch/powerpc/kernel/prom.c | 48 ++++--
> arch/powerpc/kernel/rtas.c | 119 +++++++++++++--
> arch/powerpc/kernel/setup_64.c | 19 +-
> arch/powerpc/kernel/traps.c | 27 ++-
> arch/powerpc/kernel/udbg.c | 7 +
> arch/powerpc/mm/hash_native_64.c | 3
> arch/powerpc/mm/hash_utils_64.c | 106 +++++--------
> arch/powerpc/platforms/86xx/Kconfig | 6 -
> arch/powerpc/platforms/86xx/Makefile | 3
> arch/powerpc/platforms/86xx/mpc8641_hpcn.h | 1
> arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 1
> arch/powerpc/platforms/86xx/mpc86xx_smp.c | 1
> arch/powerpc/platforms/86xx/pci.c | 1
> arch/powerpc/platforms/cell/Kconfig | 2
> arch/powerpc/platforms/cell/setup.c | 16 +-
> arch/powerpc/platforms/cell/spu_base.c | 8 +
> arch/powerpc/platforms/cell/spufs/file.c | 10 +
> arch/powerpc/platforms/cell/spufs/switch.c | 6 +
> arch/powerpc/platforms/iseries/htab.c | 4 -
> arch/powerpc/platforms/iseries/lpevents.c | 55 ++++---
> arch/powerpc/platforms/iseries/proc.c | 1
> arch/powerpc/platforms/iseries/setup.c | 19 --
> arch/powerpc/platforms/maple/setup.c | 7 -
> arch/powerpc/platforms/powermac/setup.c | 9 -
> arch/powerpc/platforms/pseries/iommu.c | 33 ++++
> arch/powerpc/platforms/pseries/lpar.c | 4 -
> arch/powerpc/platforms/pseries/setup.c | 10 +
> drivers/ide/Kconfig | 9 +
> drivers/ide/ppc/pmac.c | 125 ----------------
> drivers/macintosh/Kconfig | 12 ++
> drivers/macintosh/Makefile | 1
> drivers/macintosh/via-pmu-led.c | 144 ++++++++++++++++++
> include/asm-powerpc/cputable.h | 48 +++---
> include/asm-powerpc/iseries/it_lp_queue.h | 40 +++--
> include/asm-powerpc/kdump.h | 2
> include/asm-powerpc/kexec.h | 9 +
> include/asm-powerpc/machdep.h | 2
> include/asm-powerpc/mmu.h | 1
> include/asm-powerpc/mpc86xx.h | 1
> include/asm-powerpc/rtas.h | 3
> include/asm-powerpc/time.h | 6 +
> include/asm-powerpc/udbg.h | 3
> kernel/kexec.c | 6 -
> 56 files changed, 936 insertions(+), 858 deletions(-)
> create mode 100644 arch/powerpc/kernel/misc.S create mode
> 100644 drivers/macintosh/via-pmu-led.c
>
> Andrew Morton:
> [POWERPC] powerpc: kconfig warning fix
>
> Arnd Bergmann:
> [POWERPC] spufs: fix class0 interrupt assignment
>
> Benjamin Herrenschmidt:
> [POWERPC] spufs: map mmio space as guarded into user space
> [POWERPC] spufs: fix MFC command queue purge
>
> David Wilder:
> [POWERPC] Add the use of the firmware soft-reset-nmi to kdump.
>
> Geoff Levand:
> [POWERPC] spufs: fix memory hotplug dependency
>
> Haren Myneni:
> [POWERPC] kdump: Reserve the existing TCE mappings left
> by the first kernel
>
> Jimi Xenidis:
> [POWERPC] Don't access HID registers if running on a Hypervisor.
> [POWERPC] Skip the "copy down" of the kernel if it is
> already at zero.
>
> Johannes Berg:
> [POWERPC] Convert powermac ide blink to new led infrastructure
>
> Jon Loeliger:
> [POWERPC] Remove redundant PPC_86XX check.
> [POWERPC] Move I8259 selection under MPC8641HPCN board
> [POWERPC] Remove redundant STD_MMU selection.
> [POWERPC] Remove obsolete #include <linux/config.h>.
>
> Michael Ellerman:
> [POWERPC] Remove remaining iSeries debugger cruft
> [POWERPC] Export flat device tree via debugfs for debugging
> [POWERPC] powerpc: Initialise ppc_md htab pointers earlier
> [POWERPC] Use ppc_md.hpte_insert() in htab_bolt_mapping()
> [POWERPC] Make kexec_setup() a regular initcall
> [POWERPC] Setup the boot cpu's paca pointer in C rather than asm
> [POWERPC] Make rtas_call() safe if RTAS hasn't been initialised
> [POWERPC] Move RTAS exports next to their declarations
> [POWERPC] Setup RTAS values earlier, to enable
> rtas_call() earlier
> [POWERPC] Add udbg support for RTAS console
> [POWERPC] Enable the RTAS udbg console on IBM Cell Blade
> [POWERPC] Enable XMON in cell_defconfig
>
> Paul Mackerras:
> [POWERPC] Simplify the code defining the 64-bit CPU features
> [POWERPC] Make sure we select CONFIG_NEW_LEDS if
> ADB_PMU_LED is set
>
> Stephen Rothwell:
> [POWERPC] Clean up it_lp_queue.h
> [POWERPC] update asm-powerpc/time.h
> [POWERPC] Remove unused function call_with_mmu_off
> [POWERPC] Consolidate some of kernel/misc*.S
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>
^ permalink raw reply
* Re: [PATCH] Make lparcfg.c work when both iseries and pseries are selected
From: Nathan Lynch @ 2006-06-28 7:29 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linuxppc-dev, paulus
In-Reply-To: <20060628161903.7767131f.sfr@canb.auug.org.au>
Stephen Rothwell wrote:
> Hi Nathan,
>
> On Tue, 27 Jun 2006 23:05:40 -0500 Nathan Lynch <ntl@pobox.com> wrote:
> >
> > Stephen Rothwell wrote:
> > > static ssize_t lparcfg_write(struct file *file, const char __user * buf,
> > > size_t count, loff_t * off)
> > > {
> > > + ssize_t retval = -ENOMEM;
> > > +#ifdef CONFIG_PPC_PSERIES
> .
> .
> .
> > > +#endif /* CONFIG_PPC_PSERIES */
> > > return retval;
> > > }
> >
> > Erm... this is kind of gross, and will return -ENOMEM on iSeries when
> > it should really return -ENOSYS (I think).
>
> lparcfg_write will never be called on iSeries. The function just needs to
> exist to satisfy a conditional reference further down.
Okay. Well, my earlier comment regarding readability still stands,
and I think is bolstered somewhat by this explanation ;)
^ permalink raw reply
* how to get individual patches
From: David H. Lynch Jr. @ 2006-06-28 7:49 UTC (permalink / raw)
To: linuxppc-embedded
In-Reply-To: <20060627212448.7d048b7a@White64>
The bsp I am working on works with 2.6.16.21 but fails with 2.6.17.
How can I find the individual patches that make up the transition
from 2.6.16.21 to 2.6.17 ?
I guess I can use interdiff to create single patch to go from
2.6.16.21 to 2.6.17 but I am really looking to get all the individual
patches so I can try to isolate exactly
what is giving me trouble.
--
Dave Lynch DLA Systems
Software Development: Embedded Linux
717.627.3770 dhlii@dlasys.net http://www.dlasys.net
fax: 1.253.369.9244 Cell: 1.717.587.7774
Over 25 years' experience in platforms, languages, and technologies too numerous to list.
"Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction."
Albert Einstein
^ permalink raw reply
* Re: Can anyone tell me if it is a bug of the ELDK4.0?
From: Wolfgang Denk @ 2006-06-28 7:51 UTC (permalink / raw)
To: Denny; +Cc: linuxppc-embedded
In-Reply-To: <44A1E115.000001.12247@bj163app13.163.com>
In message <44A1E115.000001.12247@bj163app13.163.com> you wrote:
>
> I failed to compile the uboot on my 440GP platform, I set the compile switch as "-m440 -mcpu=440",
Don't do this, then. The ELDK will automatically set approproate
compiler options as needed, depending on your setting of the
CROSS_COMPILE variable.
All this is documented in the manual.
Just follow the instructions.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Half of the people in the world are below average.
^ permalink raw reply
* snd-aoa issues & fixes
From: Benjamin Herrenschmidt @ 2006-06-28 8:01 UTC (permalink / raw)
To: Johannes Berg; +Cc: linuxppc-dev list
So I've been trying to fix snd-aoa for the G5s and found a few issues...
I think I got most of it right, however I don't have any sound... I hear
"clacs" when I toggle the mutes pretty much as expected and I see
interrupts counting when playing sound but there is no actual sound in
the speaker. I've verified that snd-powermac works on the same machine
(PowerMac7,3 with tas codec). I've been toying with all the controls
available in alsamixer, it didn't help. Sounds to me that there is
nothing going out of the tas... maybe some mixer control that is not
quite right, duno
- Redefinition of various FCR related bits in i2s-control. I've fixed
that in the patch and used existing definitions. However, we still have
a problem that we don't properly lock with pmac_feature for access to
these. We need to either expose new feature calls now that we are
upstream or expose the pmac_feature spinlock
- I noticed you don't call pmac_feature and don't set bits in FCR3
etc... (enabling the 18Mhz clock for example). Is that normal ? You
don't use that clock ? That's the only difference in FCR content that
I've been able to spot between snd-powermac and snd-aoa but hacking it
doesn't seem to make much difference.
- The fabric stuff needs a bit of cleanup... You seem to be fond of
defining lotsa struct's :) Even when they don't contain much :) Triggers
another problem below
- I've had a crash with built-in snd-aoa at boot... The problem is that
when built-in, there is no enforced ordering between module_init() calls
except for link order... What happens here is that soundbus is last in
the Makefile, thus we try to register soundbus devices before we
register the bus type. I fixes that in the patch both by putting
soundbus first in the Make
- If i2sbus is loaded after the codec and fabric, the codec fails to
initialize. I haven't tried to debug that one
- The dmesg output could use some cleanup :)
- The driver is trying to access non existing codecs on the i2c bus,
that's a pretty bad idea.
I think we need to change the codec probe phase dramatically:
1 - codec drivers register the i2c thingy as normal
2 - i2c kicks in, they do the current device-node and/or i2c bus name
check and register
themselves with the core. They do not try to touch the hardware at
this point
3 - fabric kicks in (or was already there). It checks the list of
codecs registered when
loaded and gets notified of new ones added. If codec matches the
layout, then codec
init is called
4 - codec init called by fabric. That is where we try to tap the
hardware. Might fail in
which case the fabric doesn't try to use the codec
(That is, there is a global list of registered codecs at the core, and a
list of "active" codecs in the fabric or bus, whatever...)
Here's my current patch:
Index: linux-snd-aoa/sound/aoa/soundbus/i2sbus/i2sbus-core.c
===================================================================
--- linux-snd-aoa.orig/sound/aoa/soundbus/i2sbus/i2sbus-core.c 2006-06-26 12:29:38.000000000 +1000
+++ linux-snd-aoa/sound/aoa/soundbus/i2sbus/i2sbus-core.c 2006-06-28 16:10:27.000000000 +1000
@@ -7,13 +7,16 @@
*/
#include <linux/module.h>
-#include <asm/macio.h>
-#include <asm/dbdma.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
+#include <linux/dma-mapping.h>
+
#include <sound/driver.h>
#include <sound/core.h>
-#include <linux/dma-mapping.h>
+
+#include <asm/macio.h>
+#include <asm/dbdma.h>
+
#include "../soundbus.h"
#include "i2sbus.h"
@@ -24,6 +27,12 @@ MODULE_DESCRIPTION("Apple Soundbus: I2S
* string that macio puts into the relevant device */
MODULE_ALIAS("of:Ni2sTi2sC");
+static int force;
+module_param(force, int, 0444);
+MODULE_PARM_DESC(force, "Force loading i2sbus even when"
+ " no layout-id property is present");
+
+
static struct of_device_id i2sbus_match[] = {
{ .name = "i2s" },
{ }
@@ -73,7 +82,7 @@ static void i2sbus_release_dev(struct de
if (i2sdev->intfregs) iounmap(i2sdev->intfregs);
if (i2sdev->out.dbdma) iounmap(i2sdev->out.dbdma);
if (i2sdev->in.dbdma) iounmap(i2sdev->in.dbdma);
- for (i=0;i<3;i++)
+ for (i = aoa_resource_i2smmio; i <= aoa_resource_rxdbdma; i++)
if (i2sdev->allocated_resource[i])
release_and_free_resource(i2sdev->allocated_resource[i]);
free_dbdma_descriptor_ring(i2sdev, &i2sdev->out.dbdma_ring);
@@ -101,10 +110,49 @@ static irqreturn_t i2sbus_bus_intr(int i
return IRQ_HANDLED;
}
-static int force;
-module_param(force, int, 0444);
-MODULE_PARM_DESC(force, "Force loading i2sbus even when"
- " no layout-id property is present");
+/*
+ * XXX FIXME: We have to test the layout_id's here to get the proper way
+ * of mapping in various registers, thanks to bugs in Apple device-trees.
+ * Ideally, that should be handled by the layout fabric but doing so would
+ * require a little bit of shuffling around
+ */
+static int i2sbus_get_and_fixup_rsrc(struct device_node *np, int index,
+ int layout, struct resource *res)
+{
+ struct device_node *parent;
+ int pindex, rc = -ENXIO;
+ u32 *reg;
+
+ /* Machines with layout 76 and 36 (K2 based) have a weird device
+ * tree what we need to special case.
+ * Normal machines just fetch the resource from the i2s-X node.
+ * Darwin further divides normal machines into old and new layouts
+ * with a subtely different code path but that doesn't seem necessary
+ * in practice, they just bloated it. In addition, even on our K2
+ * case the i2s-modem node, if we ever want to handle it, uses the
+ * normal layout
+ */
+ if (layout != 76 && layout != 36)
+ return of_address_to_resource(np, index, res);
+
+ parent = of_get_parent(np);
+ pindex = (index == aoa_resource_i2smmio) ? 0 : 1;
+ rc = of_address_to_resource(parent, pindex, res);
+ if (rc)
+ goto bail;
+ reg = (u32 *)get_property(np, "reg", NULL);
+ if (reg == NULL) {
+ rc = -ENXIO;
+ goto bail;
+ }
+ res->start += reg[index * 2];
+ res->end = res->start + reg[index * 2 + 1] - 1;
+ printk("i2sbus rsrc %d -> %lx..%lx\n", index,
+ res->start, res->end);
+ bail:
+ of_node_put(parent);
+ return rc;
+}
/* FIXME: look at device node refcounting */
static int i2sbus_add_dev(struct macio_dev *macio,
@@ -113,7 +161,8 @@ static int i2sbus_add_dev(struct macio_d
{
struct i2sbus_dev *dev;
struct device_node *child = NULL, *sound = NULL;
- int i;
+ struct resource *r;
+ int i, layout = 0;
static const char *rnames[] = { "i2sbus: %s (control)",
"i2sbus: %s (tx)",
"i2sbus: %s (rx)" };
@@ -147,8 +196,9 @@ static int i2sbus_add_dev(struct macio_d
u32 *layout_id;
layout_id = (u32*) get_property(sound, "layout-id", NULL);
if (layout_id) {
+ layout = *layout_id;
snprintf(dev->sound.modalias, 32,
- "sound-layout-%d", *layout_id);
+ "sound-layout-%d", layout);
force = 1;
}
}
@@ -180,20 +230,28 @@ static int i2sbus_add_dev(struct macio_d
for (i=0;i<3;i++) {
dev->interrupts[i] = -1;
- snprintf(dev->rnames[i], sizeof(dev->rnames[i]), rnames[i], np->name);
+ snprintf(dev->rnames[i], sizeof(dev->rnames[i]), rnames[i],
+ np->name);
}
for (i=0;i<3;i++) {
- if (request_irq(np->intrs[i].line, ints[i], 0, dev->rnames[i], dev))
+ if (request_irq(np->intrs[i].line, ints[i], 0, dev->rnames[i],
+ dev))
goto err;
dev->interrupts[i] = np->intrs[i].line;
}
- for (i=0;i<3;i++) {
- if (of_address_to_resource(np, i, &dev->resources[i]))
+ /* Resource handling is problematic as some device-trees contain
+ * useless crap (ugh ugh ugh). We work around that here by calling
+ * specific functions for calculating the appropriate resources.
+ */
+ for (i = aoa_resource_i2smmio; i <= aoa_resource_rxdbdma; i++) {
+ if (i2sbus_get_and_fixup_rsrc(np,i,layout,&dev->resources[i]))
goto err;
- /* if only we could use our resource dev->resources[i]...
+
+ /* If only we could use our resource dev->resources[i]...
* but request_resource doesn't know about parents and
- * contained resources... */
+ * contained resources...
+ */
dev->allocated_resource[i] =
request_mem_region(dev->resources[i].start,
dev->resources[i].end -
@@ -205,12 +263,12 @@ static int i2sbus_add_dev(struct macio_d
}
}
/* should do sanity checking here about length of them */
- dev->intfregs = ioremap(dev->resources[0].start,
- dev->resources[0].end-dev->resources[0].start+1);
- dev->out.dbdma = ioremap(dev->resources[1].start,
- dev->resources[1].end-dev->resources[1].start+1);
- dev->in.dbdma = ioremap(dev->resources[2].start,
- dev->resources[2].end-dev->resources[2].start+1);
+ r = &dev->resources[aoa_resource_i2smmio];
+ dev->intfregs = ioremap(r->start, r->end - r->start + 1);
+ r = &dev->resources[aoa_resource_txdbdma];
+ dev->out.dbdma = ioremap(r->start, r->end - r->start + 1);
+ r = &dev->resources[aoa_resource_rxdbdma];
+ dev->in.dbdma = ioremap(r->start, r->end - r->start + 1);
if (!dev->intfregs || !dev->out.dbdma || !dev->in.dbdma)
goto err;
Index: linux-snd-aoa/sound/aoa/soundbus/i2sbus/i2sbus.h
===================================================================
--- linux-snd-aoa.orig/sound/aoa/soundbus/i2sbus/i2sbus.h 2006-06-26 12:29:38.000000000 +1000
+++ linux-snd-aoa/sound/aoa/soundbus/i2sbus/i2sbus.h 2006-06-28 15:16:40.000000000 +1000
@@ -7,20 +7,22 @@
*/
#ifndef __I2SBUS_H
#define __I2SBUS_H
-#include <asm/dbdma.h>
#include <linux/interrupt.h>
-#include <sound/pcm.h>
#include <linux/spinlock.h>
#include <linux/mutex.h>
+
+#include <sound/pcm.h>
+
#include <asm/prom.h>
+#include <asm/pmac_feature.h>
+#include <asm/dbdma.h>
+
#include "i2sbus-interface.h"
-#include "i2sbus-control.h"
#include "../soundbus.h"
struct i2sbus_control {
- volatile struct i2s_control_regs __iomem *controlregs;
- struct resource rsrc;
struct list_head list;
+ struct macio_chip *macio;
};
#define MAX_DBDMA_COMMANDS 32
@@ -45,6 +47,12 @@ struct pcm_info {
volatile struct dbdma_regs __iomem *dbdma;
};
+enum {
+ aoa_resource_i2smmio = 0,
+ aoa_resource_txdbdma,
+ aoa_resource_rxdbdma,
+};
+
struct i2sbus_dev {
struct soundbus_dev sound;
struct macio_dev *macio;
Index: linux-snd-aoa/sound/aoa/soundbus/i2sbus/i2sbus-control.c
===================================================================
--- linux-snd-aoa.orig/sound/aoa/soundbus/i2sbus/i2sbus-control.c 2006-06-26 12:29:38.000000000 +1000
+++ linux-snd-aoa/sound/aoa/soundbus/i2sbus/i2sbus-control.c 2006-06-28 16:09:44.000000000 +1000
@@ -6,12 +6,16 @@
* GPL v2, can be found in COPYING.
*/
-#include <asm/io.h>
+#include <linux/kernel.h>
#include <linux/delay.h>
+
+#include <asm/io.h>
#include <asm/prom.h>
#include <asm/macio.h>
#include <asm/pmac_feature.h>
#include <asm/pmac_pfunc.h>
+#include <asm/keylargo.h>
+
#include "i2sbus.h"
int i2sbus_control_init(struct macio_dev* dev, struct i2sbus_control **c)
@@ -22,26 +26,12 @@ int i2sbus_control_init(struct macio_dev
INIT_LIST_HEAD(&(*c)->list);
- if (of_address_to_resource(dev->ofdev.node, 0, &(*c)->rsrc))
- goto err;
- /* we really should be using feature calls instead of mapping
- * these registers. It's safe for now since no one else is
- * touching them... */
- (*c)->controlregs = ioremap((*c)->rsrc.start,
- sizeof(struct i2s_control_regs));
- if (!(*c)->controlregs)
- goto err;
-
+ (*c)->macio = dev->bus->chip;
return 0;
- err:
- kfree(*c);
- *c = NULL;
- return -ENODEV;
}
void i2sbus_control_destroy(struct i2sbus_control *c)
{
- iounmap(c->controlregs);
kfree(c);
}
@@ -93,19 +83,20 @@ int i2sbus_control_enable(struct i2sbus_
struct i2sbus_dev *i2sdev)
{
struct pmf_args args = { .count = 0 };
- int cc;
+ struct macio_chip *macio = c->macio;
if (i2sdev->enable)
return pmf_call_one(i2sdev->enable, &args);
+ printk("i2sbus_control_enable fallback\n");
+ if (macio == NULL || macio->base == NULL)
+ return -ENODEV;
switch (i2sdev->bus_number) {
case 0:
- cc = in_le32(&c->controlregs->cell_control);
- out_le32(&c->controlregs->cell_control, cc | CTRL_CLOCK_INTF_0_ENABLE);
+ MACIO_BIS(KEYLARGO_FCR1, KL1_I2S0_ENABLE);
break;
case 1:
- cc = in_le32(&c->controlregs->cell_control);
- out_le32(&c->controlregs->cell_control, cc | CTRL_CLOCK_INTF_1_ENABLE);
+ MACIO_BIS(KEYLARGO_FCR1, KL1_I2S1_ENABLE);
break;
default:
return -ENODEV;
@@ -118,7 +109,7 @@ int i2sbus_control_cell(struct i2sbus_co
int enable)
{
struct pmf_args args = { .count = 0 };
- int cc;
+ struct macio_chip *macio = c->macio;
switch (enable) {
case 0:
@@ -133,18 +124,22 @@ int i2sbus_control_cell(struct i2sbus_co
printk(KERN_ERR "i2sbus: INVALID CELL ENABLE VALUE\n");
return -ENODEV;
}
+
+ printk("i2sbus_control_cell fallback\n");
+ if (macio == NULL || macio->base == NULL)
+ return -ENODEV;
switch (i2sdev->bus_number) {
case 0:
- cc = in_le32(&c->controlregs->cell_control);
- cc &= ~CTRL_CLOCK_CELL_0_ENABLE;
- cc |= enable * CTRL_CLOCK_CELL_0_ENABLE;
- out_le32(&c->controlregs->cell_control, cc);
+ if (enable)
+ MACIO_BIS(KEYLARGO_FCR1, KL1_I2S0_CELL_ENABLE);
+ else
+ MACIO_BIC(KEYLARGO_FCR1, KL1_I2S0_CELL_ENABLE);
break;
case 1:
- cc = in_le32(&c->controlregs->cell_control);
- cc &= ~CTRL_CLOCK_CELL_1_ENABLE;
- cc |= enable * CTRL_CLOCK_CELL_1_ENABLE;
- out_le32(&c->controlregs->cell_control, cc);
+ if (enable)
+ MACIO_BIS(KEYLARGO_FCR1, KL1_I2S1_CELL_ENABLE);
+ else
+ MACIO_BIC(KEYLARGO_FCR1, KL1_I2S1_CELL_ENABLE);
break;
default:
return -ENODEV;
@@ -157,7 +152,7 @@ int i2sbus_control_clock(struct i2sbus_c
int enable)
{
struct pmf_args args = { .count = 0 };
- int cc;
+ struct macio_chip *macio = c->macio;
switch (enable) {
case 0:
@@ -172,18 +167,22 @@ int i2sbus_control_clock(struct i2sbus_c
printk(KERN_ERR "i2sbus: INVALID CLOCK ENABLE VALUE\n");
return -ENODEV;
}
+
+ printk("i2sbus_control_clock fallback\n");
+ if (macio == NULL || macio->base == NULL)
+ return -ENODEV;
switch (i2sdev->bus_number) {
case 0:
- cc = in_le32(&c->controlregs->cell_control);
- cc &= ~CTRL_CLOCK_CLOCK_0_ENABLE;
- cc |= enable * CTRL_CLOCK_CLOCK_0_ENABLE;
- out_le32(&c->controlregs->cell_control, cc);
+ if (enable)
+ MACIO_BIS(KEYLARGO_FCR1, KL1_I2S0_CLK_ENABLE_BIT);
+ else
+ MACIO_BIC(KEYLARGO_FCR1, KL1_I2S0_CLK_ENABLE_BIT);
break;
case 1:
- cc = in_le32(&c->controlregs->cell_control);
- cc &= ~CTRL_CLOCK_CLOCK_1_ENABLE;
- cc |= enable * CTRL_CLOCK_CLOCK_1_ENABLE;
- out_le32(&c->controlregs->cell_control, cc);
+ if (enable)
+ MACIO_BIS(KEYLARGO_FCR1, KL1_I2S1_CLK_ENABLE_BIT);
+ else
+ MACIO_BIC(KEYLARGO_FCR1, KL1_I2S1_CLK_ENABLE_BIT);
break;
default:
return -ENODEV;
Index: linux-snd-aoa/sound/aoa/soundbus/i2sbus/i2sbus-control.h
===================================================================
--- linux-snd-aoa.orig/sound/aoa/soundbus/i2sbus/i2sbus-control.h 2006-06-26 12:29:38.000000000 +1000
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,37 +0,0 @@
-/*
- * i2sbus driver -- bus register definitions
- *
- * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
- *
- * GPL v2, can be found in COPYING.
- */
-#ifndef __I2SBUS_CONTROLREGS_H
-#define __I2SBUS_CONTROLREGS_H
-
-/* i2s control registers, at least what we know about them */
-
-#define __PAD(m,n) u8 __pad##m[n]
-#define _PAD(line, n) __PAD(line, n)
-#define PAD(n) _PAD(__LINE__, (n))
-struct i2s_control_regs {
- PAD(0x38);
- __le32 fcr0; /* 0x38 (unknown) */
- __le32 cell_control; /* 0x3c (fcr1) */
- __le32 fcr2; /* 0x40 (unknown) */
- __le32 fcr3; /* 0x44 (fcr3) */
- __le32 clock_control; /* 0x48 (unknown) */
- PAD(4);
- /* total size: 0x50 bytes */
-} __attribute__((__packed__));
-
-#define CTRL_CLOCK_CELL_0_ENABLE (1<<10)
-#define CTRL_CLOCK_CLOCK_0_ENABLE (1<<12)
-#define CTRL_CLOCK_SWRESET_0 (1<<11)
-#define CTRL_CLOCK_INTF_0_ENABLE (1<<13)
-
-#define CTRL_CLOCK_CELL_1_ENABLE (1<<17)
-#define CTRL_CLOCK_CLOCK_1_ENABLE (1<<18)
-#define CTRL_CLOCK_SWRESET_1 (1<<19)
-#define CTRL_CLOCK_INTF_1_ENABLE (1<<20)
-
-#endif /* __I2SBUS_CONTROLREGS_H */
Index: linux-snd-aoa/sound/aoa/Makefile
===================================================================
--- linux-snd-aoa.orig/sound/aoa/Makefile 2006-06-26 12:29:38.000000000 +1000
+++ linux-snd-aoa/sound/aoa/Makefile 2006-06-28 15:51:55.000000000 +1000
@@ -1,4 +1,4 @@
obj-$(CONFIG_SND_AOA) += core/
+obj-$(CONFIG_SND_AOA_SOUNDBUS) += soundbus/
obj-$(CONFIG_SND_AOA) += codecs/
obj-$(CONFIG_SND_AOA) += fabrics/
-obj-$(CONFIG_SND_AOA_SOUNDBUS) += soundbus/
Index: linux-snd-aoa/sound/aoa/codecs/snd-aoa-codec-onyx.c
===================================================================
--- linux-snd-aoa.orig/sound/aoa/codecs/snd-aoa-codec-onyx.c 2006-06-26 12:29:38.000000000 +1000
+++ linux-snd-aoa/sound/aoa/codecs/snd-aoa-codec-onyx.c 2006-06-28 15:37:17.000000000 +1000
@@ -1080,6 +1080,7 @@ static int onyx_i2c_detach(struct i2c_cl
struct onyx *onyx = container_of(client, struct onyx, i2c);
int err;
+ printk("onyx_i2c_detach...\n");
if ((err = i2c_detach_client(client)))
return err;
aoa_codec_unregister(&onyx->codec);
Index: linux-snd-aoa/sound/aoa/soundbus/core.c
===================================================================
--- linux-snd-aoa.orig/sound/aoa/soundbus/core.c 2006-06-26 12:29:38.000000000 +1000
+++ linux-snd-aoa/sound/aoa/soundbus/core.c 2006-06-28 16:00:35.000000000 +1000
@@ -194,16 +194,6 @@ static struct bus_type soundbus_bus_type
.dev_attrs = soundbus_dev_attrs,
};
-static int __init soundbus_init(void)
-{
- return bus_register(&soundbus_bus_type);
-}
-
-static void __exit soundbus_exit(void)
-{
- bus_unregister(&soundbus_bus_type);
-}
-
int soundbus_add_one(struct soundbus_dev *dev)
{
static int devcount;
@@ -246,5 +236,15 @@ void soundbus_unregister_driver(struct s
}
EXPORT_SYMBOL_GPL(soundbus_unregister_driver);
-module_init(soundbus_init);
+static int __init soundbus_init(void)
+{
+ return bus_register(&soundbus_bus_type);
+}
+
+static void __exit soundbus_exit(void)
+{
+ bus_unregister(&soundbus_bus_type);
+}
+
+subsys_initcall(soundbus_init);
module_exit(soundbus_exit);
^ permalink raw reply
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