* Re: [RFT] 8xx cpm_hostalloc patch was: allow coherent DMA API to work before main page allocator is set up
From: Pantelis Antoniou @ 2005-05-23 6:27 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: linux-ppc-embedded
In-Reply-To: <20050521222713.GA28813@logos.cnet>
Marcelo Tosatti wrote:
> Can someone with 8xx using the cpm_uart driver please test
> the attached patch? It should avoid corruption of the pinned
> 8Mbyte CONFIG_PIN_TLB entry, as noted by Dan.
>
You shouldn't have these discussions on the weekend :)
I'm the culprit of the code in question.
This is the second take of the code. The hack with the 'if' was
not actually in the first edition, since I had the hostalloc
function working properly before initialization by using the
remainder of the bootpage, as a backup memory area, for when
the mm is not yet ready.
Somewhere along the way, it fell through the cracks.
IMHO that's the proper way to fix it.
There were some objection on that however.
Regards
Pantelis
^ permalink raw reply
* Re: experimental kernel patch for FORTIFY_SOURCE in kernel space
From: David Woodhouse @ 2005-05-23 8:57 UTC (permalink / raw)
To: Arjan van de Ven; +Cc: linuxppc-dev
In-Reply-To: <20050519095631.GA18966@devserv.devel.redhat.com>
On Thu, 2005-05-19 at 11:56 +0200, Arjan van de Ven wrote:
> There is somewhat of an architecture impact so before submitting it on
> lkml I'd want to ask feedback from more arches than just x86...
As discussed in IRC: Put the config option in lib/Kconfig.debug instead
of in arch/i386, and we need to do something about the string functions.
I just made the versions in lib/string.c weak; I doubt that's the best
answer.
Seems to work for me on PPC. Would certainly be nice to make it know
about kmalloc() though. I also made __chk_fail use BUG() instead of
panic().
--- linux-2.6.11/arch/i386/Kconfig.debug.fortifyppc 2005-05-19 13:18:08.000000000 +0100
+++ linux-2.6.11/arch/i386/Kconfig.debug 2005-05-19 13:18:24.000000000 +0100
@@ -59,14 +59,6 @@ config 4KSTACKS
on the VM subsystem for higher order allocations. This option
will also use IRQ stacks to compensate for the reduced stackspace.
-config FORTIFY_SOURCE
- bool "Enable limited buffer overflow checking"
- help
- If you say Y here the kernel will use a recent gcc feature that
- allows several key kernel primitives to check for buffer overflows
- when dealing with static buffers. Do not enable this feature unless
- you have a very recent gcc (version 4.1 or gccs from FC3, FC4, RHEL4)
-
config X86_FIND_SMP_CONFIG
bool
depends on X86_LOCAL_APIC || X86_VOYAGER
--- linux-2.6.11/include/asm-ppc/uaccess.h.fortifyppc 2005-05-19 12:09:40.000000000 +0100
+++ linux-2.6.11/include/asm-ppc/uaccess.h 2005-05-19 13:14:18.000000000 +0100
@@ -330,8 +330,18 @@ copy_to_user(void __user *to, const void
return n;
}
+extern void __chk_fail(void);
+
static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long size)
{
+#ifdef CONFIG_FORTIFY_SOURCE
+ /*
+ * if we know the size of "to" then we can validate that we don't overrun the buffer.
+ * note that if __nbytes is known at compiletime this check is nicely optimized out
+ */
+ if (__bos0 (to) != (size_t) -1 && size > __bos0 (to))
+ __chk_fail();
+#endif
return __copy_tofrom_user((__force void __user *)to, from, size);
}
--- linux-2.6.11/lib/fortify.c.fortifyppc 2005-05-19 13:18:56.000000000 +0100
+++ linux-2.6.11/lib/fortify.c 2005-05-19 12:22:22.000000000 +0100
@@ -29,7 +29,7 @@
void __chk_fail(void)
{
printk("** kernel buffer overflow detected via application %s ***\n", current->comm);
- panic("Aborting!\n");
+ BUG();
}
EXPORT_SYMBOL_GPL(__chk_fail);
--- linux-2.6.11/lib/Kconfig.debug.fortifyppc 2005-05-19 13:17:36.000000000 +0100
+++ linux-2.6.11/lib/Kconfig.debug 2005-05-19 13:11:33.000000000 +0100
@@ -168,6 +168,16 @@ config DEBUG_FS
If unsure, say N.
+config FORTIFY_SOURCE
+ bool "Enable limited buffer overflow checking"
+ depends on DEBUG_KERNEL
+ help
+ If you say Y here the kernel will use a recent gcc feature that
+ allows several key kernel primitives to check for buffer overflows
+ when dealing with static buffers. Do not enable this feature unless
+ you have a very recent gcc (version 4.1 or gccs from FC3, FC4, RHEL4)
+
+
config FRAME_POINTER
bool "Compile the kernel with frame pointers"
depends on DEBUG_KERNEL && ((X86 && !X86_64) || CRIS || M68K || M68KNOMMU || FRV)
--- linux-2.6.11/lib/string.c.fortifyppc 2005-05-19 12:06:49.000000000 +0100
+++ linux-2.6.11/lib/string.c 2005-05-23 09:51:27.000000000 +0100
@@ -66,7 +66,7 @@ EXPORT_SYMBOL(strnicmp);
* @src: Where to copy the string from
*/
#undef strcpy
-char * strcpy(char * dest,const char *src)
+char * __attribute__((weak)) strcpy(char * dest,const char *src)
{
char *tmp = dest;
@@ -92,7 +92,7 @@ EXPORT_SYMBOL(strcpy);
*
*/
#undef strncpy
-char * strncpy(char * dest,const char *src,size_t count)
+char * __attribute__((weak)) strncpy(char * dest,const char *src,size_t count)
{
char *tmp = dest;
@@ -139,7 +139,7 @@ EXPORT_SYMBOL(strlcpy);
* @src: The string to append to it
*/
#undef strcat
-char * strcat(char * dest, const char * src)
+char * __attribute__((weak)) strcat(char * dest, const char * src)
{
char *tmp = dest;
@@ -164,7 +164,7 @@ EXPORT_SYMBOL(strcat);
* terminated.
*/
#undef strncat
-char * strncat(char *dest, const char *src, size_t count)
+char * __attribute__((weak)) strncat(char *dest, const char *src, size_t count)
{
char *tmp = dest;
--
dwmw2
^ permalink raw reply
* Re: Microcode patches for mpc8xx
From: Vladimir A. Gurevich @ 2005-05-23 13:46 UTC (permalink / raw)
To: Wolfgang Denk; +Cc: linuxppc-embedded
In-Reply-To: <20050523082816.774E4C1512@atlas.denx.de>
Dear Wolfgang,
Wolfgang Denk wrote:
>>since we are on this topic here: look like SMC relocation is explicitly not supported and I can't see the SPI driver as well (unless it reuses 8260 driver).
>>
>>
>In our CVS tree? See the old linux-2.4 tree. We don't see many uses of 8xx systems recently with ucode requirements.
>
>
I am completely puzzled now. It looks like your stable, but old
linux-2.4 tree has a much better selection of 8xx drivers compared to
the linuxppc_2_4_devel. Why is that? What do you recommend for a new
MPC852T-based development? Can the drivers be dropped into the newer
tree or more serious backporting effort is needed?
Thanks,
Vladimir
^ permalink raw reply
* Memory mapping the PHY on CR826
From: Alex Zeffertt @ 2005-05-23 13:59 UTC (permalink / raw)
To: linuxppc-embedded, linux-atm-general@lists.sourceforge.net
Hi all,
Does anyone here have *any* code for memory mapping the PM5350 ATM phy
on the Microsys CR826 board?
I've just purchased this board from Microsys and I'm trying to get the
atm8260 ATM device driver to work on it - unfortunately I cannot seem to
memory map the phy. My current settings are:
memctl->memc_or8 = 0xe0400ef4; // base 0xe0400000; default timings
memctl->memc_br8 = 0xffff8821; // min banksize; 8bit port; GPCM local;
// bank valid
Has anybody done this already?
TIA,
Alex
^ permalink raw reply
* Re: [RFT] 8xx cpm_hostalloc patch was: allow coherent DMA API to work before main page allocator is set up
From: Dan Malek @ 2005-05-23 15:19 UTC (permalink / raw)
To: Pantelis Antoniou; +Cc: linux-ppc-embedded
In-Reply-To: <429177E8.5070701@intracom.gr>
On May 23, 2005, at 2:27 AM, Pantelis Antoniou wrote:
> You shouldn't have these discussions on the weekend :)
Sorry. I try not to, but then people think I'm not interested :-)
I was working on my race car data acquisition telemetry
project, anyway.
> I'm the culprit of the code in question.
I'm not trying to blame anyone. The new driver is better in
many ways, we just have to fix up this one little thing so
it works in all possible VM configurations.
I also have to look at the new consistent mapping functions,
as those also seem to have changed. Maybe this will
work fine, or can be made to work with minor changes.
Thanks.
-- Dan
^ permalink raw reply
* [PATCH] ppc32: Fix an off-by-one error in ipic_init
From: Kumar Gala @ 2005-05-23 17:29 UTC (permalink / raw)
To: Andrew Morton, Linus Torvalds; +Cc: linux-kernel, linuxppc-embedded
(This fixes a bug and should go into 2.6.12 if possible.)
There is an off-by-one error in the IPIC code that configures the
external interrupts (Edge or Level Sensitive).
Signed-off-by: Randy Vinson <rvinson@mvista.com>
Signed-off-by: Kumar Gala <kumar.gala@freescale.com>
---
commit e8366420067384e3443e5ed95c151198e5ca6d22
tree 6aeff44236e7890cce085e65661884e4622785a7
parent 57bf2ca5c599f50428bf3f8ff9707411b2dfbae8
author Kumar K. Gala <kumar.gala@freescale.com> Mon, 23 May 2005 12:27:15 -0500
committer Kumar K. Gala <kumar.gala@freescale.com> Mon, 23 May 2005 12:27:15 -0500
ppc/syslib/ipic.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
Index: arch/ppc/syslib/ipic.c
===================================================================
--- 55631465fc89fa1f96bdadaa7026113780db1c8a/arch/ppc/syslib/ipic.c (mode:100644)
+++ 6aeff44236e7890cce085e65661884e4622785a7/arch/ppc/syslib/ipic.c (mode:100644)
@@ -479,7 +479,7 @@
temp = 0;
for (i = 0 ; i < senses_count ; i++) {
if ((senses[i] & IRQ_SENSE_MASK) == IRQ_SENSE_EDGE) {
- temp |= 1 << (16 - i);
+ temp |= 1 << (15 - i);
if (i != 0)
irq_desc[i + irq_offset + MPC83xx_IRQ_EXT1 - 1].status = 0;
else
^ permalink raw reply
* RE: tah reset?
From: Sanjay Bajaj @ 2005-05-23 19:17 UTC (permalink / raw)
To: Eugene Surovegin; +Cc: linuxppc-embedded
FYI,
I did find the source of the reset tah issue. The physical address of =
TAH 0 and TAH 1 was ending in B00h and D00h respectively. But in the UM, =
it ends in B50 and D50. the file affected is ibm440gx.c in =
arch/ppc/platforms.
Thanks,
Sanjay
-----Original Message-----
From: Eugene Surovegin [mailto:ebs@ebshome.net]
Sent: Thursday, May 19, 2005 2:23 PM
To: Sanjay Bajaj
Cc: linuxppc-embedded@ozlabs.org
Subject: Re: tah reset?
On Thu, May 19, 2005 at 02:14:20PM -0400, Sanjay Bajaj wrote:
> While trying to reset the TAH on emac2 of PPC440GX, the Soft Reset=20
> (SR) bit never resets itself to 0. Does anybody know the reason for=20
> it?
Did you enable TAH0 in SDR0_MFR register?
Also, I don't remember for sure, but TAH may have the same problem as=20
EMAC, namely, it won't go out of reset if there is no RX clock from=20
PHY.
--=20
Eugene
^ permalink raw reply
* Re: tah reset?
From: Eugene Surovegin @ 2005-05-23 20:04 UTC (permalink / raw)
To: Sanjay Bajaj; +Cc: linuxppc-embedded
In-Reply-To: <0007F077BB3476449151699150E8FEA21A7BA0@exchange.tsi-telsys.com>
On Mon, May 23, 2005 at 03:17:26PM -0400, Sanjay Bajaj wrote:
> I did find the source of the reset tah issue. The physical address
> of TAH 0 and TAH 1 was ending in B00h and D00h respectively. But in
> the UM, it ends in B50 and D50. the file affected is ibm440gx.c in
> arch/ppc/platforms.
Linux 2.6 has correct values for TAH base address, 2.4 doesn't have
any support for TAH at all.
Where did you get this incorrect code?
You see, you should have used supported sources (2.6) or the one I
recommended to you (my 2.4 backport) but you have ignored this
suggestion and wasted your time and time of people on this mail list.
Please, next time if you use some stuff which isn't in kernel.org's
tree, direct you questions to the person who made those patches,
because we cannot help you as we don't have the source code you are
using.
--
Eugene
^ permalink raw reply
* Reading DVDs on a Mac mini
From: Tom Parker @ 2005-05-23 20:07 UTC (permalink / raw)
To: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 1844 bytes --]
I recently bought a Mac mini to try out a few things, but have been
having some problems trying to get it to read DVDs. I was using the
2.6.10 kernel (the Ubuntu linux-image-2.6.10-5-powerpc package) and I
get the same results with 2.6.12-rc4 (kernel config for that is
attached). Whenever I try to read a DVD-ROM (my test app is lsdvd, but
same results with mplayer) I get the following error message:
libdvdread: Invalid title IFO (VTS_02_0.IFO).
Can't open ifo 2!
Varying the DVD sometimes gets ifo 3/VTS_03_0.IFO, but the result is the
same. Looking at dmesg shows the following:
hdb: command error: status=0x51 { DriveReady SeekComplete Error }
hdb: command error: error=0x54 { AbortedCommand LastFailedSense=0x05 }
ide: failed opcode was: unknown
end_request: I/O error, dev hdb, sector 42872
Repeat lots and lots of times with values of sector jumping by 8 each
time. I'm not sure where it starts, because my entire dmesg output is
filled with these messages. Trying to play/copy stuff from burnt off
DVD-Rs works fine, but store bought DVDs don't like the drive (region 2
discs, the mini was bought in the Netherlands, a region 2 country). I
have occasionally *rarely* managed to persuade some discs to
occasionally read, but repeating the attempt then generally fails.
Failure always happens within two or 3 reads.
The version of libdvdread in use is 0.9.4 (the Debian 0.9.4-5
libdvdread3 package).
hdparm settings for /dev/hdb (the DVD/CD-ROM drive):
IO_support = 0 (default 16-bit)
unmaskirq = 1 (on)
using_dma = 0 (off)
keepsettings = 0 (off)
readonly = 0 (off)
readahead = 256 (on)
HDIO_GETGEO failed: Invalid argument
hdparm -i says the drive is a "MATSHITACD-RW CW-8124".
Any ideas? Because I'm all out of ideas, and I hope someone on here can
help.
Thanks,
Tom Parker
[-- Attachment #2: config-2.6.12-rc4.gz --]
[-- Type: application/octet-stream, Size: 11743 bytes --]
^ permalink raw reply
* Re: Microcode patches for mpc8xx
From: Wolfgang Denk @ 2005-05-23 20:30 UTC (permalink / raw)
To: Vladimir A. Gurevich; +Cc: linuxppc-embedded
In-Reply-To: <4291DEAF.1080705@paulidav.org>
Dear Vladimir,
in message <4291DEAF.1080705@paulidav.org> you wrote:
>
> >In our CVS tree? See the old linux-2.4 tree. We don't see many uses of 8xx systems recently with ucode requirements.
> >
> >
> I am completely puzzled now. It looks like your stable, but old
> linux-2.4 tree has a much better selection of 8xx drivers compared to
> the linuxppc_2_4_devel. Why is that? What do you recommend for a new
This is because we have limited resources, and do those things
(first) where a customer is waiting (and paying) for. Not all of the
work that went into the old 2.4.4 tree was adapted for more recent
versions of 2.4 yet; and most of the 2.4 stuff got lost in 2.6
anyway.
> MPC852T-based development? Can the drivers be dropped into the newer
> tree or more serious backporting effort is needed?
It depends. Most should work fine with minimal changes, but obviously
some effort for a code review and especially testing will be needed.
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
core error - bus dumped
^ permalink raw reply
* Re: [Linux-ATM-General] Memory mapping the PHY on CR826
From: Koen Peeters @ 2005-05-23 20:43 UTC (permalink / raw)
To: Alex Zeffertt; +Cc: linux-atm-general@lists.sourceforge.net, linuxppc-embedded
In-Reply-To: <20050523145953.3a2044ef.ajz@cambridgebroadband.com>
Hi Alex,
I have got the Microsys board but I believe
you sort of mixed up the 2 registers :
try :
memctl->memc_br8 = 0xe0400821; // base 0xe0400000; default timings;
// bank valid; 8bit port; GPCM local;
memctl->memc_or8 = 0xffff8820; // min banksize; addressline config
Please verify the or8 setting with the actual board configuration.
Alex Zeffertt wrote:
> Hi all,
>
> Does anyone here have *any* code for memory mapping the PM5350 ATM phy
> on the Microsys CR826 board?
>
> I've just purchased this board from Microsys and I'm trying to get the
> atm8260 ATM device driver to work on it - unfortunately I cannot seem to
> memory map the phy. My current settings are:
>
>
> memctl->memc_or8 = 0xe0400ef4; // base 0xe0400000; default timings
> memctl->memc_br8 = 0xffff8821; // min banksize; 8bit port; GPCM local;
> // bank valid
>
> Has anybody done this already?
>
> TIA,
>
> Alex
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space Sweepstakes
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
> http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
> _______________________________________________
> Linux-atm-general mailing list
> Linux-atm-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-atm-general
--
-------------------------------------------------
Koen Peeters
Cellink bvba
Catherinalaan 37, 3110 Rotselaar, Belgium
web : http://www.cellink.net/
^ permalink raw reply
* RE: tah reset?
From: Sanjay Bajaj @ 2005-05-23 20:56 UTC (permalink / raw)
To: Eugene Surovegin; +Cc: linuxppc-embedded
My intention is not to waste anybody's time and I think, I did not. As I =
mentioned to you earlier that I am working on the vendor provided =
version of Linux Kernel 2.4.27-pre3, which looks clearly from =
kernel.org. The value of PPC440GX_TAH0_ADDR and PPC440GX_TAH1_ADDR in =
arch/ppc/platforms/ibm440gx.h is 0x0000000140000b00 & 0x0000000140000d00 =
respectively. I verified this value in lk 2.4.30 also, these values are =
the same.
Though in lk 2.6.x, the values have been hardcoded in the =
arch/ppc/platforms/ibm440gx.c to 0x0000000140000b50 and =
0x0000000140000d50. Therefore, the confusion.
I hope this clears your misunderstanding. I did not see your suggestion =
for using your version of 2.4.x backported driver of ibm_emac. I could =
use it, if you send it again.
Thanks,
Sanjay
-----Original Message-----
From: Eugene Surovegin [mailto:ebs@ebshome.net]
Sent: Monday, May 23, 2005 4:04 PM
To: Sanjay Bajaj
Cc: linuxppc-embedded@ozlabs.org
Subject: Re: tah reset?
On Mon, May 23, 2005 at 03:17:26PM -0400, Sanjay Bajaj wrote:
> I did find the source of the reset tah issue. The physical address=20
> of TAH 0 and TAH 1 was ending in B00h and D00h respectively. But in=20
> the UM, it ends in B50 and D50. the file affected is ibm440gx.c in=20
> arch/ppc/platforms.
Linux 2.6 has correct values for TAH base address, 2.4 doesn't have=20
any support for TAH at all.
Where did you get this incorrect code?
You see, you should have used supported sources (2.6) or the one I=20
recommended to you (my 2.4 backport) but you have ignored this =20
suggestion and wasted your time and time of people on this mail list.
Please, next time if you use some stuff which isn't in kernel.org's=20
tree, direct you questions to the person who made those patches,=20
because we cannot help you as we don't have the source code you are=20
using.
--=20
Eugene
^ permalink raw reply
* MMUCR on ppc440 GP/GX
From: ming lei @ 2005-05-23 20:55 UTC (permalink / raw)
To: linuxppc-embedded; +Cc: mmporter
Hi,
I have problem on running system with linuxppc
2.4.19(ppc440GP/GX) regarding MMU Control
Register(MMUCR).
I checked the code in arch/ppc/ there is no code
setting or unsetting bit 12(DULXE) or bit 13(IULXE),
but somehow these two bits got changed during boot
process.
Question 1:
Does CPU or other hardware change these two bits? If
linux code doesnt set these two bits initiallt, what's
the default value? Or I miss something in the code
that may change these two bits?
Question 2:
For current 2.4.19 PPC440 implementation, there is no
special handling for this kind of DataStorage
exception, is it possible for the user code to stuck
in this exception forever if these two bits got set in
MMUCR and the user code calls icbi instruction?
I did a simple test on head_440.S so whenever the
DataStorage exception happens, in DataStorage assmbly
code, I clear these two bits in MMUCR, but somehow
these two bits got set mysteriourly in next exception
with error_code 0x200000(got from ESR DLK bits).
What's happening here?
Thanks for any points and suggestions,
Ming
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new Resources site
http://smallbusiness.yahoo.com/resources/
^ permalink raw reply
* RE: kernel panic in slab.c
From: Bill Rogers @ 2005-05-23 21:33 UTC (permalink / raw)
To: hub-linux-ppc; +Cc: linuxppc-dev
Hi,
I am seeing the same error. Did you determine the cause? Thanks.
Bill
kernel panic in slab.c
Hubert Figuiere hub-linux-ppc at trantor.staff.proxad.net =
<mailto:linuxppc-dev%40ozlabs.org?Subject=3Dkernel%20panic%20in%20slab.c&=
In-Reply-To=3D1064497450.702.12.camel%40gaston>
Fri Sep 26 00:14:24 EST 2003=20
* Previous message: kernel panic in slab.c <015712.html>
* Next message: kernel panic in slab.c <015714.html>
* Messages sorted by: [ date ] <date.html> [ thread ] <thread.html> [ =
subject ] <subject.html> [ author ] <author.html>=20
Hi,
On Thu, 2003-09-25 at 15:44, Benjamin Herrenschmidt wrote:
> Nice to see you using Linux again :)
I never stopped :-)
>
> What machine is this ?
Custom network hardware with a PrPMC750 Motorola board as MPU. We have a
few tiny patches for our custom devices, but nothing important here
IMHO.
> The bug shows that the poison checker found that a freed block got
> overriden. It didn't display more infos about the kind of pattern
> it found and/or a backtrace ? That would be helpful.
I might investigate.
> I've been trying to track down such kind of memory corruption for
> some time now, so if you have a good handle on it, I'm interested,
> as I suspect something wrong is going on in recent 2.4s
Fine, then I feel like investigating it since memory corruption are
probably the worst bugs. I don't have a good handle on the problem. I
often crash while running either "bird" or "swapper" (uptime don't
exceed 5 or 10 minutes). Even worse, sometime it crashes during boot up.
The only thing I'm sure is that it is fully reproducible as it plagged
me for quite sometime. I first thaught that hardware was at fault (like
defective MPU), but my co-workers don't have the problem, and in fact
disabled debugging.
Thanks
Hub
--
Hubert Figui=E8re - Freebox SA. - +33 1 73 50 2 563
AIM/Yahoo!: hfiguiere, ICQ: 307453487
** Sent via the linuxppc-dev mail list. See <http://lists.linuxppc.org/>
^ permalink raw reply
* Re: MMUCR on ppc440 GP/GX
From: Matt Porter @ 2005-05-23 22:03 UTC (permalink / raw)
To: ming lei; +Cc: linuxppc-embedded
In-Reply-To: <20050523205558.28957.qmail@web61022.mail.yahoo.com>
On Mon, May 23, 2005 at 01:55:58PM -0700, ming lei wrote:
> Hi,
>
> I have problem on running system with linuxppc
> 2.4.19(ppc440GP/GX) regarding MMU Control
> Register(MMUCR).
>
> I checked the code in arch/ppc/ there is no code
> setting or unsetting bit 12(DULXE) or bit 13(IULXE),
> but somehow these two bits got changed during boot
> process.
>
> Question 1:
> Does CPU or other hardware change these two bits? If
> linux code doesnt set these two bits initiallt, what's
> the default value? Or I miss something in the code
> that may change these two bits?
>
> Question 2:
> For current 2.4.19 PPC440 implementation, there is no
> special handling for this kind of DataStorage
> exception, is it possible for the user code to stuck
> in this exception forever if these two bits got set in
> MMUCR and the user code calls icbi instruction?
>
> I did a simple test on head_440.S so whenever the
> DataStorage exception happens, in DataStorage assmbly
> code, I clear these two bits in MMUCR, but somehow
> these two bits got set mysteriourly in next exception
> with error_code 0x200000(got from ESR DLK bits).
> What's happening here?
Your kernel revision is very ancient. The problem here is that
you are trying to use _very_ early PPC440 core code I released.
It's filled with critical bugs that were fixed over time. The MMUCR
issue was fixed almost 3 years ago, in fact.
Your best solution is to run a more recent kernel. If that's
not possible, then I suggest you backport all the PPC440
related code from a more recent kernel into your old kernel
base.
-Matt
^ permalink raw reply
* Re: Reading DVDs on a Mac mini
From: Benjamin Herrenschmidt @ 2005-05-23 23:41 UTC (permalink / raw)
To: Tom Parker; +Cc: linuxppc-dev
In-Reply-To: <429237EC.4010104@tevp.net>
On Mon, 2005-05-23 at 22:07 +0200, Tom Parker wrote:
>
> The version of libdvdread in use is 0.9.4 (the Debian 0.9.4-5
> libdvdread3 package).
>
> hdparm settings for /dev/hdb (the DVD/CD-ROM drive):
>
> IO_support = 0 (default 16-bit)
> unmaskirq = 1 (on)
> using_dma = 0 (off)
> keepsettings = 0 (off)
> readonly = 0 (off)
> readahead = 256 (on)
> HDIO_GETGEO failed: Invalid argument
>
> hdparm -i says the drive is a "MATSHITACD-RW CW-8124".
>
> Any ideas? Because I'm all out of ideas, and I hope someone on here can
> help.
Does the debian package of libdvdread contains the CSS stuff ? Also, the
lack of "using_dma" is annoying... It looks like our CD/DVD kernel
driver is still dumb and still switches DMA off on any stupid error...
Have you tried booting OS X and playing the DVD once ? Maybe the drive
wants a zone to be set at least once, which MacOS does the first time
you play a DVD
Ben.
^ permalink raw reply
* Re: [PATCH] add machine state register support
From: Benjamin Herrenschmidt @ 2005-05-23 23:53 UTC (permalink / raw)
To: Geoff Levand; +Cc: linuxppc-dev
In-Reply-To: <42926A07.20706@am.sony.com>
On Mon, 2005-05-23 at 16:40 -0700, Geoff Levand wrote:
> This patch adds routines to get and set the machine state register. These
> are needed by power management code on some platforms.
>
> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> for CELF
Hi Geoff !
Can you tell me more about this power management code ? I tend to think
that code that wants to do more than just using the existing accessors
should be written in assembly...
Also, there is already
void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);
That you can use for manipulating MSR bits.
Finally, I tend to prefer such small register accessors to be written as
inline assembly in some headers. But then, I don't think you actually
need to add anything here.
Regards,
Ben.
^ permalink raw reply
* swapon swapfile on Bamboo board
From: Youngchul Bang (방영철) @ 2005-05-24 2:20 UTC (permalink / raw)
To: linuxppc-embedded
Hi,
I'm tring to use a swapfile on Bamboo reference board. I got some of
messages. Is it a kernel BUG?
I'm using kernel 2.6.11.8, which patched [1]"PPC440EP SoC and Bamboo
board support".
[1] http://ozlabs.org/pipermail/linuxppc-embedded/2005-April/017648.html
Commands to use a swapfile are following:
/# dd if=3D/dev/zero of=3Dswapfile bs=3D1024 count=3D65536
65536+0 records in
65536+0 records out
67108864 bytes transferred in 82.371510 seconds (814710 bytes/sec)
/# mkswap swapfile =20
Setting up swapspace version 1, size =3D 67104 kB =
=20
no label, UUID=3Ddaed5412-feb7-42ed-a925-f80e1c7782fb =
=20
/# swapon swapfile =20
kernel BUG in swp_entry_to_pte at include/linux/swapops.h:67! =
=20
Oops: Exception in kernel mode, sig: 5 [#1] =
=20
PREEMPT =
=20
NIP: C00562A0 LR: C0056284 SP: C0D59EE0 REGS: c0d59e30 TRAP: 0700 Not ta=
inted
MSR: 00029000 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 00 =
=20
TASK =3D c1c30430[928] 'swapon' THREAD: c0d58000 =
=20
Last syscall: 87 =
=20
GPR00: 00000400 C0D59EE0 C1C30430 00000000 00000001 0000000A C021B875 C033A=
C10 =20
GPR08: 00000001 010B6000 C1087258 C02D0000 00004000 1001BAA4 100C0000 100A0=
000 =20
GPR16: 00000000 100DC368 C02E0000 00000000 00000001 C1882000 C0C8EC20 00000=
000 =20
GPR24: C10871B4 C030A7C0 00004000 04000000 FFFFFFEA C10B6000 C02D8ABC C10B6=
FF6 =20
NIP [c00562a0] sys_swapon+0x588/0xa04 =
=20
LR [c0056284] sys_swapon+0x56c/0xa04 =
=20
Call trace: =
=20
[c0001a88] ret_from_syscall+0x0/0x48 =
=20
Trace/breakpoint trap =
=20
/# =20
Let me know what problem is.
Thanks in advice,
Youngchul.
^ permalink raw reply
* Booting the Linux/ppc64 kernel without Open Firmware HOWTO (v3)
From: Benjamin Herrenschmidt @ 2005-05-24 4:34 UTC (permalink / raw)
To: linuxppc64-dev; +Cc: linuxppc-dev list, Tzachi Perelstein, u-boot-users
Hi !
Here's revision 3 of the spec for the booting of linux/ppc64 with a
flattened device-tree. The novelty is that I added a new more compact
format. A followup mail will have the kernel patches to add support to
this new format, I'll submit them upstream for after 2.6.12 I think.
David and I are still working on sample code & tools. We have a
prototype of a device-tree "compiler" that can build the flattened blob
from a textual representation. We'll release that soon, hopefully this
week.
--------
Booting the Linux/ppc64 kernel without Open Firmware
----------------------------------------------------
(c) 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org>, IBM Corp.
May 18, 2005: Rev 0.1 - Initial draft, no chapter III yet.
May 19, 2005: Rev 0.2 - Add chapter III and bits & pieces here or
clarifies the fact that a lot of things are
optional, the kernel only requires a very
small device tree, though it is encouraged
to provide an as complete one as possible.
May 24, 2005: Rev 0.3 - Precise that DT block has to be in RAM
- Misc fixes
- Define version 3 and new format version 16
for the DT block (version 16 needs kernel
patches, will be fwd separately).
String block now has a size, and full path
is replaced by unit name for more
compactness.
linux,phandle is made optional, only nodes
that are referenced by other nodes need it.
"name" property is now automatically
deduced from the unit name
ToDo:
- Add some definitions of interrupt tree (simple/complex)
- Add some definitions for pci host bridges
I- Introduction
===============
During the recent developpements of the Linux/ppc64 kernel, and more
specifically, the addition of new platform types outside of the old
IBM pSeries/iSeries pair, it was decided to enforce some strict rules
regarding the kernel entry and bootloader <-> kernel interfaces, in
order to avoid the degeneration that has become the ppc32 kernel entry
point and the way a new platform should be added to the kernel. The
legacy iSeries platform breaks those rules as it predates this scheme,
but no new board support will be accepted in the main tree that
doesn't follows them properly.
The main requirement that will be defined in more details below is
the presence of a device-tree whose format is defined after Open
Firmware specification. However, in order to make life easier
to embedded board vendors, the kernel doesn't require the device-tree
to represent every device in the system and only requires some nodes
and properties to be present. This will be described in details in
section III, but, for example, the kernel does not require you to
create a node for every PCI device in the system. It is a requirement
to have a node for PCI host bridges in order to provide interrupt
routing informations and memory/IO ranges, among others. It is also
recommended to define nodes for on chip devices and other busses that
doesn't specifically fit in an existing OF specification, like on chip
devices, this creates a great flexibility in the way the kernel can
them probe those and match drivers to device, without having to hard
code all sorts of tables. It also makes it more flexible for board
vendors to do minor hardware upgrades without impacting significantly
the kernel code or cluttering it with special cases.
1) Entry point
--------------
There is one and one single entry point to the kernel, at the start
of the kernel image. That entry point support two calling
conventions:
a) Boot from Open Firmware. If your firmware is compatible
with Open Firmware (IEEE 1275) or provides an OF compatible
client interface API (support for "interpret" callback of
forth words isn't required), you can enter the kernel with:
r5 : OF callback pointer as defined by IEEE 1275
bindings to powerpc. Only the 32 bits client interface
is currently supported
r3, r4 : address & lenght of an initrd if any or 0
MMU is either on or off, the kernel will run the
trampoline located in arch/ppc64/kernel/prom_init.c to
extract the device-tree and other informations from open
firmware and build a flattened device-tree as described
in b). prom_init() will then re-enter the kernel using
the second method. This trampoline code runs in the
context of the firmware, which is supposed to handle all
exceptions during that time.
b) Direct entry with a flattened device-tree block. This entry
point is called by a) after the OF trampoline and can also be
called directly by a bootloader that does not support the Open
Firmware client interface. It is also used by "kexec" to
implement "hot" booting of a new kernel from a previous
running one. This method is what I will describe in more
details in this document, as method a) is simply standard Open
Firmware, and thus should be implemented according to the
various standard documents defining it and it's binding to the
PowerPC platform. The entry point definition then becomes:
r3 : physical pointer to the device-tree block
(defined in chapter II) in RAM
r4 : physical pointer to the kernel itself. This is
used by the assembly code to properly disable the MMU
in case you are entering the kernel with MMU enabled
and a non-1:1 mapping.
r5 : NULL (as to differenciate with method a)
Note about SMP entry: Either your firmware puts your other
CPUs in some sleep loop or spin loop in ROM where you can get
them out via a soft reset or some other mean, in which case
you don't need to care, or you'll have to enter the kernel
with all CPUs. The way to do that with method b) will be
described in a later revision of this document.
2) Board support
----------------
Board supports (platforms) are not exclusive config options. An
arbitrary set of board supports can be built in a single kernel
image. The kernel will "known" what set of functions to use for a
given platform based on the content of the device-tree. Thus, you
should:
a) add your platform support as a _boolean_ option in
arch/ppc64/Kconfig, following the example of PPC_PSERIES,
PPC_PMAC and PPC_MAPLE. The later is probably a good
example of a board support to start from.
b) create your main platform file as
"arch/ppc64/kernel/myboard_setup.c" and add it to the Makefile
under the condition of your CONFIG_ option. This file will
define a structure of type "ppc_md" containing the various
callbacks that the generic code will use to get to your
platform specific code
c) Add a reference to your "ppc_md" structure in the
"machines" table in arch/ppc64/kernel/setup.c
d) request and get assigned a platform number (see PLATFORM_*
constants in include/asm-ppc64/processor.h
I will describe later the boot process and various callbacks that
your platform should implement.
II - The DT block format
===========================
This chapter defines the actual format of the flattened device-tree
passed to the kernel. The actual content of it and kernel requirements
are described later. You can find example of code manipulating that
format in various places, including arch/ppc64/kernel/prom_init.c
which will generate a flattened device-tree from the Open Firmware
representation, or the fs2dt utility which is part of the kexec tools
which will generate one from a filesystem representation. It is
expected that a bootloader like uboot provides a bit more support,
that will be discussed later as well.
Note: The block has to be in main memory. It has to be accessible in
both real mode and virtual mode with no other mapping than main
memory. If you are writing a simple flash bootloader, it should copy
the block to RAM before passing it to the kernel.
1) Header
---------
The kernel is entered with r3 pointing to an area of memory that is
roughtly described in include/asm-ppc64/prom.h by the structure
boot_param_header:
struct boot_param_header
{
u32 magic; /* magic word OF_DT_HEADER */
u32 totalsize; /* total size of DT block */
u32 off_dt_struct; /* offset to structure */
u32 off_dt_strings; /* offset to strings */
u32 off_mem_rsvmap; /* offset to memory reserve map
*/
u32 version; /* format version */
u32 last_comp_version; /* last compatible version */
/* version 2 fields below */
u32 boot_cpuid_phys; /* Which physical CPU id we're
booting on */
/* version 3 fields below */
u32 size_dt_strings; /* size of the strings block */
};
Along with the constants:
/* Definitions used by the flattened device tree */
#define OF_DT_HEADER 0xd00dfeed /* 4: version, 4: total
size */
#define OF_DT_BEGIN_NODE 0x1 /* Start node: full name
*/
#define OF_DT_END_NODE 0x2 /* End node */
#define OF_DT_PROP 0x3 /* Property: name off,
size, content */
#define OF_DT_END 0x9
All values in this header are in big endian format, the various
fields in this header are defined more precisely below. All
"offsets" values are in bytes from the start of the header, that is
from r3 value.
- magic
This is a magic value that "marks" the beginning of the
device-tree block header. It contains the value 0xd00dfeed and is
defined by the constant OF_DT_HEADER
- totalsize
This is the total size of the DT block including the header. The
"DT" block should enclose all data structures defined in this
chapter (who are pointed to by offsets in this header). That is,
the device-tree structure, strings, and the memory reserve map.
- off_dt_struct
This is an offset from the beginning of the header to the start
of the "structure" part the device tree. (see 2) device tree)
- off_dt_strings
This is an offset from the beginning of the header to the start
of the "strings" part of the device-tree
- off_mem_rsvmap
This is an offset from the beginning of the header to the start
of the reserved memory map. This map is a list of pairs of 64
bits integers. Each pair is a physical address and a size. The
list is terminated by an entry of size 0. This map provides the
kernel with a list of physical memory areas that are "reserved"
and thus not to be used for memory allocations, especially during
early initialisation. The kernel needs to allocate memory during
boot for things like un-flattening the device-tree, allocating an
MMU hash table, etc... Those allocations must be done in such a
way to avoid overriding critical things like, on Open Firmware
capable machines, the RTAS instance, or on some pSeries, the TCE
tables used for the iommu. Typically, the reserve map should
contain _at least_ this DT block itself (header,total_size). If
you are passing an initrd to the kernel, you should reserve it as
well. You do not need to reserve the kernel image itself. The map
should be 64 bits aligned.
- version
This is the version of this structure. Version 1 stops
here. Version 2 adds an additional field boot_cpuid_phys.
Version 3 adds the size of the strings block, allowing the kernel
to reallocate it easily at boot and free up the unused flattened
structure after expansion.
Version 16 introduces a new more "compact" format for the tree
itself that is however not backward compatible.
You should always generate a structure of the highest version
defined
at the time of your implementation. Currently that is version 16,
unless you explicitely aim at being backward compatible
- last_comp_version
Last compatible version. This indicates down to what version of
the DT block you are backward compatible with. For example,
version 2 is backward compatible with version 1 (that is, a
kernel build for version 1 will be able to boot with a version 2
format). You should put a 1 in this field if you generate a
device tree of version 1 to 3, or 0x10 if you generate a tree of
version 0x10 using the new unit name format.
- boot_cpuid_phys
This field only exist on version 2 headers. It indicate which
physical CPU ID is calling the kernel entry point. This is used,
among others, by kexec. If you are on an SMP system, this value
should match the content of the "reg" property of the CPU node in
the device-tree corresponding to the CPU calling the kernel entry
point (see further chapters for more informations on the required
device-tree contents)
So the typical layout of a DT block (though the various parts don't
need to be in that order) looks like (addresses go from top to
bottom):
------------------------------
r3 -> | struct boot_param_header |
------------------------------
| (alignment gap) (*) |
------------------------------
| memory reserve map |
------------------------------
| (alignment gap) |
------------------------------
| |
| device-tree structure |
| |
------------------------------
| (alignment gap) |
------------------------------
| |
| device-tree strings |
| |
-----> ------------------------------
|
|
--- (r3 + totalsize)
(*) The alignment gaps are not necessarily present, their presence
and size are dependent on the various alignment requirements of
the individual data blocks.
2) Device tree generalities
---------------------------
This device-tree itself is separated in two different blocks, a
structure block and a strings block. Both need to be page
aligned.
First, let's quickly describe the device-tree concept before detailing
the storage format. This chapter does _not_ describe the detail of the
required types of nodes & properties for the kernel, this is done
later in chapter III.
The device-tree layout is strongly inherited from the definition of
the Open Firmware IEEE 1275 device-tree. It's basically a tree of
nodes, each node having two or more named properties. A property can
have a value or not.
It is a tree, so each node has one and only one parent except for the
root node who has no parent.
A node has 2 names. The actual node name is generally contained in a
property of type "name" in the node property list whose value is a
zero terminated string and is mandatory for version 1 to 3 of the
format definition (as it is in Open Firmware). Version 0x10 makes it
optional as it can generate it from the unit name defined below.
There is also a "unit name" that is used to differenciate nodes with
the same name at the same level, it is usually made of the node
name's, the "@" sign, and a "unit address", which definition is
specific to the bus type the node sits on.
The unit name doesn't exist as a property per-se but is included in the
device-tree structure. It is typically used to represent "path" in the
device-tree. More details about the actual format of these will be
below.
The kernel ppc64 generic code does not make any formal use of the unit
address (though some board support code may do) so the only real
requirement here for the unit address is to ensure uniqueness of
the node unit name at a given level of the tree. Nodes with no notion
of address and no possible sibling of the same name (like /memory or
/cpus) may ommit the unit address in the context of this
specification, or use the "@0" default unit address.
The unit name is used to define a node "full path", which is the
concatenation of all parent nodes unit names separated with "/".
The root node doesn't have a defined name, and isn't required to have
a name property either if you are using version 3 or earlier of the
format. It also has no unit address (no @ symbol followed by a unit
address). The root node unit name is thus an empty string. The full
path to the root node is "/"
Every node who actually represents an actual device (that is who isn't
only a virtual "container" for more nodes, like "/cpus" is) is also
required to have a "device_type" property indicating the type of node
Finally, every node that can be referrenced from a property in another
node is required to have a "linux,phandle" property. Real open
firmware implementations do provide a unique "phandle" value for every
node that the "prom_init()" trampoline code turns into
"linux,phandle" properties. However, this is made optional if the
flattened is used directly. An example of a node referencing another
node via "phandle" is when laying out the interrupt tree which will be
described in a further version of this document.
This propery is a 32 bits value that uniquely identify a node. You are
free to use whatever values or system of values, internal pointers, or
whatever to generate these, the only requirement is that every node
for which you provide that property has a unique value for it.
Here is an example of a simple device-tree. In this example, a "o"
designates a node followed by the node unit name. Properties are
presented with their name followed by their content. "content"
represent an ASCII string (zero terminated) value, while <content>
represent a 32 bits hexadecimal value. The various nodes in this
example will be discusse in a later chapter. At this point, it is
only meant to give you a idea of what a device-tree looks like. I have
on purpose kept the "name" and "linux,phandle" properties which aren't
necessary in order to give you a better idea of what the tree looks
like in practice.
/ o device-tree
|- name = "device-tree"
|- model = "MyBoardName"
|- compatible = "MyBoardFamilyName"
|- #address-cells = <2>
|- #size-cells = <2>
|- linux,phandle = <0>
|
o cpus
| | - name = "cpus"
| | - linux,phandle = <1>
| | - #address-cells = <1>
| | - #size-cells = <0>
| |
| o PowerPC,970@0
| |- name = "PowerPC,970"
| |- device_type = "cpu"
| |- reg = <0>
| |- clock-frequency = <5f5e1000>
| |- linux,boot-cpu
| |- linux,phandle = <2>
|
o memory@0
| |- name = "memory"
| |- device_type = "memory"
| |- reg = <00000000 00000000 00000000 20000000>
| |- linux,phandle = <3>
|
o chosen
|- name = "chosen"
|- bootargs = "root=/dev/sda2"
|- linux,platform = <00000600>
|- linux,phandle = <4>
This tree is almost a minimal tree. It pretty much contains the
minimal set of required nodes and properties to boot a linux kernel,
that is some basic model informations at the root, the CPUs, the
physical memory layout, and misc informations passed through /chosen
like in this example, the platform type (mandatory) and the kernel
command line arguments (optional).
The /cpus/PowerPC,970@0/linux,boot-cpu property is an example of a
property without a value. All other properties have a value. The
signification of the #address-cells and #size-cells properties will be
explained in chapter IV which defines precisely the required nodes and
properties and their content.
3) Device tree "structure" block
The structure of the device tree is a linearized tree structure. The
"OF_DT_BEGIN_NODE" token starts a new node, and the "OF_DT_END" ends
that node definition. Child nodes are simply defined before
"OF_DT_END" (that is nodes within the node). A 'token' is a 32 bits
value.
Here's the basic structure of a single node:
* token OF_DT_BEGIN_NODE (that is 0x00000001)
* for version 1 to 3, this is the node full path as a zero
terminated string, starting with "/". For version 16 and later,
this is the node unit name only (or an empty string for the
root node)
* [align gap to next 4 bytes boundary]
* for each property:
* token OF_DT_PROP (that is 0x00000003)
* 32 bits value of property value size in bytes (or 0 of no
value)
* 32 bits value of offset in string block of property name
* [align gap to either next 4 bytes boundary if the property
value
size is less or equal to 4 bytes, or to next 8 bytes
boundary if the property value size is larger than 4 bytes]
* property value data if any
* [align gap to next 4 bytes boundary]
* [child nodes if any]
* token OF_DT_END (that is 0x00000002)
So the node content can be summmarised as a start token, a full path, a
list of
properties, a list of child node and an end token. Every child node is
a full node structure itself as defined above
4) Device tree 'strings" block
In order to save space, property names, which are generally redundant,
are stored separately in the "strings" block. This block is simply the
whole bunch of zero terminated strings for all property names
concatenated together. The device-tree property definitions in the
structure block will contain offset values from the beginning of the
strings block.
III - Required content of the device tree
=========================================
WARNING: All "linux,*" properties defined in this document apply only
to a flattened device-tree. If your platform uses a real
implementation of Open Firmware or an implementation compatible with
the Open Firmware client interface, those properties will be created
by the trampoline code in the kernel's prom_init() file. For example,
that's where you'll have to add code to detect your board model and
set the platform number. However, when using the flatenned device-tree
entry point, there is no prom_init() pass, and thus you have to
provide those properties yourself.
1) Note about cells and address representation
----------------------------------------------
The general rule is documented in the various Open Firmware
documentations. If you chose to describe a bus with the device-tree
and there exist an OF bus binding, then you should follow the
specification. However, the kernel does not require every single
device or bus to be described by the device tree.
In general, the format of an address for a device is defined by the
parent bus type, based on the #address-cells and #size-cells property.
In
absence of such a property, the parent's parent values are used,
etc... The kernel requires the root node to have those properties
defining addresses format for devices directly mapped on the processor
bus.
Those 2 properties define 'cells' for representing an address and a
size. A "cell" is a 32 bits number. For example, if both contain 2
like the example tree given above, then an address and a size are both
composed of 2 cells, that is a 64 bits number (cells are concatenated
and expected to be in big endian format). Another example is the way
Apple firmware define them, that is 2 cells for an address and one
cell for a size.
A device IO or MMIO areas on the bus are defined in the "reg"
property. The format of this property depends on the bus the device is
sitting on. Standard bus types define their "reg" properties format in
the various OF bindings for those bus types, you are free to define
your own "reg" format for proprietary busses or virtual busses
enclosing on-chip devices, though it is recommended that the parts of
the "reg" property containing addresses and sizes do respect the
defined #address-cells and #size-cells when those make sense.
Later, I will define more precisely some common address formats.
For a new ppc64 board, I recommend to use either the 2/2 format or
Apple's 2/1 format which is slightly more compact since sizes usually
fit in a single 32 bits word.
2) Note about "compatible" properties
-------------------------------------
Those properties are optional, but recommended in devices and the root
node. The format of a "compatible" property is a list of concatenated
zero terminated strings. They allow a device to express it's
compatibility with a family of similar devices, in some cases,
allowing a single driver to match against several devices regardless
of their actual names
3) Note about "name" properties
-------------------------------
While earlier users of Open Firmware like OldWorld macintoshes tended
to use the actual device name for the "name" property, it's nowadays
considered a good practice to use a name that is closer to the device
class (often equal to device_type). For example, nowadays, ethernet
controllers are named "ethernet", an additional "model" property
defining precisely the chip type/model, and "compatible" property
defining the family in case a single driver can driver more than one
of these chips. The kernel however doesn't generally put any
restriction on the "name" property, it is simply considered good
practice to folow the standard and it's evolutions as closely as
possible.
Note also that the new format version 16 makes the "name" property
optional. If it's absent for a node, then the node's unit name is then
used to reconstruct the name. That is, the part of the unit name
before the "@" sign is used (or the entire unit name if no "@" sign
is present).
4) Note about node and property names and character set
-------------------------------------------------------
While open firmware provides more flexibe usage of 8859-1, this
specification enforces more strict rules. Nodes and properties should
be comprised only of ASCII characters 'a' to 'z', '0' to
'9', ',', '.', '_', '+', '#', '?', and '-'. Node names additionally
allow uppercase characters 'A' to 'Z' (property names should be
lowercase. The fact that vendors like Apple don't respect this rule is
irrelevant here).
Additionally, node and property names should always begin with a
character in the range 'a' to 'z' (or 'A' to 'Z' for node names).
The maximum number of characters for both nodes and property names
is 31. In the case of node names, this is only the leftmost part of
a unit name (the pure "name" property), it doesn't include the unit
address which can extend beyond that limit.
5) Required nodes and properties
--------------------------------
a) The root node
The root node requires some properties to be present:
- model : this is your board name/model
- #address-cells : address representation for "root" devices
- #size-cells: the size representation for "root" devices
Additionally, some recommended properties are:
- compatible : the board "family" generally finds its way here,
for example, if you have 2 board models with a similar layout,
that typically get driven by the same platform code in the
kernel, you would use a different "model" property but put a
value in "compatible". The kernel doesn't directly use that
value (see /chosen/linux,platform for how the kernel choses a
platform type) but it is generally useful.
It's also generally where you add additional properties specific
to your board like the serial number if any, that sort of thing. it
is recommended that if you add any "custom" property whose name may
clash with standard defined ones, you prefix them with your vendor
name and a comma.
b) The /cpus node
This node is the parent of all individual CPUs nodes. It doesn't
have any specific requirements, though it's generally good practice
to have at least:
#address-cells = <00000001>
#size-cells = <00000000>
This defines that the "address" for a CPU is a single cell, and has
no meaningful size. This is not necessary but the kernel will assume
that format when reading the "reg" properties of a CPU node, see
below
c) The /cpus/* nodes
So under /cpus, you are supposed to create a node for every CPU on
the machine. There is no specific restriction on the name of the
CPU, though It's common practice to call it PowerPC,<name>, for
example, Apple uses PowerPC,G5 while IBM uses PowerPC,970FX.
Required properties:
- device_type : has to be "cpu"
- reg : This is the physical cpu number, it's single 32 bits cell,
this is also used as-is as the unit number for constructing the
unit name in the full path, for example, with 2 CPUs, you would
have the full path:
/cpus/PowerPC,970FX@0
/cpus/PowerPC,970FX@1
(unit addresses do not require to have leading zero's)
- d-cache-line-size : one cell, L1 data cache line size in bytes
- i-cache-line-size : one cell, L1 instruction cache line size in
bytes
- d-cache-size : one cell, size of L1 data cache in bytes
- i-cache-size : one cell, size of L1 instruction cache in bytes
Recommended properties:
- timebase-frequency : a cell indicating the frequency of the
timebase in Hz. This is not directly used by the generic code,
but you are welcome to copy/paste the pSeries code for setting
the kernel timebase/decrementer calibration based on this
value.
- clock-frequency : a cell indicating the CPU core clock frequency
in Hz. A new property will be defined for 64 bits value, but if
your frequency is < 4Ghz, one cell is enough. Here as well as
for the above, the common code doesn't use that property, but
you are welcome to re-use the pSeries or Maple one. A future
kernel version might provide a common function for this.
You are welcome to add any property you find relevant to your board,
like some informations about mecanism used to soft-reset the CPUs
for example (Apple puts the GPIO number for CPU soft reset lines in
there as a "soft-reset" property as they start secondary CPUs by
soft-resetting them).
d) the /memory node(s)
To define the physical memory layout of your board, you should
create one or more memory node(s). You can either create a single
node with all memory ranges in it's reg property, or you can create
several nodes, as you wishes. The unit address (@ part) used for the
full path is the address of the first range of memory defined by a
given node. If you use a single memory node, this will typically be
@0.
Required properties:
- device_type : has to be "memory"
- reg : This property contain all the physical memory ranges of
your board. It's a list of addresses/sizes concatenated
together, the number of cell of those beeing defined by the
#address-cells and #size-cells of the root node. For example,
with both of these properties beeing 2 like in the example given
earlier, a 970 based machine with 6Gb of RAM could typically
have a "reg" property here that looks like:
00000000 00000000 00000000 80000000
00000001 00000000 00000001 00000000
That is a range starting at 0 of 0x80000000 bytes and a range
starting at 0x100000000 and of 0x100000000 bytes. You can see
that there is no memory covering the IO hold between 2Gb and
4Gb. Some vendors prefer splitting those ranges into smaller
segments, the kernel doesn't care.
c) The /chosen node
This node is a bit "special". Normally, that's where open firmware
puts some variable environment informations, like the arguments, or
phandle pointers to nodes like the main interrupt controller, or the
default input/output devices.
This specification makes a few of these mandatory, but also defines
some linux specific properties that would be normally constructed by
the
prom_init() trampoline when booting with an OF client interface, but
that you have to provide yourself when using the flattened format.
Required properties:
- linux,platform : This is your platform number as assigned by the
architecture maintainers
Recommended properties:
- bootargs : This zero terminated string is passed as the kernel
command line
- linux,stdout-path : This is the full path to your standard
console device if any. Typically, if you have serial devices on
your board, you may want to put the full path to the one set as
the default console in the firmware here, for the kernel to pick
it up as it's own default console. If you look at the funciton
set_preferred_console() in arch/ppc64/kernel/setup.c, you'll see
that the kernel tries to find out the default console and has
knowledge of various types like 8250 serial ports. You may want
to extend this function to add your own.
- interrupt-controller : This is one cell containing a phandle
value that matches the "linux,phandle" property of your main
interrupt controller node. May be used for interrupt routing.
This is all that is currently required. However, it is strongly
recommended that you expose PCI host bridges as documented in the
PCI binding to open firmware, and your interrupt tree as documented
in OF interrupt tree specification.
IV - Recommendation for a bootloader
====================================
Here are some various ideas/recommendations that have been proposed
while all this has been defined and implemented.
- It should be possible to write a parser that turns an ASCII
representation of a device-tree (or even XML though I find that
less readable) into a device-tree block. This would allow to
basically build the device-tree structure and strings "blobs" at
bootloader build time, and have the bootloader just pass-them
as-is to the kernel. In fact, the device-tree blob could be then
separate from the bootloader itself, an be placed in a separate
portion of the flash that can be "personalized" for different
board types by flashing a different device-tree
- A very The bootloader may want to be able to use the device-tree
itself and may want to manipulate it (to add/edit some properties,
like physical memory size or kernel arguments). At this point, 2
choices can be made. Either the bootloader works directly on the
flattened format, or the bootloader has it's own internal tree
representation with pointers (similar to the kernel one) and
re-flattens the tree when booting the kernel. The former is a bit
more difficult to edit/modify, the later requires probably a bit
more code to handle the tree structure. Note that the structure
format has been designed so it's relatively easy to "insert"
properties or nodes or delete them by just memmovin'g things
around. It contains no internal offsets or pointers for this
purpose.
- An example of code for iterating nodes & retreiving properties
directly from the flattened tree format can be found in the kernel
file arch/ppc64/kernel/prom.c, look at scan_flat_dt() function,
it's usage in early_init_devtree(), and the corresponding various
early_init_dt_scan_*() callbacks. That code can be re-used in a
GPL bootloader, and as the author of that code, I would be happy
do discuss possible free licencing to any vendor who wishes to
integrate all or part of this code into a non-GPL bootloader.
^ permalink raw reply
* Re: Booting the Linux/ppc64 kernel without Open Firmware HOWTO (v3)
From: Benjamin Herrenschmidt @ 2005-05-24 4:35 UTC (permalink / raw)
To: linuxppc64-dev; +Cc: linuxppc-dev list, Tzachi Perelstein, u-boot-users
In-Reply-To: <1116909286.4992.17.camel@gaston>
On Tue, 2005-05-24 at 14:34 +1000, Benjamin Herrenschmidt wrote:
> Hi !
>
> Here's revision 3 of the spec for the booting of linux/ppc64 with a
> flattened device-tree. The novelty is that I added a new more compact
> format. A followup mail will have the kernel patches to add support to
> this new format, I'll submit them upstream for after 2.6.12 I think.
>
> David and I are still working on sample code & tools. We have a
> prototype of a device-tree "compiler" that can build the flattened blob
> from a textual representation. We'll release that soon, hopefully this
> week.
And here is the patch:
Index: linux-work/arch/ppc64/kernel/prom_init.c
===================================================================
--- linux-work.orig/arch/ppc64/kernel/prom_init.c 2005-05-23 18:15:28.000000000 +1000
+++ linux-work/arch/ppc64/kernel/prom_init.c 2005-05-24 14:10:00.000000000 +1000
@@ -1514,7 +1514,14 @@
return 0;
}
-static void __init scan_dt_build_strings(phandle node, unsigned long *mem_start,
+/*
+ * The Open Firmware 1275 specification states properties must be 31 bytes or
+ * less, however not all firmwares obey this. Make it 64 bytes to be safe.
+ */
+#define MAX_PROPERTY_NAME 64
+
+static void __init scan_dt_build_strings(phandle node,
+ unsigned long *mem_start,
unsigned long *mem_end)
{
unsigned long offset = reloc_offset();
@@ -1527,14 +1534,19 @@
/* get and store all property names */
prev_name = RELOC("");
for (;;) {
-
- /* 32 is max len of name including nul. */
- namep = make_room(mem_start, mem_end, 32, 1);
+ namep = make_room(mem_start, mem_end, MAX_PROPERTY_NAME, 1);
if (call_prom("nextprop", 3, 1, node, prev_name, namep) <= 0) {
/* No more nodes: unwind alloc */
*mem_start = (unsigned long)namep;
break;
}
+
+ /* skip "name" */
+ if (strcmp(namep, RELOC("name")) == 0) {
+ *mem_start = (unsigned long)namep;
+ prev_name = RELOC("name");
+ continue;
+ }
soff = dt_find_string(namep);
if (soff != 0) {
*mem_start = (unsigned long)namep;
@@ -1555,12 +1567,6 @@
}
}
-/*
- * The Open Firmware 1275 specification states properties must be 31 bytes or
- * less, however not all firmwares obey this. Make it 64 bytes to be safe.
- */
-#define MAX_PROPERTY_NAME 64
-
static void __init scan_dt_build_struct(phandle node, unsigned long *mem_start,
unsigned long *mem_end)
{
@@ -1570,10 +1576,8 @@
unsigned long soff;
unsigned char *valp;
unsigned long offset = reloc_offset();
- char pname[MAX_PROPERTY_NAME];
- char *path;
-
- path = RELOC(prom_scratch);
+ static char pname[MAX_PROPERTY_NAME] __initdata;
+ char *path, *p, *lp;
dt_push_token(OF_DT_BEGIN_NODE, mem_start, mem_end);
@@ -1588,10 +1592,20 @@
call_prom("package-to-path", 3, 1, node, namep, l);
}
namep[l] = '\0';
- *mem_start = _ALIGN(((unsigned long) namep) + strlen(namep) + 1, 4);
+ /* now try to find the unit name in that mess */
+ p = namep;
+ lp = NULL;
+ for (lp = NULL; *p; p++)
+ if (*p == '/')
+ lp = p + 1;
+ if (lp != NULL)
+ memmove(namep, lp, strlen(lp) + 1);
+ *mem_start = _ALIGN(((unsigned long) namep) +
+ strlen(namep) + 1, 4);
}
/* get it again for debugging */
+ path = RELOC(prom_scratch);
memset(path, 0, PROM_SCRATCH_SIZE);
call_prom("package-to-path", 3, 1, node, path, PROM_SCRATCH_SIZE-1);
@@ -1599,20 +1613,24 @@
prev_name = RELOC("");
sstart = (char *)RELOC(dt_string_start);
for (;;) {
- if (call_prom("nextprop", 3, 1, node, prev_name, pname) <= 0)
+ if (call_prom("nextprop", 3, 1, node, prev_name,
+ RELOC(pname)) <= 0)
break;
-
+ if (strcmp(RELOC(pname), RELOC("name")) == 0) {
+ prev_name = RELOC("name");
+ continue;
+ }
/* find string offset */
- soff = dt_find_string(pname);
+ soff = dt_find_string(RELOC(pname));
if (soff == 0) {
- prom_printf("WARNING: Can't find string index for <%s>, node %s\n",
- pname, path);
+ prom_printf("WARNING: Can't find string index "
+ "for <%s>, node %s\n", RELOC(pname), path);
break;
}
prev_name = sstart + soff;
/* get length */
- l = call_prom("getproplen", 2, 1, node, pname);
+ l = call_prom("getproplen", 2, 1, node, RELOC(pname));
/* sanity checks */
if (l < 0)
@@ -1621,7 +1639,7 @@
prom_printf("WARNING: ignoring large property ");
/* It seems OF doesn't null-terminate the path :-( */
prom_printf("[%s] ", path);
- prom_printf("%s length 0x%x\n", pname, l);
+ prom_printf("%s length 0x%x\n", RELOC(pname), l);
continue;
}
@@ -1633,15 +1651,15 @@
/* push property content */
align = (l >= 8) ? 8 : 4;
valp = make_room(mem_start, mem_end, l, align);
- call_prom("getprop", 4, 1, node, pname, valp, l);
+ call_prom("getprop", 4, 1, node, RELOC(pname), valp, l);
*mem_start = _ALIGN(*mem_start, 4);
}
/* Add a "linux,phandle" property. */
soff = dt_find_string(RELOC("linux,phandle"));
if (soff == 0)
- prom_printf("WARNING: Can't find string index for <linux-phandle>"
- " node %s\n", path);
+ prom_printf("WARNING: Can't find string index for"
+ " <linux-phandle> node %s\n", path);
else {
dt_push_token(OF_DT_PROP, mem_start, mem_end);
dt_push_token(4, mem_start, mem_end);
@@ -1691,7 +1709,8 @@
/* Build header and make room for mem rsv map */
mem_start = _ALIGN(mem_start, 4);
- hdr = make_room(&mem_start, &mem_end, sizeof(struct boot_param_header), 4);
+ hdr = make_room(&mem_start, &mem_end,
+ sizeof(struct boot_param_header), 4);
RELOC(dt_header_start) = (unsigned long)hdr;
rsvmap = make_room(&mem_start, &mem_end, sizeof(mem_reserve_map), 8);
@@ -1704,11 +1723,11 @@
namep = make_room(&mem_start, &mem_end, 16, 1);
strcpy(namep, RELOC("linux,phandle"));
mem_start = (unsigned long)namep + strlen(namep) + 1;
- RELOC(dt_string_end) = mem_start;
/* Build string array */
prom_printf("Building dt strings...\n");
scan_dt_build_strings(root, &mem_start, &mem_end);
+ RELOC(dt_string_end) = mem_start;
/* Build structure */
mem_start = PAGE_ALIGN(mem_start);
@@ -1723,9 +1742,11 @@
hdr->totalsize = RELOC(dt_struct_end) - RELOC(dt_header_start);
hdr->off_dt_struct = RELOC(dt_struct_start) - RELOC(dt_header_start);
hdr->off_dt_strings = RELOC(dt_string_start) - RELOC(dt_header_start);
+ hdr->dt_strings_size = RELOC(dt_string_end) - RELOC(dt_string_start);
hdr->off_mem_rsvmap = ((unsigned long)rsvmap) - RELOC(dt_header_start);
hdr->version = OF_DT_VERSION;
- hdr->last_comp_version = 1;
+ /* Version 16 is not backward compatible */
+ hdr->last_comp_version = 0x10;
/* Reserve the whole thing and copy the reserve map in, we
* also bump mem_reserve_cnt to cause further reservations to
Index: linux-work/arch/ppc64/kernel/setup.c
===================================================================
--- linux-work.orig/arch/ppc64/kernel/setup.c 2005-05-23 18:15:28.000000000 +1000
+++ linux-work/arch/ppc64/kernel/setup.c 2005-05-23 18:16:09.000000000 +1000
@@ -10,7 +10,7 @@
* 2 of the License, or (at your option) any later version.
*/
-#undef DEBUG
+#define DEBUG
#include <linux/config.h>
#include <linux/module.h>
Index: linux-work/arch/ppc64/kernel/prom.c
===================================================================
--- linux-work.orig/arch/ppc64/kernel/prom.c 2005-05-23 18:15:28.000000000 +1000
+++ linux-work/arch/ppc64/kernel/prom.c 2005-05-24 14:12:35.000000000 +1000
@@ -15,7 +15,7 @@
* 2 of the License, or (at your option) any later version.
*/
-#undef DEBUG
+#define DEBUG
#include <stdarg.h>
#include <linux/config.h>
@@ -635,20 +635,23 @@
* unflatten the tree
*/
static int __init scan_flat_dt(int (*it)(unsigned long node,
- const char *full_path, void *data),
+ const char *uname, int depth, void *data),
void *data)
{
unsigned long p = ((unsigned long)initial_boot_params) +
initial_boot_params->off_dt_struct;
int rc = 0;
+ int depth = -1;
do {
u32 tag = *((u32 *)p);
char *pathp;
p += 4;
- if (tag == OF_DT_END_NODE)
+ if (tag == OF_DT_END_NODE) {
+ depth --;
continue;
+ }
if (tag == OF_DT_END)
break;
if (tag == OF_DT_PROP) {
@@ -664,9 +667,18 @@
" device tree !\n", tag);
return -EINVAL;
}
+ depth++;
pathp = (char *)p;
p = _ALIGN(p + strlen(pathp) + 1, 4);
- rc = it(p, pathp, data);
+ if ((*pathp) == '/') {
+ char *lp, *np;
+ for (lp = NULL, np = pathp; *np; np++)
+ if ((*np) == '/')
+ lp = np+1;
+ if (lp != NULL)
+ pathp = lp;
+ }
+ rc = it(p, pathp, depth, data);
if (rc != 0)
break;
} while(1);
@@ -727,13 +739,16 @@
static unsigned long __init unflatten_dt_node(unsigned long mem,
unsigned long *p,
struct device_node *dad,
- struct device_node ***allnextpp)
+ struct device_node ***allnextpp,
+ unsigned long fpsize)
{
struct device_node *np;
struct property *pp, **prev_pp = NULL;
char *pathp;
u32 tag;
- unsigned int l;
+ unsigned int l, allocl;
+ int has_name = 0;
+ int new_format = 0;
tag = *((u32 *)(*p));
if (tag != OF_DT_BEGIN_NODE) {
@@ -742,21 +757,56 @@
}
*p += 4;
pathp = (char *)*p;
- l = strlen(pathp) + 1;
+ l = allocl = strlen(pathp) + 1;
*p = _ALIGN(*p + l, 4);
- np = unflatten_dt_alloc(&mem, sizeof(struct device_node) + l,
+ /* version 0x10 has a more compact unit name here instead of the full
+ * path. we accumulate the full path size using "fpsize", we'll rebuild
+ * it later. We detect this because the first character of the name is
+ * not '/'.
+ */
+ if ((*pathp) != '/') {
+ new_format = 1;
+ if (fpsize == 0) {
+ /* root node: special case. fpsize accounts for path
+ * plus terminating zero. root node only has '/', so
+ * fpsize should be 2, but we want to avoid the first
+ * level nodes to have two '/' so we use fpsize 1 here
+ */
+ fpsize = 1;
+ allocl = 2;
+ } else {
+ /* account for '/' and path size minus terminal 0
+ * already in 'l'
+ */
+ fpsize += l;
+ allocl = fpsize;
+ }
+ }
+
+
+ np = unflatten_dt_alloc(&mem, sizeof(struct device_node) + allocl,
__alignof__(struct device_node));
if (allnextpp) {
memset(np, 0, sizeof(*np));
np->full_name = ((char*)np) + sizeof(struct device_node);
- memcpy(np->full_name, pathp, l);
+ if (new_format) {
+ char *p = np->full_name;
+ /* rebuild full path for new format */
+ if (dad && dad->parent) {
+ strcpy(p, dad->full_name);
+ p += strlen(p);
+ }
+ *(p++) = '/';
+ memcpy(p, pathp, l);
+ } else
+ memcpy(np->full_name, pathp, l);
prev_pp = &np->properties;
**allnextpp = np;
*allnextpp = &np->allnext;
if (dad != NULL) {
np->parent = dad;
- /* we temporarily use the `next' field as `last_child'. */
+ /* we temporarily use the next field as `last_child'*/
if (dad->next == 0)
dad->child = np;
else
@@ -782,6 +832,8 @@
printk("Can't find property name in list !\n");
break;
}
+ if (strcmp(pname, "name") == 0)
+ has_name = 1;
l = strlen(pname) + 1;
pp = unflatten_dt_alloc(&mem, sizeof(struct property),
__alignof__(struct property));
@@ -801,6 +853,29 @@
}
*p = _ALIGN((*p) + sz, 4);
}
+ /* with version 0x10 we may not have the name property, recreate
+ * it here from the unit name if absent
+ */
+ if (!has_name) {
+ char *p = pathp;
+ int sz;
+
+ DBG("no name, building from %s\n", p);
+ while (*p && (*p) != '@')
+ p++;
+ sz = (p - pathp) + 1;
+ pp = unflatten_dt_alloc(&mem, sizeof(struct property) + sz,
+ __alignof__(struct property));
+ if (allnextpp) {
+ pp->name = "name";
+ pp->length = sz;
+ pp->value = (unsigned char *)(pp + 1);
+ *prev_pp = pp;
+ prev_pp = &pp->next;
+ memcpy(pp->value, pathp, sz - 1);
+ ((char *)pp->value)[sz - 1] = 0;
+ }
+ }
if (allnextpp) {
*prev_pp = NULL;
np->name = get_property(np, "name", NULL);
@@ -812,7 +887,7 @@
np->type = "<NULL>";
}
while (tag == OF_DT_BEGIN_NODE) {
- mem = unflatten_dt_node(mem, p, np, allnextpp);
+ mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);
tag = *((u32 *)(*p));
}
if (tag != OF_DT_END_NODE) {
@@ -842,7 +917,7 @@
/* First pass, scan for size */
start = ((unsigned long)initial_boot_params) +
initial_boot_params->off_dt_struct;
- size = unflatten_dt_node(0, &start, NULL, NULL);
+ size = unflatten_dt_node(0, &start, NULL, NULL, 0);
DBG(" size is %lx, allocating...\n", size);
@@ -854,7 +929,7 @@
/* Second pass, do actual unflattening */
start = ((unsigned long)initial_boot_params) +
initial_boot_params->off_dt_struct;
- unflatten_dt_node(mem, &start, NULL, &allnextp);
+ unflatten_dt_node(mem, &start, NULL, &allnextp, 0);
if (*((u32 *)start) != OF_DT_END)
printk(KERN_WARNING "Weird tag at end of tree: %x\n", *((u32 *)start));
*allnextp = NULL;
@@ -880,7 +955,7 @@
static int __init early_init_dt_scan_cpus(unsigned long node,
- const char *full_path, void *data)
+ const char *uname, int depth, void *data)
{
char *type = get_flat_dt_prop(node, "device_type", NULL);
u32 *prop;
@@ -933,13 +1008,15 @@
}
static int __init early_init_dt_scan_chosen(unsigned long node,
- const char *full_path, void *data)
+ const char *uname, int depth, void *data)
{
u32 *prop;
u64 *prop64;
extern unsigned long memory_limit, tce_alloc_start, tce_alloc_end;
- if (strcmp(full_path, "/chosen") != 0)
+ DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
+
+ if (depth != 1 || strcmp(uname, "chosen") != 0)
return 0;
/* get platform type */
@@ -989,18 +1066,20 @@
}
static int __init early_init_dt_scan_root(unsigned long node,
- const char *full_path, void *data)
+ const char *uname, int depth, void *data)
{
u32 *prop;
- if (strcmp(full_path, "/") != 0)
+ if (depth != 0)
return 0;
prop = (u32 *)get_flat_dt_prop(node, "#size-cells", NULL);
dt_root_size_cells = (prop == NULL) ? 1 : *prop;
-
+ DBG("dt_root_size_cells = %x\n", dt_root_size_cells);
+
prop = (u32 *)get_flat_dt_prop(node, "#address-cells", NULL);
dt_root_addr_cells = (prop == NULL) ? 2 : *prop;
+ DBG("dt_root_addr_cells = %x\n", dt_root_addr_cells);
/* break now */
return 1;
@@ -1028,7 +1107,7 @@
static int __init early_init_dt_scan_memory(unsigned long node,
- const char *full_path, void *data)
+ const char *uname, int depth, void *data)
{
char *type = get_flat_dt_prop(node, "device_type", NULL);
cell_t *reg, *endp;
@@ -1044,7 +1123,9 @@
endp = reg + (l / sizeof(cell_t));
- DBG("memory scan node %s ...\n", full_path);
+ DBG("memory scan node %s ..., reg size %ld, data: %x %x %x %x, ...\n",
+ uname, l, reg[0], reg[1], reg[2], reg[3]);
+
while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
unsigned long base, size;
@@ -1455,10 +1536,11 @@
struct device_node *np = allnodes;
read_lock(&devtree_lock);
- for (; np != 0; np = np->allnext)
+ for (; np != 0; np = np->allnext) {
if (np->full_name != 0 && strcasecmp(np->full_name, path) == 0
&& of_node_get(np))
break;
+ }
read_unlock(&devtree_lock);
return np;
}
Index: linux-work/include/asm-ppc64/prom.h
===================================================================
--- linux-work.orig/include/asm-ppc64/prom.h 2005-05-23 18:15:28.000000000 +1000
+++ linux-work/include/asm-ppc64/prom.h 2005-05-23 18:16:09.000000000 +1000
@@ -22,13 +22,14 @@
#define RELOC(x) (*PTRRELOC(&(x)))
/* Definitions used by the flattened device tree */
-#define OF_DT_HEADER 0xd00dfeed /* 4: version, 4: total size */
-#define OF_DT_BEGIN_NODE 0x1 /* Start node: full name */
+#define OF_DT_HEADER 0xd00dfeed /* marker */
+#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */
#define OF_DT_END_NODE 0x2 /* End node */
-#define OF_DT_PROP 0x3 /* Property: name off, size, content */
+#define OF_DT_PROP 0x3 /* Property: name off, size,
+ * content */
#define OF_DT_END 0x9
-#define OF_DT_VERSION 1
+#define OF_DT_VERSION 0x10
/*
* This is what gets passed to the kernel by prom_init or kexec
@@ -54,7 +55,9 @@
u32 version; /* format version */
u32 last_comp_version; /* last compatible version */
/* version 2 fields below */
- u32 boot_cpuid_phys; /* Which physical CPU id we're booting on */
+ u32 boot_cpuid_phys; /* Physical CPU id we're booting on */
+ /* version 3 fields below */
+ u32 dt_strings_size; /* size of the DT strings block */
};
@@ -169,17 +172,20 @@
*/
#define HAVE_ARCH_DEVTREE_FIXUPS
-static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
+static inline void set_node_proc_entry(struct device_node *dn,
+ struct proc_dir_entry *de)
{
dn->pde = de;
}
-static void inline set_node_name_link(struct device_node *dn, struct proc_dir_entry *de)
+static void inline set_node_name_link(struct device_node *dn,
+ struct proc_dir_entry *de)
{
dn->name_link = de;
}
-static void inline set_node_addr_link(struct device_node *dn, struct proc_dir_entry *de)
+static void inline set_node_addr_link(struct device_node *dn,
+ struct proc_dir_entry *de)
{
dn->addr_link = de;
}
^ permalink raw reply
* Re: Booting the Linux/ppc64 kernel without Open Firmware HOWTO (v3)
From: Segher Boessenkool @ 2005-05-24 7:50 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: linuxppc64-dev, Tzachi Perelstein, u-boot-users,
linuxppc-dev list
In-Reply-To: <1116909351.4992.19.camel@gaston>
> +/*
> + * The Open Firmware 1275 specification states properties must be 31
> bytes or
> + * less, however not all firmwares obey this. Make it 64 bytes to be
> safe.
> + */
Not true. There is no restriction on the length of properties
(or property _names_, which I guess is what you meant). There
is the 31-char restriction on _node_ names, though (and the node
name is only the part before the optional @ or : -- and at a
minimum, the part after @ but before : is needed to disambiguate
the node).
I didn't review the rest of the code, sorry.
Segher
^ permalink raw reply
* Re: Booting the Linux/ppc64 kernel without Open Firmware HOWTO (v3)
From: Benjamin Herrenschmidt @ 2005-05-24 7:55 UTC (permalink / raw)
To: Segher Boessenkool
Cc: linuxppc64-dev, Tzachi Perelstein, u-boot-users,
linuxppc-dev list
In-Reply-To: <78325f65fc807da213be423c20ce6dcd@kernel.crashing.org>
On Tue, 2005-05-24 at 09:50 +0200, Segher Boessenkool wrote:
> > +/*
> > + * The Open Firmware 1275 specification states properties must be 31
> > bytes or
> > + * less, however not all firmwares obey this. Make it 64 bytes to be
> > safe.
> > + */
>
> Not true. There is no restriction on the length of properties
> (or property _names_, which I guess is what you meant).
Yes, we meant names, and yes, there is a limit of 31 characters + 0,
that is 32 bytes (see "3.2.2.1.1 Property names" in 1275. BTW. Do you
have a useable version of this document ? mine is a totally broken PDF
made from a crappy .ps :)
IBM firmware broke that limit in a couple of places though...
> There
> is the 31-char restriction on _node_ names, though (and the node
> name is only the part before the optional @ or : -- and at a
> minimum, the part after @ but before : is needed to disambiguate
> the node).
Yes, I know all that.
> I didn't review the rest of the code, sorry.
No worries :)
Ben.
^ permalink raw reply
* Re: Booting the Linux/ppc64 kernel without Open Firmware HOWTO (v3)
From: Segher Boessenkool @ 2005-05-24 8:01 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: linuxppc-dev list, Tzachi Perelstein, u-boot-users,
linuxppc64-dev
In-Reply-To: <1116921302.6395.6.camel@gaston>
> Yes, we meant names, and yes, there is a limit of 31 characters + 0,
Nah, it's thirty-one chars, not 31. Sorry for missing this.
> that is 32 bytes (see "3.2.2.1.1 Property names" in 1275. BTW. Do you
> have a useable version of this document ? mine is a totally broken PDF
> made from a crappy .ps :)
Mine is a perfectly working PDF from a perfectly working PS. I'll send
it to you.
> IBM firmware broke that limit in a couple of places though...
That's what happens if there isn't a testsuite anywhere.
> Yes, I know all that.
Good :-)
Segher
^ permalink raw reply
* Re: [Linux-ATM-General] Memory mapping the PHY on CR826
From: Alex Zeffertt @ 2005-05-24 8:46 UTC (permalink / raw)
To: Koen Peeters; +Cc: linux-atm-general, linuxppc-embedded
In-Reply-To: <42924071.7010804@cellink.net>
Hi Koen,
Well spotted! Unfortunately this is not the problem. I got the base
address and mask the wrong way round in my email but they are the right
way round in my code. Oops.
I tried your OR8 settings but they didn't work either. I think there
may be a problem with the addressing on the CR826 board as the PM5350
address line 0 doesn't seem to go anywhere on the schematics!
Alex
On Mon, 23 May 2005 22:43:29 +0200
Koen Peeters <atm@cellink.net> wrote:
> Hi Alex,
>
> I have got the Microsys board but I believe
> you sort of mixed up the 2 registers :
>
> try :
>
> memctl->memc_br8 = 0xe0400821; // base 0xe0400000; default
> timings;
> // bank valid; 8bit port; GPCM
> local;
> memctl->memc_or8 = 0xffff8820; // min banksize; addressline config
>
> Please verify the or8 setting with the actual board configuration.
>
>
> Alex Zeffertt wrote:
> > Hi all,
> >
> > Does anyone here have *any* code for memory mapping the PM5350 ATM
> > phy on the Microsys CR826 board?
> >
> > I've just purchased this board from Microsys and I'm trying to get
> > the atm8260 ATM device driver to work on it - unfortunately I cannot
> > seem to memory map the phy. My current settings are:
> >
> >
> > memctl->memc_or8 = 0xe0400ef4; // base 0xe0400000; default timings
> > memctl->memc_br8 = 0xffff8821; // min banksize; 8bit port; GPCM
> > local;
> > // bank valid
> >
> > Has anybody done this already?
> >
> > TIA,
> >
> > Alex
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by Oracle Space Sweepstakes
> > Want to be the first software developer in space?
> > Enter now for the Oracle Space Sweepstakes!
> > http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
> > _______________________________________________
> > Linux-atm-general mailing list
> > Linux-atm-general@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/linux-atm-general
>
>
> --
> -------------------------------------------------
> Koen Peeters
> Cellink bvba
> Catherinalaan 37, 3110 Rotselaar, Belgium
> web : http://www.cellink.net/
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space Sweepstakes
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
> http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
> _______________________________________________
> Linux-atm-general mailing list
> Linux-atm-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-atm-general
^ permalink raw reply
* Re: Memory mapping the PHY on CR826
From: Clemens Koller @ 2005-05-24 9:00 UTC (permalink / raw)
To: Alex Zeffertt; +Cc: linux-atm-general@lists.sourceforge.net, linuxppc-embedded
In-Reply-To: <20050523145953.3a2044ef.ajz@cambridgebroadband.com>
Hello,
FYI: This is a board based on the Freescale MPC8260 processor.
Greets,
Clemens
Alex Zeffertt wrote:
> Hi all,
>
> Does anyone here have *any* code for memory mapping the PM5350 ATM phy
> on the Microsys CR826 board?
>
> I've just purchased this board from Microsys and I'm trying to get the
> atm8260 ATM device driver to work on it - unfortunately I cannot seem to
> memory map the phy. My current settings are:
>
>
> memctl->memc_or8 = 0xe0400ef4; // base 0xe0400000; default timings
> memctl->memc_br8 = 0xffff8821; // min banksize; 8bit port; GPCM local;
> // bank valid
>
> Has anybody done this already?
>
> TIA,
>
> Alex
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>
^ 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