* [PATCH] Enable CONFIG_FORCE_MAX_ZONEORDER for all PowerPC, and make selectable
From: Timur Tabi @ 2008-03-25 21:35 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Timur Tabi
This patch enables the FORCE_MAX_ZONEORDER Kconfig option for all PowerPC
systems. Previously, it was enabled only for 64-bit systems. We also make
the option selectable from the menu, so that the user can specify different
values. This is useful for 32-bit systems that need to allocate more than
4MB of physically contiguous memory.
Signed-off-by: Timur Tabi <timur@freescale.com>
---
I tested this on a Freescale 8610 32-bit PowerPC system, and when I increased
CONFIG_FORCE_MAX_ZONEORDER to 13, I was able to allocate 5MB of memory via
__get_free_pages(), so this change should be safe.
arch/powerpc/Kconfig | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index ef12db0..4e7eec8 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -211,14 +211,25 @@ source kernel/Kconfig.hz
source kernel/Kconfig.preempt
source "fs/Kconfig.binfmt"
-# We optimistically allocate largepages from the VM, so make the limit
-# large enough (16MB). This badly named config option is actually
-# max order + 1
config FORCE_MAX_ZONEORDER
- int
- depends on PPC64
+ int "Maximum zone order"
default "9" if PPC_64K_PAGES
- default "13"
+ default "13" if PPC64
+ default "11"
+ help
+ The kernel memory allocator divides physically contiguous memory
+ blocks into "zones", where each zone is a power of two number of
+ pages. This option selects the largest power of two that the kernel
+ keeps in the memory allocator. If you need to allocate very large
+ blocks of physically contiguous memory, then you may need to
+ increase this value.
+
+ This config option is actually maximum order plus one. For example,
+ a value of 11 means that the largest free memory block is 2^10 pages.
+
+ The page size is not necessarily 4KB. For example, on 64-bit
+ systems, 64KB pages can be enabled via CONFIG_PPC_64K_PAGES. Keep
+ this in mind when choosing a value for this option.
config HUGETLB_PAGE_SIZE_VARIABLE
bool
--
1.5.4
^ permalink raw reply related
* Re: dtc: Simplify error handling for unparseable input
From: Scott Wood @ 2008-03-25 22:10 UTC (permalink / raw)
To: Scott Wood, Jon Loeliger, linuxppc-dev
In-Reply-To: <20080325212127.GA8281@localhost.localdomain>
David Gibson wrote:
> On Tue, Mar 25, 2008 at 09:36:19AM -0500, Scott Wood wrote:
>> On Tue, Mar 25, 2008 at 12:28:05PM +1100, David Gibson wrote:
>>> On Mon, Mar 24, 2008 at 12:36:41PM -0500, Scott Wood wrote:
>>>> If you remove this, there'll be no way to indicate semantic errors other
>>>> than die() (the NULL approaches are no good, since they inhibit recovery),
>>>> which is suboptimal if the error is not immediately fatal.
>>> But everything is immediately fatal. When we have a *real* example of
>>> something that's not, we can restore an error code.
>> Failed binary includes are not immediately fatal.
>
> And is there any advantage to having them not immediately fatal?
It's generally nice to the user if you can report as many bugs as you
can rather than fail on the first one.
It's also nice to someone down the road trying to turn this code into a
library if it passes return status up the call chain gracefully.
-Scott
^ permalink raw reply
* Re: DTS question
From: David Gibson @ 2008-03-25 22:12 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: Scott Wood, linuxppc-dev, Sean MacLennan
In-Reply-To: <22b5aa51cfbcba3072020c4897206473@kernel.crashing.org>
On Fri, Mar 21, 2008 at 12:35:39PM +0100, Segher Boessenkool wrote:
>>>> Convention is to use the stock ticker symbol. If the company is
>>>> private and has no stock ticker symbol, then the company name should
>>>> be used.
>>>
>>> I didn't know that. ADI it is then.
>>
>> Well.. stock ticker is the new convention. IEEE1275 used IEEE
>> assigned OUI strings (Organization Unique Identifiers). Often those
>> are the same as the stock ticker, but not always.
>
> Erm, an OUI is a 24-bit number. I think you're confusing something
> here.
Yes, I think I am. I somehow had the impression that in addition to
the 24-bit OUIs used in MAC addresses, there were also string-form
OUIs assigned.
>> Stock ticker is a good choice for new things, but for anything from a
>> vendor which has existing 1275 bindings for its products, I think we
>> should keep the original assigned OUI, even if it differs from the
>> stock ticker.
>
> Yes, when there is an existing binding, obviously you should use what
> it says (unless that binding is *completely* broken). Compatibility
> is good.
>
> Note that a stock symbol needs to be written in uppercase; in lowercase,
> it is just a random name that has no collision protection.
Um.. bit too late for that. AFAIK, uppercase has been used by
*no-one* for stock ticker derived vendor IDs.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Which Kernel for Ocotea (440GX)?
From: Wolfgang Wegner @ 2008-03-25 22:07 UTC (permalink / raw)
To: linuxppc-dev
Hi List,
sorry for the blunt question...
I want to get an Ocotea dev board (AMCC 440GX) up and running.
As I saw from old posts (2004/2005) that this board should be supported,
I simply fetched a 2.6.24 kernel and - could not find a valid target...
It seems that support for 440gx in the arch/ppc tree was disabled, but
not yet ported to arch/powerpc.
As I am new to Linux/PowerPC, could anybody give me a hint either which
kernel version to use that supports 440GX/Ocotea out of the box or if
there is another repository of a more recent kernel where I could get
that?
Thank you very much!
Regards,
Wolfgang
^ permalink raw reply
* Re: [PATCH 1/2 v3] Driver for Freescale 8610 and 5121 DIU
From: Scott Wood @ 2008-03-25 22:19 UTC (permalink / raw)
To: York Sun
Cc: linux-fbdev-devel, a.p.zijlstra, linux-kernel, linuxppc-dev, akpm,
Timur Tabi
In-Reply-To: <12064804383051-git-send-email-yorksun@freescale.com>
York Sun wrote:
> + Example (MPC8610HPCD)
> + diu@2c000 {
display@2c000
> + device_type = "lcd";
No device_type.
> + compatible = "fsl-diu";
"fsl,diu".
> + s) Freescale on board FPGA
> +
> + This is the memory-mapped registers for on board FPGA.
> +
> + Required properities:
> + - compatible : should be "fsl,fpga-pixis".
> + - reg : should contain the address and the lenght of the FPPGA register
> + set.
> +
> + Example (MPC8610HPCD)
> + fpga {
board-control@e8000000 {
> +config FB_FSL_DIU
> + tristate "Freescale MPC8610/MPC5121 DIU framebuffer support"
Are these the only chips that will ever implement this?
> + depends on FB && (MPC8610 || MPC5121)
depends on FB && FSL_SOC
> + cmfbi = machine_data->fsl_diu_info[index+1]->par;
> + if ((mfbi->x_aoi_d + var->xres) >
> + machine_data->fsl_diu_info[0]->var.xres)
> + mfbi->x_aoi_d = machine_data->fsl_diu_info[0]->var.xres
> + - var->xres;
> + if (mfbi->x_aoi_d < 0)
> + mfbi->x_aoi_d = 0;
> + if ((var->xres + mfbi->x_aoi_d) >
> + machine_data->fsl_diu_info[0]->var.xres)
> + var->xres = machine_data->fsl_diu_info[0]->var.xres
> + - mfbi->x_aoi_d;
> +
> + if (cmfbi->count > 0) { /* AOI1 is open */
> + if ((mfbi->y_aoi_d + var->yres) > cmfbi->y_aoi_d)
> + mfbi->y_aoi_d = cmfbi->y_aoi_d - var->yres;
> + if (mfbi->y_aoi_d < 0)
> + mfbi->y_aoi_d = 0;
> + if ((var->yres + mfbi->y_aoi_d) > cmfbi->y_aoi_d)
> + var->yres = cmfbi->y_aoi_d - mfbi->y_aoi_d;
> + } else { /* AOI1 is close */
> + if ((mfbi->y_aoi_d + var->yres) >
> + machine_data->fsl_diu_info[0]->var.yres)
> + mfbi->y_aoi_d =
> + machine_data->fsl_diu_info[0]->var.yres
> + - var->yres;
> + if (mfbi->y_aoi_d < 0)
> + mfbi->y_aoi_d = 0;
> + if ((var->yres + mfbi->y_aoi_d) >
> + machine_data->fsl_diu_info[0]->var.yres)
> + var->yres =
> + machine_data->fsl_diu_info[0]->var.yres
> + - mfbi->y_aoi_d;
> + }
> + break;
> + case 2: /* AOI 1 */
> + case 4:
> + pmfbi = machine_data->fsl_diu_info[index-1]->par;
> + if ((mfbi->x_aoi_d + var->xres) >
> + machine_data->fsl_diu_info[0]->var.xres)
> + mfbi->x_aoi_d = machine_data->fsl_diu_info[0]->var.xres
> + - var->xres;
> + if (mfbi->x_aoi_d < 0)
> + mfbi->x_aoi_d = 0;
> + if ((var->xres + mfbi->x_aoi_d) >
> + machine_data->fsl_diu_info[0]->var.xres)
> + var->xres = machine_data->fsl_diu_info[0]->var.xres
> + - mfbi->x_aoi_d;
> +
> + if (pmfbi->count > 0) { /* AOI0 is open */
> + if ((mfbi->y_aoi_d + var->yres) >
> + machine_data->fsl_diu_info[0]->var.yres)
> + mfbi->y_aoi_d =
> + machine_data->fsl_diu_info[0]->var.yres
> + - var->yres;
> + if (mfbi->y_aoi_d < (pmfbi->y_aoi_d +
> + machine_data->fsl_diu_info[index-1]->var.yres))
> + mfbi->y_aoi_d = pmfbi->y_aoi_d +
> + machine_data->fsl_diu_info[index-1]->var.yres;
> + if ((var->yres + mfbi->y_aoi_d) >
> + machine_data->fsl_diu_info[0]->var.yres)
> + var->yres =
> + machine_data->fsl_diu_info[0]->var.yres
> + - mfbi->y_aoi_d;
> + } else { /* AOI0 is close */
> + if ((mfbi->y_aoi_d + var->yres) >
> + machine_data->fsl_diu_info[0]->var.yres)
> + mfbi->y_aoi_d =
> + machine_data->fsl_diu_info[0]->var.yres
> + - var->yres;
> + if (mfbi->y_aoi_d < 0)
> + mfbi->y_aoi_d = 0;
> + if ((var->yres + mfbi->y_aoi_d) >
> + machine_data->fsl_diu_info[0]->var.yres)
> + var->yres =
> + machine_data->fsl_diu_info[0]->var.yres
> + - mfbi->y_aoi_d;
Could you split some of this up into separate functions at lower
indentation levels to make it more readable?
> +#define CNVT_TOHW(val, width) ((((val)<<(width))+0x7FFF-(val))>>16)
> + red = CNVT_TOHW(red, info->var.red.length);
> + green = CNVT_TOHW(green, info->var.green.length);
> + blue = CNVT_TOHW(blue, info->var.blue.length);
> + transp = CNVT_TOHW(transp, info->var.transp.length);
> +#undef CNVT_TOHW
Define a function for this.
> + switch (cmd) {
> + case MFB_SET_PIXFMT:
> + if (!arg)
> + return -EINVAL;
> + if (copy_from_user((void *)&pix_fmt, (void *)arg,
> + sizeof(pix_fmt)))
(void __user *)arg
No cast on &pix_fmt.
> +#if defined(CONFIG_NOT_COHERENT_CACHE)
> + else if (status & INT_VSYNC) {
> + int i;
> + unsigned int *ptr;
> + ptr = coherence_data;
> + for (i = 0; i < 1024*8; i++)
> + *ptr++ = 0;
As I said in an internal review, this is not enough, and it's
inefficient. Read rather than write, and do so only once per cache
line, but the size you access has to be at least 13/8 of the cache size
for an 8-way plru cache.
-Scott
^ permalink raw reply
* Re: [PATCH] ppc: Export empty_zero_page
From: Stephen Rothwell @ 2008-03-25 22:26 UTC (permalink / raw)
To: Theodore Tso; +Cc: linuxppc-dev, Christoph Hellwig
In-Reply-To: <20080325135454.GK30110@mit.edu>
[-- Attachment #1: Type: text/plain, Size: 711 bytes --]
Hi Ted,
On Tue, 25 Mar 2008 09:54:54 -0400 Theodore Tso <tytso@MIT.EDU> wrote:
>
> So I screwed this one up. Mea culpa, mea culpa, mea maxima culpa....
>
> I assume Stephen's already sent this to patch to you guys (I picked it
> up from the linux-next git tree), but just in case he didn't....
Yeah, I already sent it and paulus is probably going to put it in his
2.6.26 tree.
However, have you made any progress on Christoph's suggestion:
"The real fix is that ext4 shouldn't be using ZERO_PAGE(). Please use
the same zeroing helpers all the other filesystems and drivers use."
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Patches added to powerpc.git powerpc-next and master branches
From: Paul Mackerras @ 2008-03-25 22:35 UTC (permalink / raw)
To: linuxppc-dev
I have added the patches listed below to the master and powerpc-next
branches of the powerpc.git repository, and pulled in Linus' current
tree.
Paul.
Manish Ahuja (10):
[POWERPC] pseries: phyp dump: Documentation
[POWERPC] pseries: phyp dump: Reserve and release memory
[POWERPC] pseries: phyp dump: Use sysfs to release reserved mem
[POWERPC] pseries: phyp dump: Register dump area
[POWERPC] pseries: phyp dump: Debugging print routines
[POWERPC] pseries: phyp dump: Invalidate and print dump areas
[POWERPC] pseries: phyp dump: Tracking memory range freed
[POWERPC] pseries: phyp dump: Add Kconfig file option
[POWERPC] pseries: phyp dump: Disable phyp-dump through boot-var
[POWERPC] pseries: phyp dump: Inform kdump when phyp-dump is load=
ed
Marian Balakowicz (1):
[POWERPC] Add 'model: ...' line to common show=5Fcpuinfo()
Nathan Lynch (4):
[POWERPC] maple: Use platform name in define=5Fmachine()
[POWERPC] maple: Kill fixup=5Fmaple=5Fide
[POWERPC] maple: Enable ipr driver in defconfig
[POWERPC] scanlog=5Finit cleanup and minor fixes
Robert P. J. Day (1):
[POWERPC] Move a.out.h to header-y since it doesn't check =5F=5FK=
ERNEL=5F=5F
Roland McGrath (2):
[POWERPC] Don't touch PT=5FDTRACE in exec
[POWERPC] powerpc32: Remove asm-offsets ptrace cruft
S.=C3=87a=C4=9Flar Onur (1):
[POWERPC] arch/powerpc/platforms/iseries/pci.c: Use time=5F* macr=
os
Stephen Rothwell (1):
[POWERPC] Really export empty=5Fzero=5Fpage
Tony Breeds (1):
[POWERPC] Update wait=5Fstate=5Fcycles in the VPA
^ permalink raw reply
* Re: Which Kernel for Ocotea (440GX)?
From: Wolfgang Denk @ 2008-03-25 22:45 UTC (permalink / raw)
To: Wolfgang Wegner; +Cc: linuxppc-dev
In-Reply-To: <20080325220742.GD15725@leila.ping.de>
In message <20080325220742.GD15725@leila.ping.de> you wrote:
>
> I want to get an Ocotea dev board (AMCC 440GX) up and running.
> As I saw from old posts (2004/2005) that this board should be supported,
> I simply fetched a 2.6.24 kernel and - could not find a valid target...
>
> It seems that support for 440gx in the arch/ppc tree was disabled, but
> not yet ported to arch/powerpc.
You can find Ocotea support (still arch/ppc only) in our kenrel
repository - see git://www.denx.de/git/linux-2.6-denx.git
I think if you just followed the links on AMCC's web site they should
have taken you there, too. Please let me know if this didn't work for
some reason.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Einstein argued that there must be simplified explanations of nature,
because God is not capricious or arbitrary. No such faith comforts
the software engineer. - Fred Brooks, Jr.
^ permalink raw reply
* RE: [PATCH 2/3] [POWERPC] Xilinx: of_serial support for Xilinx uart 16550.
From: John Linn @ 2008-03-25 22:48 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <47E7DEF1.9050501@ru.mvista.com>
Thanks for all the input. I'd like to propose a solution hoping to
arrive at consensus.
We can define a "sparse16550" binding that uses reg-shift and reg-offset
properties in the device tree.=20
It seems like this is a common variable on the 16550 so that others
could also use it. I like it because it specifies the differences
clearly from a normal 16550 yet is flexible enough to handle some other
variations also.
Thanks,
John
-----Original Message-----
From: Sergei Shtylyov [mailto:sshtylyov@ru.mvista.com]=20
Sent: Monday, March 24, 2008 11:04 AM
To: Sergei Shtylyov
Cc: Grant Likely; linuxppc-dev@ozlabs.org; Paul Mackerras; John Linn
Subject: Re: [PATCH 2/3] [POWERPC] Xilinx: of_serial support for Xilinx
uart 16550.
Hi, I wrote:
> Oh, well... unfortunately, we can't use UPIO_MEM32 "register model"
> in 8250.c anyway since that makes use of readl()/writel() -- which
treat=20
> the bus as bigendian on PPC... anyway, we would need at least a=20
I was going to write "as little-endian"... :-<
> "reg-size" property, if not new "compatible"...
WBR, Sergei
^ permalink raw reply
* Re: [PATCH] ppc: Export empty_zero_page
From: Theodore Tso @ 2008-03-25 22:49 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linuxppc-dev, Christoph Hellwig
In-Reply-To: <20080326092657.8b65e5ea.sfr@canb.auug.org.au>
[-- Attachment #1: Type: text/plain, Size: 404 bytes --]
On Wed, Mar 26, 2008 at 09:26:57AM +1100, Stephen Rothwell wrote:
> However, have you made any progress on Christoph's suggestion:
>
> "The real fix is that ext4 shouldn't be using ZERO_PAGE(). Please use
> the same zeroing helpers all the other filesystems and drivers use."
When Aneesh asked for clarification about Christoph's suggestion, he
got the following response (see attached).
- Ted
[-- Attachment #2: Type: message/rfc822, Size: 1394 bytes --]
From: Christoph Hellwig <hch@infradead.org>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Christoph Hellwig <hch@infradead.org>
Subject: Re: ZERO_PAGE(0) usage in ext4
Date: Thu, 20 Mar 2008 04:35:12 -0400
Message-ID: <20080320083512.GB27854@infradead.org>
On Mon, Mar 17, 2008 at 11:22:30PM +0530, Aneesh Kumar K.V wrote:
> Hi Christoph,
>
> I have changes pending for ext4 which uses ZERO_PAGE(0) to zero out
> file system blocks.
>
> http://repo.or.cz/w/ext4-patch-queue.git?a=blob;f=ext4-fallocate-full-fs-ENOSPC-handling.patch;h=e14ec2a53f008c3f4b80544a897165de4bb5d360;hb=HEAD
>
> The changes are needed to make sure we allow writing to prealloc space
> even when there are no space left in the file system to insert new
> extent details. To use ZERO_PAGE in ext4 i would need patches to export
> some of the variables. I found that you answered Ted's patch at
>
> http://ozlabs.org/pipermail/linuxppc-dev/2008-March/052956.html
>
> I have a patch that does the same thing for multiple arch. Can you help
> me understand what you meant by zeroing helpers ?
Ok, you're actually sending down the page and not copying from it.
This is probab;y okay.
^ permalink raw reply
* Re: dtc: Simplify error handling for unparseable input
From: David Gibson @ 2008-03-25 23:52 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev
In-Reply-To: <47E9783F.4@freescale.com>
On Tue, Mar 25, 2008 at 05:10:07PM -0500, Scott Wood wrote:
> David Gibson wrote:
>> On Tue, Mar 25, 2008 at 09:36:19AM -0500, Scott Wood wrote:
>>> On Tue, Mar 25, 2008 at 12:28:05PM +1100, David Gibson wrote:
>>>> On Mon, Mar 24, 2008 at 12:36:41PM -0500, Scott Wood wrote:
>>>>> If you remove this, there'll be no way to indicate semantic errors
>>>>> other
>>>>> than die() (the NULL approaches are no good, since they inhibit
>>>>> recovery),
>>>>> which is suboptimal if the error is not immediately fatal.
>>>> But everything is immediately fatal. When we have a *real* example of
>>>> something that's not, we can restore an error code.
>>> Failed binary includes are not immediately fatal.
>> And is there any advantage to having them not immediately fatal?
>
> It's generally nice to the user if you can report as many bugs as you can
> rather than fail on the first one.
Hrm, I guess. There's only so far it's worth going to achieve that
though.
> It's also nice to someone down the road trying to turn this code into a
> library if it passes return status up the call chain gracefully.
Can you think of any reason we'd want to do that? And that would
require fixing so many other places that the two cases which do return
an error (that's including binary includes) hardly signify.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: dtc: Simplify error handling for unparseable input
From: David Gibson @ 2008-03-25 23:59 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev
In-Reply-To: <47E9783F.4@freescale.com>
On Tue, Mar 25, 2008 at 05:10:07PM -0500, Scott Wood wrote:
> David Gibson wrote:
>> On Tue, Mar 25, 2008 at 09:36:19AM -0500, Scott Wood wrote:
>>> On Tue, Mar 25, 2008 at 12:28:05PM +1100, David Gibson wrote:
>>>> On Mon, Mar 24, 2008 at 12:36:41PM -0500, Scott Wood wrote:
>>>>> If you remove this, there'll be no way to indicate semantic errors
>>>>> other
>>>>> than die() (the NULL approaches are no good, since they inhibit
>>>>> recovery),
>>>>> which is suboptimal if the error is not immediately fatal.
>>>> But everything is immediately fatal. When we have a *real* example of
>>>> something that's not, we can restore an error code.
>>> Failed binary includes are not immediately fatal.
>> And is there any advantage to having them not immediately fatal?
>
> It's generally nice to the user if you can report as many bugs as you can
> rather than fail on the first one.
Oh.. and this patch doesn't actually preclude that. We still have the
treesource_error variable and can report errors that way during the
parse. The die() just comes at the end of dt_from_source(), instead
of in main().
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: [PATCHv4 2.6.25] i2c: adds support for i2c bus on Freescale CPM1/CPM2 controllers
From: Stephen Rothwell @ 2008-03-26 0:41 UTC (permalink / raw)
To: Jochen Friedrich
Cc: Jean Delvare, linuxppc-dev list, linux-kernel, Scott Wood, i2c
In-Reply-To: <47E94891.6020000@scram.de>
[-- Attachment #1: Type: text/plain, Size: 1948 bytes --]
Hi Jochen,
Firstly, you should probably cc Dave Miller <davem@davemloft.net> on
anything in drivers/of as Sparc is the other user of this stuff (just in
case they are interested).
On Tue, 25 Mar 2008 19:46:41 +0100 Jochen Friedrich <jochen@scram.de> wrote:
>
> +++ b/drivers/of/i2c.c
> @@ -0,0 +1,113 @@
> +/*
> + * OF helpers for the I2C API
> + *
> + * Copyright (c) 2008 Jochen Friedrich <jochen@scram.de>
> + *
> + * Based on a previous patch from Jon Smirl <jonsmirl@gmail.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#include <linux/i2c.h>
> +#include <asm/prom.h>
You should really include <linux/of.h> instead.
> +struct i2c_driver_device {
> + char *of_device;
> + char *i2c_type;
> +};
> +
> +static struct i2c_driver_device i2c_devices[] = {
> + {"dallas,ds1374", "rtc-ds1374",},
^
You don't need the comma before the brace (unless you are anticipating
that struct i2c_driver_device will change. Even then, its not a big
thing.
> +void of_register_i2c_devices(struct i2c_adapter *adap,
> + struct device_node *adap_node)
> +{
> + void *result;
> + struct device_node *node = NULL;
> +
> + while ((node = of_get_next_child(adap_node, node))) {
for_each_child_of_node(adap_node, node) {
And then you don't need to initialise "node" above.
> + info.irq = irq_of_parse_and_map(node, 0);
> + if (info.irq == NO_IRQ)
> + info.irq = -1;
> +
> + if (of_find_i2c_driver(node, &info) < 0)
> + continue;
Do you need to clean up after the irq_of_parse_and_map() above?
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: Patches added to powerpc.git powerpc-next and master branches
From: Josh Boyer @ 2008-03-26 0:54 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <18409.32313.610943.187982@cargo.ozlabs.ibm.com>
On Wed, 2008-03-26 at 09:35 +1100, Paul Mackerras wrote:
> I have added the patches listed below to the master and powerpc-next
> branches of the powerpc.git repository, and pulled in Linus' current
> tree.
I have some patches floating around that I'll be gathering together in
my tree tomorrow. I'll send a pull request then.
josh
^ permalink raw reply
* Re: dtc: Simplify error handling for unparseable input
From: Scott Wood @ 2008-03-26 1:16 UTC (permalink / raw)
To: Jon Loeliger, linuxppc-dev
In-Reply-To: <20080325235202.GG8281@localhost.localdomain>
On Wed, Mar 26, 2008 at 10:52:02AM +1100, David Gibson wrote:
> On Tue, Mar 25, 2008 at 05:10:07PM -0500, Scott Wood wrote:
> > It's generally nice to the user if you can report as many bugs as you can
> > rather than fail on the first one.
>
> Hrm, I guess. There's only so far it's worth going to achieve that
> though.
>
> > It's also nice to someone down the road trying to turn this code into a
> > library if it passes return status up the call chain gracefully.
>
> Can you think of any reason we'd want to do that?
Anything that wants to do something automated with device tree source
that doesn't fit neatly into command-line execution. Nothing specific.
> And that would require fixing so many other places that the two cases
> which do return an error (that's including binary includes) hardly
> signify.
Yeah, I just wanted to avoid going further down that path if possible.
I won't protest too loudly if the general consensus is to just die(),
though.
-Scott
^ permalink raw reply
* [PATCH 0/2] Two more pasemi_mac patches for 2.6.26
From: Olof Johansson @ 2008-03-26 1:56 UTC (permalink / raw)
To: jgarzik; +Cc: linuxppc-dev, pasemi-linux, netdev
Hi Jeff,
The below two patches go on top of the previous patches that were acked
by you but applied to pasemi.git for feed up through powerpc.git.
One is a couple of fixes for various corner cases in the jumbo support
configuration. The second is addition of netpoll support, from Nate
Case.
Review/ack would be appreciated, I'll feed them up the same path as the
other changes.
-Olof
^ permalink raw reply
* [PATCH 1/2] pasemi_mac: Jumbo frame bugfixes
From: Olof Johansson @ 2008-03-26 1:57 UTC (permalink / raw)
To: jgarzik; +Cc: linuxppc-dev, pasemi-linux, netdev
In-Reply-To: <20080326015625.GA23103@lixom.net>
Fix a couple of corner cases around interface up/down when jumbo frames are
configured. Resources weren't always freed and reallocated properly.
Signed-off-by: Olof Johansson <olof@lixom.net>
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index c50f0f4..abb1dc4 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -404,6 +404,7 @@ static void pasemi_mac_free_csring(struct pasemi_mac_csring *csring)
pasemi_dma_free_flag(csring->events[1]);
pasemi_dma_free_ring(&csring->chan);
pasemi_dma_free_chan(&csring->chan);
+ pasemi_dma_free_fun(csring->fun);
}
static int pasemi_mac_setup_rx_resources(const struct net_device *dev)
@@ -1150,7 +1151,10 @@ static int pasemi_mac_open(struct net_device *dev)
if (!mac->tx)
goto out_tx_ring;
- if (dev->mtu > 1500) {
+ /* We might already have allocated rings in case mtu was changed
+ * before interface was brought up.
+ */
+ if (dev->mtu > 1500 && !mac->num_cs) {
pasemi_mac_setup_csrings(mac);
if (!mac->num_cs)
goto out_tx_ring;
@@ -1388,8 +1392,12 @@ static int pasemi_mac_close(struct net_device *dev)
free_irq(mac->tx->chan.irq, mac->tx);
free_irq(mac->rx->chan.irq, mac->rx);
- for (i = 0; i < mac->num_cs; i++)
+ for (i = 0; i < mac->num_cs; i++) {
pasemi_mac_free_csring(mac->cs[i]);
+ mac->cs[i] = NULL;
+ }
+
+ mac->num_cs = 0;
/* Free resources */
pasemi_mac_free_rx_resources(mac);
^ permalink raw reply related
* [PATCH 2/2] pasemi_mac: Netpoll support
From: Olof Johansson @ 2008-03-26 1:58 UTC (permalink / raw)
To: jgarzik; +Cc: linuxppc-dev, pasemi-linux, netdev
In-Reply-To: <20080326015625.GA23103@lixom.net>
Add netpoll support to allow use of netconsole.
Signed-off-by: Nate Case <ncase@xes-inc.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index abb1dc4..6030ffe 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -1648,6 +1648,26 @@ static int pasemi_mac_poll(struct napi_struct *napi, int budget)
return pkts;
}
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/*
+ * Polling 'interrupt' - used by things like netconsole to send skbs
+ * without having to re-enable interrupts. It's not called while
+ * the interrupt routine is executing.
+ */
+static void pasemi_mac_netpoll(struct net_device *dev)
+{
+ const struct pasemi_mac *mac = netdev_priv(dev);
+
+ disable_irq(mac->tx->chan.irq);
+ pasemi_mac_tx_intr(mac->tx->chan.irq, mac->tx);
+ enable_irq(mac->tx->chan.irq);
+
+ disable_irq(mac->rx->chan.irq);
+ pasemi_mac_rx_intr(mac->rx->chan.irq, dev);
+ enable_irq(mac->rx->chan.irq);
+}
+#endif
+
static int pasemi_mac_change_mtu(struct net_device *dev, int new_mtu)
{
struct pasemi_mac *mac = netdev_priv(dev);
@@ -1807,6 +1827,9 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
dev->mtu = PE_DEF_MTU;
/* 1500 MTU + ETH_HLEN + VLAN_HLEN + 2 64B cachelines */
mac->bufsz = dev->mtu + ETH_HLEN + ETH_FCS_LEN + LOCAL_SKB_ALIGN + 128;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ dev->poll_controller = pasemi_mac_netpoll;
+#endif
dev->change_mtu = pasemi_mac_change_mtu;
dev->ethtool_ops = &pasemi_mac_ethtool_ops;
^ permalink raw reply related
* Re: interrupt handlers PowerPC via GCC
From: David H. Lynch Jr. @ 2008-03-26 2:50 UTC (permalink / raw)
To: Tehn Yit Chin; +Cc: linuxppc-embedded
In-Reply-To: <bf04f99c0803241603v3151865eic80b58a04bce43e2@mail.gmail.com>
Tehn Yit Chin wrote:
> Hey Scott,
>
> Thanks for the reply, I shall investigate further.
>
> I wasn't talking about interrupt handlers in Linux as such, but using
> powerpc-eabi-gcc to write an ISR for the MPC5516. (I guess that could be
> off-topic on this mailing list, but I thought the folks on this mailing list
> would probably know the answer pretty easily). I was hoping that gcc would
> generate the prologue and epilogue code for me via the interrupt attributes.
I know nothing about GCC's interrupt attributes,
however, there is no problem writing ISR's from scratch (no OS)
for the ppc. There are several boot loaders, monitors etc. out there
with examples.
There is even one inside the Linux Kernel source - though it i
probably far more complex than you need.
Somewhere I have something for the ppc405 I can send you - but most
ppc's are similar.
--
Dave Lynch DLA Systems
Software Development: Embedded Linux
717.627.3770 dhlii@dlasys.net http://www.dlasys.net
fax: 1.253.369.9244 Cell: 1.717.587.7774
Over 25 years' experience in platforms, languages, and technologies too numerous to list.
"Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction."
Albert Einstein
^ permalink raw reply
* Re: [PATCH] ehea: Fix IPv6 support
From: Jeff Garzik @ 2008-03-26 3:20 UTC (permalink / raw)
To: Thomas Klein
Cc: Jan-Bernd Themann, netdev, Hannes Hering, linux-kernel, linux-ppc,
Christoph Raisch, Stefan Roscher
In-Reply-To: <200803191355.44266.osstklei@de.ibm.com>
Thomas Klein wrote:
> Indicate that HEA calculates IPv4 checksums only
>
> Signed-off-by: Thomas Klein <tklein@de.ibm.com>
>
> ---
> diff -Nurp -X dontdiff linux-2.6.25-rc6/drivers/net/ehea/ehea.h patched_kernel/drivers/net/ehea/ehea.h
> --- linux-2.6.25-rc6/drivers/net/ehea/ehea.h 2008-03-17 00:32:14.000000000 +0100
> +++ patched_kernel/drivers/net/ehea/ehea.h 2008-03-19 08:58:07.000000000 +0100
> @@ -40,7 +40,7 @@
> #include <asm/io.h>
>
> #define DRV_NAME "ehea"
> -#define DRV_VERSION "EHEA_0087"
> +#define DRV_VERSION "EHEA_0089"
>
> /* eHEA capability flags */
> #define DLPAR_PORT_ADD_REM 1
> diff -Nurp -X dontdiff linux-2.6.25-rc6/drivers/net/ehea/ehea_main.c patched_kernel/drivers/net/ehea/ehea_main.c
> --- linux-2.6.25-rc6/drivers/net/ehea/ehea_main.c 2008-03-17 00:32:14.000000000 +0100
> +++ patched_kernel/drivers/net/ehea/ehea_main.c 2008-03-19 08:58:07.000000000 +0100
> @@ -3108,7 +3108,7 @@ struct ehea_port *ehea_setup_single_port
> dev->vlan_rx_add_vid = ehea_vlan_rx_add_vid;
> dev->vlan_rx_kill_vid = ehea_vlan_rx_kill_vid;
> dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO
> - | NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_TX
> + | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX
> | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER
applied
^ permalink raw reply
* Re: [PATCH 0/2] Two more pasemi_mac patches for 2.6.26
From: Jeff Garzik @ 2008-03-26 4:12 UTC (permalink / raw)
To: Olof Johansson; +Cc: linuxppc-dev, pasemi-linux, netdev
In-Reply-To: <20080326015625.GA23103@lixom.net>
Olof Johansson wrote:
> Hi Jeff,
>
> The below two patches go on top of the previous patches that were acked
> by you but applied to pasemi.git for feed up through powerpc.git.
>
> One is a couple of fixes for various corner cases in the jumbo support
> configuration. The second is addition of netpoll support, from Nate
> Case.
>
> Review/ack would be appreciated, I'll feed them up the same path as the
> other changes.
ACK 1-2, though I would consider closely patch #2, whether you need
disable_irq() or spin_lock_irqsave() -- which is best for your specific
driver + platform?
^ permalink raw reply
* dtc: Make dt_from_blob() open its own input file, like the other input formats
From: David Gibson @ 2008-03-26 5:16 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
Currently, main() has a variable for the input file. It used to be
that main() would open the input based on command line arguments
before passing it to the dt_from_*() function. However, only
dt_from_blob() uses this. dt_from_source() opens its own file, and
dt_from_fs() interprets the argument as as a directory and does its
own opendir() call.
Furthermore, main() opened the file with dtc_open_file() but closed it
with a direct call to fclose().
Therefore, to improve the interface consistency between the
dt_from_*() functions, make dt_from_blob() open and close its own
files like the other dt_from_*() functions.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
dtc.c | 16 +++++-----------
dtc.h | 2 +-
flattree.c | 26 ++++++++++++++++----------
3 files changed, 22 insertions(+), 22 deletions(-)
Index: dtc/dtc.c
===================================================================
--- dtc.orig/dtc.c 2008-03-26 16:08:22.000000000 +1100
+++ dtc/dtc.c 2008-03-26 16:08:37.000000000 +1100
@@ -118,7 +118,6 @@
int force = 0, check = 0;
const char *arg;
int opt;
- struct dtc_file *inf = NULL;
FILE *outf = NULL;
int outversion = DEFAULT_FDT_VERSION;
int boot_cpuid_phys = 0xfeedbeef;
@@ -187,19 +186,14 @@
fprintf(stderr, "DTC: %s->%s on file \"%s\"\n",
inform, outform, arg);
- if (streq(inform, "dts")) {
+ if (streq(inform, "dts"))
bi = dt_from_source(arg);
- } else if (streq(inform, "fs")) {
+ else if (streq(inform, "fs"))
bi = dt_from_fs(arg);
- } else if(streq(inform, "dtb")) {
- inf = dtc_open_file(arg, NULL);
- bi = dt_from_blob(inf->file);
- } else {
+ else if(streq(inform, "dtb"))
+ bi = dt_from_blob(arg);
+ else
die("Unknown input format \"%s\"\n", inform);
- }
-
- if (inf && inf->file != stdin)
- fclose(inf->file);
fill_fullpaths(bi->dt, "");
process_checks(force, bi);
Index: dtc/dtc.h
===================================================================
--- dtc.orig/dtc.h 2008-03-26 16:08:22.000000000 +1100
+++ dtc/dtc.h 2008-03-26 16:08:37.000000000 +1100
@@ -248,7 +248,7 @@
void dt_to_asm(FILE *f, struct boot_info *bi, int version,
int boot_cpuid_phys);
-struct boot_info *dt_from_blob(FILE *f);
+struct boot_info *dt_from_blob(const char *fname);
/* Tree source */
Index: dtc/flattree.c
===================================================================
--- dtc.orig/flattree.c 2008-03-26 16:08:22.000000000 +1100
+++ dtc/flattree.c 2008-03-26 16:08:37.000000000 +1100
@@ -19,6 +19,7 @@
*/
#include "dtc.h"
+#include "srcpos.h"
#define FTF_FULLPATH 0x1
#define FTF_VARALIGN 0x2
@@ -780,8 +781,9 @@
}
-struct boot_info *dt_from_blob(FILE *f)
+struct boot_info *dt_from_blob(const char *fname)
{
+ struct dtc_file *dtcf;
u32 magic, totalsize, version, size_dt;
u32 off_dt, off_str, off_mem_rsvmap;
int rc;
@@ -796,12 +798,14 @@
u32 val;
int flags = 0;
- rc = fread(&magic, sizeof(magic), 1, f);
- if (ferror(f))
+ dtcf = dtc_open_file(fname, NULL);
+
+ rc = fread(&magic, sizeof(magic), 1, dtcf->file);
+ if (ferror(dtcf->file))
die("Error reading DT blob magic number: %s\n",
strerror(errno));
if (rc < 1) {
- if (feof(f))
+ if (feof(dtcf->file))
die("EOF reading DT blob magic number\n");
else
die("Mysterious short read reading magic number\n");
@@ -811,11 +815,11 @@
if (magic != FDT_MAGIC)
die("Blob has incorrect magic number\n");
- rc = fread(&totalsize, sizeof(totalsize), 1, f);
- if (ferror(f))
+ rc = fread(&totalsize, sizeof(totalsize), 1, dtcf->file);
+ if (ferror(dtcf->file))
die("Error reading DT blob size: %s\n", strerror(errno));
if (rc < 1) {
- if (feof(f))
+ if (feof(dtcf->file))
die("EOF reading DT blob size\n");
else
die("Mysterious short read reading blob size\n");
@@ -835,12 +839,12 @@
p = blob + sizeof(magic) + sizeof(totalsize);
while (sizeleft) {
- if (feof(f))
+ if (feof(dtcf->file))
die("EOF before reading %d bytes of DT blob\n",
totalsize);
- rc = fread(p, 1, sizeleft, f);
- if (ferror(f))
+ rc = fread(p, 1, sizeleft, dtcf->file);
+ if (ferror(dtcf->file))
die("Error reading DT blob: %s\n",
strerror(errno));
@@ -902,5 +906,7 @@
free(blob);
+ dtc_close_file(dtcf);
+
return build_boot_info(reservelist, tree);
}
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* dtc: Trivial formatting fixes
From: David Gibson @ 2008-03-26 5:21 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
This patch fixes some trivial indentation and brace/bracket style
problems.
---
dtc.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
Index: dtc/dtc.c
===================================================================
--- dtc.orig/dtc.c 2008-03-26 16:18:51.000000000 +1100
+++ dtc/dtc.c 2008-03-26 16:19:12.000000000 +1100
@@ -163,8 +163,8 @@
boot_cpuid_phys = strtol(optarg, NULL, 0);
break;
case 'v':
- printf("Version: %s\n", DTC_VERSION);
- exit(0);
+ printf("Version: %s\n", DTC_VERSION);
+ exit(0);
case 'h':
default:
usage();
@@ -179,9 +179,8 @@
arg = argv[optind];
/* minsize and padsize are mutually exclusive */
- if ((minsize) && (padsize)) {
+ if (minsize && padsize)
die("Can't set both -p and -S\n");
- }
fprintf(stderr, "DTC: %s->%s on file \"%s\"\n",
inform, outform, arg);
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: Patches added to powerpc.git powerpc-next and master branches
From: Grant Likely @ 2008-03-26 6:00 UTC (permalink / raw)
To: Josh Boyer; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <1206492849.4160.11.camel@vader.jdub.homelinux.org>
On Tue, Mar 25, 2008 at 6:54 PM, Josh Boyer <jwboyer@gmail.com> wrote:
> On Wed, 2008-03-26 at 09:35 +1100, Paul Mackerras wrote:
> > I have added the patches listed below to the master and powerpc-next
> > branches of the powerpc.git repository, and pulled in Linus' current
> > tree.
>
> I have some patches floating around that I'll be gathering together in
> my tree tomorrow. I'll send a pull request then.
Josh, do you mind pickup up the following patches? I don't have a
public git tree at the moment so this is easier. :-)
http://patchwork.ozlabs.org/linuxppc/patch?person=1000&id=17388
http://patchwork.ozlabs.org/linuxppc/patch?person=1000&id=17386
http://patchwork.ozlabs.org/linuxppc/patch?person=1000&id=17387
http://patchwork.ozlabs.org/linuxppc/patch?person=486&id=17479
http://patchwork.ozlabs.org/linuxppc/patch?person=486&id=17410
Use your discretion on the last two.
Cheers,
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply
* dtc: Rework handling of boot_cpuid_phys
From: David Gibson @ 2008-03-26 6:56 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
Currently, dtc will put the nonsense value 0xfeedbeef into the
boot_cpuid_phys field of an output blob, unless explicitly given
another value with the -b command line option. As well as being a
totally unuseful default value, this also means that dtc won't
properly preserve the boot_cpuid_phys field in -I dtb -O dtb mode.
This patch reworks things to improve the boot_cpuid handling. The new
semantics are that the output's boot_cpuid_phys value is:
the value given on the command line if -b is used
otherwise
the value from the input, if in -I dtb mode
otherwise
0
Implementation-wise we do the following:
- boot_cpuid_phys is added to struct boot_info, so that
structure now contains all of the blob's semantic information.
- dt_to_blob() and dt_to_asm() output the cpuid given in
boot_info
- dt_from_blob() fills in boot_info based on the input blob
- The other dt_from_*() functions just record 0, but we can
change this easily if e.g. we invent a way of specifying the boot cpu
in the source format.
- main() overrides the cpuid in the boot_info between input
and output if -b is given
We add some testcases to check this new behaviour.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
dtc-parser.y | 4 +--
dtc.c | 12 +++++++----
dtc.h | 9 +++-----
flattree.c | 14 ++++++-------
fstree.c | 2 -
livetree.c | 3 +-
tests/Makefile.tests | 2 -
tests/boot-cpuid.c | 48 +++++++++++++++++++++++++++++++++++++++++++++
tests/dtbs_equal_ordered.c | 7 ++++++
tests/run_tests.sh | 8 +++++++
10 files changed, 88 insertions(+), 21 deletions(-)
Index: dtc/tests/dtbs_equal_ordered.c
===================================================================
--- dtc.orig/tests/dtbs_equal_ordered.c 2008-03-26 17:53:17.000000000 +1100
+++ dtc/tests/dtbs_equal_ordered.c 2008-03-26 17:53:17.000000000 +1100
@@ -125,6 +125,7 @@
int main(int argc, char *argv[])
{
void *fdt1, *fdt2;
+ uint32_t cpuid1, cpuid2;
test_init(argc, argv);
if (argc != 3)
@@ -135,5 +136,11 @@
compare_mem_rsv(fdt1, fdt2);
compare_structure(fdt1, fdt2);
+ cpuid1 = fdt_boot_cpuid_phys(fdt1);
+ cpuid2 = fdt_boot_cpuid_phys(fdt2);
+ if (cpuid1 != cpuid2)
+ FAIL("boot_cpuid_phys mismatch 0x%x != 0x%x",
+ cpuid1, cpuid2);
+
PASS();
}
Index: dtc/dtc-parser.y
===================================================================
--- dtc.orig/dtc-parser.y 2008-03-26 17:53:17.000000000 +1100
+++ dtc/dtc-parser.y 2008-03-26 17:53:17.000000000 +1100
@@ -85,11 +85,11 @@
sourcefile:
DT_V1 ';' memreserves devicetree
{
- the_boot_info = build_boot_info($3, $4);
+ the_boot_info = build_boot_info($3, $4, 0);
}
| v0_memreserves devicetree
{
- the_boot_info = build_boot_info($1, $2);
+ the_boot_info = build_boot_info($1, $2, 0);
}
;
Index: dtc/dtc.c
===================================================================
--- dtc.orig/dtc.c 2008-03-26 17:53:17.000000000 +1100
+++ dtc/dtc.c 2008-03-26 17:53:17.000000000 +1100
@@ -120,7 +120,7 @@
int opt;
FILE *outf = NULL;
int outversion = DEFAULT_FDT_VERSION;
- int boot_cpuid_phys = 0xfeedbeef;
+ long long cmdline_boot_cpuid = -1;
quiet = 0;
reservenum = 0;
@@ -160,7 +160,7 @@
quiet++;
break;
case 'b':
- boot_cpuid_phys = strtol(optarg, NULL, 0);
+ cmdline_boot_cpuid = strtoll(optarg, NULL, 0);
break;
case 'v':
printf("Version: %s\n", DTC_VERSION);
@@ -194,9 +194,13 @@
else
die("Unknown input format \"%s\"\n", inform);
+ if (cmdline_boot_cpuid != -1)
+ bi->boot_cpuid_phys = cmdline_boot_cpuid;
+
fill_fullpaths(bi->dt, "");
process_checks(force, bi);
+
if (streq(outname, "-")) {
outf = stdout;
} else {
@@ -209,9 +213,9 @@
if (streq(outform, "dts")) {
dt_to_source(outf, bi);
} else if (streq(outform, "dtb")) {
- dt_to_blob(outf, bi, outversion, boot_cpuid_phys);
+ dt_to_blob(outf, bi, outversion);
} else if (streq(outform, "asm")) {
- dt_to_asm(outf, bi, outversion, boot_cpuid_phys);
+ dt_to_asm(outf, bi, outversion);
} else if (streq(outform, "null")) {
/* do nothing */
} else {
Index: dtc/dtc.h
===================================================================
--- dtc.orig/dtc.h 2008-03-26 17:53:17.000000000 +1100
+++ dtc/dtc.h 2008-03-26 17:53:17.000000000 +1100
@@ -232,10 +232,11 @@
struct boot_info {
struct reserve_info *reservelist;
struct node *dt; /* the device tree */
+ u32 boot_cpuid_phys;
};
struct boot_info *build_boot_info(struct reserve_info *reservelist,
- struct node *tree);
+ struct node *tree, u32 boot_cpuid_phys);
/* Checks */
@@ -243,10 +244,8 @@
/* Flattened trees */
-void dt_to_blob(FILE *f, struct boot_info *bi, int version,
- int boot_cpuid_phys);
-void dt_to_asm(FILE *f, struct boot_info *bi, int version,
- int boot_cpuid_phys);
+void dt_to_blob(FILE *f, struct boot_info *bi, int version);
+void dt_to_asm(FILE *f, struct boot_info *bi, int version);
struct boot_info *dt_from_blob(const char *fname);
Index: dtc/flattree.c
===================================================================
--- dtc.orig/flattree.c 2008-03-26 17:53:17.000000000 +1100
+++ dtc/flattree.c 2008-03-26 17:53:17.000000000 +1100
@@ -354,8 +354,7 @@
fdt->size_dt_struct = cpu_to_be32(dtsize);
}
-void dt_to_blob(FILE *f, struct boot_info *bi, int version,
- int boot_cpuid_phys)
+void dt_to_blob(FILE *f, struct boot_info *bi, int version)
{
struct version_info *vi = NULL;
int i;
@@ -380,7 +379,7 @@
/* Make header */
make_fdt_header(&fdt, vi, reservebuf.len, dtbuf.len, strbuf.len,
- boot_cpuid_phys);
+ bi->boot_cpuid_phys);
/*
* If the user asked for more space than is used, adjust the totalsize.
@@ -446,7 +445,7 @@
}
}
-void dt_to_asm(FILE *f, struct boot_info *bi, int version, int boot_cpuid_phys)
+void dt_to_asm(FILE *f, struct boot_info *bi, int version)
{
struct version_info *vi = NULL;
int i;
@@ -486,7 +485,7 @@
if (vi->flags & FTF_BOOTCPUID)
fprintf(f, "\t.long\t%i\t\t\t\t\t/* boot_cpuid_phys */\n",
- boot_cpuid_phys);
+ bi->boot_cpuid_phys);
if (vi->flags & FTF_STRTABSIZE)
fprintf(f, "\t.long\t_%s_strings_end - _%s_strings_start\t/* size_dt_strings */\n",
@@ -784,7 +783,7 @@
struct boot_info *dt_from_blob(const char *fname)
{
struct dtc_file *dtcf;
- u32 magic, totalsize, version, size_dt;
+ u32 magic, totalsize, version, size_dt, boot_cpuid_phys;
u32 off_dt, off_str, off_mem_rsvmap;
int rc;
char *blob;
@@ -856,6 +855,7 @@
off_str = be32_to_cpu(fdt->off_dt_strings);
off_mem_rsvmap = be32_to_cpu(fdt->off_mem_rsvmap);
version = be32_to_cpu(fdt->version);
+ boot_cpuid_phys = be32_to_cpu(fdt->boot_cpuid_phys);
if (off_mem_rsvmap >= totalsize)
die("Mem Reserve structure offset exceeds total size\n");
@@ -908,5 +908,5 @@
dtc_close_file(dtcf);
- return build_boot_info(reservelist, tree);
+ return build_boot_info(reservelist, tree, boot_cpuid_phys);
}
Index: dtc/fstree.c
===================================================================
--- dtc.orig/fstree.c 2008-03-26 17:53:17.000000000 +1100
+++ dtc/fstree.c 2008-03-26 17:53:17.000000000 +1100
@@ -87,6 +87,6 @@
tree = read_fstree(dirname);
tree = name_node(tree, "", NULL);
- return build_boot_info(NULL, tree);
+ return build_boot_info(NULL, tree, 0);
}
Index: dtc/livetree.c
===================================================================
--- dtc.orig/livetree.c 2008-03-26 17:53:17.000000000 +1100
+++ dtc/livetree.c 2008-03-26 17:53:17.000000000 +1100
@@ -165,13 +165,14 @@
}
struct boot_info *build_boot_info(struct reserve_info *reservelist,
- struct node *tree)
+ struct node *tree, u32 boot_cpuid_phys)
{
struct boot_info *bi;
bi = xmalloc(sizeof(*bi));
bi->reservelist = reservelist;
bi->dt = tree;
+ bi->boot_cpuid_phys = boot_cpuid_phys;
return bi;
}
Index: dtc/tests/run_tests.sh
===================================================================
--- dtc.orig/tests/run_tests.sh 2008-03-26 17:53:17.000000000 +1100
+++ dtc/tests/run_tests.sh 2008-03-26 17:55:14.000000000 +1100
@@ -200,6 +200,14 @@
run_dtc_test -I dts -O dtb -o dtc_comments-cmp.test.dtb comments-cmp.dts
run_test dtbs_equal_ordered dtc_comments.test.dtb dtc_comments-cmp.test.dtb
+ # Check boot_cpuid_phys handling
+ run_dtc_test -I dts -O dtb -b 17 -o boot_cpuid.test.dtb empty.dts
+ run_test boot-cpuid boot_cpuid.test.dtb 17
+ run_dtc_test -I dtb -O dtb -b 17 -o boot_cpuid_test_tree1.test.dtb test_tree1.dtb
+ run_test boot-cpuid boot_cpuid_test_tree1.test.dtb 17
+ run_dtc_test -I dtb -O dtb -o boot_cpuid_preserved_test_tree1.test.dtb boot_cpuid_test_tree1.test.dtb
+ run_test dtbs_equal_ordered boot_cpuid_preserved_test_tree1.test.dtb boot_cpuid_test_tree1.test.dtb
+
# Check -Odts mode preserve all dtb information
for tree in test_tree1.dtb dtc_tree1.test.dtb dtc_escapes.test.dtb ; do
run_dtc_test -I dtb -O dts -o odts_$tree.test.dts $tree
Index: dtc/tests/Makefile.tests
===================================================================
--- dtc.orig/tests/Makefile.tests 2008-03-26 17:53:17.000000000 +1100
+++ dtc/tests/Makefile.tests 2008-03-26 17:53:17.000000000 +1100
@@ -9,7 +9,7 @@
sw_tree1 \
move_and_save mangle-layout nopulate \
open_pack rw_tree1 set_name setprop del_property del_node \
- string_escapes references path-references \
+ string_escapes references path-references boot-cpuid \
dtbs_equal_ordered \
add_subnode_with_nops
LIB_TESTS = $(LIB_TESTS_L:%=$(TESTS_PREFIX)%)
Index: dtc/tests/boot-cpuid.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ dtc/tests/boot-cpuid.c 2008-03-26 17:53:17.000000000 +1100
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2008 David Gibson, IBM Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdint.h>
+
+#include <fdt.h>
+#include <libfdt.h>
+
+#include "tests.h"
+#include "testdata.h"
+
+int main(int argc, char *argv[])
+{
+ void *fdt;
+ uint32_t cpuid;
+
+ test_init(argc, argv);
+
+ if (argc != 3)
+ CONFIG("Usage: %s <dtb file> <cpuid>", argv[0]);
+
+ fdt = load_blob(argv[1]);
+ cpuid = strtoul(argv[2], NULL, 0);
+
+ if (fdt_boot_cpuid_phys(fdt) != cpuid)
+ FAIL("Incorrect boot_cpuid_phys (0x%x instead of 0x%x)",
+ fdt_boot_cpuid_phys(fdt), cpuid);
+
+ PASS();
+}
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ 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