* Re: [PATCH 1/3] misc: at24: parse OF-data, too
From: Grant Likely @ 2010-12-24 9:15 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linuxppc-dev, devicetree-discuss
In-Reply-To: <1289995250-17927-2-git-send-email-w.sang@pengutronix.de>
On Wed, Nov 17, 2010 at 01:00:48PM +0100, Wolfram Sang wrote:
> Information about the pagesize and read-only-status may also come from
> the devicetree. Parse this data, too, and act accordingly. While we are
> here, change the initialization printout a bit. write_max is useful to
> know to detect performance bottlenecks, the rest is superfluous.
>
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Applied for -next, thanks.
g.
> ---
>
> Changes since last version:
>
> - use __be32 instead of u32
>
> Documentation/powerpc/dts-bindings/eeprom.txt | 28 +++++++++++++++++++++
> drivers/misc/eeprom/at24.c | 33 ++++++++++++++++++++----
> 2 files changed, 55 insertions(+), 6 deletions(-)
> create mode 100644 Documentation/powerpc/dts-bindings/eeprom.txt
>
> diff --git a/Documentation/powerpc/dts-bindings/eeprom.txt b/Documentation/powerpc/dts-bindings/eeprom.txt
> new file mode 100644
> index 0000000..4342c10
> --- /dev/null
> +++ b/Documentation/powerpc/dts-bindings/eeprom.txt
> @@ -0,0 +1,28 @@
> +EEPROMs (I2C)
> +
> +Required properties:
> +
> + - compatible : should be "<manufacturer>,<type>"
> + If there is no specific driver for <manufacturer>, a generic
> + driver based on <type> is selected. Possible types are:
> + 24c00, 24c01, 24c02, 24c04, 24c08, 24c16, 24c32, 24c64,
> + 24c128, 24c256, 24c512, 24c1024, spd
> +
> + - reg : the I2C address of the EEPROM
> +
> +Optional properties:
> +
> + - pagesize : the length of the pagesize for writing. Please consult the
> + manual of your device, that value varies a lot. A wrong value
> + may result in data loss! If not specified, a safety value of
> + '1' is used which will be very slow.
> +
> + - read-only: this parameterless property disables writes to the eeprom
> +
> +Example:
> +
> +eeprom@52 {
> + compatible = "atmel,24c32";
> + reg = <0x52>;
> + pagesize = <32>;
> +};
> diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
> index 559b0b3..3a53efc 100644
> --- a/drivers/misc/eeprom/at24.c
> +++ b/drivers/misc/eeprom/at24.c
> @@ -20,6 +20,7 @@
> #include <linux/log2.h>
> #include <linux/bitops.h>
> #include <linux/jiffies.h>
> +#include <linux/of.h>
> #include <linux/i2c.h>
> #include <linux/i2c/at24.h>
>
> @@ -457,6 +458,27 @@ static ssize_t at24_macc_write(struct memory_accessor *macc, const char *buf,
>
> /*-------------------------------------------------------------------------*/
>
> +#ifdef CONFIG_OF
> +static void at24_get_ofdata(struct i2c_client *client,
> + struct at24_platform_data *chip)
> +{
> + const __be32 *val;
> + struct device_node *node = client->dev.of_node;
> +
> + if (node) {
> + if (of_get_property(node, "read-only", NULL))
> + chip->flags |= AT24_FLAG_READONLY;
> + val = of_get_property(node, "pagesize", NULL);
> + if (val)
> + chip->page_size = be32_to_cpup(val);
> + }
> +}
> +#else
> +static void at24_get_ofdata(struct i2c_client *client,
> + struct at24_platform_data *chip)
> +{ }
> +#endif /* CONFIG_OF */
> +
> static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
> {
> struct at24_platform_data chip;
> @@ -485,6 +507,9 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
> */
> chip.page_size = 1;
>
> + /* update chipdata if OF is present */
> + at24_get_ofdata(client, &chip);
> +
> chip.setup = NULL;
> chip.context = NULL;
> }
> @@ -597,19 +622,15 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
>
> i2c_set_clientdata(client, at24);
>
> - dev_info(&client->dev, "%zu byte %s EEPROM %s\n",
> + dev_info(&client->dev, "%zu byte %s EEPROM, %s, %u bytes/write\n",
> at24->bin.size, client->name,
> - writable ? "(writable)" : "(read-only)");
> + writable ? "writable" : "read-only", at24->write_max);
> if (use_smbus == I2C_SMBUS_WORD_DATA ||
> use_smbus == I2C_SMBUS_BYTE_DATA) {
> dev_notice(&client->dev, "Falling back to %s reads, "
> "performance will suffer\n", use_smbus ==
> I2C_SMBUS_WORD_DATA ? "word" : "byte");
> }
> - dev_dbg(&client->dev,
> - "page_size %d, num_addresses %d, write_max %d, use_smbus %d\n",
> - chip.page_size, num_addresses,
> - at24->write_max, use_smbus);
>
> /* export data to kernel code */
> if (chip.setup)
> --
> 1.7.2.3
>
^ permalink raw reply
* Re: [PATCH 3/3] powerpc: pcm030/032: add pagesize to dts
From: Grant Likely @ 2010-12-24 9:15 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linuxppc-dev, devicetree-discuss
In-Reply-To: <1289995250-17927-4-git-send-email-w.sang@pengutronix.de>
On Wed, Nov 17, 2010 at 01:00:50PM +0100, Wolfram Sang wrote:
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Applied for -next, thanks.
g.
> ---
> arch/powerpc/boot/dts/pcm030.dts | 1 +
> arch/powerpc/boot/dts/pcm032.dts | 3 ++-
> 2 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/boot/dts/pcm030.dts b/arch/powerpc/boot/dts/pcm030.dts
> index 8a4ec30..e7c36bc 100644
> --- a/arch/powerpc/boot/dts/pcm030.dts
> +++ b/arch/powerpc/boot/dts/pcm030.dts
> @@ -259,6 +259,7 @@
> eeprom@52 {
> compatible = "catalyst,24c32";
> reg = <0x52>;
> + pagesize = <32>;
> };
> };
>
> diff --git a/arch/powerpc/boot/dts/pcm032.dts b/arch/powerpc/boot/dts/pcm032.dts
> index 85d857a..e175e2c 100644
> --- a/arch/powerpc/boot/dts/pcm032.dts
> +++ b/arch/powerpc/boot/dts/pcm032.dts
> @@ -257,8 +257,9 @@
> reg = <0x51>;
> };
> eeprom@52 {
> - compatible = "at24,24c32";
> + compatible = "catalyst,24c32";
> reg = <0x52>;
> + pagesize = <32>;
> };
> };
>
> --
> 1.7.2.3
>
^ permalink raw reply
* Re: [PATCH RESEND] pata_mpc52xx: driver needs BMDMA
From: Jeff Garzik @ 2010-12-24 18:38 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linuxppc-dev, Andrew Morton, linux-kernel, linux-ide
In-Reply-To: <1293033011-19265-1-git-send-email-w.sang@pengutronix.de>
On 12/22/2010 10:50 AM, Wolfram Sang wrote:
> Found by this build-error if BMDMA is disabled:
>
> drivers/ata/pata_mpc52xx.c: In function 'mpc52xx_ata_init_one':
> drivers/ata/pata_mpc52xx.c:662: error: 'ata_bmdma_interrupt' undeclared (first use in this function)
> ...
>
> Move the Kconfig entry to the proper location as needed since
> 9a7780c9acb821fe1c2b6fc53f74cc2556ff5364 (libata-sff: make BMDMA optional)
>
> Signed-off-by: Wolfram Sang<w.sang@pengutronix.de>
> ---
>
> This is a build-failure, so fixing it before 2.6.37 would be great.
>
> drivers/ata/Kconfig | 20 ++++++++++----------
> drivers/ata/Makefile | 2 +-
> 2 files changed, 11 insertions(+), 11 deletions(-)
applied
^ permalink raw reply
* Re: [PATCH][GIT PULL] powerpc64/tracing: Add frame buffer to calls of trace_hardirqs_on/off
From: Benjamin Herrenschmidt @ 2010-12-24 21:11 UTC (permalink / raw)
To: Steven Rostedt; +Cc: linuxppc-dev, Andrew Morton, Joerg Sommer, LKML
In-Reply-To: <1293169566.22802.420.camel@gandalf.stny.rr.com>
On Fri, 2010-12-24 at 00:46 -0500, Steven Rostedt wrote:
> arch/powerpc/include/asm/irqflags.h | 40 ++++++++++++++++++++++++++--------
> 1 files changed, 30 insertions(+), 10 deletions(-)
> ---------------------------
> commit 5025019505da6731f8be13940bb978617599c935
> Author: Steven Rostedt <srostedt@redhat.com>
> Date: Thu Dec 23 21:07:39 2010 -0800
>
> powerpc64/tracing: Add frame buffer to calls of trace_hardirqs_on/off
>
> When an interrupt occurs in userspace, we can call trace_hardirqs_on/off()
> With one level stack. But if we have irqsoff tracing enabled,
> it checks both CALLER_ADDR0 and CALLER_ADDR1. The second call
> goes two stack frames up. If this is from user space, then there may
> not exist a second stack.
>
> Add a second stack when calling trace_hardirqs_on/off() otherwise
> the following oops might occur:
Hrm... this is really gross :-) So we add gratuituous overhead because
the code below is dumb :-) What about making the code less stupid
instead when poking at the stack and detect it's coming from userspace
instead ?
Cheers,
Ben.
> Oops: Kernel access of bad area, sig: 11 [#1]
> PREEMPT SMP NR_CPUS=2 PA Semi PWRficient
> last sysfs file: /sys/block/sda/size
> Modules linked in: ohci_hcd ehci_hcd usbcore
> NIP: c0000000000e1c00 LR: c0000000000034d4 CTR: 000000011012c440
> REGS: c00000003e2f3af0 TRAP: 0300 Not tainted (2.6.37-rc6+)
> MSR: 9000000000001032 <ME,IR,DR> CR: 48044444 XER: 20000000
> DAR: 00000001ffb9db50, DSISR: 0000000040000000
> TASK = c00000003e1a00a0[2088] 'emacs' THREAD: c00000003e2f0000 CPU: 1
> GPR00: 0000000000000001 c00000003e2f3d70 c00000000084e0d0 c0000000008816e8
> GPR04: 000000001034c678 000000001032e8f9 0000000010336540 0000000040020000
> GPR08: 0000000040020000 00000001ffb9db40 c00000003e2f3e30 0000000060000000
> GPR12: 100000000000f032 c00000000fff0280 000000001032e8c9 0000000000000008
> GPR16: 00000000105be9c0 00000000105be950 00000000105be9b0 00000000105be950
> GPR20: 00000000ffb9dc50 00000000ffb9dbf0 00000000102f0000 00000000102f0000
> GPR24: 00000000102e0000 00000000102f0000 0000000010336540 c0000000009ded38
> GPR28: 00000000102e0000 c0000000000034d4 c0000000007ccb10 c00000003e2f3d70
> NIP [c0000000000e1c00] .trace_hardirqs_off+0xb0/0x1d0
> LR [c0000000000034d4] decrementer_common+0xd4/0x100
> Call Trace:
> [c00000003e2f3d70] [c00000003e2f3e30] 0xc00000003e2f3e30 (unreliable)
> [c00000003e2f3e30] [c0000000000034d4] decrementer_common+0xd4/0x100
> Instruction dump:
> 81690000 7f8b0000 419e0018 f84a0028 60000000 60000000 60000000 e95f0000
> 80030000 e92a0000 eb6301f8 2f800000 <eb890010> 41fe00dc a06d000a eb1e8050
> ---[ end trace 4ec7fd2be9240928 ]---
>
> Reported-by: Joerg Sommer <joerg@alea.gnuu.de>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
>
> diff --git a/arch/powerpc/include/asm/irqflags.h b/arch/powerpc/include/asm/irqflags.h
> index b85d8dd..b0b06d8 100644
> --- a/arch/powerpc/include/asm/irqflags.h
> +++ b/arch/powerpc/include/asm/irqflags.h
> @@ -12,24 +12,44 @@
>
> #else
> #ifdef CONFIG_TRACE_IRQFLAGS
> +#ifdef CONFIG_IRQSOFF_TRACER
> +/*
> + * Since the ftrace irqsoff latency trace checks CALLER_ADDR1,
> + * which is the stack frame here, we need to force a stack frame
> + * in case we came from user space.
> + */
> +#define TRACE_WITH_FRAME_BUFFER(func) \
> + mflr r0; \
> + stdu r1, -32(r1); \
> + std r0, 16(r1); \
> + stdu r1, -32(r1); \
> + bl func; \
> + ld r1, 0(r1); \
> + ld r1, 0(r1);
> +#else
> +#define TRACE_WITH_FRAME_BUFFER(func) \
> + bl func;
> +#endif
> +
> /*
> * Most of the CPU's IRQ-state tracing is done from assembly code; we
> * have to call a C function so call a wrapper that saves all the
> * C-clobbered registers.
> */
> -#define TRACE_ENABLE_INTS bl .trace_hardirqs_on
> -#define TRACE_DISABLE_INTS bl .trace_hardirqs_off
> -#define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip) \
> - cmpdi en,0; \
> - bne 95f; \
> - stb en,PACASOFTIRQEN(r13); \
> - bl .trace_hardirqs_off; \
> - b skip; \
> -95: bl .trace_hardirqs_on; \
> +#define TRACE_ENABLE_INTS TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_on)
> +#define TRACE_DISABLE_INTS TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_off)
> +
> +#define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip) \
> + cmpdi en,0; \
> + bne 95f; \
> + stb en,PACASOFTIRQEN(r13); \
> + TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_off) \
> + b skip; \
> +95: TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_on) \
> li en,1;
> #define TRACE_AND_RESTORE_IRQ(en) \
> TRACE_AND_RESTORE_IRQ_PARTIAL(en,96f); \
> - stb en,PACASOFTIRQEN(r13); \
> + stb en,PACASOFTIRQEN(r13); \
> 96:
> #else
> #define TRACE_ENABLE_INTS
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply
* [PATCH] powerpc: use simple_read_from_buffer
From: Akinobu Mita @ 2010-12-25 6:03 UTC (permalink / raw)
To: linux-kernel; +Cc: linuxppc-dev, Paul Mackerras, Akinobu Mita
Simplify read file operation for /proc/powerpc/rtas/* interface
by using simple_read_from_buffer.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
---
arch/powerpc/kernel/rtas_flash.c | 53 ++++---------------------------------
1 files changed, 6 insertions(+), 47 deletions(-)
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c
index 2b442e6..bf5f5ce 100644
--- a/arch/powerpc/kernel/rtas_flash.c
+++ b/arch/powerpc/kernel/rtas_flash.c
@@ -256,31 +256,16 @@ static ssize_t rtas_flash_read(struct file *file, char __user *buf,
struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode);
struct rtas_update_flash_t *uf;
char msg[RTAS_MSG_MAXLEN];
- int msglen;
- uf = (struct rtas_update_flash_t *) dp->data;
+ uf = dp->data;
if (!strcmp(dp->name, FIRMWARE_FLASH_NAME)) {
get_flash_status_msg(uf->status, msg);
} else { /* FIRMWARE_UPDATE_NAME */
sprintf(msg, "%d\n", uf->status);
}
- msglen = strlen(msg);
- if (msglen > count)
- msglen = count;
-
- if (ppos && *ppos != 0)
- return 0; /* be cheap */
-
- if (!access_ok(VERIFY_WRITE, buf, msglen))
- return -EINVAL;
- if (copy_to_user(buf, msg, msglen))
- return -EFAULT;
-
- if (ppos)
- *ppos = msglen;
- return msglen;
+ return simple_read_from_buffer(buf, count, ppos, msg, strlen(msg));
}
/* constructor for flash_block_cache */
@@ -394,26 +379,13 @@ static ssize_t manage_flash_read(struct file *file, char __user *buf,
char msg[RTAS_MSG_MAXLEN];
int msglen;
- args_buf = (struct rtas_manage_flash_t *) dp->data;
+ args_buf = dp->data;
if (args_buf == NULL)
return 0;
msglen = sprintf(msg, "%d\n", args_buf->status);
- if (msglen > count)
- msglen = count;
- if (ppos && *ppos != 0)
- return 0; /* be cheap */
-
- if (!access_ok(VERIFY_WRITE, buf, msglen))
- return -EINVAL;
-
- if (copy_to_user(buf, msg, msglen))
- return -EFAULT;
-
- if (ppos)
- *ppos = msglen;
- return msglen;
+ return simple_read_from_buffer(buf, count, ppos, msg, msglen);
}
static ssize_t manage_flash_write(struct file *file, const char __user *buf,
@@ -495,24 +467,11 @@ static ssize_t validate_flash_read(struct file *file, char __user *buf,
char msg[RTAS_MSG_MAXLEN];
int msglen;
- args_buf = (struct rtas_validate_flash_t *) dp->data;
+ args_buf = dp->data;
- if (ppos && *ppos != 0)
- return 0; /* be cheap */
-
msglen = get_validate_flash_msg(args_buf, msg);
- if (msglen > count)
- msglen = count;
-
- if (!access_ok(VERIFY_WRITE, buf, msglen))
- return -EINVAL;
-
- if (copy_to_user(buf, msg, msglen))
- return -EFAULT;
- if (ppos)
- *ppos = msglen;
- return msglen;
+ return simple_read_from_buffer(buf, count, ppos, msg, msglen);
}
static ssize_t validate_flash_write(struct file *file, const char __user *buf,
--
1.7.3.4
^ permalink raw reply related
* [PATCH] spufs: use simple_write_to_buffer
From: Akinobu Mita @ 2010-12-25 6:03 UTC (permalink / raw)
To: linux-kernel
Cc: cbe-oss-dev, Akinobu Mita, Paul Mackerras, Jeremy Kerr,
linuxppc-dev
Simplify several write fileoperations for spufs by using
simple_write_to_buffer().
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Jeremy Kerr <jk@ozlabs.org>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: cbe-oss-dev@lists.ozlabs.org
---
arch/powerpc/platforms/cell/spufs/file.c | 27 +++++++--------------------
1 files changed, 7 insertions(+), 20 deletions(-)
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 02f7b11..3c7c3f8 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -219,24 +219,17 @@ spufs_mem_write(struct file *file, const char __user *buffer,
loff_t pos = *ppos;
int ret;
- if (pos < 0)
- return -EINVAL;
if (pos > LS_SIZE)
return -EFBIG;
- if (size > LS_SIZE - pos)
- size = LS_SIZE - pos;
ret = spu_acquire(ctx);
if (ret)
return ret;
local_store = ctx->ops->get_ls(ctx);
- ret = copy_from_user(local_store + pos, buffer, size);
+ size = simple_write_to_buffer(local_store, LS_SIZE, ppos, buffer, size);
spu_release(ctx);
- if (ret)
- return -EFAULT;
- *ppos = pos + size;
return size;
}
@@ -574,18 +567,15 @@ spufs_regs_write(struct file *file, const char __user *buffer,
if (*pos >= sizeof(lscsa->gprs))
return -EFBIG;
- size = min_t(ssize_t, sizeof(lscsa->gprs) - *pos, size);
- *pos += size;
-
ret = spu_acquire_saved(ctx);
if (ret)
return ret;
- ret = copy_from_user((char *)lscsa->gprs + *pos - size,
- buffer, size) ? -EFAULT : size;
+ size = simple_write_to_buffer(lscsa->gprs, sizeof(lscsa->gprs), pos,
+ buffer, size);
spu_release_saved(ctx);
- return ret;
+ return size;
}
static const struct file_operations spufs_regs_fops = {
@@ -630,18 +620,15 @@ spufs_fpcr_write(struct file *file, const char __user * buffer,
if (*pos >= sizeof(lscsa->fpcr))
return -EFBIG;
- size = min_t(ssize_t, sizeof(lscsa->fpcr) - *pos, size);
-
ret = spu_acquire_saved(ctx);
if (ret)
return ret;
- *pos += size;
- ret = copy_from_user((char *)&lscsa->fpcr + *pos - size,
- buffer, size) ? -EFAULT : size;
+ size = simple_write_to_buffer(&lscsa->fpcr, sizeof(lscsa->fpcr), pos,
+ buffer, size);
spu_release_saved(ctx);
- return ret;
+ return size;
}
static const struct file_operations spufs_fpcr_fops = {
--
1.7.3.4
^ permalink raw reply related
* Re: [PATCH][GIT PULL] powerpc64/tracing: Add frame buffer to calls of trace_hardirqs_on/off
From: Steven Rostedt @ 2010-12-25 21:04 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, Andrew Morton, Joerg Sommer, LKML
In-Reply-To: <1293225065.16694.796.camel@pasglop>
On Sat, 2010-12-25 at 08:11 +1100, Benjamin Herrenschmidt wrote:
> On Fri, 2010-12-24 at 00:46 -0500, Steven Rostedt wrote:
>
> > arch/powerpc/include/asm/irqflags.h | 40 ++++++++++++++++++++++++++--------
> > 1 files changed, 30 insertions(+), 10 deletions(-)
> > ---------------------------
> > commit 5025019505da6731f8be13940bb978617599c935
> > Author: Steven Rostedt <srostedt@redhat.com>
> > Date: Thu Dec 23 21:07:39 2010 -0800
> >
> > powerpc64/tracing: Add frame buffer to calls of trace_hardirqs_on/off
> >
> > When an interrupt occurs in userspace, we can call trace_hardirqs_on/off()
> > With one level stack. But if we have irqsoff tracing enabled,
> > it checks both CALLER_ADDR0 and CALLER_ADDR1. The second call
> > goes two stack frames up. If this is from user space, then there may
> > not exist a second stack.
> >
> > Add a second stack when calling trace_hardirqs_on/off() otherwise
> > the following oops might occur:
>
> Hrm... this is really gross :-) So we add gratuituous overhead because
> the code below is dumb :-) What about making the code less stupid
> instead when poking at the stack and detect it's coming from userspace
> instead ?
Note, when CONFIG_IRQSOFF_TRACE is set, there's already a bit of
overhead :-)
Anyway, I'll have to take a look at how the frame pointer is set up. Or
we could also set up all stacks coming into the kernel to have a "dummy"
frame pointer that wont hurt anything if we index into it.
Anyway, I'm off till the new year, so I'll worry about it then ;-)
-- Steve
^ permalink raw reply
* Re: Oops in trace_hardirqs_on (powerpc)
From: Jörg Sommer @ 2010-12-26 0:30 UTC (permalink / raw)
To: Steven Rostedt
Cc: Frederic Weisbecker, Ingo Molnar, linux-kernel, linuxppc-dev
In-Reply-To: <1293072176.22802.6.camel@gandalf.stny.rr.com>
[-- Attachment #1: Type: text/plain, Size: 1437 bytes --]
Hi Steven,
Steven Rostedt hat am Wed 22. Dec, 21:42 (-0500) geschrieben:
> On Sun, 2010-12-19 at 14:27 +0100, Jörg Sommer wrote:
> > Did you've fixed this problem? The bug report is still marked as open.
> > https://bugzilla.kernel.org/show_bug.cgi?id=16573
> >
>
> I just posted a patch to that BZ. I have it here below too. Could you
> see if it fixes you problem. I only fixed the one place that you
> reported, it may need more fixes (and in that case a macro to do the
> work).
>
> I hit the same bug on my ppc64 box, and have a fix for that, that I'll
> post to LKML tomorrow.
>
> -- Steve
>
> diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
> index ed4aeb9..915cc03 100644
> --- a/arch/powerpc/kernel/entry_32.S
> +++ b/arch/powerpc/kernel/entry_32.S
> @@ -879,7 +879,18 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_47x)
> */
> andi. r10,r9,MSR_EE
> beq 1f
> + /*
> + * Since the ftrace irqsoff latency trace checks CALLER_ADDR1,
> + * which is the stack frame here, we need to force a stack frame
> + * in case we came from user space.
> + */
> + stwu r1,-32(r1)
> + mflr r0
> + stw r0,4(r1)
> + stwu r1,-32(r1)
> bl trace_hardirqs_on
> + lwz r1,0(r1)
> + lwz r1,0(r1)
> lwz r9,_MSR(r1)
> 1:
> #endif /* CONFIG_TRACE_IRQFLAGS */
This patch eliminates the oopses.
Bye, Jörg.
--
Der Klügere gibt so lange nach bis er der Dumme ist.
[-- Attachment #2: Digital signature http://en.wikipedia.org/wiki/OpenPGP --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* Re: [PATCH][GIT PULL] powerpc64/tracing: Add frame buffer to calls of trace_hardirqs_on/off
From: Benjamin Herrenschmidt @ 2010-12-27 21:38 UTC (permalink / raw)
To: Steven Rostedt; +Cc: linuxppc-dev, Andrew Morton, Joerg Sommer, LKML
In-Reply-To: <1293311043.22802.434.camel@gandalf.stny.rr.com>
On Sat, 2010-12-25 at 16:04 -0500, Steven Rostedt wrote:
>
> Note, when CONFIG_IRQSOFF_TRACE is set, there's already a bit of
> overhead :-)
>
> Anyway, I'll have to take a look at how the frame pointer is set up.
> Or
> we could also set up all stacks coming into the kernel to have a
> "dummy"
> frame pointer that wont hurt anything if we index into it.
>
> Anyway, I'm off till the new year, so I'll worry about it then ;-)
Right, might be simpler to just make them loop back onto themselves or
something like that. I can have a look too if I get a chance.
Cheers,
Ben.
^ permalink raw reply
* PMU_IOC_SLEEP failed
From: jjDaNiMoTh @ 2010-12-28 12:25 UTC (permalink / raw)
To: linuxppc-dev
Hi all,
what could be the problem here?
[root@myhost ~]# /usr/lib/hal/hal-system-power-pmu sleep
power-pmu : PMU_IOC_SLEEP failed
(same with pm-suspend, kernel version: any >= 2.6.33. I'm now on a .37-rc).
KMS is disabled (modprobe radeon modeset=0, and I can't switch over VT).
userspace thing has kms for radeon disabled (libdrm, mesa, xf86-video-ati).
There are some important parts of config should I attach?
Thanks
^ permalink raw reply
* Hang in Freescale Host Controller
From: Sabari @ 2010-12-28 13:09 UTC (permalink / raw)
To: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 479 bytes --]
Hi,
I am expereincing some sort of end less loop in FHCI, we are using linux
2.6.11 on MPC836X we got as part of BSP from freescale. When we connect the
usb device and try to do some data transfer we see an endless loop happens
in function
scan_ed_list(..) of fhci-hcd.c when list_type BULK list is passed to it.
Is any one faced similar issue on the freescale host controller interface
for any USB device? If so tell us how you have overcomed this issue.
Thanks,
Sabari.
[-- Attachment #2: Type: text/html, Size: 620 bytes --]
^ permalink raw reply
* Re: PMU_IOC_SLEEP failed
From: Michel Dänzer @ 2010-12-28 15:32 UTC (permalink / raw)
To: jjDaNiMoTh; +Cc: linuxppc-dev
In-Reply-To: <AANLkTiksBGDR=vJLArgShP8U_NWZ2OWXc65wiXRLv4kr@mail.gmail.com>
On Die, 2010-12-28 at 13:25 +0100, jjDaNiMoTh wrote:=20
>=20
> what could be the problem here?
>=20
> [root@myhost ~]# /usr/lib/hal/hal-system-power-pmu sleep
> power-pmu : PMU_IOC_SLEEP failed
>=20
> (same with pm-suspend, kernel version: any >=3D 2.6.33. I'm now on a .37-=
rc).
>=20
> KMS is disabled (modprobe radeon modeset=3D0, and I can't switch over VT)=
.
What exactly does "can't switch over VT" mean?
Sleep requires radeonfb, is that enabled?
--=20
Earthling Michel D=C3=A4nzer | http://www.vmware.c=
om
Libre software enthusiast | Debian, X and DRI developer
^ permalink raw reply
* Re: [PATCH] of_mmc_spi: add card detect irq support
From: Anton Vorontsov @ 2010-12-28 16:05 UTC (permalink / raw)
To: Grant Likely
Cc: David Brownell, Esben Haabendal, linux-mmc, David Brownell,
Andrew Morton, linuxppc-dev
In-Reply-To: <AANLkTimXJ-hSz3O1xPgLsZLxwkwBeqrW+gAmR8+6jGoW@mail.gmail.com>
On Mon, Aug 30, 2010 at 11:49:08AM -0600, Grant Likely wrote:
> On Mon, Aug 30, 2010 at 10:38 AM, David Brownell <david-b@pacbell.net> wrote:
> > Since I don't do OpenFirmware, let's hear from
> > Grant on this one.
>
> Looks good to me.
>
> Acked-by: Grant Likely <grant.likely@secretlab.ca>
I wonder what happened with this patch?
Thanks,
--
Anton Vorontsov
Email: cbouatmailru@gmail.com
^ permalink raw reply
* Re: PMU_IOC_SLEEP failed
From: jjDaNiMoTh @ 2010-12-28 16:39 UTC (permalink / raw)
To: Michel Dänzer; +Cc: linuxppc-dev
In-Reply-To: <1293550353.19556.224.camel@thor.local>
2010/12/28 Michel D=C3=A4nzer <michel@daenzer.net>:
[cut]
> What exactly does "can't switch over VT" mean?
After X is running, I can't switch over ctrl + alt + f{1,2,3,4,5,6}
consoles ( the screen flicker, then blank ). If I switch to f7, where
X live, all return to normal and I can see normal X window.
This doesn't happend with X active.
> Sleep requires radeonfb, is that enabled?
Of course, but I think there is something wrong:
(dmesg..)
[...]
radeonfb_pci_register BEGIN
radeonfb 0000:00:10.0: BAR 0: can't reserve [mem 0xb8000000-0xbfffffff pref=
]
radeonfb (0000:00:10.0): cannot request region 0.
radeonfb: probe of 0000:00:10.0 failed with error -16
^ permalink raw reply
* Re: PMU_IOC_SLEEP failed
From: Benjamin Herrenschmidt @ 2010-12-28 20:54 UTC (permalink / raw)
To: jjDaNiMoTh; +Cc: linuxppc-dev
In-Reply-To: <AANLkTinBQAMvmmNP5S_=++UOQDoTe-1efD39VF0PO5kB@mail.gmail.com>
On Tue, 2010-12-28 at 17:39 +0100, jjDaNiMoTh wrote:
> 2010/12/28 Michel Dänzer <michel@daenzer.net>:
> [cut]
> > What exactly does "can't switch over VT" mean?
> After X is running, I can't switch over ctrl + alt + f{1,2,3,4,5,6}
> consoles ( the screen flicker, then blank ). If I switch to f7, where
> X live, all return to normal and I can see normal X window.
> This doesn't happend with X active.
>
> > Sleep requires radeonfb, is that enabled?
>
> Of course, but I think there is something wrong:
>
> (dmesg..)
> [...]
> radeonfb_pci_register BEGIN
> radeonfb 0000:00:10.0: BAR 0: can't reserve [mem 0xb8000000-0xbfffffff pref]
> radeonfb (0000:00:10.0): cannot request region 0.
> radeonfb: probe of 0000:00:10.0 failed with error -16
That looks bad indeed. Send me the complete dmesg, a snapshot of the
device-tree (tar -c /proc/device-tree >foo.tar) and the output
of /proc/iomem please.
Cheers,
Ben.
^ permalink raw reply
* Re: PMU_IOC_SLEEP failed
From: jjDaNiMoTh @ 2010-12-28 23:35 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <1293569648.17779.20.camel@pasglop>
2010/12/28 Benjamin Herrenschmidt <benh@kernel.crashing.org>:
> On Tue, 2010-12-28 at 17:39 +0100, jjDaNiMoTh wrote:
>> 2010/12/28 Michel D=C3=A4nzer <michel@daenzer.net>:
>> [cut]
>> > What exactly does "can't switch over VT" mean?
>> After X is running, I can't switch over ctrl + alt + f{1,2,3,4,5,6}
>> consoles ( the screen flicker, then blank ). If I switch to f7, where
>> X live, all return to normal and I can see normal X window.
>> This doesn't happend with X active.
>>
>> > Sleep requires radeonfb, is that enabled?
>>
>> Of course, but I think there is something wrong:
>>
>> (dmesg..)
>> [...]
>> radeonfb_pci_register BEGIN
>> radeonfb 0000:00:10.0: BAR 0: can't reserve [mem 0xb8000000-0xbfffffff p=
ref]
>> radeonfb (0000:00:10.0): cannot request region 0.
>> radeonfb: probe of 0000:00:10.0 failed with error -16
>
> That looks bad indeed. Send me the complete dmesg, a snapshot of the
> device-tree (tar -c /proc/device-tree >foo.tar) and the output
> of /proc/iomem please.
[1] http://nat.vacau.com/linux/iomem.txt.gz
[2] http://nat.vacau.com/linux/dmesg_37-rc.txt.gz
[3] http://nat.vacau.com/linux/device_tree.tar
Thank you
^ permalink raw reply
* problem backporting talitos for MPC8272
From: Alexandru Ionut Grama @ 2010-12-29 1:10 UTC (permalink / raw)
To: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 1869 bytes --]
Hello,
I'm trying to backporting cryptoApi from 2.6.35.7 to 2.6.21 for making
backward compatibility with the crypto-processor of powerpc MPC8272. This
uses the SEC1.0 from Freescale for crypto. This processor it's mounted on a
custom board with a non-standard closed bootloader, but it can pass
parameters to the kernel.
I've made already the backport for the cryptoApi and talitos and the
compiles and runs. Consulting /proc/crypto I can see normal results, but no
drivers involving talitos. This it's normal because talitos_init() runs, but
not talitos_probe(). ¿Why? ¿How can I force a driver to be probed? I can see
that talitos it's registered on "of drivers tree", but nobody calls the
function talitos_probe(). I've making print this activating the print of
changing kobject on Kernel Hacking.
My final question it's about of-tree. I have the mpc8272ads.dts file with a
tree that involves talitos, but I've changed the properties acording the new
version of it on 2.6.35. ¿This file (mpc8272ads.dts) when it's used?I think
I don't use this file for nothing (it doesn't appears on make V=1) because I
don't have a normal bootloader and I have to load the kernel like a
flat-binary gz, so there's no more step after building System.map.
In the ocf-linux talitos driver specifications says that the only difference
between SEC1.0 and SEC2.0 it's the clock velocity. It has the same number of
channels and so on... ¿so talitos can be compatible with SEC1.0?
Also, ¿where I can submit the work already done (backporting of cryptoApi) ?
Maybe it's useful for someone.
I appreciate your help because this work it's a part for my finial bachelor
work.Thank you.
King regads,
Alexandru.
--
*---------------------------------------------------------------
Alexandru Ionut Grama
**email: gramaalexandruionut@gmail.com**
*
[-- Attachment #2: Type: text/html, Size: 2125 bytes --]
^ permalink raw reply
* [PATCH] KVM: PPC: Fix SPRG get/set for Book3S and BookE
From: Peter Tyser @ 2010-12-29 19:51 UTC (permalink / raw)
To: kvm-ppc; +Cc: Peter Tyser, linuxppc-dev, agraf, kvm
Previously SPRGs 4-7 were improperly read and written in
kvm_arch_vcpu_ioctl_get_regs() and kvm_arch_vcpu_ioctl_set_regs();
Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
---
I noticed this while grepping for somthing unrelated and assume its
a typo. Feel free to add to the patch description; I don't use KVM
so don't know what the high-level consequences of this change are.
arch/powerpc/kvm/book3s.c | 14 ++++++++------
arch/powerpc/kvm/booke.c | 14 ++++++++------
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index e316847..5eb86c9 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -1141,9 +1141,10 @@ int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
regs->sprg1 = vcpu->arch.shared->sprg1;
regs->sprg2 = vcpu->arch.shared->sprg2;
regs->sprg3 = vcpu->arch.shared->sprg3;
- regs->sprg5 = vcpu->arch.sprg4;
- regs->sprg6 = vcpu->arch.sprg5;
- regs->sprg7 = vcpu->arch.sprg6;
+ regs->sprg4 = vcpu->arch.sprg4;
+ regs->sprg5 = vcpu->arch.sprg5;
+ regs->sprg6 = vcpu->arch.sprg6;
+ regs->sprg7 = vcpu->arch.sprg7;
for (i = 0; i < ARRAY_SIZE(regs->gpr); i++)
regs->gpr[i] = kvmppc_get_gpr(vcpu, i);
@@ -1167,9 +1168,10 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
vcpu->arch.shared->sprg1 = regs->sprg1;
vcpu->arch.shared->sprg2 = regs->sprg2;
vcpu->arch.shared->sprg3 = regs->sprg3;
- vcpu->arch.sprg5 = regs->sprg4;
- vcpu->arch.sprg6 = regs->sprg5;
- vcpu->arch.sprg7 = regs->sprg6;
+ vcpu->arch.sprg4 = regs->sprg4;
+ vcpu->arch.sprg5 = regs->sprg5;
+ vcpu->arch.sprg6 = regs->sprg6;
+ vcpu->arch.sprg7 = regs->sprg7;
for (i = 0; i < ARRAY_SIZE(regs->gpr); i++)
kvmppc_set_gpr(vcpu, i, regs->gpr[i]);
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 77575d0..ef76acb 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -546,9 +546,10 @@ int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
regs->sprg1 = vcpu->arch.shared->sprg1;
regs->sprg2 = vcpu->arch.shared->sprg2;
regs->sprg3 = vcpu->arch.shared->sprg3;
- regs->sprg5 = vcpu->arch.sprg4;
- regs->sprg6 = vcpu->arch.sprg5;
- regs->sprg7 = vcpu->arch.sprg6;
+ regs->sprg4 = vcpu->arch.sprg4;
+ regs->sprg5 = vcpu->arch.sprg5;
+ regs->sprg6 = vcpu->arch.sprg6;
+ regs->sprg7 = vcpu->arch.sprg7;
for (i = 0; i < ARRAY_SIZE(regs->gpr); i++)
regs->gpr[i] = kvmppc_get_gpr(vcpu, i);
@@ -572,9 +573,10 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
vcpu->arch.shared->sprg1 = regs->sprg1;
vcpu->arch.shared->sprg2 = regs->sprg2;
vcpu->arch.shared->sprg3 = regs->sprg3;
- vcpu->arch.sprg5 = regs->sprg4;
- vcpu->arch.sprg6 = regs->sprg5;
- vcpu->arch.sprg7 = regs->sprg6;
+ vcpu->arch.sprg4 = regs->sprg4;
+ vcpu->arch.sprg5 = regs->sprg5;
+ vcpu->arch.sprg6 = regs->sprg6;
+ vcpu->arch.sprg7 = regs->sprg7;
for (i = 0; i < ARRAY_SIZE(regs->gpr); i++)
kvmppc_set_gpr(vcpu, i, regs->gpr[i]);
--
1.7.0.4
^ permalink raw reply related
* PowerPC BUG: using smp_processor_id() in preemptible code
From: Hugh Dickins @ 2010-12-29 22:54 UTC (permalink / raw)
To: Ben Herrenschmidt
Cc: Jeremy Fitzhardinge, linuxppc-dev, Nick Piggin, linux-kernel
With recent 2.6.37-rc, with CONFIG_PREEMPT=y CONFIG_DEBUG_PREEMPT=y
on the PowerPC G5, I get spammed by BUG warnings each time I swapoff:
BUG: using smp_processor_id() in preemptible [00000000] code: swapoff/3974
caller is .hpte_need_flush+0x4c/0x2e8
Call Trace:
[c0000001b4a3f830] [c00000000000f3cc] .show_stack+0x6c/0x16c (unreliable)
[c0000001b4a3f8e0] [c00000000023eda0] .debug_smp_processor_id+0xe4/0x11c
[c0000001b4a3f970] [c00000000002f2f4] .hpte_need_flush+0x4c/0x2e8
[c0000001b4a3fa30] [c0000000000e7ef8] .vunmap_pud_range+0x148/0x200
[c0000001b4a3fb10] [c0000000000e8058] .vunmap_page_range+0xa8/0xd4
[c0000001b4a3fbb0] [c0000000000e80a4] .free_unmap_vmap_area+0x20/0x38
[c0000001b4a3fc40] [c0000000000e8138] .remove_vm_area+0x7c/0xb4
[c0000001b4a3fcd0] [c0000000000e8308] .__vunmap+0x50/0x104
[c0000001b4a3fd60] [c0000000000ef3fc] .SyS_swapoff+0x59c/0x6a8
[c0000001b4a3fe30] [c0000000000075a8] syscall_exit+0x0/0x40
I notice hpte_need_flush() itself acknowledges
* Must be called from within some kind of spinlock/non-preempt region...
Though I didn't actually bisect, I believe this is since Jeremy's
64141da587241301ce8638cc945f8b67853156ec "vmalloc: eagerly clear ptes
on vunmap", which moves a call to vunmap_page_range() from one place
(which happened to be inside a spinlock) to another (where it's not).
I guess my warnings would be easily silenced by moving that call to
vunmap_page_range() down just inside the spinlock below it; but I'm
dubious that that's the right fix - it looked as if there are other
paths through vmalloc.c where vunmap_page_range() has been getting
called without preemption disabled, long before Jeremy's change,
just paths that I never happen to go down in my limited testing.
For the moment I'm using the obvious patch below to keep it quiet;
but I doubt that this is the right patch either. I'm hoping that
ye who understand the importance of hpte_need_flush() will be best
able to judge what to do. Or might there be other architectures
expecting to be unpreemptible there?
Thanks,
Hugh
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -37,11 +37,13 @@ static void vunmap_pte_range(pmd_t *pmd,
{
pte_t *pte;
+ preempt_disable(); /* Stop __vunmap() triggering smp_processor_id() in preemptible from hpte_need_flush() */
pte = pte_offset_kernel(pmd, addr);
do {
pte_t ptent = ptep_get_and_clear(&init_mm, addr, pte);
WARN_ON(!pte_none(ptent) && !pte_present(ptent));
} while (pte++, addr += PAGE_SIZE, addr != end);
+ preempt_enable();
}
static void vunmap_pmd_range(pud_t *pud, unsigned long addr, unsigned long end)
^ permalink raw reply
* Re: [PATCH 1/7] fdt: Add Kconfig for EARLY_FLATTREE
From: Grant Likely @ 2010-12-30 0:15 UTC (permalink / raw)
To: Stephen Neuendorffer
Cc: dirk.brandewie, microblaze-uclinux, devicetree-discuss,
linuxppc-dev
In-Reply-To: <d43cf8d1-8821-4400-9c58-692846dd37ac@SG2EHSMHS005.ehs.local>
On Thu, Nov 18, 2010 at 03:54:56PM -0800, Stephen Neuendorffer wrote:
> The device tree code is now in two pieces: some which can be used generically
> on any platform which selects CONFIG_OF_FLATTREE, and some early which is used
> at boot time on only a few architectures. This patch segregates the early
> code so that only those architectures which care about it need compile it.
> This also means that some of the requirements in the early code (such as
> a cmd_line variable) that most architectures (e.g. X86) don't provide
> can be ignored.
>
> Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Applied, thanks. I had to fix up the #ifdef which was testing for
CONFIG_EARLY_FLATTREE instead of CONFIG_OF_EARLY_FLATTREE, and I
reworked OF_EARLY_FLATTREE to select instead of depend on OF_FLATTREE.
Cheers,
g.
>
> ----
>
> Grant,
> We had discussed doing something like this a loooong time ago. This (or at
> least some other way of dealing with cmd_line) is
> actually necessary to compile on X86. Do you still want to do it this way?
> Looking at my old email, you suggested only powerpc and microblaze need this.
> Is that still the case?
>
> Conflicts:
>
> drivers/of/fdt.c
> ---
> arch/microblaze/Kconfig | 1 +
> arch/powerpc/Kconfig | 1 +
> drivers/of/Kconfig | 5 +++++
> drivers/of/fdt.c | 4 ++++
> 4 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
> index 692fdfc..384375c 100644
> --- a/arch/microblaze/Kconfig
> +++ b/arch/microblaze/Kconfig
> @@ -20,6 +20,7 @@ config MICROBLAZE
> select TRACING_SUPPORT
> select OF
> select OF_FLATTREE
> + select OF_EARLY_FLATTREE
>
> config SWAP
> def_bool n
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 631e5a0..2cd7b32 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -119,6 +119,7 @@ config PPC
> default y
> select OF
> select OF_FLATTREE
> + select OF_EARLY_FLATTREE
> select HAVE_FTRACE_MCOUNT_RECORD
> select HAVE_DYNAMIC_FTRACE
> select HAVE_FUNCTION_TRACER
> diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
> index aa675eb..0199157 100644
> --- a/drivers/of/Kconfig
> +++ b/drivers/of/Kconfig
> @@ -19,6 +19,10 @@ config OF_FLATTREE
> bool
> select DTC
>
> +config OF_EARLY_FLATTREE
> + bool
> + depends on OF_FLATTREE
> +
> config OF_PROMTREE
> bool
>
> @@ -62,3 +66,4 @@ config OF_MDIO
> OpenFirmware MDIO bus (Ethernet PHY) accessors
>
> endmenu # OF
> +
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index c1360e0..4d71b29 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -27,6 +27,8 @@ int __initdata dt_root_size_cells;
>
> struct boot_param_header *initial_boot_params;
>
> +#ifdef CONFIG_EARLY_FLATTREE
> +
> char *find_flat_dt_string(u32 offset)
> {
> return ((char *)initial_boot_params) +
> @@ -604,3 +606,5 @@ void __init unflatten_device_tree(void)
>
> pr_debug(" <- unflatten_device_tree()\n");
> }
> +
> +#endif /* CONFIG_EARLY_FLATTREE */
> --
> 1.5.6.6
>
>
>
> This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
>
>
^ permalink raw reply
* Re: [PATCH 2/7] arch/x86: Add support for device tree code.
From: Grant Likely @ 2010-12-30 0:17 UTC (permalink / raw)
To: Stephen Neuendorffer
Cc: dirk.brandewie, microblaze-uclinux, devicetree-discuss,
linuxppc-dev
In-Reply-To: <98608b2e-d138-4dc0-808d-3662ab2c9938@VA3EHSMHS025.ehs.local>
On Thu, Nov 18, 2010 at 03:54:57PM -0800, Stephen Neuendorffer wrote:
> A few support device-tree related support functions that x86 didn't
> have before.
>
> Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Skipping this patch. I expect to pick up Dirk's version instead.
g.
>
> ----
>
> Looks like just some irq related junk left!
> ---
> arch/x86/include/asm/irq.h | 2 ++
> arch/x86/kernel/irq.c | 11 +++++++++++
> 2 files changed, 13 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h
> index 5458380..af4e630 100644
> --- a/arch/x86/include/asm/irq.h
> +++ b/arch/x86/include/asm/irq.h
> @@ -10,6 +10,8 @@
> #include <asm/apicdef.h>
> #include <asm/irq_vectors.h>
>
> +#define irq_dispose_mapping(...)
> +
> static inline int irq_canonicalize(int irq)
> {
> return ((irq == 2) ? 9 : irq);
> diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
> index 91fd0c7..a3aaed4 100644
> --- a/arch/x86/kernel/irq.c
> +++ b/arch/x86/kernel/irq.c
> @@ -364,3 +364,14 @@ void fixup_irqs(void)
> }
> }
> #endif
> +
> +#ifdef CONFIG_OF
> +#include <linux/of_irq.h>
> +unsigned int irq_create_of_mapping(struct device_node *controller,
> + const u32 *intspec, unsigned int intsize)
> +{
> + return intspec[0] + 1;
> +}
> +EXPORT_SYMBOL_GPL(irq_create_of_mapping);
> +
> +#endif
> --
> 1.5.6.6
>
>
>
> This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
>
>
^ permalink raw reply
* Re: [PATCH 3/7] arch/x86: select OF and OF_FLATTREE
From: Grant Likely @ 2010-12-30 0:17 UTC (permalink / raw)
To: Stephen Neuendorffer
Cc: dirk.brandewie, microblaze-uclinux, devicetree-discuss,
linuxppc-dev
In-Reply-To: <111913e5-7481-46b8-b04d-eee3cdc8fc32@SG2EHSMHS002.ehs.local>
On Thu, Nov 18, 2010 at 03:54:58PM -0800, Stephen Neuendorffer wrote:
> Testing patch to verify that the device tree code can be compiled on X86.
> ---
Skipping this one also.
> arch/x86/Kconfig | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index cea0cd9..0f2ed5b 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -59,6 +59,8 @@ config X86
> select ANON_INODES
> select HAVE_ARCH_KMEMCHECK
> select HAVE_USER_RETURN_NOTIFIER
> + select OF
> + select OF_FLATTREE
>
> config INSTRUCTION_DECODER
> def_bool (KPROBES || PERF_EVENTS)
> --
> 1.5.6.6
>
>
>
> This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
>
>
^ permalink raw reply
* Re: [PATCH 4/7] fdt.c: Add non-boottime device tree functions
From: Grant Likely @ 2010-12-30 0:34 UTC (permalink / raw)
To: Stephen Neuendorffer
Cc: dirk.brandewie, microblaze-uclinux, devicetree-discuss,
linuxppc-dev
In-Reply-To: <d433b5eb-2d15-4a28-8083-97582bf4617f@VA3EHSMHS022.ehs.local>
On Thu, Nov 18, 2010 at 03:54:59PM -0800, Stephen Neuendorffer wrote:
> In preparation for providing run-time handling of device trees, factor
> out some of the basic functions so that they take an arbitrary blob,
> rather than relying on the single boot-time tree.
>
> Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Thanks. Merged, but one comment below. Please fix with a followup patch.
g.
>
> --
>
> V2: functions have of_fdt_* names
> removed find_flat_dt_string
> blob argument is first
> ---
> drivers/of/fdt.c | 133 ++++++++++++++++++++++++++++-------------------
> include/linux/of_fdt.h | 11 ++++
> 2 files changed, 90 insertions(+), 54 deletions(-)
>
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 4d71b29..190e26c 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -22,6 +22,82 @@
>
> #include <asm/page.h>
>
> +char *of_fdt_get_string(struct boot_param_header *blob, u32 offset)
> +{
> + return ((char *)blob) +
> + be32_to_cpu(blob->off_dt_strings) + offset;
> +}
> +
> +/**
> + * of_fdt_get_property - Given a node in the given flat blob, return
> + * the property ptr
> + */
> +void *of_fdt_get_property(struct boot_param_header *blob,
> + unsigned long node, const char *name,
> + unsigned long *size)
> +{
> + unsigned long p = node;
> +
> + do {
> + u32 tag = be32_to_cpup((__be32 *)p);
> + u32 sz, noff;
> + const char *nstr;
> +
> + p += 4;
> + if (tag == OF_DT_NOP)
> + continue;
> + if (tag != OF_DT_PROP)
> + return NULL;
> +
> + sz = be32_to_cpup((__be32 *)p);
> + noff = be32_to_cpup((__be32 *)(p + 4));
> + p += 8;
> + if (be32_to_cpu(blob->version) < 0x10)
> + p = ALIGN(p, sz >= 8 ? 8 : 4);
> +
> + nstr = of_fdt_get_string(blob, noff);
> + if (nstr == NULL) {
> + pr_warning("Can't find property index name !\n");
> + return NULL;
> + }
> + if (strcmp(name, nstr) == 0) {
> + if (size)
> + *size = sz;
> + return (void *)p;
> + }
> + p += sz;
> + p = ALIGN(p, 4);
> + } while (1);
> +}
> +
> +/**
> + * of_fdt_is_compatible - Return true if given node from the given blob has
> + * compat in its compatible list
> + * @blob: A device tree blob
> + * @node: node to test
> + * @compat: compatible string to compare with compatible list.
> + */
> +int of_fdt_is_compatible(struct boot_param_header *blob,
> + unsigned long node, const char *compat)
> +{
> + const char *cp;
> + unsigned long cplen, l;
> +
> + cp = of_fdt_get_property(blob, node, "compatible", &cplen);
> + if (cp == NULL)
> + return 0;
> + while (cplen > 0) {
> + if (of_compat_cmp(cp, compat, strlen(compat)) == 0)
> + return 1;
Need to verify that strlen(cp) + 1 is not larger than cplen.
Otherwise cplen could wrap around and the loop won't terminate because
cplen is an unsigned long.
> + l = strlen(cp) + 1;
> + cp += l;
> + cplen -= l;
> + }
> +
> + return 0;
> +}
> +
> +/* Everything below here references initial_boot_params directly. */
> int __initdata dt_root_addr_cells;
> int __initdata dt_root_size_cells;
>
> @@ -29,12 +105,6 @@ struct boot_param_header *initial_boot_params;
>
> #ifdef CONFIG_EARLY_FLATTREE
>
> -char *find_flat_dt_string(u32 offset)
> -{
> - return ((char *)initial_boot_params) +
> - be32_to_cpu(initial_boot_params->off_dt_strings) + offset;
> -}
> -
> /**
> * of_scan_flat_dt - scan flattened tree blob and call callback on each.
> * @it: callback function
> @@ -123,38 +193,7 @@ unsigned long __init of_get_flat_dt_root(void)
> void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
> unsigned long *size)
> {
> - unsigned long p = node;
> -
> - do {
> - u32 tag = be32_to_cpup((__be32 *)p);
> - u32 sz, noff;
> - const char *nstr;
> -
> - p += 4;
> - if (tag == OF_DT_NOP)
> - continue;
> - if (tag != OF_DT_PROP)
> - return NULL;
> -
> - sz = be32_to_cpup((__be32 *)p);
> - noff = be32_to_cpup((__be32 *)(p + 4));
> - p += 8;
> - if (be32_to_cpu(initial_boot_params->version) < 0x10)
> - p = ALIGN(p, sz >= 8 ? 8 : 4);
> -
> - nstr = find_flat_dt_string(noff);
> - if (nstr == NULL) {
> - pr_warning("Can't find property index name !\n");
> - return NULL;
> - }
> - if (strcmp(name, nstr) == 0) {
> - if (size)
> - *size = sz;
> - return (void *)p;
> - }
> - p += sz;
> - p = ALIGN(p, 4);
> - } while (1);
> + return of_fdt_get_property(initial_boot_params, node, name, size);
> }
>
> /**
> @@ -164,21 +203,7 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
> */
> int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
> {
> - const char *cp;
> - unsigned long cplen, l;
> -
> - cp = of_get_flat_dt_prop(node, "compatible", &cplen);
> - if (cp == NULL)
> - return 0;
> - while (cplen > 0) {
> - if (of_compat_cmp(cp, compat, strlen(compat)) == 0)
> - return 1;
> - l = strlen(cp) + 1;
> - cp += l;
> - cplen -= l;
> - }
> -
> - return 0;
> + return of_fdt_is_compatible(initial_boot_params, node, compat);
> }
>
> static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
> @@ -303,7 +328,7 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
> if (be32_to_cpu(initial_boot_params->version) < 0x10)
> *p = ALIGN(*p, sz >= 8 ? 8 : 4);
>
> - pname = find_flat_dt_string(noff);
> + pname = of_fdt_get_string(initial_boot_params, noff);
> if (pname == NULL) {
> pr_info("Can't find property name in list !\n");
> break;
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index 7bbf5b3..70c5b73 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -58,6 +58,17 @@ struct boot_param_header {
> };
>
> #if defined(CONFIG_OF_FLATTREE)
> +
> +/* For scanning an arbitrary device-tree at any time */
> +extern char *of_fdt_get_string(struct boot_param_header *blob, u32 offset);
> +extern void *of_fdt_get_property(struct boot_param_header *blob,
> + unsigned long node,
> + const char *name,
> + unsigned long *size);
> +extern int of_fdt_is_compatible(struct boot_param_header *blob,
> + unsigned long node,
> + const char *compat);
> +
> /* TBD: Temporary export of fdt globals - remove when code fully merged */
> extern int __initdata dt_root_addr_cells;
> extern int __initdata dt_root_size_cells;
> --
> 1.5.6.6
>
>
>
> This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
>
>
^ permalink raw reply
* Re: [PATCH 5/7] fdt.c: Refactor unflatten_dt_node
From: Grant Likely @ 2010-12-30 0:35 UTC (permalink / raw)
To: Stephen Neuendorffer
Cc: dirk.brandewie, microblaze-uclinux, devicetree-discuss,
linuxppc-dev
In-Reply-To: <e5face75-4978-4686-9d75-d92fa9ec7328@VA3EHSMHS013.ehs.local>
On Thu, Nov 18, 2010 at 03:55:00PM -0800, Stephen Neuendorffer wrote:
> unflatten_dt_node is a helper function that does most of the work to
> convert a device tree blob into tree of device nodes. This code
> now uses a passed-in blob instead of using the single boot-time blob,
> allowing it to be called in more contexts.
>
> Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Merged, thanks.
g.
>
> ---
>
> V2: don't reorder
> blob argument first.
> ---
> drivers/of/fdt.c | 27 ++++++++++++++++-----------
> 1 files changed, 16 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 190e26c..a07fd1a 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -206,7 +206,7 @@ int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
> return of_fdt_is_compatible(initial_boot_params, node, compat);
> }
>
> -static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
> +static void *unflatten_dt_alloc(unsigned long *mem, unsigned long size,
> unsigned long align)
> {
> void *res;
> @@ -220,16 +220,18 @@ static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
>
> /**
> * unflatten_dt_node - Alloc and populate a device_node from the flat tree
> + * @blob: The parent device tree blob
> * @p: pointer to node in flat tree
> * @dad: Parent struct device_node
> * @allnextpp: pointer to ->allnext from last allocated device_node
> * @fpsize: Size of the node path up at the current depth.
> */
> -unsigned long __init unflatten_dt_node(unsigned long mem,
> - unsigned long *p,
> - struct device_node *dad,
> - struct device_node ***allnextpp,
> - unsigned long fpsize)
> +unsigned long unflatten_dt_node(struct boot_param_header *blob,
> + unsigned long mem,
> + unsigned long *p,
> + struct device_node *dad,
> + struct device_node ***allnextpp,
> + unsigned long fpsize)
> {
> struct device_node *np;
> struct property *pp, **prev_pp = NULL;
> @@ -325,10 +327,10 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
> sz = be32_to_cpup((__be32 *)(*p));
> noff = be32_to_cpup((__be32 *)((*p) + 4));
> *p += 8;
> - if (be32_to_cpu(initial_boot_params->version) < 0x10)
> + if (be32_to_cpu(blob->version) < 0x10)
> *p = ALIGN(*p, sz >= 8 ? 8 : 4);
>
> - pname = of_fdt_get_string(initial_boot_params, noff);
> + pname = of_fdt_get_string(blob, noff);
> if (pname == NULL) {
> pr_info("Can't find property name in list !\n");
> break;
> @@ -407,7 +409,8 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
> if (tag == OF_DT_NOP)
> *p += 4;
> else
> - mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);
> + mem = unflatten_dt_node(blob, mem, p, np, allnextpp,
> + fpsize);
> tag = be32_to_cpup((__be32 *)(*p));
> }
> if (tag != OF_DT_END_NODE) {
> @@ -599,7 +602,8 @@ void __init unflatten_device_tree(void)
> /* First pass, scan for size */
> start = ((unsigned long)initial_boot_params) +
> be32_to_cpu(initial_boot_params->off_dt_struct);
> - size = unflatten_dt_node(0, &start, NULL, NULL, 0);
> + size = unflatten_dt_node(initial_boot_params, 0, &start,
> + NULL, NULL, 0);
> size = (size | 3) + 1;
>
> pr_debug(" size is %lx, allocating...\n", size);
> @@ -616,7 +620,8 @@ void __init unflatten_device_tree(void)
> /* Second pass, do actual unflattening */
> start = ((unsigned long)initial_boot_params) +
> be32_to_cpu(initial_boot_params->off_dt_struct);
> - unflatten_dt_node(mem, &start, NULL, &allnextp, 0);
> + unflatten_dt_node(initial_boot_params, mem, &start,
> + NULL, &allnextp, 0);
> if (be32_to_cpup((__be32 *)start) != OF_DT_END)
> pr_warning("Weird tag at end of tree: %08x\n", *((u32 *)start));
> if (be32_to_cpu(((__be32 *)mem)[size / 4]) != 0xdeadbeef)
> --
> 1.5.6.6
>
>
>
> This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
>
>
^ permalink raw reply
* Re: [PATCH 6/7] fdt.c: Reorder unflatten_dt_node
From: Grant Likely @ 2010-12-30 0:36 UTC (permalink / raw)
To: Stephen Neuendorffer
Cc: dirk.brandewie, microblaze-uclinux, devicetree-discuss,
linuxppc-dev
In-Reply-To: <972516c0-f170-469f-937f-bfa6be8dd04a@SG2EHSMHS004.ehs.local>
On Thu, Nov 18, 2010 at 03:55:01PM -0800, Stephen Neuendorffer wrote:
> Move unflatten_dt_node to be grouped with non-__init functions.
>
> Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Merged, thanks.
g.
> ---
> drivers/of/fdt.c | 218 +++++++++++++++++++++++++++---------------------------
> 1 files changed, 109 insertions(+), 109 deletions(-)
>
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index a07fd1a..236a8c9 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -97,115 +97,6 @@ int of_fdt_is_compatible(struct boot_param_header *blob,
> return 0;
> }
>
> -/* Everything below here references initial_boot_params directly. */
> -int __initdata dt_root_addr_cells;
> -int __initdata dt_root_size_cells;
> -
> -struct boot_param_header *initial_boot_params;
> -
> -#ifdef CONFIG_EARLY_FLATTREE
> -
> -/**
> - * of_scan_flat_dt - scan flattened tree blob and call callback on each.
> - * @it: callback function
> - * @data: context data pointer
> - *
> - * This function is used to scan the flattened device-tree, it is
> - * used to extract the memory information at boot before we can
> - * unflatten the tree
> - */
> -int __init of_scan_flat_dt(int (*it)(unsigned long node,
> - const char *uname, int depth,
> - void *data),
> - void *data)
> -{
> - unsigned long p = ((unsigned long)initial_boot_params) +
> - be32_to_cpu(initial_boot_params->off_dt_struct);
> - int rc = 0;
> - int depth = -1;
> -
> - do {
> - u32 tag = be32_to_cpup((__be32 *)p);
> - char *pathp;
> -
> - p += 4;
> - if (tag == OF_DT_END_NODE) {
> - depth--;
> - continue;
> - }
> - if (tag == OF_DT_NOP)
> - continue;
> - if (tag == OF_DT_END)
> - break;
> - if (tag == OF_DT_PROP) {
> - u32 sz = be32_to_cpup((__be32 *)p);
> - p += 8;
> - if (be32_to_cpu(initial_boot_params->version) < 0x10)
> - p = ALIGN(p, sz >= 8 ? 8 : 4);
> - p += sz;
> - p = ALIGN(p, 4);
> - continue;
> - }
> - if (tag != OF_DT_BEGIN_NODE) {
> - pr_err("Invalid tag %x in flat device tree!\n", tag);
> - return -EINVAL;
> - }
> - depth++;
> - pathp = (char *)p;
> - p = ALIGN(p + strlen(pathp) + 1, 4);
> - 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);
> -
> - return rc;
> -}
> -
> -/**
> - * of_get_flat_dt_root - find the root node in the flat blob
> - */
> -unsigned long __init of_get_flat_dt_root(void)
> -{
> - unsigned long p = ((unsigned long)initial_boot_params) +
> - be32_to_cpu(initial_boot_params->off_dt_struct);
> -
> - while (be32_to_cpup((__be32 *)p) == OF_DT_NOP)
> - p += 4;
> - BUG_ON(be32_to_cpup((__be32 *)p) != OF_DT_BEGIN_NODE);
> - p += 4;
> - return ALIGN(p + strlen((char *)p) + 1, 4);
> -}
> -
> -/**
> - * of_get_flat_dt_prop - Given a node in the flat blob, return the property ptr
> - *
> - * This function can be used within scan_flattened_dt callback to get
> - * access to properties
> - */
> -void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
> - unsigned long *size)
> -{
> - return of_fdt_get_property(initial_boot_params, node, name, size);
> -}
> -
> -/**
> - * of_flat_dt_is_compatible - Return true if given node has compat in compatible list
> - * @node: node to test
> - * @compat: compatible string to compare with compatible list.
> - */
> -int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
> -{
> - return of_fdt_is_compatible(initial_boot_params, node, compat);
> -}
> -
> static void *unflatten_dt_alloc(unsigned long *mem, unsigned long size,
> unsigned long align)
> {
> @@ -421,6 +312,115 @@ unsigned long unflatten_dt_node(struct boot_param_header *blob,
> return mem;
> }
>
> +/* Everything below here references initial_boot_params directly. */
> +int __initdata dt_root_addr_cells;
> +int __initdata dt_root_size_cells;
> +
> +struct boot_param_header *initial_boot_params;
> +
> +#ifdef CONFIG_EARLY_FLATTREE
> +
> +/**
> + * of_scan_flat_dt - scan flattened tree blob and call callback on each.
> + * @it: callback function
> + * @data: context data pointer
> + *
> + * This function is used to scan the flattened device-tree, it is
> + * used to extract the memory information at boot before we can
> + * unflatten the tree
> + */
> +int __init of_scan_flat_dt(int (*it)(unsigned long node,
> + const char *uname, int depth,
> + void *data),
> + void *data)
> +{
> + unsigned long p = ((unsigned long)initial_boot_params) +
> + be32_to_cpu(initial_boot_params->off_dt_struct);
> + int rc = 0;
> + int depth = -1;
> +
> + do {
> + u32 tag = be32_to_cpup((__be32 *)p);
> + char *pathp;
> +
> + p += 4;
> + if (tag == OF_DT_END_NODE) {
> + depth--;
> + continue;
> + }
> + if (tag == OF_DT_NOP)
> + continue;
> + if (tag == OF_DT_END)
> + break;
> + if (tag == OF_DT_PROP) {
> + u32 sz = be32_to_cpup((__be32 *)p);
> + p += 8;
> + if (be32_to_cpu(initial_boot_params->version) < 0x10)
> + p = ALIGN(p, sz >= 8 ? 8 : 4);
> + p += sz;
> + p = ALIGN(p, 4);
> + continue;
> + }
> + if (tag != OF_DT_BEGIN_NODE) {
> + pr_err("Invalid tag %x in flat device tree!\n", tag);
> + return -EINVAL;
> + }
> + depth++;
> + pathp = (char *)p;
> + p = ALIGN(p + strlen(pathp) + 1, 4);
> + 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);
> +
> + return rc;
> +}
> +
> +/**
> + * of_get_flat_dt_root - find the root node in the flat blob
> + */
> +unsigned long __init of_get_flat_dt_root(void)
> +{
> + unsigned long p = ((unsigned long)initial_boot_params) +
> + be32_to_cpu(initial_boot_params->off_dt_struct);
> +
> + while (be32_to_cpup((__be32 *)p) == OF_DT_NOP)
> + p += 4;
> + BUG_ON(be32_to_cpup((__be32 *)p) != OF_DT_BEGIN_NODE);
> + p += 4;
> + return ALIGN(p + strlen((char *)p) + 1, 4);
> +}
> +
> +/**
> + * of_get_flat_dt_prop - Given a node in the flat blob, return the property ptr
> + *
> + * This function can be used within scan_flattened_dt callback to get
> + * access to properties
> + */
> +void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
> + unsigned long *size)
> +{
> + return of_fdt_get_property(initial_boot_params, node, name, size);
> +}
> +
> +/**
> + * of_flat_dt_is_compatible - Return true if given node has compat in compatible list
> + * @node: node to test
> + * @compat: compatible string to compare with compatible list.
> + */
> +int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
> +{
> + return of_fdt_is_compatible(initial_boot_params, node, compat);
> +}
> +
> #ifdef CONFIG_BLK_DEV_INITRD
> /**
> * early_init_dt_check_for_initrd - Decode initrd location from flat tree
> --
> 1.5.6.6
>
>
>
> This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
>
>
^ 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