* Re: faulty 64-bit resource printk fixup in macio_asic.c
From: Benjamin Herrenschmidt @ 2006-07-01 23:16 UTC (permalink / raw)
To: Paul Collins; +Cc: linuxppc-dev, Greg Kroah-Hartman, linux-kernel
In-Reply-To: <878xndqwph.fsf@briny.internal.ondioline.org>
On Sat, 2006-07-01 at 23:30 +1000, Paul Collins wrote:
> Hi Greg,
>
> The patch titled "64bit resource: fix up printks for resources in misc
> drivers", committed as e29419fffceb8ec36def3c922040e1ca7bcd3de5 in
> Linus's tree, causes my PowerBook to Oops early in boot and udev to
> not function.
For now, I'd suggest reverting it. The MacIO resources always fit in 32
bits, thus we can "use" that knowledge here and only print 8 digits.
Ben.
> Unable to handle kernel paging request for data at address 0x6f000000
> Faulting instruction address: 0xc00c901c
> Oops: Kernel access of bad area, sig: 11 [#1]
> PREEMPT
> Modules linked in:
> NIP: C00C901C LR: C00C901C CTR: C00C8F78
> REGS: efed5db0 TRAP: 0300 Not tainted (2.6.17-g9262e914)
> MSR: 00009032 <EE,ME,IR,DR> CR: 22000484 XER: 20000000
> DAR: 6F000000, DSISR: 40000000
> TASK = efe97240[378] 'udevtrigger' THREAD: efed4000
> GPR00: C00C901C EFED5E60 EFE97240 00000000 CFC0BB40 00010001 CFC0BB40 C02E9754
> GPR08: 00000000 00000001 EFFE8EA4 EFED4000 44000428 1001D140 100D0000 100D0000
> GPR16: 00000000 100EBF08 100D0000 100B0000 100D0000 100B0000 100EBEA8 100EC068
> GPR24: 00000000 EFEEDA20 C0DF7880 EFED4000 CFC0BB40 EFEEDA20 C0DF78D0 6F000000
> NIP [C00C901C] sysfs_open_file+0xa4/0x284
> LR [C00C901C] sysfs_open_file+0xa4/0x284
> Call Trace:
> [EFED5E60] [C00C901C] sysfs_open_file+0xa4/0x284 (unreliable)
> [EFED5E90] [C007D6A8] __dentry_open+0x108/0x2a4
> [EFED5EC0] [C007D988] do_filp_open+0x5c/0x78
> [EFED5F20] [C007D9FC] do_sys_open+0x58/0xf8
> [EFED5F40] [C000FDB8] ret_from_syscall+0x0/0x38
> --- Exception: c01 at 0xff248d8
> LR = 0xffb525c
> Instruction dump:
> 3be0ffea 812b0050 83c90014 419e007c 2f9e0000 419e006c 83fe0004 2f9f0000
> 419e0080 38600001 4bf5b229 4809726d <801f0000> 3ba00000 2f800002 419e0024
> <6>note: udevtrigger[378] exited with preempt_count 1
>
>
> The only hunk of that commit affecting my configuration is this one,
> which when reverted lets my machine work again.
>
> diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
> index 431bd37..c687ac7 100644
> --- a/drivers/macintosh/macio_asic.c
> +++ b/drivers/macintosh/macio_asic.c
> @@ -428,10 +428,10 @@ #endif
>
> /* MacIO itself has a different reg, we use it's PCI base */
> if (np == chip->of_node) {
> - sprintf(dev->ofdev.dev.bus_id, "%1d.%08lx:%.*s",
> + sprintf(dev->ofdev.dev.bus_id, "%1d.%016llx:%.*s",
> chip->lbus.index,
> #ifdef CONFIG_PCI
> - pci_resource_start(chip->lbus.pdev, 0),
> + (unsigned long long)pci_resource_start(chip->lbus.pdev, 0),
> #else
> 0, /* NuBus may want to do something better here */
> #endif
>
>
> When applied, this hunk yields
>
> /* MacIO itself has a different reg, we use it's PCI base */
> if (np == chip->of_node) {
> sprintf(dev->ofdev.dev.bus_id, "%1d.%016llx:%.*s",
> chip->lbus.index,
> #ifdef CONFIG_PCI
> (unsigned long long)pci_resource_start(chip->lbus.pdev, 0),
> #else
> 0, /* NuBus may want to do something better here */
> #endif
> MAX_NODE_NAME_SIZE, np->name);
>
>
> Since dev->ofdev.dev is a struct device, bus_id is 20 bytes, of which
> 19 are consumed by "%1d.%016llx:". But the field width used by "%.*s"
> is MAX_NODE_NAME_SIZE, which is 8.
>
> drivers/macintosh/macio_asic.c:36:#define MAX_NODE_NAME_SIZE (BUS_ID_SIZE - 12)
>
> So I think the sprintf overflows bus_id and clobbers the next few
> bytes of struct device.
>
> I'm not sure what the right thing to do is. Making bus_id bigger will
> cost everyone, but right now with bus_id at 20 bytes, there's no room
> after the colon for any of np->name.
>
^ permalink raw reply
* [0/5][POWERPC] boot: create zImage.kexec #2
From: Milton Miller @ 2006-07-01 23:46 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Sam Ravnborg
What follows is a series of 5 patches that take the existing zImge code
from the arch/powerpc/boot directory and add an alternative image that
will boot with a device tree struct but not with a prom interface
callback.
It searches the flat device tree (read-only) to find the
memory size, reserved ranges, and rtas. Messages are sent through
rtas to eiher the new for cell put-term-char or display-character
interfaces.
Status: I changed more of the makefile to if_changed_dep. I updated
the rules to not do if_changed and cmd when changing the same file.
Patches 4 and 5 have been rediffed and __ENTRY__ and __BASE__ are now
caps instead of lowercase in patch 5.
Unfornately I could not get my test and build machines talking due
to network problems, and thereefore was unable to regression test
the output. Therefore the state is still 'it worked before I moved
code among the files' and 'display-character untested'.
Without [KBUILD] allow any PHONY in if_changed_dep it causes all
the files in boot to be built each time, unless we do some alternative,
either make COPYHEADERS a real dummy that we touch if it doesn't
exist, or just say rebuild all sources when any .h in the kernel
tree changes and collapse the dependency.
Its this fragment:
+$(obj-boot): COPYHEADERS
+COPYHEADERS: $(addprefix $(obj)/,$(linuxheader) $(zlibheader))
+PHONY += COPYHEADERS
[1/5][POWERPC] boot: prepare for zImage.kexec
I tried to keep the changes to main.c and prom.h minimal.
[2/5][POWERPC] boot: Add kexec callable zImage wrapper
The actual code and crt0 for this method.
[3/5][POWERPC] boot: use more Kbuild rules
I had a bit of trouble with rebuilds. This trys to get some
rules more right.
It also renames zliblinuxheader to linuxheader as the next
patch will add stringify.h to the list, and renames
OBJCOPYFLAGS to allow usage of the $(objcopy) rule.
[4/5][POWERPC] boot: Makefile and linker scripts for zImage.kexec
Delta to above and inker scripts for the existing link.
zImage.kexec is 32 bit, there is also altnernate link that
pretends to be 64 bit which allows kexec-tools to load it
without writing ompat code.
[5/5][POWERPC] boot: generate lds file from lds.S
An alterative file ploferations, generate the lds from .S using
the Kbuild rule. If you like this patch then I can avoid creating
two files that are immediately removed.
milton
^ permalink raw reply
* [1/5][POWERPC] boot: prepare for zImage.kexec
From: Milton Miller @ 2006-07-01 23:46 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Sam Ravnborg
In-Reply-To: <kexec-zImage-try2@bga.com>
This patch moves the initializations of prom variables to boot/prom.c
to allow it to be replaced for kexec. Kexec does not care about
the stdout handle, but will care about the location of the device
tree and will search for RTAS.
It also checks if we stop trying to claim so that we print an error
instead of storing to address -1.
Signed-off-by: Milton Miller <miltonm@bga.com>
Index: kernel/arch/powerpc/boot/main.c
===================================================================
--- kernel.orig/arch/powerpc/boot/main.c 2006-06-29 02:14:51.347560058 -0500
+++ kernel/arch/powerpc/boot/main.c 2006-06-29 02:14:57.344543429 -0500
@@ -17,14 +17,12 @@
#include "prom.h"
#include "zlib.h"
-extern void flush_cache(void *, unsigned long);
-
-
/* Value picked to match that used by yaboot */
#define PROG_START 0x01400000 /* only used on 64-bit systems */
-#define RAM_END (512<<20) /* Fixme: use OF */
#define ONE_MB 0x100000
+unsigned long ram_end; /* end of usable memory, set by init_prom */
+
extern char _start[];
extern char __bss_start[];
extern char _end[];
@@ -119,7 +117,7 @@ static unsigned long try_claim(unsigned
{
unsigned long addr = 0;
- for(; claim_base < RAM_END; claim_base += ONE_MB) {
+ for(; claim_base < ram_end; claim_base += ONE_MB) {
#ifdef DEBUG
printf(" trying: 0x%08lx\n\r", claim_base);
#endif
@@ -127,7 +125,7 @@ static unsigned long try_claim(unsigned
if ((void *)addr != (void *)-1)
break;
}
- if (addr == 0)
+ if ((addr == 0) || (void *)addr == (void *)-1)
return 0;
claim_base = PAGE_ALIGN(claim_base + size);
return addr;
@@ -211,12 +209,7 @@ void start(unsigned long a1, unsigned lo
memset(__bss_start, 0, _end - __bss_start);
- prom = (int (*)(void *)) promptr;
- chosen_handle = finddevice("/chosen");
- if (chosen_handle == (void *) -1)
- exit();
- if (getprop(chosen_handle, "stdout", &stdout, sizeof(stdout)) != 4)
- exit();
+ init_prom(a1, a2, promptr);
printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r", _start, sp);
@@ -297,6 +290,7 @@ void start(unsigned long a1, unsigned lo
vmlinux.addr += elfoffset;
flush_cache((void *)vmlinux.addr, vmlinux.size);
+ prom_smp_hook(vmlinux.addr);
kernel_entry = (kernel_entry_t)vmlinux.addr;
#ifdef DEBUG
Index: kernel/arch/powerpc/boot/prom.c
===================================================================
--- kernel.orig/arch/powerpc/boot/prom.c 2006-06-29 02:14:51.379554992 -0500
+++ kernel/arch/powerpc/boot/prom.c 2006-06-29 02:48:30.069204787 -0500
@@ -16,6 +16,22 @@ int (*prom)(void *);
phandle chosen_handle;
ihandle stdout;
+void init_prom(unsigned long a1, unsigned long a2, void *p)
+{
+ prom = (int (*)(void *)) p;
+ chosen_handle = finddevice("/chosen");
+ if (chosen_handle == (void *) -1)
+ exit();
+ if (getprop(chosen_handle, "stdout", &stdout, sizeof(stdout)) != 4)
+ exit();
+ ram_end = (512<<20); /* Fixme: use OF */
+}
+
+void prom_smp_hook(unsigned long kernel_start)
+{
+ return;
+}
+
int call_prom(const char *service, int nargs, int nret, ...)
{
int i;
Index: kernel/arch/powerpc/boot/prom.h
===================================================================
--- kernel.orig/arch/powerpc/boot/prom.h 2006-06-29 02:14:51.429547077 -0500
+++ kernel/arch/powerpc/boot/prom.h 2006-06-29 02:14:57.348542796 -0500
@@ -12,8 +12,10 @@ int call_prom(const char *service, int n
int call_prom_ret(const char *service, int nargs, int nret,
unsigned int *rets, ...);
-extern int write(void *handle, void *ptr, int nb);
-extern void *claim(unsigned long virt, unsigned long size, unsigned long aln);
+void init_prom(unsigned long a1, unsigned long a2, void *p);
+void prom_smp_hook(unsigned long kernel_start);
+int write(void *handle, void *ptr, int nb);
+void *claim(unsigned long virt, unsigned long size, unsigned long aln);
static inline void exit(void)
{
@@ -31,4 +33,9 @@ static inline int getprop(void *phandle,
return call_prom("getprop", 4, 1, phandle, name, buf, buflen);
}
+
+extern unsigned long ram_end; /* end of usable memory */
+
+extern void flush_cache(void *, unsigned long);
+
#endif /* _PPC_BOOT_PROM_H_ */
^ permalink raw reply
* [2/5][POWERPC] boot: Add kexec callable zImage wrapper
From: Milton Miller @ 2006-07-01 23:46 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Sam Ravnborg
In-Reply-To: <kexec-zImage-try2@bga.com>
This code creates a 32 bit zImage wrapper for a 32 or 64 bit PowerPC
Linux kernel. It does not support initrd at present. What it does
give you is a compressed kernel image that is expanded when used.
Limitations:
The memory node off the root with a name starting with "memory" must
contain enough free memory (not in the reserved ranges) in the first
reg range to uncompress the the kenrel with padding.
The claim allocator does not record its handouts.
Signed-off-by: Milton Miller <miltonm@bga.com>
Index: kernel/arch/powerpc/boot/kexec.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ kernel/arch/powerpc/boot/kexec.c 2006-06-29 03:47:06.865856735 -0500
@@ -0,0 +1,476 @@
+/*
+ * Copyright (C) 1997 Paul Mackerras 1997.
+ * Copyright (C) 2006 Milton Miller, IBM Corportation.
+ * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corportation.
+ *
+ * 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 <stdarg.h>
+#include <stddef.h>
+#include "string.h"
+#include "stdio.h"
+#include "prom.h"
+#include "page.h"
+#include "dt.h"
+#include "stringify.h"
+
+#define BUG_ON(x) if (x) { printf("zImage BUG %s\n\r", __stringify(x)); exit();}
+
+extern unsigned int gohere; /* slaves poll and branch when told */
+
+int (*prom)(void *);
+phandle chosen_handle;
+ihandle stdout;
+
+#define MAX_MEM 0x80000000
+static unsigned int memsize;
+static unsigned int na=2, ns=1;
+
+
+static struct boot_param_header *initial_boot_params;
+
+static int (*rtas)(void *, void *);
+static void *rtas_data;
+static int rtas_put_term_char;
+static int rtas_display_char;
+
+int call_rtas(int token, int nargs, int nret, ...)
+{
+ int i;
+ struct rtas_args {
+ int token;
+ int nargs;
+ int nret;
+ unsigned int args[12];
+ } args;
+ va_list list;
+
+ if (!rtas || !token)
+ return -1; /* Hardware error */
+ if (nargs + nret > 12)
+ return -1; /* Hardware error */
+
+ args.token = token;
+ args.nargs = nargs;
+ args.nret = nret;
+
+ va_start(list, nret);
+ for (i = 0; i < nargs; i++)
+ args.args[i] = va_arg(list, unsigned int);
+ va_end(list);
+
+ for (i = 0; i < nret; i++)
+ args.args[nargs+i] = 0;
+
+ rtas(&args, rtas_data);
+
+ return args.args[nargs];
+}
+
+
+int write(void *handle, void *ptr, int nb)
+{
+ int i=0;
+ int err;
+ char *p;
+
+ p = ptr;
+ err = 0;
+
+ if (rtas_put_term_char)
+ for (; i < nb && !err; i++)
+ err = call_rtas(rtas_put_term_char, 1, 1, p[i]);
+#if 0
+ /* not tested, doesn't check line limits, do we care? */
+ else if (rtas_display_char)
+ for (; i < nb && !err; i++)
+ err = call_rtas(rtas_put_term_char, 1, 1, p[i]);
+#endif
+
+ return i-1;
+}
+
+
+/* returns true if s2 is a prefix of s1 */
+static int string_match(const char *s1, const char *s2)
+{
+ for (; *s2; ++s2)
+ if (*s1++ != *s2)
+ return 0;
+ return 1;
+}
+
+
+/* return -1 on fail, address on success */
+void *claim(unsigned long virt, unsigned long size, unsigned long align)
+{
+
+ unsigned long al = align ? align : 1;
+ unsigned long try = _ALIGN_UP(virt, al);
+ unsigned int *r;
+
+#if 0 /* Debug */
+
+ printf("claim: request %lx size %lx align %lx, aligned %p ",
+ virt, size, align, (void *)try);
+
+
+#define BUSY(s) printf("%s\n\r", s), ((void *)(-1))
+#define RANGE_PRINT printf("range %08x %08x ",r[1], r[3]);
+#define RANGE_CLEAR printf("is clear\n\r");
+#else
+#define BUSY(s) ((void *)(-1))
+#define RANGE_PRINT do {} while(0)
+#define RANGE_CLEAR do {} while(0)
+#endif
+
+
+ if (try + size < try)
+ return BUSY("wraps");
+
+ if (memsize && try + size > memsize)
+ return BUSY("overflows");
+
+ for (r = (unsigned int *)(((unsigned long)initial_boot_params)
+ + initial_boot_params->off_mem_rsvmap);
+ r[2] || r[3]; r += 4) {
+
+ if (r[0] || r[1] > try + size)
+ continue; /* starts after */
+ if (r[2] || r[1]+r[3] < r[1])
+ return BUSY("BEYOND"); /* extends beyond */
+ if (r[1] + r[3] < try)
+ continue; /* contained before */
+
+ RANGE_PRINT;
+ return BUSY("overlaps"); /* overlaps */
+ }
+
+ /*
+ * XXX: Fixme: we should keep track here and not hand out the
+ * same address again.
+ */
+
+ RANGE_CLEAR;
+ return (void *)(try);
+}
+
+
+
+/* code lifted from arch/powerpc/kernel/prom.c */
+
+static inline char *find_flat_dt_string(u32 offset)
+{
+ return ((char *)initial_boot_params) +
+ initial_boot_params->off_dt_strings + offset;
+}
+
+/**
+ * This function is used to scan the flattened device-tree, it is
+ * used to extract the memory informations at boot before we can
+ * unflatten the tree
+ */
+int 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) +
+ initial_boot_params->off_dt_struct;
+ int rc = 0;
+ int depth = -1;
+
+ do {
+ u32 tag = *((u32 *)p);
+ char *pathp;
+
+ p += 4;
+ if (tag == OF_DT_END_NODE) {
+ depth --;
+ continue;
+ }
+ if (tag == OF_DT_NOP)
+ continue;
+ if (tag == OF_DT_END)
+ break;
+ if (tag == OF_DT_PROP) {
+ u32 sz = *((u32 *)p);
+ p += 8;
+ if (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) {
+ printf("Invalid tag %x scanning flattened"
+ " device tree !\n\r", tag);
+ return -1;
+ }
+ 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;
+}
+
+unsigned long of_get_flat_dt_root(void)
+{
+ unsigned long p = ((unsigned long)initial_boot_params) +
+ initial_boot_params->off_dt_struct;
+
+ while(*((u32 *)p) == OF_DT_NOP)
+ p += 4;
+ BUG_ON (*((u32 *)p) != OF_DT_BEGIN_NODE);
+ p += 4;
+ return _ALIGN(p + strlen((char *)p) + 1, 4);
+}
+
+/**
+ * This function can be used within scan_flattened_dt callback to get
+ * access to properties
+ */
+void* of_get_flat_dt_prop(unsigned long node, const char *name,
+ unsigned long *size)
+{
+ unsigned long p = node;
+
+ do {
+ u32 tag = *((u32 *)p);
+ u32 sz, noff;
+ const char *nstr;
+
+ p += 4;
+ if (tag == OF_DT_NOP)
+ continue;
+ if (tag != OF_DT_PROP)
+ return NULL;
+
+ sz = *((u32 *)p);
+ noff = *((u32 *)(p + 4));
+ p += 8;
+ if (initial_boot_params->version < 0x10)
+ p = _ALIGN(p, sz >= 8 ? 8 : 4);
+
+ nstr = find_flat_dt_string(noff);
+ if (nstr == NULL) {
+ printf("Can't find property index"
+ " name !\n\r");
+ return NULL;
+ }
+ if (strcmp(name, nstr) == 0) {
+ if (size)
+ *size = sz;
+ return (void *)p;
+ }
+ p += sz;
+ p = _ALIGN(p, 4);
+ } while(1);
+}
+
+/* end code lifted from arch/powerpc/kernel/prom.c */
+
+
+/* This only handles device nodes directly off of the root node
+ * and will return on any partial name match
+ */
+static int match_device_node(unsigned long node, const char *uname,
+ int depth, void *data)
+{
+ if (depth == 1 && string_match(uname, data))
+ return node;
+ return 0;
+}
+
+/* Find Real Memory (offset) region. The first reg, size pair of the
+ * memory node defines the memory that is accessable in real mode on
+ * PPC64 LPAR systems. Assume that will be enough everywhere.
+ */
+static int find_rmo(unsigned long node, const char *uname, int depth,
+ void *data)
+{
+ if (match_device_node(node, uname, depth, data)) {
+ unsigned long size;
+ unsigned int *reg;
+ int i;
+
+ reg = of_get_flat_dt_prop(node, "reg", &size);
+ if (!reg || (size < (na + ns)*4)) {
+ printf("Warning: Can't parse reg property on %s\n\r",
+ uname);
+ return 0;
+ }
+
+ /* ignore if not address 0 */
+ for (i=0; i < na; i++)
+ if (reg[i])
+ return 0;
+
+ /* if more than 1 cell then MAX_MEM */
+ for (i=0; i < ns-1; i++)
+ if (reg[na+i])
+ return MAX_MEM;
+
+ /* else return size of first reg */
+ return reg[na+i];
+ }
+
+ return 0;
+}
+
+/* dummy prom that recognises the services used by elsewhere */
+int call_prom(const char *service, int nargs, int nret, ...)
+{
+ va_list list;
+
+ if (string_match(service, "finddevice")) {
+ char *path;
+
+ if ((nargs != 1) || (nret != 1)) {
+ printf("finddevice: unexpected arg counts %d %d\n\r",
+ nargs, nret);
+ return -1;
+ }
+ va_start(list, nret);
+ path = (void *)va_arg(list, unsigned int);
+ va_end(list);
+
+ if (path[0] == '/')
+ path++;
+
+ return (int) of_scan_flat_dt(match_device_node, path);
+
+ } else if (string_match(service, "getprop")) {
+ unsigned long node;
+ char *prop;
+ char *buf;
+ unsigned int len;
+ va_list list;
+ char *ret;
+ unsigned long size;
+
+ if ((nargs != 4) || (nret != 1)) {
+ printf("getprop: unexpected arg counts %d %d\n\r",
+ nargs, nret);
+ return -1;
+ }
+
+ va_start(list, nret);
+ node = va_arg(list, unsigned int);
+ prop = (void *)va_arg(list, unsigned int);
+ buf = (void *)va_arg(list, unsigned int);
+ len = va_arg(list, unsigned int);
+ va_end(list);
+
+ ret = of_get_flat_dt_prop(node, prop, &size);
+ if (ret) {
+ memcpy(buf, ret, len < size ? len : size);
+ }
+ return size;
+ } else if (!string_match(service, "exit")) {
+ printf("Unimplemented prom service %s(%d, %d) called\n\r",
+ service, nargs, nret);
+ /* fall through */
+ }
+ for(;;)
+ ; /* Forever */
+}
+
+void init_prom(unsigned long a1, unsigned long a2, void *p)
+{
+ unsigned long node;
+
+ if (p) /* this version doesn't support a prom interface */
+ exit();
+
+ initial_boot_params = (void *) a1;
+
+ BUG_ON(initial_boot_params->magic != OF_DT_HEADER);
+ BUG_ON(initial_boot_params->last_comp_version > 0x10);
+
+ chosen_handle = finddevice("/chosen");
+ if (chosen_handle == (void *) -1)
+ exit();
+
+ node = of_scan_flat_dt(match_device_node, "rtas");
+
+ if (node) {
+ unsigned int *p;
+ p = of_get_flat_dt_prop(node,
+ "linux,rtas-base", NULL);
+ if (p)
+ rtas_data = (void *)*p;
+ p = of_get_flat_dt_prop(node,
+ "linux,rtas-entry", NULL);
+ if (p)
+ rtas = (void *)*p;
+ p = of_get_flat_dt_prop(node,
+ "put-term-char", NULL);
+ if (p)
+ rtas_put_term_char = *p;
+ p = of_get_flat_dt_prop(node,
+ "display-character", NULL);
+ if (p)
+ rtas_display_char = *p;
+ }
+
+ node = of_get_flat_dt_root();
+ if (node) {
+ unsigned long tmp;
+ void *p;
+
+ p = of_get_flat_dt_prop(node, "#addr-cells", &tmp);
+ if (tmp == 4)
+ na = *(int *)p;
+ else
+ printf("Warning, could't find or parse #addr-cells\n\r");
+ p = of_get_flat_dt_prop(node, "#size-cells", &tmp);
+ if (tmp == 4)
+ ns = *(int *)p;
+ else
+ printf("Warning, could't find or parse #size-cells\n\r");
+ }
+
+ memsize = of_scan_flat_dt(find_rmo, "memory");
+
+ if (!memsize)
+ BUG_ON("Couldn't find RMO memory size\n\r");
+
+ if (memsize > MAX_MEM)
+ memsize = MAX_MEM;
+
+ printf("Can use %x bytes of memory in RMO\n\r", memsize);
+
+ ram_end = memsize;
+}
+
+/*
+ * Kexec smp hook:
+ * copy 0x100 bytes from the kernel entry point down to address zero,
+ * flush, then tell any slaves to branch down to address 0x60.
+ */
+void prom_smp_hook(unsigned long kernel_start)
+{
+ char *kern = (char *)kernel_start;
+ char *zero = (char *)0;
+
+ memcpy(zero, kern, 0x100);
+ flush_cache(zero, 0x100);
+
+ gohere = 0x60;
+}
Index: kernel/arch/powerpc/boot/crt0_kexec.S
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ kernel/arch/powerpc/boot/crt0_kexec.S 2006-06-29 03:47:06.868856261 -0500
@@ -0,0 +1,156 @@
+/*
+ * Copyright (C) 1997 Paul Mackerras.
+ * Copyright (C) 2006 Milton Miller, IBM Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * NOTE: This code runs in 32 bit mode and is linked as ELF32.
+ * It will switch from 64 to 32 bit mode with some assumptions.
+ */
+
+#include "ppc_asm.h"
+
+ .text
+ /* This is the actual "entry" point as mentioned in the headers.
+ * It is this code that should be copied down to zero.
+ * This code must be loaded above 0x100 or the slaves will
+ * crash when we copy the kernels entry point down.
+ */
+ .globl master
+master:
+ /* Work out the offset between the address we were linked at
+ * and the address where we're running.
+ * Set 32 bit mode while we are at it.
+ */
+ bl set32
+1: mflr r0
+ lis r9,1b@ha
+ addi r9,r9,1b@l
+ subf. r0,r9,r0
+ beq 3f /* if running at same address as linked */
+
+ /* The .got2 section contains a list of addresses, so add
+ the address offset onto each entry. */
+ lis r9,__got2_start@ha
+ addi r9,r9,__got2_start@l
+ lis r8,__got2_end@ha
+ addi r8,r8,__got2_end@l
+ subf. r8,r9,r8
+ beq 3f
+ srwi. r8,r8,2
+ mtctr r8
+ add r9,r0,r9
+2: lwz r8,0(r9)
+ add r8,r8,r0
+ stw r8,0(r9)
+ addi r9,r9,4
+ bdnz 2b
+3:
+ b 3f
+
+
+
+
+ /* the slaves may be in 32 or 64 bit mode, we don't care */
+ .org master+0x60
+ .globl slave
+slave:
+ li 4,gohere-master /* read 0-relative */
+waiting:
+99: lwz r6,0(r4)
+ cmpwi 0,r6,0
+ beq 99b
+ mtctr r6
+ addi r4,r6,gohere-waiting /* read from gohere in image */
+ bctr
+
+ .global gohere
+gohere: .long 0 # when set the slave moves
+
+
+
+flushit:
+ /* Do a cache flush for our text, in case OF didn't */
+3: lis r9,_start@ha
+ addi r9,r9,_start@l
+ add r9,r0,r9
+ lis r8,_etext@ha
+ addi r8,r8,_etext@l
+ add r8,r0,r8
+4: dcbf r0,r9
+ icbi r0,r9
+ addi r9,r9,0x20
+ cmplw cr0,r9,r8
+ blt 4b
+ sync
+ isync
+
+ /* fill out a stack for c code */
+ lis r1,__stack_end@ha
+ addi r1,r1,__stack_end@l
+ add r1,r1,r0
+ stwu r5,-16(r1) /* r5 should be 0 */
+
+ /* tell slave to come to our copy */
+ lis r8,waiting@ha
+ addi r8,r8,waiting@l
+ add r8,r8,r0
+ stw r8,gohere-master(0)
+
+ mr r6,r1
+ b start
+
+
+ /*
+ * Check if the processor is running in 32 bit mode, using
+ * only 32 bit instructions which should be safe on 32 and
+ * 64 bit processors.
+ *
+ * The caller is assuming that the lr is used to return.
+ */
+set32: mfmsr r0 /* grab whole msr */
+ rlwinm r6,r0,0,0,31 /* extract bottom word */
+ subf. r6,r6,r0 /* subtract, same? */
+ beqlr /* yes: we are 32 bit mode */
+
+ /* Since the compare found other bits, we must be in 64 bit mode
+ * on a 64 bit processor. Since MSR[SF] is in the bits we masked
+ * off the compare will always fail in 64 bit mode, and will alway
+ * be equal in 32 bit mode (the size of the implicit compare).
+ *
+ * This program must run in 32 bit mode, so switch now.
+ * Assume we are actually running in low 32 bits of memory space,
+ * so we can just turn off MSR[SF] which is bit 0.
+ */
+ .machine push
+ .machine "ppc64"
+ rldicl r0,r0,0,1
+ sync
+ mtmsrd r0
+ isync
+ .machine pop
+ blr
+
+ .org master+0x100 /* make sure we don't go backwards */
+
+
+ /* this code needs a stack allocated in the image */
+ .section .stack,"aw",@nobits
+ .space 4096
+
+ .data
+
+ /* a procedure descriptor used when pretending to be elf64_powerpc */
+ .balign 8
+ .global _master64
+_master64:
+ .long 0, master /* big endian, supported reloc ppc32 */
+ .quad 0, 0, 0
+
+ /* a procedure descriptor used when booting this as a COFF file */
+ .global _master_opd
+_master_opd:
+ .long master, 0, 0, 0
Index: kernel/arch/powerpc/boot/dt.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ kernel/arch/powerpc/boot/dt.h 2006-06-29 03:47:06.870855944 -0500
@@ -0,0 +1,46 @@
+#ifndef _PPC_BOOT_DT_H_
+#define _PPC_BOOT_DT_H_
+
+typedef unsigned int u32;
+
+/* Definitions used by the flattened device tree */
+#define OF_DT_HEADER 0xd00dfeed /* marker */
+#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */
+#define OF_DT_END_NODE 0x2 /* End node */
+#define OF_DT_PROP 0x3 /* Property: name off, size,
+ * content */
+#define OF_DT_NOP 0x4 /* nop */
+#define OF_DT_END 0x9
+
+#define OF_DT_VERSION 0x10
+
+/*
+ * This is what gets passed to the kernel by prom_init or kexec
+ *
+ * The dt struct contains the device tree structure, full pathes and
+ * property contents. The dt strings contain a separate block with just
+ * the strings for the property names, and is fully page aligned and
+ * self contained in a page, so that it can be kept around by the kernel,
+ * each property name appears only once in this page (cheap compression)
+ *
+ * the mem_rsvmap contains a map of reserved ranges of physical memory,
+ * passing it here instead of in the device-tree itself greatly simplifies
+ * the job of everybody. It's just a list of u64 pairs (base/size) that
+ * ends when size is 0
+ */
+struct boot_param_header
+{
+ u32 magic; /* magic word OF_DT_HEADER */
+ u32 totalsize; /* total size of DT block */
+ u32 off_dt_struct; /* offset to structure */
+ u32 off_dt_strings; /* offset to strings */
+ u32 off_mem_rsvmap; /* offset to memory reserve map */
+ u32 version; /* format version */
+ u32 last_comp_version; /* last compatible version */
+ /* version 2 fields below */
+ u32 boot_cpuid_phys; /* Physical CPU id we're booting on */
+ /* version 3 fields below */
+ u32 dt_strings_size; /* size of the DT strings block */
+};
+
+#endif /* _PPC_BOOT_DT_H_ */
^ permalink raw reply
* [3/5][POWERPC] boot: use more Kbuild rules
From: Milton Miller @ 2006-07-01 23:46 UTC (permalink / raw)
To: linuxppc-dev, Sam Ravnborg; +Cc: linux-kernel
In-Reply-To: <kexec-zImage-try2@bga.com>
Switch to if_changed_dep for bootcc, cmd for known rebuilds without deps,
and if_changed for other commands. Add FORCE for all if_changed rule uses.
Make sure targets includes all generated files.
Move clean-files to targets for if_changed files.
Rename OBJCOPYFLAGS to OBJCOPY_SEC_FLAGS so we can use $(objcopy) rule.
Rename zliblinuxheader to linuxheader
Change from explicit dependency of main and zlib files and zlib headers
to generate all headers before compiling the source. fixdep will give
us the exact headers, but not on a clean compile.
Note: the obj-sec .c files are created/touched when the content file changes.
Signed-off-by: Milton Miller <miltonm@bga.com>
Index: kernel/arch/powerpc/boot/Makefile
===================================================================
--- kernel.orig/arch/powerpc/boot/Makefile 2006-07-01 00:03:41.940189322 -0500
+++ kernel/arch/powerpc/boot/Makefile 2006-07-01 01:33:55.937370129 -0500
@@ -25,16 +25,13 @@ HOSTCC := gcc
BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \
$(shell $(CROSS32CC) -print-file-name=include) -fPIC
BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
-OBJCOPYFLAGS := contents,alloc,load,readonly,data
+OBJCOPY_SEC_FLAGS := contents,alloc,load,readonly,data
OBJCOPY_COFF_ARGS := -O aixcoff-rs6000 --set-start 0x500000
OBJCOPY_MIB_ARGS := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c
zlibheader := infblock.h infcodes.h inffast.h inftrees.h infutil.h
-zliblinuxheader := zlib.h zconf.h zutil.h
-
-$(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader))
-#$(addprefix $(obj)/,main.o): $(addprefix $(obj)/,zlib.h)
+linuxheader := zlib.h zconf.h zutil.h
src-boot := crt0.S string.S prom.c stdio.c main.c div64.S
src-boot += $(zlib)
@@ -48,20 +45,23 @@ quiet_cmd_copy_zlib = COPY $@
quiet_cmd_copy_zlibheader = COPY $@
cmd_copy_zlibheader = sed "s@<linux/\([^>]\+\).*@\"\1\"@" $< > $@
+
# stddef.h for NULL
-quiet_cmd_copy_zliblinuxheader = COPY $@
- cmd_copy_zliblinuxheader = sed "s@<linux/string.h>@\"string.h\"@;s@<linux/kernel.h>@<stddef.h>@;s@<linux/\([^>]\+\).*@\"\1\"@" $< > $@
+quiet_cmd_copy_linuxheader = COPY $@
+ cmd_copy_linuxheader = sed "s@<linux/string.h>@\"string.h\"@;s@<linux/kernel.h>@<stddef.h>@;s@<linux/\([^>]\+\).*@\"\1\"@" $< > $@
-$(addprefix $(obj)/,$(zlib)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
- $(call cmd,copy_zlib)
+$(addprefix $(obj)/,$(zlib)): $(obj)/%: $(srctree)/lib/zlib_inflate/% FORCE
+ $(call if_changed,copy_zlib)
-$(addprefix $(obj)/,$(zlibheader)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
- $(call cmd,copy_zlibheader)
+$(addprefix $(obj)/,$(zlibheader)): $(obj)/%: $(srctree)/lib/zlib_inflate/% \
+ FORCE
+ $(call if_changed,copy_zlibheader)
-$(addprefix $(obj)/,$(zliblinuxheader)): $(obj)/%: $(srctree)/include/linux/%
- $(call cmd,copy_zliblinuxheader)
+$(addprefix $(obj)/,$(linuxheader)): $(obj)/%: $(srctree)/include/linux/% FORCE
+ $(call if_changed,copy_linuxheader)
-clean-files := $(zlib) $(zlibheader) $(zliblinuxheader)
+targets += $(zlib) $(zlibheader) $(linuxheader)
+targets += $(patsubst $(obj)/%,%, $(obj-boot))
quiet_cmd_bootcc = BOOTCC $@
@@ -73,11 +73,16 @@ quiet_cmd_bootas = BOOTAS $@
quiet_cmd_bootld = BOOTLD $@
cmd_bootld = $(CROSS32LD) -T $(srctree)/$(src)/$(3) -o $@ $(2)
-$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c
+$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE
$(call if_changed_dep,bootcc)
-$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S
+
+$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE
$(call if_changed_dep,bootas)
+$(obj-boot): COPYHEADERS
+COPYHEADERS: $(addprefix $(obj)/,$(linuxheader) $(zlibheader))
+PHONY += COPYHEADERS
+
#-----------------------------------------------------------
# ELF sections within the zImage bootloader/wrapper
#-----------------------------------------------------------
@@ -104,18 +109,20 @@ quiet_cmd_ramdisk = RAMDISK $@
quiet_cmd_stripvm = STRIP $@
cmd_stripvm = $(STRIP) -s -R .comment $< -o $@
-vmlinux.strip: vmlinux
+vmlinux.strip: vmlinux FORCE
$(call if_changed,stripvm)
-$(obj)/vmlinux.initrd: vmlinux.strip $(obj)/addRamDisk $(obj)/ramdisk.image.gz
+$(obj)/vmlinux.initrd: vmlinux.strip $(obj)/addRamDisk \
+ $(obj)/ramdisk.image.gz FORCE
$(call if_changed,ramdisk)
quiet_cmd_addsection = ADDSEC $@
cmd_addsection = $(CROSS32OBJCOPY) $@ \
--add-section=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $@))=$(patsubst %.o,%.gz, $@) \
- --set-section-flags=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $@))=$(OBJCOPYFLAGS)
+ --set-section-flags=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $@))=$(OBJCOPY_SEC_FLAGS)
quiet_cmd_addnote = ADDNOTE $@
- cmd_addnote = $(obj)/addnote $@
+ cmd_addnote = @cp -f $< $@ && \
+ $(obj)/addnote $@
quiet_cmd_gen-miboot = GEN $@
cmd_gen-miboot = $(OBJCOPY) $(OBJCOPY_MIB_ARGS) \
@@ -125,7 +132,19 @@ quiet_cmd_gencoff = COFF $@
cmd_gencoff = $(OBJCOPY) $(OBJCOPY_COFF_ARGS) $@ && \
$(obj)/hack-coff $@
-$(call gz-sec, $(required)): $(obj)/kernel-%.gz: %
+# a single rule so that we can do if_changed correctly
+define rule_ldcoff
+ $(call echo-cmd,bootld) $(cmd_bootld); \
+ $(call echo-cmd,gencoff) $(cmd_gencoff)
+endef
+
+# $(required) is built in $(objtree) not $(obj) so read cmd files manually
+cmd_files := $(wildcard $(foreach f,$(required),$(dir $(f)).$(notdir $(f)).cmd))
+ifneq ($(cmd_files),)
+ include $(cmd_files)
+endif
+
+$(call gz-sec, $(required)): $(obj)/kernel-%.gz: % FORCE
$(call if_changed,gzip)
$(obj)/kernel-initrd.gz: $(obj)/ramdisk.image.gz
@@ -135,16 +154,16 @@ $(call src-sec, $(required) $(initrd)):
@touch $@
$(call obj-sec, $(required) $(initrd)): $(obj)/kernel-%.o: $(obj)/kernel-%.c
- $(call if_changed_dep,bootcc)
+ $(call cmd,bootcc)
$(call cmd,addsection)
$(obj)/zImage.vmode $(obj)/zImage.coff: obj-boot += $(call obj-sec, $(required))
-$(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) $(srctree)/$(src)/zImage.lds
- $(call cmd,bootld,$(obj-boot),zImage.lds)
+$(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) $(srctree)/$(src)/zImage.lds FORCE
+ $(call if_changed,bootld,$(obj-boot),zImage.lds)
$(obj)/zImage.initrd.vmode $(obj)/zImage.initrd.coff: obj-boot += $(call obj-sec, $(required) $(initrd))
-$(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(srctree)/$(src)/zImage.lds
- $(call cmd,bootld,$(obj-boot),zImage.lds)
+$(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(srctree)/$(src)/zImage.lds FORCE
+ $(call if_changed,bootld,$(obj-boot),zImage.lds)
# For 32-bit powermacs, build the COFF and miboot images
# as well as the ELF images.
@@ -154,30 +173,29 @@ mibootimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PP
mibrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/miboot.initrd.image
$(obj)/zImage: $(obj)/zImage.vmode $(obj)/addnote $(coffimage-y-y) \
- $(mibootimg-y-y)
- @cp -f $< $@
+ $(mibootimg-y-y) FORCE
$(call if_changed,addnote)
+ @true
$(obj)/zImage.initrd: $(obj)/zImage.initrd.vmode $(obj)/addnote \
- $(coffrdimg-y-y) $(mibrdimg-y-y)
- @cp -f $< $@
+ $(coffrdimg-y-y) $(mibrdimg-y-y) FORCE
$(call if_changed,addnote)
+ @true
$(obj)/zImage.coff: $(call obj-sec, $(required)) $(obj-boot) \
- $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff
- $(call cmd,bootld,$(obj-boot),zImage.coff.lds)
- $(call cmd,gencoff)
+ $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff FORCE
+ $(call if_changed_rule,ldcoff,$(obj-boot),zImage.coff.lds)
$(obj)/zImage.initrd.coff: $(call obj-sec, $(required) $(initrd)) $(obj-boot) \
- $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff
- $(call cmd,bootld,$(obj-boot),zImage.coff.lds)
- $(call cmd,gencoff)
+ $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff \
+ FORCE
+ $(call if_changed_rule,ldcoff,$(obj-boot),zImage.coff.lds)
-$(obj)/miboot.image: $(obj)/dummy.o $(obj)/vmlinux.gz
- $(call cmd,gen-miboot,image)
+$(obj)/miboot.image: $(obj)/dummy.o $(obj)/vmlinux.gz FORCE
+ $(call if_changed,gen-miboot,image)
-$(obj)/miboot.initrd.image: $(obj)/miboot.image $(images)/ramdisk.image.gz
- $(call cmd,gen-miboot,initrd)
+$(obj)/miboot.initrd.image: $(obj)/miboot.image $(images)/ramdisk.image.gz FORCE
+ $(call if_changed,gen-miboot,initrd)
#-----------------------------------------------------------
# build u-boot images
@@ -199,6 +217,7 @@ extra-y += vmlinux.bin vmlinux.gz
$(obj)/vmlinux.bin: vmlinux FORCE
$(call if_changed,objbin)
+ @true
$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
$(call if_changed,mygzip)
^ permalink raw reply
* [4/5][POWERPC] boot: Makefile and linker scripts for zImage.kexec
From: Milton Miller @ 2006-07-01 23:46 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Paul Mackerras, Sam Ravnborg
In-Reply-To: <kexec-zImage-try2@bga.com>
The Makefile and linker script changes to build zImage.kexec
This patch is based after the if_changed_dep patch.
Signed-off-by: Milton Miller <miltonm@bga.com>
Index: kernel/arch/powerpc/boot/Makefile
===================================================================
--- kernel.orig/arch/powerpc/boot/Makefile 2006-07-01 01:33:55.937370129 -0500
+++ kernel/arch/powerpc/boot/Makefile 2006-07-01 01:41:52.895398201 -0500
@@ -32,12 +32,22 @@ OBJCOPY_MIB_ARGS := -O aixcoff-rs6000 -
zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c
zlibheader := infblock.h infcodes.h inffast.h inftrees.h infutil.h
linuxheader := zlib.h zconf.h zutil.h
+linuxheader += stringify.h
-src-boot := crt0.S string.S prom.c stdio.c main.c div64.S
-src-boot += $(zlib)
+src-common := string.S stdio.c main.c div64.S
+src-common += $(zlib)
+
+src-boot := crt0.S prom.c $(src-common)
src-boot := $(addprefix $(obj)/, $(src-boot))
obj-boot := $(addsuffix .o, $(basename $(src-boot)))
+src-kexec := crt0_kexec.S kexec.c $(src-common)
+src-kexec := $(addprefix $(obj)/, $(src-kexec))
+obj-kexec := $(addsuffix .o, $(basename $(src-kexec)))
+
+src-mult := $(sort $(src-boot) $(src-kexec))
+obj-mult := $(sort $(obj-boot) $(obj-kexec))
+
BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj)
quiet_cmd_copy_zlib = COPY $@
@@ -61,7 +71,7 @@ $(addprefix $(obj)/,$(linuxheader)): $(o
$(call if_changed,copy_linuxheader)
targets += $(zlib) $(zlibheader) $(linuxheader)
-targets += $(patsubst $(obj)/%,%, $(obj-boot))
+targets += $(patsubst $(obj)/%,%, $(obj-mult))
quiet_cmd_bootcc = BOOTCC $@
@@ -73,10 +83,10 @@ quiet_cmd_bootas = BOOTAS $@
quiet_cmd_bootld = BOOTLD $@
cmd_bootld = $(CROSS32LD) -T $(srctree)/$(src)/$(3) -o $@ $(2)
-$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE
+$(patsubst %.c,%.o, $(filter %.c, $(src-mult))): %.o: %.c FORCE
$(call if_changed_dep,bootcc)
-$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE
+$(patsubst %.S,%.o, $(filter %.S, $(src-mult))): %.o: %.S FORCE
$(call if_changed_dep,bootas)
$(obj-boot): COPYHEADERS
@@ -97,6 +107,7 @@ hostprogs-y := addnote addRamDisk hack-
targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd \
zImage.coff zImage.initrd.coff miboot.image miboot.initrd.image \
+ zImage.kexec zImage.kexec.3264 zImage.kexec64 \
$(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
$(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
$(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \
@@ -121,7 +132,7 @@ quiet_cmd_addsection = ADDSEC $@
--set-section-flags=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $@))=$(OBJCOPY_SEC_FLAGS)
quiet_cmd_addnote = ADDNOTE $@
- cmd_addnote = @cp -f $< $@ && \
+ cmd_addnote = cp -f $< $@ && \
$(obj)/addnote $@
quiet_cmd_gen-miboot = GEN $@
@@ -172,8 +183,35 @@ coffrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PP
mibootimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/miboot.image
mibrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/miboot.initrd.image
+# The kexec entry point is valid for all kernels. This zImage should work
+# on all loaders (kexec or firmware) that do not use an openfirmware prom
+# callback, assuming the memory node constraints are met.
+#
+# Build if CONFIG_KEXEC=y or on master make zImage.kexec.
+#
+kexecimg-$(CONFIG_KEXEC)-$(CONFIG_PPC64) += $(obj)/zImage.kexec64
+kexecimg-$(CONFIG_KEXEC)-y += $(obj)/zImage.kexec
+
+# Build 64 bit and 32 bit package when 64 bit kernel is being built
+$(obj)/zImage.kexec: $(filter-out $(obj)/zImage.kexec, $(kexecimg-y-y))
+
+$(obj)/zImage.kexec: obj-kexec += $(call obj-sec, $(required))
+$(obj)/zImage.kexec: $(obj-kexec) $(srctree)/$(src)/zImage.kexec.lds \
+ $(call obj-sec, $(required)) FORCE
+ $(call if_changed,bootld,$(obj-kexec),zImage.kexec.lds)
+ @true
+
+$(obj)/zImage.kexec.3264: obj-kexec += $(call obj-sec, $(required))
+$(obj)/zImage.kexec.3264: $(obj-kexec) $(srctree)/$(src)/zImage.kexec64.lds \
+ $(call obj-sec, $(required)) FORCE
+ $(call if_changed,bootld,$(obj-kexec),zImage.kexec64.lds)
+
+OBJCOPYFLAGS_zImage.kexec64 := -I elf32-powerpc -O elf64-powerpc
+$(obj)/zImage.kexec64: $(obj)/zImage.kexec.3264 FORCE
+ $(call if_changed,objcopy,$< $@)
+
$(obj)/zImage: $(obj)/zImage.vmode $(obj)/addnote $(coffimage-y-y) \
- $(mibootimg-y-y) FORCE
+ $(mibootimg-y-y) $(kexecimg-y-y) FORCE
$(call if_changed,addnote)
@true
@@ -231,4 +269,4 @@ $(obj)/uImage: $(obj)/vmlinux.gz
install: $(CONFIGURE) $(BOOTIMAGE)
sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" "$(BOOTIMAGE)"
-clean-files += $(addprefix $(objtree)/, $(obj-boot) vmlinux.strip)
+clean-files += $(addprefix $(objtree)/, $(obj-mult) vmlinux.strip)
Index: kernel/arch/powerpc/Makefile
===================================================================
--- kernel.orig/arch/powerpc/Makefile 2006-07-01 01:30:31.108598026 -0500
+++ kernel/arch/powerpc/Makefile 2006-07-01 01:34:26.665172415 -0500
@@ -147,7 +147,7 @@ all: $(KBUILD_IMAGE)
CPPFLAGS_vmlinux.lds := -Upowerpc
-BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm uImage vmlinux.bin
+BOOT_TARGETS = zImage zImage.initrd zImage.kexec znetboot znetboot.initrd vmlinux.sm uImage vmlinux.bin
PHONY += $(BOOT_TARGETS)
Index: kernel/arch/powerpc/boot/zImage.kexec.lds
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ kernel/arch/powerpc/boot/zImage.kexec.lds 2006-07-01 01:40:22.459982024 -0500
@@ -0,0 +1,51 @@
+OUTPUT_ARCH(powerpc:common)
+ENTRY(master)
+SECTIONS
+{
+ . = 0;
+ _start = .;
+ .text :
+ {
+ *(.text)
+ *(.fixup)
+ }
+ _etext = .;
+ . = ALIGN(4096);
+ .data :
+ {
+ *(.rodata*)
+ *(.data*)
+ *(.sdata*)
+ __got2_start = .;
+ *(.got2)
+ __got2_end = .;
+ }
+
+ . = ALIGN(4096);
+ _vmlinux_start = .;
+ .kernel:vmlinux.strip : { *(.kernel:vmlinux.strip) }
+ _vmlinux_end = .;
+
+ . = ALIGN(4096);
+ _initrd_start = .;
+ .kernel:initrd : { *(.kernel:initrd) }
+ _initrd_end = .;
+
+ . = ALIGN(4096);
+ _edata = .;
+
+ . = ALIGN(4096);
+ __stack_start = .;
+ .stack : { *(.stack) }
+ __stack_end = .;
+
+ . = ALIGN(4096);
+ __bss_start = .;
+ .bss :
+ {
+ *(.sbss)
+ *(.bss)
+ }
+ . = ALIGN(4096);
+ _end = . ;
+}
Index: kernel/arch/powerpc/boot/zImage.kexec64.lds
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ kernel/arch/powerpc/boot/zImage.kexec64.lds 2006-07-01 01:40:22.487977592 -0500
@@ -0,0 +1,52 @@
+OUTPUT_ARCH(powerpc:common)
+ENTRY(_master64)
+SECTIONS
+{
+ . = 0;
+ _start = .;
+ .text :
+ {
+ *(.text)
+ *(.fixup)
+ }
+ _etext = .;
+ . = ALIGN(4096);
+ .data :
+ {
+ *(.rodata*)
+ *(.data*)
+ *(.sdata*)
+ __got2_start = .;
+ *(.got2)
+ __got2_end = .;
+ }
+
+ . = ALIGN(4096);
+ _vmlinux_start = .;
+ .kernel:vmlinux.strip : { *(.kernel:vmlinux.strip) }
+ _vmlinux_end = .;
+
+ . = ALIGN(4096);
+ _initrd_start = .;
+ .kernel:initrd : { *(.kernel:initrd) }
+ _initrd_end = .;
+
+ . = ALIGN(4096);
+ _edata = .;
+
+ . = ALIGN(4096);
+ __stack_start = .;
+ .stack : { *(.stack) }
+ __stack_end = .;
+
+ . = ALIGN(4096);
+ __bss_start = .;
+ .bss :
+ {
+ *(.sbss)
+ *(.bss)
+ }
+ . = ALIGN(4096);
+ _end = . ;
+}
+
^ permalink raw reply
* [5/5][POWERPC] boot: generate lds file from lds.S
From: Milton Miller @ 2006-07-01 23:47 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Sam Ravnborg
In-Reply-To: <kexec-zImage-try2@bga.com>
The zImage.kexec and zImage.kexec64 linker files are almost identical to
the base elf file. Use the lds.S -> ld rule to share the source.
Tell the linker the fils is in $(obj) not $(srctree)/$(src)
zImage.coff.lds is different, it links the initrd and kernel in .data
rather than as a seperate section and without alignment, keep it seperate
for now.
Signed-off-by: Milton Miller <miltonm@bga.com>
Index: kernel/arch/powerpc/boot/Makefile
===================================================================
--- kernel.orig/arch/powerpc/boot/Makefile 2006-07-01 01:41:52.895398201 -0500
+++ kernel/arch/powerpc/boot/Makefile 2006-07-01 01:42:18.569198987 -0500
@@ -81,7 +81,7 @@ quiet_cmd_bootas = BOOTAS $@
cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
quiet_cmd_bootld = BOOTLD $@
- cmd_bootld = $(CROSS32LD) -T $(srctree)/$(src)/$(3) -o $@ $(2)
+ cmd_bootld = $(CROSS32LD) -T $(obj)/$(3) -o $@ $(2)
$(patsubst %.c,%.o, $(filter %.c, $(src-mult))): %.o: %.c FORCE
$(call if_changed_dep,bootcc)
@@ -108,6 +108,7 @@ hostprogs-y := addnote addRamDisk hack-
targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd \
zImage.coff zImage.initrd.coff miboot.image miboot.initrd.image \
zImage.kexec zImage.kexec.3264 zImage.kexec64 \
+ zImage.lds zImage.kexec.lds zImage.kexec64.lds zImage.coff.lds \
$(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
$(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
$(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \
@@ -168,12 +169,26 @@ $(call obj-sec, $(required) $(initrd)):
$(call cmd,bootcc)
$(call cmd,addsection)
+lds-fl := -P -C -Upowerpc
+CPPFLAGS_zImage.coff.lds := $(lds-fl)
+CPPFLAGS_zImage.lds := $(lds-fl) -D__ENTRY__=_zimage_start
+CPPFLAGS_zImage.lds += -D__BASE__="4*1024*1024"
+CPPFLAGS_zImage.kexec.lds := $(lds-fl) -D__ENTRY__=master -D__BASE__=0
+CPPFLAGS_zImage.kexec64.lds := $(lds-fl) -D__ENTRY__=_master64 -D__BASE__=0
+
+$(addprefix $(obj)/, zImage.lds zImage.kexec.lds zImage.kexec64.lds): \
+ $(srctree)/$(src)/zImage.lds.S FORCE
+ $(call if_changed_dep,cpp_lds_S)
+
+$(obj)/zImage.coff.lds: $(srctree)/$(src)/$zImage.coff.lds.S FORCE
+ $(call if_changed_dep,cpp_lds_S)
+
$(obj)/zImage.vmode $(obj)/zImage.coff: obj-boot += $(call obj-sec, $(required))
-$(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) $(srctree)/$(src)/zImage.lds FORCE
+$(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) $(obj)/zImage.lds FORCE
$(call if_changed,bootld,$(obj-boot),zImage.lds)
$(obj)/zImage.initrd.vmode $(obj)/zImage.initrd.coff: obj-boot += $(call obj-sec, $(required) $(initrd))
-$(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(srctree)/$(src)/zImage.lds FORCE
+$(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(obj)/zImage.lds FORCE
$(call if_changed,bootld,$(obj-boot),zImage.lds)
# For 32-bit powermacs, build the COFF and miboot images
@@ -196,13 +211,13 @@ kexecimg-$(CONFIG_KEXEC)-y
$(obj)/zImage.kexec: $(filter-out $(obj)/zImage.kexec, $(kexecimg-y-y))
$(obj)/zImage.kexec: obj-kexec += $(call obj-sec, $(required))
-$(obj)/zImage.kexec: $(obj-kexec) $(srctree)/$(src)/zImage.kexec.lds \
+$(obj)/zImage.kexec: $(obj-kexec) $(obj)/zImage.kexec.lds \
$(call obj-sec, $(required)) FORCE
$(call if_changed,bootld,$(obj-kexec),zImage.kexec.lds)
@true
$(obj)/zImage.kexec.3264: obj-kexec += $(call obj-sec, $(required))
-$(obj)/zImage.kexec.3264: $(obj-kexec) $(srctree)/$(src)/zImage.kexec64.lds \
+$(obj)/zImage.kexec.3264: $(obj-kexec) $(obj)/zImage.kexec64.lds \
$(call obj-sec, $(required)) FORCE
$(call if_changed,bootld,$(obj-kexec),zImage.kexec64.lds)
@@ -221,12 +236,11 @@ $(obj)/zImage.initrd: $(obj)/zImage.init
@true
$(obj)/zImage.coff: $(call obj-sec, $(required)) $(obj-boot) \
- $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff FORCE
+ $(obj)/zImage.coff.lds $(obj)/hack-coff FORCE
$(call if_changed_rule,ldcoff,$(obj-boot),zImage.coff.lds)
$(obj)/zImage.initrd.coff: $(call obj-sec, $(required) $(initrd)) $(obj-boot) \
- $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff \
- FORCE
+ $(obj)/zImage.coff.lds $(obj)/hack-coff FORCE
$(call if_changed_rule,ldcoff,$(obj-boot),zImage.coff.lds)
$(obj)/miboot.image: $(obj)/dummy.o $(obj)/vmlinux.gz FORCE
Index: kernel/arch/powerpc/boot/zImage.coff.lds
===================================================================
--- kernel.orig/arch/powerpc/boot/zImage.coff.lds 2006-07-01 01:40:22.406990413 -0500
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,46 +0,0 @@
-OUTPUT_ARCH(powerpc:common)
-ENTRY(_start)
-SECTIONS
-{
- . = (5*1024*1024);
- _start = .;
- .text :
- {
- *(.text)
- *(.fixup)
- }
- _etext = .;
- . = ALIGN(4096);
- .data :
- {
- *(.rodata*)
- *(.data*)
- *(.sdata*)
- __got2_start = .;
- *(.got2)
- __got2_end = .;
-
- _vmlinux_start = .;
- *(.kernel:vmlinux.strip)
- _vmlinux_end = .;
-
- _initrd_start = .;
- *(.kernel:initrd)
- _initrd_end = .;
- }
-
- . = ALIGN(4096);
- _edata = .;
- __bss_start = .;
- .bss :
- {
- *(.sbss)
- *(.bss)
- }
- _end = . ;
-
- /DISCARD/ :
- {
- *(.comment)
- }
-}
Index: kernel/arch/powerpc/boot/zImage.coff.lds.S
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ kernel/arch/powerpc/boot/zImage.coff.lds.S 2006-07-01 01:42:18.572198512 -0500
@@ -0,0 +1,46 @@
+OUTPUT_ARCH(powerpc:common)
+ENTRY(_start)
+SECTIONS
+{
+ . = (5*1024*1024);
+ _start = .;
+ .text :
+ {
+ *(.text)
+ *(.fixup)
+ }
+ _etext = .;
+ . = ALIGN(4096);
+ .data :
+ {
+ *(.rodata*)
+ *(.data*)
+ *(.sdata*)
+ __got2_start = .;
+ *(.got2)
+ __got2_end = .;
+
+ _vmlinux_start = .;
+ *(.kernel:vmlinux.strip)
+ _vmlinux_end = .;
+
+ _initrd_start = .;
+ *(.kernel:initrd)
+ _initrd_end = .;
+ }
+
+ . = ALIGN(4096);
+ _edata = .;
+ __bss_start = .;
+ .bss :
+ {
+ *(.sbss)
+ *(.bss)
+ }
+ _end = . ;
+
+ /DISCARD/ :
+ {
+ *(.comment)
+ }
+}
Index: kernel/arch/powerpc/boot/zImage.kexec.lds
===================================================================
--- kernel.orig/arch/powerpc/boot/zImage.kexec.lds 2006-07-01 01:40:22.459982024 -0500
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,51 +0,0 @@
-OUTPUT_ARCH(powerpc:common)
-ENTRY(master)
-SECTIONS
-{
- . = 0;
- _start = .;
- .text :
- {
- *(.text)
- *(.fixup)
- }
- _etext = .;
- . = ALIGN(4096);
- .data :
- {
- *(.rodata*)
- *(.data*)
- *(.sdata*)
- __got2_start = .;
- *(.got2)
- __got2_end = .;
- }
-
- . = ALIGN(4096);
- _vmlinux_start = .;
- .kernel:vmlinux.strip : { *(.kernel:vmlinux.strip) }
- _vmlinux_end = .;
-
- . = ALIGN(4096);
- _initrd_start = .;
- .kernel:initrd : { *(.kernel:initrd) }
- _initrd_end = .;
-
- . = ALIGN(4096);
- _edata = .;
-
- . = ALIGN(4096);
- __stack_start = .;
- .stack : { *(.stack) }
- __stack_end = .;
-
- . = ALIGN(4096);
- __bss_start = .;
- .bss :
- {
- *(.sbss)
- *(.bss)
- }
- . = ALIGN(4096);
- _end = . ;
-}
Index: kernel/arch/powerpc/boot/zImage.kexec64.lds
===================================================================
--- kernel.orig/arch/powerpc/boot/zImage.kexec64.lds 2006-07-01 01:40:22.487977592 -0500
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,52 +0,0 @@
-OUTPUT_ARCH(powerpc:common)
-ENTRY(_master64)
-SECTIONS
-{
- . = 0;
- _start = .;
- .text :
- {
- *(.text)
- *(.fixup)
- }
- _etext = .;
- . = ALIGN(4096);
- .data :
- {
- *(.rodata*)
- *(.data*)
- *(.sdata*)
- __got2_start = .;
- *(.got2)
- __got2_end = .;
- }
-
- . = ALIGN(4096);
- _vmlinux_start = .;
- .kernel:vmlinux.strip : { *(.kernel:vmlinux.strip) }
- _vmlinux_end = .;
-
- . = ALIGN(4096);
- _initrd_start = .;
- .kernel:initrd : { *(.kernel:initrd) }
- _initrd_end = .;
-
- . = ALIGN(4096);
- _edata = .;
-
- . = ALIGN(4096);
- __stack_start = .;
- .stack : { *(.stack) }
- __stack_end = .;
-
- . = ALIGN(4096);
- __bss_start = .;
- .bss :
- {
- *(.sbss)
- *(.bss)
- }
- . = ALIGN(4096);
- _end = . ;
-}
-
Index: kernel/arch/powerpc/boot/zImage.lds
===================================================================
--- kernel.orig/arch/powerpc/boot/zImage.lds 2006-07-01 01:40:22.516973001 -0500
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,46 +0,0 @@
-OUTPUT_ARCH(powerpc:common)
-ENTRY(_zimage_start)
-SECTIONS
-{
- . = (4*1024*1024);
- _start = .;
- .text :
- {
- *(.text)
- *(.fixup)
- }
- _etext = .;
- . = ALIGN(4096);
- .data :
- {
- *(.rodata*)
- *(.data*)
- *(.sdata*)
- __got2_start = .;
- *(.got2)
- __got2_end = .;
- }
-
- . = ALIGN(4096);
- _vmlinux_start = .;
- .kernel:vmlinux.strip : { *(.kernel:vmlinux.strip) }
- _vmlinux_end = .;
-
- . = ALIGN(4096);
- _initrd_start = .;
- .kernel:initrd : { *(.kernel:initrd) }
- _initrd_end = .;
-
- . = ALIGN(4096);
- _edata = .;
-
- . = ALIGN(4096);
- __bss_start = .;
- .bss :
- {
- *(.sbss)
- *(.bss)
- }
- . = ALIGN(4096);
- _end = . ;
-}
Index: kernel/arch/powerpc/boot/zImage.lds.S
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ kernel/arch/powerpc/boot/zImage.lds.S 2006-07-01 01:42:18.576197879 -0500
@@ -0,0 +1,51 @@
+OUTPUT_ARCH(powerpc:common)
+ENTRY(__ENTRY__)
+SECTIONS
+{
+ . = __BASE__;
+ _start = .;
+ .text :
+ {
+ *(.text)
+ *(.fixup)
+ }
+ _etext = .;
+ . = ALIGN(4096);
+ .data :
+ {
+ *(.rodata*)
+ *(.data*)
+ *(.sdata*)
+ __got2_start = .;
+ *(.got2)
+ __got2_end = .;
+ }
+
+ . = ALIGN(4096);
+ _vmlinux_start = .;
+ .kernel:vmlinux.strip : { *(.kernel:vmlinux.strip) }
+ _vmlinux_end = .;
+
+ . = ALIGN(4096);
+ _initrd_start = .;
+ .kernel:initrd : { *(.kernel:initrd) }
+ _initrd_end = .;
+
+ . = ALIGN(4096);
+ _edata = .;
+
+ . = ALIGN(4096);
+ __stack_start = .;
+ .stack : { *(.stack) }
+ __stack_end = .;
+
+ . = ALIGN(4096);
+ __bss_start = .;
+ .bss :
+ {
+ *(.sbss)
+ *(.bss)
+ }
+ . = ALIGN(4096);
+ _end = . ;
+}
^ permalink raw reply
* Re: OSS driver removal, 2nd round
From: Adrian Bunk @ 2006-07-01 23:12 UTC (permalink / raw)
To: linux-kernel; +Cc: linuxppc-dev, alsa-devel, Johannes Berg, perex, Olaf Hering
In-Reply-To: <20060629192128.GE19712@stusta.de>
On Thu, Jun 29, 2006 at 09:21:28PM +0200, Adrian Bunk wrote:
> Now that I've sent the first round of actually removing the code for OSS
> drivers where ALSA drivers without regressions exist for the same
> hardware, it's time for a second round amongst the remaining drivers.
>
>
> Removing OSS drivers where ALSA drivers for the same hardware exists has
> two reasons:
>
> 1. remove obsolete and mostly unmaintained code
> 2. get bugs in the ALSA drivers reported that weren't previously
> reported due to the possible workaround of using the OSS drivers
>
>
> The list below divides the OSS drivers into the following three
> categories:
> 1. ALSA drivers for the same hardware
> 2. ALSA drivers for the same hardware with known problems
> 3. no ALSA drivers for the same hardware
>
>
> My proposed timeline is:
> - 2.6.18: let the drivers under 1. in the list below depend on
> OSS_OBSOLETE_DRIVER
> - 2.6.20: remove the options depending on OSS_OBSOLETE_DRIVER
> - 2.6.22: remove the code for the drivers that were depending on
> OSS_OBSOLETE_DRIVER from the kernel tree
>...
> 2. ALSA drivers for the same hardware with known problems
>
> DMASOUND_PMAC
> - Olaf Hering regarding regressions in SND_POWERMAC:
> Some tumbler models work only after one plug/unplug cycle of
> the headphone. early powerbooks report/handle the mute settings
> incorrectly. there are likely more bugs.
>...
Could anyone tell me whether there are still regressions in ALSA
compared to DMASOUND_PMAC, and if yes give me bug numbers in the
ALSA BTS so that I can track them?
TIA
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply
* [PATCH] powermac: Fix some 64b resource damage
From: Benjamin Herrenschmidt @ 2006-07-02 1:55 UTC (permalink / raw)
To: Andrew Morton, Linus Torvalds
Cc: linuxppc-dev list, Greg Kroah-Hartman, Paul Mackerras
The 64 bits resource patches did a bit of damage on PowerMac causing a
buffer overflow in macio_asic and a warning in a sound driver. The
former is fixed by reverting the sprintf of the bus_id to %08x as it was
before. The bus_id used for macio devices is always a 32 bits value
(macio always sits in 32 bits space) and since it's exposed to userland,
the format of the string shouldn't be changed like that anyway. The
second by using the proper type for printk.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
Linus, please apply asap since right now, PowerMac overflows kobject
buffers on boot, pretty bad.
Index: linux-irq-work/drivers/macintosh/macio_asic.c
===================================================================
--- linux-irq-work.orig/drivers/macintosh/macio_asic.c 2006-07-02 11:46:53.000000000 +1000
+++ linux-irq-work/drivers/macintosh/macio_asic.c 2006-07-02 11:47:37.000000000 +1000
@@ -427,10 +427,10 @@
/* MacIO itself has a different reg, we use it's PCI base */
if (np == chip->of_node) {
- sprintf(dev->ofdev.dev.bus_id, "%1d.%016llx:%.*s",
+ sprintf(dev->ofdev.dev.bus_id, "%1d.%08x:%.*s",
chip->lbus.index,
#ifdef CONFIG_PCI
- (unsigned long long)pci_resource_start(chip->lbus.pdev, 0),
+ (unsigned int)pci_resource_start(chip->lbus.pdev, 0),
#else
0, /* NuBus may want to do something better here */
#endif
Index: linux-irq-work/sound/ppc/pmac.c
===================================================================
--- linux-irq-work.orig/sound/ppc/pmac.c 2006-07-02 11:46:53.000000000 +1000
+++ linux-irq-work/sound/ppc/pmac.c 2006-07-02 11:48:40.000000000 +1000
@@ -1170,7 +1170,7 @@
chip->rsrc[i].start + 1,
rnames[i]) == NULL) {
printk(KERN_ERR "snd: can't request rsrc "
- " %d (%s: 0x%016lx:%016lx)\n",
+ " %d (%s: 0x%016llx:%016llx)\n",
i, rnames[i],
(unsigned long long)chip->rsrc[i].start,
(unsigned long long)chip->rsrc[i].end);
^ permalink raw reply
* RE: [PATCH] powerpc:Fix rheap alignment problem
From: Rune Torgersen @ 2006-07-02 3:54 UTC (permalink / raw)
To: Pantelis Antoniou, Kumar Gala
Cc: linuxppc-dev list, Paul Mackerras, linux-kernel
In-Reply-To: <200607011750.05019.pantelis.antoniou@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 808 bytes --]
From: Pantelis Antoniou
Sent: Sat 7/1/2006 9:50 AM
>Since genalloc is the blessed linux thing it might be best to use that & remove
>rheap completely. Oh well...
Two problems with genalloc that I can see (for CPM programming):
1) (minor) Does not have a way to specify alignment (genalloc does it for you)
2) (major problerm, at least for me) Does not have a way to allocate a specified address in the pool.
2 is needed esp when programming MCC drivers, since a lot of the datastructures must be in DP RAM _and_ be in a specific spot. And if you cannot tell the allocator that I am using a specific address, then the allocator might very well give somebody else that portion of RAM. The only solution without a fixed allocator is to allocate ALL memory in the DP RAM and use your own allocator.
[-- Attachment #2: Type: text/html, Size: 1247 bytes --]
^ permalink raw reply
* [PATCH] powerpc: Fix warning in cell setup.c
From: Benjamin Herrenschmidt @ 2006-07-02 4:30 UTC (permalink / raw)
To: Paul Mackerras; +Cc: Andrew Morton, linuxppc-dev list, Arnd Bergmann
Fixes a warning due to a missing #include on cell
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Index: linux-irq-work/arch/powerpc/platforms/cell/setup.c
===================================================================
--- linux-irq-work.orig/arch/powerpc/platforms/cell/setup.c 2006-07-01 15:25:33.000000000 +1000
+++ linux-irq-work/arch/powerpc/platforms/cell/setup.c 2006-07-01 15:25:36.000000000 +1000
@@ -49,6 +49,7 @@
#include <asm/irq.h>
#include <asm/spu.h>
#include <asm/spu_priv1.h>
+#include <asm/udbg.h>
#include "interrupt.h"
#include "iommu.h"
^ permalink raw reply
* Re: [PATCH] powermac: Fix some 64b resource damage
From: Greg KH @ 2006-07-02 4:05 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: Andrew Morton, linuxppc-dev list, Linus Torvalds, Paul Mackerras
In-Reply-To: <1151805303.19419.15.camel@localhost.localdomain>
On Sun, Jul 02, 2006 at 11:55:03AM +1000, Benjamin Herrenschmidt wrote:
> The 64 bits resource patches did a bit of damage on PowerMac causing a
> buffer overflow in macio_asic and a warning in a sound driver. The
> former is fixed by reverting the sprintf of the bus_id to %08x as it was
> before. The bus_id used for macio devices is always a 32 bits value
> (macio always sits in 32 bits space) and since it's exposed to userland,
> the format of the string shouldn't be changed like that anyway. The
> second by using the proper type for printk.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> Linus, please apply asap since right now, PowerMac overflows kobject
> buffers on boot, pretty bad.
Acked by me, sorry about this.
greg k-h
^ permalink raw reply
* Re: [PATCH] powerpc:Fix rheap alignment problem
From: Pantelis Antoniou @ 2006-07-02 5:18 UTC (permalink / raw)
To: Rune Torgersen; +Cc: linuxppc-dev list, Paul Mackerras, linux-kernel
In-Reply-To: <DCEAAC0833DD314AB0B58112AD99B93B07B36F@ismail.innsys.innovsys.com>
On Sunday 02 July 2006 06:54, Rune Torgersen wrote:
> From: Pantelis Antoniou
> Sent: Sat 7/1/2006 9:50 AM
> >Since genalloc is the blessed linux thing it might be best to use that & remove
> >rheap completely. Oh well...
>
> Two problems with genalloc that I can see (for CPM programming):
> 1) (minor) Does not have a way to specify alignment (genalloc does it for you)
> 2) (major problerm, at least for me) Does not have a way to allocate a specified address in the pool.
>
> 2 is needed esp when programming MCC drivers, since a lot of the datastructures must be in DP RAM _and_ be in a specific spot. And if you cannot tell the allocator that I am using a specific address, then the allocator might very well give somebody else that portion of RAM. The only solution without a fixed allocator is to allocate ALL memory in the DP RAM and use your own allocator.
>
Yeah, that too.
Too bad there are no main tree drivers like that, but they do exist.
One could conceivably hack genalloc to do that, but will end up with
something complex too.
BTW, there are other uEngine based architectures with similar alignment
requirements.
So in conclusion, for the in-tree drivers genalloc is sufficient as an cpm memory allocator.
For some out of tree drivers, it is not.
Pantelis
^ permalink raw reply
* Re: [PATCH] powerpc: Fix warning in cell setup.c
From: Andrew Morton @ 2006-07-02 6:08 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, paulus, arnd
In-Reply-To: <1151814604.19419.20.camel@localhost.localdomain>
On Sun, 02 Jul 2006 14:30:04 +1000
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> Fixes a warning due to a missing #include on cell
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>
> Index: linux-irq-work/arch/powerpc/platforms/cell/setup.c
> ===================================================================
> --- linux-irq-work.orig/arch/powerpc/platforms/cell/setup.c 2006-07-01 15:25:33.000000000 +1000
> +++ linux-irq-work/arch/powerpc/platforms/cell/setup.c 2006-07-01 15:25:36.000000000 +1000
> @@ -49,6 +49,7 @@
> #include <asm/irq.h>
> #include <asm/spu.h>
> #include <asm/spu_priv1.h>
> +#include <asm/udbg.h>
>
> #include "interrupt.h"
> #include "iommu.h"
I already had that.
I don't know what to do with powerpc patches any more. Help.
^ permalink raw reply
* Re: [PATCH] powerpc: Fix warning in cell setup.c
From: Benjamin Herrenschmidt @ 2006-07-02 6:40 UTC (permalink / raw)
To: Andrew Morton; +Cc: linuxppc-dev, paulus, arnd
In-Reply-To: <20060701230845.e2f8507d.akpm@osdl.org>
On Sat, 2006-07-01 at 23:08 -0700, Andrew Morton wrote:
> On Sun, 02 Jul 2006 14:30:04 +1000
> Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
>
> > Fixes a warning due to a missing #include on cell
> >
> > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> >
> > Index: linux-irq-work/arch/powerpc/platforms/cell/setup.c
> > ===================================================================
> > --- linux-irq-work.orig/arch/powerpc/platforms/cell/setup.c 2006-07-01 15:25:33.000000000 +1000
> > +++ linux-irq-work/arch/powerpc/platforms/cell/setup.c 2006-07-01 15:25:36.000000000 +1000
> > @@ -49,6 +49,7 @@
> > #include <asm/irq.h>
> > #include <asm/spu.h>
> > #include <asm/spu_priv1.h>
> > +#include <asm/udbg.h>
> >
> > #include "interrupt.h"
> > #include "iommu.h"
>
> I already had that.
>
> I don't know what to do with powerpc patches any more. Help.
If you already have it, drop it :) I didnt notice it was already there.
For trivialities like that, it doesn't matter. Important stuff goes
through paulus.
Ben.
^ permalink raw reply
* Re: sound connector detection
From: Richard Purdie @ 2006-07-02 9:28 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Liam Girdwood, Linux Kernel list, linuxppc-dev list, linux-input,
Johannes Berg, alsa-devel
In-Reply-To: <200607011609.59426.dtor@insightbb.com>
Hi,
On Sat, 2006-07-01 at 16:09 -0400, Dmitry Torokhov wrote:
> I am not too happy with putting this kind of switches into input layer,
> it should be reserved for "real" buttons, ones that user can explicitely
> push or toggle
Playing devil's advocate, by inserting a headphone cable, you push the
switch - the user can explicitly control that switch but inserting or
removing the cable...
> (lid switch is on the edge here but it and sleep button
> are used for similar purposes so it makes sense to have it in input layer
> too). But "cable X connected" kind of events is too much [for input layer,
> there could well be a separate layer for it]. If we go this way we'd have
> to move cable detection code from network to input layer as well ;)
I have mixed feelings about this and can see it from both sides. In a
lot of cases, we need to report these "switch" events to userspace as
only userspace can determine the correct action. Taking some examples,
just from the Zaurus:
Upon lid closure should:
- the screen/backlight be turned off?
- the device suspended?
Upon insertion of a headphone jack should:
- the external speaker be turned on/off?
- does the jack connect to headphones, a headset, mic or line in
source? (no autodetection so the user has to select and only then can
the mixer be appropriately configured)
Only userspace can make these decisions so we need to pass them there so
it can decide how to handle things. In the case of the Zaurus, we have a
program called zaurusd which listens for the events and knows how to
handle them (http://svn.o-hand.com/view/misc/trunk/zaurusd/). It turns
these events into something the user can influence with scripts.
There is also a question of which USB client to load when USB client is
detected - again, this insertion event really needs to be passed to
userspace for a decision. I've not touched this issue yet and adding
switch events for client cable detection would probably get frowned
upon?
One thing the input system does well is pass simple switch events to
userspace though its event devices. Not using the input system for
switch like events like these is going to result in code duplication.
I can understand the concern with not wanting to fill the input
subsystem with events that have a tenuous relationship to input devices.
Perhaps the solution is to separate the events layer from the input
layer and start to allow it to handle more generic events?
One of the issues is the ownership of the events data. Currently, you
can't tag a given source of events to a given soundcard. Perhaps each
soundcard would create a separate events device but we need to think
about things like this. Some switch events have no real parent (like the
lid switch on the Zaurus which if anything does belong to the keyboard
driver). Others like the headphone switch on the zaurus arguably belong
to the ASoC sound device (not in mainline yet but coming soon).
In the audio case, there is perhaps an argument for some kind of
scenarios handling where the mixer has some predefined states which get
activated given certain circumstances. The Zaurus ASoC implementations
already sort of implement this having controls which set the headphone
jack mode (headphones, headset, mic, line, off). There is still a need
to ask userspace what was inserted though which requires some kind of
event system.
Even if the audio situation improves, it doesn't solve the general event
case either. Can anyone see a way forward? Would some kind of generic
event code that any device could add to its sysfs directory work? Could
such a thing be abstracted from the input system code?
Richard
^ permalink raw reply
* RE: rs232 endianness on PPC
From: Antonio Di Bacco @ 2006-07-02 10:10 UTC (permalink / raw)
To: linuxppc-embedded
PowerPC is neither byte swapped nor bit swapped.
When transmitting on a network card the most significant byte is transmitted
first, and, inside the byte, the most significant bit is sent first.
RS232 is an exception: LSB is sent first.
^ permalink raw reply
* [PATCH 2.6.17] Add -fno-stack-protector to BOOTCFLAGS in arch/powerpc/boot/Makefile.
From: Niels Kristian Bech Jensen @ 2006-07-02 11:02 UTC (permalink / raw)
To: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 389 bytes --]
I got some undefined references to __stack_chk_fail in
arch/powerpc/boot/stdio.o and arch/powerpc/boot/prom.o when I was trying
to build a kernel on Ubuntu Edgy Eft - which includes Stack Smashing
Protection.
This patch adds -fno-stack-protector to BOOTCFLAGS in
arch/powerpc/boot/Makefile (why does BOOTCFLAGS depend on HOSTCFLAGS and
not CFLAGS?).
Regards,
Niels Kristian Bech Jensen
[-- Attachment #2: powerpc-2.6.17.diff --]
[-- Type: text/x-patch, Size: 492 bytes --]
--- linux-source-2.6.17/arch/powerpc/boot/Makefile~ 2006-06-29 03:23:03.000000000 +0200
+++ linux-source-2.6.17/arch/powerpc/boot/Makefile 2006-07-02 12:44:34.000000000 +0200
@@ -41,6 +41,10 @@ src-boot += $(zlib)
src-boot := $(addprefix $(obj)/, $(src-boot))
obj-boot := $(addsuffix .o, $(basename $(src-boot)))
+ifeq ($(call cc-option-yn, -fstack-protector),y)
+BOOTCFLAGS += -fno-stack-protector
+endif
+
BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj)
quiet_cmd_copy_zlib = COPY $@
^ permalink raw reply
* Problem booting Linux on MPC8XXFADS
From: Hamid Marshall @ 2006-07-02 21:41 UTC (permalink / raw)
To: linuxppc-embedded; +Cc: boehringer
[-- Attachment #1: Type: text/plain, Size: 167 bytes --]
Hi Sven,
Were you able to resolve your Linux boot problem on this board. Let me know
what steps you took to resolve this.
Thanks,
Hamid Marshall
[-- Attachment #2: Type: text/html, Size: 2915 bytes --]
^ permalink raw reply
* Re: sound connector detection
From: Dmitry Torokhov @ 2006-07-03 2:48 UTC (permalink / raw)
To: Richard Purdie
Cc: Liam Girdwood, Linux Kernel list, linuxppc-dev list, linux-input,
Johannes Berg, alsa-devel
In-Reply-To: <1151832510.5536.32.camel@localhost.localdomain>
[-- Attachment #1: Type: text/plain, Size: 897 bytes --]
On Sunday 02 July 2006 05:28, Richard Purdie wrote:
> One thing the input system does well is pass simple switch events to
> userspace though its event devices. Not using the input system for
> switch like events like these is going to result in code duplication.
>
I think that hotplug/uevent like mechanism would be better suited here.
You want to monitor changes in system state and you do not really want
to monitor myriad of devices but just latch onto one data feed and get
all the data from it (unlike input devices where you might want to
separate data coming from different devices). The following "event"
might be a good starting point:
struct system_change_event {
struct timeval time; /* look for 32/64 bit issues */
__u16 type;
__u16 code;
__s32 value;
char object_path[224];
};
Maybe we should start looking into connector or a pure netlink implementation.
--
Dmitry
[-- Attachment #2: Type: text/html, Size: 1217 bytes --]
^ permalink raw reply
* RE: [PATCH] Add QE device tree definition
From: Li Yang-r58472 @ 2006-07-03 6:17 UTC (permalink / raw)
To: Fleming Andy-afleming; +Cc: linuxppc-dev
> -----Original Message-----
> From: Fleming Andy-afleming
> Sent: Saturday, July 01, 2006 1:55 AM
> To: Li Yang-r58472
> Cc: 'Kumar Gala'; linuxppc-dev@ozlabs.org
> Subject: Re: [PATCH] Add QE device tree definition
>
>
> On Jun 29, 2006, at 22:36, Li Yang-r58472 wrote:
>
> >>> +
> >>> +
> >>> + 2) SPI (Serial Peripheral Interface)
> >>> +
> >>> + Required properties:
> >>> + - device_type : should be "spi".
> >>> + - compatible : should be "fsl_spi".
> >>> + - mode : the spi operation mode, it can be "cpu" or "qe".
> >>
> >> What does it mean for the spi to be in "qe" mode?
> > That means:
> > The SPI can operate in QE mode or in CPU mode. In QE mode SPI is
> > compatible to the MPC826x SPI, and is controlled by QE RISC. In CPU
> > mode, the SPI is controlled wholly by the CPU without any QE RISC
> > intervention.
>
>
> Doesn't that mean the "cpu" SPI isn't part of the QE device? I kind
> of feel like it shouldn't be part of the QE node, then. Or is it
> actually one device that can act in two different modes?
Yes, it is actually one device with two modes, sharing the same set of registers within QE memory map region. So it best lives in QE node.
>
>
> >
> >>
> >>> + - reg : offset to the register set and its length.
> >>> + - interrupts : <a b> where a is the interrupt number and b is a
> >>> + field that represents an encoding of the sense and level
> >>> + information for the interrupt. This should be encoded
> >>> based on
> >>> + the information in section 2) depending on the type of
> >>> interrupt
> >>> + controller you have.
> >>> + - interrupt-parent : the phandle for the interrupt controller
> >>> that
> >>> + services interrupts for this device.
> >>> +
> >>> + Example:
> >>> + spi@4c0 {
> >>> + device_type = "spi";
> >>> + compatible = "fsl_spi";
> >>> + reg = <4c0 40>;
> >>> + interrupts = <82 0>;
> >>> + interrupt-parent = <700>;
> >>> + mode = "cpu";
> >>> + };
> >>> +
> >>
> >> How do we tell the difference between the various spi controllers. I
> >> think we have four of them, three of which are probably pretty
> >> similar. We have the 834x spi, and QE, CPM1, CPM2 SPI.
> >>
> >>> +
> >>> + 3) USB (Universal Serial Bus Controller)
> >>> +
> >>> + Required properties:
> >>> + - device_type : should be "usb".
> >>> + - compatible : could be "qe_udc" or "fhci-hcd".
> >>> + - model : the could be "host" or "slave".
> >>
> >> got a 'l' on mode, if we are slave should we provide more info about
> >> what kinda slave we are (ie, what gadget driver should apply).
> >>
> >>> + - reg : there will be two tuples of "address size". The first
> >>> tuple is
> >>> + offset and length of the device registers respectively; the
> >>> second is
> >>> + offset and length of the device parameter RAM respectively.
> >>> + - interrupts : <a b> where a is the interrupt number and b is a
> >>> + field that represents an encoding of the sense and level
> >>> + information for the interrupt. This should be encoded
> >>> based on
> >>> + the information in section 2) depending on the type of
> >>> interrupt
> >>> + controller you have.
> >>> + - interrupt-parent : the phandle for the interrupt controller
> >>> that
> >>> + services interrupts for this device.
> >>> +
> >>> + Example(slave):
> >>> + usb@6c0 {
> >>> + device_type = "usb";
> >>> + compatible = "qe_udc";
> >>> + reg = <6c0 40 8B00 100>;
> >>> + interrupts = <8b 0>;
> >>> + interrupt-parent = <700>;
> >>> + mode = "slave";
> >>> + };
> >>> +
> >>> +
> >>> + 4) UCC (Unified Communications Controllers)
> >>
> >> Why dont you create a sub section for network, and in the future
> >> additional subsections can be added for the different device_types.
> >>
> >>> +
> >>> + Required properties:
> >>> + - device_type : should be "network", "hldc", "uart",
> >>> "transparent"
> >>> + "bisync" or "atm".
> >>> + - compatible : could be "ucc_geth" or "fsl_atm" and so on.
> >>> + - model : should be "UCC".
> >>> + - device-id : the ucc number(1-8), corresponding to UCCx in UM.
> >>> + - reg : there will be two tuples of "address size". The first
> >>> tuple is
> >>> + offset and length of the device registers respectively; the
> >>> second is
> >>> + offset and length of the device parameter RAM respectively.
> >>> + - interrupts : <a b> where a is the interrupt number and b is a
> >>> + field that represents an encoding of the sense and level
> >>> + information for the interrupt. This should be encoded
> >>> based on
> >>> + the information in section 2) depending on the type of
> >>> interrupt
> >>> + controller you have.
> >>> + - interrupt-parent : the phandle for the interrupt controller
> >>> that
> >>> + services interrupts for this device.
> >>> + - pio-handle : The phandle for the Parallel I/O port
> >>> configuration.
> >>> +
> >>> + Required properties for network device_type:
> >>> + - mac-address : list of bytes representing the ethernet address.
> >>> + - rx-clock : a string represents the UCC receive clock source.
> >>> + "brgx" : clock source is BRG1~BRG16 respectively;
> >>> + "clkx" : clock source is QE_CLK1~QE_CLK24 respectively.
> >>> + others : clock source is disabled;
> >>> + - tx-clock: a string represents the UCC transmit clock source;
> >>> + "brgx" : clock source is BRG1~BRG16 respectively;
> >>> + "clkx" : clock source is QE_CLK1~QE_CLK24 respectively.
> >>> + others : clock source is disabled;
> >>> + - phy-handle : The phandle for the PHY connected to this
> >>> controller.
> >>> +
> >>> + Example:
> >>> + ucc@2000 {
> >>> + device_type = "network";
> >>> + compatible = "ucc_geth";
> >>> + model = "UCC";
> >>> + device-id = <1>;
> >>> + reg = <2000 200 8400 100>;
> >>> + interrupts = <a0 0>;
> >>> + interrupt-parent = <700>;
> >>> + mac-address = [ 00 04 9f 00 23 23 ];
> >>> + rx-clock = "none";
> >>> + tx-clock = "clk9";
> >>> + phy-handle = <212000>;
> >>> + pio-handle = <140001>;
> >>> + };
> >>> +
> >>> +
> >>> + 5) Parallel I/O Ports
> >>> +
> >>> + This node configures Parallel I/O ports for CPUs with QE
> >>> support.
> >>> + The node should reside in the "soc" node of the tree. For each
> >>> + device that using parallel I/O ports, a child node should be
> >>> created.
> >>> + See the definition of the Pin configuration nodes below for more
> >>> + information.
> >>> +
> >>> + Required properties:
> >>> + - device_type : should be "par_io".
> >>> + - reg : offset to the register set and its length.
> >>> +
> >>> + Example:
> >>> + par_io@1400 {
> >>> + reg = <1400 100>;
> >>> + #address-cells = <1>;
> >>> + #size-cells = <0>;
> >>> + device_type = "par_io";
> >>> + ucc_pin@01 {
> >>> + ......
> >>> + };
> >>> +
> >>
> >> Can you explain this further, I'm not getting the relationship
> >> between a par_io & ucc_pin. An example maybe helpful.
> >
> > Each QE device needs to configure Parallel I/O Ports pin
> > configuration in order to work, for example the configuration for
> > ucc1 is ucc_pin@01. par_io is a container for all these
> > configurations and gives the base for parallel io port register. I
> > will paste dts file for 8360 to give an example.
> >>
> >>> +
> >>> + 6) Pin configuration nodes
> >>> +
> >>> + Required properties:
> >>> + - linux,phandle : phandle of this node; likely referenced by
> >>> a QE
> >>> + device.
> >>> + - pio-map : array of pin configurations. Each pin is defined
> >>> by 6
> >>> + integers. The six numbers are respectively: port, pin, dir,
> >>> + open_drain, assignment, has_irq.
> >>> + - port : port number of the pin; 0-6 represent port A-G in UM.
> >>> + - pin : pin number in the port.
> >>> + - dir : direction of the pin, should encode as follows:
> >>> +
> >>> + 0 = The pin is disabled
> >>> + 1 = The pin is an output
> >>> + 2 = The pin is an input
> >>> + 3 = The pin is I/O
> >>> +
> >>> + - open_drain : indicates the pin is normal or wired-OR:
> >>> +
> >>> + 0 = The pin is actively driven as an output
> >>> + 1 = The pin is an open-drain driver. As an output, the pin is
> >>> + driven active-low, otherwise it is three-stated.
> >>> +
> >>> + - assignment : function number of the pin according to the
> >>> Pin Assignment
> >>> + tables in User Manual. Each pin can have up to 4 possible
> >>> functions in
> >>> + QE and two options for CPM.
> >>> + - has_irq : indicates if the pin is used as source of exteral
> >>> + interrupts.
> >>> +
> >>> + Example:
> >>> + ucc_pin@01 {
> >>> + linux,phandle = <140001>;
> >>> + pio-map = <
> >>> + /* port pin dir open_drain assignment has_irq */
> >>> + 0 3 1 0 1 0 /* TxD0 */
> >>> + 0 4 1 0 1 0 /* TxD1 */
> >>> + 0 5 1 0 1 0 /* TxD2 */
> >>> + 0 6 1 0 1 0 /* TxD3 */
> >>> + 1 6 1 0 3 0 /* TxD4 */
> >>> + 1 7 1 0 1 0 /* TxD5 */
> >>> + 1 9 1 0 2 0 /* TxD6 */
> >>> + 1 a 1 0 2 0 /* TxD7 */
> >>> + 0 9 2 0 1 0 /* RxD0 */
> >>> + 0 a 2 0 1 0 /* RxD1 */
> >>> + 0 b 2 0 1 0 /* RxD2 */
> >>> + 0 c 2 0 1 0 /* RxD3 */
> >>> + 0 d 2 0 1 0 /* RxD4 */
> >>> + 1 1 2 0 2 0 /* RxD5 */
> >>> + 1 0 2 0 2 0 /* RxD6 */
> >>> + 1 4 2 0 2 0 /* RxD7 */
> >>> + 0 7 1 0 1 0 /* TX_EN */
> >>> + 0 8 1 0 1 0 /* TX_ER */
> >>> + 0 f 2 0 1 0 /* RX_DV */
> >>> + 0 10 2 0 1 0 /* RX_ER */
> >>> + 0 0 2 0 1 0 /* RX_CLK */
> >>> + 2 9 1 0 3 0 /* GTX_CLK - CLK10 */
> >>> + 2 8 2 0 1 0>; /* GTX125 - CLK9 */
> >>> + };
> >>> +
> >>> +
> >>> More devices will be defined as this spec matures.
> >>>
> >>>
> >>> _______________________________________________
> >>> Linuxppc-dev mailing list
> >>> Linuxppc-dev@ozlabs.org
> >>> https://ozlabs.org/mailman/listinfo/linuxppc-dev
> > _______________________________________________
> > Linuxppc-dev mailing list
> > Linuxppc-dev@ozlabs.org
> > https://ozlabs.org/mailman/listinfo/linuxppc-dev
^ permalink raw reply
* Re: MPC8548 PCIe / PCI support with BSP MPC8548CDS 02/24/2006
From: Florian Boelstler @ 2006-07-03 6:38 UTC (permalink / raw)
To: linuxppc-embedded
In-Reply-To: <9FCDBA58F226D911B202000BDBAD467306DD12EC@zch01exm40.ap.freescale.net>
Hi,
Zhang Wei-r63237 schrieb:
> Yes, I think so. You can plug a PCIe ethernet card to test it.
A single device always works.
> :-), Maybe it's need more study. Could you enable the DEBUG and post the kernel verbose message?
We added lots of debug output and made some modifications (mostly delays
between calls to early_read_config_dword() and
early_write_config_dword() in pci_auto.c) and came to the conclusion
that generic bridge devices (PCIe-to-PCI), even in a cascaded setup of
three bridges, work fine.
However a PCIe switch (PLX8516/8532) doesn't work. The MPC8548 only
detects a single device (i.e. primary side of the switch).
We are going to analyze the problem more deeply soon. It seems that the
configuration space of that devices isn't properly set up.
The provided patch doesn't make any difference, besides that it is moved
to a location where the PPC itself is not detected.
Please keep us informed if there is any progress besides Freescale, as I
will do.
Cheers,
Florian
^ permalink raw reply
* How do you set up a PPC440GX with a PHY on emac2 only?
From: Howard, Marc @ 2006-07-03 5:41 UTC (permalink / raw)
To: linuxppc-embedded
[-- Attachment #1: Type: text/plain, Size: 396 bytes --]
Hi,
Does anyone have any pointers/tips on how to set up a ocotea-like PPC440GX design with only a single gigabit (Cicada) PHY on emac2? Editing ocotea_set_emacdata() to just define a single PHY doesn't work correctly. It looks like this has something to do with the MII communtications being on the ZMII bridge on emac0 but defining emac0 doesn't help either.
Thanks,
Marc W. Howard
[-- Attachment #2: Type: text/html, Size: 829 bytes --]
^ permalink raw reply
* How do you set up a PPC440GX with a PHY on emac2 only?
From: Howard, Marc @ 2006-07-03 5:41 UTC (permalink / raw)
To: linuxppc-embedded
[-- Attachment #1: Type: text/plain, Size: 396 bytes --]
Hi,
Does anyone have any pointers/tips on how to set up a ocotea-like PPC440GX design with only a single gigabit (Cicada) PHY on emac2? Editing ocotea_set_emacdata() to just define a single PHY doesn't work correctly. It looks like this has something to do with the MII communtications being on the ZMII bridge on emac0 but defining emac0 doesn't help either.
Thanks,
Marc W. Howard
[-- Attachment #2: Type: text/html, Size: 829 bytes --]
^ permalink raw reply
* RE: [PATCH] powerpc:Fix rheap alignment problem
From: Li Yang-r58472 @ 2006-07-03 6:49 UTC (permalink / raw)
To: 'Pantelis Antoniou', Rune Torgersen
Cc: linuxppc-dev list, Paul Mackerras, linux-kernel
Buddy allocation is good in general, but doesn't mean it fits best in any condition. In this case for managing DPRAM/MURAM in Freescale soc, in most case we only put buffer descriptor in DPRAM. That means the alloc/free only occurs on initialization and unloading of the driver. So there are not supposed to be a lot of free operations. Buddy allocation will cause more internal fragment, in my humble opinion. And a free-list allocation is best fit in this case.
Best Regards,
Leo
> -----Original Message-----
> From: linuxppc-dev-bounces+leoli=freescale.com@ozlabs.org
> [mailto:linuxppc-dev-bounces+leoli=freescale.com@ozlabs.org] On Behalf Of
> Pantelis Antoniou
> Sent: Sunday, July 02, 2006 1:18 PM
> To: Rune Torgersen
> Cc: linuxppc-dev list; Paul Mackerras; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] powerpc:Fix rheap alignment problem
>
> On Sunday 02 July 2006 06:54, Rune Torgersen wrote:
> > From: Pantelis Antoniou
> > Sent: Sat 7/1/2006 9:50 AM
> > >Since genalloc is the blessed linux thing it might be best to use that &
> remove
> > >rheap completely. Oh well...
> >
> > Two problems with genalloc that I can see (for CPM programming):
> > 1) (minor) Does not have a way to specify alignment (genalloc does it for
> you)
> > 2) (major problerm, at least for me) Does not have a way to allocate a specified
> address in the pool.
> >
> > 2 is needed esp when programming MCC drivers, since a lot of the datastructures
> must be in DP RAM _and_ be in a specific spot. And if you cannot tell the
> allocator that I am using a specific address, then the allocator might very
> well give somebody else that portion of RAM. The only solution without a fixed
> allocator is to allocate ALL memory in the DP RAM and use your own allocator.
> >
>
> Yeah, that too.
>
> Too bad there are no main tree drivers like that, but they do exist.
>
> One could conceivably hack genalloc to do that, but will end up with
> something complex too.
>
> BTW, there are other uEngine based architectures with similar alignment
> requirements.
>
> So in conclusion, for the in-tree drivers genalloc is sufficient as an cpm
> memory allocator.
> For some out of tree drivers, it is not.
>
> Pantelis
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
^ 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