* RE: Hang with isync
From: Liu Dave-r63238 @ 2006-09-21 4:24 UTC (permalink / raw)
To: Manoj Sharma, Linas Vepstas; +Cc: linuxppc-dev
In-Reply-To: <d6dada100609201759r5dd047d7y2b60684d9c4feaa8@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1179 bytes --]
No MSR is 00029030 and user mode bit is not set here.
I had missed it in the prev mail:
\x05NIP: C0005DA4 XER: 20000000 LR: C0004FE4 SP: C01F3000\x05 REGS: c01eff30
TRAP: 1020 Not tainted
MSR: 00029030 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 11
TASK = c01f1080[0] 'swapper' Last syscall: 120
last math 00000000 last altivec 00000000
\x05PLB0: bear= 0x08000000 acr= 0xbb000000 besr= 0x00000000
Dave>I notice that MSR and TRAP, MSR is 00029030- the critical interrupt
enable.
Dave>TRAP is 1020. --WatchDog timer exception is happening
Dave>You can disable the MSR[CE] bit to no critical exception or disable
the WD timer
On 9/20/06, Linas Vepstas <linas@austin.ibm.com> wrote:
On Thu, Sep 21, 2006 at 08:38:13AM +1000, Benjamin
Herrenschmidt wrote:
> On Wed, 2006-09-20 at 15:31 -0700, Manoj Sharma wrote:
> > This is the stack trace.
> >
> > Registers:
> > GPR00: 00069030
This is the MSR and it has the user-mode bit set, which
is surely wrong.
This is not how one gets to user space.
00048000
The MSR had this or'ed into it, which is setting the
user-mode bit.
Surely that's wrong.
--linas
[-- Attachment #2: Type: text/html, Size: 2624 bytes --]
^ permalink raw reply
* [PATCH] kdump: don't call __ioremap() for pfn = 0
From: Sachin P. Sant @ 2006-09-21 4:37 UTC (permalink / raw)
To: linuxppc-dev; +Cc: paulus, Fastboot mailing list
[-- Attachment #1: Type: text/plain, Size: 517 bytes --]
Hi
While using dd command to retrive the dump from /dev/oldmem, there comes
a rare case where pfn value is zero. In this case the __ioremap() call
returns
NULL and hence copying fails.
# dd if=/dev/oldmem of=/dev/null
dd: reading `/dev/oldmem': Bad address
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000121 seconds, 0.0 kB/s
Attached is a patch to fix this problem. During such rare cases don't call
__ioremap() to do the address translation, instead use __va() .
Tested with 2.6.18.
Thanks
-Sachin
[-- Attachment #2: kdump-no-ioremap-for-pfn-zero-fix --]
[-- Type: text/plain, Size: 1027 bytes --]
* During some rare cases [like using dd command with /dev/oldmem] the pfn value
can be zero. Do not call __ioremap for zero pfn value, instead use __va to
calculate the virtual address.
Signed-off-by: Sachin Sant <sachinp@in.ibm.com>
diff -Naurp a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
--- a/arch/powerpc/kernel/crash_dump.c 2006-09-20 09:12:06.000000000 +0530
+++ b/arch/powerpc/kernel/crash_dump.c 2006-09-21 09:06:35.000000000 +0530
@@ -101,7 +101,15 @@ ssize_t copy_oldmem_page(unsigned long p
if (!csize)
return 0;
- vaddr = __ioremap(pfn << PAGE_SHIFT, PAGE_SIZE, 0);
+ /* During some rare cases [like using dd command with /dev/oldmem]
+ * the pfn value can be zero. Do not call __ioremap for zero
+ * pfn value, instead use __va to calculate the virtual address.
+ */
+
+ if (pfn == 0)
+ vaddr = __va(pfn << PAGE_SHIFT);
+ else
+ vaddr = __ioremap(pfn << PAGE_SHIFT, PAGE_SIZE, 0);
if (userbuf) {
if (copy_to_user((char __user *)buf, (vaddr + offset), csize)) {
^ permalink raw reply
* [POWERPC] mark BUG() as noreturn
From: Stephen Rothwell @ 2006-09-21 4:55 UTC (permalink / raw)
To: paulus; +Cc: ppc-dev, Hollis Blanchard
In-Reply-To: <1158798041.7062.4.camel@localhost.localdomain>
>From an idea from Michael Ellerman.
We finish the BUG() macro with a call to a function marked with attribute
"noreturn" so that the compiler will know that BUG() and BUG_ON()
(with a constant, non-zero argument) will not return.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
include/asm-powerpc/bug.h | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --git a/include/asm-powerpc/bug.h b/include/asm-powerpc/bug.h
index f44b529..cf5c460 100644
--- a/include/asm-powerpc/bug.h
+++ b/include/asm-powerpc/bug.h
@@ -31,6 +31,16 @@ #define BUG_WARNING_TRAP 0x1000000
#ifdef CONFIG_BUG
/*
+ * This is so that we can tell the compiler that BUG() and
+ * BUG_ON() with a constant non-zero argument does not return.
+ */
+static inline void __attribute__((noreturn)) __bug_does_not_return(void)
+{
+ while (1)
+ /* do nothing */;
+}
+
+/*
* BUG_ON() and WARN_ON() do their best to cooperate with compile-time
* optimisations. However depending on the complexity of the condition
* some compiler versions may not produce optimal results.
@@ -43,6 +53,7 @@ #define BUG() do { \
"\t"PPC_LONG" 1b,%0,%1,%2\n" \
".previous" \
: : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \
+ __bug_does_not_return(); \
} while (0)
#define BUG_ON(x) do { \
--
1.4.2.1
^ permalink raw reply related
* Re: Hang with isync
From: Manoj Sharma @ 2006-09-21 6:17 UTC (permalink / raw)
To: Liu Dave-r63238; +Cc: linuxppc-dev
In-Reply-To: <995B09A8299C2C44B59866F6391D263516BFD7@zch01exm21.fsl.freescale.net>
[-- Attachment #1: Type: text/plain, Size: 1566 bytes --]
Dave, watchdog timeout is around one second and no cpu activity for that
long is something wrong. Is it ok to disable it to hide the problem lying
somewhere else? Do you think it can be because of sync-isync
instructions and moving to 2.6 might resolve it?
On 9/20/06, Liu Dave-r63238 <DaveLiu@freescale.com> wrote:
>
>
> No MSR is 00029030 and user mode bit is not set here.
>
> I had missed it in the prev mail:
>
> \x05NIP: C0005DA4 XER: 20000000 LR: C0004FE4 SP: C01F3000\x05 REGS: c01eff30
> TRAP: 1020 Not tainted
> MSR: 00029030 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 11
> TASK = c01f1080[0] 'swapper' Last syscall: 120
> last math 00000000 last altivec 00000000
> \x05PLB0: bear= 0x08000000 acr= 0xbb000000 besr= 0x00000000
>
> Dave>I notice that MSR and TRAP, MSR is 00029030- the critical interrupt
> enable.
> Dave>TRAP is 1020. --WatchDog timer exception is happening
> Dave>You can disable the MSR[CE] bit to no critical exception or disable
> the WD timer
>
>
>
> On 9/20/06, Linas Vepstas <linas@austin.ibm.com> wrote:
> >
> > On Thu, Sep 21, 2006 at 08:38:13AM +1000, Benjamin Herrenschmidt wrote:
> > > On Wed, 2006-09-20 at 15:31 -0700, Manoj Sharma wrote:
> > > > This is the stack trace.
> > > >
> > > > Registers:
> > > > GPR00: 00069030
> >
> > This is the MSR and it has the user-mode bit set, which is surely wrong.
> > This is not how one gets to user space.
> >
> > 00048000
> >
> > The MSR had this or'ed into it, which is setting the user-mode bit.
> > Surely that's wrong.
> >
> > --linas
> >
>
>
[-- Attachment #2: Type: text/html, Size: 2975 bytes --]
^ permalink raw reply
* RE: Hang with isync
From: Liu Dave-r63238 @ 2006-09-21 6:27 UTC (permalink / raw)
To: Manoj Sharma; +Cc: linuxppc-dev
In-Reply-To: <d6dada100609202317s8037f73o624015ac37402c2d@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1921 bytes --]
First, you must make sure if it really happen at watchdog timer
exception.
if it is, you need select one suitable way to fix it.
Second, I don't believe the sync-isync instructions make it happen.
you can try the 2.6, I don't know if 2.6 kernel can resolve your
problem.
-Dave
________________________________
Dave, watchdog timeout is around one second and no cpu activity
for that long is something wrong. Is it ok to disable it to hide the
problem lying somewhere else? Do you think it can be because of
sync-isync instructions and moving to 2.6 might resolve it?
On 9/20/06, Liu Dave-r63238 <DaveLiu@freescale.com> wrote:
No MSR is 00029030 and user mode bit is not set here.
I had missed it in the prev mail:
\x05NIP: C0005DA4 XER: 20000000 LR: C0004FE4 SP: C01F3000\x05
REGS: c01eff30 TRAP: 1020 Not tainted
MSR: 00029030 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 11
TASK = c01f1080[0] 'swapper' Last syscall: 120
last math 00000000 last altivec 00000000
\x05PLB0: bear= 0x08000000 acr= 0xbb000000 besr=
0x00000000
Dave>I notice that MSR and TRAP, MSR is 00029030- the
critical interrupt enable.
Dave>TRAP is 1020. --WatchDog timer exception is
happening
Dave>You can disable the MSR[CE] bit to no critical
exception or disable the WD timer
On 9/20/06, Linas Vepstas <linas@austin.ibm.com
> wrote:
On Thu, Sep 21, 2006 at 08:38:13AM
+1000, Benjamin Herrenschmidt wrote:
> On Wed, 2006-09-20 at 15:31 -0700,
Manoj Sharma wrote:
> > This is the stack trace.
> >
> > Registers:
> > GPR00: 00069030
This is the MSR and it has the user-mode
bit set, which is surely wrong.
This is not how one gets to user space.
00048000
The MSR had this or'ed into it, which is
setting the user-mode bit.
Surely that's wrong.
--linas
[-- Attachment #2: Type: text/html, Size: 4835 bytes --]
^ permalink raw reply
* [PATCH] Use __builtin_trap() to indicate that BUG() never returns
From: Michael Ellerman @ 2006-09-21 6:48 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, Stephen Rothwell
By using __builtin_trap() in BUG() we tell the compiler that we
don't expect the code below to be executed, and in certain circumstances
this allows the compiler to elide that code altogether.
In fact it works so well that we have to put the bug section stuff
before the __builtin_trap() or else it isn't generated at all.
Tested on P5 LPAR, line numbers etc. all OK.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
include/asm-powerpc/bug.h | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
Index: to-merge/include/asm-powerpc/bug.h
===================================================================
--- to-merge.orig/include/asm-powerpc/bug.h
+++ to-merge/include/asm-powerpc/bug.h
@@ -37,12 +37,13 @@ struct bug_entry *find_bug(unsigned long
*/
#define BUG() do { \
- __asm__ __volatile__( \
- "1: twi 31,0,0\n" \
+ __asm__ __volatile__( \
".section __bug_table,\"a\"\n" \
- "\t"PPC_LONG" 1b,%0,%1,%2\n" \
- ".previous" \
+ "\t"PPC_LONG" 1f,%0,%1,%2\n" \
+ ".previous\n" \
+ "1: " \
: : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \
+ __builtin_trap(); \
} while (0)
#define BUG_ON(x) do { \
^ permalink raw reply
* Re: Hang with isync
From: Manoj Sharma @ 2006-09-21 7:11 UTC (permalink / raw)
To: Liu Dave-r63238; +Cc: linuxppc-dev
In-Reply-To: <995B09A8299C2C44B59866F6391D263516C018@zch01exm21.fsl.freescale.net>
[-- Attachment #1: Type: text/plain, Size: 2299 bytes --]
The hang has trigerred watchdog timer exception. It points that there is
problem somewhere but don't know what is it.
Even with 2.4, it does not happen regularly. It occurs once in a while and
not reproducable.
On 9/20/06, Liu Dave-r63238 <DaveLiu@freescale.com> wrote:
>
> First, you must make sure if it really happen at watchdog timer
> exception.
> if it is, you need select one suitable way to fix it.
> Second, I don't believe the sync-isync instructions make it happen.
> you can try the 2.6, I don't know if 2.6 kernel can resolve your problem.
>
> -Dave
>
> ------------------------------
> Dave, watchdog timeout is around one second and no cpu activity for that
> long is something wrong. Is it ok to disable it to hide the problem lying
> somewhere else? Do you think it can be because of sync-isync
> instructions and moving to 2.6 might resolve it?
>
>
> On 9/20/06, Liu Dave-r63238 <DaveLiu@freescale.com> wrote:
> >
> >
> > No MSR is 00029030 and user mode bit is not set here.
> >
> > I had missed it in the prev mail:
> >
> > \x05NIP: C0005DA4 XER: 20000000 LR: C0004FE4 SP: C01F3000\x05 REGS: c01eff30
> > TRAP: 1020 Not tainted
> > MSR: 00029030 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 11
> > TASK = c01f1080[0] 'swapper' Last syscall: 120
> > last math 00000000 last altivec 00000000
> > \x05PLB0: bear= 0x08000000 acr= 0xbb000000 besr= 0x00000000
> >
> > Dave>I notice that MSR and TRAP, MSR is 00029030- the critical interrupt
> > enable.
> > Dave>TRAP is 1020. --WatchDog timer exception is happening
> > Dave>You can disable the MSR[CE] bit to no critical exception or disable
> > the WD timer
> >
> >
> >
> > On 9/20/06, Linas Vepstas <linas@austin.ibm.com > wrote:
> > >
> > > On Thu, Sep 21, 2006 at 08:38:13AM +1000, Benjamin Herrenschmidt
> > > wrote:
> > > > On Wed, 2006-09-20 at 15:31 -0700, Manoj Sharma wrote:
> > > > > This is the stack trace.
> > > > >
> > > > > Registers:
> > > > > GPR00: 00069030
> > >
> > > This is the MSR and it has the user-mode bit set, which is surely
> > > wrong.
> > > This is not how one gets to user space.
> > >
> > > 00048000
> > >
> > > The MSR had this or'ed into it, which is setting the user-mode bit.
> > > Surely that's wrong.
> > >
> > > --linas
> > >
> >
> >
>
[-- Attachment #2: Type: text/html, Size: 4865 bytes --]
^ permalink raw reply
* Re: Linux on custom Xilinx board with PPC405 hangs on boot
From: Peter N. Andreasen @ 2006-09-21 7:40 UTC (permalink / raw)
To: Liu Dave-r63238, Linas Vepstas, linuxppc-dev
In-Reply-To: <995B09A8299C2C44B59866F6391D263516BFD2@zch01exm21.fsl.freescale.net>
[-- Attachment #1: Type: text/plain, Size: 1435 bytes --]
Liu, Linas, list
Thanks a lot for the answers. It helped me to review the hardware
configuration again.
The problem was the definition of the Flash size.
It turns out that the Xilinx generated header files define the size of the
Flash. But the kernel also has a configuration option: Memory Technology
Devices / Mapping Drivers for Chip Access / Physical Length of Chip Mapping
My arch/ppc/platforms/xilinx_ocp/xparameters_ml300.h defines this as 4Mbyte,
but the option in the kernel was set to 64 Mbyte (an extra 0 which I had not
seen)
thanks again
Peter
On 9/21/06, Liu Dave-r63238 <DaveLiu@freescale.com> wrote:
>
> <snip>
> > > Instruction machine check in kernel mode.
> > > Oops: machine check, sig: 7
> > > NIP: C00A2960 XER: 40000000 LR: C009CBD8 SP: C04D9D90 REGS:
> > c04d9ce0 TRAP:
> > > 0200 Not tainted
> > > MSR: 00009030 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 11
> >
> > Machine checks happen when some hunk of hardware is wired to
> > the machine-check pin of the cpu chip, and that bit of
> > hardware decides to raise the wire. I'd say the first step
> > is to figure ou what hardware is wired up this way, and what
> > would make it unhappy enough to assert a machine check.
> >
> > SRR1 has bits that state what caused he machine check. -- e.g
> > partity error on data or address bus, "transfer error", or MC signal.
>
> The PPC405 has different registers for machine check. Unlike classic
> powerpc.
>
> -Dave
>
[-- Attachment #2: Type: text/html, Size: 1870 bytes --]
^ permalink raw reply
* [POWERPC] merge iSeries i/o operations with the rest
From: Stephen Rothwell @ 2006-09-21 8:00 UTC (permalink / raw)
To: paulus; +Cc: ppc-dev
In-Reply-To: <20060921100315.89d74f6f.sfr@canb.auug.org.au>
This patch changes the io operations so that they are out of line if
CONFIG_PPC_ISERIES is set and includes a firmware feature check in
that case.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
arch/powerpc/kernel/io.c | 14 ++
arch/powerpc/platforms/iseries/pci.c | 280 ++++++++++++++++++++++++------
include/asm-powerpc/io.h | 148 ++++++++--------
include/asm-powerpc/iseries/iseries_io.h | 60 ------
4 files changed, 319 insertions(+), 183 deletions(-)
This version depends on either of the patches that mark BUG() as noreturn
(with a preference for Michael's).
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --git a/arch/powerpc/kernel/io.c b/arch/powerpc/kernel/io.c
index 80a3209..e981806 100644
--- a/arch/powerpc/kernel/io.c
+++ b/arch/powerpc/kernel/io.c
@@ -22,12 +22,16 @@ #include <linux/compiler.h>
#include <linux/module.h>
#include <asm/io.h>
+#include <asm/firmware.h>
+#include <asm/bug.h>
void _insb(volatile u8 __iomem *port, void *buf, long count)
{
u8 *tbuf = buf;
u8 tmp;
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
if (unlikely(count <= 0))
return;
asm volatile("sync");
@@ -44,6 +48,8 @@ void _outsb(volatile u8 __iomem *port, c
{
const u8 *tbuf = buf;
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
if (unlikely(count <= 0))
return;
asm volatile("sync");
@@ -59,6 +65,8 @@ void _insw_ns(volatile u16 __iomem *port
u16 *tbuf = buf;
u16 tmp;
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
if (unlikely(count <= 0))
return;
asm volatile("sync");
@@ -75,6 +83,8 @@ void _outsw_ns(volatile u16 __iomem *por
{
const u16 *tbuf = buf;
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
if (unlikely(count <= 0))
return;
asm volatile("sync");
@@ -90,6 +100,8 @@ void _insl_ns(volatile u32 __iomem *port
u32 *tbuf = buf;
u32 tmp;
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
if (unlikely(count <= 0))
return;
asm volatile("sync");
@@ -106,6 +118,8 @@ void _outsl_ns(volatile u32 __iomem *por
{
const u32 *tbuf = buf;
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
if (unlikely(count <= 0))
return;
asm volatile("sync");
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index f4d427a..3eb1206 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -34,6 +34,7 @@ #include <asm/machdep.h>
#include <asm/pci-bridge.h>
#include <asm/iommu.h>
#include <asm/abs_addr.h>
+#include <asm/firmware.h>
#include <asm/iseries/hv_call_xm.h>
#include <asm/iseries/mf.h>
@@ -270,46 +271,6 @@ void pcibios_fixup_resources(struct pci_
}
/*
- * I/0 Memory copy MUST use mmio commands on iSeries
- * To do; For performance, include the hv call directly
- */
-void iSeries_memset_io(volatile void __iomem *dest, char c, size_t Count)
-{
- u8 ByteValue = c;
- long NumberOfBytes = Count;
-
- while (NumberOfBytes > 0) {
- iSeries_Write_Byte(ByteValue, dest++);
- -- NumberOfBytes;
- }
-}
-EXPORT_SYMBOL(iSeries_memset_io);
-
-void iSeries_memcpy_toio(volatile void __iomem *dest, void *source, size_t count)
-{
- char *src = source;
- long NumberOfBytes = count;
-
- while (NumberOfBytes > 0) {
- iSeries_Write_Byte(*src++, dest++);
- -- NumberOfBytes;
- }
-}
-EXPORT_SYMBOL(iSeries_memcpy_toio);
-
-void iSeries_memcpy_fromio(void *dest, const volatile void __iomem *src, size_t count)
-{
- char *dst = dest;
- long NumberOfBytes = count;
-
- while (NumberOfBytes > 0) {
- *dst++ = iSeries_Read_Byte(src++);
- -- NumberOfBytes;
- }
-}
-EXPORT_SYMBOL(iSeries_memcpy_fromio);
-
-/*
* Look down the chain to find the matching Device Device
*/
static struct device_node *find_Device_Node(int bus, int devfn)
@@ -491,7 +452,7 @@ static inline struct device_node *xlate_
* iSeries_Read_Word = Read Word (16 bit)
* iSeries_Read_Long = Read Long (32 bit)
*/
-u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
+static u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
{
u64 BarOffset;
u64 dsa;
@@ -518,9 +479,8 @@ u8 iSeries_Read_Byte(const volatile void
return (u8)ret.value;
}
-EXPORT_SYMBOL(iSeries_Read_Byte);
-u16 iSeries_Read_Word(const volatile void __iomem *IoAddress)
+static u16 iSeries_Read_Word(const volatile void __iomem *IoAddress)
{
u64 BarOffset;
u64 dsa;
@@ -548,9 +508,8 @@ u16 iSeries_Read_Word(const volatile voi
return swab16((u16)ret.value);
}
-EXPORT_SYMBOL(iSeries_Read_Word);
-u32 iSeries_Read_Long(const volatile void __iomem *IoAddress)
+static u32 iSeries_Read_Long(const volatile void __iomem *IoAddress)
{
u64 BarOffset;
u64 dsa;
@@ -578,7 +537,6 @@ u32 iSeries_Read_Long(const volatile voi
return swab32((u32)ret.value);
}
-EXPORT_SYMBOL(iSeries_Read_Long);
/*
* Write MM I/O Instructions for the iSeries
@@ -587,7 +545,7 @@ EXPORT_SYMBOL(iSeries_Read_Long);
* iSeries_Write_Word = Write Word(16 bit)
* iSeries_Write_Long = Write Long(32 bit)
*/
-void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress)
+static void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress)
{
u64 BarOffset;
u64 dsa;
@@ -612,9 +570,8 @@ void iSeries_Write_Byte(u8 data, volatil
rc = HvCall4(HvCallPciBarStore8, dsa, BarOffset, data, 0);
} while (CheckReturnCode("WWB", DevNode, &retry, rc) != 0);
}
-EXPORT_SYMBOL(iSeries_Write_Byte);
-void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress)
+static void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress)
{
u64 BarOffset;
u64 dsa;
@@ -639,9 +596,8 @@ void iSeries_Write_Word(u16 data, volati
rc = HvCall4(HvCallPciBarStore16, dsa, BarOffset, swab16(data), 0);
} while (CheckReturnCode("WWW", DevNode, &retry, rc) != 0);
}
-EXPORT_SYMBOL(iSeries_Write_Word);
-void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress)
+static void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress)
{
u64 BarOffset;
u64 dsa;
@@ -666,4 +622,224 @@ void iSeries_Write_Long(u32 data, volati
rc = HvCall4(HvCallPciBarStore32, dsa, BarOffset, swab32(data), 0);
} while (CheckReturnCode("WWL", DevNode, &retry, rc) != 0);
}
-EXPORT_SYMBOL(iSeries_Write_Long);
+
+extern unsigned char __raw_readb(const volatile void __iomem *addr)
+{
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
+ return *(volatile unsigned char __force *)addr;
+}
+EXPORT_SYMBOL(__raw_readb);
+
+extern unsigned short __raw_readw(const volatile void __iomem *addr)
+{
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
+ return *(volatile unsigned short __force *)addr;
+}
+EXPORT_SYMBOL(__raw_readw);
+
+extern unsigned int __raw_readl(const volatile void __iomem *addr)
+{
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
+ return *(volatile unsigned int __force *)addr;
+}
+EXPORT_SYMBOL(__raw_readl);
+
+extern unsigned long __raw_readq(const volatile void __iomem *addr)
+{
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
+ return *(volatile unsigned long __force *)addr;
+}
+EXPORT_SYMBOL(__raw_readq);
+
+extern void __raw_writeb(unsigned char v, volatile void __iomem *addr)
+{
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
+ *(volatile unsigned char __force *)addr = v;
+}
+EXPORT_SYMBOL(__raw_writeb);
+
+extern void __raw_writew(unsigned short v, volatile void __iomem *addr)
+{
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
+ *(volatile unsigned short __force *)addr = v;
+}
+EXPORT_SYMBOL(__raw_writew);
+
+extern void __raw_writel(unsigned int v, volatile void __iomem *addr)
+{
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
+ *(volatile unsigned int __force *)addr = v;
+}
+EXPORT_SYMBOL(__raw_writel);
+
+extern void __raw_writeq(unsigned long v, volatile void __iomem *addr)
+{
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
+ *(volatile unsigned long __force *)addr = v;
+}
+EXPORT_SYMBOL(__raw_writeq);
+
+int in_8(const volatile unsigned char __iomem *addr)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ return iSeries_Read_Byte(addr);
+ return __in_8(addr);
+}
+EXPORT_SYMBOL(in_8);
+
+void out_8(volatile unsigned char __iomem *addr, int val)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ iSeries_Write_Byte(val, addr);
+ else
+ __out_8(addr, val);
+}
+EXPORT_SYMBOL(out_8);
+
+int in_le16(const volatile unsigned short __iomem *addr)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ return iSeries_Read_Word(addr);
+ return __in_le16(addr);
+}
+EXPORT_SYMBOL(in_le16);
+
+int in_be16(const volatile unsigned short __iomem *addr)
+{
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
+ return __in_be16(addr);
+}
+EXPORT_SYMBOL(in_be16);
+
+void out_le16(volatile unsigned short __iomem *addr, int val)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ iSeries_Write_Word(val, addr);
+ else
+ __out_le16(addr, val);
+}
+EXPORT_SYMBOL(out_le16);
+
+void out_be16(volatile unsigned short __iomem *addr, int val)
+{
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
+ __out_be16(addr, val);
+}
+EXPORT_SYMBOL(out_be16);
+
+unsigned in_le32(const volatile unsigned __iomem *addr)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ return iSeries_Read_Long(addr);
+ return __in_le32(addr);
+}
+EXPORT_SYMBOL(in_le32);
+
+unsigned in_be32(const volatile unsigned __iomem *addr)
+{
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
+ return __in_be32(addr);
+}
+EXPORT_SYMBOL(in_be32);
+
+void out_le32(volatile unsigned __iomem *addr, int val)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ iSeries_Write_Long(val, addr);
+ else
+ __out_le32(addr, val);
+}
+EXPORT_SYMBOL(out_le32);
+
+void out_be32(volatile unsigned __iomem *addr, int val)
+{
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
+ __out_be32(addr, val);
+}
+EXPORT_SYMBOL(out_be32);
+
+unsigned long in_le64(const volatile unsigned long __iomem *addr)
+{
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
+ return __in_le64(addr);
+}
+EXPORT_SYMBOL(in_le64);
+
+unsigned long in_be64(const volatile unsigned long __iomem *addr)
+{
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
+ return __in_be64(addr);
+}
+EXPORT_SYMBOL(in_be64);
+
+void out_le64(volatile unsigned long __iomem *addr, unsigned long val)
+{
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
+ __out_le64(addr, val);
+}
+EXPORT_SYMBOL(out_le64);
+
+void out_be64(volatile unsigned long __iomem *addr, unsigned long val)
+{
+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
+
+ __out_be64(addr, val);
+}
+EXPORT_SYMBOL(out_be64);
+
+void memset_io(volatile void __iomem *addr, int c, unsigned long n)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+ volatile char __iomem *d = addr;
+
+ while (n-- > 0) {
+ iSeries_Write_Byte(c, d++);
+ }
+ } else
+ eeh_memset_io(addr, c, n);
+}
+EXPORT_SYMBOL(memset_io);
+
+void memcpy_fromio(void *dest, const volatile void __iomem *src,
+ unsigned long n)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+ char *d = dest;
+ const volatile char __iomem *s = src;
+
+ while (n-- > 0) {
+ *d++ = iSeries_Read_Byte(s++);
+ }
+ } else
+ eeh_memcpy_fromio(dest, src, n);
+}
+EXPORT_SYMBOL(memcpy_fromio);
+
+void memcpy_toio(volatile void __iomem *dest, const void *src, unsigned long n)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+ const char *s = src;
+ volatile char __iomem *d = dest;
+
+ while (n-- > 0) {
+ iSeries_Write_Byte(*s++, d++);
+ }
+ } else
+ eeh_memcpy_toio(dest, src, n);
+}
+EXPORT_SYMBOL(memcpy_toio);
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index 174fb89..46bae1c 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -20,9 +20,6 @@ #include <linux/compiler.h>
#include <asm/page.h>
#include <asm/byteorder.h>
#include <asm/paca.h>
-#ifdef CONFIG_PPC_ISERIES
-#include <asm/iseries/iseries_io.h>
-#endif
#include <asm/synch.h>
#include <asm/delay.h>
@@ -37,41 +34,53 @@ extern unsigned long isa_io_base;
extern unsigned long pci_io_base;
#ifdef CONFIG_PPC_ISERIES
-/* __raw_* accessors aren't supported on iSeries */
-#define __raw_readb(addr) { BUG(); 0; }
-#define __raw_readw(addr) { BUG(); 0; }
-#define __raw_readl(addr) { BUG(); 0; }
-#define __raw_readq(addr) { BUG(); 0; }
-#define __raw_writeb(v, addr) { BUG(); 0; }
-#define __raw_writew(v, addr) { BUG(); 0; }
-#define __raw_writel(v, addr) { BUG(); 0; }
-#define __raw_writeq(v, addr) { BUG(); 0; }
-#define readb(addr) iSeries_Read_Byte(addr)
-#define readw(addr) iSeries_Read_Word(addr)
-#define readl(addr) iSeries_Read_Long(addr)
-#define writeb(data, addr) iSeries_Write_Byte((data),(addr))
-#define writew(data, addr) iSeries_Write_Word((data),(addr))
-#define writel(data, addr) iSeries_Write_Long((data),(addr))
-#define memset_io(a,b,c) iSeries_memset_io((a),(b),(c))
-#define memcpy_fromio(a,b,c) iSeries_memcpy_fromio((a), (b), (c))
-#define memcpy_toio(a,b,c) iSeries_memcpy_toio((a), (b), (c))
-
-#define inb(addr) readb(((void __iomem *)(long)(addr)))
-#define inw(addr) readw(((void __iomem *)(long)(addr)))
-#define inl(addr) readl(((void __iomem *)(long)(addr)))
-#define outb(data,addr) writeb(data,((void __iomem *)(long)(addr)))
-#define outw(data,addr) writew(data,((void __iomem *)(long)(addr)))
-#define outl(data,addr) writel(data,((void __iomem *)(long)(addr)))
-/*
- * The *_ns versions below don't do byte-swapping.
- * Neither do the standard versions now, these are just here
- * for older code.
- */
-#define insb(port, buf, ns) _insb((u8 __iomem *)((port)+pci_io_base), (buf), (ns))
-#define insw(port, buf, ns) _insw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns))
-#define insl(port, buf, nl) _insl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl))
-#else
+extern int in_8(const volatile unsigned char __iomem *addr);
+extern void out_8(volatile unsigned char __iomem *addr, int val);
+extern int in_le16(const volatile unsigned short __iomem *addr);
+extern int in_be16(const volatile unsigned short __iomem *addr);
+extern void out_le16(volatile unsigned short __iomem *addr, int val);
+extern void out_be16(volatile unsigned short __iomem *addr, int val);
+extern unsigned in_le32(const volatile unsigned __iomem *addr);
+extern unsigned in_be32(const volatile unsigned __iomem *addr);
+extern void out_le32(volatile unsigned __iomem *addr, int val);
+extern void out_be32(volatile unsigned __iomem *addr, int val);
+extern unsigned long in_le64(const volatile unsigned long __iomem *addr);
+extern unsigned long in_be64(const volatile unsigned long __iomem *addr);
+extern void out_le64(volatile unsigned long __iomem *addr, unsigned long val);
+extern void out_be64(volatile unsigned long __iomem *addr, unsigned long val);
+
+extern unsigned char __raw_readb(const volatile void __iomem *addr);
+extern unsigned short __raw_readw(const volatile void __iomem *addr);
+extern unsigned int __raw_readl(const volatile void __iomem *addr);
+extern unsigned long __raw_readq(const volatile void __iomem *addr);
+extern void __raw_writeb(unsigned char v, volatile void __iomem *addr);
+extern void __raw_writew(unsigned short v, volatile void __iomem *addr);
+extern void __raw_writel(unsigned int v, volatile void __iomem *addr);
+extern void __raw_writeq(unsigned long v, volatile void __iomem *addr);
+
+extern void memset_io(volatile void __iomem *addr, int c, unsigned long n);
+extern void memcpy_fromio(void *dest, const volatile void __iomem *src,
+ unsigned long n);
+extern void memcpy_toio(volatile void __iomem *dest, const void *src,
+ unsigned long n);
+
+#else /* CONFIG_PPC_ISERIES */
+
+#define in_8(addr) __in_8((addr))
+#define out_8(addr, val) __out_8((addr), (val))
+#define in_le16(addr) __in_le16((addr))
+#define in_be16(addr) __in_be16((addr))
+#define out_le16(addr, val) __out_le16((addr), (val))
+#define out_be16(addr, val) __out_be16((addr), (val))
+#define in_le32(addr) __in_le32((addr))
+#define in_be32(addr) __in_be32((addr))
+#define out_le32(addr, val) __out_le32((addr), (val))
+#define out_be32(addr, val) __out_be32((addr), (val))
+#define in_le64(addr) __in_le64((addr))
+#define in_be64(addr) __in_be64((addr))
+#define out_le64(addr, val) __out_le64((addr), (val))
+#define out_be64(addr, val) __out_be64((addr), (val))
static inline unsigned char __raw_readb(const volatile void __iomem *addr)
{
@@ -105,23 +114,11 @@ static inline void __raw_writeq(unsigned
{
*(volatile unsigned long __force *)addr = v;
}
-#define readb(addr) eeh_readb(addr)
-#define readw(addr) eeh_readw(addr)
-#define readl(addr) eeh_readl(addr)
-#define readq(addr) eeh_readq(addr)
-#define writeb(data, addr) eeh_writeb((data), (addr))
-#define writew(data, addr) eeh_writew((data), (addr))
-#define writel(data, addr) eeh_writel((data), (addr))
-#define writeq(data, addr) eeh_writeq((data), (addr))
#define memset_io(a,b,c) eeh_memset_io((a),(b),(c))
#define memcpy_fromio(a,b,c) eeh_memcpy_fromio((a),(b),(c))
#define memcpy_toio(a,b,c) eeh_memcpy_toio((a),(b),(c))
-#define inb(port) eeh_inb((unsigned long)port)
-#define outb(val, port) eeh_outb(val, (unsigned long)port)
-#define inw(port) eeh_inw((unsigned long)port)
-#define outw(val, port) eeh_outw(val, (unsigned long)port)
-#define inl(port) eeh_inl((unsigned long)port)
-#define outl(val, port) eeh_outl(val, (unsigned long)port)
+
+#endif /* CONFIG_PPC_ISERIES */
/*
* The insw/outsw/insl/outsl macros don't do byte-swapping.
@@ -132,12 +129,25 @@ #define insb(port, buf, ns) eeh_insb((po
#define insw(port, buf, ns) eeh_insw_ns((port), (buf), (ns))
#define insl(port, buf, nl) eeh_insl_ns((port), (buf), (nl))
-#endif
-
#define outsb(port, buf, ns) _outsb((u8 __iomem *)((port)+pci_io_base), (buf), (ns))
#define outsw(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns))
#define outsl(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl))
+#define readb(addr) eeh_readb(addr)
+#define readw(addr) eeh_readw(addr)
+#define readl(addr) eeh_readl(addr)
+#define readq(addr) eeh_readq(addr)
+#define writeb(data, addr) eeh_writeb((data), (addr))
+#define writew(data, addr) eeh_writew((data), (addr))
+#define writel(data, addr) eeh_writel((data), (addr))
+#define writeq(data, addr) eeh_writeq((data), (addr))
+#define inb(port) eeh_inb((unsigned long)port)
+#define outb(val, port) eeh_outb(val, (unsigned long)port)
+#define inw(port) eeh_inw((unsigned long)port)
+#define outw(val, port) eeh_outw(val, (unsigned long)port)
+#define inl(port) eeh_inl((unsigned long)port)
+#define outl(val, port) eeh_outl(val, (unsigned long)port)
+
#define readb_relaxed(addr) readb(addr)
#define readw_relaxed(addr) readw(addr)
#define readl_relaxed(addr) readl(addr)
@@ -258,7 +268,7 @@ #define iobarrier_w() eieio()
* and should not be used directly by device drivers. Use inb/readb
* instead.
*/
-static inline int in_8(const volatile unsigned char __iomem *addr)
+static inline int __in_8(const volatile unsigned char __iomem *addr)
{
int ret;
@@ -267,14 +277,14 @@ static inline int in_8(const volatile un
return ret;
}
-static inline void out_8(volatile unsigned char __iomem *addr, int val)
+static inline void __out_8(volatile unsigned char __iomem *addr, int val)
{
__asm__ __volatile__("sync; stb%U0%X0 %1,%0"
: "=m" (*addr) : "r" (val));
get_paca()->io_sync = 1;
}
-static inline int in_le16(const volatile unsigned short __iomem *addr)
+static inline int __in_le16(const volatile unsigned short __iomem *addr)
{
int ret;
@@ -283,7 +293,7 @@ static inline int in_le16(const volatile
return ret;
}
-static inline int in_be16(const volatile unsigned short __iomem *addr)
+static inline int __in_be16(const volatile unsigned short __iomem *addr)
{
int ret;
@@ -292,21 +302,21 @@ static inline int in_be16(const volatile
return ret;
}
-static inline void out_le16(volatile unsigned short __iomem *addr, int val)
+static inline void __out_le16(volatile unsigned short __iomem *addr, int val)
{
__asm__ __volatile__("sync; sthbrx %1,0,%2"
: "=m" (*addr) : "r" (val), "r" (addr));
get_paca()->io_sync = 1;
}
-static inline void out_be16(volatile unsigned short __iomem *addr, int val)
+static inline void __out_be16(volatile unsigned short __iomem *addr, int val)
{
__asm__ __volatile__("sync; sth%U0%X0 %1,%0"
: "=m" (*addr) : "r" (val));
get_paca()->io_sync = 1;
}
-static inline unsigned in_le32(const volatile unsigned __iomem *addr)
+static inline unsigned __in_le32(const volatile unsigned __iomem *addr)
{
unsigned ret;
@@ -315,7 +325,7 @@ static inline unsigned in_le32(const vol
return ret;
}
-static inline unsigned in_be32(const volatile unsigned __iomem *addr)
+static inline unsigned __in_be32(const volatile unsigned __iomem *addr)
{
unsigned ret;
@@ -324,21 +334,21 @@ static inline unsigned in_be32(const vol
return ret;
}
-static inline void out_le32(volatile unsigned __iomem *addr, int val)
+static inline void __out_le32(volatile unsigned __iomem *addr, int val)
{
__asm__ __volatile__("sync; stwbrx %1,0,%2" : "=m" (*addr)
: "r" (val), "r" (addr));
get_paca()->io_sync = 1;
}
-static inline void out_be32(volatile unsigned __iomem *addr, int val)
+static inline void __out_be32(volatile unsigned __iomem *addr, int val)
{
__asm__ __volatile__("sync; stw%U0%X0 %1,%0"
: "=m" (*addr) : "r" (val));
get_paca()->io_sync = 1;
}
-static inline unsigned long in_le64(const volatile unsigned long __iomem *addr)
+static inline unsigned long __in_le64(const volatile unsigned long __iomem *addr)
{
unsigned long tmp, ret;
@@ -358,7 +368,7 @@ static inline unsigned long in_le64(cons
return ret;
}
-static inline unsigned long in_be64(const volatile unsigned long __iomem *addr)
+static inline unsigned long __in_be64(const volatile unsigned long __iomem *addr)
{
unsigned long ret;
@@ -367,7 +377,7 @@ static inline unsigned long in_be64(cons
return ret;
}
-static inline void out_le64(volatile unsigned long __iomem *addr, unsigned long val)
+static inline void __out_le64(volatile unsigned long __iomem *addr, unsigned long val)
{
unsigned long tmp;
@@ -385,15 +395,13 @@ static inline void out_le64(volatile uns
get_paca()->io_sync = 1;
}
-static inline void out_be64(volatile unsigned long __iomem *addr, unsigned long val)
+static inline void __out_be64(volatile unsigned long __iomem *addr, unsigned long val)
{
__asm__ __volatile__("sync; std%U0%X0 %1,%0" : "=m" (*addr) : "r" (val));
get_paca()->io_sync = 1;
}
-#ifndef CONFIG_PPC_ISERIES
#include <asm/eeh.h>
-#endif
/**
* check_signature - find BIOS signatures
@@ -409,7 +417,6 @@ static inline int check_signature(const
const unsigned char *signature, int length)
{
int retval = 0;
-#ifndef CONFIG_PPC_ISERIES
do {
if (readb(io_addr) != *signature)
goto out;
@@ -419,7 +426,6 @@ #ifndef CONFIG_PPC_ISERIES
} while (length);
retval = 1;
out:
-#endif
return retval;
}
diff --git a/include/asm-powerpc/iseries/iseries_io.h b/include/asm-powerpc/iseries/iseries_io.h
deleted file mode 100644
index f29009b..0000000
--- a/include/asm-powerpc/iseries/iseries_io.h
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef _ASM_POWERPC_ISERIES_ISERIES_IO_H
-#define _ASM_POWERPC_ISERIES_ISERIES_IO_H
-
-
-#ifdef CONFIG_PPC_ISERIES
-#include <linux/types.h>
-/*
- * Created by Allan Trautman on Thu Dec 28 2000.
- *
- * Remaps the io.h for the iSeries Io
- * Copyright (C) 2000 Allan H Trautman, IBM Corporation
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the:
- * Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307 USA
- *
- * Change Activity:
- * Created December 28, 2000
- * End Change Activity
- */
-
-#ifdef CONFIG_PCI
-extern u8 iSeries_Read_Byte(const volatile void __iomem * IoAddress);
-extern u16 iSeries_Read_Word(const volatile void __iomem * IoAddress);
-extern u32 iSeries_Read_Long(const volatile void __iomem * IoAddress);
-extern void iSeries_Write_Byte(u8 IoData, volatile void __iomem * IoAddress);
-extern void iSeries_Write_Word(u16 IoData, volatile void __iomem * IoAddress);
-extern void iSeries_Write_Long(u32 IoData, volatile void __iomem * IoAddress);
-
-extern void iSeries_memset_io(volatile void __iomem *dest, char x, size_t n);
-extern void iSeries_memcpy_toio(volatile void __iomem *dest, void *source,
- size_t n);
-extern void iSeries_memcpy_fromio(void *dest,
- const volatile void __iomem *source, size_t n);
-#else
-static inline u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
-{
- return 0xff;
-}
-
-static inline void iSeries_Write_Byte(u8 IoData,
- volatile void __iomem *IoAddress)
-{
-}
-#endif /* CONFIG_PCI */
-
-#endif /* CONFIG_PPC_ISERIES */
-#endif /* _ASM_POWERPC_ISERIES_ISERIES_IO_H */
--
1.4.2.1
^ permalink raw reply related
* Re: how an application program utilizes the driver.
From: Ming Liu @ 2006-09-21 8:13 UTC (permalink / raw)
To: dwh, jdub; +Cc: linuxppc-embedded
In-Reply-To: <451168F6.3030701@ovro.caltech.edu>
Dear Dave and Josh,
Thanks so much for your suggestion first.
Yes, it looks that I am really a beginner and there are so many points I
cannot understand well. So I will follow your suggestions and go through
those material first...
In fact, I am reading LDD3 now. However, it seems that the book is mainly
focused on the driver part and there is not some chapter to tell how apps
work with drivers. So after a rough glance, I still have much confusion. :(
I will read more to understand this topic. Thanks for your help again.
Regards
Ming
>From: David Hawkins <dwh@ovro.caltech.edu>
>To: Ming Liu <eemingliu@hotmail.com>
>CC: linuxppc-embedded@ozlabs.org
>Subject: Re: how an application program utilizes the driver.
>Date: Wed, 20 Sep 2006 09:14:46 -0700
>
>Hi Ming,
>
> > My situation is: I want to write a driver for my custom device.(In the
> > driver there are some functions defined to read or write my device.)
Then
> > in my application program, I use these defined functions to operate my
> > hardware device. I think this is a normal process to operate the
hardware
> > with driver+app, right?
>
>Right, but you've missed a few critical points.
>
>For your custom device, you'll create a driver that implements
>*kernel space* functions my_driver_open(), read(), write(), close()
>etc. You'll install that module and create an appropriate
>device node, eg. /dev/my_driver.
>
>In your *user-space* application code, you'll open that device
>
>int main(argc, argv) ...
>
> int fd = open("/dev/my_driver" ...)
>
>
>and then write to your device ...
>
> int write(fd, buffer, len);
>
>or read from your device ...
>
> int read(fd, buffer, len);
>
>The user-space calls open, read, write eventually call down into
>your driver space code. The driver and application are not
>linked, they communicate via the /dev interface.
>
>You really should read through Linux Device Drivers by Rubini,
>or check out a tutorial such as
>
>http://www.ovro.caltech.edu/~dwh/correlator/pdf/LNX-723-Hawkins.pdf
>http://www.ovro.caltech.edu/~dwh/correlator/software/driver_design.tar.gz
>http://www.ovro.caltech.edu/~dwh/correlator/index.html
>
>Regards,
>Dave
>
>
>
>
>
>
_________________________________________________________________
享用世界上最大的电子邮件系统― MSN Hotmail。 http://www.hotmail.com
^ permalink raw reply
* [PATCH] Remove DISCONTIGMEM cruft from page.h
From: Michael Ellerman @ 2006-09-21 8:21 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
This looks like cruft to me, these functions don't exist AFAICT,
and I can't see that it's possible to even enable DISCONTIGMEM on
powerpc anymore. CC'ing some folks who might know better, based on
the who-touched-it-last principle.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
include/asm-powerpc/page.h | 6 ------
1 file changed, 6 deletions(-)
Index: to-merge/include/asm-powerpc/page.h
===================================================================
--- to-merge.orig/include/asm-powerpc/page.h
+++ to-merge/include/asm-powerpc/page.h
@@ -55,12 +55,6 @@
#define PAGE_OFFSET ASM_CONST(CONFIG_KERNEL_START)
#define KERNELBASE (PAGE_OFFSET + PHYSICAL_START)
-#ifdef CONFIG_DISCONTIGMEM
-#define page_to_pfn(page) discontigmem_page_to_pfn(page)
-#define pfn_to_page(pfn) discontigmem_pfn_to_page(pfn)
-#define pfn_valid(pfn) discontigmem_pfn_valid(pfn)
-#endif
-
#ifdef CONFIG_FLATMEM
#define pfn_valid(pfn) ((pfn) < max_mapnr)
#endif
^ permalink raw reply
* Re: MPC5200b kernel module memory mapping
From: sudheer @ 2006-09-21 8:47 UTC (permalink / raw)
To: Steven Kaiser; +Cc: linuxppc-embedded
In-Reply-To: <000001c6dd12$417d7a50$6e4ec880@volt>
Hi Stevenson Kaiser,
Steven Kaiser wrote:
> #define MPC5xxx_MM_IPBI (MPC5xxx_MBAR + 0x0054)
>
> void *ioaddr = NULL;
>
>
> // map our physical address into kernal virtual address space
> // do I need this call?
> ioaddr = ioremap(MALab_MM_START,MALab_MM_SIZE);
>
>
Try typecasting. ioaddr = (u16 *)ioremap (start, size );
Regards
Sudheer
> return 0;
> }
>
> Later (in a ioctrl routine), I will try and write something to the first
> location in my address range. I tried these three ways:
>
> *(volatile u16 *)MALab_MM_START = 0x5555;
> outw(0x5555,MALab_MM_START);
> outw(0x5555,ioaddr);
>
> Any and all of the these calls crash the kernel so horrendously I have to
> reboot. Sometimes I have to delete and mknod a new /dev entry.
>
> I have tried the io memory map technique instead of the above io port map
> technique, using request_mem_region(), with the same crashing results upon
> any writew() call or direct variants. I tried things without the ioremap()
> call-- I get a segmentation fault in these cases.
>
> The request_region() or request_mem_region() seems to work ok. I can cat
> /proc/iomem or /proc/ioports and see my range in there. I am pretty sure I
> am setting up the LocalBus chip select registers ok.
>
> Yet obviously I am doing something profoundly stupid. Is my error obvious?
> Can someone enlighten me in my darkness?
>
> Steven Kaiser
> Chemistry Electronics Facility
> University of California, Irvine
> 2347 Natural Sciences 2
> Irvine, CA 92697-2025
> (949)824-7520
>
>
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>
>
^ permalink raw reply
* Re: I2C: Getting Compiation Error for application program
From: Matthias Fuchs @ 2006-09-21 9:13 UTC (permalink / raw)
To: linuxppc-embedded; +Cc: Sachin Rane
In-Reply-To: <8584FDC94AFF7640B17B8A89B23B19B34F6571@sbsserver.AlphionCorp.local>
On Wednesday 20 September 2006 14:51, Sachin Rane wrote:
> Hi,
>
> I am trying to compile simple program (appended), but getting lots of
compilation error.
It's always helpful to see the compiler output. Could you post it?
> I am using Timesys Linux 2.6.13 for ppc440 evaluation board.
>
> Command used for compilation:
> $> gcc eeprom-client.c -o eeprom-client.o
Are you crosscompiling? Doesn't look like that...
>
> Could you help me to find out the reason behind getting the errors?
>
> Regards,
> Sachin Rane
>
>
>
8< ------------------------eeprom-client.c -------------------------------------------------------------------------------------
>
> #include <linux/i2c.h>
> #include <linux/i2c-dev.h>
>
> int main()
> {
> int file;
> int adapter_nr = 0; /* probably dynamically determined */
> char filename[20];
> int addr = 0xA1; /* The I2C address */
You propably have to use 0x50 here.
>
> sprintf(filename,"/dev/i2c-%d",adapter_nr);
> if ((file = open(filename,O_RDWR)) < 0)
> {
> exit(1);
> }
>
> if (ioctl(file,I2C_SLAVE,addr) < 0)
> {
> exit(1);
> }
> else
> {
> printf("\n Able to bind the adapter");
> }
> return 0;
> }
Matthias
^ permalink raw reply
* what's the difference between portwidth & chipwidth
From: enorm @ 2006-09-21 9:33 UTC (permalink / raw)
To: linuxppc-embedded
Hi,
what's the difference between portwidth & chipwidth in file cif_flash.c?
what does "8M × 8 BITS" mean?
Best regards
enorm
^ permalink raw reply
* RE: what's the difference between portwidth & chipwidth
From: Liu Dave-r63238 @ 2006-09-21 9:38 UTC (permalink / raw)
To: enorm, linuxppc-embedded
In-Reply-To: <004c01c6dd60$f4fa4880$a309a8c0@enorm>
> what's the difference between portwidth & chipwidth in file=20
> cif_flash.c?=20
Assuming the system has 4 flash chips, and each flash chip is 16 bits =
witdh.
So, the portwidth is 64bits, that is 4 *16. the chipwidth is 16bits.
> what does "8M =D7 8 BITS" mean?
Looks up some flash datasheet, you will perfect know what is the =
meaning.
-Dave
^ permalink raw reply
* [PATCH] powerpc: fix building gdb against asm/ptrace.h
From: Arnd Bergmann @ 2006-09-21 10:29 UTC (permalink / raw)
To: linuxppc-dev
Cc: Ulrich Weigand, Anton Blanchard, Paul Mackerras, David Woodhouse
Ulrich Weigand found a bug with the current version of the
asm-powerpc/ptrace.h that prevents building at least the
SPU target version of gdb, since some ptrace opcodes are
not defined.
The problem seems to have originated in the merging of 32 and
64 bit versions of that file, the problem is that some opcodes
are only valid on 64 bit kernels, but are also used by 32 bit
programs, so they can't depends on the __powerpc64__ symbol.
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
--- a/include/asm-powerpc/ptrace.h
+++ b/include/asm-powerpc/ptrace.h
@@ -215,12 +215,10 @@ do { \
#define PTRACE_GETVRREGS 18
#define PTRACE_SETVRREGS 19
-#ifndef __powerpc64__
/* Get/set all the upper 32-bits of the SPE registers, accumulator, and
* spefscr, in one go */
#define PTRACE_GETEVRREGS 20
#define PTRACE_SETEVRREGS 21
-#endif /* __powerpc64__ */
/*
* Get or set a debug register. The first 16 are DABR registers and the
@@ -235,7 +233,6 @@ do { \
#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */
#define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */
-#ifdef __powerpc64__
/* Calls to trace a 64bit program from a 32bit program */
#define PPC_PTRACE_PEEKTEXT_3264 0x95
#define PPC_PTRACE_PEEKDATA_3264 0x94
@@ -243,6 +240,5 @@ do { \
#define PPC_PTRACE_POKEDATA_3264 0x92
#define PPC_PTRACE_PEEKUSR_3264 0x91
#define PPC_PTRACE_POKEUSR_3264 0x90
-#endif /* __powerpc64__ */
#endif /* _ASM_POWERPC_PTRACE_H */
^ permalink raw reply
* [RFC/PATCH] Create a "wrapper" script and use it in arch/powerpc/boot
From: Paul Mackerras @ 2006-09-21 10:58 UTC (permalink / raw)
To: linuxppc-dev
This puts the knowledge of how to create various sorts of zImage
wrappers into a script called "wrapper" that could be used outside of
the kernel tree. This also changes arch/powerpc/boot so it first
builds the files that the wrapper script needs, then runs it to create
whatever flavours of zImage are required.
I haven't merged the uImage building stuff into this framework yet -
somebody want to send me a patch to do that?
Also, this probably doesn't do the right thing for maple, cell, etc.
Another point to note is that this renames the images: the one for
pSeries is called zImage.pseries rather than zImage, and the one for
powermacs is now zImage.pmac rather than zImage.vmode.
Signed-off-by: Paul Mackerras <paulus@samba.org>
---
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 01667d1..2bfb7ee 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -20,6 +20,7 @@ CROSS32_COMPILE ?=
CROSS32CC := $(CROSS32_COMPILE)gcc
CROSS32AS := $(CROSS32_COMPILE)as
CROSS32LD := $(CROSS32_COMPILE)ld
+CROSS32AR := $(CROSS32_COMPILE)ar
CROSS32OBJCOPY := $(CROSS32_COMPILE)objcopy
ifeq ($(HAS_BIARCH),y)
@@ -28,10 +29,11 @@ CROSS32CC := $(CC) -m32
CROSS32AS := $(AS) -a32
CROSS32LD := $(LD) -m elf32ppc
CROSS32OBJCOPY := $(OBJCOPY)
+CROSS32AR := $(AR)
endif
endif
-export CROSS32CC CROSS32AS CROSS32LD CROSS32OBJCOPY
+export CROSS32CC CROSS32AS CROSS32LD CROSS32AR CROSS32OBJCOPY
KBUILD_DEFCONFIG := $(shell uname -m)_defconfig
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index e737741..95b0cdf 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -20,33 +20,34 @@ # To make it easier to setup a cross com
# CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE
# in the toplevel makefile.
+all: $(obj)/zImage
HOSTCC := gcc
BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \
$(shell $(CROSS32CC) -print-file-name=include) -fPIC
BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
-OBJCOPYFLAGS := contents,alloc,load,readonly,data
-OBJCOPY_COFF_ARGS := -O aixcoff-rs6000 --set-start 0x500000
-OBJCOPY_MIB_ARGS := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
+
+ifeq ($(call cc-option-yn, -fstack-protector),y)
+BOOTCFLAGS += -fno-stack-protector
+endif
+
+BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj)
zlib := inffast.c inflate.c inftrees.c
zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h
zliblinuxheader := zlib.h zconf.h zutil.h
-$(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader))
-#$(addprefix $(obj)/,main.o): $(addprefix $(obj)/,zlib.h)
+$(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) \
+ $(addprefix $(obj)/,$(zlibheader))
+
+src-wlib := string.S stdio.c main.c div64.S $(zlib)
+src-plat := of.c
+src-boot := crt0.S $(src-wlib) $(src-plat) empty.c
-src-boot-$(CONFIG_PPC_MULTIPLATFORM) := of.c
-src-boot := crt0.S string.S stdio.c main.c div64.S $(src-boot-y)
-src-boot += $(zlib)
src-boot := $(addprefix $(obj)/, $(src-boot))
obj-boot := $(addsuffix .o, $(basename $(src-boot)))
-
-ifeq ($(call cc-option-yn, -fstack-protector),y)
-BOOTCFLAGS += -fno-stack-protector
-endif
-
-BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj)
+obj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib))))
+obj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat))))
quiet_cmd_copy_zlib = COPY $@
cmd_copy_zlib = sed "s@__attribute_used__@@;s@<linux/\([^>]\+\).*@\"\1\"@" $< > $@
@@ -66,8 +67,14 @@ quiet_cmd_copy_zliblinuxheader = COPY
$(addprefix $(obj)/,$(zliblinuxheader)): $(obj)/%: $(srctree)/include/linux/%
$(call cmd,copy_zliblinuxheader)
-clean-files := $(zlib) $(zlibheader) $(zliblinuxheader)
+$(obj)/empty.c:
+ @touch $@
+$(obj)/zImage.lds $(obj)/zImage.coff.lds: $(obj)/%: $(srctree)/$(src)/%.S
+ @cp $< $@
+
+clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \
+ $(obj)/empty.c
quiet_cmd_bootcc = BOOTCC $@
cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
@@ -75,114 +82,86 @@ quiet_cmd_bootcc = BOOTCC $@
quiet_cmd_bootas = BOOTAS $@
cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
-quiet_cmd_bootld = BOOTLD $@
- cmd_bootld = $(CROSS32LD) -T $(srctree)/$(src)/$(3) -o $@ $(2)
+quiet_cmd_bootar = BOOTAR $@
+ cmd_bootar = $(CROSS32AR) -cr $@.$$$$ $^; mv $@.$$$$ $@
$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c
$(call if_changed_dep,bootcc)
$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S
$(call if_changed_dep,bootas)
-#-----------------------------------------------------------
-# ELF sections within the zImage bootloader/wrapper
-#-----------------------------------------------------------
-required := vmlinux.strip
-initrd := initrd
+$(obj)/wrapper.a: $(obj-wlib)
+ $(call cmd,bootar)
-obj-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.o, $(section)))
-src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section)))
-gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section)))
+hostprogs-y := addnote addRamDisk hack-coff
-hostprogs-y := addnote addRamDisk hack-coff
+extra-y := $(obj)/crt0.o $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
+ $(obj)/zImage.lds $(obj)/zImage.coff.lds
-targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd \
- zImage.coff zImage.initrd.coff miboot.image miboot.initrd.image \
- $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
- $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
- $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \
- vmlinux.initrd dummy.o
-extra-y := initrd.o
+wrapper :=$(srctree)/$(src)/wrapper
+wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff)
-quiet_cmd_ramdisk = RAMDISK $@
- cmd_ramdisk = $(obj)/addRamDisk $(obj)/ramdisk.image.gz $< $@
+#############
+# Bits for building various flavours of zImage
-quiet_cmd_stripvm = STRIP $@
- cmd_stripvm = $(STRIP) -s -R .comment $< -o $@
+ifneq ($(CROSS32_COMPILE),)
+CROSSWRAP := -C $(CROSS32_COMPILE)
+else
+ifneq ($(CROSS_COMPILE),)
+CROSSWRAP := -C $(CROSS_COMPILE)
+endif
+endif
-vmlinux.strip: vmlinux
- $(call if_changed,stripvm)
-$(obj)/vmlinux.initrd: vmlinux.strip $(obj)/addRamDisk $(obj)/ramdisk.image.gz
- $(call if_changed,ramdisk)
+quiet_cmd_wrap = WRAP $@
+ cmd_wrap =$(wrapper) -c -o $@ -p $2 $(CROSSWRAP) vmlinux
+quiet_cmd_wrap_initrd = WRAP $@
+ cmd_wrap_initrd =$(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \
+ -i $(obj)/ramdisk.image.gz vmlinux
-quiet_cmd_addsection = ADDSEC $@
- cmd_addsection = $(CROSS32OBJCOPY) $@ \
- --add-section=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $@))=$(patsubst %.o,%.gz, $@) \
- --set-section-flags=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $@))=$(OBJCOPYFLAGS)
+$(obj)/zImage.chrp: vmlinux $(wrapperbits)
+ $(call cmd,wrap,chrp)
-quiet_cmd_addnote = ADDNOTE $@
- cmd_addnote = $(obj)/addnote $@
+$(obj)/zImage.initrd.chrp: vmlinux $(wrapperbits)
+ $(call cmd,wrap_initrd,chrp)
-quiet_cmd_gen-miboot = GEN $@
- cmd_gen-miboot = $(OBJCOPY) $(OBJCOPY_MIB_ARGS) \
- --add-section=$1=$(word 2, $^) $< $@
+$(obj)/zImage.pseries: vmlinux $(wrapperbits)
+ $(call cmd,wrap,pseries)
-quiet_cmd_gencoff = COFF $@
- cmd_gencoff = $(OBJCOPY) $(OBJCOPY_COFF_ARGS) $@ && \
- $(obj)/hack-coff $@
+$(obj)/zImage.initrd.pseries: vmlinux $(wrapperbits)
+ $(call cmd,wrap_initrd,pseries)
-$(call gz-sec, $(required)): $(obj)/kernel-%.gz: %
- $(call if_changed,gzip)
+$(obj)/zImage.pmac: vmlinux $(wrapperbits)
+ $(call cmd,wrap,pmac)
-$(obj)/kernel-initrd.gz: $(obj)/ramdisk.image.gz
- cp -f $(obj)/ramdisk.image.gz $@
+$(obj)/zImage.initrd.pmac: vmlinux $(wrapperbits)
+ $(call cmd,wrap_initrd,pmac)
-$(call src-sec, $(required) $(initrd)): $(obj)/kernel-%.c: $(obj)/kernel-%.gz
- @touch $@
+$(obj)/zImage.coff: vmlinux $(wrapperbits)
+ $(call cmd,wrap,pmaccoff)
-$(call obj-sec, $(required) $(initrd)): $(obj)/kernel-%.o: $(obj)/kernel-%.c
- $(call if_changed_dep,bootcc)
- $(call cmd,addsection)
+$(obj)/zImage.initrd.coff: vmlinux $(wrapperbits)
+ $(call cmd,wrap_initrd,pmaccoff)
-$(obj)/zImage.vmode $(obj)/zImage.coff: obj-boot += $(call obj-sec, $(required))
-$(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) $(srctree)/$(src)/zImage.lds
- $(call cmd,bootld,$(obj-boot),zImage.lds)
+$(obj)/zImage.miboot: vmlinux $(wrapperbits)
+ $(call cmd,wrap,miboot)
-$(obj)/zImage.initrd.vmode $(obj)/zImage.initrd.coff: obj-boot += $(call obj-sec, $(required) $(initrd))
-$(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(srctree)/$(src)/zImage.lds
- $(call cmd,bootld,$(obj-boot),zImage.lds)
+$(obj)/zImage.initrd.miboot: vmlinux $(wrapperbits)
+ $(call cmd,wrap_initrd,miboot)
+
+image-$(CONFIG_PPC_PSERIES) += zImage.pseries
+image-$(CONFIG_PPC_PMAC) += zImage.pmac
+image-$(CONFIG_PPC_CHRP) += zImage.chrp
# For 32-bit powermacs, build the COFF and miboot images
# as well as the ELF images.
-coffimage-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/zImage.coff
-coffrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/zImage.initrd.coff
-mibootimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/miboot.image
-mibrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/miboot.initrd.image
-
-$(obj)/zImage: $(obj)/zImage.vmode $(obj)/addnote $(coffimage-y-y) \
- $(mibootimg-y-y)
- @cp -f $< $@
- $(call if_changed,addnote)
-
-$(obj)/zImage.initrd: $(obj)/zImage.initrd.vmode $(obj)/addnote \
- $(coffrdimg-y-y) $(mibrdimg-y-y)
- @cp -f $< $@
- $(call if_changed,addnote)
-
-$(obj)/zImage.coff: $(call obj-sec, $(required)) $(obj-boot) \
- $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff
- $(call cmd,bootld,$(obj-boot),zImage.coff.lds)
- $(call cmd,gencoff)
-
-$(obj)/zImage.initrd.coff: $(call obj-sec, $(required) $(initrd)) $(obj-boot) \
- $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff
- $(call cmd,bootld,$(obj-boot),zImage.coff.lds)
- $(call cmd,gencoff)
+ifeq ($(CONFIG_PPC32),y)
+image-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot
+endif
-$(obj)/miboot.image: $(obj)/dummy.o $(obj)/vmlinux.gz
- $(call cmd,gen-miboot,image)
+initrd-y := $(patsubst zImage.%, zImage.initrd.%, $(image-y))
-$(obj)/miboot.initrd.image: $(obj)/miboot.image $(images)/ramdisk.image.gz
- $(call cmd,gen-miboot,initrd)
+$(obj)/zImage: $(addprefix $(obj)/, $(image-y))
+$(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y))
#-----------------------------------------------------------
# build u-boot images
@@ -217,4 +196,4 @@ extra-y += vmlinux.bin vmlinux.gz
install: $(CONFIGURE) $(BOOTIMAGE)
sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" "$(BOOTIMAGE)"
-clean-files += $(addprefix $(objtree)/, $(obj-boot) vmlinux.strip)
+clean-files += $(addprefix $(objtree)/, $(obj-boot) vmlinux.strip.gz)
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
new file mode 100755
index 0000000..98dc8b0
--- /dev/null
+++ b/arch/powerpc/boot/wrapper
@@ -0,0 +1,191 @@
+#!/bin/sh
+
+# Copyright (C) 2006 Paul Mackerras, IBM Corporation <paulus@samba.org>
+# This program may be used under the terms of version 2 of the GNU
+# General Public License.
+
+# This script takes a kernel binary and optionally an initrd image
+# and/or a device-tree blob, and creates a bootable zImage for a
+# given platform.
+
+# Options:
+# -o zImage specify output file
+# -p platform specify platform (links in $platform.o)
+# -i initrd specify initrd file
+# -d devtree specify device-tree blob
+# -s tree.dts specify device-tree source file (needs dtc installed)
+# -c cache $kernel.strip.gz (use if present & newer, else make)
+# -C prefix specify command prefix for cross-building tools
+# (strip, objcopy, ld)
+# -D dir specify directory containing data files used by script
+# (default ./arch/powerpc/boot)
+# -W dir specify working directory for temporary files (default .)
+
+# defaults
+kernel=
+ofile=zImage
+platform=of
+initrd=
+dtb=
+dts=
+cacheit=
+
+# cross-compilation prefix
+CROSS=
+
+# directory for object and other files used by this script
+object=arch/powerpc/boot
+
+# directory for working files
+tmpdir=.
+
+usage() {
+ echo 'Usage: wrapper [-o output] [-p platform] [-i initrd]' >&2
+ echo ' [-d devtree] [-s tree.dts] [-c] [-C cross-prefix]' >&2
+ echo ' [-D datadir] [-W workingdir] [vmlinux]' >&2
+ exit 1
+}
+
+while [ "$#" -gt 0 ]; do
+ case "$1" in
+ -o)
+ shift
+ [ "$#" -gt 0 ] || usage
+ ofile="$1"
+ ;;
+ -p)
+ shift
+ [ "$#" -gt 0 ] || usage
+ platform="$1"
+ ;;
+ -i)
+ shift
+ [ "$#" -gt 0 ] || usage
+ initrd="$1"
+ ;;
+ -d)
+ shift
+ [ "$#" -gt 0 ] || usage
+ dtb="$1"
+ ;;
+ -s)
+ shift
+ [ "$#" -gt 0 ] || usage
+ dts="$1"
+ ;;
+ -c)
+ cacheit=y
+ ;;
+ -C)
+ shift
+ [ "$#" -gt 0 ] || usage
+ CROSS="$1"
+ ;;
+ -D)
+ shift
+ [ "$#" -gt 0 ] || usage
+ object="$1"
+ ;;
+ -W)
+ shift
+ [ "$#" -gt 0 ] || usage
+ tmpdir="$1"
+ ;;
+ -?)
+ usage
+ ;;
+ *)
+ [ -z "$kernel" ] || usage
+ kernel="$1"
+ ;;
+ esac
+ shift
+done
+
+if [ -n "$dts" ]; then
+ if [ -z "$dtb" ]; then
+ dtb="$platform.dtb"
+ fi
+ dtc -O dtb -o "$dtb" -b 0 -V 16 "$dts" || exit 1
+fi
+
+if [ -z "$kernel" ]; then
+ kernel=vmlinux
+fi
+
+platformo=$object/"$platform".o
+lds=$object/zImage.lds
+
+case "$platform" in
+pmac|pseries|chrp)
+ platformo=$object/of.o
+ ;;
+pmaccoff)
+ platformo=$object/of.o
+ lds=$object/zImage.coff.lds
+ ;;
+miboot)
+ # this is quite different...
+ tmpvm=$tmpdir/vmlinux.bin.$$
+ ${CROSS}objcopy -O binary "$kernel" $tmpvm
+ gzip -f -9 $tmpvm
+ tmpir=
+ if [ -n "$initrd" ]; then
+ tmpir=--add-section=initrd="$initrd"
+ fi
+ ${CROSS}objcopy -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment \
+ --add-section=image=$tmpvm.gz $tmpir \
+ $object/empty.o "$ofile"
+ rm $tmpvm.gz
+ exit 0
+esac
+
+tmp=$tmpdir/zImage.$$.o
+cp $object/empty.o $tmp
+
+addsec() {
+ ${CROSS}objcopy $1 \
+ --add-section=.kernel:$3="$2" \
+ --set-section-flags=.kernel:$3=contents,alloc,load,readonly,data
+}
+
+if [ -n "$cacheit" ]; then
+ vmz="$tmpdir/`basename \"$kernel\"`.strip"
+ if [ ! -f "$vmz.gz" -o "$vmz.gz" -ot "$kernel" ]; then
+ cp "$kernel" "$vmz"
+ ${CROSS}strip "$vmz"
+ gzip -f -9 "$vmz"
+ fi
+ addsec $tmp "$vmz.gz" vmlinux.strip
+else
+ tmpvmz=$tmpdir/vmlinux.$$
+ cp "$kernel" $tmpvmz
+ ${CROSS}strip $tmpvmz
+ gzip -f -9 $tmpvmz
+ addsec $tmp $tmpvmz.gz vmlinux.strip
+ rm $tmpvmz.gz
+fi
+
+if [ -n "$initrd" ]; then
+ addsec $tmp "$initrd" initrd
+fi
+
+if [ -n "$dtb" ]; then
+ addsec $tmp "$dtb" dtb
+fi
+
+${CROSS}ld -m elf32ppc -T $lds -o "$ofile" \
+ $object/crt0.o $platformo $tmp $object/wrapper.a
+
+rm $tmp
+
+# post-processing needed for some platforms
+case "$platform" in
+pseries|chrp)
+ $object/addnote "$ofile"
+ ;;
+pmaccoff)
+ ${CROSS}objcopy -O aixcoff-rs6000 --set-start 0x500000 "$ofile"
+ $object/hack-coff "$ofile"
+ ;;
+esac
diff --git a/arch/powerpc/boot/zImage.coff.lds b/arch/powerpc/boot/zImage.coff.lds
deleted file mode 100644
index 6016251..0000000
--- a/arch/powerpc/boot/zImage.coff.lds
+++ /dev/null
@@ -1,46 +0,0 @@
-OUTPUT_ARCH(powerpc:common)
-ENTRY(_start)
-SECTIONS
-{
- . = (5*1024*1024);
- _start = .;
- .text :
- {
- *(.text)
- *(.fixup)
- }
- _etext = .;
- . = ALIGN(4096);
- .data :
- {
- *(.rodata*)
- *(.data*)
- *(.sdata*)
- __got2_start = .;
- *(.got2)
- __got2_end = .;
-
- _vmlinux_start = .;
- *(.kernel:vmlinux.strip)
- _vmlinux_end = .;
-
- _initrd_start = .;
- *(.kernel:initrd)
- _initrd_end = .;
- }
-
- . = ALIGN(4096);
- _edata = .;
- __bss_start = .;
- .bss :
- {
- *(.sbss)
- *(.bss)
- }
- _end = . ;
-
- /DISCARD/ :
- {
- *(.comment)
- }
-}
diff --git a/arch/powerpc/boot/zImage.coff.lds.S b/arch/powerpc/boot/zImage.coff.lds.S
new file mode 100644
index 0000000..6016251
--- /dev/null
+++ b/arch/powerpc/boot/zImage.coff.lds.S
@@ -0,0 +1,46 @@
+OUTPUT_ARCH(powerpc:common)
+ENTRY(_start)
+SECTIONS
+{
+ . = (5*1024*1024);
+ _start = .;
+ .text :
+ {
+ *(.text)
+ *(.fixup)
+ }
+ _etext = .;
+ . = ALIGN(4096);
+ .data :
+ {
+ *(.rodata*)
+ *(.data*)
+ *(.sdata*)
+ __got2_start = .;
+ *(.got2)
+ __got2_end = .;
+
+ _vmlinux_start = .;
+ *(.kernel:vmlinux.strip)
+ _vmlinux_end = .;
+
+ _initrd_start = .;
+ *(.kernel:initrd)
+ _initrd_end = .;
+ }
+
+ . = ALIGN(4096);
+ _edata = .;
+ __bss_start = .;
+ .bss :
+ {
+ *(.sbss)
+ *(.bss)
+ }
+ _end = . ;
+
+ /DISCARD/ :
+ {
+ *(.comment)
+ }
+}
diff --git a/arch/powerpc/boot/zImage.lds b/arch/powerpc/boot/zImage.lds
deleted file mode 100644
index 4b6bb3f..0000000
--- a/arch/powerpc/boot/zImage.lds
+++ /dev/null
@@ -1,46 +0,0 @@
-OUTPUT_ARCH(powerpc:common)
-ENTRY(_zimage_start)
-SECTIONS
-{
- . = (4*1024*1024);
- _start = .;
- .text :
- {
- *(.text)
- *(.fixup)
- }
- _etext = .;
- . = ALIGN(4096);
- .data :
- {
- *(.rodata*)
- *(.data*)
- *(.sdata*)
- __got2_start = .;
- *(.got2)
- __got2_end = .;
- }
-
- . = ALIGN(4096);
- _vmlinux_start = .;
- .kernel:vmlinux.strip : { *(.kernel:vmlinux.strip) }
- _vmlinux_end = .;
-
- . = ALIGN(4096);
- _initrd_start = .;
- .kernel:initrd : { *(.kernel:initrd) }
- _initrd_end = .;
-
- . = ALIGN(4096);
- _edata = .;
-
- . = ALIGN(4096);
- __bss_start = .;
- .bss :
- {
- *(.sbss)
- *(.bss)
- }
- . = ALIGN(4096);
- _end = . ;
-}
diff --git a/arch/powerpc/boot/zImage.lds.S b/arch/powerpc/boot/zImage.lds.S
new file mode 100644
index 0000000..4b6bb3f
--- /dev/null
+++ b/arch/powerpc/boot/zImage.lds.S
@@ -0,0 +1,46 @@
+OUTPUT_ARCH(powerpc:common)
+ENTRY(_zimage_start)
+SECTIONS
+{
+ . = (4*1024*1024);
+ _start = .;
+ .text :
+ {
+ *(.text)
+ *(.fixup)
+ }
+ _etext = .;
+ . = ALIGN(4096);
+ .data :
+ {
+ *(.rodata*)
+ *(.data*)
+ *(.sdata*)
+ __got2_start = .;
+ *(.got2)
+ __got2_end = .;
+ }
+
+ . = ALIGN(4096);
+ _vmlinux_start = .;
+ .kernel:vmlinux.strip : { *(.kernel:vmlinux.strip) }
+ _vmlinux_end = .;
+
+ . = ALIGN(4096);
+ _initrd_start = .;
+ .kernel:initrd : { *(.kernel:initrd) }
+ _initrd_end = .;
+
+ . = ALIGN(4096);
+ _edata = .;
+
+ . = ALIGN(4096);
+ __bss_start = .;
+ .bss :
+ {
+ *(.sbss)
+ *(.bss)
+ }
+ . = ALIGN(4096);
+ _end = . ;
+}
^ permalink raw reply related
* Re: [PATCH] kdump: don't call __ioremap() for pfn = 0
From: Michael Ellerman @ 2006-09-21 11:02 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev, Fastboot mailing list, Sachin P. Sant
In-Reply-To: <451216EE.8010404@in.ibm.com>
On Thu, 2006-09-21 at 10:07 +0530, Sachin P. Sant wrote:
> Hi
>
> While using dd command to retrive the dump from /dev/oldmem, there comes
> a rare case where pfn value is zero. In this case the __ioremap() call
> returns
> NULL and hence copying fails.
>
> # dd if=/dev/oldmem of=/dev/null
> dd: reading `/dev/oldmem': Bad address
> 0+0 records in
> 0+0 records out
> 0 bytes (0 B) copied, 0.000121 seconds, 0.0 kB/s
>
> Attached is a patch to fix this problem. During such rare cases don't call
> __ioremap() to do the address translation, instead use __va() .
It's not really rare, it's just when we're reading /dev/oldmem directly.
We can actually use the __va() trick for the whole linear mapping rather
than just pfn 0, which saves the ioremap. We also shouldn't really be
trying to iounmap(__va(0)).
So perhaps something more like this? Although it's a bit ugly because of
the need to conditionally call iounmap().
Paul you said we shouldn't be using ioremap(), but I really can't find
an alternative - map_vm_area() looks close but it requires struct pages
which we don't have. And I think your main objection was a cacheable
mapping, which we're not doing anyway by calling __ioremap().
...
Fix /dev/oldmem for kdump
A change to __ioremap() broke reading /dev/oldmem because we're no
longer able to ioremap pfn 0 (d177c207ba16b1db31283e2d1fee7ad4a863584b).
We actually don't need to ioremap for anything that's part of the linear
mapping, so just read it directly.
Also make sure we're only reading one page or less at a time.
Index: to-merge/arch/powerpc/kernel/crash_dump.c
===================================================================
--- to-merge.orig/arch/powerpc/kernel/crash_dump.c
+++ to-merge/arch/powerpc/kernel/crash_dump.c
@@ -80,6 +80,20 @@ static int __init parse_savemaxmem(char
}
__setup("savemaxmem=", parse_savemaxmem);
+
+static size_t copy_oldmem_vaddr(void *vaddr, char *buf, size_t csize,
+ unsigned long offset, int userbuf)
+{
+ if (userbuf) {
+ if (copy_to_user((char __user *)buf, (vaddr + offset), csize)) {
+ return -EFAULT;
+ }
+ } else
+ memcpy(buf, (vaddr + offset), csize);
+
+ return csize;
+}
+
/**
* copy_oldmem_page - copy one page from "oldmem"
* @pfn: page frame number to be copied
@@ -101,16 +115,16 @@ ssize_t copy_oldmem_page(unsigned long p
if (!csize)
return 0;
- vaddr = __ioremap(pfn << PAGE_SHIFT, PAGE_SIZE, 0);
+ csize = min(csize, PAGE_SIZE);
- if (userbuf) {
- if (copy_to_user((char __user *)buf, (vaddr + offset), csize)) {
- iounmap(vaddr);
- return -EFAULT;
- }
- } else
- memcpy(buf, (vaddr + offset), csize);
+ if (pfn < max_pfn) {
+ vaddr = __va(pfn << PAGE_SHIFT);
+ csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf);
+ } else {
+ vaddr = __ioremap(pfn << PAGE_SHIFT, PAGE_SIZE, 0);
+ csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf);
+ iounmap(vaddr);
+ }
- iounmap(vaddr);
return csize;
}
^ permalink raw reply
* RE: I2C: Getting Compiation Error for application program
From: Sachin Rane @ 2006-09-21 11:10 UTC (permalink / raw)
To: Matthias Fuchs; +Cc: linuxppc-embedded
In-Reply-To: <200609211113.15457.matthias.fuchs@esd-electronics.com>
[-- Attachment #1: Type: text/plain, Size: 3396 bytes --]
Hello Matthias,
Thanks for the reply.
I got the reason from i2c mailing list on getting compilation errors.
A text from the I2C mailing list :
8<---------------------------------------------------------------------------------------
"All the above it caused by you including <linux/i2c.h>. As explained
before, this is a kernel-only header file, which you must _not_ include
in user-space code. You are not the only one to blame though, as in
fact this header file should not be in /usr/include at all, this is a
mistake which should be fixed "soon". "
--------------------------------------------------------------------------------------->8
Some of the error lines are appended for your reference.
Now I will do the changes in the code as per above above suggestion.
Tnaks and Regards,
Sachin Rane
> -bash-2.05b# gcc eeprom-client.c
> In file included from /usr/include/asm/div64.h:1,
> from /usr/include/linux/jiffies.h:9,
> from /usr/include/linux/sched.h:12,
> from /usr/include/linux/module.h:10,
> from /usr/include/linux/i2c.h:31,
> from eeprom-client.c:1:
> /usr/include/asm-generic/div64.h:54:3: #error do_div() does not yet support the C64
> In file included from /usr/include/linux/sched.h:12,
> from /usr/include/linux/module.h:10,
> from /usr/include/linux/i2c.h:31,
> from eeprom-client.c:1:
> /usr/include/linux/jiffies.h:84: error: parse error before "jiffies_64"
> /usr/include/linux/jiffies.h:88: error: parse error before "get_jiffies_64"
> In file included from /usr/include/linux/sched.h:12,
> from /usr/include/linux/module.h:10,
> from /usr/include/linux/i2c.h:31,
> from eeprom-
________________________________
From: Matthias Fuchs [mailto:matthias.fuchs@esd-electronics.com]
Sent: Thu 9/21/2006 5:13 AM
To: linuxppc-embedded@ozlabs.org
Cc: Sachin Rane
Subject: Re: I2C: Getting Compiation Error for application program
On Wednesday 20 September 2006 14:51, Sachin Rane wrote:
> Hi,
>
> I am trying to compile simple program (appended), but getting lots of
compilation error.
It's always helpful to see the compiler output. Could you post it?
> I am using Timesys Linux 2.6.13 for ppc440 evaluation board.
>
> Command used for compilation:
> $> gcc eeprom-client.c -o eeprom-client.o
Are you crosscompiling? Doesn't look like that...
>
> Could you help me to find out the reason behind getting the errors?
>
> Regards,
> Sachin Rane
>
>
>
8< ------------------------eeprom-client.c -------------------------------------------------------------------------------------
>
> #include <linux/i2c.h>
> #include <linux/i2c-dev.h>
>
> int main()
> {
> int file;
> int adapter_nr = 0; /* probably dynamically determined */
> char filename[20];
> int addr = 0xA1; /* The I2C address */
You propably have to use 0x50 here.
>
> sprintf(filename,"/dev/i2c-%d",adapter_nr);
> if ((file = open(filename,O_RDWR)) < 0)
> {
> exit(1);
> }
>
> if (ioctl(file,I2C_SLAVE,addr) < 0)
> {
> exit(1);
> }
> else
> {
> printf("\n Able to bind the adapter");
> }
> return 0;
> }
Matthias
[-- Attachment #2: Type: text/html, Size: 6315 bytes --]
^ permalink raw reply
* A question about power on
From: enorm @ 2006-09-21 11:11 UTC (permalink / raw)
To: linuxppc-embedded
After power on, cpu reads instruction from certain addr. But how does it
know how many bits he can read at once.
^ permalink raw reply
* Re: First cut of "wrapper" program
From: Simon Richter @ 2006-09-21 11:03 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <17681.53490.705075.155580@cargo.ozlabs.ibm.com>
Hi,
Paul Mackerras wrote:
> Here is a prototype of a "wrapper" program which will take a kernel,
> and optionally an initrd image and/or a device tree blob, and create a
> bootable zImage. My idea is that the Makefile in arch/powerpc/boot
> will construct the files that this needs, then run it one or more
> times to create whatever images are needed.
Hmm, in Debian there is a tool called mkvmlinuz that does this, which is
run in a hook script after generating an initrd.
Simon
^ permalink raw reply
* bsp for Linux kernel 2.6
From: shenbagaraj @ 2006-09-22 0:07 UTC (permalink / raw)
To: linuxppc-embedded
In-Reply-To: <4509FE5C.2070104@dlasys.net>
Hi,
I ma working on Windriver powerquicc board 8260.where do i get the required
patches for linux 2.6.11.11.
regards,
shen
^ permalink raw reply
* Re: First cut of "wrapper" program
From: Paul Mackerras @ 2006-09-21 11:41 UTC (permalink / raw)
To: Simon Richter; +Cc: linuxppc-dev
In-Reply-To: <45127177.3000408@hogyros.de>
Simon Richter writes:
> Hmm, in Debian there is a tool called mkvmlinuz that does this, which is
> run in a hook script after generating an initrd.
It doesn't handle any of the embedded formats (uImage, treeboot,
etc.). Neither does my script, but it will... It also doesn't handle
including a device-tree blob.
Paul.
^ permalink raw reply
* IDE not found on Performa due to interrupt breakage
From: Olaf Hering @ 2006-09-21 11:50 UTC (permalink / raw)
To: linuxppc-dev
The IDE controller is not usable on a Performa 6400 with 2.6.18:
<6>hda: Enabling MultiWord DMA 2
<4>ide0: Disabled unable to get IRQ 13.
<6>ide0: failed to initialize IDE interface
inst-sys:~ # cat /proc/interrupts
CPU0
18: 21329 PMAC-PIC Edge MESH
20: 0 PMAC-PIC Level NMI - XMON
23: 77585 PMAC-PIC Level eth0
27: 5733 PMAC-PIC Edge ADB
BAD: 0
inst-sys:~ # cat /proc/iomem
80000000-8fffffff : /bandit
80800000-808003ff : 0000:00:0d.0
80800000-808003ff : tulip
f1000000-f10fffff : valkyriefb
f3000000-f3ffffff : /bandit
f3000000-f307ffff : 0000:00:10.0
f3008000-f30080ff : mesh
f3008400-f30084ff : pmac_zilog
f3008500-f30085ff : pmac_zilog
f3008600-f30086ff : pmac_zilog
f3008700-f30087ff : pmac_zilog
f3008b00-f3008bff : ide-pmac (dma)
f3010000-f30100ff : mesh
f3013000-f301301f : pmac_zilog
f3013020-f301303f : pmac_zilog
f3020000-f3020fff : ide-pmac (ports)
<6>Using PowerMac machine description
<5>Linux version 2.6.18-rc7-git1-2-default (geeko@buildhost) (gcc version 4.1.2 20060913 (prerelease) (SUSE Linux)) #1 Fri Sep 15 11:35:09 UTC 2006
<4>Found initrd at 0xc0494000:0xc0b8ca1a
<6>Found a OHare mac-io controller, rev: 1, mapped at 0xfdf00000
<6>PowerMac motherboard: Alchemy
<6>Cache coherency enabled for bandit/PSX
<6>Found Bandit PCI host bridge at 0x00000000f2000000. Firmware bus number: 0->0
<4>nvram: OF partition at 0x1800
<4>nvram: XP partition at 0x1300
<4>nvram: NR partition at 0x1400
<7>Top of RAM: 0x8800000, Total RAM: 0x8800000
<7>Memory hole size: 0MB
<7>On node 0 totalpages: 34816
<7> DMA zone: 34816 pages, LIFO batch:7
<4>Built 1 zonelists. Total pages: 34816
<5>Kernel command line: ramdisk_size=8192 minmemory=0 memyasttext=0 sysrq=1 quiet start_shell install=slp
<6>irq: Found primary Apple PIC /bandit/ohare for 32 irqs
<6>irq: System has 32 possible interrupts
<4>PID hash table entries: 1024 (order: 10, 4096 bytes)
<4>GMT Delta read from XPRAM: 120 minutes, DST: on
<7>time_init: decrementer frequency = 9.999850 MHz
<7>time_init: processor frequency = 200.000000 MHz
<4>Console: colour dummy device 80x25
<4>Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
<4>Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
<7>High memory: 0k
<6>Memory: 114188k/139264k available (3568k kernel code, 24932k reserved, 520k data, 452k bss, 192k init)
<7>Calibrating delay loop... 19.90 BogoMIPS (lpj=39808)
<6>Security Framework v1.0.0 initialized
<4>Mount-cache hash table entries: 512
<6>checking if image is initramfs... it is
<4>Freeing initrd memory: 7138k freed
<6>NET: Registered protocol family 16
<6>PCI: Probing PCI hardware
<7>Registering pmac pic with sysfs...
<6>usbcore: registered new driver usbfs
<6>usbcore: registered new driver hub
<6>NET: Registered protocol family 2
<4>IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
<4>TCP established hash table entries: 8192 (order: 3, 32768 bytes)
<4>TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
<6>TCP: Hash tables configured (established 8192 bind 4096)
<6>TCP reno registered
<4>Thermal assist unit not available
<6>audit: initializing netlink socket (disabled)
<5>audit(1158838343.315:1): initialized
<5>VFS: Disk quotas dquot_6.5.1
<4>Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
<6>Initializing Cryptographic API
<6>io scheduler noop registered
<6>io scheduler anticipatory registered
<6>io scheduler deadline registered
<6>io scheduler cfq registered (default)
<6>Monitor sense value = 0x60b
<6>using video mode 13 and color mode 0.
<4>Console: switching to colour frame buffer device 104x39
<6>fb0: valkyrie frame buffer device
<6>Generic RTC Driver v1.07
<6>Macintosh non-volatile memory driver v1.1
<6>pmac_zilog: 0.6 (Benjamin Herrenschmidt <benh@kernel.crashing.org>)
<6>ttyS0 at MMIO 0xf3013020 (irq = 16) is a Z85c30 ESCC - Serial port
<6>ttyS1 at MMIO 0xf3013000 (irq = 17) is a Z85c30 ESCC - Serial port
<4>RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize
<6>MacIO PCI driver attached to OHare chipset
<4>Can't request resource 0 for MacIO device 0.f3000000:ohare
<6>input: Macintosh mouse button emulation as /class/input/input0
<4>Macintosh CUDA driver v0.5 for Unified ADB.
<6>apm_emu: Requires a machine with a PMU.
<6>adb: starting probe task...
<6>Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
<6>ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
<4>ide0: no intrs for device /bandit/ohare/ATA, using 13
<6>ide0: Found Apple OHare ATA controller, bus ID 0, irq 13
<7>Probing IDE interface ide0...
<4>hda: IBM-DJNA-371350, ATA DISK drive
<7>adb devices: [2]: 2 5 [3]: 3 1
<4>ADB keyboard at 2, handler set to 3
<6>Detected ADB keyboard, type ISO, swapping keys.
<6>input: ADB keyboard as /class/input/input1
<4>ADB mouse at 3, handler set to 2
<6>input: ADB mouse as /class/input/input2
<6>adb: finished probe task...
<6>hda: Enabling MultiWord DMA 2
<4>ide0: Disabled unable to get IRQ 13.
<6>ide0: failed to initialize IDE interface
<7>Probing IDE interface ide0...
<4>hda: IBM-DJNA-371350, ATA DISK drive
<4>hda: IRQ probe failed (0x0)
<4>kobject_add failed for ide0 with -EEXIST, don't try to register things with the same name in the same directory.
<4>Call Trace:
<4>[C1865EB0] [C00086FC] show_stack+0x50/0x184 (unreliable)
<4>[C1865ED0] [C015BD50] kobject_add+0x154/0x190
<4>[C1865EF0] [C01EBBD0] device_add+0x68/0x314
<4>[C1865F20] [C0209B0C] probe_hwif+0x618/0x804
<4>[C1865F50] [C020A530] ideprobe_init+0x84/0x164
<4>[C1865F90] [C037037C] ide_generic_init+0x10/0x28
<4>[C1865FA0] [C0003DA4] init+0x90/0x25c
<4>[C1865FF0] [C0013668] kernel_thread+0x44/0x60
<4>hdb: IRQ probe failed (0x0)
<4>hdb: IRQ probe failed (0x0)
<6>hda: Enabling MultiWord DMA 2
<4>ide0: DISABLED, NO IRQ
<7>ohci_hcd: 2005 April 22 USB 1.1 'Open' Host Controller (OHCI) Driver (PCI)
<6>usbcore: registered new driver hiddev
<6>usbcore: registered new driver usbhid
<6>drivers/usb/input/hid-core.c: v2.6:USB HID core driver
<6>usbcore: registered new driver appletouch
<6>mice: PS/2 mouse device common for all mice
<6>md: md driver 0.90.3 MAX_MD_DEVS=256, MD_SB_DISKS=27
<6>md: bitmap version 4.39
<6>NET: Registered protocol family 1
<6>NET: Registered protocol family 17
<4>Freeing unused kernel memory: 192k init
<5>SCSI subsystem initialized
<6>st: Version 20050830, fixed bufsize 32768, s/g segs 256
<6>loop: loaded (max 8 devices)
<6>mesh: configured for synchronous 5 MB/s
<6>mesh: performing initial bus reset...
<6>scsi0 : MESH
<6>mesh: target 3 synchronous at 5.0 MB/s
<5> Vendor: MATSHITA Model: CD-ROM CR-8008 Rev: 8.0e
<5> Type: CD-ROM ANSI SCSI revision: 02
<4>sr0: scsi-1 drive
<6>Uniform CD-ROM driver Revision: 3.20
<7>sr 0:0:3:0: Attached scsi CD-ROM sr0
<5>sr 0:0:3:0: Attached scsi generic sg0 type 5
<6>Linux Tulip driver version 1.1.13-NAPI (May 11, 2002)
<4>PCI: Enabling device 0000:00:0d.0 (0014 -> 0017)
<6>tulip0: EEPROM default media type Autosense.
<6>tulip0: Index #0 - Media MII (#11) described by a 21142 MII PHY (3) block.
<6>tulip0: MII transceiver #5 config 1000 status 782d advertising 01e1.
<6>eth0: Digital DS21143 Tulip rev 65 at c9188000, 00:00:1C:B5:A9:15, IRQ 23.
<6>eth0: Setting full-duplex based on MII#5 link partner capability of 45e1.
<5>lockd: failed to open /var/lib/nfs/state: err=-2
^ permalink raw reply
* Re: IDE not found on Performa due to interrupt breakage
From: Benjamin Herrenschmidt @ 2006-09-21 11:56 UTC (permalink / raw)
To: Olaf Hering; +Cc: linuxppc-dev
In-Reply-To: <20060921115030.GA16732@aepfle.de>
On Thu, 2006-09-21 at 13:50 +0200, Olaf Hering wrote:
> The IDE controller is not usable on a Performa 6400 with 2.6.18:
>
> <6>hda: Enabling MultiWord DMA 2
> <4>ide0: Disabled unable to get IRQ 13.
> <6>ide0: failed to initialize IDE interface
.../...
Looks like a workaround for bogus OF bitrotted... What about this patch:
Index: linux-work/drivers/ide/ppc/pmac.c
===================================================================
--- linux-work.orig/drivers/ide/ppc/pmac.c 2006-07-01 13:51:19.000000000 +1000
+++ linux-work/drivers/ide/ppc/pmac.c 2006-09-21 21:55:31.000000000 +1000
@@ -1326,7 +1326,7 @@
if (macio_irq_count(mdev) == 0) {
printk(KERN_WARNING "ide%d: no intrs for device %s, using 13\n",
i, mdev->ofdev.node->full_name);
- irq = 13;
+ irq = irq_create_mapping(NULL, 13);
} else
irq = macio_irq(mdev, 0);
^ 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