login
Header Space

 
 

Re: [PATCH 18/56] microblaze_v2: early_printk support

Previous thread: VFS + path walktrough by Enrico Weigelt on Monday, May 5, 2008 - 8:40 am. (19 messages)

Next thread: [git pull] Please pull powerpc.git powerpc-next branch by Paul Mackerras on Monday, May 5, 2008 - 8:57 am. (7 messages)
To: <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>
Date: Sunday, May 4, 2008 - 7:40 am

Hi All,

this is second set of patches. I fixed almost all bugs which
were reported in your emails.

As you know we are fixing syscall table and files related with it.
Please don't report bugs there.

Please send me all your suggestions.

I would like to catch 2.6.27. Please report all future bugs which can arise with it.

All changes are available on git.monstr.eu.

Thanks for your review,
Michal Simek


--
To: <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Sunday, May 4, 2008 - 7:40 am

From: Michal Simek &lt;monstr@monstr.eu&gt;


Signed-off-by: Michal Simek &lt;monstr@monstr.eu&gt;
---
 arch/microblaze/Kconfig                       |  149 +++++++++++++++++++++++++
 arch/microblaze/Kconfig.debug                 |   35 ++++++
 arch/microblaze/platform/Kconfig.platform     |   63 +++++++++++
 arch/microblaze/platform/generic/Kconfig.auto |   52 +++++++++
 4 files changed, 299 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/Kconfig
 create mode 100644 arch/microblaze/Kconfig.debug
 create mode 100644 arch/microblaze/platform/Kconfig.platform
 create mode 100644 arch/microblaze/platform/generic/Kconfig.auto

diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
new file mode 100644
index 0000000..49767d1
--- /dev/null
+++ b/arch/microblaze/Kconfig
@@ -0,0 +1,149 @@
+# For a description of the syntax of this configuration file,
+# see Documentation/kbuild/kconfig-language.txt.
+
+mainmenu "Linux/Microblaze Kernel Configuration"
+
+config MICROBLAZE
+	def_bool y
+	select HAVE_LMB
+
+config MMU
+	def_bool n
+
+config SWAP
+	def_bool n
+
+config RWSEM_GENERIC_SPINLOCK
+	def_bool y
+
+config RWSEM_XCHGADD_ALGORITHM
+	bool
+
+config ARCH_HAS_ILOG2_U32
+	def_bool n
+
+config ARCH_HAS_ILOG2_U64
+	def_bool n
+
+config GENERIC_FIND_NEXT_BIT
+	def_bool y
+
+config GENERIC_HWEIGHT
+	def_bool y
+
+config GENERIC_HARDIRQS
+	def_bool y
+
+config GENERIC_IRQ_PROBE
+	def_bool y
+
+config GENERIC_CALIBRATE_DELAY
+	def_bool y
+
+config PCI
+	def_bool n
+
+config NO_DMA
+	def_bool y
+
+config UID16
+	def_bool y
+
+config HZ
+	int
+	default 100
+
+config DEFCONFIG_LIST
+	string
+	default "arch/$ARCH/defconfig"
+
+source "init/Kconfig"
+
+source "arch/microblaze/platform/Kconfig.platform"
+
+menu "Processor type and features"
+
+config PREEMPT
+	bool "Preemptible Kernel"
+	help
+	  This option reduces the latency of the kernel when reacting to
+	  real-time or interactive events by allowing a low priority...
To: <monstr@...>
Cc: <linux-kernel@...>, <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, Michal Simek <monstr@...>
Date: Sunday, May 4, 2008 - 5:24 pm

Is this appropriate for mainline?  If so, it should have a better
description.  :-)

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--
To: Grant Likely <grant.likely@...>
Cc: <linux-kernel@...>, <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, Michal Simek <monstr@...>
Date: Monday, May 5, 2008 - 2:36 am

I forget to remove this option. I'll remove consistent.c file where was this

Michal
--
To: <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Sunday, May 4, 2008 - 7:40 am

From: Michal Simek &lt;monstr@monstr.eu&gt;


Signed-off-by: Michal Simek &lt;monstr@monstr.eu&gt;
---
 arch/microblaze/Makefile                  |   63 +++++++++++++++++++++++++++++
 arch/microblaze/boot/Makefile             |   17 ++++++++
 arch/microblaze/kernel/Makefile           |   17 ++++++++
 arch/microblaze/kernel/cpu/Makefile       |    8 ++++
 arch/microblaze/lib/Makefile              |    5 ++
 arch/microblaze/mm/Makefile               |    5 ++
 arch/microblaze/platform/Makefile         |    3 +
 arch/microblaze/platform/generic/Makefile |    3 +
 8 files changed, 121 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/Makefile
 create mode 100644 arch/microblaze/boot/Makefile
 create mode 100644 arch/microblaze/kernel/Makefile
 create mode 100644 arch/microblaze/kernel/cpu/Makefile
 create mode 100644 arch/microblaze/lib/Makefile
 create mode 100644 arch/microblaze/mm/Makefile
 create mode 100644 arch/microblaze/platform/Makefile
 create mode 100644 arch/microblaze/platform/generic/Makefile

diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
new file mode 100644
index 0000000..fb80b49
--- /dev/null
+++ b/arch/microblaze/Makefile
@@ -0,0 +1,63 @@
+UTS_SYSNAME = -DUTS_SYSNAME=\"uClinux\"
+
+# What CPU vesion are we building for, and crack it open
+# as major.minor.rev
+CPU_VER=$(subst ",,$(CONFIG_XILINX_MICROBLAZE0_HW_VER) )
+CPU_MAJOR=$(shell echo $(CPU_VER) | cut -d '.' -f 1)
+CPU_MINOR=$(shell echo $(CPU_VER) | cut -d '.' -f 2)
+CPU_REV=$(shell echo $(CPU_VER) | cut -d '.' -f 3)
+
+export CPU_VER CPU_MAJOR CPU_MINOR CPU_REV
+
+# Use cpu-related CONFIG_ vars to set compile options.
+
+# Work out HW multipler support.  This is icky.
+# 1. Spartan2 has no HW multiplers.
+# 2. MicroBlaze v3.x always uses them, except in Spartan 2
+# 3. All other FPGa/CPU ver combos, we can trust the CONFIG_ settings
+ifeq (,$(findstring spartan2,$(CONFIG_XILINX_MICROBLAZE0_FAMILY)))
+  ifeq ($(CPU_MAJOR),3)
+    CPUFLAGS-1 += -mno-xl-soft-mul
...
To: <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Sunday, May 4, 2008 - 7:40 am

From: Michal Simek &lt;monstr@monstr.eu&gt;


Signed-off-by: Michal Simek &lt;monstr@monstr.eu&gt;
---
 arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c |   83 +++++++++++++++++
 arch/microblaze/kernel/cpu/cpuinfo-static.c   |  117 +++++++++++++++++++++++++
 arch/microblaze/kernel/cpu/cpuinfo.c          |   91 +++++++++++++++++++
 include/asm-microblaze/cpuinfo.h              |  116 ++++++++++++++++++++++++
 4 files changed, 407 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
 create mode 100644 arch/microblaze/kernel/cpu/cpuinfo-static.c
 create mode 100644 arch/microblaze/kernel/cpu/cpuinfo.c
 create mode 100644 include/asm-microblaze/cpuinfo.h

diff --git a/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c b/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
new file mode 100644
index 0000000..fa061a3
--- /dev/null
+++ b/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
@@ -0,0 +1,83 @@
+/*
+ * arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
+ *
+ * Support for MicroBlaze PVR (processor version register)
+ *
+ * Copyright (C) 2007 John Williams &lt;john.williams@petalogix.com&gt;
+ * Copyright (C) 2007 PetaLogix
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ */
+
+#include &lt;linux/init.h&gt;
+#include &lt;linux/string.h&gt;
+#include &lt;linux/autoconf.h&gt;
+#include &lt;asm/pvr.h&gt;
+#include &lt;asm/cpuinfo.h&gt;
+
+/*
+ * Helper macro to map between fields in our struct cpuinfo, and
+ * the PVR macros in pvr.h.
+ */
+
+#define CI(c, p) ci-&gt;c = PVR_##p(pvr)
+
+void set_cpuinfo_pvr_full(struct cpuinfo *ci)
+{
+	struct pvr_s pvr;
+	get_pvr(&amp;pvr);
+
+	CI(use_barrel, USE_BARREL);
+	CI(use_divider, USE_DIV);
+	CI(use_mult, USE_HW_MUL);
+	CI(use_fpu, USE_FPU);
+
+	CI(use_mul_64, USE_MUL64);
+	CI(use_msr_instr, USE_MSR_INSTR);
+	CI(use_pcmp_instr, USE_PCMP_INSTR);
+	CI(ver_code, ...
To: <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Sunday, May 4, 2008 - 7:40 am

From: Michal Simek &lt;monstr@monstr.eu&gt;


Signed-off-by: Michal Simek &lt;monstr@monstr.eu&gt;
---
 arch/microblaze/kernel/prom.c        | 1653 ++++++++++++++++++++++++++++++++++
 include/asm-microblaze/of_device.h   |   41 +
 include/asm-microblaze/of_platform.h |   45 +
 include/asm-microblaze/prom.h        |  311 +++++++
 4 files changed, 2050 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/prom.c
 create mode 100644 include/asm-microblaze/of_device.h
 create mode 100644 include/asm-microblaze/of_platform.h
 create mode 100644 include/asm-microblaze/prom.h

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
new file mode 100644
index 0000000..7c9793a
--- /dev/null
+++ b/arch/microblaze/kernel/prom.c
@@ -0,0 +1,1653 @@
+/*
+ * Procedures for creating, accessing and interpreting the device tree.
+ *
+ * Paul Mackerras	August 1996.
+ * Copyright (C) 1996-2005 Paul Mackerras.
+ *
+ *  Adapted for 64bit PowerPC by Dave Engebretsen and Peter Bergner.
+ *    {engebret|bergner}@us.ibm.com
+ *
+ *      This program is free software; you can redistribute it and/or
+ *      modify it under the terms of the GNU General Public License
+ *      as published by the Free Software Foundation; either version
+ *      2 of the License, or (at your option) any later version.
+ */
+
+#undef DEBUG
+
+#include &lt;stdarg.h&gt;
+#include &lt;linux/kernel.h&gt;
+#include &lt;linux/string.h&gt;
+#include &lt;linux/init.h&gt;
+#include &lt;linux/threads.h&gt;
+#include &lt;linux/spinlock.h&gt;
+#include &lt;linux/types.h&gt;
+#include &lt;linux/pci.h&gt;
+#include &lt;linux/stringify.h&gt;
+#include &lt;linux/delay.h&gt;
+#include &lt;linux/initrd.h&gt;
+#include &lt;linux/bitops.h&gt;
+#include &lt;linux/module.h&gt;
+#include &lt;linux/kexec.h&gt;
+#include &lt;linux/debugfs.h&gt;
+#include &lt;linux/irq.h&gt;
+#include &lt;linux/lmb.h&gt;
+
+#include &lt;asm/prom.h&gt;
+#include &lt;asm/page.h&gt;
+#include &lt;asm/processor...
To: <microblaze-uclinux@...>, <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Wednesday, May 7, 2008 - 12:04 pm

or PPC32

Steve


--
To: <microblaze-uclinux@...>
Cc: <linux-kernel@...>, <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Wednesday, May 7, 2008 - 2:40 pm

Hi Steve,

you are right. Microblaze don't need CONFIG_PPC_something but
I keep this in files because it will be easier to move this to better place.
I wanted to sort what Microblaze don't use.

I need to talk with people from sparc and powerpc what we can move and where.
I see the best way to push these files to microblaze/kernel/ and then sychronize
them with one patch - all archs together.

--
To: <monstr@...>
Cc: <microblaze-uclinux@...>, <linux-kernel@...>, <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, Michal Simek <monstr@...>
Date: Wednesday, May 7, 2008 - 2:59 pm

I would disagree.  I think its better to push (and get merged) patches
to move the files first; then add microblaze on top of that.  You can
start getting stuff merged piecemeal that way instead of relying on
getting your entire patch series merged at once.

However, that's just my opinion, others may look at it differently.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--
To: Grant Likely <grant.likely@...>
Cc: <monstr@...>, <microblaze-uclinux@...>, <linux-kernel@...>, <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, Paul Mackerras <paulus@...>, Stephen Rothwell <sfr@...>, David Miller <davem@...>
Date: Wednesday, May 7, 2008 - 3:12 pm

Hi Grant,

you understand I use of_device, of_platform and prom_parse. If you do diff
between them they will almost the same. One small difference is in prom.c file.

I hope we will move these files to drivers/of.
This is not only question to me.

Paul, Steve and David: Can I moved these three files to drivers/of?


--
To: <microblaze-uclinux@...>, Grant Likely <grant.likely@...>
Cc: <linux-kernel@...>, <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, Paul Mackerras <paulus@...>, Stephen Rothwell <sfr@...>, David Miller <davem@...>
Date: Wednesday, May 7, 2008 - 4:14 pm

I'm don't think all of this code should move.

In particular, parts of prom_parse.c dealing with irqs handle virtual
irqs in a powerpc specific way.
I also think ifdef PPC_PSERIES and PPC_64 and PPC_32 in prom.c are
indicative of the fact that alot of this is dealing with
architecture-specific issues.

Probably some parts of these files, but it's going to take some tweezing
to figure out what parts.



--
To: <monstr@...>, <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Monday, May 5, 2008 - 5:56 pm

Michal,

You're missing some of the stuff implemented in powerpc/prom_parse.c, in
particular this:




--
To: Stephen Neuendorffer <stephen.neuendorffer@...>
Cc: <linux-kernel@...>, <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Tuesday, May 6, 2008 - 3:27 am

In prom.h is it. prom_parse.c of_device.c and of_platform.c will be in drivers/of/

--
To: <monstr@...>
Cc: <linux-kernel@...>, <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <microblaze-uclinux@...>, Michal Simek <monstr@...>, linuxppc-dev <linuxppc-dev@...>
Date: Monday, May 5, 2008 - 10:24 am

another mostly-clone from arch/powerpc/kernel.  Is anyone working on
moving the guts of this file to a common location?

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--
To: <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Sunday, May 4, 2008 - 7:40 am

From: Michal Simek &lt;monstr@monstr.eu&gt;


Signed-off-by: Michal Simek &lt;monstr@monstr.eu&gt;
---
 include/asm-microblaze/semaphore.h |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/semaphore.h

diff --git a/include/asm-microblaze/semaphore.h b/include/asm-microblaze/semaphore.h
new file mode 100644
index 0000000..cdb1e05
--- /dev/null
+++ b/include/asm-microblaze/semaphore.h
@@ -0,0 +1,16 @@
+/*
+ * include/asm-microblaze/semaphore.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2007 Michal Simek &lt;monstr@monstr.eu&gt;
+ */
+
+#ifndef _ASM_MICROBLAZE_SEMAPHORE_H
+#define _ASM_MICROBLAZE_SEMAPHORE_H
+
+#include &lt;linux/semaphore.h&gt;
+
+#endif /* _ASM_MICROBLAZE_SEMAPHORE_H */
-- 
1.5.4.GIT

--
To: <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Sunday, May 4, 2008 - 7:40 am

From: Michal Simek &lt;monstr@monstr.eu&gt;


Signed-off-by: Michal Simek &lt;monstr@monstr.eu&gt;
---
 arch/microblaze/kernel/exceptions.c           |   78 +++++
 arch/microblaze/kernel/hw_exception_handler.S |  395 +++++++++++++++++++++++++
 include/asm-microblaze/exceptions.h           |   66 ++++
 3 files changed, 539 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/exceptions.c
 create mode 100644 arch/microblaze/kernel/hw_exception_handler.S
 create mode 100644 include/asm-microblaze/exceptions.h

diff --git a/arch/microblaze/kernel/exceptions.c b/arch/microblaze/kernel/exceptions.c
new file mode 100644
index 0000000..9b92e56
--- /dev/null
+++ b/arch/microblaze/kernel/exceptions.c
@@ -0,0 +1,78 @@
+/*
+ * arch/microblaze/kernel/exceptions.c - HW exception handling
+ *
+ * Copyright (C) 2007 Xilinx, Inc.
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ */
+
+#include &lt;linux/kernel.h&gt;
+#include &lt;linux/signal.h&gt;
+#include &lt;linux/sched.h&gt;
+#include &lt;asm/exceptions.h&gt;
+#include &lt;asm/entry.h&gt;		/* For KM CPU var */
+
+/* Initialize_exception_handlers() - called from setup.c/trap_init() */
+void initialize_exception_handlers(void)
+{
+}
+
+#define MICROBLAZE_ILL_OPCODE_EXCEPTION	0x02
+#define MICROBLAZE_IOPB_BUS_EXCEPTION	0x03
+#define MICROBLAZE_DOPB_BUS_EXCEPTION	0x04
+#define MICROBLAZE_DIV_ZERO_EXCEPTION	0x05
+#define MICROBLAZE_FPU_EXCEPTION	0x06
+
+static void handle_unexpected_exception(unsigned int esr,
+				unsigned int kernel_mode, unsigned int addr)
+{
+	printk(KERN_WARNING "Unexpected exception %02x in %s mode, PC=%08x\n",
+		esr, kernel_mode ? "kernel" : "user", addr);
+}
+
+static void handle_exception(const char *message, int signal,
+				unsigned int kernel_mode, unsigned int addr)
+{
+	if (kernel_mode)
+		panic("%s in the kernel mode, PC=%08x\n", message, a...
To: <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Sunday, May 4, 2008 - 7:40 am

From: Michal Simek &lt;monstr@monstr.eu&gt;


Signed-off-by: Michal Simek &lt;monstr@monstr.eu&gt;
---
 arch/microblaze/kernel/signal.c |  534 +++++++++++++++++++++++++++++++++++++++
 include/asm-microblaze/signal.h |  199 +++++++++++++++
 2 files changed, 733 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/signal.c
 create mode 100644 include/asm-microblaze/signal.h

diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c
new file mode 100644
index 0000000..dc9f273
--- /dev/null
+++ b/arch/microblaze/kernel/signal.c
@@ -0,0 +1,534 @@
+/*
+ * arch/microblaze/kernel/signal.c -- Signal handling
+ *
+ * Copyright (C) 2003,2004 John Williams &lt;jwilliams@itee.uq.edu.au&gt;
+ * Copyright (C) 2001 NEC Corporation
+ * Copyright (C) 2001 Miles Bader &lt;miles@gnu.org&gt;
+ * Copyright (C) 1999,2000 Niibe Yutaka &amp; Kaz Kojima
+ * Copyright (C) 1991,1992 Linus Torvalds
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson
+ *
+ * This file was was derived from the sh version, arch/sh/kernel/signal.c
+ */
+
+#include &lt;linux/sched.h&gt;
+#include &lt;linux/mm.h&gt;
+#include &lt;linux/smp.h&gt;
+#include &lt;linux/smp_lock.h&gt;
+#include &lt;linux/kernel.h&gt;
+#include &lt;linux/signal.h&gt;
+#include &lt;linux/errno.h&gt;
+#include &lt;linux/wait.h&gt;
+#include &lt;linux/ptrace.h&gt;
+#include &lt;linux/unistd.h&gt;
+#include &lt;linux/stddef.h&gt;
+#include &lt;linux/personality.h&gt;
+#include &lt;linux/percpu.h&gt;
+#include &lt;asm/entry.h&gt;
+#include &lt;asm/ucontext.h&gt;
+#include &lt;asm/uaccess.h&gt;
+#include &lt;asm/pgtable.h&gt;
+#include &lt;asm/pgalloc.h&gt;
+#include &lt;asm/signal.h&gt;
+
+#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
+
+asmlinkage int do_signal(struct pt_regs *regs, sigset...
To: <monstr@...>, <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Monday, May 5, 2008 - 5:32 pm

(multiple places)  can this code (and flush_cache_sigtramp()) go away?

+#if 0
+		flush_cache_sigtramp((unsigned long)frame-&gt;tramp);
+#endif


--
To: Stephen Neuendorffer <stephen.neuendorffer@...>
Cc: <monstr@...>, <linux-kernel@...>, <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Monday, May 5, 2008 - 7:33 pm

You have to icache_invalidate the sigtramp because you are writing into
memory that will shortly be executed. 

I'm not sure why this is #if'd away in the first place?

John


--
To: John Williams <john.williams@...>
Cc: <monstr@...>, <linux-kernel@...>, <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Monday, May 5, 2008 - 8:13 pm

I'm somewhat ignorant about what this code is attempting to do, but with
some quick poking around (m68knommu, blackfin) seems to suggest that
other architectures don't do this, while others (v850) have almost
exactly the same code (although they are somewhat smarter and are
careful not to flush the whole cache).

At the very least, it seems like there is some work in this area needed.



--
To: Stephen Neuendorffer <stephen.neuendorffer@...>
Cc: <monstr@...>, <linux-kernel@...>, <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Monday, May 5, 2008 - 8:25 pm

flush_cache_sigtramp should just invalidate 8 bytes up from the base
address of the trampoline.  This is just the region on the process stack
where we insert a kind of call-back back.  Writing the opcodes goes via
the dcache, and so there's a vanishingly small possibility that the CPU
will get a false hit on on an icache fetch when the code is executed.

That was what Michal's patch had when I scanned it yesterday.  It
certainly won't/shouldn't be invalidating the entire cache.

Cheers,

John


--
To: John Williams <john.williams@...>
Cc: <monstr@...>, <linux-kernel@...>, <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Monday, May 5, 2008 - 8:33 pm

You're right.  (I think I've been staring at this too much today... :)



--
To: Stephen Neuendorffer <stephen.neuendorffer@...>
Cc: John Williams <john.williams@...>, <monstr@...>, <linux-kernel@...>, <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>
Date: Tuesday, May 6, 2008 - 5:41 am

I hope that conclusion is remove #if 0 from signal.c code.


--
To: <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Sunday, May 4, 2008 - 7:40 am

From: Michal Simek &lt;monstr@monstr.eu&gt;


Signed-off-by: Michal Simek &lt;monstr@monstr.eu&gt;
---
 arch/microblaze/kernel/hack.c  |   82 ++++++++++++++++++
 arch/microblaze/kernel/intc.c  |  186 ++++++++++++++++++++++++++++++++++++++++
 arch/microblaze/kernel/irq.c   |  100 +++++++++++++++++++++
 arch/microblaze/kernel/timer.c |  164 +++++++++++++++++++++++++++++++++++
 include/asm-microblaze/hack.h  |   24 +++++
 include/asm-microblaze/irq.h   |   44 ++++++++++
 6 files changed, 600 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/hack.c
 create mode 100644 arch/microblaze/kernel/intc.c
 create mode 100644 arch/microblaze/kernel/irq.c
 create mode 100644 arch/microblaze/kernel/timer.c
 create mode 100644 include/asm-microblaze/hack.h
 create mode 100644 include/asm-microblaze/irq.h

diff --git a/arch/microblaze/kernel/hack.c b/arch/microblaze/kernel/hack.c
new file mode 100644
index 0000000..855e3c2
--- /dev/null
+++ b/arch/microblaze/kernel/hack.c
@@ -0,0 +1,82 @@
+/*
+ * arch/microblaze/kernel/hack.c
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2007 Michal Simek &lt;monstr@monstr.eu&gt;
+ */
+
+#include &lt;linux/interrupt.h&gt;
+#include &lt;asm/hack.h&gt;
+
+#undef DEBUG
+
+/* NOTE
+ * self-modified part of code for improvement of interrupt controller
+ * save instruction in interrupt rutine
+ */
+void function_hack(const int *arr_fce, const unsigned int base)
+{
+	unsigned int flags = 0;
+	unsigned int j, i;
+	unsigned int *addr = NULL;
+
+	local_irq_save(flags);
+	__disable_icache();
+
+	/* zero terminated array */
+	for (j = 0; arr_fce[j] != 0; j++) {
+		/* get start address of function */
+		addr = (unsigned int *) arr_fce[j];
+		pr_debug("%s: func(%d) at 0x%x\n",
+					__func__, j, (unsigned int) addr);
+		for (i = 0;; i++) {
+			pr_debug("%s: instruction code at...
To: <monstr@...>
Cc: <linux-kernel@...>, <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Wednesday, May 7, 2008 - 3:04 am

Michal,



Just a coding style nit:

       unsigned int i, j, flags, *addr = NULL;


Please replace all those hex constants with proper named defines so

Please split this modification code out into a separate function. The


Please use a sensible name for that config switch and the constants

Please create a macro for that instead of uglyfying each function with
ifdeffery

#ifdef CONFIG_XXXX
# define INTC_BASE	XXX_BASE_ADDR
#else
# define INTC_BASE	intc_baseaddr
#endif

So now your functions reads simple:

       unsigned int mask = (0x00000001 &lt;&lt; (irq &amp; 31));


Please do not do that. Create two irq_chips one for level and one for
edge with different implementations of the functions so you don't have

With two irq chips this would be:

	for (i = 0; i &lt; NR_IRQ; ++i) {
		if (handle &amp; (0x00000001 &lt;&lt; i)) {
		        set_irq_chip_and_handler(irq, &amp;intc_edge, handle_edge_irq);
			irq_desc[i].status &amp;= ~IRQ_LEVEL;
		} else {
		        set_irq_chip_and_handler(irq, &amp;intc_level, handle_level_irq);
			irq_desc[i].status |= IRQ_LEVEL;
		}


Please do not use __do_IRQ() use the handlers which provide per
interrupt type optimized handlers.

	  struct irq_desc *desc = irq_desc + irq;




Can you please move a new architecture to clockevents / clocksource
right from the beginning ? No need to invent another incompatible set

Grr. Please use defines for everything and do not hardcode stuff here
and there and make a define depend on some hardcoded value in a c





Already defined in include/linux/interrupt.h

Thanks,
	tglx
--
To: Thomas Gleixner <tglx@...>
Cc: <linux-kernel@...>, <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Sunday, May 11, 2008 - 9:55 am

Hi Thomas,










It is a little bit different but with sililar style. You can check it in next







is used in serial_core.c


Thanks for your review,

Michal Simek
--
To: Michal Simek <monstr@...>
Cc: <linux-kernel@...>, <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Sunday, May 11, 2008 - 10:35 am

Michal,


Please use a (inline) function whenever possible. Macros are harder to

GENERIC_TIME and GENERIC_CLOCKEVENTS. You get high resolution timers

Doh, forgot about that one.

Thanks,
	tglx
--
To: Thomas Gleixner <tglx@...>
Cc: <linux-kernel@...>, <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Sunday, May 11, 2008 - 5:55 pm

About CLOCKEVENTS. I looked at arm/mach-versatile/

and I found I need implement:
loading current timer value - clocksource.read

clock_event_device.set_mode - set one from fourth modes
clock_event_device.set_next_event - the same mode with new init timer value
(this is little bit mess for me because arm do this that only change actual
counting value - I hope I do that too).

Supported modes are:
CLOCK_EVT_MODE_PERIODIC - reload and timer interrupt
CLOCK_EVT_MODE_ONESHOT - one interrupt at zero value and end - no others interrupts.
CLOCK_EVT_MODE_UNUSED: What is it?
CLOCK_EVT_MODE_SHUTDOWN: What is it?
CLOCK_EVT_MODE_RESUME: What is it?


I hope I can use only one timer(adding extra timers is not problem).
We have one timer with two timebase (that's one option in IP core).

And there is necessary to fill some value in timer initializing
timer0_clockevent.mult - nanosecond to cycles multiplier ?
timer0_clockevent.shift - nanoseconds to cycles divisor (power of two)?
timer0_clockevent.irq - irq from our intc.
timer0_clockevent.min_delta_ns - minimal timer resolution (I think this value
have to be sensible for system)
timer0_clockevent.max_delta_ns - maximal timer resolution
timer0_clockevent.cpumask = 0 for 1 cpu

I hope others is set by general code.

and change handler function to calling evt-&gt;enent_handler;

I found that archs use sys for showing values.

I hope I can see that this systems works via /proc/interrupts and from sysfs.

Am I right?

Thanks,
Michal

--
To: <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Sunday, May 4, 2008 - 7:40 am

From: Michal Simek &lt;monstr@monstr.eu&gt;


Signed-off-by: Michal Simek &lt;monstr@monstr.eu&gt;
---
 arch/microblaze/kernel/cpu/cache.c  |  256 +++++++++++++++++++++++++++++++++++
 include/asm-microblaze/cache.h      |   47 +++++++
 include/asm-microblaze/cacheflush.h |   72 ++++++++++
 3 files changed, 375 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/cpu/cache.c
 create mode 100644 include/asm-microblaze/cache.h
 create mode 100644 include/asm-microblaze/cacheflush.h

diff --git a/arch/microblaze/kernel/cpu/cache.c b/arch/microblaze/kernel/cpu/cache.c
new file mode 100644
index 0000000..d6a1eab
--- /dev/null
+++ b/arch/microblaze/kernel/cpu/cache.c
@@ -0,0 +1,256 @@
+/*
+ * arch/microblaze/kernel/cpu/cache.c
+ * Cache control for MicroBlaze cache memories
+ *
+ * Copyright (C) 2007 Michal Simek &lt;monstr@monstr.eu&gt;
+ * Copyright (C) 2007 PetaLogix
+ * Copyright (C) 2007 John Williams &lt;john.williams@petalogix.com&gt;
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ */
+
+#include &lt;asm/cacheflush.h&gt;
+#include &lt;asm/cache.h&gt;
+#include &lt;asm/cpuinfo.h&gt;
+
+/* Exported functions */
+
+void _enable_icache(void)
+{
+	if (cpuinfo.use_icache) {
+#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
+		__asm__ __volatile__ ("					\
+				msrset	r0, %0;				\
+				nop; "					\
+				:					\
+				: "i" (MSR_ICE)				\
+				: "memory");
+#else
+		__asm__ __volatile__ ("					\
+				mfs	r12, rmsr;			\
+				ori	r12, r12, %0;			\
+				mts	rmsr, r12;			\
+				nop; "					\
+				:					\
+				: "i" (MSR_ICE)				\
+				: "memory", "r12");
+#endif
+	}
+}
+
+void _disable_icache(void)
+{
+	if (cpuinfo.use_icache) {
+#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
+		__asm__ __volatile__ ("					\
+				msrclr r0, %0;				\
+				nop; "					\
+				:					\
+				: "i" (MSR_ICE)				\
+				: "memory");
+#els...
To: <monstr@...>, <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Monday, May 5, 2008 - 6:37 pm

Primarily, this patch implements the dma-coherent API.  In addition,
it cleans up some of the code that deals with caches, in order to
match the usage in dma-coherent.

In particular, the dcache in the microblaze is write through, so the
existing code is more easily thought of as 'invalidation' than
'flushing'.  In addition, some of the flush_* methods were old, and
some shouldn't need to be implemented (since currently no mmu is
supported).

I'd appreciate if someone would ACK my interpretation of
Documentation/cachetlb.txt.  In particular:

flush_cache_mm(mm) (NOOP because nommu)
flush_cache_range(mm, start, end) (Does this need to be implemented
since nommu?)
flush_cache_page(vma, vmaddr) (NOOP because nommu)
flush_dcache_page(page) (NOOP because write through cache.)
flush_dcache_range(start, end) (NOOP because write through cache.)
flush_dcache_mmap_lock(mapping) (NOOP because nommu)
flush_dcache_mmap_unlock(mapping) (NOOP because nommu)

flush_icache_page(vma,pg) (Does this need to be implemented? Doc is
unclear, but I assume it is used as flush_icache_range)
flush_icache_range(start, end) (Must be implemented because icache
doesn't snoop dcache on code loads)

Signed-off-by: Stephen Neuendorffer &lt;stephen.neuendorffer@xilinx.com&gt;
---
 arch/microblaze/kernel/cpu/cache.c  |   37 +---------
 arch/microblaze/kernel/setup.c      |    4 +-
 arch/microblaze/mm/dma-coherent.c   |  122
+++++++++++++++++++++++++++++++++++
 include/asm-microblaze/cacheflush.h |   71 +++++++++------------
 4 files changed, 158 insertions(+), 76 deletions(-)
 create mode 100644 arch/microblaze/mm/dma-coherent.c

diff --git a/arch/microblaze/kernel/cpu/cache.c
b/arch/microblaze/kernel/cpu/cache.c
index d6a1eab..1247b9e 100644
--- a/arch/microblaze/kernel/cpu/cache.c
+++ b/arch/microblaze/kernel/cpu/cache.c
@@ -129,7 +129,7 @@ void _invalidate_dcache(unsigned int addr)
 				: "r" (addr));
 }
 
-void __flush_icache_all(void)
+void __invalidate_icache_all(void)
 {
 	unsigned int i;
 	u...
To: <microblaze-uclinux@...>, <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Monday, May 5, 2008 - 1:37 pm

The microblaze has a write through data cache, hence 'flush' is really a
misnomer here and interesting methods are 'invalidate'.  In addition,
most of these functions should be used directly by an implementation of
dma-coherent.c (which I can't find in your patches).  

I'll try to cook up a patch for you with this today.



--
To: Stephen Neuendorffer <stephen.neuendorffer@...>
Cc: <microblaze-uclinux@...>, <linux-kernel@...>, <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <grant.likely@...>
Date: Tuesday, May 6, 2008 - 5:22 am

I removed consistent.c or dma-coherent.c from files. I don't need this code for
now. Microblaze is currently no DMA arch.
I know we need this to ll_temac work but not now. I added this to my plan after
first pull.


--
To: <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Sunday, May 4, 2008 - 7:40 am

From: Michal Simek &lt;monstr@monstr.eu&gt;


Signed-off-by: Michal Simek &lt;monstr@monstr.eu&gt;
---
 arch/microblaze/platform/generic/system.dts |  137 +++++++++++++++++++++++++++
 1 files changed, 137 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/platform/generic/system.dts

diff --git a/arch/microblaze/platform/generic/system.dts b/arch/microblaze/platform/generic/system.dts
new file mode 100644
index 0000000..91eac31
--- /dev/null
+++ b/arch/microblaze/platform/generic/system.dts
@@ -0,0 +1,137 @@
+/*
+ * (C) Copyright 2007 Michal Simek
+ *
+ * Michal SIMEK &lt;monstr@monstr.eu&gt;
+ *
+ * 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, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ * CAUTION: This file is automatically generated by libgen.
+ * Version: Xilinx EDK 9.2 EDK_Jm.16
+ * Generate by U-BOOT v4.00.b
+ */
+
+/ {
+	#address-cells = &lt;1&gt;;
+	#size-cells = &lt;1&gt;;
+	compatible = "ibm,opb";
+	model = "testing";
+	DDR_SDRAM_32Mx16: memory@44000000 {
+		device_type = "memory";
+		reg = &lt; 44000000 2000000 &gt;;
+	} ;
+	chosen {
+		bootargs = "root=mtdblock0";
+	} ;
+	cpus {
+		#address-cells = &lt;1&gt;;
+		#cpus = &lt;1&gt;;
+		#size-cells = &lt;0&gt;;
+		microblaze,5.00.c@0 {
+			clock-frequency = &lt;3f940ab&gt;;
+			d-cache-baseaddr = &lt;44000000&gt;;
+			d-cache-highaddr = &lt;47ffffff&gt;;
...
To: <monstr@...>, <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Monday, May 5, 2008 - 1:25 pm

I think it would be nice if dts files were stored in boot/dts, as on
powerpc, which would reduce confusion.


--
To: Stephen Neuendorffer <stephen.neuendorffer@...>
Cc: <monstr@...>, <linux-kernel@...>, <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Monday, May 5, 2008 - 7:16 pm

I'm not so sure.  By grouping 

 * the DTS
 * Kconfig.auto (now just storing CPU parameters for CPUFLAGS); and
 * board-specific setup.c if required, 

we concentrate in one place, in a single subdir of
arch/microblaze/platform/*, all of the board specific info.  

Maybe our Kbuild should copy the platform .dts file out of the platform
dir and into microblaze/boot, like we do with the finished kernel?  Then
it's ready to be picked up by the user or some higher level build tool.

If users or vendors want to maintain multiple DTS files for a single
board, again they can just collect them in the platform subdir so their
intended target remains obvious.

-- 
John Williams, PhD, B.Eng, B.IT
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com  p: +61-7-30090663  f: +61-7-30090663


--
To: John Williams <john.williams@...>
Cc: <monstr@...>, <linux-kernel@...>, <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Monday, May 5, 2008 - 7:32 pm

The .dts is not board specific, it's design specific.  In my opinion,
this is not something that 'a vendor might maintain multiple versions
of': instead it is in most cases simply fundamental to the FPGA design
flow.  In fact, in most cases, I'd like to make the .dts file part of
the bitstream and not compiled into the kernel.

Although powerpc has a bit more boot-time complexity than the microblaze
does currently, I think it makes alot of sense to have some consistency
here, and there is already a pattern to follow here which nicely
orthogonalizes multiple .dts files for the same platform code.



--
To: Stephen Neuendorffer <stephen.neuendorffer@...>
Cc: John Williams <john.williams@...>, <monstr@...>, <linux-kernel@...>, <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>
Date: Tuesday, May 6, 2008 - 3:38 am

I have not compiled DTB with kernel!!! This not make sense. This was the first
thing which I removed some month ago.
I registered discussion about incorporating DTB to bitstream. It's bogus because
if you do it, you can't change any parameters. If you want to DTB in your
design, you can add xps_bram (or whatever) to your design and you can load DTB
with bitstream.


--
To: Stephen Neuendorffer <stephen.neuendorffer@...>
Cc: <monstr@...>, <linux-kernel@...>, <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Monday, May 5, 2008 - 8:10 pm

Sure.  I'm not sure how that changes where the .DTS files should be
stored.

I find it extremely helpful from a configuration management point of
view to cluster together all of the platform-specific code and data.  I
also think it simplifies things for users, and that makes my life easier

Sure it is.  Here's an ML505 design using the DVI video out.  Here's one
using the LL_TEMAC in SGMII mode.  Multiple designs, same board, all
will use the same board init but different DTS files.

These could be thrown down in /boot along with every other tree, but
why?  They have nothing in common with the other files down there, and
everything in common with the board/design-specific code.


Well, I've just run out of BRAM on a V5LX50T design so please don't ask
for more of it to store a DTC! :)  Or do you mean to piggyback on the
tail of the configuration stream and read with some kind of JTAG user

arch/powerpc/boot is building a bootloader, so maybe that's why .dts
files belong there.  The bootloader is really the only thing that cares
about them as objects.  Once the kernel starts, it's just dereferencing
a pointer that happens to point to a datastructure it understands (or
copying it as a blob before doing same).

In fact, you could mount an argument that .dts files don't belong
anywhere near the MicroBlaze kernel, since our build process never
actually touches them.  

cheers,

John


--
To: John Williams <john.williams@...>
Cc: Stephen Neuendorffer <stephen.neuendorffer@...>, <monstr@...>, <linux-kernel@...>, <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>
Date: Tuesday, May 6, 2008 - 3:50 am

In fact. PowerPC has almost the same boot-time complexity as Microblaze has.
Just use U-BOOT and you can see. You can handle with DTB, you can change
everything there. I think it's good time for Xilinx to look at it. You will be
surprised what is there. :-)

I designed a startup part as complex can be. Passing three parameters to kernel
direct everything. You can compile DTB to kernel for final products - only set
one param to address in kernel. You can load DTB externally. You can use
compiled in FS you can use special image with FS. (I haven't tested Initramfs).
U-BOOT supports FIT where you can have many kernels, many fs with many DTB. All
in one pack. :-)
http://git.denx.de/?p=u-boot.git;a=tree;f=doc/uImage.FIT;h=b47619b84e4c1aa70911156af5a...

Michal
--
To: John Williams <john.williams@...>
Cc: <monstr@...>, <linux-kernel@...>, <arnd@...>, <linux-arch@...>, John Linn <linnj@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Monday, May 5, 2008 - 8:17 pm

That's a possibility.  More likely, it can get stuffed in the low BRAM
and ripped out during boot time.  I've got the same trick working on

Well, that was part of my argument that they shouldn't be part of the
platform code, but I guess I wasn't clear enough... :)

Steve



--
To: <monstr@...>
Cc: <linux-kernel@...>, <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, Michal Simek <monstr@...>
Date: Monday, May 5, 2008 - 10:31 am

What is the purpose of the generic dts?  Will this work with custom
microblaze designs?  The header block should contain a comment about
what this file is for.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--
To: Grant Likely <grant.likely@...>
Cc: <linux-kernel@...>, <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, Michal Simek <monstr@...>
Date: Monday, May 5, 2008 - 4:07 pm

This file has only demonstration purpose. That's all.
This kernel has no relation with any board or design. This could be introduce
e.g. in petalogix distribution or in xilinx where you distribute this kernel
with specific hw design. That's one more reason why I want to keep system.dts in
platform specific folder too.

M
--
To: <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Sunday, May 4, 2008 - 7:41 am

From: Michal Simek &lt;monstr@monstr.eu&gt;


Signed-off-by: Michal Simek &lt;monstr@monstr.eu&gt;
---
 arch/microblaze/kernel/microblaze_ksyms.c |   49 ++++++++++
 arch/microblaze/kernel/module.c           |  149 +++++++++++++++++++++++++++++
 include/asm-microblaze/module.h           |   41 ++++++++
 3 files changed, 239 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/microblaze_ksyms.c
 create mode 100644 arch/microblaze/kernel/module.c
 create mode 100644 include/asm-microblaze/module.h

diff --git a/arch/microblaze/kernel/microblaze_ksyms.c b/arch/microblaze/kernel/microblaze_ksyms.c
new file mode 100644
index 0000000..3efa1a1
--- /dev/null
+++ b/arch/microblaze/kernel/microblaze_ksyms.c
@@ -0,0 +1,49 @@
+/*
+ * arch/microblaze/kernel/microblaze_ksyms.c
+ *
+ * Copyright (C) 2008 Michal Simek &lt;monstr@monstr.eu&gt;
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include &lt;linux/module.h&gt;
+#include &lt;linux/string.h&gt;
+#include &lt;linux/cryptohash.h&gt;
+#include &lt;linux/delay.h&gt;
+#include &lt;linux/in6.h&gt;
+#include &lt;linux/syscalls.h&gt;
+
+#include &lt;asm/checksum.h&gt;
+#include &lt;asm/io.h&gt;
+#include &lt;asm/page.h&gt;
+#include &lt;asm/system.h&gt;
+#include &lt;asm/uaccess.h&gt;
+
+/*
+ * libgcc functions - functions that are used internally by the
+ * compiler... (prototypes are not correct though, but that
+ * doesn't really matter since they're not versioned).
+ */
+extern void __ashldi3(void);
+EXPORT_SYMBOL(__ashldi3);
+extern void __ashrdi3(void);
+EXPORT_SYMBOL(__ashrdi3);
+extern void __divsi3(void);
+EXPORT_SYMBOL(__divsi3);
+extern void __lshrdi3(void);
+EXPORT_SYMBOL(__lshrdi3);
+extern void __modsi3(void);
+EXPORT_SYMBOL(__modsi3);
+extern void __mulsi3(void);
+EXPORT_SYMBOL(__mulsi3);
+extern void __muldi3(void);
+EXPORT_SYMBOL(__mu...
To: <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Sunday, May 4, 2008 - 7:41 am

From: Michal Simek &lt;monstr@monstr.eu&gt;


Signed-off-by: Michal Simek &lt;monstr@monstr.eu&gt;
---
 include/asm-microblaze/lmb.h |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/lmb.h

diff --git a/include/asm-microblaze/lmb.h b/include/asm-microblaze/lmb.h
new file mode 100644
index 0000000..40d5f65
--- /dev/null
+++ b/include/asm-microblaze/lmb.h
@@ -0,0 +1,21 @@
+/*
+ * include/asm-microblaze/lmb.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2008 Michal Simek &lt;monstr@monstr.eu&gt;
+ */
+
+#ifndef _ASM_MICROBLAZE_LMB_H
+#define _ASM_MICROBLAZE_LMB_H
+
+/*#define LMB_DBG(fmt...) pr_debug(fmt) */
+
+/* LMB limit is OFF */
+#define LMB_REAL_LIMIT	0xFFFFFFFF
+
+#endif /* _ASM_MICROBLAZE_LMB_H */
+
+
-- 
1.5.4.GIT

--
To: <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Sunday, May 4, 2008 - 7:41 am

From: Michal Simek &lt;monstr@monstr.eu&gt;


Signed-off-by: Michal Simek &lt;monstr@monstr.eu&gt;
---
 arch/microblaze/kernel/cpu/mb.c  |  115 ++++++++++++++++++++++++++++++++++++++
 arch/microblaze/kernel/cpu/pvr.c |   83 +++++++++++++++++++++++++++
 2 files changed, 198 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/cpu/mb.c
 create mode 100644 arch/microblaze/kernel/cpu/pvr.c

diff --git a/arch/microblaze/kernel/cpu/mb.c b/arch/microblaze/kernel/cpu/mb.c
new file mode 100644
index 0000000..44a911c
--- /dev/null
+++ b/arch/microblaze/kernel/cpu/mb.c
@@ -0,0 +1,115 @@
+/*
+ * arch/microblaze/kernel/cpu/mb.c
+ *
+ * CPU-version specific code
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2007 Michal Simek &lt;monstr@monstr.eu&gt;
+ * Copyright (C) 2006 PetaLogix
+ */
+
+#include &lt;linux/init.h&gt;
+#include &lt;linux/string.h&gt;
+#include &lt;linux/seq_file.h&gt;
+#include &lt;linux/cpu.h&gt;
+#include &lt;linux/initrd.h&gt;
+
+#include &lt;asm/cpuinfo.h&gt;
+#include &lt;asm/setup.h&gt;
+#include &lt;asm/sections.h&gt;
+#include &lt;asm/page.h&gt;
+#include &lt;asm/io.h&gt;
+#include &lt;asm/bug.h&gt;
+#include &lt;asm/param.h&gt;
+
+static int show_cpuinfo(struct seq_file *m, void *v)
+{
+	int count = 0;
+	char *fpga_family = "Unknown";
+	char *cpu_ver = "Unknown";
+	int i;
+
+	/* Denormalised to get the fpga family string */
+	for (i = 0; family_string_lookup[i].s != NULL; i++) {
+		if (cpuinfo.fpga_family_code == family_string_lookup[i].k) {
+			fpga_family = (char *)family_string_lookup[i].s;
+			break;
+		}
+	}
+
+	/* Denormalised to get the hw version string */
+	for (i = 0; cpu_ver_lookup[i].s != NULL; i++) {
+		if (cpuinfo.ver_code == cpu_ver_lookup[i].k) {
+			cpu_ver = (char *)cpu_ver_lookup[i].s;
+			break;
+		}
+	}
+
+	count = seq_printf(m,
+			"CPU-Fam...
To: <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Sunday, May 4, 2008 - 7:41 am

From: Michal Simek &lt;monstr@monstr.eu&gt;


Signed-off-by: Michal Simek &lt;monstr@monstr.eu&gt;
---
 arch/microblaze/defconfig |  604 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 604 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/defconfig

diff --git a/arch/microblaze/defconfig b/arch/microblaze/defconfig
new file mode 100644
index 0000000..5092d19
--- /dev/null
+++ b/arch/microblaze/defconfig
@@ -0,0 +1,604 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.25
+# Wed Apr 23 20:28:29 2008
+#
+CONFIG_MICROBLAZE=y
+# CONFIG_MMU is not set
+# CONFIG_SWAP is not set
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+# CONFIG_ARCH_HAS_ILOG2_U32 is not set
+# CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+# CONFIG_PCI is not set
+CONFIG_UID16=y
+CONFIG_HZ=100
+CONFIG_DEFCONFIG_LIST="arch/$ARCH/defconfig"
+
+#
+# General setup
+#
+# CONFIG_EXPERIMENTAL is not set
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION=""
+# CONFIG_LOCALVERSION_AUTO is not set
+# CONFIG_SYSVIPC is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_AUDIT is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_CGROUPS is not set
+# CONFIG_GROUP_SCHED is not set
+CONFIG_SYSFS_DEPRECATED=y
+CONFIG_SYSFS_DEPRECATED_V2=y
+# CONFIG_RELAY is not set
+# CONFIG_NAMESPACES is not set
+# CONFIG_BLK_DEV_INITRD is not set
+CONFIG_SYSCTL=y
+CONFIG_EMBEDDED=y
+CONFIG_SYSCTL_SYSCALL=y
+# CONFIG_KALLSYMS is not set
+# CONFIG_HOTPLUG is not set
+CONFIG_PRINTK=y
+# CONFIG_BUG is not set
+CONFIG_ELF_CORE=y
+CONFIG_COMPAT_BRK=y
+# CONFIG_BASE_FULL is not set
+# CONFIG_FUTEX is not set
+CONFIG_ANON_INODES=y
+# CONFIG_EPOLL is not set
+CONFIG_SIGNALFD=y
+# CONFIG_TIMERFD is not set
+CONFIG_EVENTFD=y
+CONFIG_VM_EVENT_COUNT...
To: <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Sunday, May 4, 2008 - 7:41 am

From: Michal Simek &lt;monstr@monstr.eu&gt;


Signed-off-by: Michal Simek &lt;monstr@monstr.eu&gt;
---
 arch/microblaze/kernel/head.S        |   40 +++++++++
 arch/microblaze/kernel/vmlinux.lds.S |  145 ++++++++++++++++++++++++++++++++++
 2 files changed, 185 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/head.S
 create mode 100644 arch/microblaze/kernel/vmlinux.lds.S

diff --git a/arch/microblaze/kernel/head.S b/arch/microblaze/kernel/head.S
new file mode 100644
index 0000000..8ca148b
--- /dev/null
+++ b/arch/microblaze/kernel/head.S
@@ -0,0 +1,40 @@
+/*
+ * arch/microblaze/kernel/head.S
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2007 Michal Simek &lt;monstr@monstr.eu&gt;
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#include &lt;linux/linkage.h&gt;
+#include &lt;asm/thread_info.h&gt;
+
+	.text
+ENTRY(_start)
+	mfs	r1, rmsr
+	andi	r1, r1, ~2
+	mts	rmsr, r1
+
+	/* Initialize small data anchors */
+	la	r13, r0, _KERNEL_SDA_BASE_
+	la	r2, r0, _KERNEL_SDA2_BASE_
+
+	/* Initialize stack pointer */
+	la	r1, r0, init_thread_union + THREAD_SIZE - 4
+
+	/* Initialize r31 with current task address */
+	la	r31, r0, init_task
+
+	/* Call platform dependent initialize function.
+	 * Please see $(ARCH)/mach-$(SUBARCH)/setup.c for
+	 * the function. */
+	la	r8, r0, machine_early_init
+	brald	r15, r8
+	nop
+
+	la	r15, r0, machine_halt
+	braid	start_kernel
+	nop
diff --git a/arch/microblaze/kernel/vmlinux.lds.S b/arch/microblaze/kernel/vmlinux.lds.S
new file mode 100644
index 0000000..8940f1f
--- /dev/null
+++ b/arch/microblaze/kernel/vmlinux.lds.S
@@ -0,0 +1,145 @@
+/*
+ * arch/microblaze/kernel/vmlinux.lds.S
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more...
To: <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Sunday, May 4, 2008 - 7:41 am

From: Michal Simek &lt;monstr@monstr.eu&gt;


Signed-off-by: Michal Simek &lt;monstr@monstr.eu&gt;
---
 arch/microblaze/lib/memcpy.c  |  162 +++++++++++++++++++++++++++++++++++++
 arch/microblaze/lib/memmove.c |  176 +++++++++++++++++++++++++++++++++++++++++
 arch/microblaze/lib/memset.c  |   77 ++++++++++++++++++
 3 files changed, 415 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/lib/memcpy.c
 create mode 100644 arch/microblaze/lib/memmove.c
 create mode 100644 arch/microblaze/lib/memset.c

diff --git a/arch/microblaze/lib/memcpy.c b/arch/microblaze/lib/memcpy.c
new file mode 100644
index 0000000..8dc5b90
--- /dev/null
+++ b/arch/microblaze/lib/memcpy.c
@@ -0,0 +1,162 @@
+/*
+ * arch/microblaze/lib/memcpy.c
+ *
+ * Copyright (C) 2008 Michal Simek &lt;monstr@monstr.eu&gt;
+ *
+ * Reasonably optimised generic C-code for memcpy on Microblaze
+ * This is generic C code to do efficient, alignment-aware memcpy.
+ *
+ * It is based on demo code originally Copyright 2001 by Intel Corp, taken from
+ * http://www.embedded.com/showArticle.jhtml?articleID=19205567
+ *
+ * Attempts were made, unsuccesfully, to contact the original
+ * author of this code (Michael Morrow, Intel).  Below is the original
+ * copyright notice.
+ *
+ * This software has been developed by Intel Corporation.
+ * Intel specifically disclaims all warranties, express or
+ * implied, and all liability, including consequential and
+ * other indirect damages, for the use of this program, including
+ * liability for infringement of any proprietary rights,
+ * and including the warranties of merchantability and fitness
+ * for a particular purpose. Intel does not assume any
+ * responsibility for and errors which may appear in this program
+ * not any responsibility to update it.
+ */
+
+#include &lt;linux/types.h&gt;
+#include &lt;linux/stddef.h&gt;
+#include &lt;linux/compiler.h&gt;
+#include &lt;linux/module.h&gt;
+
+#include &lt;asm/string.h&gt;
+#include &lt;asm/system.h&gt;
+
+#...
To: <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Sunday, May 4, 2008 - 7:41 am

From: Michal Simek &lt;monstr@monstr.eu&gt;


Signed-off-by: Michal Simek &lt;monstr@monstr.eu&gt;
---
 arch/microblaze/lib/checksum.c    |  166 +++++++++++++++++++++++++++++++++++++
 include/asm-microblaze/checksum.h |  101 ++++++++++++++++++++++
 2 files changed, 267 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/lib/checksum.c
 create mode 100644 include/asm-microblaze/checksum.h

diff --git a/arch/microblaze/lib/checksum.c b/arch/microblaze/lib/checksum.c
new file mode 100644
index 0000000..1f4646f
--- /dev/null
+++ b/arch/microblaze/lib/checksum.c
@@ -0,0 +1,166 @@
+/*
+ * arch/microblaze/lib/checksum.c
+ *
+ * Copyright (C) 2008 Michal Simek &lt;monstr@monstr.eu&gt;
+ *
+ * INET		An implementation of the TCP/IP protocol suite for the LINUX
+ *		operating system.  INET is implemented using the  BSD Socket
+ *		interface as the means of communication with the user level.
+ *
+ *		IP/TCP/UDP checksumming routines
+ *
+ * Authors:	Jorge Cwik, &lt;jorge@laser.satlink.net&gt;
+ *		Arnt Gulbrandsen, &lt;agulbra@nvg.unit.no&gt;
+ *		Tom May, &lt;ftom@netcom.com&gt;
+ *		Andreas Schwab, &lt;schwab@issan.informatik.uni-dortmund.de&gt;
+ *		Lots of code moved from tcp.c and ip.c; see those files
+ *		for more names.
+ *
+ * 03/02/96	Jes Sorensen, Andreas Schwab, Roman Hodek:
+ *		Fixed some nasty bugs, causing some horrible crashes.
+ *		A: At some points, the sum (%0) was used as
+ *		length-counter instead of the length counter
+ *		(%1). Thanks to Roman Hodek for pointing this out.
+ *		B: GCC seems to mess up if one uses too many
+ *		data-registers to hold input values and one tries to
+ *		specify d0 and d1 as scratch registers. Letting gcc choose these
+ *      registers itself solves the problem.
+ *
+ *		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 lat...
To: <linux-kernel@...>
Cc: <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <john.williams@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Sunday, May 4, 2008 - 7:41 am

From: Michal Simek &lt;monstr@monstr.eu&gt;


Signed-off-by: Michal Simek &lt;monstr@monstr.eu&gt;
---
 arch/microblaze/kernel/early_printk.c |  115 +++++++++++++++++++++++++++++++++
 1 files changed, 115 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/early_printk.c

diff --git a/arch/microblaze/kernel/early_printk.c b/arch/microblaze/kernel/early_printk.c
new file mode 100644
index 0000000..0f533ff
--- /dev/null
+++ b/arch/microblaze/kernel/early_printk.c
@@ -0,0 +1,115 @@
+/*
+ * arch/microblaze/kernel/early_printk.c
+ *
+ * Copyright (C) 2007 Michal Simek &lt;monstr@monstr.eu&gt;
+ * Copyright (C) 2003-2006 Yasushi SHOJI &lt;yashi@atmark-techno.com&gt;
+ *
+ * Early printk support for Microblaze.
+ *
+ * Once we got some system without uart light, we need to refactor.
+ */
+
+#include &lt;linux/console.h&gt;
+#include &lt;linux/kernel.h&gt;
+#include &lt;linux/init.h&gt;
+#include &lt;linux/string.h&gt;
+#include &lt;linux/tty.h&gt;
+#include &lt;asm/io.h&gt;
+#include &lt;asm/processor.h&gt;
+#include &lt;asm/fcntl.h&gt;
+#include &lt;asm/setup.h&gt;
+
+#ifdef CONFIG_EARLY_PRINTK
+#define BASE_ADDR ((unsigned char *)CONFIG_EARLY_PRINTK_UARTLITE_ADDRESS)
+
+#define RX_FIFO	BASE_ADDR
+#define TX_FIFO	((unsigned long *)(BASE_ADDR + 4))
+#define STATUS	((unsigned long *)(BASE_ADDR + 8))
+#define CONTROL	((unsigned long *)(BASE_ADDR + 12))
+
+static void early_printk_putc(char c)
+{
+	while (ioread32(STATUS) &amp; (1&lt;&lt;3));
+	iowrite32((c &amp; 0xff), TX_FIFO);
+}
+
+static void early_printk_write(struct console *unused,
+					const char *s, unsigned n)
+{
+	while (*s &amp;&amp; n-- &gt; 0) {
+		early_printk_putc(*s);
+		if (*s == '\n')
+			early_printk_putc('\r');
+		s++;
+	}
+}
+
+static struct console early_serial_console = {
+	.name = "earlyser",
+	.write = early_printk_write,
+	.flags = CON_PRINTBUFFER,
+	.index = -1,
+};
+
+/* Direct interface for emergencies */
+static struct console *early_console = &amp;ear...
To: <monstr@...>
Cc: <linux-kernel@...>, <arnd@...>, <linux-arch@...>, <stephen.neuendorffer@...>, <John.Linn@...>, <matthew@...>, <will.newton@...>, <drepper@...>, <microblaze-uclinux@...>, <grant.likely@...>, Michal Simek <monstr@...>
Date: Monday, May 5, 2008 - 7:22 pm

The while() loop needs a retry counter - if you configure
EARLY_PRINTK_BASE_ADDRESS wrongly and it points to memory or anything
that is not a uartlite, the loop spins forever and you get silent
lockup.  Not nice behaviour from debug code :)

Here's my current implementation:

static void early_printk_putc(char c)
{
        /* Limit how many times we'll spin waiting for TX FIFO status.
           This will prevent lockups if the base address is incorrectly
set, or
           any other issue on the UARTLITE.

           This limit is pretty arbitrary, unless we are at about 10
baud 
           we'll never timeout on a working UART. */

        unsigned retries=10000;
        while (retries-- &amp;&amp; (ioread32(STATUS) &amp; (1&lt;&lt;3)))