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 --
Hi Michal, Thanks for your work. Maybe I missed it, but I didn't see entry.S, head.S, ptrace.c, and a few others? John --
Hi John, I used git-send command for it. I'll fix bug and send third version. Entry.S and others will at the end of set. --
From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- 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 process ...
Hi Michal, I think this should default to 0x00000000, then in the early_printk code we can test for zero baseaddress and attempt some sensible fallback in Again, default address should be zero which is checked in the code (zero can disable). Prevent accesses to random memory locations in case of As suggested by Grant, this sohuld be 1. renamed and described as something sensible SELF_MODIFYING_CODE_HACK "Unsigned alignment"?? Should be just "get all of the CPU settings", since we use OF to get the Why does this depend on UNCACHED_SHADOW? Regards, John --
I'll add default option to HEART_BEAT to no and zero base address. I don't want to Because only UNCACHED_SHADOW wanted to know how big is memory. Current situation is clear. Only consistent.c file wanted UNCACHED_SHADOW choise. I'll remove Thanks, Michal --
21 config SELFMOD 22 bool "Use self modified code for intc/timer" 23 depends on EXPERIMENTAL 24 default n 25 help 26 This choice enables self-modified code for interrupt controller 27 and timer. 28 29 config SELFMOD_INTC 30 bool "Use self modified code for intc" 31 depends on SELFMOD 32 default y 33 help 34 This choice enables self-modified code for interrupt controller. 35 36 config SELFMOD_TIMER 37 bool "Use self modified code for timer" 38 depends on SELFMOD 39 default y 40 help 41 This choice enables self-modified code for timer. I keep this for now. I hope we will talked about later with Xilinx guys what Because consistent.c needs to know where was the end of memory. This issue hasn't never tested. Currently consistent.c is removed. M --
From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- 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 + ...
No doubt there's some cleaner shell-fu to do this but I'm not How about a single obj-$(CONFIG_PLATFORM_GENERIC) += generic/ to show how platform-specific setup code can be added (even though there's none in the default generic target)? --
I think you told me that toolchain can use this flags. This is not pain for now. We'll add this to Microblaze readme file. Chapter: how to add platform specific files. M --
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
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 <john.williams@petalogix.com>
+ * 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 <linux/init.h>
+#include <linux/string.h>
+#include <linux/autoconf.h>
+#include <asm/pvr.h>
+#include <asm/cpuinfo.h>
+
+/*
+ * Helper macro to map between fields in our struct cpuinfo, and
+ * the PVR macros in pvr.h.
+ */
+
+#define CI(c, p) ci->c = PVR_##p(pvr)
+
+void set_cpuinfo_pvr_full(struct cpuinfo *ci)
+{
+ struct pvr_s pvr;
+ get_pvr(&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, VERSION);
+
+ CI(use_icache, ...pvr_partial never got written - it can be deleted. John --
I moved it. This was in cpuinfo.c because you can't load frequency from PVR regs. this value was loaded from DTS and I don't want to setup second parameter to pvr I removed it and changed values M --
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
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 <stdarg.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/init.h>
+#include <linux/threads.h>
+#include <linux/spinlock.h>
+#include <linux/types.h>
+#include <linux/pci.h>
+#include <linux/stringify.h>
+#include <linux/delay.h>
+#include <linux/initrd.h>
+#include <linux/bitops.h>
+#include <linux/module.h>
+#include <linux/kexec.h>
+#include <linux/debugfs.h>
+#include <linux/irq.h>
+#include <linux/lmb.h>
+
+#include <asm/prom.h>
+#include <asm/page.h>
+#include <asm/processor.h>
+#include <asm/irq.h>
+#include <asm/io.h>
+#include <asm/system.h>
+#include <asm/mmu.h>
+#include ...From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- 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 <monstr@monstr.eu> + */ + +#ifndef _ASM_MICROBLAZE_SEMAPHORE_H +#define _ASM_MICROBLAZE_SEMAPHORE_H + +#include <linux/semaphore.h> + +#endif /* _ASM_MICROBLAZE_SEMAPHORE_H */ -- 1.5.4.GIT --
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
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 <linux/kernel.h>
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <asm/exceptions.h>
+#include <asm/entry.h> /* 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, addr);
+ else
+ force_sig(signal, ...From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- 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 <jwilliams@itee.uq.edu.au> + * Copyright (C) 2001 NEC Corporation + * Copyright (C) 2001 Miles Bader <miles@gnu.org> + * Copyright (C) 1999,2000 Niibe Yutaka & 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 <linux/sched.h> +#include <linux/mm.h> +#include <linux/smp.h> +#include <linux/smp_lock.h> +#include <linux/kernel.h> +#include <linux/signal.h> +#include <linux/errno.h> +#include <linux/wait.h> +#include <linux/ptrace.h> +#include <linux/unistd.h> +#include <linux/stddef.h> +#include <linux/personality.h> +#include <linux/percpu.h> +#include <asm/entry.h> +#include <asm/ucontext.h> +#include <asm/uaccess.h> +#include <asm/pgtable.h> +#include <asm/pgalloc.h> +#include <asm/signal.h> + +#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) + +asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset, int in_sycall); + +/* + * Atomically swap in the new signal mask, and wait for a signal. + */ +asmlinkage ...
This patch should have a comment saying that it will mostly go away with the new syscall interface, with the one exception of sys_rt_sigreturn(). Arnd <>< --
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
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 <monstr@monstr.eu>
+ */
+
+#include <linux/interrupt.h>
+#include <asm/hack.h>
+
+#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 %d: ...These 'hack' files, functions and CONFIGS should be renamed. How about * selfmod.[c|h] (core infrastructure) * CONFIG_SELFMOD (enables the self modifying API) * CONFIG_SELFMOD_IRQ (use it on IRS) * CONFIG_SELFMOD_TIMER (user it on the timer) The last two would be dependent on CONFIG_SELFMOD With the recent ksplice stuff it seems self-modifying code is ready for the mainline :) --
FIXED. Part of Kconfig was in previous email. --
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
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 <monstr@monstr.eu>
+ * Copyright (C) 2007 PetaLogix
+ * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
+ *
+ * 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 <asm/cacheflush.h>
+#include <asm/cache.h>
+#include <asm/cpuinfo.h>
+
+/* 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");
+#else
+ __asm__ __volatile__ ...This is the slowest and greatest latency-inducing loop in the MicroBlaze kernel. The CPU specs says icache must be disabled while you clear it - if you have a chance it's worth checking to see what happens if you violate that rule. This will be less of a problem once we update the kernel_from_bram This could be smarter - if our cache size is less than a page then there Perhaps a #define in asm-microblaze/signal.h to tell us the size of the again might be worth testing if it still works with dcache enabled Is this actually used anywhere? If so, it's wrong because cache line If you are throwing out the alloc_consist()/free_consist() Is the icache flush required? Is copy_to_user_page() called from the binfmt_flat loader? --
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
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 <monstr@monstr.eu>
+ *
+ * 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 = <1>;
+ #size-cells = <1>;
+ compatible = "ibm,opb";
+ model = "testing";
+ DDR_SDRAM_32Mx16: memory@44000000 {
+ device_type = "memory";
+ reg = < 44000000 2000000 >;
+ } ;
+ chosen {
+ bootargs = "root=mtdblock0";
+ } ;
+ cpus {
+ #address-cells = <1>;
+ #cpus = <1>;
+ #size-cells = <0>;
+ microblaze,5.00.c@0 {
+ clock-frequency = <3f940ab>;
+ d-cache-baseaddr = <44000000>;
+ d-cache-highaddr = <47ffffff>;
+ d-cache-line-size = <10>;
+ d-cache-size = ...From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- 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 <monstr@monstr.eu> + * + * 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 <linux/module.h> +#include <linux/string.h> +#include <linux/cryptohash.h> +#include <linux/delay.h> +#include <linux/in6.h> +#include <linux/syscalls.h> + +#include <asm/checksum.h> +#include <asm/io.h> +#include <asm/page.h> +#include <asm/system.h> +#include <asm/uaccess.h> + +/* + * 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(__muldi3); +extern void __ucmpdi2(void); +EXPORT_SYMBOL(__ucmpdi2); +extern void ...
From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- 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 <monstr@monstr.eu> + */ + +#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 --
Since LMB has a very specific (and different) meaning the microblaze context (LMB = Local Memory Bus), can we have a comment or explanation from the PPC folks on what LMB actually stands for? That can then become a disambiguating comment in the microblaze source code that refers to it. --
See lib/lmb.c: /* * Procedures for maintaining information about logical memory blocks. * Segher --
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
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 <monstr@monstr.eu>
+ * Copyright (C) 2006 PetaLogix
+ */
+
+#include <linux/init.h>
+#include <linux/string.h>
+#include <linux/seq_file.h>
+#include <linux/cpu.h>
+#include <linux/initrd.h>
+
+#include <asm/cpuinfo.h>
+#include <asm/setup.h>
+#include <asm/sections.h>
+#include <asm/page.h>
+#include <asm/io.h>
+#include <asm/bug.h>
+#include <asm/param.h>
+
+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 = ...The actual IRQ clear/restore is not required - can you just use local_save_flags() or similar to read the MSR? --
From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- 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 ...
From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- 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 <monstr@monstr.eu> + * Copyright (C) 2006 Atmark Techno, Inc. + */ + +#include <linux/linkage.h> +#include <asm/thread_info.h> + + .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 details. + * + * ...
From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- 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 <monstr@monstr.eu> + * + * 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 <linux/types.h> +#include <linux/stddef.h> +#include <linux/compiler.h> +#include <linux/module.h> + +#include <asm/string.h> +#include <asm/system.h> + +#ifdef __HAVE_ARCH_MEMCPY +void *memcpy(void ...
From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- 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 <monstr@monstr.eu> + * + * 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, <jorge@laser.satlink.net> + * Arnt Gulbrandsen, <agulbra@nvg.unit.no> + * Tom May, <ftom@netcom.com> + * Andreas Schwab, <schwab@issan.informatik.uni-dortmund.de> + * 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 later version. + */ + +/* Revised by ...
This is a pretty generic implementation, and you copied it from another architecture. How about moving it from arch/microblaze/lib/ to lib/? I'd suggest building it conditionally under CONFIG_GENERIC_CSUM, which you def_bool in your architecture Kconfig. Arnd <>< --
I move checksum.c to /lib and checksum.h to asm-generic and add to GENERIC_CSUM to Kconfig 6 config MICROBLAZE 7 def_bool y 8 select HAVE_LMB 9 select GENERIC_CSUM M --
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
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 <monstr@monstr.eu>
+ * Copyright (C) 2003-2006 Yasushi SHOJI <yashi@atmark-techno.com>
+ *
+ * Early printk support for Microblaze.
+ *
+ * Once we got some system without uart light, we need to refactor.
+ */
+
+#include <linux/console.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/string.h>
+#include <linux/tty.h>
+#include <asm/io.h>
+#include <asm/processor.h>
+#include <asm/fcntl.h>
+#include <asm/setup.h>
+
+#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) & (1<<3));
+ iowrite32((c & 0xff), TX_FIFO);
+}
+
+static void early_printk_write(struct console *unused,
+ const char *s, unsigned n)
+{
+ while (*s && n-- > 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 = &early_serial_console;
+static int early_console_initialized;
+
+void early_printk(const char *fmt, ...From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
arch/microblaze/lib/uaccess.c | 43 +++++++++++++
include/asm-microblaze/uaccess.h | 126 ++++++++++++++++++++++++++++++++++++++
2 files changed, 169 insertions(+), 0 deletions(-)
create mode 100644 arch/microblaze/lib/uaccess.c
create mode 100644 include/asm-microblaze/uaccess.h
diff --git a/arch/microblaze/lib/uaccess.c b/arch/microblaze/lib/uaccess.c
new file mode 100644
index 0000000..9a36778
--- /dev/null
+++ b/arch/microblaze/lib/uaccess.c
@@ -0,0 +1,43 @@
+/*
+ * arch/microblaze/lib/uaccess.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) 2006 Atmark Techno, Inc.
+ */
+
+#include <linux/string.h>
+#include <asm/uaccess.h>
+
+#include <asm/bug.h>
+
+long strnlen_user(const char __user *s, long n)
+{
+ return strlen(s) + 1;
+}
+
+#define __do_strncpy_from_user(dst, src, count, res) \
+ do { \
+ char *tmp; \
+ strncpy(dst, src, count); \
+ for (tmp = dst; *tmp && count > 0; tmp++, count--) \
+ ; \
+ res = (tmp - dst); \
+ } while (0)
+
+long __strncpy_from_user(char *dst, const char __user *src, long count)
+{
+ long res;
+ __do_strncpy_from_user(dst, src, count, res);
+ return res;
+}
+
+long strncpy_from_user(char *dst, const char *src, long count)
+{
+ long res = -EFAULT;
+ if (access_ok(VERIFY_READ, src, 1))
+ __do_strncpy_from_user(dst, src, count, res);
+ return res;
+}
diff --git a/include/asm-microblaze/uaccess.h b/include/asm-microblaze/uaccess.h
new file mode 100644
index 0000000..e6adda3
--- /dev/null
+++ b/include/asm-microblaze/uaccess.h
@@ -0,0 +1,126 @@
+/*
+ * include/asm-microblaze/uaccess.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 ...From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
arch/microblaze/kernel/heartbeat.c | 37 ++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
create mode 100644 arch/microblaze/kernel/heartbeat.c
diff --git a/arch/microblaze/kernel/heartbeat.c b/arch/microblaze/kernel/heartbeat.c
new file mode 100644
index 0000000..508b463
--- /dev/null
+++ b/arch/microblaze/kernel/heartbeat.c
@@ -0,0 +1,37 @@
+/*
+ * arch/microblaze/kernel/heartbeat.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) 2006 Atmark Techno, Inc.
+ */
+
+#include <linux/sched.h>
+#include <asm/page.h>
+#include <asm/io.h>
+#include <asm/setup.h>
+
+void heartbeat(void)
+{
+ static unsigned int cnt, period, dist;
+
+ if (cnt == 0 || cnt == dist)
+ iowrite32(1, CONFIG_HEART_BEAT_ADDRESS);
+ else if (cnt == 7 || cnt == dist + 7)
+ iowrite32(0, CONFIG_HEART_BEAT_ADDRESS);
+
+ if (++cnt > period) {
+ cnt = 0;
+
+ /*
+ * The hyperbolic function below modifies the heartbeat period
+ * length in dependency of the current (5min) load. It goes
+ * through the points f(0)=126, f(1)=86, f(5)=51, f(inf)->30.
+ */
+ period = ((672 << FSHIFT) / (5 * avenrun[0] +
+ (7 << FSHIFT))) + 30;
+ dist = period / 4;
+ }
+}
--
1.5.4.GIT
--
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
arch/microblaze/kernel/setup.c | 189 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 189 insertions(+), 0 deletions(-)
create mode 100644 arch/microblaze/kernel/setup.c
diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
new file mode 100644
index 0000000..afd2786
--- /dev/null
+++ b/arch/microblaze/kernel/setup.c
@@ -0,0 +1,189 @@
+/*
+ * arch/microblaze/kernel/setup.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) 2008 Michal Simek <monstr@monstr.eu>
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#include <linux/init.h>
+#include <linux/string.h>
+#include <linux/seq_file.h>
+#include <linux/cpu.h>
+#include <linux/initrd.h>
+#include <linux/console.h>
+#include <linux/debugfs.h>
+
+#include <asm/setup.h>
+#include <asm/sections.h>
+#include <asm/page.h>
+#include <asm/io.h>
+#include <asm/bug.h>
+#include <asm/param.h>
+#include <asm/cache.h>
+#include <asm/cacheflush.h>
+#include <asm/entry.h>
+#include <asm/cpuinfo.h>
+
+#include <asm/system.h>
+#include <asm/prom.h>
+#include <asm/pgtable.h>
+
+DEFINE_PER_CPU(unsigned int, KSP); /* Saved kernel stack pointer */
+DEFINE_PER_CPU(unsigned int, KM); /* Kernel/user mode */
+DEFINE_PER_CPU(unsigned int, ENTRY_SP); /* Saved SP on kernel entry */
+DEFINE_PER_CPU(unsigned int, R11_SAVE); /* Temp variable for entry */
+DEFINE_PER_CPU(unsigned int, CURRENT_SAVE); /* Saved current pointer */
+
+unsigned int boot_cpuid;
+char cmd_line[COMMAND_LINE_SIZE];
+static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
+
+void __init setup_arch(char **cmdline_p)
+{
+ console_verbose();
+
+ unflatten_device_tree();
+ /* NOTE I think that this function is not necessary to call */
+ /* irq_early_init(); ...From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
arch/microblaze/kernel/asm-offsets.c | 118 ++++++++++++++++++++++++++++++++++
1 files changed, 118 insertions(+), 0 deletions(-)
create mode 100644 arch/microblaze/kernel/asm-offsets.c
diff --git a/arch/microblaze/kernel/asm-offsets.c b/arch/microblaze/kernel/asm-offsets.c
new file mode 100644
index 0000000..f01aa3b
--- /dev/null
+++ b/arch/microblaze/kernel/asm-offsets.c
@@ -0,0 +1,118 @@
+/*
+ * arch/microblaze/kernel/asm-offset.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 PetaLogix
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#include <linux/stddef.h>
+#include <linux/sched.h>
+#include <linux/kernel_stat.h>
+#include <linux/ptrace.h>
+#include <linux/hardirq.h>
+#include <linux/thread_info.h>
+
+#define DEFINE(sym, val) asm volatile("\n->" #sym " %0 " #val : : "i" (val))
+#define BLANK() asm volatile("\n->" : :)
+
+int main(int argc, char *argv[])
+{
+ /* struct pt_regs */
+ DEFINE(PT_SIZE, sizeof(struct pt_regs));
+ DEFINE(PT_MSR, offsetof(struct pt_regs, msr));
+ DEFINE(PT_EAR, offsetof(struct pt_regs, ear));
+ DEFINE(PT_ESR, offsetof(struct pt_regs, esr));
+ DEFINE(PT_FSR, offsetof(struct pt_regs, fsr));
+ DEFINE(PT_PC, offsetof(struct pt_regs, pc));
+ DEFINE(PT_R0, offsetof(struct pt_regs, r0));
+ DEFINE(PT_R1, offsetof(struct pt_regs, r1));
+ DEFINE(PT_R2, offsetof(struct pt_regs, r2));
+ DEFINE(PT_R3, offsetof(struct pt_regs, r3));
+ DEFINE(PT_R4, offsetof(struct pt_regs, r4));
+ DEFINE(PT_R5, offsetof(struct pt_regs, r5));
+ DEFINE(PT_R6, offsetof(struct pt_regs, r6));
+ DEFINE(PT_R7, offsetof(struct pt_regs, r7));
+ DEFINE(PT_R8, offsetof(struct pt_regs, r8));
+ DEFINE(PT_R9, offsetof(struct pt_regs, r9));
+ DEFINE(PT_R10, offsetof(struct pt_regs, r10));
+ DEFINE(PT_R11, ...From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
arch/microblaze/kernel/init_task.c | 31 +++++++++
arch/microblaze/kernel/process.c | 129 ++++++++++++++++++++++++++++++++++++
2 files changed, 160 insertions(+), 0 deletions(-)
create mode 100644 arch/microblaze/kernel/init_task.c
create mode 100644 arch/microblaze/kernel/process.c
diff --git a/arch/microblaze/kernel/init_task.c b/arch/microblaze/kernel/init_task.c
new file mode 100644
index 0000000..7c6bce3
--- /dev/null
+++ b/arch/microblaze/kernel/init_task.c
@@ -0,0 +1,31 @@
+/*
+ * arch/microblaze/kernel/init_task.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) 2006 Atmark Techno, Inc.
+ */
+
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/init_task.h>
+#include <linux/fs.h>
+#include <linux/mqueue.h>
+
+#include <asm/pgtable.h>
+
+static struct fs_struct init_fs = INIT_FS;
+static struct files_struct init_files = INIT_FILES;
+static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
+static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
+struct mm_struct init_mm = INIT_MM(init_mm);
+EXPORT_SYMBOL(init_mm);
+
+union thread_union init_thread_union
+ __attribute__((__section__(".data.init_task"))) =
+{ INIT_THREAD_INFO(init_task) };
+
+struct task_struct init_task = INIT_TASK(init_task);
+EXPORT_SYMBOL(init_task);
diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
new file mode 100644
index 0000000..679fe19
--- /dev/null
+++ b/arch/microblaze/kernel/process.c
@@ -0,0 +1,129 @@
+/*
+ * arch/microblaze/kernel/process.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 ...From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
arch/microblaze/kernel/time.c | 90 ++++++++++++++++++++++++++++++++++++++++
include/asm-microblaze/delay.h | 33 +++++++++++++++
include/asm-microblaze/timex.h | 20 +++++++++
3 files changed, 143 insertions(+), 0 deletions(-)
create mode 100644 arch/microblaze/kernel/time.c
create mode 100644 include/asm-microblaze/delay.h
create mode 100644 include/asm-microblaze/timex.h
diff --git a/arch/microblaze/kernel/time.c b/arch/microblaze/kernel/time.c
new file mode 100644
index 0000000..d5ebdff
--- /dev/null
+++ b/arch/microblaze/kernel/time.c
@@ -0,0 +1,90 @@
+/*
+ * arch/microblaze/kernel/time.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) 2006 Atmark Techno, Inc.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/param.h>
+#include <linux/jiffies.h>
+#include <linux/time.h>
+#include <linux/hrtimer.h>
+#include <asm/bug.h>
+#include <asm/setup.h>
+
+void time_init(void)
+{
+ system_timer_init();
+}
+
+int do_settimeofday(struct timespec *tv)
+{
+ if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
+ return -EINVAL;
+
+ write_seqlock_irq(&xtime_lock);
+
+ /* This is revolting. We need to set the xtime.tv_nsec
+ * correctly. However, the value in this location is
+ * is value at the last tick.
+ * Discover what correction gettimeofday
+ * would have done, and then undo it!
+ */
+#if 0
+ tv->tv_nsec -= mach_gettimeoffset() * 1000;
+#endif
+
+ while (tv->tv_nsec < 0) {
+ tv->tv_nsec += NSEC_PER_SEC;
+ tv->tv_sec--;
+ }
+
+ xtime.tv_sec = tv->tv_sec;
+ xtime.tv_nsec = tv->tv_nsec;
+
+ time_adjust = 0;
+ time_status |= STA_UNSYNC;
+ time_maxerror = NTP_PHASE_LIMIT;
+ time_esterror = ...Let's hope like hell the CPU has HW multipler and shifter for this What's this? Is it used anywhere? --
Hi John, you wrote me you have smarter implementation that xilinx did. Can you find it and send me it? Thanks, --
Hi Michal, It's not much (any?) better? One less multiply I think? Attached anyway - feel free to discard for now. We could do a nice asm implementation with the optional mulhi instruction, but that can wait. Cheers, John
+extern __inline__ void __udelay(unsigned int x)
{
- unsigned long long tmp = usec;
- unsigned long loops = (tmp * 4295 * HZ * loops_per_jiffy) >> 32;
+ unsigned long long tmp=(unsigned long long)x*(unsigned long
long)loops_per_jiffy*226LL;
+ unsigned loops=tmp>>32;
+
__delay(loops);
}
-#endif /* _ASM_MICROBLAZE_DELAY_H */
+extern __inline__ void __ndelay(unsigned int x)
+{
+ unsigned long long tmp=(unsigned long long)x*(unsigned long
long)loops_per_jiffy*226LL;
+ unsigned loops=tmp>>32;
+
+ __delay(loops);
+}
Why is __ndelay implementation the same with __udelay? This is weird for me.
+
+extern void __bad_udelay(void); /* deliberately undefined */
+extern void __bad_ndelay(void); /* deliberately undefined */
Are these function used anywhere?
+#define udelay(n) (__builtin_constant_p(n)? \
+ ((n) > __MAX_UDELAY? __bad_udelay(): __udelay((n) * (19 * HZ))) : \
+ __udelay((n) * (19 * HZ)))
+
+#define ndelay(n) (__builtin_constant_p(n)? \
+ ((n) > __MAX_NDELAY? __bad_ndelay(): __ndelay((n) * HZ)) : \
+ __ndelay((n) * HZ))
+#define muldiv(a, b, c) (((a)*(b))/(c))
muldiv: Where is this use?
Michal
--
Hi All, I saw a lot of comments about files but I have never seen any comments that any file is OK. Does it mean everything is broken??? I don't think so. I'll integrate reported bugs and send microblaze_v3 version. Thanks, Michal --
I've commented mostly on the header files defining the ABI. Since my aim is to have the ABI definition entirely in asm-generic/*.h, every exported file that has more than one line in it should be changed. The files that implement the architecture support itself all look good to me, but since I'm not familiar with the architecture, I'm not trying to comment on them. I think you're doing a great job on this. Any patch set of this size that has been maintained for a long time outside of the kernel goes through this phase where everyone tells you what to improve, based on their experience, while everything you do right about the patches is just taken for granted. Don't let yourself get discouraged by the negative comments, we're really Ok, thanks! Arnd <>< --
Hi Arnd, I am not discouraged from negative comments. I got school from Wolfgang Denk on U-BOOT project. (Thanks Wolfgang :-)) I only want to direct this to right way. That's all. And positive ACK to some files give me better view what's wrong. :-) Have a good day, --
Hi Michal, I'd like to echo the other comments so far -you are doing a great job. I'd take silence on a patch as cautious agreement - like Steve I'm waiting for the dust to settle to do a build and boot test (probably on v3 of your patchset). Most of this code has been running happily for >18 months in the PetaLogix 2.6.20 kernel, and you tested your OF changes pretty well over Oct-Jan. So, I'm happy enough with the underlying implementation, it's really just a case of meeting the kernel.org gatekeeper's standards. The syscall interface is the last prickly one, but we'll get there. Cheers, John --
Let me add my voice to Arnd's. This is a *big* task and you're handling it very well. Cheers, g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. --
granted. I completely agree on this. I think you're making a huge amount of progress and spending alot of time incorporating alot of comments from alot of people. My main priority is to get as many of the improvements that we've had at in our git tree, so as to be able to switch to the mainline code as quickly as possible. If I keep bringing up the same things it is because they are barriers to that happening. I very much want to put a big ACK on everything, but I'm uncomfortable doing that until I can at One of the key things that many people take a long time to learn is that negative comments about code are not a reflection of negativity towards the person who wrote the code. Steve --
From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- arch/microblaze/kernel/ptrace.c | 206 +++++++++++++++++++++++++++++++++++++++ include/asm-microblaze/ptrace.h | 70 +++++++++++++ 2 files changed, 276 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/ptrace.c create mode 100644 include/asm-microblaze/ptrace.h diff --git a/arch/microblaze/kernel/ptrace.c b/arch/microblaze/kernel/ptrace.c new file mode 100644 index 0000000..958f076 --- /dev/null +++ b/arch/microblaze/kernel/ptrace.c @@ -0,0 +1,206 @@ +/* + * arch/microblaze/kernel/ptrace.c -- `ptrace' system call + * + * Copyright (C) 2008 Michal Simek <monstr@monstr.eu> + * Copyright (C) 2007 PetaLogix + * Copyright (C) 2004-07 John Williams <john.williams@petalogix.com> + * + * derived from arch/v850/kernel/ptrace.c + * + * Copyright (C) 2002,03 NEC Electronics Corporation + * Copyright (C) 2002,03 Miles Bader <miles@gnu.org> + * + * Derived from arch/mips/kernel/ptrace.c: + * + * Copyright (C) 1992 Ross Biro + * Copyright (C) Linus Torvalds + * Copyright (C) 1994, 95, 96, 97, 98, 2000 Ralf Baechle + * Copyright (C) 1996 David S. Miller + * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com + * Copyright (C) 1999 MIPS Technologies, 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 <linux/kernel.h> +#include <linux/mm.h> +#include <linux/sched.h> +#include <linux/smp_lock.h> +#include <linux/ptrace.h> +#include <linux/signal.h> + +#include <asm/errno.h> +#include <asm/ptrace.h> +#include <asm/processor.h> +#include <asm/uaccess.h> +#include <asm/asm-offsets.h> + +/* Returns the address where the register at REG_OFFS in P is stashed away. */ +static microblaze_reg_t *reg_save_addr(unsigned reg_offs, + struct task_struct *t) +{ + struct pt_regs ...
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
arch/microblaze/kernel/traps.c | 88 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 88 insertions(+), 0 deletions(-)
create mode 100644 arch/microblaze/kernel/traps.c
diff --git a/arch/microblaze/kernel/traps.c b/arch/microblaze/kernel/traps.c
new file mode 100644
index 0000000..eb8202b
--- /dev/null
+++ b/arch/microblaze/kernel/traps.c
@@ -0,0 +1,88 @@
+/*
+ * arch/microblaze/kernel/traps.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) 2006 Atmark Techno, Inc.
+ */
+
+#include <linux/kernel.h>
+#include <linux/kallsyms.h>
+#include <linux/module.h>
+#include <linux/sched.h>
+
+#include <asm/exceptions.h>
+#include <asm/system.h>
+
+void trap_init(void)
+{
+ initialize_exception_handlers();
+ __enable_hw_exceptions();
+}
+
+void __bad_xchg(volatile void *ptr, int size)
+{
+ printk(KERN_INFO "xchg: bad data size: pc 0x%p, ptr 0x%p, size %d\n",
+ __builtin_return_address(0), ptr, size);
+ BUG();
+}
+EXPORT_SYMBOL(__bad_xchg);
+
+static int kstack_depth_to_print = 24;
+
+void show_trace(struct task_struct *task, unsigned long *stack)
+{
+ unsigned long addr;
+
+ if (!stack)
+ stack = (unsigned long *)&stack;
+
+ printk(KERN_INFO "Call Trace: ");
+#ifdef CONFIG_KALLSYMS
+ printk(KERN_INFO "\n");
+#endif
+ while (!kstack_end(stack)) {
+ addr = *stack++;
+ if (__kernel_text_address(addr)) {
+ printk(KERN_INFO "[<%08lx>] ", addr);
+ print_symbol("%s\n", addr);
+ }
+ }
+ printk(KERN_INFO "\n");
+}
+
+void show_stack(struct task_struct *task, unsigned long *sp)
+{
+ unsigned long *stack;
+ int i;
+
+ if (sp == NULL) {
+ if (task)
+ sp = (unsigned long *) ((struct thread_info *)
+ (task->stack))->cpu_context.sp;
+ else
+ sp = (unsigned long *)&sp;
+ }
+
+ stack ...From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- include/asm-microblaze/a.out.h | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/a.out.h diff --git a/include/asm-microblaze/a.out.h b/include/asm-microblaze/a.out.h new file mode 100644 index 0000000..31729e4 --- /dev/null +++ b/include/asm-microblaze/a.out.h @@ -0,0 +1,14 @@ +/* + * include/asm-microblaze/a.out.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) 2006 Atmark Techno, Inc. + */ + +#ifndef _ASM_MICROBLAZE_A_OUT_H +#define _ASM_MICROBLAZE_A_OUT_H + +#endif /* _ASM_MICROBLAZE_A_OUT_H */ -- 1.5.4.GIT --
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
arch/microblaze/mm/init.c | 184 ++++++++++++++++++++++++++++++++++
include/asm-microblaze/mmu.h | 19 ++++
include/asm-microblaze/mmu_context.h | 24 +++++
include/asm-microblaze/tlb.h | 18 ++++
include/asm-microblaze/tlbflush.h | 22 ++++
5 files changed, 267 insertions(+), 0 deletions(-)
create mode 100644 arch/microblaze/mm/init.c
create mode 100644 include/asm-microblaze/mmu.h
create mode 100644 include/asm-microblaze/mmu_context.h
create mode 100644 include/asm-microblaze/tlb.h
create mode 100644 include/asm-microblaze/tlbflush.h
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
new file mode 100644
index 0000000..d3c042a
--- /dev/null
+++ b/arch/microblaze/mm/init.c
@@ -0,0 +1,184 @@
+/*
+ * arch/microblaze/mm/init.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 <monstr@monstr.eu>
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#include <linux/autoconf.h>
+#include <linux/init.h>
+#include <linux/mm.h>
+#include "../../../mm/internal.h"
+#include <linux/swap.h>
+#include <linux/bootmem.h>
+#include <linux/pfn.h>
+#include <asm/sections.h>
+
+#include <asm/lmb.h>
+#include <asm/uaccess.h>
+#include <asm/system.h>
+#include <asm/pgtable.h>
+
+#undef DEBUG
+
+char *klimit = _end;
+static unsigned int memory_start;
+static unsigned int memory_end;
+
+unsigned int __page_offset;
+EXPORT_SYMBOL(__page_offset);
+
+void __init setup_memory(void)
+{
+ int i;
+ unsigned int start, end;
+ unsigned long map_size;
+ unsigned long start_pfn = 0;
+ unsigned long end_pfn = 0;
+
+ /* Find main memory where is the kernel */
+ for (i = 0; i < lmb.memory.cnt; i++) {
+ start_pfn = lmb.memory.region[i].base >> ...From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
include/asm-microblaze/page.h | 119 ++++++++++++++++++++++++++++++++++++
include/asm-microblaze/segment.h | 42 +++++++++++++
include/asm-microblaze/unaligned.h | 16 +++++
3 files changed, 177 insertions(+), 0 deletions(-)
create mode 100644 include/asm-microblaze/page.h
create mode 100644 include/asm-microblaze/segment.h
create mode 100644 include/asm-microblaze/unaligned.h
diff --git a/include/asm-microblaze/page.h b/include/asm-microblaze/page.h
new file mode 100644
index 0000000..5c7c262
--- /dev/null
+++ b/include/asm-microblaze/page.h
@@ -0,0 +1,119 @@
+/*
+ * include/asm-microblaze/page.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) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_PAGE_H
+#define _ASM_MICROBLAZE_PAGE_H
+
+#include <linux/autoconf.h>
+#include <linux/pfn.h>
+
+/* PAGE_SHIFT determines the page size */
+
+#define PAGE_SHIFT (12)
+#define PAGE_SIZE (1UL << PAGE_SHIFT)
+#define PAGE_MASK (~(PAGE_SIZE-1))
+
+#ifdef __KERNEL__
+
+#include <asm/setup.h>
+
+#ifndef __ASSEMBLY__
+
+#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
+#define free_user_page(page, addr) free_page(addr)
+
+#define clear_page(pgaddr) memset((pgaddr), 0, PAGE_SIZE)
+#define copy_page(to, from) memcpy((to), (from), PAGE_SIZE)
+
+#define clear_user_page(pgaddr, vaddr, page) memset((pgaddr), 0, PAGE_SIZE)
+#define copy_user_page(vto, vfrom, vaddr, topg) \
+ memcpy((vto), (vfrom), PAGE_SIZE)
+
+/*
+ * These are used to make use of C type-checking..
+ */
+typedef struct { unsigned long pte; } pte_t;
+typedef struct { unsigned long ste[64]; } pmd_t;
+typedef struct { pmd_t pue[1]; } pud_t;
+typedef struct { pud_t pge[1]; } pgd_t;
+typedef struct { unsigned long pgprot; ...From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
include/asm-microblaze/msgbuf.h | 41 +++++++++++++++++++++++++++++
include/asm-microblaze/shmbuf.h | 52 +++++++++++++++++++++++++++++++++++++
include/asm-microblaze/shmparam.h | 16 +++++++++++
3 files changed, 109 insertions(+), 0 deletions(-)
create mode 100644 include/asm-microblaze/msgbuf.h
create mode 100644 include/asm-microblaze/shmbuf.h
create mode 100644 include/asm-microblaze/shmparam.h
diff --git a/include/asm-microblaze/msgbuf.h b/include/asm-microblaze/msgbuf.h
new file mode 100644
index 0000000..e2f93f4
--- /dev/null
+++ b/include/asm-microblaze/msgbuf.h
@@ -0,0 +1,41 @@
+/*
+ * include/asm-microblaze/msgbuf.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) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_MSGBUF_H
+#define _ASM_MICROBLAZE_MSGBUF_H
+
+/*
+ * The msqid64_ds structure for m68k architecture.
+ * Note extra padding because this structure is passed back and forth
+ * between kernel and user space.
+ *
+ * Pad space is left for:
+ * - 64-bit time_t to solve y2038 problem
+ * - 2 miscellaneous 32-bit values
+ */
+
+struct msqid64_ds {
+ struct ipc64_perm msg_perm;
+ __kernel_time_t msg_stime; /* last msgsnd time */
+ unsigned long __unused1;
+ __kernel_time_t msg_rtime; /* last msgrcv time */
+ unsigned long __unused2;
+ __kernel_time_t msg_ctime; /* last change time */
+ unsigned long __unused3;
+ unsigned long msg_cbytes; /* current number of bytes on queue */
+ unsigned long msg_qnum; /* number of messages in queue */
+ unsigned long msg_qbytes; /* max number of bytes on queue */
+ __kernel_pid_t msg_lspid; /* pid of last msgsnd */
+ __kernel_pid_t msg_lrpid; /* last receive pid */
+ unsigned long __unused4;
+ unsigned long __unused5;
+};
+
+#endif /* ...Along with cleaning up the syscall interface, you should create asm-generic
versions of these files, ipcbuf.h and sembuf.h belong in the same category
(sysv IPC).
Unfortunately, most architectures have slightly different versions of them,
few of them really getting it right.
The version you have copied to microblaze is correct for little-endian
32 bit architectures, but not for big-endian architectures. The only
big-endian architectures that correctly implement padding are parisc,
powerpc, sparc, and the only one that gets 32 bit emulation right is
parisc (which, btw is a common scheme: if you want to know how to do
it, look at the parisc code).
I suppose it doesn't really matter much now, because SysV IPC is not
used a lot any more, and people have learned to live with the ill-defined
data structures. Most architectures have made the same mistake by
blindly copying the i386 version, so I'd suggest you take the version
you have and move that to asm-generic/{msg,shm,sem,ipc}buf.h, and
asm-generic/shmparam.h, so that every architecture using a copy of the
i386 headers can move to the generic one.
Arnd <><
--
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
include/asm-microblaze/bug.h | 17 +++++++++++++++++
include/asm-microblaze/bugs.h | 19 +++++++++++++++++++
2 files changed, 36 insertions(+), 0 deletions(-)
create mode 100644 include/asm-microblaze/bug.h
create mode 100644 include/asm-microblaze/bugs.h
diff --git a/include/asm-microblaze/bug.h b/include/asm-microblaze/bug.h
new file mode 100644
index 0000000..a0f58d1
--- /dev/null
+++ b/include/asm-microblaze/bug.h
@@ -0,0 +1,17 @@
+/*
+ * include/asm-microblaze/bug.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) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_BUG_H
+#define _ASM_MICROBLAZE_BUG_H
+
+#include <linux/kernel.h>
+#include <asm-generic/bug.h>
+
+#endif /* _ASM_MICROBLAZE_BUG_H */
diff --git a/include/asm-microblaze/bugs.h b/include/asm-microblaze/bugs.h
new file mode 100644
index 0000000..09256e7
--- /dev/null
+++ b/include/asm-microblaze/bugs.h
@@ -0,0 +1,19 @@
+/*
+ * include/asm-microblaze/bugs.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) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_BUGS_H
+#define _ASM_MICROBLAZE_BUGS_H
+
+static inline void check_bugs(void)
+{
+ /* nothing to do */
+}
+
+#endif /* _ASM_MICROBLAZE_BUGS_H */
--
1.5.4.GIT
--
From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- include/asm-microblaze/posix_types.h | 75 ++++++++++++++++++++++++++++++++++ include/asm-microblaze/types.h | 64 +++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/posix_types.h create mode 100644 include/asm-microblaze/types.h diff --git a/include/asm-microblaze/posix_types.h b/include/asm-microblaze/posix_types.h new file mode 100644 index 0000000..a4aa46e --- /dev/null +++ b/include/asm-microblaze/posix_types.h @@ -0,0 +1,75 @@ +/* + * include/asm-microblaze/posix_types.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) 2006 Atmark Techno, Inc. + */ + +#ifndef _ASM_MICROBLAZE_POSIX_TYPES_H +#define _ASM_MICROBLAZE_POSIX_TYPES_H + +/* + * This file is generally used by user-level software, so you need to + * be a little careful about namespace pollution etc. Also, we cannot + * assume GCC is being used. + */ + +typedef unsigned long __kernel_ino_t; +typedef unsigned short __kernel_mode_t; +typedef unsigned short __kernel_nlink_t; +typedef long __kernel_off_t; +typedef int __kernel_pid_t; +typedef unsigned short __kernel_ipc_pid_t; +typedef unsigned short __kernel_uid_t; +typedef unsigned short __kernel_gid_t; +typedef unsigned int __kernel_size_t; +typedef int __kernel_ssize_t; +typedef int __kernel_ptrdiff_t; +typedef long __kernel_time_t; +typedef long __kernel_suseconds_t; +typedef long __kernel_clock_t; +typedef int __kernel_timer_t; +typedef int __kernel_clockid_t; +typedef int __kernel_daddr_t; +typedef char * __kernel_caddr_t; +typedef unsigned short __kernel_uid16_t; +typedef unsigned short __kernel_gid16_t; +typedef unsigned int __kernel_uid32_t; +typedef unsigned int __kernel_gid32_t; + +typedef unsigned ...
It would be good to have this as asm-generic/posix_types_32.h. Unfortunately, __kernel_size_t and friends need to match the compiler and are sometimes defined as 'unsigned int' and sometimes as 'unsigned long', otherwise we could even use Some architectures define these as 'unsigned int', which seems reasonable, though there is no real requirement behind it, I suppose this should become 'typedef long long __kernel_off_t;' It won't work on pre-C99 compilers, but I don't think we need try not defining these at all and see if something breaks. If it does, that's probably a bug. Arnd <>< --
From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- include/asm-microblaze/ioctl.h | 84 +++++++++++++++++++++++++++++++++++ include/asm-microblaze/ioctls.h | 93 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/ioctl.h create mode 100644 include/asm-microblaze/ioctls.h diff --git a/include/asm-microblaze/ioctl.h b/include/asm-microblaze/ioctl.h new file mode 100644 index 0000000..7cfaaea --- /dev/null +++ b/include/asm-microblaze/ioctl.h @@ -0,0 +1,84 @@ +/* + * include/asm-microblaze/ioctl.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) 2006 Atmark Techno, Inc. + */ + +#ifndef _ASM_MICROBLAZE_IOCTL_H +#define _ASM_MICROBLAZE_IOCTL_H + +/* + * this was copied from the alpha as it's a bit cleaner there. + * -- Cort + */ + +#define _IOC_NRBITS 8 +#define _IOC_TYPEBITS 8 +#define _IOC_SIZEBITS 13 +#define _IOC_DIRBITS 3 + +#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) +#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) +#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) +#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) + +#define _IOC_NRSHIFT 0 +#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) +#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) +#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) + +/* + * Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit. + * And this turns out useful to catch old ioctl numbers in header + * files for us. + */ +#define _IOC_NONE 1U +#define _IOC_READ 2U +#define _IOC_WRITE 4U + +#define _IOC(dir, type, nr, size) \ + (((dir) << _IOC_DIRSHIFT) | \ + ((type) << _IOC_TYPESHIFT) | \ + ((nr) << _IOC_NRSHIFT) | \ + ((size) << _IOC_SIZESHIFT)) + +/* provoke compile error for invalid uses of size argument */ +extern unsigned int ...
This is a direct copy of asm-generic/ioctl.h, so just include that
I've already prototyped an asm-generic version of that, which would be the patch
below.
Arnd <><
---
Consolidate include/asm*/ioctls.h
Most architectures have an identical implementation of ioctls.h, so we can
just as well move it to asm-generic. While it should have been defined
using _IO style macros in the first place, there is enough precendent
to give up on that now, and just document what every architecture is
doing already.
The major difference between architectures at this time is the definition
of FIOQSIZE, which sometimes conflicts with TIOCGHAYESESP, so I use an
#ifdef for that.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Index: linux-2.6/include/asm-arm/ioctls.h
===================================================================
--- linux-2.6.orig/include/asm-arm/ioctls.h
+++ linux-2.6/include/asm-arm/ioctls.h
@@ -1,84 +1,6 @@
#ifndef __ASM_ARM_IOCTLS_H
#define __ASM_ARM_IOCTLS_H
-#include <asm/ioctl.h>
-
-/* 0x54 is just a magic number to make these relatively unique ('T') */
-
-#define TCGETS 0x5401
-#define TCSETS 0x5402
-#define TCSETSW 0x5403
-#define TCSETSF 0x5404
-#define TCGETA 0x5405
-#define TCSETA 0x5406
-#define TCSETAW 0x5407
-#define TCSETAF 0x5408
-#define TCSBRK 0x5409
-#define TCXONC 0x540A
-#define TCFLSH 0x540B
-#define TIOCEXCL 0x540C
-#define TIOCNXCL 0x540D
-#define TIOCSCTTY 0x540E
-#define TIOCGPGRP 0x540F
-#define TIOCSPGRP 0x5410
-#define TIOCOUTQ 0x5411
-#define TIOCSTI 0x5412
-#define TIOCGWINSZ 0x5413
-#define TIOCSWINSZ 0x5414
-#define TIOCMGET 0x5415
-#define TIOCMBIS 0x5416
-#define TIOCMBIC 0x5417
-#define TIOCMSET 0x5418
-#define TIOCGSOFTCAR 0x5419
-#define TIOCSSOFTCAR 0x541A
-#define FIONREAD 0x541B
-#define TIOCINQ FIONREAD
-#define TIOCLINUX 0x541C
-#define TIOCCONS 0x541D
-#define TIOCGSERIAL 0x541E
-#define TIOCSSERIAL 0x541F
-#define TIOCPKT 0x5420
-#define FIONBIO 0x5421
-#define ...I fixed it. I use asm-generic version too. ioctl.h and ioctls.h too. --
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
include/asm-microblaze/io.h | 210 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 210 insertions(+), 0 deletions(-)
create mode 100644 include/asm-microblaze/io.h
diff --git a/include/asm-microblaze/io.h b/include/asm-microblaze/io.h
new file mode 100644
index 0000000..d2c492f
--- /dev/null
+++ b/include/asm-microblaze/io.h
@@ -0,0 +1,210 @@
+/*
+ * include/asm-microblaze/io.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) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_IO_H
+#define _ASM_MICROBLAZE_IO_H
+
+#include <asm/byteorder.h>
+#include <asm/page.h>
+
+static inline unsigned char __raw_readb(const volatile void *addr)
+{
+ return *(volatile unsigned char __force *)addr;
+}
+static inline unsigned short __raw_readw(const volatile void *addr)
+{
+ return *(volatile unsigned short __force *)addr;
+}
+static inline unsigned int __raw_readl(const volatile void *addr)
+{
+ return *(volatile unsigned int __force *)addr;
+}
+static inline unsigned long __raw_readq(const volatile void *addr)
+{
+ return *(volatile unsigned long __force *)addr;
+}
+static inline void __raw_writeb(unsigned char v, volatile void *addr)
+{
+ *(volatile unsigned char __force *)addr = v;
+}
+static inline void __raw_writew(unsigned short v, volatile void *addr)
+{
+ *(volatile unsigned short __force *)addr = v;
+}
+static inline void __raw_writel(unsigned int v, volatile void *addr)
+{
+ *(volatile unsigned int __force *)addr = v;
+}
+static inline void __raw_writeq(unsigned long v, volatile void *addr)
+{
+ *(volatile unsigned long __force *)addr = v;
+}
+
+/*
+ * read (readb, readw, readl, readq) and write (writeb, writew,
+ * writel, writeq) accessors are for PCI and thus littel endian.
+ * Linux ...From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- include/asm-microblaze/elf.h | 24 +++++++++++ include/asm-microblaze/flat.h | 93 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/elf.h create mode 100644 include/asm-microblaze/flat.h diff --git a/include/asm-microblaze/elf.h b/include/asm-microblaze/elf.h new file mode 100644 index 0000000..4a14fa0 --- /dev/null +++ b/include/asm-microblaze/elf.h @@ -0,0 +1,24 @@ +/* + * include/asm-microblaze/elf.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) 2006 Atmark Techno, Inc. + */ + +#ifndef _ASM_MICROBLAZE_ELF_H +#define _ASM_MICROBLAZE_ELF_H + +#define EM_XILINX_MICROBLAZE 0xbaab +#define ELF_ARCH EM_XILINX_MICROBLAZE + +#define elf_check_arch(x) ((x)->e_machine == EM_XILINX_MICROBLAZE) + +/* + * These are used to set parameters in the core dumps. + */ +#define ELF_CLASS ELFCLASS32 + +#endif /* _ASM_MICROBLAZE_ELF_H */ diff --git a/include/asm-microblaze/flat.h b/include/asm-microblaze/flat.h new file mode 100644 index 0000000..77ef8a2 --- /dev/null +++ b/include/asm-microblaze/flat.h @@ -0,0 +1,93 @@ +/* + * include/asm-microblaze/flat.h + * + * uClinux flat-format executables + * + * Copyright (C) 2005 John Williams <jwilliams@itee.uq.edu.au> + * + * 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. + * + */ + +#ifndef _ASM_MICROBLAZE_FLAT_H +#define _ASM_MICROBLAZE_FLAT_H + +#include <asm/unaligned.h> + +#define flat_stack_align(sp) /* nothing needed */ +#define flat_argvp_envp_on_stack() 0 +#define flat_old_ram_flag(flags) (flags) +#define flat_reloc_valid(reloc, size) ((reloc) <= ...
I'm pretty sure this is also #defined somewhere else - asm/modules.h maybe? Also worth checking to see if MicroBlaze has been assigned a real ELF machine ID yet - not sure if Xilinx ever applied for one. --
From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- include/asm-microblaze/dma-mapping.h | 17 +++++++++++++++++ include/asm-microblaze/dma.h | 20 ++++++++++++++++++++ include/asm-microblaze/scatterlist.h | 21 +++++++++++++++++++++ 3 files changed, 58 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/dma-mapping.h create mode 100644 include/asm-microblaze/dma.h create mode 100644 include/asm-microblaze/scatterlist.h diff --git a/include/asm-microblaze/dma-mapping.h b/include/asm-microblaze/dma-mapping.h new file mode 100644 index 0000000..7227661 --- /dev/null +++ b/include/asm-microblaze/dma-mapping.h @@ -0,0 +1,17 @@ +/* + * include/asm-microblaze/dma-mapping.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 <monstr@monstr.eu> + * Copyright (C) 2006 Atmark Techno, Inc. + */ + +#ifndef _ASM_MICROBLAZE_DMA_MAPPING_H +#define _ASM_MICROBLAZE_DMA_MAPPING_H + +#include <asm-generic/dma-mapping.h> + +#endif /* _ASM_MICROBLAZE_DMA_MAPPING_H */ diff --git a/include/asm-microblaze/dma.h b/include/asm-microblaze/dma.h new file mode 100644 index 0000000..e36619f --- /dev/null +++ b/include/asm-microblaze/dma.h @@ -0,0 +1,20 @@ +/* + * include/asm-microblaze/dma.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) 2006 Atmark Techno, Inc. + */ + +#ifndef _ASM_MICROBLAZE_DMA_H +#define _ASM_MICROBLAZE_DMA_H + +/* we don't have dma address limit. define it as zero to be + * unlimited. */ +#define MAX_DMA_ADDRESS (0) + +#define ISA_DMA_THRESHOLD (0) + +#endif /* _ASM_MICROBLAZE_DMA_H */ diff --git a/include/asm-microblaze/scatterlist.h ...
Is this worthy of promotion to asm-generic/scatterlist.h? --
after moving dma_address one position up in the structure, as dma_addr_t may be
64-bit?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
dma_addr_t is defined in types.h. If your arch want to use 64bit addr, you can define it in types.h. I keep scatterlist.h in asm-microblaze. Adding to asm-generic later. Michal --
Sorry for not making myself clear: If unsigned long and dma_addr_t are 64-bit,
there may be a hole in between offset and dma_address, due to alignment
restrictions. So it's better to move dma_address up.
As dma_addr_t may be 64-bit even on 32-bit architectures, it may be best
to move it even to the start of the structure.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
yes, only move length is enough.
struct scatterlist {
unsigned long page_link;
unsigned int offset;
unsigned int length;
dma_addr_t dma_address;
};
Michal
--
If unsigned long is 32-bit but dma_addr_t is 64-bit, there may be a gap
between length and dma_address.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
But moving dma_address to the front only has the effect to create implicit padding at the end of struct scatterlist, so you don't gain anything either way. It's only an internal definition that can be changed at any time without breaking applications, so I wouldn't worry about it, and better leave it identical to the other architectures. The one thing that should indeed be changed is the addition of 'unsigned long sg_magic' that is needed for CONFIG_DEBUG_SG. Arnd <>< --
Hi all,
here is proposed struct.
struct scatterlist {
dma_addr_t dma_address;
unsigned long page_link;
#ifdef CONFIG_DEBUG_SG
unsigned long sg_magic;
#endif
unsigned int length;
unsigned int offset;
};
Is it OK now?
--
Everyone else has the sg_magic first, which makes sense for debugging. Don't worry about it too much, just use the same code as avr32, h8300, blackfin, fvr, mk68knommu, mn10300, sh, v850 and xtensa. These are all the same, but I just saw that they also have #define sg_dma_address(sg) ((sg)->dma_address) #define sg_dma_len(sg) ((sg)->length) which you probably want as well. Arnd <>< --
Hi Arnd and Geert,
struct scatterlist {
#ifdef CONFIG_DEBUG_SG
unsigned long sg_magic; /* 32 bit */
#endif
unsigned long page_link; /* 32 bit */
dma_addr_t dma_address; /* 32/64 bit */
unsigned int length; /* 32 bit */
unsigned int offset; /* 32 bit */
};
#define sg_dma_address(sg) ((sg)->dma_address)
#define sg_dma_len(sg) ((sg)->length)
Is it OK now? This will moved to asm-generic too.
--
Ack.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
looks good to me as well. Arnd <>< --
Hi Arnd and Geert, I think scatterlist.h can be moved to asm-generic. --
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
include/asm-microblaze/hardirq.h | 31 +++++++++++++++++++++++++++++++
include/asm-microblaze/hw_irq.h | 19 +++++++++++++++++++
include/asm-microblaze/irq_regs.h | 19 +++++++++++++++++++
3 files changed, 69 insertions(+), 0 deletions(-)
create mode 100644 include/asm-microblaze/hardirq.h
create mode 100644 include/asm-microblaze/hw_irq.h
create mode 100644 include/asm-microblaze/irq_regs.h
diff --git a/include/asm-microblaze/hardirq.h b/include/asm-microblaze/hardirq.h
new file mode 100644
index 0000000..8a143fa
--- /dev/null
+++ b/include/asm-microblaze/hardirq.h
@@ -0,0 +1,31 @@
+/*
+ * include/asm-microblaze/hardirq.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) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_HARDIRQ_H
+#define _ASM_MICROBLAZE_HARDIRQ_H
+
+#include <linux/cache.h>
+#include <linux/irq.h>
+#include <asm/irq.h>
+#include <asm/current.h>
+#include <asm/ptrace.h>
+
+/* should be defined in each interrupt controller driver */
+extern unsigned int get_irq(struct pt_regs *regs);
+
+typedef struct {
+ unsigned int __softirq_pending;
+} ____cacheline_aligned irq_cpustat_t;
+
+void ack_bad_irq(unsigned int irq);
+
+#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
+
+#endif /* _ASM_MICROBLAZE_HARDIRQ_H */
diff --git a/include/asm-microblaze/hw_irq.h b/include/asm-microblaze/hw_irq.h
new file mode 100644
index 0000000..467fa26
--- /dev/null
+++ b/include/asm-microblaze/hw_irq.h
@@ -0,0 +1,19 @@
+/*
+ * include/asm-microblaze/hw_irq.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) 2006 Atmark ...From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
include/asm-microblaze/atomic.h | 108 ++++++++++++++++++++++++++++++++++++
include/asm-microblaze/bitops.h | 29 ++++++++++
include/asm-microblaze/byteorder.h | 23 ++++++++
3 files changed, 160 insertions(+), 0 deletions(-)
create mode 100644 include/asm-microblaze/atomic.h
create mode 100644 include/asm-microblaze/bitops.h
create mode 100644 include/asm-microblaze/byteorder.h
diff --git a/include/asm-microblaze/atomic.h b/include/asm-microblaze/atomic.h
new file mode 100644
index 0000000..d0afdc5
--- /dev/null
+++ b/include/asm-microblaze/atomic.h
@@ -0,0 +1,108 @@
+/*
+ * include/asm-microblaze/atomic.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) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_ATOMIC_H
+#define _ASM_MICROBLAZE_ATOMIC_H
+
+#include <linux/compiler.h> /* likely */
+#include <asm/system.h> /* local_irq_XXX and friends */
+
+typedef struct { volatile int counter; } atomic_t;
+
+#define ATOMIC_INIT(i) { (i) }
+#define atomic_read(v) ((v)->counter)
+#define atomic_set(v, i) (((v)->counter) = (i))
+
+#define atomic_inc(v) (atomic_add_return(1, (v)))
+#define atomic_dec(v) (atomic_sub_return(1, (v)))
+
+#define atomic_add(i, v) (atomic_add_return(i, (v)))
+#define atomic_sub(i, v) (atomic_sub_return(i, (v)))
+
+#define atomic_inc_return(v) (atomic_add_return(1, (v)))
+#define atomic_dec_return(v) (atomic_sub_return(1, (v)))
+
+#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0)
+#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
+
+#define atomic_inc_not_zero(v) (atomic_add_unless((v), 1, 0))
+
+#define atomic_sub_and_test(i, v) (atomic_sub_return((i), (v)) == 0)
+
+static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
+{
+ int ...It would be cool if you could introduce this file as asm-generic/atomic-irqdisable.h or similar (can someone please think of a better name?). It looks like it could be shared with blackfin, h8300, m32r, m68k, mn10300 and v850. Not important though, as this is not part of the ABI. Arnd <>< --
atomic-nonnative.h? atomic-emulated.h? atomic-wish-we-had-it-native.h? --
Hi All, have someone any idea about others names of atomic.h in asm-generic? If not - I'll choose one but not the last(atomic-wish-we-had-it-native.h). :-) --
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
include/asm-microblaze/pgalloc.h | 16 ++++++++++++
include/asm-microblaze/pgtable.h | 50 ++++++++++++++++++++++++++++++++++++++
2 files changed, 66 insertions(+), 0 deletions(-)
create mode 100644 include/asm-microblaze/pgalloc.h
create mode 100644 include/asm-microblaze/pgtable.h
diff --git a/include/asm-microblaze/pgalloc.h b/include/asm-microblaze/pgalloc.h
new file mode 100644
index 0000000..adb41b9
--- /dev/null
+++ b/include/asm-microblaze/pgalloc.h
@@ -0,0 +1,16 @@
+/*
+ * include/asm-microblaze/pgalloc.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) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_PGALLOC_H
+#define _ASM_MICROBLAZE_PGALLOC_H
+
+#define check_pgt_cache() do {} while (0)
+
+#endif /* _ASM_MICROBLAZE_PGALLOC_H */
diff --git a/include/asm-microblaze/pgtable.h b/include/asm-microblaze/pgtable.h
new file mode 100644
index 0000000..d454df1
--- /dev/null
+++ b/include/asm-microblaze/pgtable.h
@@ -0,0 +1,50 @@
+/*
+ * include/asm-microblaze/pgtable.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) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_PGTABLE_H
+#define _ASM_MICROBLAZE_PGTABLE_H
+
+#define pgd_present(pgd) (1) /* pages are always present on NO_MM */
+#define pgd_none(pgd) (0)
+#define pgd_bad(pgd) (0)
+#define pgd_clear(pgdp)
+#define kern_addr_valid(addr) (1)
+#define pmd_offset(a, b) ((void *) 0)
+
+#define PAGE_NONE __pgprot(0) /* these mean nothing to NO_MM */
+#define PAGE_SHARED __pgprot(0) /* these mean nothing to NO_MM */
+#define PAGE_COPY __pgprot(0) /* these mean nothing to NO_MM ...From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
include/asm-microblaze/processor.h | 89 +++++++++++++++++
include/asm-microblaze/pvr.h | 185 +++++++++++++++++++++++++++++++++++
include/asm-microblaze/system.h | 190 ++++++++++++++++++++++++++++++++++++
3 files changed, 464 insertions(+), 0 deletions(-)
create mode 100644 include/asm-microblaze/processor.h
create mode 100644 include/asm-microblaze/pvr.h
create mode 100644 include/asm-microblaze/system.h
diff --git a/include/asm-microblaze/processor.h b/include/asm-microblaze/processor.h
new file mode 100644
index 0000000..6fd391c
--- /dev/null
+++ b/include/asm-microblaze/processor.h
@@ -0,0 +1,89 @@
+/*
+ * include/asm-microblaze/processor.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) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_PROCESSOR_H
+#define _ASM_MICROBLAZE_PROCESSOR_H
+
+#include <asm/ptrace.h>
+#include <asm/setup.h>
+
+/*
+ * User space process size: memory size
+ *
+ * TASK_SIZE on MMU cpu is usually 1GB. However, on no-MMU arch, both
+ * user processes and the kernel is on the same memory region. They
+ * both share the memory space and that is limited by the amount of
+ * physical memory. thus, we set TASK_SIZE == amount of total memory.
+ */
+
+#define TASK_SIZE (0x81000000 - 0x80000000)
+
+/*
+ * Default implementation of macro that returns current
+ * instruction pointer ("program counter").
+ */
+#define current_text_addr() ({ __label__ _l; _l: &&_l; })
+
+/*
+ * This decides where the kernel will search for a free chunk of vm
+ * space during mmap's. We won't be using it
+ */
+#define TASK_UNMAPPED_BASE 0
+
+struct task_struct;
+
+/* thread_struct is gone. use thread_info instead. */
+struct thread_struct { };
+#define INIT_THREAD { }
+
+/* Do ...From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- include/asm-microblaze/clinkage.h | 29 +++++++++++++++++++++++++++++ include/asm-microblaze/kmap_types.h | 31 +++++++++++++++++++++++++++++++ include/asm-microblaze/linkage.h | 17 +++++++++++++++++ include/asm-microblaze/sections.h | 19 +++++++++++++++++++ 4 files changed, 96 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/clinkage.h create mode 100644 include/asm-microblaze/kmap_types.h create mode 100644 include/asm-microblaze/linkage.h create mode 100644 include/asm-microblaze/sections.h diff --git a/include/asm-microblaze/clinkage.h b/include/asm-microblaze/clinkage.h new file mode 100644 index 0000000..28dcd1c --- /dev/null +++ b/include/asm-microblaze/clinkage.h @@ -0,0 +1,29 @@ +/* + * include/asm-microblaze/clinkage.h + * + * Macros to reflect C symbol-naming conventions + * + * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au> + * Copyright (C) 2001,2002 NEC Corporatione + * Copyright (C) 2001,2002 Miles Bader <miles@gnu.org> + * + * 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. + * + * Written by Miles Bader <miles@gnu.org> + * Microblaze port by John Williams + */ + +#ifndef _ASM_MICROBLAZE_CLINKAGE_H +#define _ASM_MICROBLAZE_CLINKAGE_H + +#define __ASSEMBLY__ + +#include <linux/linkage.h> + +#define C_SYMBOL_NAME(name) name +#define C_ENTRY(name) .globl name; .align 4; name +#define C_END(name) + +#endif /* _ASM_MICROBLAZE_CLINKAGE_H */ diff --git a/include/asm-microblaze/kmap_types.h b/include/asm-microblaze/kmap_types.h new file mode 100644 index 0000000..5b53f6e --- /dev/null +++ b/include/asm-microblaze/kmap_types.h @@ -0,0 +1,31 @@ +/* + * include/asm-microblaze/kmap_types.h + * + * This file is subject to the terms and conditions of the GNU General Public + * ...
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
include/asm-microblaze/stat.h | 75 +++++++++++++++++++++++++++++++++++++++
include/asm-microblaze/statfs.h | 16 ++++++++
2 files changed, 91 insertions(+), 0 deletions(-)
create mode 100644 include/asm-microblaze/stat.h
create mode 100644 include/asm-microblaze/statfs.h
diff --git a/include/asm-microblaze/stat.h b/include/asm-microblaze/stat.h
new file mode 100644
index 0000000..4289f6b
--- /dev/null
+++ b/include/asm-microblaze/stat.h
@@ -0,0 +1,75 @@
+/*
+ * include/asm-microblaze/stat.h
+ *
+ * Microblaze stat structure
+ *
+ * Copyright (C) 2001,02,03 NEC Electronics Corporation
+ * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org>
+ *
+ * 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.
+ *
+ * Written by Miles Bader <miles@gnu.org>
+ */
+
+#ifndef _ASM_MICROBLAZE_STAT_H
+#define _ASM_MICROBLAZE_STAT_H
+
+#include <asm/posix_types.h>
+
+struct stat {
+ unsigned int st_dev;
+ unsigned long st_ino;
+ unsigned int st_mode;
+ unsigned int st_nlink;
+ unsigned int st_uid;
+ unsigned int st_gid;
+ unsigned int st_rdev;
+ long st_size;
+ unsigned long st_blksize;
+ unsigned long st_blocks;
+ unsigned long st_atime;
+ unsigned long __unused1;
+ unsigned long st_mtime;
+ unsigned long __unused2;
+ unsigned long st_ctime;
+ unsigned long __unused3;
+ unsigned long __unused4;
+ unsigned long __unused5;
+};
+
+struct stat64 {
+ unsigned long long st_dev;
+ unsigned long __unused1;
+
+ unsigned long long st_ino;
+
+ unsigned int st_mode;
+ unsigned int st_nlink;
+
+ unsigned int st_uid;
+ unsigned int st_gid;
+
+ unsigned long long st_rdev;
+ unsigned long __unused3;
+
+ long long st_size;
+ unsigned long st_blksize;
+
+ unsigned long st_blocks; /* No. of 512-byte blocks allocated */
+ unsigned long __unused4; /* ...There should only be a 'struct stat', not stat64, and it would be nice
to have that in asm-generic/stat.h.
I think it should be defined as
struct stat {
unsigned long long st_dev;
unsigned long long st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned int st_uid;
unsigned int st_gid;
unsigned long long st_rdev;
long long st_size;
unsigned int st_blksize;
unsigned int __unused1;
unsigned long long st_blocks; /* No. of 512-byte blocks allocated */
unsigned int st_atime;
unsigned int st_atime_nsec;
unsigned int st_mtime;
unsigned int st_mtime_nsec;
unsigned int st_ctime;
unsigned int st_ctime_nsec;
unsigned int __unused2;
unsigned int __unused3;
};
This way, you don't have any unnecessary padding, and the structure
is compatible in 32 and 64 bit architectures.
Arnd <><
--
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
include/asm-microblaze/termbits.h | 203 +++++++++++++++++++++++++++++++++++++
include/asm-microblaze/termios.h | 86 ++++++++++++++++
2 files changed, 289 insertions(+), 0 deletions(-)
create mode 100644 include/asm-microblaze/termbits.h
create mode 100644 include/asm-microblaze/termios.h
diff --git a/include/asm-microblaze/termbits.h b/include/asm-microblaze/termbits.h
new file mode 100644
index 0000000..695f370
--- /dev/null
+++ b/include/asm-microblaze/termbits.h
@@ -0,0 +1,203 @@
+/*
+ * include/asm-microblaze/termbits.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) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_TERMBITS_H
+#define _ASM_MICROBLAZE_TERMBITS_H
+
+#include <linux/posix_types.h>
+
+typedef unsigned char cc_t;
+typedef unsigned int speed_t;
+typedef unsigned int tcflag_t;
+
+#define NCCS 19
+struct termios {
+ tcflag_t c_iflag; /* input mode flags */
+ tcflag_t c_oflag; /* output mode flags */
+ tcflag_t c_cflag; /* control mode flags */
+ tcflag_t c_lflag; /* local mode flags */
+ cc_t c_line; /* line discipline */
+ cc_t c_cc[NCCS]; /* control characters */
+};
+
+struct ktermios {
+ tcflag_t c_iflag; /* input mode flags */
+ tcflag_t c_oflag; /* output mode flags */
+ tcflag_t c_cflag; /* control mode flags */
+ tcflag_t c_lflag; /* local mode flags */
+ cc_t c_line; /* line discipline */
+ cc_t c_cc[NCCS]; /* control characters */
+ speed_t c_ispeed; /* input speed */
+ speed_t c_ospeed; /* output speed */
+};
+
+
+/* c_cc characters */
+
+#define VINTR 0
+#define VQUIT 1
+#define VERASE 2
+#define VKILL 3
+#define VEOF 4
+#define VTIME 5
+#define VMIN 6
+#define VSWTC 7
+#define VSTART 8
+#define VSTOP 9
+#define VSUSP 10
+#define VEOL 11
+#define VREPRINT ...Both of these are candidates for asm-generic, but I haven't looked at them in detail yet. Arnd <>< --
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
include/asm-microblaze/sigcontext.h | 21 +++++++++++++++++++++
include/asm-microblaze/siginfo.h | 17 +++++++++++++++++
2 files changed, 38 insertions(+), 0 deletions(-)
create mode 100644 include/asm-microblaze/sigcontext.h
create mode 100644 include/asm-microblaze/siginfo.h
diff --git a/include/asm-microblaze/sigcontext.h b/include/asm-microblaze/sigcontext.h
new file mode 100644
index 0000000..b35dd88
--- /dev/null
+++ b/include/asm-microblaze/sigcontext.h
@@ -0,0 +1,21 @@
+/*
+ * include/asm-microblaze/sigcontext.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) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_SIGCONTEXT_H
+#define _ASM_MICROBLAZE_SIGCONTEXT_H
+
+#include <asm/ptrace.h>
+
+struct sigcontext {
+ struct pt_regs regs;
+ unsigned long oldmask;
+};
+
+#endif /* _ASM_MICROBLAZE_SIGCONTEXT_H */
diff --git a/include/asm-microblaze/siginfo.h b/include/asm-microblaze/siginfo.h
new file mode 100644
index 0000000..ef15636
--- /dev/null
+++ b/include/asm-microblaze/siginfo.h
@@ -0,0 +1,17 @@
+/*
+ * include/asm-microblaze/siginfo.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) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_SIGINFO_H
+#define _ASM_MICROBLAZE_SIGINFO_H
+
+#include <linux/types.h>
+#include <asm-generic/siginfo.h>
+
+#endif /* _ASM_MICROBLAZE_SIGINFO_H */
--
1.5.4.GIT
--
From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- include/asm-microblaze/auxvec.h | 14 ++++++++++++++ include/asm-microblaze/cputime.h | 16 ++++++++++++++++ include/asm-microblaze/div64.h | 16 ++++++++++++++++ include/asm-microblaze/emergency-restart.h | 16 ++++++++++++++++ include/asm-microblaze/errno.h | 16 ++++++++++++++++ include/asm-microblaze/futex.h | 16 ++++++++++++++++ include/asm-microblaze/kdebug.h | 19 +++++++++++++++++++ include/asm-microblaze/local.h | 16 ++++++++++++++++ include/asm-microblaze/mutex.h | 16 ++++++++++++++++ include/asm-microblaze/namei.h | 24 ++++++++++++++++++++++++ include/asm-microblaze/percpu.h | 16 ++++++++++++++++ include/asm-microblaze/resource.h | 16 ++++++++++++++++ include/asm-microblaze/user.h | 18 ++++++++++++++++++ 13 files changed, 219 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/auxvec.h create mode 100644 include/asm-microblaze/cputime.h create mode 100644 include/asm-microblaze/div64.h create mode 100644 include/asm-microblaze/emergency-restart.h create mode 100644 include/asm-microblaze/errno.h create mode 100644 include/asm-microblaze/futex.h create mode 100644 include/asm-microblaze/kdebug.h create mode 100644 include/asm-microblaze/local.h create mode 100644 include/asm-microblaze/mutex.h create mode 100644 include/asm-microblaze/namei.h create mode 100644 include/asm-microblaze/percpu.h create mode 100644 include/asm-microblaze/resource.h create mode 100644 include/asm-microblaze/user.h diff --git a/include/asm-microblaze/auxvec.h b/include/asm-microblaze/auxvec.h new file mode 100644 index 0000000..73c0fb0 --- /dev/null +++ b/include/asm-microblaze/auxvec.h @@ -0,0 +1,14 @@ +/* + * include/asm-microblaze/auxvec.h + * + * This file is subject to the terms and ...
These are all just includes of asm-generic/* (hooray!). But, is it reasonable to to suggest adding asm-generic at the end of the kernel include path, and save all this verbosity? Principle of least surprise maybe? John --
On Sun, May 4, 2008 at 8:34 PM, John Williams Convention in the other archs is already established to explicitly include asm-generic files one by one. It is probably best to match existing convention for commonality sake. Cheers, g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. --
Right, I agree. We may eventually want to move to something more sophisticated, but we should not change the current way of doing this while we're in the process of adding a new architecture. Arnd <>< --
On Mon, 05 May 2008 12:34:09 +1000 John Williams <john.williams@petalogix.c= Absolutely, but is it really necessary to have 14-16 lines of comment (including a copyright notice) for a file whose single real line is just to include another file? i.e. reduce all these to 1 line files. --=20 Cheers, Stephen Rothwell sfr@canb.auug.org.au http://www.canb.auug.org.au/~sfr/
Can I do it? I think every file need license. M --
Its pretty hard to claim copyright rights on a single source line of code. :-) Cheers, g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. --
If you want a good answer on that, ask your lawyer. In general, every file comes with a 'license' (GPLv2) and 'copyright' (you or the person you copied from) even if you don't put either statement in the file. Files smaller than some 10 lines are usually not considered to be covered by copyright, even if you have the statement in there. Most files nowadays are written by large corporations that have strict rules about what you must put in there to protect their intellectual property. It's certainly safe to leave out the file names from the comments, they don't add any value at all. Similarly, you should easily be able to leave out the license statement, unless you are under a contract that forces you to leave them present. Most people here will be happier if you remove the license statements. The most tricky one part is the copyright statement ("Copyright 2012 Big Corporation of America"), which you strictly speaking should never remove from a file unless you have permission from the copyright holder. Many of your files in your patch set are obviously copies of existing kernel files, with the original copyright notice replaced with "Atmark Techno, inc.". You can draw your own conclusions from that ;-) Obviously, I am not a lawyer, so don't consider this as legal advice. I really hope this doesn't turn into a flamewar, as discussions on intellectual property sometimes do. Arnd <>< --
From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- include/asm-microblaze/current.h | 25 +++++++++++++++++++++++++ include/asm-microblaze/entry.h | 32 ++++++++++++++++++++++++++++++++ include/asm-microblaze/mman.h | 27 +++++++++++++++++++++++++++ include/asm-microblaze/registers.h | 26 ++++++++++++++++++++++++++ include/asm-microblaze/sembuf.h | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 146 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/current.h create mode 100644 include/asm-microblaze/entry.h create mode 100644 include/asm-microblaze/mman.h create mode 100644 include/asm-microblaze/registers.h create mode 100644 include/asm-microblaze/sembuf.h diff --git a/include/asm-microblaze/current.h b/include/asm-microblaze/current.h new file mode 100644 index 0000000..342df9f --- /dev/null +++ b/include/asm-microblaze/current.h @@ -0,0 +1,25 @@ +/* + * include/asm-microblaze/current.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) 2006 Atmark Techno, Inc. + */ + +#ifndef _ASM_MICROBLAZE_CURRENT_H +#define _ASM_MICROBLAZE_CURRENT_H + +#ifndef __ASSEMBLY__ + +/* + * Dedicate r31 to keeping the current task pointer + */ +register struct task_struct *current asm("r31"); + +#define get_current() current + +#endif + +#endif /* _ASM_MICROBLAZE_CURRENT_H */ diff --git a/include/asm-microblaze/entry.h b/include/asm-microblaze/entry.h new file mode 100644 index 0000000..9e55a95 --- /dev/null +++ b/include/asm-microblaze/entry.h @@ -0,0 +1,32 @@ +/* + * include/asm-microblaze/entry.h + * + * Definitions used by low-level trap handlers + * + * Copyright (C) 2007 PetaLogix + * Copyright (C) 2007 John Williams <john.williams@petalogix.com> + * + * This file is subject to the terms and conditions of the ...
I think we should come up with a good way to fold these into the asm-generic header, as half the architectures use the same values for them, in addition to what is already shared. Arnd <>< --
Hi Arnd, I keep mman.h in this style. I see the best way push microblaze to mainline and then synchronize all these files together among all archs. I'll add it to my future list. --
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
include/asm-microblaze/device.h | 27 ++++++++
include/asm-microblaze/param.h | 36 +++++++++++
include/asm-microblaze/topology.h | 119 +++++++++++++++++++++++++++++++++++++
3 files changed, 182 insertions(+), 0 deletions(-)
create mode 100644 include/asm-microblaze/device.h
create mode 100644 include/asm-microblaze/param.h
create mode 100644 include/asm-microblaze/topology.h
diff --git a/include/asm-microblaze/device.h b/include/asm-microblaze/device.h
new file mode 100644
index 0000000..c0e203c
--- /dev/null
+++ b/include/asm-microblaze/device.h
@@ -0,0 +1,27 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ */
+
+#ifndef _ASM_MICROBLAZE_DEVICE_H
+#define _ASM_MICROBLAZE_DEVICE_H
+
+struct dma_mapping_ops;
+struct device_node;
+
+struct dev_archdata {
+ /* Optional pointer to an OF device node */
+ struct device_node *of_node;
+
+ /* DMA operations on that device */
+ struct dma_mapping_ops *dma_ops;
+ void *dma_data;
+
+ /* NUMA node if applicable */
+ int numa_node;
+};
+
+#endif /* _ASM_MICROBLAZE_DEVICE_H */
+
+
diff --git a/include/asm-microblaze/param.h b/include/asm-microblaze/param.h
new file mode 100644
index 0000000..e6873a9
--- /dev/null
+++ b/include/asm-microblaze/param.h
@@ -0,0 +1,36 @@
+/*
+ * include/asm-microblaze/param.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) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_PARAM_H
+#define _ASM_MICROBLAZE_PARAM_H
+
+#ifdef __KERNEL__
+# define HZ 100 /* internal timer frequency */
+# define USER_HZ 100 /* for user interfaces in "ticks" */
+# define CLOCKS_PER_SEC (USER_HZ) /* frequnzy at which times() counts */
+#endif
+
+#ifndef NGROUPS
+#define ...microblaze doesn't have NUMA or dma_mapping_ops, afaict, so it should
just be
struct dev_archdata {
/* Optional pointer to an OF device node */
struct device_node *of_node;
These parameters are so common that they should become asm-generic/param.h.
4kb page size is of course a HW feature, but it's so universal that it's almost
please use the existing asm-generic/topology.h here.
Arnd <><
--
I reduced device.h. Remove NUMA from structure and comment NUMA in OF files. param.h moved to generic folder. --
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
include/asm-microblaze/poll.h | 37 +++++++++++++++++++++
include/asm-microblaze/socket.h | 68 +++++++++++++++++++++++++++++++++++++++
2 files changed, 105 insertions(+), 0 deletions(-)
create mode 100644 include/asm-microblaze/poll.h
create mode 100644 include/asm-microblaze/socket.h
diff --git a/include/asm-microblaze/poll.h b/include/asm-microblaze/poll.h
new file mode 100644
index 0000000..4b33ac7
--- /dev/null
+++ b/include/asm-microblaze/poll.h
@@ -0,0 +1,37 @@
+/*
+ * include/asm-microblaze/poll.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) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_POLL_H
+#define _ASM_MICROBLAZE_POLL_H
+
+#define POLLIN 0x0001
+#define POLLPRI 0x0002
+#define POLLOUT 0x0004
+
+#define POLLERR 0x0008
+#define POLLHUP 0x0010
+#define POLLNVAL 0x0020
+
+#define POLLRDNORM 0x0040
+#define POLLRDBAND 0x0080
+#define POLLWRNORM POLLOUT
+#define POLLWRBAND 0x0100
+
+#define POLLMSG 0x0400
+#define POLLREMOVE 0x0800
+#define POLLRDHUP 0x2000
+
+struct pollfd {
+ int fd;
+ short events;
+ short revents;
+};
+
+#endif /* _ASM_MICROBLAZE_POLL_H */
diff --git a/include/asm-microblaze/socket.h b/include/asm-microblaze/socket.h
new file mode 100644
index 0000000..58d6e01
--- /dev/null
+++ b/include/asm-microblaze/socket.h
@@ -0,0 +1,68 @@
+/*
+ * include/asm-microblaze/socket.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) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_SOCKET_H
+#define _ASM_MICROBLAZE_SOCKET_H
+
+#include <asm/sockios.h>
+
+/* For setsockoptions(2) */
+#define ...Please make a new asm-generic/socket.h out of this file, and use it. Arnd <>< --
From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- include/asm-microblaze/fcntl.h | 104 +++++++++++++++++++++++++++++++++++++ include/asm-microblaze/sockios.h | 25 +++++++++ include/asm-microblaze/ucontext.h | 24 +++++++++ 3 files changed, 153 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/fcntl.h create mode 100644 include/asm-microblaze/sockios.h create mode 100644 include/asm-microblaze/ucontext.h diff --git a/include/asm-microblaze/fcntl.h b/include/asm-microblaze/fcntl.h new file mode 100644 index 0000000..b8706c9 --- /dev/null +++ b/include/asm-microblaze/fcntl.h @@ -0,0 +1,104 @@ +/* + * include/asm-microblaze/fcntl.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) 2006 Atmark Techno, Inc. + */ + +#ifndef _ASM_MICROBLAZE_FCNTL_H +#define _ASM_MICROBLAZE_FCNTL_H + +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files + located on an ext2 file system */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define FASYNC 020000 /* fcntl, for BSD compatibility */ +#define O_DIRECTORY 040000 /* must be a directory */ +#define O_NOFOLLOW 0100000 /* don't follow links */ +#define O_LARGEFILE 0200000 +#define O_DIRECT 0400000 /* direct disk access hint */ +#define O_NOATIME 01000000 +#define O_CLOEXEC 02000000 + +#define F_DUPFD 0 /* dup */ +#define F_GETFD 1 /* get close_on_exec */ +#define F_SETFD 2 /* set/clear close_on_exec */ +#define F_GETFL 3 /* get file->f_flags */ +#define F_SETFL 4 /* set ...
turn these into asm-generic versions. Arnd <>< --
From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- include/asm-microblaze/setup.h | 42 +++++++++ include/asm-microblaze/string.h | 22 +++++ include/asm-microblaze/thread_info.h | 155 ++++++++++++++++++++++++++++++++++ 3 files changed, 219 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/setup.h create mode 100644 include/asm-microblaze/string.h create mode 100644 include/asm-microblaze/thread_info.h diff --git a/include/asm-microblaze/setup.h b/include/asm-microblaze/setup.h new file mode 100644 index 0000000..ba4bf7d --- /dev/null +++ b/include/asm-microblaze/setup.h @@ -0,0 +1,42 @@ +/* + * include/asm-microblaze/setup.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) 2006 Atmark Techno, Inc. + */ + +#ifndef _ASM_MICROBLAZE_SETUP_H +#define _ASM_MICROBLAZE_SETUP_H + +#include <linux/init.h> + +extern unsigned int boot_cpuid; + +#define COMMAND_LINE_SIZE 256 +extern char cmd_line[COMMAND_LINE_SIZE]; + +int __init setup_early_printk(char *opt); +void early_printk(const char *fmt, ...); + +#ifdef CONFIG_HEART_BEAT +void heartbeat(void); +#endif + +void system_timer_init(void); +unsigned long do_gettimeoffset(void); +void time_init(void); +unsigned long long sched_clock(void); + +void __init setup_memory(void); +void __init machine_early_init(const char *cmdline, unsigned int ram, + unsigned int fdt); + +void machine_restart(char *cmd); +void machine_shutdown(void); +void machine_halt(void); +void machine_power_off(void); + +#endif /* _ASM_MICROBLAZE_SETUP_H */ diff --git a/include/asm-microblaze/string.h b/include/asm-microblaze/string.h new file mode 100644 index 0000000..bf2051c --- /dev/null +++ b/include/asm-microblaze/string.h @@ -0,0 +1,22 @@ +/* + * include/asm-microblaze/string.h + * + * This ...
I'd be happier to see this called r1. If mb-as doesn't accept "sp" as an alias for "r1", nor should we. Is it worth a comment that r31 is absent because it's used as 'current' pointer, and -ffixed-r31 etc? --
From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- include/asm-microblaze/Kbuild | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/Kbuild diff --git a/include/asm-microblaze/Kbuild b/include/asm-microblaze/Kbuild new file mode 100644 index 0000000..783296d --- /dev/null +++ b/include/asm-microblaze/Kbuild @@ -0,0 +1,24 @@ +include include/asm-generic/Kbuild.asm + +header-y += auxvec.h +header-y += cpuinfo.h +header-y += errno.h +header-y += fcntl.h +header-y += ioctl.h +header-y += ioctls.h +header-y += ipcbuf.h +header-y += linkage.h +header-y += mman.h +header-y += msgbuf.h +header-y += poll.h +header-y += resource.h +header-y += sembuf.h +header-y += shmbuf.h +header-y += sigcontext.h +header-y += siginfo.h +header-y += socket.h +header-y += sockios.h +header-y += statfs.h +header-y += stat.h +header-y += termbits.h +header-y += ucontext.h -- 1.5.4.GIT --
From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- include/asm-microblaze/pci-bridge.h | 17 +++++++++++++++++ include/asm-microblaze/pci.h | 19 +++++++++++++++++++ 2 files changed, 36 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/pci-bridge.h create mode 100644 include/asm-microblaze/pci.h diff --git a/include/asm-microblaze/pci-bridge.h b/include/asm-microblaze/pci-bridge.h new file mode 100644 index 0000000..3a74fd4 --- /dev/null +++ b/include/asm-microblaze/pci-bridge.h @@ -0,0 +1,17 @@ +/* + * include/asm-microblaze/pci-bridge.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 <monstr@monstr.eu> + * Copyright (C) 2006 Atmark Techno, Inc. + */ + +#ifndef _ASM_PCI_BRIDGE_H +#define _ASM_PCI_BRIDGE_H + +#include <linux/pci.h> + +#endif /* _ASM_PCI_BRIDGE_H */ diff --git a/include/asm-microblaze/pci.h b/include/asm-microblaze/pci.h new file mode 100644 index 0000000..89bec79 --- /dev/null +++ b/include/asm-microblaze/pci.h @@ -0,0 +1,19 @@ +/* + * include/asm-microblaze/pci.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 <monstr@monstr.eu> + * Copyright (C) 2006 Atmark Techno, Inc. + */ + +#ifndef _ASM_MICROBLAZE_PCI_H +#define _ASM_MICROBLAZE_PCI_H + +#ifdef __KERNEL__ +#include <asm/io.h> +#endif + +#endif /* _ASM_MICROBLAZE_PCI_H */ -- 1.5.4.GIT --
You don't export asm/pci.h to userspace, so the #ifdef __KERNEL__ is not needed. Arnd <>< --
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
include/asm-microblaze/ipc.h | 18 ++++++++++++++++++
include/asm-microblaze/ipcbuf.h | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 0 deletions(-)
create mode 100644 include/asm-microblaze/ipc.h
create mode 100644 include/asm-microblaze/ipcbuf.h
diff --git a/include/asm-microblaze/ipc.h b/include/asm-microblaze/ipc.h
new file mode 100644
index 0000000..cd0fe3a
--- /dev/null
+++ b/include/asm-microblaze/ipc.h
@@ -0,0 +1,18 @@
+/*
+ * include/asm-microblaze/ipc.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) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_IPC_H
+#define _ASM_MICROBLAZE_IPC_H
+
+#include <asm-generic/ipc.h>
+
+#endif /* _ASM_MICROBLAZE_IPC_H */
+
+
diff --git a/include/asm-microblaze/ipcbuf.h b/include/asm-microblaze/ipcbuf.h
new file mode 100644
index 0000000..4aadc52
--- /dev/null
+++ b/include/asm-microblaze/ipcbuf.h
@@ -0,0 +1,38 @@
+/*
+ * include/asm-microblaze/ipcbuf.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) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_IPCBUF_H
+#define _ASM_MICROBLAZE_IPCBUF_H
+
+/*
+ * The user_ipc_perm structure for m68k architecture.
+ * Note extra padding because this structure is passed back and forth
+ * between kernel and user space.
+ *
+ * Pad space is left for:
+ * - 32-bit mode_t and seq
+ * - 2 miscellaneous 32-bit values
+ */
+
+struct ipc64_perm {
+ __kernel_key_t key;
+ __kernel_uid32_t uid;
+ __kernel_gid32_t gid;
+ __kernel_uid32_t cuid;
+ __kernel_gid32_t cgid;
+ __kernel_mode_t mode;
+ unsigned ...From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- arch/microblaze/kernel/entry.S | 597 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 597 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/entry.S diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S new file mode 100644 index 0000000..d0b487b --- /dev/null +++ b/arch/microblaze/kernel/entry.S @@ -0,0 +1,597 @@ +/* + * arch/microblaze/kernel/entry.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) 2006 Atmark Techno, Inc. + */ + +#include <linux/linkage.h> +#include <asm/thread_info.h> +#include <asm/errno.h> +#include <asm/asm-offsets.h> +#include <asm/registers.h> +#include <asm/unistd.h> +#include <asm/percpu.h> +#include <asm/signal.h> + +#define PER_CPU(var) per_cpu__##var + +#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR + .macro disable_irq + msrclr r0, MSR_IE + .endm + + .macro enable_irq + msrset r0, MSR_IE + .endm + + .macro clear_bip + msrclr r0, MSR_BIP + .endm +#else + .macro disable_irq + mfs r11, rmsr + andi r11, r11, ~MSR_IE + mts rmsr, r11 + .endm + + .macro enable_irq + mfs r11, rmsr + ori r11, r11, MSR_IE + mts rmsr, r11 + .endm + + .macro clear_bip + mfs r11, rmsr + andi r11, r11, ~MSR_BIP + mts rmsr, r11 + .endm +#endif + +ENTRY(_interrupt) + swi r1, r0, PER_CPU(ENTRY_SP) /* save the current sp */ + swi r11, r0, PER_CPU(R11_SAVE) /* temporarily save r11 */ + lwi r11, r0, PER_CPU(KM) /* load mode indicator */ + beqid r11, 1f + nop + brid 2f /* jump over */ + addik r1, r1, (-PT_SIZE) /* room for pt_regs (delay slot) */ +1: /* switch to kernel stack */ + lwi r1, r0, PER_CPU(CURRENT_SAVE) /* get the saved current */ + lwi r1, r1, TS_THREAD_INFO /* get the thread info */ + /* calculate kernel stack pointer ...
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
arch/microblaze/kernel/sys_microblaze.c | 287 +++++++++++++++++++++++++++++++
1 files changed, 287 insertions(+), 0 deletions(-)
create mode 100644 arch/microblaze/kernel/sys_microblaze.c
diff --git a/arch/microblaze/kernel/sys_microblaze.c b/arch/microblaze/kernel/sys_microblaze.c
new file mode 100644
index 0000000..1cf8efd
--- /dev/null
+++ b/arch/microblaze/kernel/sys_microblaze.c
@@ -0,0 +1,287 @@
+/*
+ * arch/microblaze/kernel/sys_microblaze.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) 2006 Atmark Techno, Inc.
+ * Copyright (C) 2007 PetaLogix
+ *
+ * Authors:
+ * John Williams <john.williams@petalogix.com>
+ * Yasushi SHOJI <yashi@atmark-techno.com>
+ * Tetsuya OHKAWA <tetsuya@atmark-techno.com>
+ */
+
+#include <linux/errno.h>
+#include <linux/mm.h>
+#include <linux/smp.h>
+#include <linux/smp_lock.h>
+#include <linux/syscalls.h>
+#include <linux/sem.h>
+#include <linux/msg.h>
+#include <linux/shm.h>
+#include <linux/stat.h>
+#include <linux/mman.h>
+#include <linux/sys.h>
+#include <linux/ipc.h>
+#include <linux/utsname.h>
+#include <linux/file.h>
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/fs.h>
+
+#include <asm/uaccess.h>
+#include <linux/ipc.h>
+#include <asm/semaphore.h>
+#include <asm/unistd.h>
+
+/*
+ * sys_ipc() is the de-multiplexer for the SysV IPC calls..
+ *
+ * This is really horribly ugly.
+ */
+int
+sys_ipc(uint call, int first, int second, int third, void *ptr, long fifth)
+{
+ int version, ret;
+
+ version = call >> 16; /* hack for backward compatibility */
+ call &= 0xffff;
+
+ ret = -EINVAL;
+ switch (call) {
+ case SEMOP:
+ ret = sys_semop(first, (struct sembuf *)ptr, second);
+ break;
+ case SEMGET:
+ ret = sys_semget(first, second, ...From: Michal Simek <monstr@monstr.eu> Signed-off-by: Michal Simek <monstr@monstr.eu> --- arch/microblaze/kernel/syscall_table.S | 330 +++++++++++++++++++++++++++ include/asm-microblaze/unistd.h | 392 ++++++++++++++++++++++++++++++++ 2 files changed, 722 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/syscall_table.S create mode 100644 include/asm-microblaze/unistd.h diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S new file mode 100644 index 0000000..6a5461b --- /dev/null +++ b/arch/microblaze/kernel/syscall_table.S @@ -0,0 +1,330 @@ +ENTRY(sys_call_table) + .long sys_restart_syscall /* 0 - old "setup()" system call, + * used for restarting */ + .long sys_exit + .long sys_ni_syscall /* was fork */ + .long sys_read + .long sys_write + .long sys_open /* 5 */ + .long sys_close + .long sys_waitpid + .long sys_creat + .long sys_link + .long sys_unlink /* 10 */ + .long sys_execve_wrapper + .long sys_chdir + .long sys_time + .long sys_mknod + .long sys_chmod /* 15 */ + .long sys_lchown16 + .long sys_ni_syscall /* old break syscall holder */ + .long sys_ni_syscall /* stat */ + .long sys_lseek + .long sys_getpid /* 20 */ + .long sys_mount + .long sys_oldumount + .long sys_setuid16 + .long sys_getuid16 + .long sys_stime /* 25 */ + .long sys_ptrace + .long sys_alarm + .long sys_ni_syscall /* fstat */ + .long sys_pause + .long sys_utime /* 30 */ + .long sys_ni_syscall /* old stty syscall holder */ + .long sys_ni_syscall /* old gtty syscall holder */ + .long sys_access + .long sys_nice + .long sys_ni_syscall /* 35 - old ftime syscall holder */ + .long sys_sync + .long sys_kill + .long sys_rename + .long sys_mkdir + .long sys_rmdir /* 40 */ + .long sys_dup + .long sys_pipe + .long sys_times + .long sys_ni_syscall /* old prof syscall holder */ + .long sys_brk /* 45 */ + .long sys_setgid16 + .long sys_getgid16 + .long sys_signal + .long ...
^^^^
You also want to update these, to avoid triggering my attention ;-)
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
Again, please convert the time code to clocksource and use the generic functionality. Thanks, tglx --
I'm not opposed to this as is, but longer term will you be getting the base address out of the device tree instead of from CONFIG_EARLY_PRINTK_UARTLITE_ADDRESS? Cheers, -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. --
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-- && (ioread32(STATUS) & (1<<3)))
;
/* Only attempt the iowrite if we didn't timeout */
if(retries)
iowrite32((c & 0xff), TX_FIFO);
}
Cheers
John
--
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. --
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 --
I think it would be nice if dts files were stored in boot/dts, as on powerpc, which would reduce confusion. --
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 --
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. --
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 --
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 --
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 --
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. --
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. --
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. --
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 <stephen.neuendorffer@xilinx.com>
---
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;
...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 << (irq & 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 < NR_IRQ; ++i) {
if (handle & (0x00000001 << i)) {
set_irq_chip_and_handler(irq, &intc_edge, handle_edge_irq);
irq_desc[i].status &= ~IRQ_LEVEL;
} else {
set_irq_chip_and_handler(irq, &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
--
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 --
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 --
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->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 --
(multiple places) can this code (and flush_cache_sigtramp()) go away? +#if 0 + flush_cache_sigtramp((unsigned long)frame->tramp); +#endif --
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 --
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. --
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 --
You're right. (I think I've been staring at this too much today... :) --
I hope that conclusion is remove #if 0 from signal.c code. --
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. --
Michal, You're missing some of the stuff implemented in powerpc/prom_parse.c, in particular this: --
In prom.h is it. prom_parse.c of_device.c and of_platform.c will be in drivers/of/ --
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. --
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. --
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? --
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. --
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. --
I forget to remove this option. I'll remove consistent.c file where was this Michal --
| Jesse Barnes | Re: [stable] [BUG][PATCH] cpqphp: fix kernel NULL pointer dereference |
| Greg KH | [003/136] p54usb: add Zcomax XG-705A usbid |
| Magnus Damm | [PATCH 03/07] ARM: Use shared GIC entry macros on Realview |
| Oliver Neukum | Re: [Bug #13682] The webcam stopped working when upgrading from 2.6.29 to 2.6.30 |
| Martin Schwidefsky | Re: [PATCH] optimized ktime_get[_ts] for GENERIC_TIME=y |
git: | |
| Junio C Hamano | Re: Som |
