Re: 44x bug: funny TLB writes?
On Fri, 2007-09-21 at 15:42 +1000, David Gibson wrote: On Thu, Sep 20, 2007 at 10:34:12PM -0500, Hollis Blanchard wrote: I seem to have come across a strange bug while doing KVM development. It seems that the final tlbwe in finish_tlb (head_44x.S) is actually leaking RPN bits into the attribute word. When I set a breakpoint there and press enter on the serial console, I see r12=ef600703, which is the physical address of the UART on this chip (440EP), plus the correct permission bits at the bottom. Am I crazy? I'm not really looking to step through that assembly right now... Clearly (current) hardware is just ignoring these errant writes, but it should be fixed. A quick glance at the code suggests this is indeed wrong. Hurrah. Another reason to rewrite the 44x tlb miss handling. Just a quick fix would be fine too... ;) I'm just glad it's not a KVM bug, because when I dumped the TLB state and saw bizarre values I was getting really worried. PS. errant and error are not cognate, even if the chip doc writers think so... According to Merriam Webster, errant 2c is c : behaving wrongly an errant child, so I'm OK with it. -- Hollis Blanchard IBM Linux Technology Center ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH v2 2/4] Implement generic time of day clocksource for powerpc machines.
On Fri, Sep 21, 2007 at 02:59:31PM +1000, Paul Mackerras wrote: Daniel Walker writes: I don't think the RTC frequency isn't the same as the timebase? Seems like the RTC only case about seconds at the lowest level. If that's the case then the jiffies clock might be better to use .. The other thing I wonder is if the __USE_RTC boards might have lower level clocks that could be used instead .. It's OK, the RTC isn't what you think it is, it's a pair of CPU-internal registers which count seconds and nanoseconds. On processors with the RTC, tb_ticks_per_sec is initialized to 10. Trust me, this code is OK. :) Indeed.. I'm wondering if we should do a s/rtc/ppc601rtc/ or something. Otherwise people will keep making this mistake and be confused. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: 44x bug: funny TLB writes?
On Fri, Sep 21, 2007 at 01:38:34AM -0500, Hollis Blanchard wrote: On Fri, 2007-09-21 at 15:42 +1000, David Gibson wrote: On Thu, Sep 20, 2007 at 10:34:12PM -0500, Hollis Blanchard wrote: I seem to have come across a strange bug while doing KVM development. It seems that the final tlbwe in finish_tlb (head_44x.S) is actually leaking RPN bits into the attribute word. When I set a breakpoint there and press enter on the serial console, I see r12=ef600703, which is the physical address of the UART on this chip (440EP), plus the correct permission bits at the bottom. Am I crazy? I'm not really looking to step through that assembly right now... Clearly (current) hardware is just ignoring these errant writes, but it should be fixed. A quick glance at the code suggests this is indeed wrong. Hurrah. Another reason to rewrite the 44x tlb miss handling. Just a quick fix would be fine too... ;) I suppose. I'm just glad it's not a KVM bug, because when I dumped the TLB state and saw bizarre values I was getting really worried. PS. errant and error are not cognate, even if the chip doc writers think so... According to Merriam Webster, errant 2c is c : behaving wrongly an errant child, so I'm OK with it. Good heavens. No such usage mentioned in the Shorter OED, only as in knight errant. You Americans and your strange language :-p. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Triggered BUG_ON in prom.c/of_get_flat_dt_root()
Hi, I was able to boot the first cuImage build from a 2.6.23-rc7 kernel source on my AmigaOne. Unfortunately the kernel triggers a BUG_ON statement in of_get_flat_dt_root(), which is called in the probe function of my platform code. I wasn't able to capture the kernel log, but it looks similar to this: Invalid tag 0 scanning flattened device tree ! Invalid tag 0 scanning flattened device tree ! Invalid tag 0 scanning flattened device tree ! Invalid tag 0 scanning flattened device tree ! Bug in prom.c at line 162. This is the cuboot-amigaone.c file: #include ops.h #include stdio.h #include cuboot.h #include ppcboot.h static bd_t bd; extern char _dtb_start[], _dtb_end[]; static void platform_fixups(void) { dt_fixup_memory(bd.bi_memstart, bd.bi_memsize); dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 4, bd.bi_busfreq); } void platform_init(unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7) { CUBOOT_INIT(); ft_init(_dtb_start, _dtb_end - _dtb_start, 32); serial_console_init(); platform_ops.fixups = platform_fixups; } The device tree compiles fine, so I wonder what could trigger this problem. Any ideas? Thanks! regards, Gerhard -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 09/11] [POWERPC] iSeries: move detection of virtual tapes
+#if defined(CONFIG_VIOTAPE) || defined(CONFIG_VIOTAPE_MODULE) +/* Handle interrupt events for tape */ +static void __init handle_tape_event(struct HvLpEvent *event) +{ + struct vio_waitevent *we; + struct viotapelpevent *tevent = (struct viotapelpevent *)event; I think we should generate these device tree entires unconditionally. They're just a conversion of what the iseries firmware/hypervisor provides and not dependent on a specific driver. (dito for the other patches with the same scheme) ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 09/11] [POWERPC] iSeries: move detection of virtual tapes
On Fri, 21 Sep 2007 10:29:52 +0200 Christoph Hellwig [EMAIL PROTECTED] wrote: I think we should generate these device tree entires unconditionally. They're just a conversion of what the iseries firmware/hypervisor provides and not dependent on a specific driver. (dito for the other patches with the same scheme) You are right, of course. I will redo the relevant patches. -- Cheers, Stephen Rothwell[EMAIL PROTECTED] http://www.canb.auug.org.au/~sfr/ pgpJF3LzfofmA.pgp Description: PGP signature ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 1/3] PowerPC: Introduce cpu_setup functionality to 44x platform
This adds cpu_setup functionality for ppc44x platform. Low level cpu-spefic initialization routines should be placed in cpu_setup_44x.S and a callback should be added to cputable. The cpu_setup is invoked by identify_cpu() function at early init. Signed-off-by: Valentine Barshak [EMAIL PROTECTED] --- arch/powerpc/kernel/Makefile|1 + arch/powerpc/kernel/cpu_setup_44x.S | 19 +++ arch/powerpc/kernel/cputable.c | 13 +++-- 3 files changed, 27 insertions(+), 6 deletions(-) diff -ruN linux-2.6.orig/arch/powerpc/kernel/cpu_setup_44x.S linux-2.6/arch/powerpc/kernel/cpu_setup_44x.S --- linux-2.6.orig/arch/powerpc/kernel/cpu_setup_44x.S 1970-01-01 03:00:00.0 +0300 +++ linux-2.6/arch/powerpc/kernel/cpu_setup_44x.S 2007-09-21 17:04:20.0 +0400 @@ -0,0 +1,19 @@ +/* + * This file contains low level CPU setup functions. + * Valentine Barshak [EMAIL PROTECTED] + * MontaVista Software, Inc (c) 2007 + * + * Based on cpu_setup_6xx code by + * Benjamin Herrenschmidt [EMAIL PROTECTED] + * + * 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 asm/processor.h +#include asm/cputable.h +#include asm/ppc_asm.h + diff -ruN linux-2.6.orig/arch/powerpc/kernel/cputable.c linux-2.6/arch/powerpc/kernel/cputable.c --- linux-2.6.orig/arch/powerpc/kernel/cputable.c 2007-09-21 14:56:40.0 +0400 +++ linux-2.6/arch/powerpc/kernel/cputable.c2007-09-21 17:04:50.0 +0400 @@ -1319,17 +1319,18 @@ for (i = 0; i ARRAY_SIZE(cpu_specs); i++,s++) if ((pvr s-pvr_mask) == s-pvr_value) { *cur = cpu_specs + i; -#ifdef CONFIG_PPC64 - /* ppc64 expects identify_cpu to also call setup_cpu -* for that processor. I will consolidate that at a -* later time, for now, just use our friend #ifdef. +#if defined(CONFIG_PPC64) || defined(CONFIG_BOOKE) + /* ppc64 and booke expect identify_cpu to also call +* setup_cpu for that processor. I will consolidate +* that at a later time, for now, just use #ifdef. * we also don't need to PTRRELOC the function pointer -* on ppc64 as we are running at 0 in real mode. +* on ppc64 and booke as we are running at 0 in real +* mode on ppc64 and reloc_offset is always 0 on booke. */ if (s-cpu_setup) { s-cpu_setup(offset, s); } -#endif /* CONFIG_PPC64 */ +#endif /* CONFIG_PPC64 || CONFIG_BOOKE */ return s; } BUG(); diff -ruN linux-2.6.orig/arch/powerpc/kernel/Makefile linux-2.6/arch/powerpc/kernel/Makefile --- linux-2.6.orig/arch/powerpc/kernel/Makefile 2007-09-21 14:56:40.0 +0400 +++ linux-2.6/arch/powerpc/kernel/Makefile 2007-09-21 17:04:20.0 +0400 @@ -56,6 +56,7 @@ udbg.o misc.o io.o obj-$(CONFIG_PPC32)+= entry_32.o setup_32.o misc_32.o obj-$(CONFIG_PPC64)+= misc_64.o dma_64.o iommu.o +obj-$(CONFIG_44x) += cpu_setup_44x.o obj-$(CONFIG_PPC_MULTIPLATFORM)+= prom_init.o obj-$(CONFIG_MODULES) += ppc_ksyms.o obj-$(CONFIG_BOOTX_TEXT) += btext.o ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 2/3] PowerPC: Move 440EP(x) FPU setup from head_44x to cpu_setup_4xx
The PowerPC 440EP(x) FPU init is currently done in head_44x under ifdefs. Since we should support more then one board in the same kernel, we move FPU initialization code from head_44x to cpu_setup_44x and add cpu_setup callbacks for 440EP(x). Signed-off-by: Valentine Barshak [EMAIL PROTECTED] --- arch/powerpc/kernel/cpu_setup_44x.S | 14 ++ arch/powerpc/kernel/cputable.c |6 ++ arch/powerpc/kernel/head_44x.S | 10 -- 3 files changed, 20 insertions(+), 10 deletions(-) diff -ruN linux-2.6.orig/arch/powerpc/kernel/cpu_setup_44x.S linux-2.6/arch/powerpc/kernel/cpu_setup_44x.S --- linux-2.6.orig/arch/powerpc/kernel/cpu_setup_44x.S 2007-09-21 16:18:35.0 +0400 +++ linux-2.6/arch/powerpc/kernel/cpu_setup_44x.S 2007-09-21 16:17:03.0 +0400 @@ -17,3 +17,17 @@ #include asm/cputable.h #include asm/ppc_asm.h +_GLOBAL(__setup_cpu_440ep) + b __init_fpu_44x +_GLOBAL(__setup_cpu_440epx) + b __init_fpu_44x + +/* enable APU between CPU and FPU */ +_GLOBAL(__init_fpu_44x) + mfspr r3,SPRN_CCR0 + /* Clear DAPUIB flag in CCR0 */ + rlwinm r3,r3,0,12,10 + mtspr SPRN_CCR0,r3 + isync + blr + diff -ruN linux-2.6.orig/arch/powerpc/kernel/cputable.c linux-2.6/arch/powerpc/kernel/cputable.c --- linux-2.6.orig/arch/powerpc/kernel/cputable.c 2007-09-21 16:18:22.0 +0400 +++ linux-2.6/arch/powerpc/kernel/cputable.c2007-09-21 16:17:05.0 +0400 @@ -31,6 +31,8 @@ * and ppc64 */ #ifdef CONFIG_PPC32 +extern void __setup_cpu_440ep(unsigned long offset, struct cpu_spec* spec); +extern void __setup_cpu_440epx(unsigned long offset, struct cpu_spec* spec); extern void __setup_cpu_603(unsigned long offset, struct cpu_spec* spec); extern void __setup_cpu_604(unsigned long offset, struct cpu_spec* spec); extern void __setup_cpu_750(unsigned long offset, struct cpu_spec* spec); @@ -,6 +1113,7 @@ .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU, .icache_bsize = 32, .dcache_bsize = 32, + .cpu_setup = __setup_cpu_440ep, .platform = ppc440, }, { @@ -1121,6 +1124,7 @@ .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU, .icache_bsize = 32, .dcache_bsize = 32, + .cpu_setup = __setup_cpu_440ep, .platform = ppc440, }, { /* 440EPX */ @@ -1131,6 +1135,8 @@ .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU, .icache_bsize = 32, .dcache_bsize = 32, + .cpu_setup = __setup_cpu_440epx, + .platform = ppc440, }, { /* 440GRX */ .pvr_mask = 0xfffb, diff -ruN linux-2.6.orig/arch/powerpc/kernel/head_44x.S linux-2.6/arch/powerpc/kernel/head_44x.S --- linux-2.6.orig/arch/powerpc/kernel/head_44x.S 2007-09-21 16:19:04.0 +0400 +++ linux-2.6/arch/powerpc/kernel/head_44x.S2007-09-21 16:00:17.0 +0400 @@ -217,16 +217,6 @@ lis r4,[EMAIL PROTECTED]/* IVPR only uses the high 16-bits */ mtspr SPRN_IVPR,r4 -#if defined(CONFIG_440EP) || defined(CONFIG_440EPX) - /* Clear DAPUIB flag in CCR0 (enable APU between CPU and FPU) */ - mfspr r2,SPRN_CCR0 - lis r3,0xffef - ori r3,r3,0x - and r2,r2,r3 - mtspr SPRN_CCR0,r2 - isync -#endif - /* * This is where the main kernel code starts. */ ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 3/3] PowerPC: 440EPx/GRx incorrect write to DDR SDRAM errata workaround
Add a workaround for PowerPC 440EPx/GRx incorrect write to DDR SDRAM errata. Data can be written to wrong address in SDRAM when write pipelining enabled on plb0. We disable it in the cpu_setup for these processors at early init. Signed-off-by: Valentine Barshak [EMAIL PROTECTED] --- arch/powerpc/kernel/cpu_setup_44x.S | 25 - arch/powerpc/kernel/cputable.c |3 +++ 2 files changed, 27 insertions(+), 1 deletion(-) diff -ruN linux-2.6.orig/arch/powerpc/kernel/cpu_setup_44x.S linux-2.6/arch/powerpc/kernel/cpu_setup_44x.S --- linux-2.6.orig/arch/powerpc/kernel/cpu_setup_44x.S 2007-09-21 15:31:14.0 +0400 +++ linux-2.6/arch/powerpc/kernel/cpu_setup_44x.S 2007-09-21 16:07:12.0 +0400 @@ -20,7 +20,14 @@ _GLOBAL(__setup_cpu_440ep) b __init_fpu_44x _GLOBAL(__setup_cpu_440epx) - b __init_fpu_44x + mflrr4 + bl __init_fpu_44x + bl __plb_disable_wrp + mtlrr4 + blr +_GLOBAL(__setup_cpu_440grx) + b __plb_disable_wrp + /* enable APU between CPU and FPU */ _GLOBAL(__init_fpu_44x) @@ -31,3 +38,19 @@ isync blr +/* + * Workaround for the incorrect write to DDR SDRAM errata. + * The write address can be corrupted during writes to + * DDR SDRAM when write pipelining is enabled on PLB0. + * Disable write pipelining here. + */ +#define DCRN_PLB4A0_ACR0x81 + +_GLOBAL(__plb_disable_wrp) + mfdcr r3,DCRN_PLB4A0_ACR + /* clear WRP bit in PLB4A0_ACR */ + rlwinm r3,r3,0,8,6 + mtdcr DCRN_PLB4A0_ACR,r3 + isync + blr + diff -ruN linux-2.6.orig/arch/powerpc/kernel/cputable.c linux-2.6/arch/powerpc/kernel/cputable.c --- linux-2.6.orig/arch/powerpc/kernel/cputable.c 2007-09-21 15:55:23.0 +0400 +++ linux-2.6/arch/powerpc/kernel/cputable.c2007-09-21 16:08:23.0 +0400 @@ -33,6 +33,7 @@ #ifdef CONFIG_PPC32 extern void __setup_cpu_440ep(unsigned long offset, struct cpu_spec* spec); extern void __setup_cpu_440epx(unsigned long offset, struct cpu_spec* spec); +extern void __setup_cpu_440grx(unsigned long offset, struct cpu_spec* spec); extern void __setup_cpu_603(unsigned long offset, struct cpu_spec* spec); extern void __setup_cpu_604(unsigned long offset, struct cpu_spec* spec); extern void __setup_cpu_750(unsigned long offset, struct cpu_spec* spec); @@ -1146,6 +1147,8 @@ .cpu_user_features = COMMON_USER_BOOKE, .icache_bsize = 32, .dcache_bsize = 32, + .cpu_setup = __setup_cpu_440grx, + .platform = ppc440, }, { /* 440GP Rev. B */ .pvr_mask = 0xffff, ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: AMCC yosemite 440ep PCI slot doesn't work.
Andrew Liu wrote: Hello All, when insert a RealTek RTL8139 network card into PCI slot, After system boot up, [EMAIL PROTECTED]:/root ifconfig eth2 192.168.17.12 irq 25: nobody cared (try booting with the irqpoll option) Call Trace: [cf135af0] [c0008820] show_stack+0x48/0x190 (unreliable) [cf135b20] [c003c414] __report_bad_irq+0x34/0xac [cf135b40] [c003c714] note_interrupt+0x288/0x2c8 [cf135b70] [c003b818] __do_IRQ+0x104/0x110 [cf135b90] [c0006900] do_IRQ+0xbc/0xc0 [cf135ba0] [c00020c0] ret_from_except+0x0/0x18 [cf135c60] [0019] 0x19 [cf135c90] [c000668c] do_softirq+0x54/0x58 [cf135ca0] [c001df40] irq_exit+0x48/0x58 [cf135cb0] [c00068b4] do_IRQ+0x70/0xc0 [cf135cc0] [c00020c0] ret_from_except+0x0/0x18 [cf135d80] [c003c2b4] setup_irq+0x1ac/0x200 [cf135da0] [c003c3cc] request_irq+0xc4/0xd8 [cf135dd0] [c0122328] rtl8139_open+0x38/0x210 [cf135df0] [c0187500] dev_open+0x7c/0xcc [cf135e10] [c0187420] dev_change_flags+0x16c/0x1d0 [cf135e30] [c01cbff0] devinet_ioctl+0x604/0x720 [cf135ea0] [c01cc1f8] inet_ioctl+0x98/0xbc [cf135eb0] [c0179328] sock_ioctl+0x60/0x260 [cf135ed0] [c006c360] do_ioctl+0x38/0x84 [cf135ee0] [c006c438] vfs_ioctl+0x8c/0x40c [cf135f10] [c006c7f8] sys_ioctl+0x40/0x74 [cf135f40] [c0001a84] ret_from_syscall+0x0/0x3c handlers: [c0122bd4] (rtl8139_interrupt+0x0/0x52c) Disabling IRQ #25 [EMAIL PROTECTED]:/root Message from [EMAIL PROTECTED] at Thu Jan 1 00:02:13 1970 ... localhost kernel: Disabling IRQ #25 [EMAIL PROTECTED]:/root The system boot up information as follows: [EMAIL PROTECTED]:/root dmesg Linux version 2.6.23-rc6-gea60adb5 ([EMAIL PROTECTED]) (gcc version 4.0.0 (DENX ELDK 4.1 4.0.0)) #3 Fri Sep 21 18:37:59 CST 2007 AMCC PowerPC 440EP Yosemite Platform Entering add_active_range(0, 0, 65536) 0 entries of 256 used Zone PFN ranges: DMA 0 -65536 Normal 65536 -65536 Movable zone start PFN for each node early_node_map[1] active PFN ranges 0:0 -65536 On node 0 totalpages: 65536 DMA zone: 512 pages used for memmap DMA zone: 0 pages reserved DMA zone: 65024 pages, LIFO batch:15 Normal zone: 0 pages used for memmap Movable zone: 0 pages used for memmap Built 1 zonelists in Zone order. Total pages: 65024 Kernel command line: root=/dev/nfs rw nfsroot=128.224.149.6:/tftpboot/sliu/rootfs ip=128.224.149.11::128.224.149.1:255.255.255.0:yosemite:eth0:off console=ttyS0,9600 PID hash table entries: 1024 (order: 10, 4096 bytes) console [ttyS0] enabled Dentry cache hash table entries: 32768 (order: 5, 131072 bytes) Inode-cache hash table entries: 16384 (order: 4, 65536 bytes) Memory: 256896k available (2052k kernel code, 716k data, 152k init, 0k highmem) Calibrating delay loop... 798.72 BogoMIPS (lpj=1597440) Mount-cache hash table entries: 512 NET: Registered protocol family 16 PCI: Probing PCI hardware PCI: Scanning bus :00 PCI: Found :00:0c.0 [10ec/8139] 000200 00 PCI: Calling quirk c000444c for :00:0c.0 PCI: Fixups for bus :00 PCI: Bus scan for :00 returning with max=00 PCI: fixup irq: (:00:0c.0) got 25 SCSI subsystem initialized usbcore: registered new interface driver usbfs usbcore: registered new interface driver hub usbcore: registered new device driver usb NET: Registered protocol family 2 IP route cache hash table entries: 2048 (order: 1, 8192 bytes) TCP established hash table entries: 8192 (order: 4, 65536 bytes) TCP bind hash table entries: 8192 (order: 3, 32768 bytes) TCP: Hash tables configured (established 8192 bind 8192) TCP reno registered io scheduler noop registered io scheduler anticipatory registered (default) io scheduler deadline registered io scheduler cfq registered PCI: Calling quirk c00fbab4 for :00:0c.0 PCI: Calling quirk c02ae3b8 for :00:0c.0 Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled serial8250: ttyS0 at MMIO 0x0 (irq = 0) is a 16550A serial8250: ttyS1 at MMIO 0x0 (irq = 1) is a 16550A RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize PPC 4xx OCP EMAC driver, version 3.54 mal0: initialized, 4 TX channels, 2 RX channels zmii0: bridge in RMII mode eth0: emac0, MAC 00:10:ec:00:87:42 eth0: found Generic MII PHY (0x01) eth1: emac1, MAC 00:00:00:00:00:00 eth1: found Generic MII PHY (0x03) 8139too Fast Ethernet driver 0.9.28 eth2: RealTek RTL8139 at 0xd1012f00, 00:0e:2e:7e:f5:e6, IRQ 25 eth2: Identified 8139 chip type 'RTL-8100B/8139D' pegasus: v0.6.14 (2006/09/27), Pegasus/Pegasus II USB Ethernet driver usbcore: registered new interface driver pegasus Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2 ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx usbmon: debugfs is not available ohci_hcd: 2006 August 04 USB 1.1 'Open' Host Controller (OHCI) Driver ppc-soc-ohci ppc-soc-ohci.0: USB Host Controller ppc-soc-ohci ppc-soc-ohci.0: new USB bus registered, assigned bus number 1 ppc-soc-ohci
DTC Patch for Cygwin
Changes required to compile DTC under Cygwin === --- dtc-org.orig/tests/supernode_atdepth_offset.c +++ dtc-org/tests/supernode_atdepth_offset.c @@ -63,8 +63,11 @@ int path_prefix(const char *path, int de return 1; p = path; - for (i = 0; i depth; i++) - p = strchrnul(p+1, '/'); + for (i = 0; i depth; i++) { + p = strchr(p+1, '/'); + if (!p) + p = path + strlen(path); + } return p - path; } Index: dtc-org/tests/testutils.c === --- dtc-org.orig/tests/testutils.c +++ dtc-org/tests/testutils.c @@ -52,10 +52,9 @@ static void sigint_handler(int signum, s void test_init(int argc, char *argv[]) { int err; - struct sigaction sa_int = { - .sa_sigaction = sigint_handler, - }; + struct sigaction sa_int; + sa_int.sa_sigaction = sigint_handler, test_name = argv[0]; err = sigaction(SIGINT, sa_int, NULL); Index: dtc-org/tests/trees.S === --- dtc-org.orig/tests/trees.S +++ dtc-org/tests/trees.S @@ -17,10 +17,16 @@ .byte ((val) 8) 0xff ; \ .byte (val) 0xff +#ifdef __CYGWIN__ +#define TREE_SYMBOL(tree) __##tree +#else +#define TREE_SYMBOL(tree) _##tree +#endif + #define TREE_HDR(tree) \ .balign 4 ; \ - .globl _##tree ; \ -_##tree: \ + .globl TREE_SYMBOL(tree); \ +TREE_SYMBOL(tree): \ tree: \ FDTLONG(FDT_MAGIC) ; \ FDTLONG(tree##_end - tree) ; \ Index: dtc-org/tests/tests.h === --- dtc-org.orig/tests/tests.h +++ dtc-org/tests/tests.h @@ -130,4 +130,15 @@ const void *check_getprop(void *fdt, int void *load_blob_arg(int argc, char *argv[]); void save_blob(const char *filename, void *blob); +#ifndef GLIBC +#define strndupa(my_str, my_len) \ + ({ \ + char *new_str=alloca((my_len) + 1); \ + strncpy(new_str, my_str, my_len); \ + new_str[my_len]='\0'; \ + new_str; \ + }) + +#endif + #endif /* _TESTS_H */ Matt Tyrlik___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
AMCC yosemite 440ep PCI slot doesn't work.
Hello All, when insert a RealTek RTL8139 network card into PCI slot, After system boot up, [EMAIL PROTECTED]:/root ifconfig eth2 192.168.17.12 irq 25: nobody cared (try booting with the irqpoll option) Call Trace: [cf135af0] [c0008820] show_stack+0x48/0x190 (unreliable) [cf135b20] [c003c414] __report_bad_irq+0x34/0xac [cf135b40] [c003c714] note_interrupt+0x288/0x2c8 [cf135b70] [c003b818] __do_IRQ+0x104/0x110 [cf135b90] [c0006900] do_IRQ+0xbc/0xc0 [cf135ba0] [c00020c0] ret_from_except+0x0/0x18 [cf135c60] [0019] 0x19 [cf135c90] [c000668c] do_softirq+0x54/0x58 [cf135ca0] [c001df40] irq_exit+0x48/0x58 [cf135cb0] [c00068b4] do_IRQ+0x70/0xc0 [cf135cc0] [c00020c0] ret_from_except+0x0/0x18 [cf135d80] [c003c2b4] setup_irq+0x1ac/0x200 [cf135da0] [c003c3cc] request_irq+0xc4/0xd8 [cf135dd0] [c0122328] rtl8139_open+0x38/0x210 [cf135df0] [c0187500] dev_open+0x7c/0xcc [cf135e10] [c0187420] dev_change_flags+0x16c/0x1d0 [cf135e30] [c01cbff0] devinet_ioctl+0x604/0x720 [cf135ea0] [c01cc1f8] inet_ioctl+0x98/0xbc [cf135eb0] [c0179328] sock_ioctl+0x60/0x260 [cf135ed0] [c006c360] do_ioctl+0x38/0x84 [cf135ee0] [c006c438] vfs_ioctl+0x8c/0x40c [cf135f10] [c006c7f8] sys_ioctl+0x40/0x74 [cf135f40] [c0001a84] ret_from_syscall+0x0/0x3c handlers: [c0122bd4] (rtl8139_interrupt+0x0/0x52c) Disabling IRQ #25 [EMAIL PROTECTED]:/root Message from [EMAIL PROTECTED] at Thu Jan 1 00:02:13 1970 ... localhost kernel: Disabling IRQ #25 [EMAIL PROTECTED]:/root The system boot up information as follows: [EMAIL PROTECTED]:/root dmesg Linux version 2.6.23-rc6-gea60adb5 ([EMAIL PROTECTED]) (gcc version 4.0.0 (DENX ELDK 4.1 4.0.0)) #3 Fri Sep 21 18:37:59 CST 2007 AMCC PowerPC 440EP Yosemite Platform Entering add_active_range(0, 0, 65536) 0 entries of 256 used Zone PFN ranges: DMA 0 -65536 Normal 65536 -65536 Movable zone start PFN for each node early_node_map[1] active PFN ranges 0:0 -65536 On node 0 totalpages: 65536 DMA zone: 512 pages used for memmap DMA zone: 0 pages reserved DMA zone: 65024 pages, LIFO batch:15 Normal zone: 0 pages used for memmap Movable zone: 0 pages used for memmap Built 1 zonelists in Zone order. Total pages: 65024 Kernel command line: root=/dev/nfs rw nfsroot=128.224.149.6:/tftpboot/sliu/rootfs ip=128.224.149.11::128.224.149.1:255.255.255.0:yosemite:eth0:off console=ttyS0,9600 PID hash table entries: 1024 (order: 10, 4096 bytes) console [ttyS0] enabled Dentry cache hash table entries: 32768 (order: 5, 131072 bytes) Inode-cache hash table entries: 16384 (order: 4, 65536 bytes) Memory: 256896k available (2052k kernel code, 716k data, 152k init, 0k highmem) Calibrating delay loop... 798.72 BogoMIPS (lpj=1597440) Mount-cache hash table entries: 512 NET: Registered protocol family 16 PCI: Probing PCI hardware PCI: Scanning bus :00 PCI: Found :00:0c.0 [10ec/8139] 000200 00 PCI: Calling quirk c000444c for :00:0c.0 PCI: Fixups for bus :00 PCI: Bus scan for :00 returning with max=00 PCI: fixup irq: (:00:0c.0) got 25 SCSI subsystem initialized usbcore: registered new interface driver usbfs usbcore: registered new interface driver hub usbcore: registered new device driver usb NET: Registered protocol family 2 IP route cache hash table entries: 2048 (order: 1, 8192 bytes) TCP established hash table entries: 8192 (order: 4, 65536 bytes) TCP bind hash table entries: 8192 (order: 3, 32768 bytes) TCP: Hash tables configured (established 8192 bind 8192) TCP reno registered io scheduler noop registered io scheduler anticipatory registered (default) io scheduler deadline registered io scheduler cfq registered PCI: Calling quirk c00fbab4 for :00:0c.0 PCI: Calling quirk c02ae3b8 for :00:0c.0 Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled serial8250: ttyS0 at MMIO 0x0 (irq = 0) is a 16550A serial8250: ttyS1 at MMIO 0x0 (irq = 1) is a 16550A RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize PPC 4xx OCP EMAC driver, version 3.54 mal0: initialized, 4 TX channels, 2 RX channels zmii0: bridge in RMII mode eth0: emac0, MAC 00:10:ec:00:87:42 eth0: found Generic MII PHY (0x01) eth1: emac1, MAC 00:00:00:00:00:00 eth1: found Generic MII PHY (0x03) 8139too Fast Ethernet driver 0.9.28 eth2: RealTek RTL8139 at 0xd1012f00, 00:0e:2e:7e:f5:e6, IRQ 25 eth2: Identified 8139 chip type 'RTL-8100B/8139D' pegasus: v0.6.14 (2006/09/27), Pegasus/Pegasus II USB Ethernet driver usbcore: registered new interface driver pegasus Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2 ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx usbmon: debugfs is not available ohci_hcd: 2006 August 04 USB 1.1 'Open' Host Controller (OHCI) Driver ppc-soc-ohci ppc-soc-ohci.0: USB Host Controller ppc-soc-ohci ppc-soc-ohci.0: new USB bus registered, assigned bus number 1 ppc-soc-ohci ppc-soc-ohci.0: irq 40, io mem 0xef601000 usb usb1: configuration #1 chosen from 1 choice hub 1-0:1.0: USB hub found hub 1-0:1.0: 2 ports
Re: [PATCH 08/10] bootwrapper: Add a firmware-independent raw target.
On 9/5/07, Scott Wood [EMAIL PROTECTED] wrote: This target produces a flat binary rather than an ELF file, fixes the entry point at the beginning of the image, and takes a complete device tree with no fixups needed. The device tree must have labels on /#address-cells, the timebase frequency, and the memory size. Signed-off-by: Scott Wood [EMAIL PROTECTED] --- diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index 02f0fe0..2a6a4c6 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -48,7 +48,8 @@ src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \ cpm-serial.c stdlib.c planetcore.c src-plat := of.c cuboot-83xx.c cuboot-85xx.c holly.c \ cuboot-ebony.c treeboot-ebony.c prpmc2800.c \ - ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c cuboot-pq2.c + ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c \ + cuboot-8xx.c cuboot-pq2.c fixed-head.S raw-platform.c src-boot := $(src-wlib) $(src-plat) empty.c src-boot := $(addprefix $(obj)/, $(src-boot)) @@ -146,6 +147,7 @@ image-$(CONFIG_PPC_83xx)+= cuImage.83xx image-$(CONFIG_PPC_85xx) += cuImage.85xx image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony image-$(CONFIG_BAMBOO) += treeImage.bamboo +image-$(CONFIG_BUILD_RAW_IMAGE)+= zImage.raw endif # For 32-bit powermacs, build the COFF and miboot images Are these makefile changes complete? When I attempt to compile with this patch I get the following error: [EMAIL PROTECTED]:~/hacking/linux-2.6$ ppc4xx make CHK include/linux/version.h CHK include/linux/utsrelease.h CALLscripts/checksyscalls.sh CHK include/linux/compile.h make[1]: *** No rule to make target `arch/powerpc/boot/zImage.raw', needed by `arch/powerpc/boot/zImage'. Stop. make: *** [zImage] Error 2 [EMAIL PROTECTED]:~/hacking/linux-2.6$ Cheers, g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. [EMAIL PROTECTED] (403) 399-0195 ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 08/10] bootwrapper: Add a firmware-independent raw target.
On Fri, Sep 21, 2007 at 11:31:11AM -0600, Grant Likely wrote: Are these makefile changes complete? When I attempt to compile with this patch I get the following error: [EMAIL PROTECTED]:~/hacking/linux-2.6$ ppc4xx make CHK include/linux/version.h CHK include/linux/utsrelease.h CALLscripts/checksyscalls.sh CHK include/linux/compile.h make[1]: *** No rule to make target `arch/powerpc/boot/zImage.raw', needed by `arch/powerpc/boot/zImage'. Stop. make: *** [zImage] Error 2 [EMAIL PROTECTED]:~/hacking/linux-2.6$ Odd... It should match the zImage.% target. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: 44x bug: funny TLB writes?
On Fri, 2007-09-21 at 15:42 +1000, David Gibson wrote: On Thu, Sep 20, 2007 at 10:34:12PM -0500, Hollis Blanchard wrote: I seem to have come across a strange bug while doing KVM development. It seems that the final tlbwe in finish_tlb (head_44x.S) is actually leaking RPN bits into the attribute word. When I set a breakpoint there and press enter on the serial console, I see r12=ef600703, which is the physical address of the UART on this chip (440EP), plus the correct permission bits at the bottom. Am I crazy? I'm not really looking to step through that assembly right now... Clearly (current) hardware is just ignoring these errant writes, but it should be fixed. A quick glance at the code suggests this is indeed wrong. Hurrah. Another reason to rewrite the 44x tlb miss handling. Actually it's slightly worse than I thought. Not only are we setting 0 bits in the TLB word, I'm also seeing mappings like this: pid word0word1word2 0001 7fe4f210 00209000 00200349 That means WIMG=0011, which seems inappropriate for userspace mappings. (Oh and we're also writing to the only reserved bit in word2.) -- Hollis Blanchard IBM Linux Technology Center ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: DTC Patch for Cygwin
Scott Wood [EMAIL PROTECTED] wrote on 09/21/2007 02:46:39 PM: On Fri, Sep 21, 2007 at 11:26:04AM -0400, Matt Tyrlik wrote: Changes required to compile DTC under Cygwin === --- dtc-org.orig/tests/supernode_atdepth_offset.c +++ dtc-org/tests/supernode_atdepth_offset.c @@ -63,8 +63,11 @@ int path_prefix(const char *path, int de return 1; p = path; - for (i = 0; i depth; i++) - p = strchrnul(p+1, '/'); + for (i = 0; i depth; i++) { + p = strchr(p+1, '/'); + if (!p) + p = path + strlen(path); + } return p - path; } Maybe we should define strchrnul under #ifndef GLIBC, similar to strndupa? Since this is used only in one place David Gibson suggested that the change should be done in code. Index: dtc-org/tests/testutils.c === --- dtc-org.orig/tests/testutils.c +++ dtc-org/tests/testutils.c @@ -52,10 +52,9 @@ static void sigint_handler(int signum, s void test_init(int argc, char *argv[]) { int err; - struct sigaction sa_int = { - .sa_sigaction = sigint_handler, - }; + struct sigaction sa_int; + sa_int.sa_sigaction = sigint_handler, test_name = argv[0]; What version of GCC does cygwin use? That doesn't seem like something that should break due to OS differences. -Scott Currently 3.4.4. The compiler can't handle unnamed union in an initializer. Matt___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH v2 2/4] Implement generic time of day clocksource for powerpc machines.
On Fri, Sep 21, 2007 at 02:52:12PM +1000, Stephen Rothwell wrote: Small comments. Thanks. I think this is redundant as if __USE_RTC() is true, you register clocksource_rtc below. Yup you're right. The #ifdef is redundant since if CONFIG_ISERIES is not set, firmware_has_feature(FW_FEATURE_ISERIES) is constant 0. Ahh okay. I got too fancy for my own good. patch comming. Yours Tony linux.conf.auhttp://linux.conf.au/ || http://lca2008.linux.org.au/ Jan 28 - Feb 02 2008 The Australian Linux Technical Conference! ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH v3 2/4] Implement generic time of day clocksource for powerpc machines.
Signed-off-by: Tony Breeds [EMAIL PROTECTED] --- Updated to create a clocksource driver specific to the 601 Updated to address feedback from sfr Only compile tested. arch/powerpc/Kconfig |6 arch/powerpc/kernel/time.c | 255 - 2 files changed, 91 insertions(+), 170 deletions(-) Index: working/arch/powerpc/Kconfig === --- working.orig/arch/powerpc/Kconfig +++ working/arch/powerpc/Kconfig @@ -24,6 +24,12 @@ config MMU config GENERIC_CMOS_UPDATE def_bool y +config GENERIC_TIME + def_bool y + +config GENERIC_TIME_VSYSCALL + def_bool y + config GENERIC_HARDIRQS bool default y Index: working/arch/powerpc/kernel/time.c === --- working.orig/arch/powerpc/kernel/time.c +++ working/arch/powerpc/kernel/time.c @@ -73,9 +73,38 @@ #include asm/iseries/hv_call_xm.h #endif +/* powerpc clocksource/clockevent code */ + +#include linux/clocksource.h + +static cycle_t rtc_read(void); +static struct clocksource clocksource_rtc = { + .name = rtc, + .rating = 400, + .flags= CLOCK_SOURCE_IS_CONTINUOUS, + .mask = CLOCKSOURCE_MASK(64), + .shift= 22, + .mult = 0, /* To be filled in */ + .read = rtc_read, +}; + +static cycle_t timebase_read(void); +static struct clocksource clocksource_timebase = { + .name = timebase, + .rating = 400, + .flags= CLOCK_SOURCE_IS_CONTINUOUS, + .mask = CLOCKSOURCE_MASK(64), + .shift= 22, + .mult = 0, /* To be filled in */ + .read = timebase_read, +}; + #ifdef CONFIG_PPC_ISERIES static unsigned long __initdata iSeries_recal_titan; static signed long __initdata iSeries_recal_tb; + +/* Forward declaration is only needed for iSereis compiles */ +void __init clocksource_init(void); #endif #define XSEC_PER_SEC (1024*1024) @@ -343,65 +372,6 @@ void udelay(unsigned long usecs) } EXPORT_SYMBOL(udelay); -/* - * This version of gettimeofday has microsecond resolution. - */ -static inline void __do_gettimeofday(struct timeval *tv) -{ - unsigned long sec, usec; - u64 tb_ticks, xsec; - struct gettimeofday_vars *temp_varp; - u64 temp_tb_to_xs, temp_stamp_xsec; - - /* -* These calculations are faster (gets rid of divides) -* if done in units of 1/2^20 rather than microseconds. -* The conversion to microseconds at the end is done -* without a divide (and in fact, without a multiply) -*/ - temp_varp = do_gtod.varp; - - /* Sampling the time base must be done after loading -* do_gtod.varp in order to avoid racing with update_gtod. -*/ - data_barrier(temp_varp); - tb_ticks = get_tb() - temp_varp-tb_orig_stamp; - temp_tb_to_xs = temp_varp-tb_to_xs; - temp_stamp_xsec = temp_varp-stamp_xsec; - xsec = temp_stamp_xsec + mulhdu(tb_ticks, temp_tb_to_xs); - sec = xsec / XSEC_PER_SEC; - usec = (unsigned long)xsec (XSEC_PER_SEC - 1); - usec = SCALE_XSEC(usec, 100); - - tv-tv_sec = sec; - tv-tv_usec = usec; -} - -void do_gettimeofday(struct timeval *tv) -{ - if (__USE_RTC()) { - /* do this the old way */ - unsigned long flags, seq; - unsigned int sec, nsec, usec; - - do { - seq = read_seqbegin_irqsave(xtime_lock, flags); - sec = xtime.tv_sec; - nsec = xtime.tv_nsec + tb_ticks_since(tb_last_jiffy); - } while (read_seqretry_irqrestore(xtime_lock, seq, flags)); - usec = nsec / 1000; - while (usec = 100) { - usec -= 100; - ++sec; - } - tv-tv_sec = sec; - tv-tv_usec = usec; - return; - } - __do_gettimeofday(tv); -} - -EXPORT_SYMBOL(do_gettimeofday); /* * There are two copies of tb_to_xs and stamp_xsec so that no @@ -447,56 +417,6 @@ static inline void update_gtod(u64 new_t ++(vdso_data-tb_update_count); } -/* - * When the timebase - tb_orig_stamp gets too big, we do a manipulation - * between tb_orig_stamp and stamp_xsec. The goal here is to keep the - * difference tb - tb_orig_stamp small enough to always fit inside a - * 32 bits number. This is a requirement of our fast 32 bits userland - * implementation in the vdso. If we miss a call to this function - * (interrupt latency, CPU locked in a spinlock, ...) and we end up - * with a too big difference, then the vdso will fallback to calling - * the syscall - */ -static __inline__ void timer_recalc_offset(u64 cur_tb) -{ - unsigned long offset; - u64 new_stamp_xsec; - u64 tlen, t2x; -
[PATCH v2] pcmcia: Convert io_req_t to use kio_addr_t
Convert the io_req_t members to kio_addr_t, to allow use on machines with more than 16 bits worth of IO ports (i.e. secondary busses on ppc64, etc). I've also gone through the drivers, changed the few occurrances of ioaddr_t to kio_addr_t where relevant, and changed format strings for printk() and friends. There are still places where a kio_addr_t is casted to an int, but at the moment that's not causing problems. It should be cleaned up at some point in the future though. Signed-off-by: Olof Johansson [EMAIL PROTECTED] --- On Fri, Sep 14, 2007 at 03:48:54AM -0700, Andrew Morton wrote: On Wed, 5 Sep 2007 09:27:43 -0500 Olof Johansson [EMAIL PROTECTED] wrote: Convert the io_req_t members to kio_addr_t, to allow use on machines with more than 16 bits worth of IO port address space (ppc64 in this case, but it applies to others as well). drivers/usb/host/sl811_cs.c: In function 'sl811_cs_config': drivers/usb/host/sl811_cs.c:263: warning: format '%04x' expects type 'unsigned int', but argument 2 has type 'kio_addr_t' drivers/usb/host/sl811_cs.c:263: warning: format '%04x' expects type 'unsigned int', but argument 3 has type 'long unsigned int' That's not just a cosmetic thing - the printk can print junk and if there's a %s in the control string after the %x's, printk() will crash. I don't know how many instances of this are in the tree, but they'll all need to be found and fixed. I think I caught them all by now. Thanks, -Olof diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 4177f6d..b4f6036 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -308,7 +308,7 @@ static unsigned int calc_baudv(unsigned char fidi) return (wcrcf / wbrcf); } -static unsigned short io_read_num_rec_bytes(ioaddr_t iobase, unsigned short *s) +static unsigned short io_read_num_rec_bytes(kio_addr_t iobase, unsigned short *s) { unsigned short tmp; @@ -426,7 +426,7 @@ static struct card_fixup card_fixups[] = { static void set_cardparameter(struct cm4000_dev *dev) { int i; - ioaddr_t iobase = dev-p_dev-io.BasePort1; + kio_addr_t iobase = dev-p_dev-io.BasePort1; u_int8_t stopbits = 0x02; /* ISO default */ DEBUGP(3, dev, - set_cardparameter\n); @@ -459,7 +459,7 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq) unsigned short num_bytes_read; unsigned char pts_reply[4]; ssize_t rc; - ioaddr_t iobase = dev-p_dev-io.BasePort1; + kio_addr_t iobase = dev-p_dev-io.BasePort1; rc = 0; @@ -610,7 +610,7 @@ exit_setprotocol: return rc; } -static int io_detect_cm4000(ioaddr_t iobase, struct cm4000_dev *dev) +static int io_detect_cm4000(kio_addr_t iobase, struct cm4000_dev *dev) { /* note: statemachine is assumed to be reset */ @@ -671,7 +671,7 @@ static void terminate_monitor(struct cm4000_dev *dev) static void monitor_card(unsigned long p) { struct cm4000_dev *dev = (struct cm4000_dev *) p; - ioaddr_t iobase = dev-p_dev-io.BasePort1; + kio_addr_t iobase = dev-p_dev-io.BasePort1; unsigned short s; struct ptsreq ptsreq; int i, atrc; @@ -933,7 +933,7 @@ static ssize_t cmm_read(struct file *filp, __user char *buf, size_t count, loff_t *ppos) { struct cm4000_dev *dev = filp-private_data; - ioaddr_t iobase = dev-p_dev-io.BasePort1; + kio_addr_t iobase = dev-p_dev-io.BasePort1; ssize_t rc; int i, j, k; @@ -1054,7 +1054,7 @@ static ssize_t cmm_write(struct file *filp, const char __user *buf, size_t count, loff_t *ppos) { struct cm4000_dev *dev = (struct cm4000_dev *) filp-private_data; - ioaddr_t iobase = dev-p_dev-io.BasePort1; + kio_addr_t iobase = dev-p_dev-io.BasePort1; unsigned short s; unsigned char tmp; unsigned char infolen; @@ -1408,7 +1408,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { struct cm4000_dev *dev = filp-private_data; - ioaddr_t iobase = dev-p_dev-io.BasePort1; + kio_addr_t iobase = dev-p_dev-io.BasePort1; struct pcmcia_device *link; int size; int rc; diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index b24a3e7..3ecfc33 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c @@ -586,7 +586,7 @@ static int reader_config(struct pcmcia_device *link, int devno) dev-node.minor = devno; dev-node.next = dev-node; - DEBUGP(2, dev, device DEVICE_NAME %d at 0x%.4x-0x%.4x\n, devno, + DEBUGP(2, dev, device DEVICE_NAME %d at 0x%.4lx-0x%.4lx\n, devno, link-io.BasePort1, link-io.BasePort1+link-io.NumPorts1); DEBUGP(2, dev, - reader_config (succ)\n); diff --git
Re: [PATCH v2] pcmcia: Convert io_req_t to use kio_addr_t
On Fri, 21 Sep 2007 17:15:16 -0500 Olof Johansson [EMAIL PROTECTED] wrote: Convert the io_req_t members to kio_addr_t, to allow use on machines with more than 16 bits worth of IO ports (i.e. secondary busses on ppc64, etc). What about the formatting and field widths ? ulong would probably be a lot saner than kio_addr_t and yet more type obfuscation. Otherwise looks sensible to me ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 0/15] bootwrapper: kexec and external payloads
The following series of 15 patches implement support for 64-bit powerpc zImage to be loaded by kexec-tools the wrapper uses the same startup interface as the kernel support for obtaining the kernel externally to the zImage link including via searching for a path string in initramfs This is the third round of posting for most of the patches, which have been rebased to apply to for-2.6.24, and I ask they be considered for inclusion therein. I have ordered the series to apply needed functionality to get usable code for similar enviornments before fleshing out the feature set I am using. If desired I can reorder and rediff as requested. (for example, adding the smp hook could go with the smp marshalling support). The last patch is only needed for the qemu pathes below. Following the series are an additonal 2 patches to provide experimental platform support for running under qemu with its exiting powerpc prep emulation. One patch provides the support necessary to build the kernel, the second patch provides the wrapper changes and device tree to boot, including bulding a rom image. Once the rom is built, it can start a vmlinux elf when loaded into memory by qemu. Thanks for your consideration, milton ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 1/15] boot: find initrd location from device-tree
Some platforms have a boot agent that can create or modify properties in the device-tree and load images into memory. Provide a helper to set loader_info used by prep_initrd(). Signed-off-by: Milton Miller [EMAIL PROTECTED] Acked-by: David Gibson [EMAIL PROTECTED] --- re 12168 rediffed types.h, offset in ops.h Index: kernel/arch/powerpc/boot/ops.h === --- kernel.orig/arch/powerpc/boot/ops.h 2007-09-17 22:12:47.0 -0500 +++ kernel/arch/powerpc/boot/ops.h 2007-09-17 22:12:51.0 -0500 @@ -163,6 +163,7 @@ void dt_fixup_clock(const char *path, u3 void __dt_fixup_mac_addresses(u32 startindex, ...); #define dt_fixup_mac_addresses(...) \ __dt_fixup_mac_addresses(0, __VA_ARGS__, NULL) +void dt_find_initrd(void); static inline void *find_node_by_linuxphandle(const u32 linuxphandle) Index: kernel/arch/powerpc/boot/types.h === --- kernel.orig/arch/powerpc/boot/types.h 2007-09-17 22:12:47.0 -0500 +++ kernel/arch/powerpc/boot/types.h2007-09-17 22:12:51.0 -0500 @@ -12,6 +12,8 @@ typedef short s16; typedef ints32; typedef long long s64; +#define UINT_MAX 0x + #define min(x,y) ({ \ typeof(x) _x = (x); \ typeof(y) _y = (y); \ Index: kernel/arch/powerpc/boot/devtree.c === --- kernel.orig/arch/powerpc/boot/devtree.c 2007-09-17 22:12:47.0 -0500 +++ kernel/arch/powerpc/boot/devtree.c 2007-09-17 22:12:51.0 -0500 @@ -1,6 +1,7 @@ /* * devtree.c - convenience functions for device tree manipulation * Copyright 2007 David Gibson, IBM Corporation. + * Copyright 2007 Milton Miller, IBM Corporation. * Copyright (c) 2007 Freescale Semiconductor, Inc. * * Authors: David Gibson [EMAIL PROTECTED] @@ -333,3 +334,68 @@ int dt_is_compatible(void *node, const c return 0; } + +/** + * dt_find_initrd - set loader initrd location based on existing properties + * + * finds the linux,initrd-start and linux,initrd-end properties in + * the /chosen node and sets the loader initrd fields accordingly. + * + * Use this if your loader sets the properties to allow other code to + * relocate the tree and/or cause r3 and r4 to be set on true OF + * platforms. + */ +void dt_find_initrd(void) +{ + int rc; + unsigned long long initrd_start, initrd_end; + void *devp; + static const char start_prop[] = linux,initrd-start; + static const char end_prop[] = linux,initrd-end; + + devp = finddevice(/chosen); + if (! devp) { + return; + } + + rc = getprop(devp, start_prop, initrd_start, sizeof(initrd_start)); + if (rc 0) + return; /* not found */ + /* The properties had to be 8 bytes until 2.6.22 */ + if (rc == sizeof(unsigned long)) { + unsigned long tmp; + memcpy(tmp, initrd_start, rc); + initrd_start = tmp; + } else if (rc != sizeof(initrd_start)) {/* now they can be 4 */ + printf(unexpected length of %s in /chosen!\n\r, start_prop); + return; + } + + rc = getprop(devp, end_prop, initrd_end, sizeof(initrd_end)); + if (rc 0) { + printf(chosen has %s but no %s!\n\r, start_prop, end_prop); + return; + } + if (rc == sizeof(unsigned long)) { + unsigned long tmp; + memcpy(tmp, initrd_end, rc); + initrd_end = tmp; + } else if (rc != sizeof(initrd_end)) { + printf(unexpected length of %s in /chosen!\n\r, end_prop); + return; + } + + /* Check for presence, ignore if (partially) loaded above 32 bits */ + if (initrd_start == initrd_end) { + printf(ignoring empty device-tree supplied initrd\n); + } else if (initrd_start initrd_end) { + printf(ignoring device-tree supplied initrd: start 0x%llx + end 0x%llx \n, initrd_start, initrd_end); + } else if (initrd_end UINT_MAX) { + printf(ignoring device-tree supplied initrd: +end 0x%llx 32 bits\n, initrd_end); + } else { + loader_info.initrd_addr = initrd_start; + loader_info.initrd_size = initrd_end - initrd_start; + } +} ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 2/15] boot: record header bytes in gunzip_start
Record the number of header bytes skipped in the total bytes read field. This is needed for the initramfs parsing code to find the end of the zip file. Signed-off-by: Milton Miller [EMAIL PROTECTED] --- Identical to 12169 Index: kernel/arch/powerpc/boot/gunzip_util.c === --- kernel.orig/arch/powerpc/boot/gunzip_util.c 2007-07-10 03:33:34.0 -0500 +++ kernel/arch/powerpc/boot/gunzip_util.c 2007-07-10 03:40:59.0 -0500 @@ -78,6 +78,7 @@ void gunzip_start(struct gunzip_state *s fatal(inflateInit2 returned %d\n\r, r); } + state-s.total_in = hdrlen; state-s.next_in = src + hdrlen; state-s.avail_in = srclen - hdrlen; } ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 4/15] bootwrapper: smp support code
Support code to move cpus around, both a spin loop and c code to move the cpus before uncompressing and copying the kernel to 0. The low level code is designed to be included in a crt0 or other assembly file because it may need to be at a fixed location or there may be other entry point requirements. Note: this code works with kernel head_64.S. head_6xx.S needs the 0x60 entry point (it currently mentions something at address 0xC0; but the similar code is at 0xC4); the other heads don't appear to support SMP. Signed-off-by: Milton Miller [EMAIL PROTECTED] --- vs 12171 get barrier from io.h instead of adding to reg.h rediff ops.h, Makefile Index: kernel/arch/powerpc/boot/marshal_low.S === --- /dev/null 1970-01-01 00:00:00.0 + +++ kernel/arch/powerpc/boot/marshal_low.S 2007-09-17 22:13:14.0 -0500 @@ -0,0 +1,103 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright 2007 IBM Corporation. + * + * Authors: Milton Miller [EMAIL PROTECTED] + * + */ + +#include ppc_asm.h + + .text + /* +* This code is designed to be a kexec entry point block. +* That is, it has both code for the master cpu that begins +* at offset 0 as linked into the image, and a sequence of +* 0x100 bytes that, when copied to address 0, forms the +* wait loop for slave cpus. Each slave should have its +* unique hardware cpu identifier in r3 before entering +* this code. +*/ + .globl master +master: b _zimage_start_plat + + .global slave_wait +slave_wait: + /* r3 cpu id, r4 slaves_wait, r5 cpu bit, r6 cpu mask word offset */ + + /* set our bit in the slaves mask */ +98:lwarx r7,r4,r6 + or r8,r7,r5 + stwcx. r8,r4,r6 + bne 98b + + and.r8,r7,r5 + bnel- err_slave + +99:lwz r7,gohere-slave_wait(r4) + cmpwi 0,r7,0 + beq 99b + mtctr r7 + mr r4,r7 + bctr + + + .global gohere +gohere:.long 0 /* when set the slave moves */ + + +err_slave: + stw r5,slave_error-slave_wait(4)/* no locking */ + blr + + .globl slave_error /* set when slave detects error */ +slave_error: + .long 0 + + /* +* The slaves may be in 32 or 64 bit mode, we don't care +* r3 is the slave cpu number, matching the device tree. +*/ + .orgmaster+0x60 + .globl slave +slave: bl 1f +1: mflrr4 + addir4,r4,slave_wait-1b /* code assumes r4=slave_wait */ + li r5,1 + rlwnm r5,r5,r3,0,31 /* bit within word */ + rlwinm r6,r3,32-5+2,4,29 /* word in array */ + addir6,r6,slaves-slave_wait /* relative to r4, slave_wait */ + b slave_wait + + .orgmaster+0x80 /* put locked bitmask data in another line */ + .global slaves +slaves: + + .globl slaves_end; +slaves_end = 0f + +#if 0 + /* today, the 32 bit kernel starts slaves at 0xc0 +* but this limits us to cpu to 512 vs 1024 +*/ + .orgmaster+0xc0 +0: b slave +#endif + + + .orgmaster+0x100/* we must fit in 0x100 bytes */ +0: + Index: kernel/arch/powerpc/boot/marshal.c === --- /dev/null 1970-01-01 00:00:00.0 + +++ kernel/arch/powerpc/boot/marshal.c 2007-09-17 22:13:14.0 -0500 @@ -0,0 +1,276 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 51 Franklin Street, Fifth Floor,
[PATCH 5/15] bootwrapper: occuppied memory ranges
Add a set of library routines to manage gross memory allocations. This code uses an array in bss to store upto 32 entrys with merging representing a range of memory below rma_end (aka end of real mode memory at 0). To use this code, a platform would set rma_end (find_rma_end), mark memory ranges occupied (add_known_ranges et al), initialize malloc in the spaces between (ranges_init_malloc), and optionally use the supplied vmlinux_alloc may be used. Signed-off-by: Milton Miller [EMAIL PROTECTED] --- vs 12172 rename rmo_end to rma_end (real mode area, as used in papr) removed section labels (now in ops.h) rediff ops.h, Makefile moved find_rma_end here (from kexec.c in a later patch) find_rma_end searches by node type for memory, checks that the parent is the root node, then looks for a reg property with the first address/size pair starting at 0. Index: kernel/arch/powerpc/boot/memranges.c === --- /dev/null 1970-01-01 00:00:00.0 + +++ kernel/arch/powerpc/boot/memranges.c2007-09-20 17:51:42.0 -0500 @@ -0,0 +1,299 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright IBM Corporation 2007 + * + * Authors: Milton Miller [EMAIL PROTECTED] + */ + +#include ops.h +#include stdio.h +#include flatdevtree.h +#include page.h +#include types.h + +void *rma_end; + +static struct { + void *start, *end; +} ranges[32]; +static int num_ranges; + +/** + * find_rma_end - find end of Real Mode Area + * Query the device tree to find the node of type memory that contains a + * reg starting with address 0, and update rma_end to point to the end + * of that region. On PAPR systems, only this RMA region is accessable + * in real mode. + */ +void find_rma_end(void) +{ + unsigned int na, ns, reg[4], *rp; char path[MAX_PATH_LEN]; + void *devp, *root; int rc; + + path[0] = '\0'; + root = finddevice(/); + if (!root) + fatal(Ack, can't get device-tree root); + rc = getprop(root, #address-cells, na, sizeof(na)); + if (rc != sizeof(na)) + fatal(Ack, no #address-cells in root); + rc = getprop(root, #size-cells, ns, sizeof(ns)); + if (rc != sizeof(ns)) + fatal(Ack, no #size-cells in root); + if (!na || !ns || na 1 || na 2 || ns 1 || ns 2) + fatal(find_rma_end: / #addr-cells or #size-cells unsupported); + + devp = NULL; + while ((devp = find_node_by_devtype(devp, memory))) { + if (root != get_parent(devp)) { + printf(Ignoring memory node %s +--- not a child of root\n\r, + get_path(devp, path, sizeof(path))); + continue; + } + rc = getprop(devp, reg, reg, sizeof(reg)); + if (rc (na + ns) * sizeof(int)) { + printf(No valid reg property in memory node %s\n\r, + get_path(devp, path, sizeof(path))); + continue; + } + /* find the node where the first reg entry starts at 0 */ + rp = reg[0]; + if (*rp++) + continue; + if (na 1 *rp++) + continue; + + /* if 4G, limit it */ + if (ns 1 *rp++) { + rma_end = (void *)0x; + return; + } + + /* other wise use its size */ + rma_end = (void *)*rp; + return; + } + fatal(find_rma_end: didn't find memory at 0\n\r); +} + +/** + * add_occupied_range - mark a range as occupied + * @start: start of range pointer + * @end: end of range pointer + * + * Mark the range from @start to @end as occupied. + * Ignore anything above rma_end. + */ +void add_occupied_range(void *start, void *end) +{ + int i, j; + + if (start == end) + return; + if (start rma_end) + return; + if (end rma_end) + end = rma_end; + if (start end) + fatal(%s: BUG: start %p end %p\n\r, __FUNCTION__, + start,
[PATCH 6/15] bootwrapper: help for 64 bit cpus
Add code to check if the processor is in 64 or 32 bit mode using only instructions from the 32 bit subset. If the processor is in 64 bit mode, switch to 32 bit mode by clearing MSR[SF]. Also add a 64 bit procedure descriptor to use as a elf64 entry point. Signed-off-by: Milton Miller [EMAIL PROTECTED] --- vs 12173 correct comment (equal vs not-equal) Index: kernel/arch/powerpc/boot/crt0.S === --- kernel.orig/arch/powerpc/boot/crt0.S2007-07-10 03:33:36.0 -0500 +++ kernel/arch/powerpc/boot/crt0.S 2007-07-10 03:39:08.0 -0500 @@ -17,11 +17,47 @@ _zimage_start_opd: .long _zimage_start, 0, 0, 0 + /* a procedure descriptor used when pretending to be elf64_powerpc */ + .balign 8 + .globl _zimage_start_64 +_zimage_start_64: + .long 0, _zimage_start/* big endian, supported reloc ppc32 */ + .long 0, 0, 0, 0, 0, 0 + + .weak _zimage_start .globl _zimage_start _zimage_start: .globl _zimage_start_lib _zimage_start_lib: + /* 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. +* +* Subtract bottom 32 bits of MSR from full value recording +* the result. Since MSR[SF] is in the high word, we will +* be equal iff in 32 bit mode (either the processor is +* a 32 bit processor or MSR[SF] = 0). +*/ + mfmsr r0 /* grab whole msr */ + rlwinm r8,r0,0,0,31/* extract bottom word */ + subf. r8,r8,r0/* subtract, same? */ + beq 0f /* yes: we are 32 bit mode */ + + /* We are in 64-bit mode. This program must run in 32 bit +* mode. Assume we are actually running somewhere in the +* low 32 bits of the address 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 +0: /* We are now in 32-bit mode */ + /* Work out the offset between the address we were linked at and the address where we're running. */ bl 1f ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 7/15] bootwrapper: Add kexec callable zImage wrapper
This code creates a 32 bit zImage wrapper for a 32 or 64 bit PowerPC Linux kernel. This allows you to kexec a zImage with its compressed vmlinux instead of the uncompressed vmlinux elf. The code is also packaged as a 64 bit elf for use by kexec-tools on 64 bit kernels. Limitations: Note: the device-tree generated by kexec-tools is currently version 2, not the version 16 supported by the boot code base. Signed-off-by: Milton Miller [EMAIL PROTECTED] --- find_rmo_end moved to memranges as find_rma_end. early_scan_flat_tree replaced with calls to its pieces in kexec_platform_init rediff wrapper, Makefile, ops.h Index: kernel/arch/powerpc/boot/kexec.c === --- /dev/null 1970-01-01 00:00:00.0 + +++ kernel/arch/powerpc/boot/kexec.c2007-09-21 04:52:46.0 -0500 @@ -0,0 +1,122 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright IBM Corporation 2007 + * + * Authors: Milton Miller [EMAIL PROTECTED] + */ + +#include ops.h +#include stdio.h +#include flatdevtree.h +#include page.h +#include types.h + +extern char _start[]; +extern char _end[]; + +BSS_STACK(16*1024); + +static void find_console_from_tree(void) +{ + int rc = -1; + + if (rc) { + /* no console, oh well */ + } +} + +/** + * setup_initial_heap - setup a small heap in the bss + * Using a preallocated heap, setup for scanning the device tree. + * Intended for the initial read while the tree will remain read-only so + * a minimal malloc and search limit can be used. This way we don't have + * lots of data or bss to clear. + */ +static void setup_initial_heap(void) +{ + static char initial_heap[8*1024]; + void *heap_end; + + heap_end = simple_alloc_init(initial_heap, + sizeof(initial_heap) * 7 / 8, + sizeof(long), 64); + + if (heap_end - sizeof(initial_heap) (void *)initial_heap[0]) + fatal(Initial heap too big\n\r); +} + +static void init_flat_tree(struct boot_param_header *dt_blob) +{ + int rc; + + rc = ft_init(dt_blob, dt_blob-totalsize, /* max_finddevice */ 1024); + if (rc) + fatal(Unable to initialize device_tree library!\n\r); +} + +static void *saved_vmlinux_addr; + +static void *kexec_vmlinux_alloc(unsigned long size) +{ + void *addr; + + addr = ranges_vmlinux_alloc(size); + + saved_vmlinux_addr = addr; + return addr; +} + +static void kexec_fixups(void) +{ + wait_slaves_moved(); +} + +static unsigned long (*finalize_chain)(void); + +static unsigned long kexec_finalize(void) +{ + send_slaves_to_kernel(saved_vmlinux_addr); + + return finalize_chain(); +} + +void kexec_platform_init(struct boot_param_header *dt_blob) +{ + slaves_are_low(); + move_slaves_up(); + + setup_initial_heap(); + init_flat_tree(dt_blob); + /* +* drivers can malloc and read the tree, but not realloc later +* or modify the tree now. +*/ + if (!console_ops.write) + find_console_from_tree(); + + find_rma_end(); + dt_find_initrd(); + add_known_ranges(dt_blob); + ranges_init_malloc(); + + /* now that we have a malloc region, start over from the flat tree */ + init_flat_tree(dt_blob); + + platform_ops.vmlinux_alloc = kexec_vmlinux_alloc; + platform_ops.fixups = kexec_fixups; + finalize_chain = dt_ops.finalize; + dt_ops.finalize = kexec_finalize; +} Index: kernel/arch/powerpc/boot/crt0_kexec.S === --- /dev/null 1970-01-01 00:00:00.0 + +++ kernel/arch/powerpc/boot/crt0_kexec.S 2007-09-21 04:52:46.0 -0500 @@ -0,0 +1,45 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public
[PATCH 8/15] bootwrapper: convert flatdevtree to version 16
kexec-tools still produces a version 2 device tree, while the libraries in the wrapper only support version 16 and later. Add a routine to convert a v2 flat device tree to a v16 one inplace by inserting OF_DT_NOP and chomping full path. Make space for new headers by moving and then chomping the OF_DT_NOPs. Signed-off-by: Milton Miller [EMAIL PROTECTED] --- vs 12175 Rediffed Makefile, ops, kexec.c Index: kernel/arch/powerpc/boot/flatdevtree_conv.c === --- /dev/null 1970-01-01 00:00:00.0 + +++ kernel/arch/powerpc/boot/flatdevtree_conv.c 2007-09-20 17:49:04.0 -0500 @@ -0,0 +1,280 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright IBM Corporation 2007 + * + * Authors: Milton Miller [EMAIL PROTECTED] + */ +#include flatdevtree.h +#include stdio.h +#include ops.h + +#define MIN_VERSION 2 +#define OUT_VERSION 16 +#define OUT_COMPAT 16 + +#ifdef NO_CHECK +static int check_v123_tree(u32 *start, u32 *limit) +{ + return 0; +} +#else +/** + * check_v123_tree - check integrety of a version 1, 2, or 3 tree + * @start: the start of the device tree struct + * @limit: the end of the region for the struct + * structural checks on device_tree + */ +static int check_v123_tree(u32 *start, u32 *limit) +{ + u32 len; + int depth = 0; + u32 *dtp = start; + + while (dtp limit) + switch (*dtp) { + case OF_DT_END: + if (depth) + return -1; + return ++dtp - start; + case OF_DT_NOP: + dtp++; + break; + case OF_DT_END_NODE: + dtp++; + depth--; + break; + case OF_DT_BEGIN_NODE: + len = strlen((char *)(++dtp)); + /* check path is suffix to previous? */ + dtp += 1 + (len / 4); + depth++; + break; + case OF_DT_PROP: + len = dtp[1]; + dtp += 3; + if ((len = 8) ((long)dtp 4)) + dtp++; + dtp += (len + 3) / 4; + break; + default: + return -1; + } + return -1; /* no OF_DT_END */ +} +#endif + +/** + * nop_to_v16 - add %OF_DT_NOP to hide alignment differences + * @dtp: pointer to the beginning of the struct area to modify + * insert %OF_DT_NOP into the dt_struct @dtp to make it v16 from v1, 2, or 3. + */ +static int nop_to_v16(u32 *dtp) +{ + int nops = 0; + char *p, *s; + int len; + u32 *next; + + while (*dtp != OF_DT_END) + switch (*dtp) { + case OF_DT_BEGIN_NODE: + /* v2 v3 names are full path, v16+ is relative */ + p = (char *)(++dtp); + len = strlen(p); + next = dtp + 1 + len / 4; + + for (s = p + len; *s != '/'; s--) + if (s == p) + fatal(name %s has no '/', p); + + len -= s++ - p; /* not the slash but the nul */ + memmove(p, s, len); + while (len % 4) + p[len++] = '\0'; + dtp += len / 4; + while (dtp != next) { + *dtp++ = OF_DT_NOP; + nops++; + } + break; + case OF_DT_PROP: + /* convert from align_8 to align_4 via prefixing nop */ + len = dtp[1]; + if ((len = 8) !((long)dtp 4)) { + memmove(dtp+1, dtp, 12); + *dtp++ = OF_DT_NOP; + nops++; + } + dtp += 3 + (len + 3)/4; + break; + default: + fatal(%s: unrecognised tag
[PATCH 9/15] bootwrapper: rtas support
This code provides a console write that calls put-term-char. To avoid PIC relocation of the absolute rtas addresses, hide the actual call to rtas in assembly and declare all variables as int. An instantiated rtas will be protected by a reserved range in the device tree, so no explicit call to add_occupied_range is needed here. Signed-off-by: Milton Miller [EMAIL PROTECTED] --- vs 12176 rtas_put_term_write now takes const char *buf rediff ops.h, Makefile Index: kernel/arch/powerpc/boot/rtas.c === --- /dev/null 1970-01-01 00:00:00.0 + +++ kernel/arch/powerpc/boot/rtas.c 2007-09-21 01:43:08.0 -0500 @@ -0,0 +1,146 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright 2007 IBM Corporation. + * + * Authors: Milton Miller [EMAIL PROTECTED] + * + */ + +#include ops.h +#include stdio.h +#include flatdevtree.h + +static int rtas_entry; +static int rtas_base; +static int rtas_size; + +static void find_rtas(void) +{ + int rc; + void *devp; + char *str; + + devp = finddevice(/rtas); + if (! devp) + return; + + str = linux,rtas-entry; + rc = getprop(devp, str, rtas_entry, sizeof(rtas_entry)); + if (rc 0) + return; + if (rc != sizeof(rtas_entry)) + goto fail; + + str = rtas-size; + rc = getprop(devp, str, rtas_size, sizeof(rtas_size)); + if (rc 0) + return; + if (rc != sizeof(rtas_size)) + goto fail; + + str = linux,rtas-base; + rc = getprop(devp, str, rtas_base, sizeof(rtas_base)); + if (rc 0) { + printf(rtas-size but no linux,rtas-base in /rtas. + disabling wrapper rtas interface\n\r); + rtas_entry = 0; + return; + } + + if (rc != sizeof(rtas_base)) + goto fail; + + return; + + +fail: + printf(Unexpected length %d of %s property in /rtas.\n\r + disabling wrapper rtas interface\n\r, rc, str); + rtas_entry = 0; + return; +} + +/* + * PIC relocation of function pointers happens at call time. + * We have an absolute out-of-image address. So tell C they + * are just integers, and hide the call as an out-of-file + * function. + */ +__asm__ ( + .globl call_rtas\n + call_rtas: mtctr 5\n + bctr\n + ); + +void call_rtas(int args[], int base, int entry); + + +static int put_term_char; + +static void rtas_put_term_write(const char *buf, int len) +{ + int i, args[5]; + + args[0] = put_term_char; + args[1] = 1;/* num inputs */ + args[2] = 1;/* num outputs */ + + for (i=0; i len; ) { + args[3] = buf[i]; + args[4] = 0; + + call_rtas(args, rtas_base, rtas_entry); + if (args[4] == 0) /* SUCCESS */ + i++; + else if (args[4] == -1) /* HARDWARE_ERROR */ + break; + /* else retry */ + } +} + +int rtas_console_init(void) +{ + void *devp; + int rc; + + + devp = finddevice(/rtas); + if (!devp) + return -1; + + if (!rtas_entry) + find_rtas(); + if (!rtas_entry) + return -1; + + rc = getprop(devp, put-term-char, put_term_char, + sizeof(put_term_char)); + if (rc == sizeof(put_term_char)) + console_ops.write = rtas_put_term_write; + else + put_term_char = -1; + + return put_term_char == -1 ? -1 : 0; +} + +/* for debug, hard code */ +void use_rtas_console(int entry, int base, int tc) +{ + rtas_entry = entry; + rtas_base = base; + put_term_char = tc; + console_ops.write = rtas_put_term_write; +} Index: kernel/arch/powerpc/boot/ops.h === --- kernel.orig/arch/powerpc/boot/ops.h 2007-09-21 01:43:02.0 -0500 +++ kernel/arch/powerpc/boot/ops.h 2007-09-21 01:43:08.0 -0500 @@ -99,6 +99,8 @@ void send_slaves_to_kernel(void *vmlinux void
[PATCH 10/15] bootwrapper: add cpio file extraction library.
Add a library to search through a cpio or initramfs buffer for a specified path name. No canocalization of the path is performed. Signed-off-by: Milton Miller [EMAIL PROTECTED] --- vs 12177 rediff Makefile cpio.c should be reusable by a stand alone user space applicaton. Index: kernel/arch/powerpc/boot/cpio.c === --- /dev/null 1970-01-01 00:00:00.0 + +++ kernel/arch/powerpc/boot/cpio.c 2007-08-22 20:51:29.0 -0500 @@ -0,0 +1,306 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright 2007 IBM Corporation. + * + * Authors: Milton Miller [EMAIL PROTECTED] + * + */ + +#include cpio.h +#include string.h + +struct cpio_header { + char ino[8]; + char mode[8]; + char uid[8]; + char gid[8]; + char nlink[8]; + char mtime[8]; + char filesize[8]; + char maj[8]; + char min[8]; + char rmaj[8]; + char rmin[8]; + char namesize[8]; + char chksum[8]; +} cpio_header_buf; + +static int check_magic(char magic[6]) +{ + return !memcmp(magic,070701,6) || !memcmp(magic,070702,6); +} + +static int read_magic(struct gunzip_state *stream) +{ + int len; + char magic[6]; + + len = gunzip_partial(stream, magic, sizeof(magic)); + if (len == 0) + return 0; + + if (len == sizeof(magic) check_magic(magic)) + return len; + + + /* Not the right magic or short read. We might have stumbled +* onto a compressed archive immediately following an +* uncompressed one, or just some NUL bytes at the end of the +* archive. Inform the higher layers by the negative length. +*/ + return -len; +} + +static int get_cpio_header(struct gunzip_state *stream) +{ + int len; + + len = read_magic(stream); + if (len = 0) + return len; + + gunzip_exactly(stream, cpio_header_buf, sizeof(cpio_header_buf)); + len += sizeof(cpio_header_buf); + + return len; +} + +static unsigned int cpio_str_to_num(char hexascii[8]) +{ + unsigned int num = 0; + char c; + int d; + + for (d=0; d 8; d++) { + c = hexascii[d]; + num = 4; + if (c = '0' c = '9') { + num += c - '0'; + } else if (c = 'A' c = 'F') { + num += c - 'A' + 10; + } else if (c = 'a' c = 'f') { + num += c - 'a' + 10; + } else { + cpio_error(bad cpio archive header: + invalid a hex digit); + } + } + + return num; +} + +static char name_buf[MAX_PATH+1]; +static const char cpio_end[] = TRAILER!!!; +#define CPIO_END_LEN sizeof(cpio_end) + +/* check_next_file + * Look for @path in @stream. Set @consumed to the number of bytes + * succesfully read and processed. return 1 on match, 0 for discarding + * an unmatched file, -1 on end of archive (either detected trailer or + * EOF on stream), or -(1 + bytes read) for a short read or bad magic + * number. (For the short or bad read, the consumed is not changed). + */ +static int check_next_file(char *path, int pathlen, + struct gunzip_state *stream, int *consumed) +{ + int len, total, match; + + if (pathlen MAX_PATH) { + cpio_error(path too long to search\n); + } + total = get_cpio_header(stream); + if (total = 0) + return total - 1; + + len = cpio_str_to_num(cpio_header_buf.namesize); + + if (len == pathlen || len == CPIO_END_LEN) { + gunzip_exactly(stream, name_buf, len); + total += len; + match = !strcmp(name_buf, path); + if (!match !cpio_str_to_num(cpio_header_buf.filesize)) + match = -!strcmp(name_buf, cpio_end); + } else { + gunzip_discard(stream, len); + total += len; + name_buf[0] = '\0'; + match = 0; + } + + len = total % 4; + if (len) { + gunzip_discard(stream, 4 - len); + total += 4 - len; + } + + if (!match) { +
[PATCH 11/15] bootwrapper: allow vmlinuz to be an external payload
Allow the boot wrapper to obtain the vmlinux elf from an external platform supplied location instead of embedding it at link time. When used with the cpio library, the kernel can be stored as a file in the initramfs, allowing the same (compressed) copy of the vmlinux elf to be used for both the kernel to execute and any user space tools such as kexec (for reboot), crash dump, or oprofile. Another use would be to uncompress directly from a memory mapped region such as a flash partition. Signed-off-by: Milton Miller [EMAIL PROTECTED] --- vs 12178, just fuzz. The source and source len variables are passed to the routine only to allow them to be printed later. The gunzip_state is passed to allow a platform to find the elf stream in an arbitrary container (cpio, ar, etc) without decompressing leading data twice. I also used this hook for qemu, where the rom contains the wrapper code and device tree blob, but the kernel is loaded into ram via the -kernel flag (allowing a raw vmlinux elf). Index: kernel/arch/powerpc/boot/main.c === --- kernel.orig/arch/powerpc/boot/main.c2007-09-20 17:00:15.0 -0500 +++ kernel/arch/powerpc/boot/main.c 2007-09-20 17:49:10.0 -0500 @@ -37,10 +37,19 @@ static struct addr_range prep_kernel(voi struct elf_info ei; int len; - /* gunzip the ELF header of the kernel */ - gunzip_start(gzstate, vmlinuz_addr, vmlinuz_size); - gunzip_exactly(gzstate, elfheader, sizeof(elfheader)); + /* Initialze zlib. Any attached kernel overrides find_vmlinuz */ + if (vmlinuz_size) + gunzip_start(gzstate, vmlinuz_addr, vmlinuz_size); + else + if (platform_ops.find_vmlinuz) + platform_ops.find_vmlinuz(gzstate, vmlinuz_addr, + vmlinuz_size); + else + fatal(Can't find a kernel to boot: no attached + vmlinuz and no find_vmlinuz method\n\r); + /* gunzip and parse the ELF header of the kernel */ + gunzip_exactly(gzstate, elfheader, sizeof(elfheader)); if (!parse_elf64(elfheader, ei) !parse_elf32(elfheader, ei)) fatal(Error: not a valid PPC32 or PPC64 ELF file!\n\r); Index: kernel/arch/powerpc/boot/ops.h === --- kernel.orig/arch/powerpc/boot/ops.h 2007-09-20 17:49:08.0 -0500 +++ kernel/arch/powerpc/boot/ops.h 2007-09-20 17:49:10.0 -0500 @@ -24,6 +24,8 @@ typedef void (*kernel_entry_t)(unsigned struct boot_param_header; +struct gunzip_state; + /* Platform specific operations */ struct platform_ops { void(*fixups)(void); @@ -33,6 +35,8 @@ struct platform_ops { void * (*realloc)(void *ptr, unsigned long size); void(*exit)(void); void * (*vmlinux_alloc)(unsigned long size); + void(*find_vmlinuz)(struct gunzip_state *, void **srcp, + unsigned long *lenp); }; extern struct platform_ops platform_ops; ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 12/15] bootwrapper: kexec extract vmlinux from initramfs
Teach the kexec platform to find the vmlinux from the initramfs. The implementation searches the initramfs for a path specified by the property linux,kernel-path in chosen. Signed-off-by: Milton Miller [EMAIL PROTECTED] --- vs 12179 change property from boot-file to linux,kernel-path context diffs Index: kernel/arch/powerpc/boot/kexec.c === --- kernel.orig/arch/powerpc/boot/kexec.c 2007-09-20 17:49:08.0 -0500 +++ kernel/arch/powerpc/boot/kexec.c2007-09-20 17:49:13.0 -0500 @@ -23,6 +23,8 @@ #include flatdevtree.h #include page.h #include types.h +#include cpio.h +#include stat.h extern char _start[]; extern char _end[]; @@ -41,6 +43,51 @@ static void find_console_from_tree(void) } } +void find_vmlinux_in_initramfs(struct gunzip_state *state, + void **srcp, unsigned long *lenp) +{ + void *devp; + int rc; + char path[MAX_PATH]; + + if (!loader_info.initrd_size) + dt_find_initrd(); + if (!loader_info.initrd_size) + fatal(find_vmlinux: no initramfs); + devp = finddevice(/chosen); + if (!devp) + fatal(find_vmlinux: no /chosen to find vmlinux); + rc = getprop(devp, linux,kernel-path, path, sizeof(path)); + if (rc 0) + fatal(find_vmlinux: no linux,kernel-path property in /chosen) + else if (rc == 0 || rc MAX_PATH) + fatal(linux,kernel-path too long in /chosen) + + rc = find_in_initramfs(path, (void *)loader_info.initrd_addr, + loader_info.initrd_size, state); + if (!rc) + fatal(find_vmlinux: couldn't find linux,kernel-path %s +in initramfs, path); + + rc = get_cpio_file_mode(); + if (!S_ISREG(rc)) + fatal(find_vmlinux: linux,kernel-path %s is not +a regular file, path) + + get_cpio_info(srcp, rc); + *lenp = get_cpio_file_size(); +} + +void cpio_error(char *msg) +{ + void *srcp; + int read; + + get_cpio_info(srcp, read); + + fatal(cpio_error at %p + 0x%x(%d): %s, srcp, read, read, msg); +} + /** * setup_initial_heap - setup a small heap in the bss * Using a preallocated heap, setup for scanning the device tree. @@ -119,6 +166,7 @@ void kexec_platform_init(struct boot_par /* now that we have a malloc region, start over from the flat tree */ init_flat_tree(dt_blob); + platform_ops.find_vmlinuz = find_vmlinux_in_initramfs; platform_ops.vmlinux_alloc = kexec_vmlinux_alloc; platform_ops.fixups = kexec_fixups; finalize_chain = dt_ops.finalize; ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 13/15] bootwrapper: attach an empty vmlinux
Allow the boot wrapper code to be linked without an attached vmlinux. Rather than invent a new syntax to invoke the wrapper, attach the stripped version of empty.o, which produces the same result. This new intermediary is called zBoot. Signed-off-by: Milton Miller [EMAIL PROTECTED] --- vs 12180 context diffs, identical content Iniital attempts to remove the dependency on vmlinux in the arch Makefile have lead to multiple make commands competeing in the boot directory and destroying each other. Until the make rules are fixed, the full kenrel must be built. There are parallel make conflicts when specifying a dts file to be compiled into the binary unaffected by this patch, except one may choose more targets showing the problems.. Index: kernel/arch/powerpc/boot/Makefile === --- kernel.orig/arch/powerpc/boot/Makefile 2007-09-17 22:11:51.0 -0500 +++ kernel/arch/powerpc/boot/Makefile 2007-09-17 22:12:05.0 -0500 @@ -126,7 +126,8 @@ endif # args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd quiet_cmd_wrap = WRAP$@ cmd_wrap =$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \ - $(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) vmlinux + $(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) \ + $(if $6,$6,vmlinux) kexec-$(CONFIG_PPC32) += zImage.kexec kexec-$(CONFIG_PPC64) += zImage.kexec64 @@ -144,6 +145,7 @@ image-$(CONFIG_PPC_PRPMC2800) += zImage image-$(CONFIG_PPC_ISERIES)+= zImage.iseries image-$(CONFIG_DEFAULT_UIMAGE) += uImage image-$(CONFIG_KEXEC) += $(kexec-y) +image-$(CONFIG_KEXEC) += $(patsubst zImage%,zBoot%,$(kexec-y)) ifneq ($(CONFIG_DEVICE_TREE),) image-$(CONFIG_PPC_8xx)+= cuImage.8xx @@ -197,6 +199,9 @@ $(obj)/vmlinux.strip: vmlinux $(obj)/zImage.iseries: vmlinux $(STRIP) -s -R .comment $ -o $@ +$(obj)/zBoot.%: $(wrapperbits) $(dts) + $(call if_changed,wrap,$*,$(dts),,,$(obj)/empty.o) + $(obj)/zImage.ps3: vmlinux $(wrapper) $(wrapperbits) $(srctree)/$(src)/dts/ps3.dts $(STRIP) -s -R .comment $ -o vmlinux.strip $(call cmd,wrap,ps3,$(srctree)/$(src)/dts/ps3.dts,,) @@ -234,7 +239,7 @@ clean-files += $(image-) $(initrd-) zIma otheros.bld $(kexec-) # clean up files cached by wrapper -clean-kernel := vmlinux.strip vmlinux.bin +clean-kernel := vmlinux.strip vmlinux.bin empty.o.bin clean-kernel += $(addsuffix .gz,$(clean-kernel)) # If not absolute clean-files are relative to $(obj). clean-files += $(addprefix $(objtree)/, $(clean-kernel)) Index: kernel/arch/powerpc/boot/wrapper === --- kernel.orig/arch/powerpc/boot/wrapper 2007-09-17 22:11:51.0 -0500 +++ kernel/arch/powerpc/boot/wrapper2007-09-17 22:12:05.0 -0500 @@ -161,6 +161,13 @@ ps3) ;; esac +if [ $kernel = $object/empty.o ] ; then +ext=bin +objflags=-O binary +gzip= +fi + + vmz=$tmpdir/`basename \$kernel\`.$ext if [ -z $cacheit -o ! -f $vmz$gzip -o $vmz$gzip -ot $kernel ]; then ${CROSS}objcopy $objflags $kernel $vmz.$$ ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 14/15] boot: add a hook to start cpus
The kexec code is doing strange contortions with dtops.finalize and platform_ops.vmlinux_alloc to manage the slave cpus. Add a hook with the needed information. Signed-off-by: Milton Miller [EMAIL PROTECTED] --- vs 12181 rediff fuzz. Index: kernel/arch/powerpc/boot/kexec.c === --- kernel.orig/arch/powerpc/boot/kexec.c 2007-09-20 17:49:13.0 -0500 +++ kernel/arch/powerpc/boot/kexec.c2007-09-20 17:49:19.0 -0500 @@ -117,32 +117,11 @@ static void init_flat_tree(struct boot_p fatal(Unable to initialize device_tree library!\n\r); } -static void *saved_vmlinux_addr; - -static void *kexec_vmlinux_alloc(unsigned long size) -{ - void *addr; - - addr = ranges_vmlinux_alloc(size); - - saved_vmlinux_addr = addr; - return addr; -} - static void kexec_fixups(void) { wait_slaves_moved(); } -static unsigned long (*finalize_chain)(void); - -static unsigned long kexec_finalize(void) -{ - send_slaves_to_kernel(saved_vmlinux_addr); - - return finalize_chain(); -} - void kexec_platform_init(struct boot_param_header *dt_blob) { slaves_are_low(); @@ -167,8 +146,7 @@ void kexec_platform_init(struct boot_par init_flat_tree(dt_blob); platform_ops.find_vmlinuz = find_vmlinux_in_initramfs; - platform_ops.vmlinux_alloc = kexec_vmlinux_alloc; + platform_ops.vmlinux_alloc = ranges_vmlinux_alloc; platform_ops.fixups = kexec_fixups; - finalize_chain = dt_ops.finalize; - dt_ops.finalize = kexec_finalize; + platform_ops.start_smp = send_slaves_to_kernel; } Index: kernel/arch/powerpc/boot/main.c === --- kernel.orig/arch/powerpc/boot/main.c2007-09-20 17:49:10.0 -0500 +++ kernel/arch/powerpc/boot/main.c 2007-09-20 17:49:19.0 -0500 @@ -202,6 +202,9 @@ void start(void) else printf( using OF tree (promptr=%p)\n\r, loader_info.promptr); + if (platform_ops.start_smp) + platform_ops.start_smp(vmlinux.addr); + if (console_ops.close) console_ops.close(); Index: kernel/arch/powerpc/boot/ops.h === --- kernel.orig/arch/powerpc/boot/ops.h 2007-09-20 17:49:10.0 -0500 +++ kernel/arch/powerpc/boot/ops.h 2007-09-20 17:49:19.0 -0500 @@ -35,6 +35,7 @@ struct platform_ops { void * (*realloc)(void *ptr, unsigned long size); void(*exit)(void); void * (*vmlinux_alloc)(unsigned long size); + void(*start_smp)(void *vmlinux); void(*find_vmlinuz)(struct gunzip_state *, void **srcp, unsigned long *lenp); }; ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 15/15] bootwrapper: recheck for command line after fixups
After the fixups hook has run, if we still have not set a command line, check to see if fixups pointed us to one. Running as a part of fixup allows device tree interaction and error messages to be displayed. Signed-off-by: Milton Miller [EMAIL PROTECTED] --- The code in main presently checks for the platform providing commandline information before calling the console open or platform fixups in case the command line data is not safe from overwrite by malloc. If malloc can overwrite the command line then how do we know flat tree initialization or console search has not already overwritten it? And why would the same argument not apply to the initrd? If a platform can't adjust malloc to keep the loader supplied command line safe, then it could copy the loader command line to a buffer in bss. Regardless, this is safe as we will stop once the command line contains any information. My current qemu patch relies on this. Index: kernel/arch/powerpc/boot/main.c === --- kernel.orig/arch/powerpc/boot/main.c2007-09-19 02:21:18.0 -0500 +++ kernel/arch/powerpc/boot/main.c 2007-09-19 02:21:18.0 -0500 @@ -181,6 +181,11 @@ void start(void) if (platform_ops.fixups) platform_ops.fixups(); + /* check again, in case fixups told us about it */ + if ((loader_info.cmdline_len 0) (cmdline[0] == '\0')) + memmove(cmdline, loader_info.cmdline, + min(loader_info.cmdline_len, COMMAND_LINE_SIZE-1)); + printf(\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r, _start, get_sp()); ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 1/2] qemu platform, v2
Here is the second rev of patches to boot a arch powerpc kernel on qemu with the prep architecture. The goal is to provide an environment for use with the existing qemu hardware suppplied hardware, as oposed to changing the qemu machine description. This patch contains only the kernel portion. While the diff was generated against for-2.6.24, this first patch applies cleanly to 2.6.23-rc7. With the rom image created in the next patch, a kernel built by this patch should boot when using qemu -kernel. I debated putting this in the embedded6xx tree, especially when I discovered that the bridge is suposedly a '105, but saw no advantage in the end. pci config space is now working, however cirrusfb causes crashes and ohci times out, so at least pci memory is likely still broken. ide and serial work, floppy and parallel are untested. I added a defconfig based on chrp32; hardware options still need tweaking (eg isa ne2k). Index: kernel/arch/powerpc/platforms/Kconfig === --- kernel.orig/arch/powerpc/platforms/Kconfig 2007-09-19 02:32:54.0 -0500 +++ kernel/arch/powerpc/platforms/Kconfig 2007-09-19 02:41:00.0 -0500 @@ -47,6 +47,7 @@ source arch/powerpc/platforms/chrp/Kcon source arch/powerpc/platforms/52xx/Kconfig source arch/powerpc/platforms/powermac/Kconfig source arch/powerpc/platforms/prep/Kconfig +source arch/powerpc/platforms/qemu/Kconfig source arch/powerpc/platforms/maple/Kconfig source arch/powerpc/platforms/pasemi/Kconfig source arch/powerpc/platforms/celleb/Kconfig Index: kernel/arch/powerpc/platforms/qemu/Kconfig === --- /dev/null 1970-01-01 00:00:00.0 + +++ kernel/arch/powerpc/platforms/qemu/Kconfig 2007-09-20 14:12:57.0 -0500 @@ -0,0 +1,10 @@ +config PPC_QEMU + bool QEMU emulated PowerPC Reference Platform (PReP) system + depends on PPC_MULTIPLATFORM PPC32 + select PPC_I8259 + select PPC_INDIRECT_PCI + select PPC_UDBG_16550 + select PPC_NATIVE + select WANT_DEVICE_TREE + default n + Index: kernel/arch/powerpc/platforms/qemu/Makefile === --- /dev/null 1970-01-01 00:00:00.0 + +++ kernel/arch/powerpc/platforms/qemu/Makefile 2007-09-19 02:41:00.0 -0500 @@ -0,0 +1,2 @@ +obj-y += setup.o +obj-$(CONFIG_PCI) += pci.o Index: kernel/arch/powerpc/platforms/qemu/pci.c === --- /dev/null 1970-01-01 00:00:00.0 + +++ kernel/arch/powerpc/platforms/qemu/pci.c2007-09-19 02:56:36.0 -0500 @@ -0,0 +1,133 @@ +/* + * prep Port to arch/powerpc: + * Copyright 2007 David Gibson, IBM Corporation. + * + * prep Port to qemu: + * Copyright 2007 Milton Miller, IBM Corporation. + * + * Based on OpenHackware 0.4 + * Copyright (c) 2004-2005 Jocelyn Mayer + * + * pci config based on arch/powerpc/platforms/chrp/pci.c GoldenGate code + * + */ + +#include linux/init.h + +#include asm/io.h +#include asm/prom.h +#include asm/pci-bridge.h +#include asm/udbg.h + +static volatile void __iomem *qemu_config_addr(struct pci_bus *bus, + unsigned int devfn, int off) +{ + int dev, fn; + struct pci_controller *hose = bus-sysdata; + + if (!hose-cfg_data) + return NULL; + + if (bus-number != 0) + return NULL; + + dev = devfn 3; + fn = devfn 7; + + if (dev 11 || dev 21) + return NULL; + + return hose-cfg_data + ((1 dev) | (fn 8) | off); +} + +int qemu_read_config(struct pci_bus *bus, unsigned int devfn, int off, + int len, u32 *val) +{ + volatile void __iomem *cfg_data = qemu_config_addr(bus, devfn, off); + + if (cfg_data == NULL) + return PCIBIOS_DEVICE_NOT_FOUND; + + /* +* Note: the caller has already checked that off is +* suitably aligned and that len is 1, 2 or 4. +*/ + switch (len) { + case 1: + *val = in_8(cfg_data); + break; + case 2: + *val = in_le16(cfg_data); + break; + default: + *val = in_le32(cfg_data); + break; + } + return PCIBIOS_SUCCESSFUL; +} + +int qemu_write_config(struct pci_bus *bus, unsigned int devfn, int off, + int len, u32 val) +{ + volatile void __iomem *cfg_data = qemu_config_addr(bus, devfn, off); + + if (cfg_data == NULL) + return PCIBIOS_DEVICE_NOT_FOUND; + + /* +* Note: the caller has already checked that off is +* suitably aligned and that len is 1, 2 or 4. +*/ + switch (len) { + case 1: + out_8(cfg_data, val); + break; + case 2: + out_le16(cfg_data,
Re: DTC Patch for Cygwin
On Fri, Sep 21, 2007 at 03:42:04PM -0400, Matt Tyrlik wrote: Scott Wood [EMAIL PROTECTED] wrote on 09/21/2007 02:46:39 PM: On Fri, Sep 21, 2007 at 11:26:04AM -0400, Matt Tyrlik wrote: Changes required to compile DTC under Cygwin A S-o-b line will be needed before this can be applied. === --- dtc-org.orig/tests/supernode_atdepth_offset.c +++ dtc-org/tests/supernode_atdepth_offset.c @@ -63,8 +63,11 @@ int path_prefix(const char *path, int de return 1; p = path; - for (i = 0; i depth; i++) - p = strchrnul(p+1, '/'); + for (i = 0; i depth; i++) { + p = strchr(p+1, '/'); + if (!p) + p = path + strlen(path); + } return p - path; } Maybe we should define strchrnul under #ifndef GLIBC, similar to strndupa? Since this is used only in one place David Gibson suggested that the change should be done in code. Yeah, I don't actually particularly care which way we go with this one. Index: dtc-org/tests/testutils.c === --- dtc-org.orig/tests/testutils.c +++ dtc-org/tests/testutils.c @@ -52,10 +52,9 @@ static void sigint_handler(int signum, s void test_init(int argc, char *argv[]) { int err; - struct sigaction sa_int = { - .sa_sigaction = sigint_handler, - }; + struct sigaction sa_int; + sa_int.sa_sigaction = sigint_handler, test_name = argv[0]; What version of GCC does cygwin use? That doesn't seem like something that should break due to OS differences. -Scott Currently 3.4.4. The compiler can't handle unnamed union in an initializer. Or at least that's my surmise, I can't see why else it would be breaking. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: 2.6.23-rc6-mm1: Build failure on ppc64 drivers/ata/pata_scc.c
Hi, On Thu, 20 Sep 2007, Alan Cox wrote: On Thu, 20 Sep 2007 14:13:15 +0100 [EMAIL PROTECTED] (Mel Gorman) wrote: PPC64 building allmodconfig fails to compile drivers/ata/pata_scc.c . It doesn't show up on other arches because this driver is specific to the architecture. drivers/ata/pata_scc.c: In function `scc_bmdma_status' Its not been updated to match the libata core changes. Try something like this. Whoever is maintaining it should also remove the prereset cable handling code and use the proper cable detect method. It appears you forgot to fix scc_std_softreset() and one of its callsites in scc_bdma_stop(). A complete patch is attempted below -- please review. [PATCH -mm] pata_scc: Keep up with libata core API changes Little fixlets, that the build started erroring / warning about: drivers/ata/pata_scc.c: In function 'scc_bmdma_status': drivers/ata/pata_scc.c:734: error: structure has no member named 'active_tag' drivers/ata/pata_scc.c: In function 'scc_pata_prereset': drivers/ata/pata_scc.c:866: warning: passing arg 1 of 'ata_std_prereset' from incompatible pointer type drivers/ata/pata_scc.c: In function 'scc_error_handler': drivers/ata/pata_scc.c:908: warning: passing arg 2 of 'ata_bmdma_drive_eh' from incompatible pointer type drivers/ata/pata_scc.c:908: warning: passing arg 3 of 'ata_bmdma_drive_eh' from incompatible pointer type drivers/ata/pata_scc.c:908: warning: passing arg 5 of 'ata_bmdma_drive_eh' from incompatible pointer type make[2]: *** [drivers/ata/pata_scc.o] Error 1 Signed-off-by: Satyam Sharma [EMAIL PROTECTED] Cc: Alan Cox [EMAIL PROTECTED] Cc: Mel Gorman [EMAIL PROTECTED] --- Andrew, this includes (supercedes) the previous two ones from Mel / Alan. drivers/ata/pata_scc.c | 21 - 1 file changed, 12 insertions(+), 9 deletions(-) diff -ruNp a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c --- a/drivers/ata/pata_scc.c2007-09-22 06:26:37.0 +0530 +++ b/drivers/ata/pata_scc.c2007-09-22 08:04:42.0 +0530 @@ -594,16 +594,17 @@ static unsigned int scc_bus_softreset(st * Note: Original code is ata_std_softreset(). */ -static int scc_std_softreset (struct ata_port *ap, unsigned int *classes, - unsigned long deadline) +static int scc_std_softreset(struct ata_link *link, unsigned int *classes, + unsigned long deadline) { + struct ata_port *ap = link-ap; unsigned int slave_possible = ap-flags ATA_FLAG_SLAVE_POSS; unsigned int devmask = 0, err_mask; u8 err; DPRINTK(ENTER\n); - if (ata_link_offline(ap-link)) { + if (ata_link_offline(link)) { classes[0] = ATA_DEV_NONE; goto out; } @@ -692,7 +693,7 @@ static void scc_bmdma_stop (struct ata_q printk(KERN_WARNING %s: Internal Bus Error\n, DRV_NAME); out_be32(bmid_base + SCC_DMA_INTST, INTSTS_BMSINT); /* TBD: SW reset */ - scc_std_softreset(ap, classes, deadline); + scc_std_softreset(ap-link, classes, deadline); continue; } @@ -731,7 +732,7 @@ static u8 scc_bmdma_status (struct ata_p void __iomem *mmio = ap-ioaddr.bmdma_addr; u8 host_stat = in_be32(mmio + SCC_DMA_STATUS); u32 int_status = in_be32(mmio + SCC_DMA_INTST); - struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap-active_tag); + struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap-link.active_tag); static int retry = 0; /* return if IOS_SS is cleared */ @@ -860,10 +861,10 @@ static void scc_bmdma_freeze (struct ata * @deadline: deadline jiffies for the operation */ -static int scc_pata_prereset(struct ata_port *ap, unsigned long deadline) +static int scc_pata_prereset(struct ata_link *link, unsigned long deadline) { - ap-cbl = ATA_CBL_PATA80; - return ata_std_prereset(ap, deadline); + link-ap-cbl = ATA_CBL_PATA80; + return ata_std_prereset(link, deadline); } /** @@ -874,8 +875,10 @@ static int scc_pata_prereset(struct ata_ * Note: Original code is ata_std_postreset(). */ -static void scc_std_postreset (struct ata_port *ap, unsigned int *classes) +static void scc_std_postreset(struct ata_link *link, unsigned int *classes) { + struct ata_port *ap = link-ap; + DPRINTK(ENTER\n); /* is double-select really necessary? */ ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [patch 04/28] Add cmpxchg64 and cmpxchg64_local to powerpc
Mathieu Desnoyers writes: Make sure that at least cmpxchg64_local is available on all architectures to use for unsigned long long values. Signed-off-by: Mathieu Desnoyers [EMAIL PROTECTED] Acked-by: Paul Mackerras [EMAIL PROTECTED] ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev