Skip to contentSkip to conversation

Microblaze linux support

PATCH In review [email protected] 14 participants 114 messages Mar 18, 2009 – Mar 26, 2009

Subsystems (9)
lore
Share & tools
lore
author maintainer
#5 lore raw

PATCH 5/57 microblaze_v7: Platorm bus registration

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/platform/platform.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/platform/platform.c
arch/microblaze/platform/platform.c new file +31 -0
new file mode 100644
index 0000000..56e0234
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 Michal Simek <[email protected]>
+ *
+ * based on virtex.c file
+ *
+ * Copyright 2007 Secret Lab Technologies Ltd.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include <linux/init.h>
+#include <linux/of_platform.h>
+#include <asm/prom.h>
+
+static struct of_device_id xilinx_of_bus_ids[] __initdata = {
+	{ .compatible = "simple-bus", },
+	{ .compatible = "xlnx,plb-v46-1.00.a", },
+	{ .compatible = "xlnx,opb-v20-1.10.c", },
+	{ .compatible = "xlnx,opb-v20-1.10.b", },
+	{ .compatible = "xlnx,compound", },
+	{}
+};
+
+static int __init microblaze_device_probe(void)
+{
+	of_platform_bus_probe(NULL, xilinx_of_bus_ids, NULL);
+	return 0;
+}
+device_initcall(microblaze_device_probe);
Signature · 1 line
1.5.5.1

[email protected]

author maintainer
#0 lore raw

Hi all,

I think that is the right time to send you next pack with Microblaze support. It is seventh pack - some previous packs was review by community and I hope there are not any big faults.

We tested this kernel on some boards.
We have GIT server up and gitweb is available at http://developer.petalogix.com/git/gitweb.cgi

All information about git clone you can find on gitweb.
This pack is available in for-linus branch. Information about other branches are on gitweb too.

More information about microblaze fdt kernel you can find at www.monstr.eu/fdt/ If you want to test kernel with microblaze toolchain let me know.

I added only uart16550 and uartlite support - that's enought for first merge.

Thanks for you comments and especially for your ACK, Michal

author maintainer
#2 lore raw

PATCH 2/57 microblaze_v7: Makefiles for Microblaze cpu

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/Makefile                  |   69 +++++++++++++++++++++++++++++
 arch/microblaze/boot/Makefile             |   17 +++++++
 arch/microblaze/kernel/Makefile           |   19 ++++++++
 arch/microblaze/kernel/cpu/Makefile       |    8 +++
 arch/microblaze/lib/Makefile              |   13 +++++
 arch/microblaze/mm/Makefile               |    5 ++
 arch/microblaze/platform/Makefile         |    6 +++
 arch/microblaze/platform/generic/Makefile |    3 +
 8 files changed, 140 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
arch/microblaze/Makefile new file +69 -0
new file mode 100644
index 0000000..0dcbb98
@@ -0,0 +1,69 @@
+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
+  else
+    # USE_HW_MUL can be 0, 1, or 2, defining a heirarchy of HW Mul support.
+    CPUFLAGS-$(subst 1,,$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL)) += -mxl-multiply-high
+    CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL) += -mno-xl-soft-mul
+  endif
+endif
+CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_DIV) += -mno-xl-soft-div
+CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_BARREL) += -mxl-barrel-shift
+CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP) += -mxl-pattern-compare
+
+CPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER))
+
+# The various CONFIG_XILINX cpu features options are integers 0/1/2...
+# rather than bools y/n
+CFLAGS += $(CPUFLAGS-1)
+CFLAGS += $(CPUFLAGS-2)
+
+# r31 holds current when in kernel mode
+CFLAGS += -ffixed-r31
+
+LDFLAGS_BLOB := --format binary --oformat elf32-microblaze
+
+LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
+
+head-y		:= arch/microblaze/kernel/head.o
+libs-y		+= arch/microblaze/lib/ $(LIBGCC)
+core-y		+= arch/microblaze/kernel/ arch/microblaze/mm/ \
+		   arch/microblaze/platform/
+
+boot := arch/$(ARCH)/boot
+
+# defines filename extension depending memory management type
+ifeq ($(CONFIG_MMU),)
+MMUEXT		:= -nommu
+endif
+export	MMUEXT
+
+all: linux.bin
+
+archclean:
+	$(Q)$(MAKE) $(clean)=$(boot)
+
+linux.bin linux.bin.gz: vmlinux
+	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
+
+define archhelp
+  echo  '* linux.bin    - Create raw binary'
+  echo  '  linux.bin.gz - Create compressed raw binary'
+endef
arch/microblaze/boot/Makefile new file +17 -0
new file mode 100644
index 0000000..844edf4
@@ -0,0 +1,17 @@
+#
+# arch/microblaze/boot/Makefile
+#
+
+targets := linux.bin linux.bin.gz
+
+OBJCOPYFLAGS_linux.bin  := -O binary
+
+$(obj)/linux.bin: vmlinux FORCE
+	$(call if_changed,objcopy)
+	@echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
+
+$(obj)/linux.bin.gz: $(obj)/linux.bin FORCE
+	$(call if_changed,gzip)
+	@echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
+
+clean-kernel += linux.bin linux.bin.gz
arch/microblaze/kernel/Makefile new file +19 -0
new file mode 100644
index 0000000..da94bec
@@ -0,0 +1,19 @@
+#
+# Makefile
+#
+
+extra-y := head.o vmlinux.lds
+
+obj-y += exceptions.o \
+	hw_exception_handler.o init_task.o intc.o irq.o of_device.o \
+	of_platform.o process.o prom.o prom_parse.o ptrace.o \
+	setup.o signal.o sys_microblaze.o timer.o traps.o
+
+obj-y += cpu/
+
+obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
+obj-$(CONFIG_SELFMOD)		+= selfmod.o
+obj-$(CONFIG_HEART_BEAT)	+= heartbeat.o
+obj-$(CONFIG_MODULES)		+= microblaze_ksyms.o module.o
+
+obj-y	+= entry$(MMUEXT).o
arch/microblaze/kernel/cpu/Makefile new file +8 -0
new file mode 100644
index 0000000..20646e5
@@ -0,0 +1,8 @@
+#
+# Build the appropriate CPU version support
+#
+
+EXTRA_CFLAGS += -DCPU_MAJOR=$(CPU_MAJOR) -DCPU_MINOR=$(CPU_MINOR) \
+		-DCPU_REV=$(CPU_REV)
+
+obj-y += cache.o cpuinfo.o cpuinfo-pvr-full.o cpuinfo-static.o mb.o pvr.o
arch/microblaze/lib/Makefile new file +13 -0
new file mode 100644
index 0000000..86d63fd
@@ -0,0 +1,13 @@
+#
+# Makefile
+#
+
+lib-y :=  memset.o checksum.o
+
+ifeq ($(CONFIG_OPT_LIB_ASM),y)
+lib-y += fastcopy.o
+else
+lib-y += memcpy.o memmove.o
+endif
+
+lib-y +=  uaccess.o 
arch/microblaze/mm/Makefile new file +5 -0
new file mode 100644
index 0000000..bf9e447
@@ -0,0 +1,5 @@
+#
+# Makefile
+#
+
+obj-y := init.o
arch/microblaze/platform/Makefile new file +6 -0
new file mode 100644
index 0000000..ea1b75c
@@ -0,0 +1,6 @@
+#
+# Makefile for arch/microblaze/platform directory
+#
+#obj-$(CONFIG_PLATFORM_GENERIC) += generic/
+
+obj-y	+= platform.o
arch/microblaze/platform/generic/Makefile new file +3 -0
new file mode 100644
index 0000000..9a8b1bd
@@ -0,0 +1,3 @@
+#
+# Empty Makefile to keep make clean happy
+#
Signature · 1 line
1.5.5.1
author maintainer
#1 lore raw

PATCH 1/57 microblaze_v7: Kconfig patches

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/Kconfig                       |  136 +++++++++++++++++++++++++
 arch/microblaze/Kconfig.debug                 |   26 +++++
 arch/microblaze/platform/Kconfig.platform     |   85 +++++++++++++++
 arch/microblaze/platform/generic/Kconfig.auto |   62 +++++++++++
 4 files changed, 309 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
arch/microblaze/Kconfig new file +136 -0
new file mode 100644
index 0000000..a2df3f8
@@ -0,0 +1,136 @@
+# 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 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 GENERIC_TIME
+	def_bool y
+
+config GENERIC_TIME_VSYSCALL
+	def_bool n
+
+config GENERIC_CLOCKEVENTS
+	def_bool y
+
+config PCI
+	depends on !MMU
+	def_bool n
+
+config NO_DMA
+	depends on !MMU
+	def_bool n
+
+source "init/Kconfig"
+
+source "arch/microblaze/platform/Kconfig.platform"
+
+menu "Processor type and features"
+
+source kernel/time/Kconfig
+
+source "kernel/Kconfig.preempt"
+
+source "kernel/Kconfig.hz"
+
+config MMU
+	def_bool n
+
+config NO_MMU
+	bool
+	depends on !MMU
+	default y
+
+comment "Boot options"
+
+config CMDLINE_BOOL
+	bool "Default bootloader kernel arguments"
+
+config CMDLINE
+	string "Default kernel command string"
+	depends on CMDLINE_BOOL
+	default "console=ttyUL0,115200"
+	help
+	  On some architectures there is currently no way for the boot loader
+	  to pass arguments to the kernel. For these architectures, you should
+	  supply some command-line options at build time by entering them
+	  here.
+
+config CMDLINE_FORCE
+	bool "Force default kernel command string"
+	depends on CMDLINE_BOOL
+	default n
+	help
+	  Set this to have arguments from the default kernel command string
+	  override those passed by the boot loader.
+
+config OF
+	def_bool y
+
+config OF_DEVICE
+	def_bool y
+
+config PROC_DEVICETREE
+	bool "Support for device tree in /proc"
+	depends on PROC_FS
+	help
+	  This option adds a device-tree directory under /proc which contains
+	  an image of the device tree that the kernel copies from Open
+	  Firmware or other boot firmware. If unsure, say Y here.
+
+endmenu
+
+source "mm/Kconfig"
+
+menu "Exectuable file formats"
+
+source "fs/Kconfig.binfmt"
+
+endmenu
+
+source "net/Kconfig"
+
+source "drivers/Kconfig"
+
+source "fs/Kconfig"
+
+source "arch/microblaze/Kconfig.debug"
+
+source "security/Kconfig"
+
+source "crypto/Kconfig"
+
+source "lib/Kconfig"
arch/microblaze/Kconfig.debug new file +26 -0
new file mode 100644
index 0000000..242cd35
@@ -0,0 +1,26 @@
+# For a description of the syntax of this configuration file,
+# see Documentation/kbuild/kconfig-language.txt.
+
+menu "Kernel hacking"
+
+source "lib/Kconfig.debug"
+
+config EARLY_PRINTK
+	bool "Early printk function for kernel"
+	default n
+	help
+	  This option turns on/off early printk messages to console.
+	  First Uartlite node is taken.
+
+config HEART_BEAT
+	bool "Heart beat function for kernel"
+	default n
+	help
+	  This option turns on/off heart beat kernel functionality.
+	  First GPIO node is taken.
+
+config DEBUG_BOOTMEM
+	depends on DEBUG_KERNEL
+	bool "Debug BOOTMEM initialization"
+
+endmenu
arch/microblaze/platform/Kconfig.platform new file +85 -0

85 lines not on this page · raw message

arch/microblaze/platform/generic/Kconfig.auto new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#3 lore raw

PATCH 3/57 microblaze_v7: Cpuinfo handling

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/cpuinfo.h         |  102 +++++++++++++++++
 arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c |  101 +++++++++++++++++
 arch/microblaze/kernel/cpu/cpuinfo-static.c   |  145 +++++++++++++++++++++++++
 arch/microblaze/kernel/cpu/cpuinfo.c          |   87 +++++++++++++++
 4 files changed, 435 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/cpuinfo.h
 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
arch/microblaze/include/asm/cpuinfo.h new file +102 -0
new file mode 100644
index 0000000..0f40f7a
@@ -0,0 +1,102 @@
+/*
+ * Generic support for queying CPU info
+ *
+ * Copyright (C) 2007-2008 Michal Simek <[email protected]>
+ * Copyright (C) 2007 John Williams <[email protected]>
+ * 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_CPUINFO_H
+#define _ASM_MICROBLAZE_CPUINFO_H
+
+#include <asm/prom.h>
+
+/* CPU Version and FPGA Family code conversion table type */
+struct cpu_ver_key {
+	const char *s;
+	const unsigned k;
+};
+
+extern const struct cpu_ver_key cpu_ver_lookup[];
+
+struct family_string_key {
+	const char *s;
+	const unsigned k;
+};
+
+extern const struct family_string_key family_string_lookup[];
+
+struct cpuinfo {
+	/* Core CPU configuration */
+	int use_instr;
+	int use_mult;
+	int use_fpu;
+	int use_exc;
+	int ver_code;
+	int mmu;
+
+	/* CPU caches */
+	int use_icache;
+	int icache_tagbits;
+	int icache_write;
+	int icache_line;
+	int icache_size;
+	unsigned long icache_base;
+	unsigned long icache_high;
+
+	int use_dcache;
+	int dcache_tagbits;
+	int dcache_write;
+	int dcache_line;
+	int dcache_size;
+	unsigned long dcache_base;
+	unsigned long dcache_high;
+
+	/* Bus connections */
+	int use_dopb;
+	int use_iopb;
+	int use_dlmb;
+	int use_ilmb;
+	int num_fsl;
+
+	/* CPU interrupt line info */
+	int irq_edge;
+	int irq_positive;
+
+	int area_optimised;
+
+	/* HW debug support */
+	int hw_debug;
+	int num_pc_brk;
+	int num_rd_brk;
+	int num_wr_brk;
+	int cpu_clock_freq; /* store real freq of cpu */
+	int freq_div_hz; /* store freq/HZ */
+
+	/* FPGA family */
+	int fpga_family_code;
+
+	/* User define */
+	int pvr_user1;
+	int pvr_user2;
+};
+
+extern struct cpuinfo cpuinfo;
+
+/* fwd declarations of the various CPUinfo populators */
+void setup_cpuinfo(void);
+
+void set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu);
+void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu);
+
+static inline unsigned int fcpu(struct device_node *cpu, char *n)
+{
+	int *val;
+	return (val = (int *) of_get_property(cpu, n, NULL)) ? *val : 0;
+}
+
+#endif /* _ASM_MICROBLAZE_CPUINFO_H */
arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c new file +101 -0

101 lines not on this page · raw message

arch/microblaze/kernel/cpu/cpuinfo-static.c new file +145 -0

145 lines not on this page · raw message

arch/microblaze/kernel/cpu/cpuinfo.c new file +87 -0

87 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#6 lore raw

PATCH 6/57 microblaze_v7: exception handling

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/exceptions.h      |   65 ++++
 arch/microblaze/kernel/exceptions.c           |  157 ++++++++
 arch/microblaze/kernel/hw_exception_handler.S |  470 +++++++++++++++++++++++++
 3 files changed, 692 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/exceptions.h
 create mode 100644 arch/microblaze/kernel/exceptions.c
 create mode 100644 arch/microblaze/kernel/hw_exception_handler.S
arch/microblaze/include/asm/exceptions.h new file +65 -0
new file mode 100644
index 0000000..cd41f6c
@@ -0,0 +1,65 @@
+/*
+ * Preliminary support for HW exception handing for Microblaze
+ *
+ * Copyright (C) 2008 Michal Simek
+ * Copyright (C) 2008 PetaLogix
+ * Copyright (C) 2005 John Williams <[email protected]>
+ *
+ * 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_EXCEPTIONS_H
+#define _ASM_MICROBLAZE_EXCEPTIONS_H
+
+#ifdef __KERNEL__
+#ifndef __ASSEMBLY__
+
+/* Macros to enable and disable HW exceptions in the MSR */
+/* Define MSR enable bit for HW exceptions */
+#define HWEX_MSR_BIT (1 << 8)
+
+#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
+#define __enable_hw_exceptions()					\
+	__asm__ __volatile__ ("	msrset	r0, %0;				\
+				nop;"					\
+				:					\
+				: "i" (HWEX_MSR_BIT)			\
+				: "memory")
+
+#define __disable_hw_exceptions()					\
+	__asm__ __volatile__ ("	msrclr r0, %0;				\
+				nop;"					\
+				:					\
+				: "i" (HWEX_MSR_BIT)			\
+				: "memory")
+#else /* !CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */
+#define __enable_hw_exceptions()					\
+	__asm__ __volatile__ ("						\
+				mfs	r12, rmsr;			\
+				nop;					\
+				ori	r12, r12, %0;			\
+				mts	rmsr, r12;			\
+				nop;"					\
+				:					\
+				: "i" (HWEX_MSR_BIT)			\
+				: "memory", "r12")
+
+#define __disable_hw_exceptions()					\
+	__asm__ __volatile__ ("						\
+				mfs	r12, rmsr;			\
+				nop;					\
+				andi	r12, r12, ~%0;			\
+				mts	rmsr, r12;			\
+				nop;"					\
+				:					\
+				: "i" (HWEX_MSR_BIT)			\
+				: "memory", "r12")
+#endif /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */
+
+asmlinkage void full_exception(struct pt_regs *regs, unsigned int type, int fsr, int addr);
+
+#endif /*__ASSEMBLY__ */
+#endif /* __KERNEL__ */
+#endif /* _ASM_MICROBLAZE_EXCEPTIONS_H */
arch/microblaze/kernel/exceptions.c new file +157 -0

157 lines not on this page · raw message

arch/microblaze/kernel/hw_exception_handler.S new file +470 -0

470 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#4 lore raw

PATCH 4/57 microblaze_v7: Open firmware files

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/of_device.h   |   45 ++
 arch/microblaze/include/asm/of_platform.h |   64 ++
 arch/microblaze/include/asm/prom.h        |  313 ++++++++
 arch/microblaze/kernel/of_device.c        |  115 +++
 arch/microblaze/kernel/of_platform.c      |  201 +++++
 arch/microblaze/kernel/prom.c             | 1147 +++++++++++++++++++++++++++++
 arch/microblaze/kernel/prom_parse.c       | 1025 ++++++++++++++++++++++++++
 7 files changed, 2910 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/of_device.h
 create mode 100644 arch/microblaze/include/asm/of_platform.h
 create mode 100644 arch/microblaze/include/asm/prom.h
 create mode 100644 arch/microblaze/kernel/of_device.c
 create mode 100644 arch/microblaze/kernel/of_platform.c
 create mode 100644 arch/microblaze/kernel/prom.c
 create mode 100644 arch/microblaze/kernel/prom_parse.c
arch/microblaze/include/asm/of_device.h new file +45 -0
new file mode 100644
index 0000000..ba917cf
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2007-2008 Michal Simek <[email protected]>
+ *
+ * based on PowerPC of_device.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.
+ */
+
+#ifndef _ASM_MICROBLAZE_OF_DEVICE_H
+#define _ASM_MICROBLAZE_OF_DEVICE_H
+#ifdef __KERNEL__
+
+#include <linux/device.h>
+#include <linux/of.h>
+
+/*
+ * The of_device is a kind of "base class" that is a superset of
+ * struct device for use by devices attached to an OF node and
+ * probed using OF properties.
+ */
+struct of_device {
+	struct device_node	*node; /* to be obsoleted */
+	u64			dma_mask; /* DMA mask */
+	struct device		dev; /* Generic device interface */
+};
+
+extern ssize_t of_device_get_modalias(struct of_device *ofdev,
+					char *str, ssize_t len);
+
+extern struct of_device *of_device_alloc(struct device_node *np,
+					 const char *bus_id,
+					 struct device *parent);
+
+extern int of_device_uevent(struct device *dev,
+			    struct kobj_uevent_env *env);
+
+extern void of_device_make_bus_id(struct of_device *dev);
+
+/* This is just here during the transition */
+#include <linux/of_device.h>
+
+#endif /* __KERNEL__ */
+#endif /* _ASM_MICROBLAZE_OF_DEVICE_H */
arch/microblaze/include/asm/of_platform.h new file +64 -0

64 lines not on this page · raw message

arch/microblaze/include/asm/prom.h new file +313 -0

313 lines not on this page · raw message

arch/microblaze/kernel/of_device.c new file +115 -0

115 lines not on this page · raw message

arch/microblaze/kernel/of_platform.c new file +201 -0

201 lines not on this page · raw message

arch/microblaze/kernel/prom.c new file +1147 -0

1,147 lines not on this page · raw message

arch/microblaze/kernel/prom_parse.c new file +1025 -0

1,025 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#8 lore raw

PATCH 8/57 microblaze_v7: Interrupt handling, timer support, selfmod code

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/irq.h     |   46 ++++++
 arch/microblaze/include/asm/selfmod.h |   24 ++++
 arch/microblaze/kernel/intc.c         |  167 ++++++++++++++++++++++
 arch/microblaze/kernel/irq.c          |  102 ++++++++++++++
 arch/microblaze/kernel/selfmod.c      |   80 +++++++++++
 arch/microblaze/kernel/timer.c        |  246 +++++++++++++++++++++++++++++++++
 6 files changed, 665 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/irq.h
 create mode 100644 arch/microblaze/include/asm/selfmod.h
 create mode 100644 arch/microblaze/kernel/intc.c
 create mode 100644 arch/microblaze/kernel/irq.c
 create mode 100644 arch/microblaze/kernel/selfmod.c
 create mode 100644 arch/microblaze/kernel/timer.c
arch/microblaze/include/asm/irq.h new file +46 -0
new file mode 100644
index 0000000..c0b773f
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_IRQ_H
+#define _ASM_MICROBLAZE_IRQ_H
+
+#define NR_IRQS 32
+
+#include <linux/interrupt.h>
+
+extern unsigned int nr_irq;
+
+#define NO_IRQ (-1)
+
+static inline int irq_canonicalize(int irq)
+{
+	return irq;
+}
+
+struct pt_regs;
+extern void do_IRQ(struct pt_regs *regs);
+
+/* irq_of_parse_and_map - Parse and Map an interrupt into linux virq space
+ * @device: Device node of the device whose interrupt is to be mapped
+ * @index: Index of the interrupt to map
+ *
+ * This function is a wrapper that chains of_irq_map_one() and
+ * irq_create_of_mapping() to make things easier to callers
+ */
+struct device_node;
+extern unsigned int irq_of_parse_and_map(struct device_node *dev, int index);
+
+/** FIXME - not implement
+ * irq_dispose_mapping - Unmap an interrupt
+ * @virq: linux virq number of the interrupt to unmap
+ */
+static inline void irq_dispose_mapping(unsigned int virq) {
+	return;
+}
+
+#endif /* _ASM_MICROBLAZE_IRQ_H */
arch/microblaze/include/asm/selfmod.h new file +24 -0
new file mode 100644
index 0000000..c42aff2
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2007-2008 Michal Simek <[email protected]>
+ *
+ * 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_SELFMOD_H
+#define _ASM_MICROBLAZE_SELFMOD_H
+
+/*
+ * BARRIER_BASE_ADDR is constant address for selfmod function.
+ * do not change this value - selfmod function is in
+ * arch/microblaze/kernel/selfmod.c: selfmod_function()
+ *
+ * last 16 bits is used for storing register offset
+ */
+
+#define BARRIER_BASE_ADDR	0x1234ff00
+
+void selfmod_function(const int *arr_fce, const unsigned int base);
+
+#endif /* _ASM_MICROBLAZE_SELFMOD_H */
arch/microblaze/kernel/intc.c new file +167 -0

167 lines not on this page · raw message

arch/microblaze/kernel/irq.c new file +102 -0

102 lines not on this page · raw message

arch/microblaze/kernel/selfmod.c new file +80 -0

80 lines not on this page · raw message

arch/microblaze/kernel/timer.c new file +246 -0

246 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#9 lore raw

PATCH 9/57 microblaze_v7: cache support

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/cache.h      |   43 +++++
 arch/microblaze/include/asm/cacheflush.h |   85 ++++++++++
 arch/microblaze/kernel/cpu/cache.c       |  258 ++++++++++++++++++++++++++++++
 3 files changed, 386 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/cache.h
 create mode 100644 arch/microblaze/include/asm/cacheflush.h
 create mode 100644 arch/microblaze/kernel/cpu/cache.c
arch/microblaze/include/asm/cache.h new file +43 -0
new file mode 100644
index 0000000..16a647d
@@ -0,0 +1,43 @@
+/*
+ * Cache operations
+ *
+ * Copyright (C) 2007 Michal Simek <[email protected]>
+ * Copyright (C) 2003 John Williams <[email protected]>
+ *
+ * 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_CACHE_H
+#define _ASM_MICROBLAZE_CACHE_H
+
+#include <asm/registers.h>
+
+#ifndef L1_CACHE_BYTES
+/* word-granular cache in microblaze */
+#define L1_CACHE_BYTES		4
+#endif
+
+void _enable_icache(void);
+void _disable_icache(void);
+void _invalidate_icache(unsigned int addr);
+
+#define __enable_icache()		_enable_icache()
+#define __disable_icache()		_disable_icache()
+#define __invalidate_icache(addr)	_invalidate_icache(addr)
+
+void _enable_dcache(void);
+void _disable_dcache(void);
+void _invalidate_dcache(unsigned int addr);
+
+#define __enable_dcache()		_enable_dcache()
+#define __disable_dcache()		_disable_dcache()
+#define __invalidate_dcache(addr)	_invalidate_dcache(addr)
+
+/* FIXME - I don't think this is right */
+#ifdef CONFIG_XILINX_UNCACHED_SHADOW
+#define UNCACHED_SHADOW_MASK (CONFIG_XILINX_ERAM_SIZE)
+#endif
+
+#endif /* _ASM_MICROBLAZE_CACHE_H */
arch/microblaze/include/asm/cacheflush.h new file +85 -0

85 lines not on this page · raw message

arch/microblaze/kernel/cpu/cache.c new file +258 -0

258 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#11 lore raw

PATCH 11/57 microblaze_v7: kernel modules support

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/module.h      |   37 +++++++
 arch/microblaze/kernel/microblaze_ksyms.c |   46 +++++++++
 arch/microblaze/kernel/module.c           |  148 +++++++++++++++++++++++++++++
 3 files changed, 231 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/module.h
 create mode 100644 arch/microblaze/kernel/microblaze_ksyms.c
 create mode 100644 arch/microblaze/kernel/module.c
arch/microblaze/include/asm/module.h new file +37 -0
new file mode 100644
index 0000000..914565a
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_MODULE_H
+#define _ASM_MICROBLAZE_MODULE_H
+
+/* Microblaze Relocations */
+#define R_MICROBLAZE_NONE 0
+#define R_MICROBLAZE_32 1
+#define R_MICROBLAZE_32_PCREL 2
+#define R_MICROBLAZE_64_PCREL 3
+#define R_MICROBLAZE_32_PCREL_LO 4
+#define R_MICROBLAZE_64 5
+#define R_MICROBLAZE_32_LO 6
+#define R_MICROBLAZE_SRO32 7
+#define R_MICROBLAZE_SRW32 8
+#define R_MICROBLAZE_64_NONE 9
+#define R_MICROBLAZE_32_SYM_OP_SYM 10
+/* Keep this the last entry. */
+#define R_MICROBLAZE_NUM 11
+
+struct mod_arch_specific {
+	int foo;
+};
+
+#define Elf_Shdr	Elf32_Shdr
+#define Elf_Sym		Elf32_Sym
+#define Elf_Ehdr	Elf32_Ehdr
+
+typedef struct { volatile int counter; } module_t;
+
+#endif /* _ASM_MICROBLAZE_MODULE_H */
arch/microblaze/kernel/microblaze_ksyms.c new file +46 -0

46 lines not on this page · raw message

arch/microblaze/kernel/module.c new file +148 -0

148 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#12 lore raw

PATCH 12/57 microblaze_v7: lmb include file

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/lmb.h |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/lmb.h
arch/microblaze/include/asm/lmb.h new file +17 -0
new file mode 100644
index 0000000..a0a0a92
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2008 Michal Simek <[email protected]>
+ *
+ * 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_LMB_H
+#define _ASM_MICROBLAZE_LMB_H
+
+/* LMB limit is OFF */
+#define LMB_REAL_LIMIT	0xFFFFFFFF
+
+#endif /* _ASM_MICROBLAZE_LMB_H */
+
+
Signature · 1 line
1.5.5.1
author maintainer
#10 lore raw

PATCH 10/57 microblaze_v7: Generic dts file for platforms

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/platform/generic/system.dts |  332 +++++++++++++++++++++++++++
 1 files changed, 332 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/platform/generic/system.dts
arch/microblaze/platform/generic/system.dts new file +332 -0
new file mode 100644
index 0000000..29993f6
@@ -0,0 +1,332 @@
+/*
+ * Device Tree Generator version: 1.1
+ *
+ * (C) Copyright 2007-2008 Xilinx, Inc.
+ * (C) Copyright 2007-2009 Michal Simek
+ *
+ * Michal SIMEK <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * 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 10.1.03 EDK_K_SP3.6
+ *
+ * XPS project directory: Xilinx-ML505-ll_temac-sgdma-MMU-FDT-edk101
+ */
+
+/dts-v1/;
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+	compatible = "xlnx,microblaze";
+	model = "testing";
+	DDR2_SDRAM: memory@90000000 {
+		device_type = "memory";
+		reg = < 0x90000000 0x10000000 >;
+	} ;
+	chosen {
+		bootargs = "console=ttyUL0,115200 highres=on";
+		linux,stdout-path = "/plb@0/serial@84000000";
+	} ;
+	cpus {
+		#address-cells = <1>;
+		#cpus = <0x1>;
+		#size-cells = <0>;
+		microblaze_0: cpu@0 {
+			clock-frequency = <125000000>;
+			compatible = "xlnx,microblaze-7.10.d";
+			d-cache-baseaddr = <0x90000000>;
+			d-cache-highaddr = <0x9fffffff>;
+			d-cache-line-size = <0x10>;
+			d-cache-size = <0x2000>;
+			device_type = "cpu";
+			i-cache-baseaddr = <0x90000000>;
+			i-cache-highaddr = <0x9fffffff>;
+			i-cache-line-size = <0x10>;
+			i-cache-size = <0x2000>;
+			model = "microblaze,7.10.d";
+			reg = <0>;
+			timebase-frequency = <125000000>;
+			xlnx,addr-tag-bits = <0xf>;
+			xlnx,allow-dcache-wr = <0x1>;
+			xlnx,allow-icache-wr = <0x1>;
+			xlnx,area-optimized = <0x0>;
+			xlnx,cache-byte-size = <0x2000>;
+			xlnx,d-lmb = <0x1>;
+			xlnx,d-opb = <0x0>;
+			xlnx,d-plb = <0x1>;
+			xlnx,data-size = <0x20>;
+			xlnx,dcache-addr-tag = <0xf>;
+			xlnx,dcache-always-used = <0x1>;
+			xlnx,dcache-byte-size = <0x2000>;
+			xlnx,dcache-line-len = <0x4>;
+			xlnx,dcache-use-fsl = <0x1>;
+			xlnx,debug-enabled = <0x1>;
+			xlnx,div-zero-exception = <0x1>;
+			xlnx,dopb-bus-exception = <0x0>;
+			xlnx,dynamic-bus-sizing = <0x1>;
+			xlnx,edge-is-positive = <0x1>;
+			xlnx,family = "virtex5";
+			xlnx,fpu-exception = <0x1>;
+			xlnx,fsl-data-size = <0x20>;
+			xlnx,fsl-exception = <0x0>;
+			xlnx,fsl-links = <0x0>;
+			xlnx,i-lmb = <0x1>;
+			xlnx,i-opb = <0x0>;
+			xlnx,i-plb = <0x1>;
+			xlnx,icache-always-used = <0x1>;
+			xlnx,icache-line-len = <0x4>;
+			xlnx,icache-use-fsl = <0x1>;
+			xlnx,ill-opcode-exception = <0x1>;
+			xlnx,instance = "microblaze_0";
+			xlnx,interconnect = <0x1>;
+			xlnx,interrupt-is-edge = <0x0>;
+			xlnx,iopb-bus-exception = <0x0>;
+			xlnx,mmu-dtlb-size = <0x4>;
+			xlnx,mmu-itlb-size = <0x2>;
+			xlnx,mmu-tlb-access = <0x3>;
+			xlnx,mmu-zones = <0x10>;
+			xlnx,number-of-pc-brk = <0x1>;
+			xlnx,number-of-rd-addr-brk = <0x0>;
+			xlnx,number-of-wr-addr-brk = <0x0>;
+			xlnx,opcode-0x0-illegal = <0x1>;
+			xlnx,pvr = <0x2>;
+			xlnx,pvr-user1 = <0x0>;
+			xlnx,pvr-user2 = <0x0>;
+			xlnx,reset-msr = <0x0>;
+			xlnx,sco = <0x0>;
+			xlnx,unaligned-exceptions = <0x1>;
+			xlnx,use-barrel = <0x1>;
+			xlnx,use-dcache = <0x1>;
+			xlnx,use-div = <0x1>;
+			xlnx,use-ext-brk = <0x1>;
+			xlnx,use-ext-nm-brk = <0x1>;
+			xlnx,use-extended-fsl-instr = <0x0>;
+			xlnx,use-fpu = <0x2>;
+			xlnx,use-hw-mul = <0x2>;
+			xlnx,use-icache = <0x1>;
+			xlnx,use-interrupt = <0x1>;
+			xlnx,use-mmu = <0x3>;
+			xlnx,use-msr-instr = <0x1>;
+			xlnx,use-pcmp-instr = <0x1>;
+		} ;
+	} ;
+	mb_plb: plb@0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "xlnx,plb-v46-1.03.a", "simple-bus";
+		ranges ;
+		FLASH: flash@a0000000 {
+			bank-width = <2>;
+			compatible = "xlnx,xps-mch-emc-2.00.a", "cfi-flash";
+			reg = < 0xa0000000 0x2000000 >;
+			xlnx,family = "virtex5";
+			xlnx,include-datawidth-matching-0 = <0x1>;
+			xlnx,include-datawidth-matching-1 = <0x0>;
+			xlnx,include-datawidth-matching-2 = <0x0>;
+			xlnx,include-datawidth-matching-3 = <0x0>;
+			xlnx,include-negedge-ioregs = <0x0>;
+			xlnx,include-plb-ipif = <0x1>;
+			xlnx,include-wrbuf = <0x1>;
+			xlnx,max-mem-width = <0x10>;
+			xlnx,mch-native-dwidth = <0x20>;
+			xlnx,mch-plb-clk-period-ps = <0x1f40>;
+			xlnx,mch-splb-awidth = <0x20>;
+			xlnx,mch0-accessbuf-depth = <0x10>;
+			xlnx,mch0-protocol = <0x0>;
+			xlnx,mch0-rddatabuf-depth = <0x10>;
+			xlnx,mch1-accessbuf-depth = <0x10>;
+			xlnx,mch1-protocol = <0x0>;
+			xlnx,mch1-rddatabuf-depth = <0x10>;
+			xlnx,mch2-accessbuf-depth = <0x10>;
+			xlnx,mch2-protocol = <0x0>;
+			xlnx,mch2-rddatabuf-depth = <0x10>;
+			xlnx,mch3-accessbuf-depth = <0x10>;
+			xlnx,mch3-protocol = <0x0>;
+			xlnx,mch3-rddatabuf-depth = <0x10>;
+			xlnx,mem0-width = <0x10>;
+			xlnx,mem1-width = <0x20>;
+			xlnx,mem2-width = <0x20>;
+			xlnx,mem3-width = <0x20>;
+			xlnx,num-banks-mem = <0x1>;
+			xlnx,num-channels = <0x0>;
+			xlnx,priority-mode = <0x0>;
+			xlnx,synch-mem-0 = <0x0>;
+			xlnx,synch-mem-1 = <0x0>;
+			xlnx,synch-mem-2 = <0x0>;
+			xlnx,synch-mem-3 = <0x0>;
+			xlnx,synch-pipedelay-0 = <0x2>;
+			xlnx,synch-pipedelay-1 = <0x2>;
+			xlnx,synch-pipedelay-2 = <0x2>;
+			xlnx,synch-pipedelay-3 = <0x2>;
+			xlnx,tavdv-ps-mem-0 = <0x1adb0>;
+			xlnx,tavdv-ps-mem-1 = <0x3a98>;
+			xlnx,tavdv-ps-mem-2 = <0x3a98>;
+			xlnx,tavdv-ps-mem-3 = <0x3a98>;
+			xlnx,tcedv-ps-mem-0 = <0x1adb0>;
+			xlnx,tcedv-ps-mem-1 = <0x3a98>;
+			xlnx,tcedv-ps-mem-2 = <0x3a98>;
+			xlnx,tcedv-ps-mem-3 = <0x3a98>;
+			xlnx,thzce-ps-mem-0 = <0x88b8>;
+			xlnx,thzce-ps-mem-1 = <0x1b58>;
+			xlnx,thzce-ps-mem-2 = <0x1b58>;
+			xlnx,thzce-ps-mem-3 = <0x1b58>;
+			xlnx,thzoe-ps-mem-0 = <0x1b58>;
+			xlnx,thzoe-ps-mem-1 = <0x1b58>;
+			xlnx,thzoe-ps-mem-2 = <0x1b58>;
+			xlnx,thzoe-ps-mem-3 = <0x1b58>;
+			xlnx,tlzwe-ps-mem-0 = <0x88b8>;
+			xlnx,tlzwe-ps-mem-1 = <0x0>;
+			xlnx,tlzwe-ps-mem-2 = <0x0>;
+			xlnx,tlzwe-ps-mem-3 = <0x0>;
+			xlnx,twc-ps-mem-0 = <0x2af8>;
+			xlnx,twc-ps-mem-1 = <0x3a98>;
+			xlnx,twc-ps-mem-2 = <0x3a98>;
+			xlnx,twc-ps-mem-3 = <0x3a98>;
+			xlnx,twp-ps-mem-0 = <0x11170>;
+			xlnx,twp-ps-mem-1 = <0x2ee0>;
+			xlnx,twp-ps-mem-2 = <0x2ee0>;
+			xlnx,twp-ps-mem-3 = <0x2ee0>;
+			xlnx,xcl0-linesize = <0x4>;
+			xlnx,xcl0-writexfer = <0x1>;
+			xlnx,xcl1-linesize = <0x4>;
+			xlnx,xcl1-writexfer = <0x1>;
+			xlnx,xcl2-linesize = <0x4>;
+			xlnx,xcl2-writexfer = <0x1>;
+			xlnx,xcl3-linesize = <0x4>;
+			xlnx,xcl3-writexfer = <0x1>;
+		} ;
+		Hard_Ethernet_MAC: xps-ll-temac@81c00000 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			compatible = "xlnx,compound";
+			ethernet@81c00000 {
+				compatible = "xlnx,xps-ll-temac-1.01.b";
+				device_type = "network";
+				interrupt-parent = <&xps_intc_0>;
+				interrupts = < 5 2 >;
+				llink-connected = <&PIM3>;
+				local-mac-address = [ 02 00 00 00 00 00 ];
+				reg = < 0x81c00000 0x40 >;
+				xlnx,bus2core-clk-ratio = <0x1>;
+				xlnx,phy-type = <0x1>;
+				xlnx,phyaddr = <0x1>;
+				xlnx,rxcsum = <0x0>;
+				xlnx,rxfifo = <0x1000>;
+				xlnx,temac-type = <0x0>;
+				xlnx,txcsum = <0x0>;
+				xlnx,txfifo = <0x1000>;
+			} ;
+		} ;
+		IIC_EEPROM: i2c@81600000 {
+			compatible = "xlnx,xps-iic-2.00.a";
+			interrupt-parent = <&xps_intc_0>;
+			interrupts = < 6 2 >;
+			reg = < 0x81600000 0x10000 >;
+			xlnx,clk-freq = <0x7735940>;
+			xlnx,family = "virtex5";
+			xlnx,gpo-width = <0x1>;
+			xlnx,iic-freq = <0x186a0>;
+			xlnx,scl-inertial-delay = <0x0>;
+			xlnx,sda-inertial-delay = <0x0>;
+			xlnx,ten-bit-adr = <0x0>;
+		} ;
+		LEDs_8Bit: gpio@81400000 {
+			compatible = "xlnx,xps-gpio-1.00.a";
+			interrupt-parent = <&xps_intc_0>;
+			interrupts = < 7 2 >;
+			reg = < 0x81400000 0x10000 >;
+			xlnx,all-inputs = <0x0>;
+			xlnx,all-inputs-2 = <0x0>;
+			xlnx,dout-default = <0x0>;
+			xlnx,dout-default-2 = <0x0>;
+			xlnx,family = "virtex5";
+			xlnx,gpio-width = <0x8>;
+			xlnx,interrupt-present = <0x1>;
+			xlnx,is-bidir = <0x1>;
+			xlnx,is-bidir-2 = <0x1>;
+			xlnx,is-dual = <0x0>;
+			xlnx,tri-default = <0xffffffff>;
+			xlnx,tri-default-2 = <0xffffffff>;
+		} ;
+		RS232_Uart_1: serial@84000000 {
+			clock-frequency = <125000000>;
+			compatible = "xlnx,xps-uartlite-1.00.a";
+			current-speed = <115200>;
+			device_type = "serial";
+			interrupt-parent = <&xps_intc_0>;
+			interrupts = < 8 0 >;
+			port-number = <0>;
+			reg = < 0x84000000 0x10000 >;
+			xlnx,baudrate = <0x1c200>;
+			xlnx,data-bits = <0x8>;
+			xlnx,family = "virtex5";
+			xlnx,odd-parity = <0x0>;
+			xlnx,use-parity = <0x0>;
+		} ;
+		SysACE_CompactFlash: sysace@83600000 {
+			compatible = "xlnx,xps-sysace-1.00.a";
+			interrupt-parent = <&xps_intc_0>;
+			interrupts = < 4 2 >;
+			reg = < 0x83600000 0x10000 >;
+			xlnx,family = "virtex5";
+			xlnx,mem-width = <0x10>;
+		} ;
+		debug_module: debug@84400000 {
+			compatible = "xlnx,mdm-1.00.d";
+			reg = < 0x84400000 0x10000 >;
+			xlnx,family = "virtex5";
+			xlnx,interconnect = <0x1>;
+			xlnx,jtag-chain = <0x2>;
+			xlnx,mb-dbg-ports = <0x1>;
+			xlnx,uart-width = <0x8>;
+			xlnx,use-uart = <0x1>;
+			xlnx,write-fsl-ports = <0x0>;
+		} ;
+		mpmc@90000000 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			compatible = "xlnx,mpmc-4.02.a";
+			PIM3: sdma@84600180 {
+				compatible = "xlnx,ll-dma-1.00.a";
+				interrupt-parent = <&xps_intc_0>;
+				interrupts = < 2 2 1 2 >;
+				reg = < 0x84600180 0x80 >;
+			} ;
+		} ;
+		xps_intc_0: interrupt-controller@81800000 {
+			#interrupt-cells = <0x2>;
+			compatible = "xlnx,xps-intc-1.00.a";
+			interrupt-controller ;
+			reg = < 0x81800000 0x10000 >;
+			xlnx,kind-of-intr = <0x100>;
+			xlnx,num-intr-inputs = <0x9>;
+		} ;
+		xps_timer_1: timer@83c00000 {
+			compatible = "xlnx,xps-timer-1.00.a";
+			interrupt-parent = <&xps_intc_0>;
+			interrupts = < 3 2 >;
+			reg = < 0x83c00000 0x10000 >;
+			xlnx,count-width = <0x20>;
+			xlnx,family = "virtex5";
+			xlnx,gen0-assert = <0x1>;
+			xlnx,gen1-assert = <0x1>;
+			xlnx,one-timer-only = <0x0>;
+			xlnx,trig0-assert = <0x1>;
+			xlnx,trig1-assert = <0x1>;
+		} ;
+	} ;
+}  ;
Signature · 1 line
1.5.5.1
author maintainer
#7 lore raw

PATCH 7/57 microblaze_v7: Signal support

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/signal.h |  165 +++++++++++
 arch/microblaze/kernel/signal.c      |  536 ++++++++++++++++++++++++++++++++++
 2 files changed, 701 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/signal.h
 create mode 100644 arch/microblaze/kernel/signal.c
arch/microblaze/include/asm/signal.h new file +165 -0
new file mode 100644
index 0000000..9676fad
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ *	Yasushi SHOJI <[email protected]>
+ *	Tetsuya OHKAWA <[email protected]>
+ *
+ * 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_SIGNAL_H
+#define _ASM_MICROBLAZE_SIGNAL_H
+
+#define SIGHUP		1
+#define SIGINT		2
+#define SIGQUIT		3
+#define SIGILL		4
+#define SIGTRAP		5
+#define SIGABRT		6
+#define SIGIOT		6
+#define SIGBUS		7
+#define SIGFPE		8
+#define SIGKILL		9
+#define SIGUSR1		10
+#define SIGSEGV		11
+#define SIGUSR2		12
+#define SIGPIPE		13
+#define SIGALRM		14
+#define SIGTERM		15
+#define SIGSTKFLT	16
+#define SIGCHLD		17
+#define SIGCONT		18
+#define SIGSTOP		19
+#define SIGTSTP		20
+#define SIGTTIN		21
+#define SIGTTOU		22
+#define SIGURG		23
+#define SIGXCPU		24
+#define SIGXFSZ		25
+#define SIGVTALRM	26
+#define SIGPROF		27
+#define SIGWINCH	28
+#define SIGIO		29
+#define SIGPOLL		SIGIO
+/*
+#define SIGLOST		29
+*/
+#define SIGPWR		30
+#define SIGSYS		31
+#define	SIGUNUSED	31
+
+/* These should not be considered constants from userland. */
+#define SIGRTMIN	32
+#define SIGRTMAX	_NSIG
+
+/*
+ * SA_FLAGS values:
+ *
+ * SA_ONSTACK indicates that a registered stack_t will be used.
+ * SA_RESTART flag to get restarting signals (which were the default long ago)
+ * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
+ * SA_RESETHAND clears the handler when the signal is delivered.
+ * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
+ * SA_NODEFER prevents the current signal from being masked in the handler.
+ *
+ * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
+ * Unix names RESETHAND and NODEFER respectively.
+ */
+#define SA_NOCLDSTOP	0x00000001
+#define SA_NOCLDWAIT	0x00000002
+#define SA_SIGINFO	0x00000004
+#define SA_ONSTACK	0x08000000
+#define SA_RESTART	0x10000000
+#define SA_NODEFER	0x40000000
+#define SA_RESETHAND	0x80000000
+
+#define SA_NOMASK	SA_NODEFER
+#define SA_ONESHOT	SA_RESETHAND
+
+#define SA_RESTORER	0x04000000
+
+/*
+ * sigaltstack controls
+ */
+#define SS_ONSTACK	1
+#define SS_DISABLE	2
+
+#define MINSIGSTKSZ	2048
+#define SIGSTKSZ	8192
+
+# ifndef __ASSEMBLY__
+# include <linux/types.h>
+# include <asm-generic/signal.h>
+
+/* Avoid too many header ordering problems. */
+struct siginfo;
+
+#  ifdef __KERNEL__
+/*
+ * Most things should be clean enough to redefine this at will, if care
+ * is taken to make libc match.
+ */
+#  define _NSIG		64
+#  define _NSIG_BPW	32
+#  define _NSIG_WORDS	(_NSIG / _NSIG_BPW)
+
+typedef unsigned long old_sigset_t; /* at least 32 bits */
+
+typedef struct {
+	unsigned long sig[_NSIG_WORDS];
+} sigset_t;
+
+struct old_sigaction {
+	__sighandler_t sa_handler;
+	old_sigset_t sa_mask;
+	unsigned long sa_flags;
+	void (*sa_restorer)(void);
+};
+
+struct sigaction {
+	__sighandler_t sa_handler;
+	unsigned long sa_flags;
+	void (*sa_restorer)(void);
+	sigset_t sa_mask; /* mask last for extensibility */
+};
+
+struct k_sigaction {
+	struct sigaction sa;
+};
+
+#  include <asm/sigcontext.h>
+#  undef __HAVE_ARCH_SIG_BITOPS
+
+#  define ptrace_signal_deliver(regs, cookie) do { } while (0)
+
+#  else /* !__KERNEL__ */
+
+/* Here we must cater to libcs that poke about in kernel headers. */
+
+#  define NSIG		32
+typedef unsigned long sigset_t;
+
+struct sigaction {
+	union {
+	__sighandler_t _sa_handler;
+	void (*_sa_sigaction)(int, struct siginfo *, void *);
+	} _u;
+	sigset_t sa_mask;
+	unsigned long sa_flags;
+	void (*sa_restorer)(void);
+};
+
+#  define sa_handler	_u._sa_handler
+#  define sa_sigaction	_u._sa_sigaction
+
+#  endif /* __KERNEL__ */
+
+typedef struct sigaltstack {
+	void *ss_sp;
+	int ss_flags;
+	size_t ss_size;
+} stack_t;
+
+# endif /* __ASSEMBLY__ */
+#endif /* _ASM_MICROBLAZE_SIGNAL_H */
arch/microblaze/kernel/signal.c new file +536 -0

536 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#13 lore raw

PATCH 13/57 microblaze_v7: PVR support, cpuinfo support

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/pvr.h |  209 +++++++++++++++++++++++++++++++++++++
 arch/microblaze/kernel/cpu/mb.c   |  148 ++++++++++++++++++++++++++
 arch/microblaze/kernel/cpu/pvr.c  |   81 ++++++++++++++
 3 files changed, 438 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/pvr.h
 create mode 100644 arch/microblaze/kernel/cpu/mb.c
 create mode 100644 arch/microblaze/kernel/cpu/pvr.c
arch/microblaze/include/asm/pvr.h new file +209 -0
new file mode 100644
index 0000000..66f1b30
@@ -0,0 +1,209 @@
+/*
+ * Support for the MicroBlaze PVR (Processor Version Register)
+ *
+ * Copyright (C) 2009 Michal Simek <[email protected]>
+ * Copyright (C) 2007 John Williams <[email protected]>
+ * Copyright (C) 2007 - 2009 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_PVR_H
+#define _ASM_MICROBLAZE_PVR_H
+
+#define PVR_MSR_BIT 0x400
+
+struct pvr_s {
+	unsigned pvr[16];
+};
+
+/* The following taken from Xilinx's standalone BSP pvr.h */
+
+/* Basic PVR mask */
+#define PVR0_PVR_FULL_MASK		0x80000000
+#define PVR0_USE_BARREL_MASK		0x40000000
+#define PVR0_USE_DIV_MASK		0x20000000
+#define PVR0_USE_HW_MUL_MASK		0x10000000
+#define PVR0_USE_FPU_MASK		0x08000000
+#define PVR0_USE_EXC_MASK		0x04000000
+#define PVR0_USE_ICACHE_MASK		0x02000000
+#define PVR0_USE_DCACHE_MASK		0x01000000
+#define PVR0_USE_MMU			0x00800000	/* new */
+#define PVR0_VERSION_MASK		0x0000FF00
+#define PVR0_USER1_MASK			0x000000FF
+
+/* User 2 PVR mask */
+#define PVR1_USER2_MASK			0xFFFFFFFF
+
+/* Configuration PVR masks */
+#define PVR2_D_OPB_MASK			0x80000000
+#define PVR2_D_LMB_MASK			0x40000000
+#define PVR2_I_OPB_MASK			0x20000000
+#define PVR2_I_LMB_MASK			0x10000000
+#define PVR2_INTERRUPT_IS_EDGE_MASK	0x08000000
+#define PVR2_EDGE_IS_POSITIVE_MASK	0x04000000
+#define PVR2_D_PLB_MASK			0x02000000	/* new */
+#define PVR2_I_PLB_MASK			0x01000000	/* new */
+#define PVR2_INTERCONNECT		0x00800000	/* new */
+#define PVR2_USE_EXTEND_FSL		0x00080000	/* new */
+#define PVR2_USE_FSL_EXC		0x00040000	/* new */
+#define PVR2_USE_MSR_INSTR		0x00020000
+#define PVR2_USE_PCMP_INSTR		0x00010000
+#define PVR2_AREA_OPTIMISED		0x00008000
+#define PVR2_USE_BARREL_MASK		0x00004000
+#define PVR2_USE_DIV_MASK		0x00002000
+#define PVR2_USE_HW_MUL_MASK		0x00001000
+#define PVR2_USE_FPU_MASK		0x00000800
+#define PVR2_USE_MUL64_MASK		0x00000400
+#define PVR2_USE_FPU2_MASK		0x00000200	/* new */
+#define PVR2_USE_IPLBEXC 		0x00000100
+#define PVR2_USE_DPLBEXC		0x00000080
+#define PVR2_OPCODE_0x0_ILL_MASK	0x00000040
+#define PVR2_UNALIGNED_EXC_MASK		0x00000020
+#define PVR2_ILL_OPCODE_EXC_MASK	0x00000010
+#define PVR2_IOPB_BUS_EXC_MASK		0x00000008
+#define PVR2_DOPB_BUS_EXC_MASK		0x00000004
+#define PVR2_DIV_ZERO_EXC_MASK		0x00000002
+#define PVR2_FPU_EXC_MASK		0x00000001
+
+/* Debug and exception PVR masks */
+#define PVR3_DEBUG_ENABLED_MASK		0x80000000
+#define PVR3_NUMBER_OF_PC_BRK_MASK	0x1E000000
+#define PVR3_NUMBER_OF_RD_ADDR_BRK_MASK	0x00380000
+#define PVR3_NUMBER_OF_WR_ADDR_BRK_MASK	0x0000E000
+#define PVR3_FSL_LINKS_MASK		0x00000380
+
+/* ICache config PVR masks */
+#define PVR4_USE_ICACHE_MASK		0x80000000
+#define PVR4_ICACHE_ADDR_TAG_BITS_MASK	0x7C000000
+#define PVR4_ICACHE_USE_FSL_MASK	0x02000000
+#define PVR4_ICACHE_ALLOW_WR_MASK	0x01000000
+#define PVR4_ICACHE_LINE_LEN_MASK	0x00E00000
+#define PVR4_ICACHE_BYTE_SIZE_MASK	0x001F0000
+
+/* DCache config PVR masks */
+#define PVR5_USE_DCACHE_MASK		0x80000000
+#define PVR5_DCACHE_ADDR_TAG_BITS_MASK	0x7C000000
+#define PVR5_DCACHE_USE_FSL_MASK	0x02000000
+#define PVR5_DCACHE_ALLOW_WR_MASK	0x01000000
+#define PVR5_DCACHE_LINE_LEN_MASK	0x00E00000
+#define PVR5_DCACHE_BYTE_SIZE_MASK	0x001F0000
+
+/* ICache base address PVR mask */
+#define PVR6_ICACHE_BASEADDR_MASK	0xFFFFFFFF
+
+/* ICache high address PVR mask */
+#define PVR7_ICACHE_HIGHADDR_MASK	0xFFFFFFFF
+
+/* DCache base address PVR mask */
+#define PVR8_DCACHE_BASEADDR_MASK	0xFFFFFFFF
+
+/* DCache high address PVR mask */
+#define PVR9_DCACHE_HIGHADDR_MASK	0xFFFFFFFF
+
+/* Target family PVR mask */
+#define PVR10_TARGET_FAMILY_MASK	0xFF000000
+
+/* MMU descrtiption */
+#define PVR11_USE_MMU			0xC0000000
+#define PVR11_MMU_ITLB_SIZE		0x38000000
+#define PVR11_MMU_DTLB_SIZE		0x07000000
+#define PVR11_MMU_TLB_ACCESS		0x00C00000
+#define PVR11_MMU_ZONES			0x003C0000
+/* MSR Reset value PVR mask */
+#define PVR11_MSR_RESET_VALUE_MASK	0x000007FF
+
+
+/* PVR access macros */
+#define PVR_IS_FULL(pvr)		(pvr.pvr[0] & PVR0_PVR_FULL_MASK)
+#define PVR_USE_BARREL(pvr)		(pvr.pvr[0] & PVR0_USE_BARREL_MASK)
+#define PVR_USE_DIV(pvr)		(pvr.pvr[0] & PVR0_USE_DIV_MASK)
+#define PVR_USE_HW_MUL(pvr)		(pvr.pvr[0] & PVR0_USE_HW_MUL_MASK)
+#define PVR_USE_FPU(pvr)		(pvr.pvr[0] & PVR0_USE_FPU_MASK)
+#define PVR_USE_FPU2(pvr)		(pvr.pvr[2] & PVR2_USE_FPU2_MASK)
+#define PVR_USE_ICACHE(pvr)		(pvr.pvr[0] & PVR0_USE_ICACHE_MASK)
+#define PVR_USE_DCACHE(pvr)		(pvr.pvr[0] & PVR0_USE_DCACHE_MASK)
+#define PVR_VERSION(pvr)	((pvr.pvr[0] & PVR0_VERSION_MASK) >> 8)
+#define PVR_USER1(pvr)			(pvr.pvr[0] & PVR0_USER1_MASK)
+#define PVR_USER2(pvr)			(pvr.pvr[1] & PVR1_USER2_MASK)
+
+#define PVR_D_OPB(pvr)			(pvr.pvr[2] & PVR2_D_OPB_MASK)
+#define PVR_D_LMB(pvr)			(pvr.pvr[2] & PVR2_D_LMB_MASK)
+#define PVR_I_OPB(pvr)			(pvr.pvr[2] & PVR2_I_OPB_MASK)
+#define PVR_I_LMB(pvr)			(pvr.pvr[2] & PVR2_I_LMB_MASK)
+#define PVR_INTERRUPT_IS_EDGE(pvr) \
+			(pvr.pvr[2] & PVR2_INTERRUPT_IS_EDGE_MASK)
+#define PVR_EDGE_IS_POSITIVE(pvr) \
+			(pvr.pvr[2] & PVR2_EDGE_IS_POSITIVE_MASK)
+#define PVR_USE_MSR_INSTR(pvr)		(pvr.pvr[2] & PVR2_USE_MSR_INSTR)
+#define PVR_USE_PCMP_INSTR(pvr)		(pvr.pvr[2] & PVR2_USE_PCMP_INSTR)
+#define PVR_AREA_OPTIMISED(pvr)		(pvr.pvr[2] & PVR2_AREA_OPTIMISED)
+#define PVR_USE_MUL64(pvr)		(pvr.pvr[2] & PVR2_USE_MUL64_MASK)
+#define PVR_OPCODE_0x0_ILLEGAL(pvr) \
+			(pvr.pvr[2] & PVR2_OPCODE_0x0_ILL_MASK)
+#define PVR_UNALIGNED_EXCEPTION(pvr) \
+			(pvr.pvr[2] & PVR2_UNALIGNED_EXC_MASK)
+#define PVR_ILL_OPCODE_EXCEPTION(pvr) \
+			(pvr.pvr[2] & PVR2_ILL_OPCODE_EXC_MASK)
+#define PVR_IOPB_BUS_EXCEPTION(pvr) \
+			(pvr.pvr[2] & PVR2_IOPB_BUS_EXC_MASK)
+#define PVR_DOPB_BUS_EXCEPTION(pvr) \
+			(pvr.pvr[2] & PVR2_DOPB_BUS_EXC_MASK)
+#define PVR_DIV_ZERO_EXCEPTION(pvr) \
+			(pvr.pvr[2] & PVR2_DIV_ZERO_EXC_MASK)
+#define PVR_FPU_EXCEPTION(pvr)		(pvr.pvr[2] & PVR2_FPU_EXC_MASK)
+#define PVR_FSL_EXCEPTION(pvr)		(pvr.pvr[2] & PVR2_USE_EXTEND_FSL)
+
+#define PVR_DEBUG_ENABLED(pvr)		(pvr.pvr[3] & PVR3_DEBUG_ENABLED_MASK)
+#define PVR_NUMBER_OF_PC_BRK(pvr) \
+			((pvr.pvr[3] & PVR3_NUMBER_OF_PC_BRK_MASK) >> 25)
+#define PVR_NUMBER_OF_RD_ADDR_BRK(pvr) \
+			((pvr.pvr[3] & PVR3_NUMBER_OF_RD_ADDR_BRK_MASK) >> 19)
+#define PVR_NUMBER_OF_WR_ADDR_BRK(pvr) \
+			((pvr.pvr[3] & PVR3_NUMBER_OF_WR_ADDR_BRK_MASK) >> 13)
+#define PVR_FSL_LINKS(pvr)	((pvr.pvr[3] & PVR3_FSL_LINKS_MASK) >> 7)
+
+#define PVR_ICACHE_ADDR_TAG_BITS(pvr) \
+			((pvr.pvr[4] & PVR4_ICACHE_ADDR_TAG_BITS_MASK) >> 26)
+#define PVR_ICACHE_USE_FSL(pvr)		(pvr.pvr[4] & PVR4_ICACHE_USE_FSL_MASK)
+#define PVR_ICACHE_ALLOW_WR(pvr)	(pvr.pvr[4] & PVR4_ICACHE_ALLOW_WR_MASK)
+#define PVR_ICACHE_LINE_LEN(pvr) \
+			(1 << ((pvr.pvr[4] & PVR4_ICACHE_LINE_LEN_MASK) >> 21))
+#define PVR_ICACHE_BYTE_SIZE(pvr) \
+			(1 << ((pvr.pvr[4] & PVR4_ICACHE_BYTE_SIZE_MASK) >> 16))
+
+#define PVR_DCACHE_ADDR_TAG_BITS(pvr) \
+			((pvr.pvr[5] & PVR5_DCACHE_ADDR_TAG_BITS_MASK) >> 26)
+#define PVR_DCACHE_USE_FSL(pvr)		(pvr.pvr[5] & PVR5_DCACHE_USE_FSL_MASK)
+#define PVR_DCACHE_ALLOW_WR(pvr)	(pvr.pvr[5] & PVR5_DCACHE_ALLOW_WR_MASK)
+#define PVR_DCACHE_LINE_LEN(pvr) \
+			(1 << ((pvr.pvr[5] & PVR5_DCACHE_LINE_LEN_MASK) >> 21))
+#define PVR_DCACHE_BYTE_SIZE(pvr) \
+			(1 << ((pvr.pvr[5] & PVR5_DCACHE_BYTE_SIZE_MASK) >> 16))
+
+
+#define PVR_ICACHE_BASEADDR(pvr)	(pvr.pvr[6] & PVR6_ICACHE_BASEADDR_MASK)
+#define PVR_ICACHE_HIGHADDR(pvr)	(pvr.pvr[7] & PVR7_ICACHE_HIGHADDR_MASK)
+
+#define PVR_DCACHE_BASEADDR(pvr)	(pvr.pvr[8] & PVR8_DCACHE_BASEADDR_MASK)
+#define PVR_DCACHE_HIGHADDR(pvr)	(pvr.pvr[9] & PVR9_DCACHE_HIGHADDR_MASK)
+
+#define PVR_TARGET_FAMILY(pvr)	((pvr.pvr[10] & PVR10_TARGET_FAMILY_MASK) >> 24)
+
+#define PVR_MSR_RESET_VALUE(pvr) \
+				(pvr.pvr[11] & PVR11_MSR_RESET_VALUE_MASK)
+
+/* mmu */
+#define PVR_USE_MMU(pvr)	((pvr.pvr[11] & PVR11_USE_MMU) >> 30)
+#define PVR_MMU_ITLB_SIZE(pvr)	(pvr.pvr[11] & PVR11_MMU_ITLB_SIZE)
+#define PVR_MMU_DTLB_SIZE(pvr)	(pvr.pvr[11] & PVR11_MMU_DTLB_SIZE)
+#define PVR_MMU_TLB_ACCESS(pvr)	(pvr.pvr[11] & PVR11_MMU_TLB_ACCESS)
+#define PVR_MMU_ZONES(pvr)	(pvr.pvr[11] & PVR11_MMU_ZONES)
+
+
+int cpu_has_pvr(void);
+void get_pvr(struct pvr_s *pvr);
+
+#endif /* _ASM_MICROBLAZE_PVR_H */
arch/microblaze/kernel/cpu/mb.c new file +148 -0

148 lines not on this page · raw message

arch/microblaze/kernel/cpu/pvr.c new file +81 -0

81 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#14 lore raw

PATCH 14/57 microblaze_v7: defconfig file

From: Michal Simek <[email protected]>

---
 arch/microblaze/configs/nommu_defconfig |  802 +++++++++++++++++++++++++++++++
 1 files changed, 802 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/configs/nommu_defconfig
arch/microblaze/configs/nommu_defconfig new file +802 -0
new file mode 100644
index 0000000..c1ca9cc
@@ -0,0 +1,802 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.29-rc8
+# Wed Mar 18 17:29:24 2009
+#
+CONFIG_MICROBLAZE=y
+# 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_GENERIC_TIME=y
+# CONFIG_GENERIC_TIME_VSYSCALL is not set
+CONFIG_GENERIC_CLOCKEVENTS=y
+# CONFIG_PCI is not set
+# CONFIG_NO_DMA is not set
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+CONFIG_POSIX_MQUEUE=y
+CONFIG_BSD_PROCESS_ACCT=y
+CONFIG_BSD_PROCESS_ACCT_V3=y
+# CONFIG_TASKSTATS is not set
+# CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_CLASSIC_RCU=y
+# CONFIG_TREE_RCU is not set
+# CONFIG_PREEMPT_RCU is not set
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_PREEMPT_RCU_TRACE is not set
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=17
+# CONFIG_GROUP_SCHED is not set
+# CONFIG_CGROUPS 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_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
+CONFIG_EMBEDDED=y
+CONFIG_SYSCTL_SYSCALL=y
+CONFIG_KALLSYMS=y
+CONFIG_KALLSYMS_ALL=y
+CONFIG_KALLSYMS_EXTRA_PASS=y
+# CONFIG_HOTPLUG is not set
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+# CONFIG_BASE_FULL is not set
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+CONFIG_AIO=y
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_COMPAT_BRK=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=1
+CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_BLOCK=y
+# CONFIG_LBD is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_DEFAULT_AS is not set
+# CONFIG_DEFAULT_DEADLINE is not set
+CONFIG_DEFAULT_CFQ=y
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="cfq"
+
+#
+# Platform options
+#
+CONFIG_PLATFORM_GENERIC=y
+# CONFIG_SELFMOD is not set
+# CONFIG_OPT_LIB_FUNCTION is not set
+# CONFIG_ALLOW_EDIT_AUTO is not set
+CONFIG_KERNEL_BASE_ADDR=0x90000000
+CONFIG_XILINX_MICROBLAZE0_FAMILY="virtex5"
+CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR=1
+CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR=1
+CONFIG_XILINX_MICROBLAZE0_USE_BARREL=1
+CONFIG_XILINX_MICROBLAZE0_USE_DIV=1
+CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL=2
+CONFIG_XILINX_MICROBLAZE0_USE_FPU=2
+CONFIG_XILINX_MICROBLAZE0_HW_VER="7.10.d"
+
+#
+# Processor type and features
+#
+CONFIG_TICK_ONESHOT=y
+# CONFIG_NO_HZ is not set
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+CONFIG_PREEMPT_NONE=y
+# CONFIG_PREEMPT_VOLUNTARY is not set
+# CONFIG_PREEMPT is not set
+CONFIG_HZ_100=y
+# CONFIG_HZ_250 is not set
+# CONFIG_HZ_300 is not set
+# CONFIG_HZ_1000 is not set
+CONFIG_HZ=100
+CONFIG_SCHED_HRTICK=y
+# CONFIG_MMU is not set
+CONFIG_NO_MMU=y
+
+#
+# Boot options
+#
+CONFIG_CMDLINE_BOOL=y
+CONFIG_CMDLINE="console=ttyUL0,115200"
+# CONFIG_CMDLINE_FORCE is not set
+CONFIG_OF=y
+CONFIG_OF_DEVICE=y
+CONFIG_PROC_DEVICETREE=y
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_FLATMEM_MANUAL=y
+# CONFIG_DISCONTIGMEM_MANUAL is not set
+# CONFIG_SPARSEMEM_MANUAL is not set
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+CONFIG_PAGEFLAGS_EXTENDED=y
+CONFIG_SPLIT_PTLOCK_CPUS=4
+# CONFIG_PHYS_ADDR_T_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=0
+CONFIG_VIRT_TO_BUS=y
+
+#
+# Exectuable file formats
+#
+CONFIG_BINFMT_FLAT=y
+# CONFIG_BINFMT_ZFLAT is not set
+# CONFIG_BINFMT_SHARED_FLAT is not set
+# CONFIG_HAVE_AOUT is not set
+# CONFIG_BINFMT_MISC is not set
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_COMPAT_NET_DEV_OPS=y
+CONFIG_PACKET=y
+# CONFIG_PACKET_MMAP is not set
+CONFIG_UNIX=y
+CONFIG_XFRM=y
+# CONFIG_XFRM_USER is not set
+# CONFIG_XFRM_SUB_POLICY is not set
+# CONFIG_XFRM_MIGRATE is not set
+# CONFIG_XFRM_STATISTICS is not set
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+# CONFIG_IP_MULTICAST is not set
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_FIB_HASH=y
+# CONFIG_IP_PNP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+# CONFIG_INET_TUNNEL is not set
+CONFIG_INET_XFRM_MODE_TRANSPORT=y
+CONFIG_INET_XFRM_MODE_TUNNEL=y
+CONFIG_INET_XFRM_MODE_BEET=y
+# CONFIG_INET_LRO is not set
+CONFIG_INET_DIAG=y
+CONFIG_INET_TCP_DIAG=y
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+# CONFIG_IPV6 is not set
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+# CONFIG_NET_SCHED is not set
+# CONFIG_DCB is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+# CONFIG_AF_RXRPC is not set
+# CONFIG_PHONET is not set
+CONFIG_WIRELESS=y
+# CONFIG_CFG80211 is not set
+CONFIG_WIRELESS_OLD_REGULATORY=y
+# CONFIG_WIRELESS_EXT is not set
+# CONFIG_LIB80211 is not set
+# CONFIG_MAC80211 is not set
+# CONFIG_WIMAX is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_STANDALONE=y
+# CONFIG_PREVENT_FIRMWARE_BUILD is not set
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
+# CONFIG_SYS_HYPERVISOR is not set
+# CONFIG_CONNECTOR is not set
+CONFIG_MTD=y
+# CONFIG_MTD_DEBUG is not set
+CONFIG_MTD_CONCAT=y
+CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_TESTS is not set
+# CONFIG_MTD_REDBOOT_PARTS is not set
+CONFIG_MTD_CMDLINE_PARTS=y
+# CONFIG_MTD_AR7_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLKDEVS=y
+CONFIG_MTD_BLOCK=y
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+# CONFIG_RFD_FTL is not set
+# CONFIG_SSFDC is not set
+# CONFIG_MTD_OOPS is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+CONFIG_MTD_CFI=y
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+# CONFIG_MTD_CFI_ADV_OPTIONS is not set
+CONFIG_MTD_MAP_BANK_WIDTH_1=y
+CONFIG_MTD_MAP_BANK_WIDTH_2=y
+CONFIG_MTD_MAP_BANK_WIDTH_4=y
+# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+CONFIG_MTD_CFI_I1=y
+CONFIG_MTD_CFI_I2=y
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 is not set
+CONFIG_MTD_CFI_INTELEXT=y
+CONFIG_MTD_CFI_AMDSTD=y
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
+CONFIG_MTD_RAM=y
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+# CONFIG_MTD_PHYSMAP is not set
+CONFIG_MTD_UCLINUX=y
+# CONFIG_MTD_PLATRAM is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLOCK2MTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+# CONFIG_MTD_NAND is not set
+# CONFIG_MTD_ONENAND is not set
+
+#
+# LPDDR flash memory drivers
+#
+# CONFIG_MTD_LPDDR is not set
+
+#
+# UBI - Unsorted block images
+#
+# CONFIG_MTD_UBI is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_DEV_COW_COMMON is not set
+# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_NBD=y
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=4096
+# CONFIG_BLK_DEV_XIP is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+CONFIG_MISC_DEVICES=y
+# CONFIG_ENCLOSURE_SERVICES is not set
+# CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_93CX6 is not set
+
+#
+# SCSI device support
+#
+# CONFIG_RAID_ATTRS is not set
+# CONFIG_SCSI is not set
+# CONFIG_SCSI_DMA is not set
+# CONFIG_SCSI_NETLINK is not set
+# CONFIG_ATA is not set
+# CONFIG_MD is not set
+CONFIG_NETDEVICES=y
+# CONFIG_DUMMY is not set
+# CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+# CONFIG_VETH is not set
+# CONFIG_PHYLIB is not set
+CONFIG_NET_ETHERNET=y
+# CONFIG_MII is not set
+# CONFIG_DNET is not set
+# CONFIG_IBM_NEW_EMAC_ZMII is not set
+# CONFIG_IBM_NEW_EMAC_RGMII is not set
+# CONFIG_IBM_NEW_EMAC_TAH is not set
+# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
+# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
+# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
+# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
+# CONFIG_B44 is not set
+CONFIG_NETDEV_1000=y
+CONFIG_NETDEV_10000=y
+
+#
+# Wireless LAN
+#
+# CONFIG_WLAN_PRE80211 is not set
+# CONFIG_WLAN_80211 is not set
+# CONFIG_IWLWIFI_LEDS is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+# CONFIG_WAN is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_ISDN is not set
+# CONFIG_PHONE is not set
+
+#
+# Input device support
+#
+# CONFIG_INPUT is not set
+
+#
+# Hardware I/O ports
+#
+# CONFIG_SERIO is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+# CONFIG_VT is not set
+CONFIG_DEVKMEM=y
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+CONFIG_SERIAL_UARTLITE=y
+CONFIG_SERIAL_UARTLITE_CONSOLE=y
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+# CONFIG_IPMI_HANDLER is not set
+CONFIG_HW_RANDOM=y
+# CONFIG_RTC is not set
+# CONFIG_GEN_RTC is not set
+# CONFIG_R3964 is not set
+# CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+# CONFIG_I2C is not set
+# CONFIG_SPI is not set
+# CONFIG_W1 is not set
+# CONFIG_POWER_SUPPLY is not set
+# CONFIG_HWMON is not set
+# CONFIG_THERMAL is not set
+# CONFIG_THERMAL_HWMON is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
+
+#
+# Sonics Silicon Backplane
+#
+# CONFIG_SSB is not set
+
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_CORE is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_REGULATOR is not set
+
+#
+# Multimedia devices
+#
+
+#
+# Multimedia core support
+#
+# CONFIG_VIDEO_DEV is not set
+# CONFIG_DVB_CORE is not set
+# CONFIG_VIDEO_MEDIA is not set
+
+#
+# Multimedia drivers
+#
+CONFIG_DAB=y
+
+#
+# Graphics support
+#
+# CONFIG_VGASTATE is not set
+CONFIG_VIDEO_OUTPUT_CONTROL=y
+# CONFIG_FB is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+
+#
+# Display device support
+#
+# CONFIG_DISPLAY_SUPPORT is not set
+# CONFIG_SOUND is not set
+CONFIG_USB_SUPPORT=y
+# CONFIG_USB_ARCH_HAS_HCD is not set
+# CONFIG_USB_ARCH_HAS_OHCI is not set
+# CONFIG_USB_ARCH_HAS_EHCI is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
+
+#
+# Enable Host or Gadget support to see Inventra options
+#
+
+#
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
+#
+# CONFIG_USB_GADGET is not set
+
+#
+# OTG and related infrastructure
+#
+# CONFIG_MMC is not set
+# CONFIG_MEMSTICK is not set
+# CONFIG_NEW_LEDS is not set
+# CONFIG_ACCESSIBILITY is not set
+# CONFIG_RTC_CLASS is not set
+# CONFIG_DMADEVICES is not set
+# CONFIG_UIO is not set
+# CONFIG_STAGING is not set
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+# CONFIG_EXT3_FS is not set
+# CONFIG_EXT4_FS is not set
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+CONFIG_FS_POSIX_ACL=y
+CONFIG_FILE_LOCKING=y
+# CONFIG_XFS_FS is not set
+# CONFIG_OCFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_DNOTIFY is not set
+# CONFIG_INOTIFY is not set
+# CONFIG_QUOTA is not set
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+# CONFIG_FUSE_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+# CONFIG_MSDOS_FS is not set
+# CONFIG_VFAT_FS is not set
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_SYSCTL=y
+CONFIG_SYSFS=y
+# CONFIG_TMPFS is not set
+# CONFIG_HUGETLB_PAGE is not set
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_JFFS2_FS is not set
+CONFIG_CRAMFS=y
+# CONFIG_SQUASHFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+CONFIG_ROMFS_FS=y
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+CONFIG_NETWORK_FILESYSTEMS=y
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+CONFIG_NFS_V3_ACL=y
+# CONFIG_NFS_V4 is not set
+# CONFIG_NFSD is not set
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+CONFIG_NFS_ACL_SUPPORT=y
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=y
+# CONFIG_SUNRPC_REGISTER_V4 is not set
+# CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
+# CONFIG_SMB_FS is not set
+# CONFIG_CIFS is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+
+#
+# Partition Types
+#
+# CONFIG_PARTITION_ADVANCED is not set
+CONFIG_MSDOS_PARTITION=y
+# CONFIG_NLS is not set
+# CONFIG_DLM is not set
+
+#
+# Kernel hacking
+#
+# CONFIG_PRINTK_TIME is not set
+CONFIG_ENABLE_WARN_DEPRECATED=y
+CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
+# CONFIG_MAGIC_SYSRQ is not set
+CONFIG_UNUSED_SYMBOLS=y
+CONFIG_DEBUG_FS=y
+# CONFIG_HEADERS_CHECK is not set
+CONFIG_DEBUG_KERNEL=y
+CONFIG_DEBUG_SHIRQ=y
+CONFIG_DETECT_SOFTLOCKUP=y
+CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y
+CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=1
+CONFIG_SCHED_DEBUG=y
+CONFIG_SCHEDSTATS=y
+CONFIG_TIMER_STATS=y
+CONFIG_DEBUG_OBJECTS=y
+CONFIG_DEBUG_OBJECTS_SELFTEST=y
+CONFIG_DEBUG_OBJECTS_FREE=y
+CONFIG_DEBUG_OBJECTS_TIMERS=y
+CONFIG_DEBUG_OBJECTS_ENABLE_DEFAULT=1
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+# CONFIG_DEBUG_KOBJECT is not set
+CONFIG_DEBUG_INFO=y
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_NOMMU_REGIONS is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+CONFIG_DEBUG_LIST=y
+CONFIG_DEBUG_SG=y
+# CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_RCU_CPU_STALL_DETECTOR is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_FAULT_INJECTION is not set
+CONFIG_SYSCTL_SYSCALL_CHECK=y
+
+#
+# Tracers
+#
+# CONFIG_SCHED_TRACER is not set
+# CONFIG_CONTEXT_SWITCH_TRACER is not set
+# CONFIG_BOOT_TRACER is not set
+# CONFIG_TRACE_BRANCH_PROFILING is not set
+# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
+# CONFIG_SAMPLES is not set
+CONFIG_EARLY_PRINTK=y
+CONFIG_HEART_BEAT=y
+# CONFIG_DEBUG_BOOTMEM is not set
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+# CONFIG_SECURITYFS is not set
+# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+# CONFIG_CRYPTO_FIPS is not set
+# CONFIG_CRYPTO_MANAGER is not set
+# CONFIG_CRYPTO_MANAGER2 is not set
+# CONFIG_CRYPTO_GF128MUL is not set
+# CONFIG_CRYPTO_NULL is not set
+# CONFIG_CRYPTO_CRYPTD is not set
+# CONFIG_CRYPTO_AUTHENC is not set
+# CONFIG_CRYPTO_TEST is not set
+
+#
+# Authenticated Encryption with Associated Data
+#
+# CONFIG_CRYPTO_CCM is not set
+# CONFIG_CRYPTO_GCM is not set
+# CONFIG_CRYPTO_SEQIV is not set
+
+#
+# Block modes
+#
+# CONFIG_CRYPTO_CBC is not set
+# CONFIG_CRYPTO_CTR is not set
+# CONFIG_CRYPTO_CTS is not set
+# CONFIG_CRYPTO_ECB is not set
+# CONFIG_CRYPTO_LRW is not set
+# CONFIG_CRYPTO_PCBC is not set
+# CONFIG_CRYPTO_XTS is not set
+
+#
+# Hash modes
+#
+# CONFIG_CRYPTO_HMAC is not set
+# CONFIG_CRYPTO_XCBC is not set
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_MD4 is not set
+# CONFIG_CRYPTO_MD5 is not set
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
+# CONFIG_CRYPTO_RMD128 is not set
+# CONFIG_CRYPTO_RMD160 is not set
+# CONFIG_CRYPTO_RMD256 is not set
+# CONFIG_CRYPTO_RMD320 is not set
+# CONFIG_CRYPTO_SHA1 is not set
+# CONFIG_CRYPTO_SHA256 is not set
+# CONFIG_CRYPTO_SHA512 is not set
+# CONFIG_CRYPTO_TGR192 is not set
+# CONFIG_CRYPTO_WP512 is not set
+
+#
+# Ciphers
+#
+# CONFIG_CRYPTO_AES is not set
+# CONFIG_CRYPTO_ANUBIS is not set
+# CONFIG_CRYPTO_ARC4 is not set
+# CONFIG_CRYPTO_BLOWFISH is not set
+# CONFIG_CRYPTO_CAMELLIA is not set
+# CONFIG_CRYPTO_CAST5 is not set
+# CONFIG_CRYPTO_CAST6 is not set
+# CONFIG_CRYPTO_DES is not set
+# CONFIG_CRYPTO_FCRYPT is not set
+# CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_SALSA20 is not set
+# CONFIG_CRYPTO_SEED is not set
+# CONFIG_CRYPTO_SERPENT is not set
+# CONFIG_CRYPTO_TEA is not set
+# CONFIG_CRYPTO_TWOFISH is not set
+
+#
+# Compression
+#
+# CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_LZO is not set
+
+#
+# Random Number Generation
+#
+# CONFIG_CRYPTO_ANSI_CPRNG is not set
+CONFIG_CRYPTO_HW=y
+
+#
+# Library routines
+#
+CONFIG_GENERIC_FIND_LAST_BIT=y
+# CONFIG_CRC_CCITT is not set
+# CONFIG_CRC16 is not set
+# CONFIG_CRC_T10DIF is not set
+# CONFIG_CRC_ITU_T is not set
+# CONFIG_CRC32 is not set
+# CONFIG_CRC7 is not set
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_PLIST=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_HAVE_LMB=y
Signature · 1 line
1.5.5.1
author maintainer
#15 lore raw

PATCH 15/57 microblaze_v7: assembler files head.S, entry-nommu.S, syscall_table.S

From: Michal Simek <[email protected]>

---
 arch/microblaze/kernel/entry-nommu.S   |  594 ++++++++++++++++++++++++++++++++
 arch/microblaze/kernel/head.S          |   55 +++
 arch/microblaze/kernel/syscall_table.S |  365 ++++++++++++++++++++
 3 files changed, 1014 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/entry-nommu.S
 create mode 100644 arch/microblaze/kernel/head.S
 create mode 100644 arch/microblaze/kernel/syscall_table.S
arch/microblaze/kernel/entry-nommu.S new file +594 -0
new file mode 100644
index 0000000..5678f17
@@ -0,0 +1,594 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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/linkage.h>
+#include <asm/thread_info.h>
+#include <asm/errno.h>
+#include <asm/entry.h>
+#include <asm/asm-offsets.h>
+#include <asm/registers.h>
+#include <asm/unistd.h>
+#include <asm/percpu.h>
+#include <asm/signal.h>
+
+#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 */
+	addik	r1, r1, THREAD_SIZE - PT_SIZE
+2:
+	swi	r11, r1, PT_MODE		/* store the mode */
+	lwi	r11, r0, PER_CPU(R11_SAVE)	/* reload r11 */
+	swi	r2, r1, PT_R2
+	swi	r3, r1, PT_R3
+	swi	r4, r1, PT_R4
+	swi	r5, r1, PT_R5
+	swi	r6, r1, PT_R6
+	swi	r7, r1, PT_R7
+	swi	r8, r1, PT_R8
+	swi	r9, r1, PT_R9
+	swi	r10, r1, PT_R10
+	swi	r11, r1, PT_R11
+	swi	r12, r1, PT_R12
+	swi	r13, r1, PT_R13
+	swi	r14, r1, PT_R14
+	swi	r14, r1, PT_PC
+	swi	r15, r1, PT_R15
+	swi	r16, r1, PT_R16
+	swi	r17, r1, PT_R17
+	swi	r18, r1, PT_R18
+	swi	r19, r1, PT_R19
+	swi	r20, r1, PT_R20
+	swi	r21, r1, PT_R21
+	swi	r22, r1, PT_R22
+	swi	r23, r1, PT_R23
+	swi	r24, r1, PT_R24
+	swi	r25, r1, PT_R25
+	swi	r26, r1, PT_R26
+	swi	r27, r1, PT_R27
+	swi	r28, r1, PT_R28
+	swi	r29, r1, PT_R29
+	swi	r30, r1, PT_R30
+	swi	r31, r1, PT_R31
+	/* special purpose registers */
+	mfs	r11, rmsr
+	swi	r11, r1, PT_MSR
+	mfs	r11, rear
+	swi	r11, r1, PT_EAR
+	mfs	r11, resr
+	swi	r11, r1, PT_ESR
+	mfs	r11, rfsr
+	swi	r11, r1, PT_FSR
+	/* reload original stack pointer and save it */
+	lwi	r11, r0, PER_CPU(ENTRY_SP)
+	swi	r11, r1, PT_R1
+	/* update mode indicator we are in kernel mode */
+	addik	r11, r0, 1
+	swi	r11, r0, PER_CPU(KM)
+	/* restore r31 */
+	lwi	r31, r0, PER_CPU(CURRENT_SAVE)
+	/* prepare the link register, the argument and jump */
+	la	r15, r0, ret_from_intr - 8
+	addk	r6, r0, r15
+	braid	do_IRQ
+	add	r5, r0, r1
+
+ret_from_intr:
+	lwi	r11, r1, PT_MODE
+	bneid	r11, 3f
+
+	lwi	r6, r31, TS_THREAD_INFO	/* get thread info */
+	lwi	r19, r6, TI_FLAGS	/* get flags in thread info */
+				/* do an extra work if any bits are set */
+
+	andi	r11, r19, _TIF_NEED_RESCHED
+	beqi	r11, 1f
+	bralid	r15, schedule
+	nop
+1:	andi	r11, r19, _TIF_SIGPENDING
+	beqid	r11, no_intr_reshed
+	addk	r5, r1, r0
+	addk	r7, r0, r0
+	bralid	r15, do_signal
+	addk	r6, r0, r0
+
+no_intr_reshed:
+	/* save mode indicator */
+	lwi	r11, r1, PT_MODE
+3:
+	swi	r11, r0, PER_CPU(KM)
+
+	/* save r31 */
+	swi	r31, r0, PER_CPU(CURRENT_SAVE)
+restore_context:
+	/* special purpose registers */
+	lwi	r11, r1, PT_FSR
+	mts	rfsr, r11
+	lwi	r11, r1, PT_ESR
+	mts	resr, r11
+	lwi	r11, r1, PT_EAR
+	mts	rear, r11
+	lwi	r11, r1, PT_MSR
+	mts	rmsr, r11
+
+	lwi	r31, r1, PT_R31
+	lwi	r30, r1, PT_R30
+	lwi	r29, r1, PT_R29
+	lwi	r28, r1, PT_R28
+	lwi	r27, r1, PT_R27
+	lwi	r26, r1, PT_R26
+	lwi	r25, r1, PT_R25
+	lwi	r24, r1, PT_R24
+	lwi	r23, r1, PT_R23
+	lwi	r22, r1, PT_R22
+	lwi	r21, r1, PT_R21
+	lwi	r20, r1, PT_R20
+	lwi	r19, r1, PT_R19
+	lwi	r18, r1, PT_R18
+	lwi	r17, r1, PT_R17
+	lwi	r16, r1, PT_R16
+	lwi	r15, r1, PT_R15
+	lwi	r14, r1, PT_PC
+	lwi	r13, r1, PT_R13
+	lwi	r12, r1, PT_R12
+	lwi	r11, r1, PT_R11
+	lwi	r10, r1, PT_R10
+	lwi	r9, r1, PT_R9
+	lwi	r8, r1, PT_R8
+	lwi	r7, r1, PT_R7
+	lwi	r6, r1, PT_R6
+	lwi	r5, r1, PT_R5
+	lwi	r4, r1, PT_R4
+	lwi	r3, r1, PT_R3
+	lwi	r2, r1, PT_R2
+	lwi	r1, r1, PT_R1
+	rtid	r14, 0
+	nop
+
+ENTRY(_reset)
+	brai	0;
+
+ENTRY(_user_exception)
+	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				/* Already in kernel mode? */
+	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 */
+	addik	r1, r1, THREAD_SIZE - PT_SIZE
+	swi	r11, r0, PER_CPU(R11_SAVE)	/* temporarily save r11 */
+	lwi	r11, r0, PER_CPU(KM)		/* load mode indicator */
+2:
+	swi	r11, r1, PT_MODE		/* store the mode */
+	lwi	r11, r0, PER_CPU(R11_SAVE)	/* reload r11 */
+	/* save them on stack */
+	swi	r2, r1, PT_R2
+	swi	r3, r1, PT_R3 /* r3: _always_ in clobber list; see unistd.h */
+	swi	r4, r1, PT_R4 /* r4: _always_ in clobber list; see unistd.h */
+	swi	r5, r1, PT_R5
+	swi	r6, r1, PT_R6
+	swi	r7, r1, PT_R7
+	swi	r8, r1, PT_R8
+	swi	r9, r1, PT_R9
+	swi	r10, r1, PT_R10
+	swi	r11, r1, PT_R11
+	/* r12: _always_ in clobber list; see unistd.h */
+	swi	r12, r1, PT_R12
+	swi	r13, r1, PT_R13
+	/* r14: _always_ in clobber list; see unistd.h */
+	swi	r14, r1, PT_R14
+	/* but we want to return to the next inst. */
+	addik	r14, r14, 0x4
+	swi	r14, r1, PT_PC		/* increment by 4 and store in pc */
+	swi	r15, r1, PT_R15
+	swi	r16, r1, PT_R16
+	swi	r17, r1, PT_R17
+	swi	r18, r1, PT_R18
+	swi	r19, r1, PT_R19
+	swi	r20, r1, PT_R20
+	swi	r21, r1, PT_R21
+	swi	r22, r1, PT_R22
+	swi	r23, r1, PT_R23
+	swi	r24, r1, PT_R24
+	swi	r25, r1, PT_R25
+	swi	r26, r1, PT_R26
+	swi	r27, r1, PT_R27
+	swi	r28, r1, PT_R28
+	swi	r29, r1, PT_R29
+	swi	r30, r1, PT_R30
+	swi	r31, r1, PT_R31
+
+	disable_irq
+	nop		/* make sure IE bit is in effect */
+	clear_bip	/* once IE is in effect it is safe to clear BIP */
+	nop
+
+	/* special purpose registers */
+	mfs	r11, rmsr
+	swi	r11, r1, PT_MSR
+	mfs	r11, rear
+	swi	r11, r1, PT_EAR
+	mfs	r11, resr
+	swi	r11, r1, PT_ESR
+	mfs	r11, rfsr
+	swi	r11, r1, PT_FSR
+	/* reload original stack pointer and save it */
+	lwi	r11, r0, PER_CPU(ENTRY_SP)
+	swi	r11, r1, PT_R1
+	/* update mode indicator we are in kernel mode */
+	addik	r11, r0, 1
+	swi	r11, r0, PER_CPU(KM)
+	/* restore r31 */
+	lwi	r31, r0, PER_CPU(CURRENT_SAVE)
+	/* re-enable interrupts now we are in kernel mode */
+	enable_irq
+
+	/* See if the system call number is valid. */
+	addi	r11, r12, -__NR_syscalls
+	bgei	r11, 1f			/* return to user if not valid */
+	/* Figure out which function to use for this system call. */
+	/* Note Microblaze barrel shift is optional, so don't rely on it */
+	add	r12, r12, r12			/* convert num -> ptr */
+	add	r12, r12, r12
+	lwi	r12, r12, sys_call_table	/* Get function pointer */
+	la	r15, r0, ret_to_user-8		/* set return address */
+	bra	r12				/* Make the system call. */
+	bri	0				/* won't reach here */
+1:
+	brid	ret_to_user			/* jump to syscall epilogue */
+	addi	r3, r0, -ENOSYS			/* set errno in delay slot */
+
+/*
+ * Debug traps are like a system call, but entered via brki r14, 0x60
+ * All we need to do is send the SIGTRAP signal to current, ptrace and do_signal
+ * will handle the rest
+ */
+ENTRY(_debug_exception)
+	swi	r1, r0, PER_CPU(ENTRY_SP)	/* save the current sp */
+	lwi	r1, r0, PER_CPU(CURRENT_SAVE)	/* get the saved current */
+	lwi	r1, r1, TS_THREAD_INFO		/* get the thread info */
+	addik	r1, r1, THREAD_SIZE - PT_SIZE	/* get the kernel stack */
+	swi	r11, r0, PER_CPU(R11_SAVE)	/* temporarily save r11 */
+	lwi	r11, r0, PER_CPU(KM)		/* load mode indicator */
+//save_context:
+	swi	r11, r1, PT_MODE	/* store the mode */
+	lwi	r11, r0, PER_CPU(R11_SAVE)	/* reload r11 */
+	/* save them on stack */
+	swi	r2, r1, PT_R2
+	swi	r3, r1, PT_R3 /* r3: _always_ in clobber list; see unistd.h */
+	swi	r4, r1, PT_R4 /* r4: _always_ in clobber list; see unistd.h */
+	swi	r5, r1, PT_R5
+	swi	r6, r1, PT_R6
+	swi	r7, r1, PT_R7
+	swi	r8, r1, PT_R8
+	swi	r9, r1, PT_R9
+	swi	r10, r1, PT_R10
+	swi	r11, r1, PT_R11
+	/* r12: _always_ in clobber list; see unistd.h */
+	swi	r12, r1, PT_R12
+	swi	r13, r1, PT_R13
+	/* r14: _always_ in clobber list; see unistd.h */
+	swi	r14, r1, PT_R14
+	swi	r14, r1, PT_PC /* Will return to interrupted instruction */
+	swi	r15, r1, PT_R15
+	swi	r16, r1, PT_R16
+	swi	r17, r1, PT_R17
+	swi	r18, r1, PT_R18
+	swi	r19, r1, PT_R19
+	swi	r20, r1, PT_R20
+	swi	r21, r1, PT_R21
+	swi	r22, r1, PT_R22
+	swi	r23, r1, PT_R23
+	swi	r24, r1, PT_R24
+	swi	r25, r1, PT_R25
+	swi	r26, r1, PT_R26
+	swi	r27, r1, PT_R27
+	swi	r28, r1, PT_R28
+	swi	r29, r1, PT_R29
+	swi	r30, r1, PT_R30
+	swi	r31, r1, PT_R31
+
+	disable_irq
+	nop		/* make sure IE bit is in effect */
+	clear_bip	/* once IE is in effect it is safe to clear BIP */
+	nop
+
+	/* special purpose registers */
+	mfs	r11, rmsr
+	swi	r11, r1, PT_MSR
+	mfs	r11, rear
+	swi	r11, r1, PT_EAR
+	mfs	r11, resr
+	swi	r11, r1, PT_ESR
+	mfs	r11, rfsr
+	swi	r11, r1, PT_FSR
+	/* reload original stack pointer and save it */
+	lwi	r11, r0, PER_CPU(ENTRY_SP)
+	swi	r11, r1, PT_R1
+	/* update mode indicator we are in kernel mode */
+	addik	r11, r0, 1
+	swi	r11, r0, PER_CPU(KM)
+	/* restore r31 */
+	lwi	r31, r0, PER_CPU(CURRENT_SAVE)
+	/* re-enable interrupts now we are in kernel mode */
+	enable_irq
+
+	addi	r5, r0, SIGTRAP			/* sending the trap signal */
+	add	r6, r0, r31			/* to current */
+	bralid	r15, send_sig
+	add	r7, r0, r0			/* 3rd param zero */
+
+	/* Restore r3/r4 to work around how ret_to_user works */
+	lwi	r3, r1, PT_R3
+	lwi	r4, r1, PT_R4
+	bri	ret_to_user
+
+ENTRY(_break)
+	bri	0
+
+/* struct task_struct *_switch_to(struct thread_info *prev,
+					struct thread_info *next); */
+ENTRY(_switch_to)
+	/* prepare return value */
+	addk	r3, r0, r31
+
+	/* save registers in cpu_context */
+	/* use r11 and r12, volatile registers, as temp register */
+	addik	r11, r5, TI_CPU_CONTEXT
+	swi	r1, r11, CC_R1
+	swi	r2, r11, CC_R2
+	/* skip volatile registers.
+	 * they are saved on stack when we jumped to _switch_to() */
+	/* dedicated registers */
+	swi	r13, r11, CC_R13
+	swi	r14, r11, CC_R14
+	swi	r15, r11, CC_R15
+	swi	r16, r11, CC_R16
+	swi	r17, r11, CC_R17
+	swi	r18, r11, CC_R18
+	/* save non-volatile registers */
+	swi	r19, r11, CC_R19
+	swi	r20, r11, CC_R20
+	swi	r21, r11, CC_R21
+	swi	r22, r11, CC_R22
+	swi	r23, r11, CC_R23
+	swi	r24, r11, CC_R24
+	swi	r25, r11, CC_R25
+	swi	r26, r11, CC_R26
+	swi	r27, r11, CC_R27
+	swi	r28, r11, CC_R28
+	swi	r29, r11, CC_R29
+	swi	r30, r11, CC_R30
+	/* special purpose registers */
+	mfs	r12, rmsr
+	swi	r12, r11, CC_MSR
+	mfs	r12, rear
+	swi	r12, r11, CC_EAR
+	mfs	r12, resr
+	swi	r12, r11, CC_ESR
+	mfs	r12, rfsr
+	swi	r12, r11, CC_FSR
+
+	/* update r31, the current */
+	lwi	r31, r6, TI_TASK
+	swi	r31, r0, PER_CPU(CURRENT_SAVE)
+
+	/* get new process' cpu context and restore */
+	addik	r11, r6, TI_CPU_CONTEXT
+
+	/* special purpose registers */
+	lwi	r12, r11, CC_FSR
+	mts	rfsr, r12
+	lwi	r12, r11, CC_ESR
+	mts	resr, r12
+	lwi	r12, r11, CC_EAR
+	mts	rear, r12
+	lwi	r12, r11, CC_MSR
+	mts	rmsr, r12
+	/* non-volatile registers */
+	lwi	r30, r11, CC_R30
+	lwi	r29, r11, CC_R29
+	lwi	r28, r11, CC_R28
+	lwi	r27, r11, CC_R27
+	lwi	r26, r11, CC_R26
+	lwi	r25, r11, CC_R25
+	lwi	r24, r11, CC_R24
+	lwi	r23, r11, CC_R23
+	lwi	r22, r11, CC_R22
+	lwi	r21, r11, CC_R21
+	lwi	r20, r11, CC_R20
+	lwi	r19, r11, CC_R19
+	/* dedicated registers */
+	lwi	r18, r11, CC_R18
+	lwi	r17, r11, CC_R17
+	lwi	r16, r11, CC_R16
+	lwi	r15, r11, CC_R15
+	lwi	r14, r11, CC_R14
+	lwi	r13, r11, CC_R13
+	/* skip volatile registers */
+	lwi	r2, r11, CC_R2
+	lwi	r1, r11, CC_R1
+
+	rtsd	r15, 8
+	nop
+
+ENTRY(ret_from_fork)
+	addk	r5, r0, r3
+	addk	r6, r0, r1
+	brlid	r15, schedule_tail
+	nop
+	swi	r31, r1, PT_R31		/* save r31 in user context. */
+			/* will soon be restored to r31 in ret_to_user */
+	addk	r3, r0, r0
+	brid	ret_to_user
+	nop
+
+work_pending:
+	andi	r11, r19, _TIF_NEED_RESCHED
+	beqi	r11, 1f
+	bralid	r15, schedule
+	nop
+1:	andi	r11, r19, _TIF_SIGPENDING
+	beqi	r11, no_work_pending
+	addk	r5, r1, r0
+	addik	r7, r0, 1
+	bralid	r15, do_signal
+	addk	r6, r0, r0
+	bri	no_work_pending
+
+ENTRY(ret_to_user)
+	disable_irq
+
+	swi	r4, r1, PT_R4		/* return val */
+	swi	r3, r1, PT_R3		/* return val */
+
+	lwi	r6, r31, TS_THREAD_INFO /* get thread info */
+	lwi	r19, r6, TI_FLAGS /* get flags in thread info */
+	bnei	r19, work_pending /* do an extra work if any bits are set */
+no_work_pending:
+	disable_irq
+
+	/* save r31 */
+	swi	r31, r0, PER_CPU(CURRENT_SAVE)
+	/* save mode indicator */
+	lwi	r18, r1, PT_MODE
+	swi	r18, r0, PER_CPU(KM)
+//restore_context:
+	/* special purpose registers */
+	lwi	r18, r1, PT_FSR
+	mts	rfsr, r18
+	lwi	r18, r1, PT_ESR
+	mts	resr, r18
+	lwi	r18, r1, PT_EAR
+	mts	rear, r18
+	lwi	r18, r1, PT_MSR
+	mts	rmsr, r18
+
+	lwi	r31, r1, PT_R31
+	lwi	r30, r1, PT_R30
+	lwi	r29, r1, PT_R29
+	lwi	r28, r1, PT_R28
+	lwi	r27, r1, PT_R27
+	lwi	r26, r1, PT_R26
+	lwi	r25, r1, PT_R25
+	lwi	r24, r1, PT_R24
+	lwi	r23, r1, PT_R23
+	lwi	r22, r1, PT_R22
+	lwi	r21, r1, PT_R21
+	lwi	r20, r1, PT_R20
+	lwi	r19, r1, PT_R19
+	lwi	r18, r1, PT_R18
+	lwi	r17, r1, PT_R17
+	lwi	r16, r1, PT_R16
+	lwi	r15, r1, PT_R15
+	lwi	r14, r1, PT_PC
+	lwi	r13, r1, PT_R13
+	lwi	r12, r1, PT_R12
+	lwi	r11, r1, PT_R11
+	lwi	r10, r1, PT_R10
+	lwi	r9, r1, PT_R9
+	lwi	r8, r1, PT_R8
+	lwi	r7, r1, PT_R7
+	lwi	r6, r1, PT_R6
+	lwi	r5, r1, PT_R5
+	lwi	r4, r1, PT_R4		/* return val */
+	lwi	r3, r1, PT_R3		/* return val */
+	lwi	r2, r1, PT_R2
+	lwi	r1, r1, PT_R1
+
+	rtid	r14, 0
+	nop
+
+sys_vfork_wrapper:
+	brid	sys_vfork
+	addk	r5, r1, r0
+
+sys_clone_wrapper:
+	brid	sys_clone
+	addk	r7, r1, r0
+
+sys_execve_wrapper:
+	brid	sys_execve
+	addk	r8, r1, r0
+
+sys_sigreturn_wrapper:
+	brid	sys_sigreturn
+	addk	r5, r1, r0
+
+sys_rt_sigreturn_wrapper:
+	brid	sys_rt_sigreturn
+	addk	r5, r1, r0
+
+sys_sigsuspend_wrapper:
+	brid	sys_rt_sigsuspend
+	addk	r6, r1, r0
+
+sys_rt_sigsuspend_wrapper:
+	brid	sys_rt_sigsuspend
+	addk	r7, r1, r0
+
+	/* Interrupt vector table */
+	.section	.init.ivt, "ax"
+	.org 0x0
+	brai	_reset
+	brai	_user_exception
+	brai	_interrupt
+	brai	_break
+	brai	_hw_exception_handler
+	.org 0x60
+	brai	_debug_exception
+
+.section .rodata,"a"
+#include "syscall_table.S"
+
+syscall_table_size=(.-sys_call_table)
arch/microblaze/kernel/head.S new file +55 -0

55 lines not on this page · raw message

arch/microblaze/kernel/syscall_table.S new file +365 -0

365 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#16 lore raw

PATCH 16/57 microblaze_v7: vmlinux.lds.S - linker script

From: Michal Simek <[email protected]>

---
 arch/microblaze/kernel/vmlinux.lds.S |  163 ++++++++++++++++++++++++++++++++++
 1 files changed, 163 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/vmlinux.lds.S
arch/microblaze/kernel/vmlinux.lds.S new file +163 -0
new file mode 100644
index 0000000..67c0e24
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2008 Michal Simek
+ * Copyright (C) 2008 PetaLogix
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+OUTPUT_FORMAT("elf32-microblaze", "elf32-microblaze", "elf32-microblaze")
+OUTPUT_ARCH(microblaze)
+ENTRY(_start)
+
+#include <asm-generic/vmlinux.lds.h>
+
+jiffies = jiffies_64 + 4;
+
+SECTIONS {
+	. = CONFIG_KERNEL_BASE_ADDR;
+
+	.text : {
+		_text = . ;
+		_stext = . ;
+        	*(.text .text.*)
+		*(.fixup)
+
+		*(.exitcall.exit)
+		SCHED_TEXT
+		LOCK_TEXT
+		KPROBES_TEXT
+		. = ALIGN (4) ;
+		_etext = . ;
+	}
+
+	. = ALIGN (4) ;
+	_fdt_start = . ; /* place for fdt blob */
+	. = . + 0x4000;
+	_fdt_end = . ;
+
+	. = ALIGN(16);
+	RODATA
+	. = ALIGN(16);
+	__ex_table : { 
+		__start___ex_table = .;
+		*(__ex_table) 
+		__stop___ex_table = .;
+	}
+
+	/*
+	 * sdata2 section can go anywhere, but must be word aligned
+	 * and SDA2_BASE must point to the middle of it
+	 */
+	.sdata2 : {
+		_ssrw = .;
+		. = ALIGN(4096); /* page aligned when MMU used - origin 0x8 */
+		*(.sdata2)
+	. = ALIGN(8);
+	_essrw = .;
+	_ssrw_size = _essrw - _ssrw;
+	_KERNEL_SDA2_BASE_ = _ssrw + (_ssrw_size / 2);
+	}
+
+	_sdata = . ;
+	.data ALIGN (4096) : { /* page aligned when MMU used - origin 0x4 */
+        	*(.data)
+	}
+	. = ALIGN(32);
+	.data.cacheline_aligned : { *(.data.cacheline_aligned) }
+	_edata = . ;
+
+	/* Reserve some low RAM for r0 based memory references */
+	. = ALIGN(0x4) ;
+	r0_ram = . ;
+	. = . +  4096;	/* a page should be enough */
+
+	/* The initial task */
+	. = ALIGN(8192);
+	.data.init_task : { *(.data.init_task) }
+
+	/* Under the microblaze ABI, .sdata and .sbss must be contiguous */
+	. = ALIGN(8);
+	.sdata : {
+		_ssro = .;
+		*(.sdata)
+	}
+
+	.sbss :	{
+		_ssbss = .;
+		*(.sbss)
+		_esbss = .;
+		_essro = .;
+		_ssro_size = _essro - _ssro ;
+		_KERNEL_SDA_BASE_ = _ssro + (_ssro_size / 2) ;
+	}
+
+	__init_begin = .;
+
+	. = ALIGN(4096);
+	.init.text : {
+		_sinittext = . ;
+		*(.init.text)
+		*(.exit.text)
+		*(.exit.data)
+		_einittext = .;
+	}
+
+	.init.data : { *(.init.data) }
+
+	. = ALIGN(4);
+	.init.ivt : {
+		__ivt_start = .;
+		*(.init.ivt)
+		__ivt_end = .;
+	}
+
+	.init.setup : {
+		__setup_start = .;
+		*(.init.setup)
+		__setup_end = .;
+	}
+
+	.initcall.init : {
+		__initcall_start = .;
+		INITCALLS
+		__initcall_end = .;
+	}
+
+	.con_initcall.init : {
+		__con_initcall_start = .;
+		*(.con_initcall.init)
+		__con_initcall_end = .;
+	}
+
+	__init_end_before_initramfs = .;
+
+	.init.ramfs ALIGN(4096) : {
+		__initramfs_start = .;
+		*(.init.ramfs)
+		__initramfs_end = .;
+		. = ALIGN(4);
+		LONG(0);
+/*
+ * FIXME this can break initramfs for MMU.
+ * Pad init.ramfs up to page boundary,
+ * so that __init_end == __bss_start. This will make image.elf
+ * consistent with the image.bin
+ */
+		/* . = ALIGN(4096); */
+	}
+	__init_end = .;
+
+	.bss ALIGN (4096) : { /* page aligned when MMU used */
+		__bss_start = . ;
+			*(.bss*)
+			*(COMMON)
+		. = ALIGN (4) ;
+		__bss_stop = . ;
+		_ebss = . ;
+	}
+	. = ALIGN(4096);
+	_end = .;
+}
Signature · 1 line
1.5.5.1
author maintainer
#21 lore raw

PATCH 21/57 microblaze_v7: heartbeat file

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/kernel/heartbeat.c |   66 ++++++++++++++++++++++++++++++++++++
 1 files changed, 66 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/heartbeat.c
arch/microblaze/kernel/heartbeat.c new file +66 -0
new file mode 100644
index 0000000..390bab7
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2007-2008 Michal Simek <[email protected]>
+ * Copyright (C) 2006 Atmark Techno, 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/sched.h>
+#include <linux/io.h>
+
+#include <asm/setup.h>
+#include <asm/page.h>
+#include <asm/prom.h>
+
+static unsigned int base_addr;
+
+void heartbeat(void)
+{
+	static unsigned int cnt, period, dist;
+
+	if (base_addr) {
+		if (cnt == 0 || cnt == dist)
+			out_be32(base_addr, 1);
+		else if (cnt == 7 || cnt == dist + 7)
+			out_be32(base_addr, 0);
+
+		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;
+		}
+	}
+}
+
+void setup_heartbeat(void)
+{
+	struct device_node *gpio = NULL;
+	int j;
+	char *gpio_list[] = {
+				"xlnx,xps-gpio-1.00.a",
+				"xlnx,opb-gpio-1.00.a",
+				NULL
+			};
+
+	for (j = 0; gpio_list[j] != NULL; j++) {
+		gpio = of_find_compatible_node(NULL, NULL, gpio_list[j]);
+		if (gpio)
+			break;
+	}
+
+	base_addr = *(int *) of_get_property(gpio, "reg", NULL);
+	base_addr = (unsigned long) ioremap(base_addr, PAGE_SIZE);
+	printk(KERN_NOTICE "Heartbeat GPIO at 0x%x\n", base_addr);
+
+	if (*(int *) of_get_property(gpio, "xlnx,is-bidir", NULL))
+		out_be32(base_addr + 4, 0); /* GPIO is configured as output */
+}
Signature · 1 line
1.5.5.1
author maintainer
#32 lore raw

PATCH 32/57 microblaze_v7: bug headers files

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/bug.h  |   15 +++++++++++++++
 arch/microblaze/include/asm/bugs.h |   17 +++++++++++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/bug.h
 create mode 100644 arch/microblaze/include/asm/bugs.h
arch/microblaze/include/asm/bug.h new file +15 -0
new file mode 100644
index 0000000..8eb2cdd
@@ -0,0 +1,15 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_BUG_H
+#define _ASM_MICROBLAZE_BUG_H
+
+#include <linux/kernel.h>
+#include <asm-generic/bug.h>
+
+#endif /* _ASM_MICROBLAZE_BUG_H */
arch/microblaze/include/asm/bugs.h new file +17 -0
new file mode 100644
index 0000000..f2c6593
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_BUGS_H
+#define _ASM_MICROBLAZE_BUGS_H
+
+static inline void check_bugs(void)
+{
+	/* nothing to do */
+}
+
+#endif /* _ASM_MICROBLAZE_BUGS_H */
Signature · 1 line
1.5.5.1
author maintainer
#19 lore raw

PATCH 19/57 microblaze_v7: early_printk support

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/kernel/early_printk.c |  106 +++++++++++++++++++++++++++++++++
 1 files changed, 106 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/early_printk.c
arch/microblaze/kernel/early_printk.c new file +106 -0
new file mode 100644
index 0000000..4e2083b
@@ -0,0 +1,106 @@
+/*
+ * Early printk support for Microblaze.
+ *
+ * Copyright (C) 2007-2008 Michal Simek <[email protected]>
+ * Copyright (C) 2003-2006 Yasushi SHOJI <[email protected]>
+ *
+ * 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/console.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/string.h>
+#include <linux/tty.h>
+#include <linux/io.h>
+#include <asm/processor.h>
+#include <linux/fcntl.h>
+#include <asm/setup.h>
+#include <asm/prom.h>
+
+static u32 early_console_initialized;
+static u32 base_addr;
+
+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;
+	/* read status bit - 0x8 offset */
+	while (retries-- && (in_be32(base_addr + 8) & (1 << 3)))
+		;
+
+	/* Only attempt the iowrite if we didn't timeout */
+	/* write to TX_FIFO - 0x4 offset */
+	if (retries)
+		out_be32(base_addr + 4, c & 0xff);
+}
+
+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,
+};
+
+static struct console *early_console = &early_serial_console;
+
+void early_printk(const char *fmt, ...)
+{
+	char buf[512];
+	int n;
+	va_list ap;
+
+	if (early_console_initialized) {
+		va_start(ap, fmt);
+		n = vscnprintf(buf, 512, fmt, ap);
+		early_console->write(early_console, buf, n);
+		va_end(ap);
+	}
+}
+
+int __init setup_early_printk(char *opt)
+{
+	if (early_console_initialized)
+		return 1;
+
+	base_addr = early_uartlite_console();
+	if (base_addr) {
+		early_console_initialized = 1;
+		early_printk("early_printk_console is enabled at 0x%08x\n",
+							base_addr);
+
+		/* register_console(early_console); */
+
+		return 0;
+	} else
+		return 1;
+}
+
+void __init disable_early_printk(void)
+{
+	if (!early_console_initialized || !early_console)
+		return;
+	printk(KERN_WARNING "disabling early console\n");
+	unregister_console(early_console);
+	early_console_initialized = 0;
+}
Signature · 1 line
1.5.5.1
author maintainer
#47 lore raw

PATCH 47/57 microblaze_v7: namei.h

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/namei.h |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/namei.h
arch/microblaze/include/asm/namei.h new file +22 -0
new file mode 100644
index 0000000..61d60b8
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_NAMEI_H
+#define _ASM_MICROBLAZE_NAMEI_H
+
+#ifdef __KERNEL__
+
+/* This dummy routine maybe changed to something useful
+ * for /usr/gnemul/ emulation stuff.
+ * Look at asm-sparc/namei.h for details.
+ */
+#define __emul_prefix() NULL
+
+#endif /* __KERNEL__ */
+
+#endif /* _ASM_MICROBLAZE_NAMEI_H */
Signature · 1 line
1.5.5.1
author maintainer
#28 lore raw

PATCH 28/57 microblaze_v7: traps support

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/kernel/traps.c |  105 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 105 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/traps.c
arch/microblaze/kernel/traps.c new file +105 -0
new file mode 100644
index 0000000..4863a57
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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/kallsyms.h>
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/debug_locks.h>
+
+#include <asm/exceptions.h>
+#include <asm/system.h>
+
+void trap_init(void)
+{
+	__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;
+
+static int __init kstack_setup(char *s)
+{
+	kstack_depth_to_print = simple_strtoul(s, NULL, 0);
+
+	return 1;
+}
+__setup("kstack=", kstack_setup);
+
+void show_trace(struct task_struct *task, unsigned long *stack)
+{
+	unsigned long addr;
+
+	if (!stack)
+		stack = (unsigned long *)&stack;
+
+	printk(KERN_NOTICE "Call Trace: ");
+#ifdef CONFIG_KALLSYMS
+	printk(KERN_NOTICE "\n");
+#endif
+	while (!kstack_end(stack)) {
+		addr = *stack++;
+		/*
+		 * If the address is either in the text segment of the
+		 * kernel, or in the region which contains vmalloc'ed
+		 * memory, it *may* be the address of a calling
+		 * routine; if so, print it so that someone tracing
+		 * down the cause of the crash will be able to figure
+		 * out the call path that was taken.
+		 */
+		if (kernel_text_address(addr))
+			print_ip_sym(addr);
+	}
+	printk(KERN_NOTICE "\n");
+
+	if (!task)
+		task = current;
+
+	debug_show_held_locks(task);
+}
+
+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.r1;
+		else
+			sp = (unsigned long *)&sp;
+	}
+
+	stack = sp;
+
+	printk(KERN_INFO "\nStack:\n  ");
+
+	for (i = 0; i < kstack_depth_to_print; i++) {
+		if (kstack_end(sp))
+			break;
+		if (i && ((i % 8) == 0))
+			printk("\n  ");
+		printk("%08lx ", *sp++);
+	}
+	printk("\n");
+	show_trace(task, stack);
+}
+
+void dump_stack(void)
+{
+	show_stack(NULL, NULL);
+}
+EXPORT_SYMBOL(dump_stack);
Signature · 1 line
1.5.5.1
author maintainer
#55 lore raw

PATCH 55/57 microblaze_v7: pci headers

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/pci-bridge.h |    1 +
 arch/microblaze/include/asm/pci.h        |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/pci-bridge.h
 create mode 100644 arch/microblaze/include/asm/pci.h
arch/microblaze/include/asm/pci-bridge.h new file +1 -0
new file mode 100644
index 0000000..7ad28f6
@@ -0,0 +1 @@
+#include <linux/pci.h>
arch/microblaze/include/asm/pci.h new file +1 -0
new file mode 100644
index 0000000..ca03794
@@ -0,0 +1 @@
+#include <linux/io.h>
Signature · 1 line
1.5.5.1
author maintainer
#54 lore raw

PATCH 54/57 microblaze_v7: Kbuild file

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/Kbuild |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/Kbuild
arch/microblaze/include/asm/Kbuild new file +26 -0
new file mode 100644
index 0000000..31820df
@@ -0,0 +1,26 @@
+include include/asm-generic/Kbuild.asm
+
+header-y += auxvec.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 += 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
+
+unifdef-y += cputable.h
+unifdef-y += elf.h
+unifdef-y += termios.h
Signature · 1 line
1.5.5.1
author maintainer
#45 lore raw

PATCH 45/57 microblaze_v7: sigcontext.h siginfo.h

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/sigcontext.h |   20 ++++++++++++++++++++
 arch/microblaze/include/asm/siginfo.h    |   15 +++++++++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/sigcontext.h
 create mode 100644 arch/microblaze/include/asm/siginfo.h
arch/microblaze/include/asm/sigcontext.h new file +20 -0
new file mode 100644
index 0000000..55873c8
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_SIGCONTEXT_H
+#define _ASM_MICROBLAZE_SIGCONTEXT_H
+
+/* FIXME should be linux/ptrace.h */
+#include <asm/ptrace.h>
+
+struct sigcontext {
+	struct pt_regs regs;
+	unsigned long oldmask;
+};
+
+#endif /* _ASM_MICROBLAZE_SIGCONTEXT_H */
arch/microblaze/include/asm/siginfo.h new file +15 -0
new file mode 100644
index 0000000..f162911
@@ -0,0 +1,15 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_SIGINFO_H
+#define _ASM_MICROBLAZE_SIGINFO_H
+
+#include <linux/types.h>
+#include <asm-generic/siginfo.h>
+
+#endif /* _ASM_MICROBLAZE_SIGINFO_H */
Signature · 1 line
1.5.5.1
author maintainer
#57 lore raw

PATCH 57/57 microblaze_v7: Uartlite for Microblaze

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 drivers/serial/Kconfig |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/serial/Kconfig +2 -2
index 7d7f576..131901b 100644
@@ -833,7 +833,7 @@ config SERIAL_IMX_CONSOLE
 
 config SERIAL_UARTLITE
 	tristate "Xilinx uartlite serial port support"
-	depends on PPC32
+	depends on PPC32 || MICROBLAZE
 	select SERIAL_CORE
 	help
 	  Say Y here if you want to use the Xilinx uartlite serial controller.
@@ -1319,7 +1319,7 @@ config SERIAL_NETX_CONSOLE
 
 config SERIAL_OF_PLATFORM
 	tristate "Serial port on Open Firmware platform bus"
-	depends on PPC_OF
+	depends on PPC_OF || MICROBLAZE
 	depends on SERIAL_8250 || SERIAL_OF_PLATFORM_NWPSERIAL
 	help
 	  If you have a PowerPC based system that has serial ports
Signature · 1 line
1.5.5.1
author maintainer
#25 lore raw

PATCH 25/57 microblaze_v7: delay.h, timex.h

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/delay.h |   72 +++++++++++++++++++++++++++++++++++
 arch/microblaze/include/asm/timex.h |   18 +++++++++
 2 files changed, 90 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/delay.h
 create mode 100644 arch/microblaze/include/asm/timex.h
arch/microblaze/include/asm/delay.h new file +72 -0
new file mode 100644
index 0000000..05b7d39
@@ -0,0 +1,72 @@
+/*
+ * include/asm-microblaze/delay.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
+ * Copyright (C) 2007 John Williams
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_DELAY_H
+#define _ASM_MICROBLAZE_DELAY_H
+
+extern inline void __delay(unsigned long loops)
+{
+	asm volatile ("# __delay		\n\t"		\
+			"1: addi	%0, %0, -1\t\n"		\
+			"bneid	%0, 1b		\t\n"		\
+			"nop			\t\n"
+			: "=r" (loops)
+			: "0" (loops));
+}
+
+/*
+ * Note that 19 * 226 == 4294 ==~ 2^32 / 10^6, so
+ * loops = (4294 * usecs * loops_per_jiffy * HZ) / 2^32.
+ *
+ * The mul instruction gives us loops = (a * b) / 2^32.
+ * We choose a = usecs * 19 * HZ and b = loops_per_jiffy * 226
+ * because this lets us support a wide range of HZ and
+ * loops_per_jiffy values without either a or b overflowing 2^32.
+ * Thus we need usecs * HZ <= (2^32 - 1) / 19 = 226050910 and
+ * loops_per_jiffy <= (2^32 - 1) / 226 = 19004280
+ * (which corresponds to ~3800 bogomips at HZ = 100).
+ * -- paulus
+ */
+#define __MAX_UDELAY	(226050910UL/HZ)	/* maximum udelay argument */
+#define __MAX_NDELAY	(4294967295UL/HZ)	/* maximum ndelay argument */
+
+extern unsigned long loops_per_jiffy;
+
+extern inline void __udelay(unsigned int x)
+{
+
+	unsigned long long tmp =
+		(unsigned long long)x * (unsigned long long)loops_per_jiffy \
+			* 226LL;
+	unsigned loops = tmp >> 32;
+
+/*
+	__asm__("mulxuu %0,%1,%2" : "=r" (loops) :
+		"r" (x), "r" (loops_per_jiffy * 226));
+*/
+	__delay(loops);
+}
+
+extern void __bad_udelay(void);		/* deliberately undefined */
+extern void __bad_ndelay(void);		/* deliberately undefined */
+
+#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() : __udelay((n) * HZ)) : \
+	__udelay((n) * HZ))
+
+#define muldiv(a, b, c)		(((a)*(b))/(c))
+
+#endif /* _ASM_MICROBLAZE_DELAY_H */
arch/microblaze/include/asm/timex.h new file +18 -0
new file mode 100644
index 0000000..678525d
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_TIMEX_H
+#define _ASM_MICROBLAZE_TIMEX_H
+
+#define CLOCK_TICK_RATE 1000 /* Timer input freq. */
+
+typedef unsigned long cycles_t;
+
+#define get_cycles()	(0)
+
+#endif /* _ASM_TIMEX_H */
Signature · 1 line
1.5.5.1
author maintainer
#43 lore raw

PATCH 43/57 microblaze_v7: stats headers

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/stat.h   |   73 ++++++++++++++++++++++++++++++++++
 arch/microblaze/include/asm/statfs.h |    1 +
 2 files changed, 74 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/stat.h
 create mode 100644 arch/microblaze/include/asm/statfs.h
arch/microblaze/include/asm/stat.h new file +73 -0
new file mode 100644
index 0000000..a4e148e
@@ -0,0 +1,73 @@
+/*
+ * Microblaze stat structure
+ *
+ * Copyright (C) 2001,02,03 NEC Electronics Corporation
+ * Copyright (C) 2001,02,03 Miles Bader <[email protected]>
+ *
+ * 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 <[email protected]>
+ */
+
+#ifndef _ASM_MICROBLAZE_STAT_H
+#define _ASM_MICROBLAZE_STAT_H
+
+#include <linux/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;
+	unsigned long	st_size;
+	unsigned long	st_blksize;
+	unsigned long	st_blocks;
+	unsigned long	st_atime;
+	unsigned long	__unused1; /* unsigned long  st_atime_nsec */ 
+	unsigned long	st_mtime;
+	unsigned long	__unused2; /* unsigned long  st_mtime_nsec */
+	unsigned long	st_ctime;
+	unsigned long	__unused3; /* unsigned long  st_ctime_nsec */
+	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; /* future possible st_blocks high bits */
+
+	unsigned long	st_atime;
+	unsigned long	st_atime_nsec;
+
+	unsigned long	st_mtime;
+	unsigned long	st_mtime_nsec;
+
+	unsigned long	st_ctime;
+	unsigned long	st_ctime_nsec;
+
+	unsigned long	__unused8;
+};
+
+#endif /* _ASM_MICROBLAZE_STAT_H */
arch/microblaze/include/asm/statfs.h new file +1 -0
new file mode 100644
index 0000000..0b91fe1
@@ -0,0 +1 @@
+#include <asm-generic/statfs.h>
Signature · 1 line
1.5.5.1
author maintainer
#31 lore raw

PATCH 31/57 microblaze_v7: includes SHM*, msgbuf

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/msgbuf.h   |   31 +++++++++++++++++++++++
 arch/microblaze/include/asm/shmbuf.h   |   42 ++++++++++++++++++++++++++++++++
 arch/microblaze/include/asm/shmparam.h |    6 ++++
 3 files changed, 79 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/msgbuf.h
 create mode 100644 arch/microblaze/include/asm/shmbuf.h
 create mode 100644 arch/microblaze/include/asm/shmparam.h
arch/microblaze/include/asm/msgbuf.h new file +31 -0
new file mode 100644
index 0000000..09dd970
@@ -0,0 +1,31 @@
+#ifndef _ASM_MICROBLAZE_MSGBUF_H
+#define _ASM_MICROBLAZE_MSGBUF_H
+
+/*
+ * The msqid64_ds structure for microblaze 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 /* _ASM_MICROBLAZE_MSGBUF_H */
arch/microblaze/include/asm/shmbuf.h new file +42 -0

42 lines not on this page · raw message

arch/microblaze/include/asm/shmparam.h new file +6 -0
new file mode 100644
index 0000000..9f5fc2b
@@ -0,0 +1,6 @@
+#ifndef _ASM_MICROBLAZE_SHMPARAM_H
+#define _ASM_MICROBLAZE_SHMPARAM_H
+
+#define SHMLBA	PAGE_SIZE /* attach addr a multiple of this */
+
+#endif /* _ASM_MICROBLAZE_SHMPARAM_H */
Signature · 1 line
1.5.5.1
author maintainer
#40 lore raw

PATCH 40/57 microblaze_v7: headers pgalloc.h pgtable.h

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/pgalloc.h |   14 ++++++++
 arch/microblaze/include/asm/pgtable.h |   54 +++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/pgalloc.h
 create mode 100644 arch/microblaze/include/asm/pgtable.h
arch/microblaze/include/asm/pgalloc.h new file +14 -0
new file mode 100644
index 0000000..2a4b354
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_PGALLOC_H
+#define _ASM_MICROBLAZE_PGALLOC_H
+
+#define check_pgt_cache()	do {} while (0)
+
+#endif /* _ASM_MICROBLAZE_PGALLOC_H */
arch/microblaze/include/asm/pgtable.h new file +54 -0

54 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#50 lore raw

PATCH 50/57 microblaze_v7: pool.h socket.h

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/poll.h   |    1 +
 arch/microblaze/include/asm/socket.h |   66 ++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/poll.h
 create mode 100644 arch/microblaze/include/asm/socket.h
arch/microblaze/include/asm/poll.h new file +1 -0
new file mode 100644
index 0000000..c98509d
@@ -0,0 +1 @@
+#include <asm-generic/poll.h>
arch/microblaze/include/asm/socket.h new file +66 -0

66 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#34 lore raw

PATCH 34/57 microblaze_v7: ioctl support

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/ioctl.h  |    1 +
 arch/microblaze/include/asm/ioctls.h |   91 ++++++++++++++++++++++++++++++++++
 2 files changed, 92 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/ioctl.h
 create mode 100644 arch/microblaze/include/asm/ioctls.h
arch/microblaze/include/asm/ioctl.h new file +1 -0
new file mode 100644
index 0000000..b279fe0
@@ -0,0 +1 @@
+#include <asm-generic/ioctl.h>
arch/microblaze/include/asm/ioctls.h new file +91 -0

91 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#56 lore raw

PATCH 56/57 microblaze_v7: syscalls.h

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/syscalls.h |   45 ++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/syscalls.h
arch/microblaze/include/asm/syscalls.h new file +45 -0
new file mode 100644
index 0000000..9cb4ff0
@@ -0,0 +1,45 @@
+#ifndef __ASM_MICROBLAZE_SYSCALLS_H
+#define __ASM_MICROBLAZE_SYSCALLS_H
+#ifdef __KERNEL__
+
+#include <linux/compiler.h>
+#include <linux/linkage.h>
+#include <linux/types.h>
+#include <linux/signal.h>
+
+/* FIXME will be removed */
+asmlinkage int sys_ipc(uint call, int first, int second,
+				int third, void *ptr, long fifth);
+
+struct pt_regs;
+asmlinkage int sys_vfork(struct pt_regs *regs);
+asmlinkage int sys_clone(int flags, unsigned long stack, struct pt_regs *regs);
+asmlinkage int sys_execve(char __user *filenamei, char __user *__user *argv,
+			char __user *__user *envp, struct pt_regs *regs);
+
+asmlinkage unsigned long sys_mmap2(unsigned long addr, size_t len,
+			unsigned long prot, unsigned long flags,
+			unsigned long fd, unsigned long pgoff);
+
+asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len,
+			unsigned long prot, unsigned long flags,
+			unsigned long fd, off_t offset);
+
+/* from signal.c */
+asmlinkage int sys_sigsuspend(old_sigset_t mask, struct pt_regs *regs);
+
+asmlinkage int sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize,
+		struct pt_regs *regs);
+
+asmlinkage int sys_sigaction(int sig, const struct old_sigaction *act,
+		struct old_sigaction *oact);
+
+asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
+		struct pt_regs *regs);
+
+asmlinkage int sys_sigreturn(struct pt_regs *regs);
+
+asmlinkage int sys_rt_sigreturn(struct pt_regs *regs);
+
+#endif /* __KERNEL__ */
+#endif /* __ASM_MICROBLAZE_SYSCALLS_H */
Signature · 1 line
1.5.5.1
author maintainer
#51 lore raw

PATCH 51/57 microblaze_v7: fcntl.h sockios.h ucontext.h

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/fcntl.h    |    1 +
 arch/microblaze/include/asm/sockios.h  |   23 +++++++++++++++++++++++
 arch/microblaze/include/asm/ucontext.h |   22 ++++++++++++++++++++++
 3 files changed, 46 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/fcntl.h
 create mode 100644 arch/microblaze/include/asm/sockios.h
 create mode 100644 arch/microblaze/include/asm/ucontext.h
arch/microblaze/include/asm/fcntl.h new file +1 -0
new file mode 100644
index 0000000..46ab12d
@@ -0,0 +1 @@
+#include <asm-generic/fcntl.h>
arch/microblaze/include/asm/sockios.h new file +23 -0
new file mode 100644
index 0000000..9fff57a
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_SOCKIOS_H
+#define _ASM_MICROBLAZE_SOCKIOS_H
+
+#include <linux/ioctl.h>
+
+/* Socket-level I/O control calls. */
+#define FIOSETOWN	0x8901
+#define SIOCSPGRP	0x8902
+#define FIOGETOWN	0x8903
+#define SIOCGPGRP	0x8904
+#define SIOCATMARK	0x8905
+#define SIOCGSTAMP	0x8906		/* Get stamp (timeval) */
+#define SIOCGSTAMPNS	0x8907		/* Get stamp (timespec) */
+
+#endif /* _ASM_MICROBLAZE_SOCKIOS_H */
arch/microblaze/include/asm/ucontext.h new file +22 -0
new file mode 100644
index 0000000..11f6bb3
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_UCONTEXT_H
+#define _ASM_MICROBLAZE_UCONTEXT_H
+
+#include <asm/sigcontext.h>
+
+struct ucontext {
+	unsigned long		uc_flags;
+	struct ucontext		*uc_link;
+	stack_t			uc_stack;
+	struct sigcontext	uc_mcontext;
+	sigset_t		uc_sigmask; /* mask last for extensibility */
+};
+
+#endif /* _ASM_MICROBLAZE_UCONTEXT_H */
Signature · 1 line
1.5.5.1
author maintainer
#42 lore raw

PATCH 42/57 microblaze_v7: clinkage.h linkage.h sections.h kmap_types.h

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/clinkage.h   |    1 +
 arch/microblaze/include/asm/kmap_types.h |   29 +++++++++++++++++++++++++++++
 arch/microblaze/include/asm/linkage.h    |   15 +++++++++++++++
 arch/microblaze/include/asm/sections.h   |   25 +++++++++++++++++++++++++
 4 files changed, 70 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/clinkage.h
 create mode 100644 arch/microblaze/include/asm/kmap_types.h
 create mode 100644 arch/microblaze/include/asm/linkage.h
 create mode 100644 arch/microblaze/include/asm/sections.h
arch/microblaze/include/asm/clinkage.h new file +1 -0
new file mode 100644
index 0000000..9e21843
@@ -0,0 +1 @@
+#include <linux/linkage.h>
arch/microblaze/include/asm/kmap_types.h new file +29 -0
new file mode 100644
index 0000000..4d7e222
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_KMAP_TYPES_H
+#define _ASM_MICROBLAZE_KMAP_TYPES_H
+
+enum km_type {
+	KM_BOUNCE_READ,
+	KM_SKB_SUNRPC_DATA,
+	KM_SKB_DATA_SOFTIRQ,
+	KM_USER0,
+	KM_USER1,
+	KM_BIO_SRC_IRQ,
+	KM_BIO_DST_IRQ,
+	KM_PTE0,
+	KM_PTE1,
+	KM_IRQ0,
+	KM_IRQ1,
+	KM_SOFTIRQ0,
+	KM_SOFTIRQ1,
+	KM_TYPE_NR,
+};
+
+#endif /* _ASM_MICROBLAZE_KMAP_TYPES_H */
arch/microblaze/include/asm/linkage.h new file +15 -0
new file mode 100644
index 0000000..3a8e36d
@@ -0,0 +1,15 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_LINKAGE_H
+#define _ASM_MICROBLAZE_LINKAGE_H
+
+#define __ALIGN		.align 4
+#define __ALIGN_STR	".align 4"
+
+#endif /* _ASM_MICROBLAZE_LINKAGE_H */
arch/microblaze/include/asm/sections.h new file +25 -0
new file mode 100644
index 0000000..8434a43
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_SECTIONS_H
+#define _ASM_MICROBLAZE_SECTIONS_H
+
+#include <asm-generic/sections.h>
+
+# ifndef __ASSEMBLY__
+extern char _ssbss[], _esbss[];
+extern unsigned long __ivt_start[], __ivt_end[];
+
+#  ifdef CONFIG_MTD_UCLINUX
+extern char *_ebss;
+#  endif
+
+extern u32 _fdt_start[], _fdt_end[];
+
+# endif /* !__ASSEMBLY__ */
+#endif /* _ASM_MICROBLAZE_SECTIONS_H */
Signature · 1 line
1.5.5.1
author maintainer
#49 lore raw

PATCH 49/57 microblaze_v7: device.h param.h topology.h

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/device.h   |   21 +++++++++++++++++++++
 arch/microblaze/include/asm/param.h    |   30 ++++++++++++++++++++++++++++++
 arch/microblaze/include/asm/topology.h |   11 +++++++++++
 3 files changed, 62 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/device.h
 create mode 100644 arch/microblaze/include/asm/param.h
 create mode 100644 arch/microblaze/include/asm/topology.h
arch/microblaze/include/asm/device.h new file +21 -0
new file mode 100644
index 0000000..c042830
@@ -0,0 +1,21 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License v2. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#ifndef _ASM_MICROBLAZE_DEVICE_H
+#define _ASM_MICROBLAZE_DEVICE_H
+
+struct device_node;
+
+struct dev_archdata {
+	/* Optional pointer to an OF device node */
+	struct device_node	*of_node;
+};
+
+#endif /* _ASM_MICROBLAZE_DEVICE_H */
+
+
arch/microblaze/include/asm/param.h new file +30 -0
new file mode 100644
index 0000000..8c538a4
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_PARAM_H
+#define _ASM_MICROBLAZE_PARAM_H
+
+#ifdef __KERNEL__
+#define HZ		CONFIG_HZ	/* internal kernel timer frequency */
+#define USER_HZ		100		/* for user interfaces in "ticks" */
+#define CLOCKS_PER_SEC	(USER_HZ)	/* frequency at which times() counts */
+#endif /* __KERNEL__ */
+
+#ifndef HZ
+#define HZ 100
+#endif
+
+#define EXEC_PAGESIZE	4096
+
+#ifndef NOGROUP
+#define NOGROUP		(-1)
+#endif
+
+#define MAXHOSTNAMELEN	64	/* max length of hostname */
+
+#endif /* _ASM_MICROBLAZE_PARAM_H */
arch/microblaze/include/asm/topology.h new file +11 -0
new file mode 100644
index 0000000..96bcea5
@@ -0,0 +1,11 @@
+#include <asm-generic/topology.h>
+
+#ifndef _ASM_MICROBLAZE_TOPOLOGY_H
+#define _ASM_MICROBLAZE_TOPOLOGY_H
+
+struct device_node;
+static inline int of_node_to_nid(struct device_node *device)
+{
+	return 0;
+}
+#endif /* _ASM_MICROBLAZE_TOPOLOGY_H */
Signature · 1 line
1.5.5.1
author maintainer
#33 lore raw

PATCH 33/57 microblaze_v7: definitions of types

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/posix_types.h |   69 +++++++++++++++++++++++++++++
 arch/microblaze/include/asm/types.h       |   38 ++++++++++++++++
 2 files changed, 107 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/posix_types.h
 create mode 100644 arch/microblaze/include/asm/types.h
arch/microblaze/include/asm/posix_types.h new file +69 -0
new file mode 100644
index 0000000..c858eb7
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#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 int	__kernel_mode_t;
+typedef unsigned int	__kernel_nlink_t;
+typedef long		__kernel_off_t;
+typedef int		__kernel_pid_t;
+typedef unsigned int	__kernel_ipc_pid_t;
+typedef unsigned int	__kernel_uid_t;
+typedef unsigned int	__kernel_gid_t;
+typedef unsigned long	__kernel_size_t;
+typedef long		__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;
+
+#ifdef __GNUC__
+typedef long long	__kernel_loff_t;
+#endif
+
+typedef struct {
+#if defined(__KERNEL__) || defined(__USE_ALL)
+	int	val[2];
+#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
+	int	__val[2];
+#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
+} __kernel_fsid_t;
+
+#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
+
+#undef	__FD_SET
+#define	__FD_SET(d, set)	((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
+
+#undef	__FD_CLR
+#define	__FD_CLR(d, set)	((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
+
+#undef	__FD_ISSET
+#define	__FD_ISSET(d, set)	(!!((set)->fds_bits[__FDELT(d)] & __FDMASK(d)))
+
+#undef	__FD_ZERO
+#define __FD_ZERO(fdsetp) (memset(fdsetp, 0, sizeof(*(fd_set *)fdsetp)))
+
+#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
+
+#endif /* _ASM_MICROBLAZE_POSIX_TYPES_H */
arch/microblaze/include/asm/types.h new file +38 -0
new file mode 100644
index 0000000..bebc018
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_TYPES_H
+#define _ASM_MICROBLAZE_TYPES_H
+
+/*
+ * This file is never included by application software unless
+ * explicitly requested (e.g., via linux/types.h) in which case the
+ * application is Linux specific so (user-) name space pollution is
+ * not a major issue.  However, for interoperability, libraries still
+ * need to be careful to avoid a name clashes.
+ */
+
+#include <asm-generic/int-ll64.h>
+
+# ifndef __ASSEMBLY__
+
+typedef unsigned short umode_t;
+
+/*
+ * These aren't exported outside the kernel to avoid name space clashes
+ */
+#  ifdef __KERNEL__
+#  define BITS_PER_LONG 32
+
+/* Dma addresses are 32-bits wide. */
+
+typedef u32 dma_addr_t;
+
+#  endif/* __KERNEL__ */
+# endif /* __ASSEMBLY__ */
+#endif /* _ASM_MICROBLAZE_TYPES_H */
Signature · 1 line
1.5.5.1
author maintainer
#36 lore raw

PATCH 36/57 microblaze_v7: headers for executables format FLAT, ELF

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/elf.h  |   30 ++++++++++++
 arch/microblaze/include/asm/flat.h |   90 ++++++++++++++++++++++++++++++++++++
 2 files changed, 120 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/elf.h
 create mode 100644 arch/microblaze/include/asm/flat.h
arch/microblaze/include/asm/elf.h new file +30 -0
new file mode 100644
index 0000000..81337f2
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_ELF_H
+#define _ASM_MICROBLAZE_ELF_H
+
+/*
+ * Note there is no "official" ELF designation for Microblaze.
+ * I've snaffled the value from the microblaze binutils source code
+ * /binutils/microblaze/include/elf/microblaze.h
+ */
+#define EM_XILINX_MICROBLAZE	0xbaab
+#define ELF_ARCH		EM_XILINX_MICROBLAZE
+
+/*
+ * This is used to ensure we don't load something for the wrong architecture.
+ */
+#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 */
arch/microblaze/include/asm/flat.h new file +90 -0

90 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#23 lore raw

PATCH 23/57 microblaze_v7: asm-offsets

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/kernel/asm-offsets.c |  115 ++++++++++++++++++++++++++++++++++
 1 files changed, 115 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/asm-offsets.c
arch/microblaze/kernel/asm-offsets.c new file +115 -0
new file mode 100644
index 0000000..799283a
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2007 PetaLogix
+ * Copyright (C) 2006 Atmark Techno, 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/init.h>
+#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>
+#include <linux/kbuild.h>
+
+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, offsetof(struct pt_regs, r11));
+	DEFINE(PT_R12, offsetof(struct pt_regs, r12));
+	DEFINE(PT_R13, offsetof(struct pt_regs, r13));
+	DEFINE(PT_R14, offsetof(struct pt_regs, r14));
+	DEFINE(PT_R15, offsetof(struct pt_regs, r15));
+	DEFINE(PT_R16, offsetof(struct pt_regs, r16));
+	DEFINE(PT_R17, offsetof(struct pt_regs, r17));
+	DEFINE(PT_R18, offsetof(struct pt_regs, r18));
+	DEFINE(PT_R19, offsetof(struct pt_regs, r19));
+	DEFINE(PT_R20, offsetof(struct pt_regs, r20));
+	DEFINE(PT_R21, offsetof(struct pt_regs, r21));
+	DEFINE(PT_R22, offsetof(struct pt_regs, r22));
+	DEFINE(PT_R23, offsetof(struct pt_regs, r23));
+	DEFINE(PT_R24, offsetof(struct pt_regs, r24));
+	DEFINE(PT_R25, offsetof(struct pt_regs, r25));
+	DEFINE(PT_R26, offsetof(struct pt_regs, r26));
+	DEFINE(PT_R27, offsetof(struct pt_regs, r27));
+	DEFINE(PT_R28, offsetof(struct pt_regs, r28));
+	DEFINE(PT_R29, offsetof(struct pt_regs, r29));
+	DEFINE(PT_R30, offsetof(struct pt_regs, r30));
+	DEFINE(PT_R31, offsetof(struct pt_regs, r31));
+	DEFINE(PT_MODE, offsetof(struct pt_regs, kernel_mode));
+	BLANK();
+
+	/* Magic offsets for PTRACE PEEK/POKE etc */
+	DEFINE(PT_TEXT_ADDR, sizeof(struct pt_regs) + 1);
+	DEFINE(PT_TEXT_LEN, sizeof(struct pt_regs) + 2);
+	DEFINE(PT_DATA_ADDR, sizeof(struct pt_regs) + 3);
+	BLANK();
+
+	/* struct task_struct */
+	DEFINE(TS_THREAD_INFO, offsetof(struct task_struct, stack));
+
+	/* struct thread_info */
+	DEFINE(TI_TASK, offsetof(struct thread_info, task));
+	DEFINE(TI_EXEC_DOMAIN, offsetof(struct thread_info, exec_domain));
+	DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
+	DEFINE(TI_STATUS, offsetof(struct thread_info, status));
+	DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
+	DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count));
+	DEFINE(TI_ADDR_LIMIT, offsetof(struct thread_info, addr_limit));
+	DEFINE(TI_RESTART_BLOCK, offsetof(struct thread_info, restart_block));
+	DEFINE(TI_CPU_CONTEXT, offsetof(struct thread_info, cpu_context));
+	BLANK();
+
+	/* struct cpu_context */
+	DEFINE(CC_R1, offsetof(struct cpu_context, r1)); /* r1 */
+	DEFINE(CC_R2, offsetof(struct cpu_context, r2));
+	/* dedicated registers */
+	DEFINE(CC_R13, offsetof(struct cpu_context, r13));
+	DEFINE(CC_R14, offsetof(struct cpu_context, r14));
+	DEFINE(CC_R15, offsetof(struct cpu_context, r15));
+	DEFINE(CC_R16, offsetof(struct cpu_context, r16));
+	DEFINE(CC_R17, offsetof(struct cpu_context, r17));
+	DEFINE(CC_R18, offsetof(struct cpu_context, r18));
+	/* non-volatile registers */
+	DEFINE(CC_R19, offsetof(struct cpu_context, r19));
+	DEFINE(CC_R20, offsetof(struct cpu_context, r20));
+	DEFINE(CC_R21, offsetof(struct cpu_context, r21));
+	DEFINE(CC_R22, offsetof(struct cpu_context, r22));
+	DEFINE(CC_R23, offsetof(struct cpu_context, r23));
+	DEFINE(CC_R24, offsetof(struct cpu_context, r24));
+	DEFINE(CC_R25, offsetof(struct cpu_context, r25));
+	DEFINE(CC_R26, offsetof(struct cpu_context, r26));
+	DEFINE(CC_R27, offsetof(struct cpu_context, r27));
+	DEFINE(CC_R28, offsetof(struct cpu_context, r28));
+	DEFINE(CC_R29, offsetof(struct cpu_context, r29));
+	DEFINE(CC_R30, offsetof(struct cpu_context, r30));
+	/* special purpose registers */
+	DEFINE(CC_MSR, offsetof(struct cpu_context, msr));
+	DEFINE(CC_EAR, offsetof(struct cpu_context, ear));
+	DEFINE(CC_ESR, offsetof(struct cpu_context, esr));
+	DEFINE(CC_FSR, offsetof(struct cpu_context, fsr));
+	BLANK();
+
+	return 0;
+}
Signature · 1 line
1.5.5.1
author maintainer
#20 lore raw

PATCH 20/57 microblaze_v7: uaccess files

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/uaccess.h |  134 +++++++++++++++++++++++++++++++++
 arch/microblaze/lib/uaccess.c         |   41 ++++++++++
 2 files changed, 175 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/uaccess.h
 create mode 100644 arch/microblaze/lib/uaccess.c
arch/microblaze/include/asm/uaccess.h new file +134 -0
new file mode 100644
index 0000000..5a3ffc3
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_UACCESS_H
+#define _ASM_MICROBLAZE_UACCESS_H
+
+#ifdef __KERNEL__
+#ifndef __ASSEMBLY__
+
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/sched.h> /* RLIMIT_FSIZE */
+#include <linux/mm.h>
+
+#include <asm/mmu.h>
+#include <asm/page.h>
+#include <asm/pgtable.h>
+#include <asm/segment.h>
+#include <linux/string.h>
+
+#define VERIFY_READ	0
+#define VERIFY_WRITE	1
+
+extern int ___range_ok(unsigned long addr, unsigned long size);
+
+#define __range_ok(addr, size) \
+		___range_ok((unsigned long)(addr), (unsigned long)(size))
+
+#define access_ok(type, addr, size) (__range_ok((addr), (size)) == 0)
+#define __access_ok(add, size) (__range_ok((addr), (size)) == 0)
+
+extern inline int bad_user_access_length(void)
+{
+	return 0;
+}
+/* FIXME this is function for optimalization -> memcpy */
+#define __get_user(var, ptr)					\
+	({							\
+		int __gu_err = 0;				\
+		switch (sizeof(*(ptr))) {			\
+		case 1:						\
+		case 2:						\
+		case 4:						\
+			(var) = *(ptr);				\
+			break;					\
+		case 8:						\
+			memcpy((void *) &(var), (ptr), 8);	\
+			break;					\
+		default:					\
+			(var) = 0;				\
+			__gu_err = __get_user_bad();		\
+			break;					\
+		}						\
+		__gu_err;					\
+	})
+
+#define __get_user_bad()	(bad_user_access_length(), (-EFAULT))
+
+#define __put_user(var, ptr)					\
+	({							\
+		int __pu_err = 0;				\
+		switch (sizeof(*(ptr))) {			\
+		case 1:						\
+		case 2:						\
+		case 4:						\
+			*(ptr) = (var);				\
+			break;					\
+		case 8: {					\
+			typeof(*(ptr)) __pu_val = var;		\
+			memcpy(ptr, &__pu_val, sizeof(__pu_val));\
+			}					\
+			break;					\
+		default:					\
+			__pu_err = __put_user_bad();		\
+			break;					\
+		}							\
+		__pu_err;						\
+	})
+
+#define __put_user_bad()	(bad_user_access_length(), (-EFAULT))
+
+#define put_user(x, ptr)	__put_user(x, ptr)
+#define get_user(x, ptr)	__get_user(x, ptr)
+
+#define copy_to_user(to, from, n)		(memcpy(to, from, n), 0)
+#define copy_from_user(to, from, n)		(memcpy(to, from, n), 0)
+
+#define __copy_to_user(to, from, n)		(copy_to_user(to, from, n))
+#define __copy_from_user(to, from, n)		(copy_from_user(to, from, n))
+#define __copy_to_user_inatomic(to, from, n)	(__copy_to_user(to, from, n))
+#define __copy_from_user_inatomic(to, from, n)	(__copy_from_user(to, from, n))
+
+#define __clear_user(addr, n)	(memset((void *)addr, 0, n), 0)
+
+static inline unsigned long clear_user(void *addr, unsigned long size)
+{
+	if (access_ok(VERIFY_WRITE, addr, size))
+		size = __clear_user(addr, size);
+	return size;
+}
+
+/* Returns 0 if exception not found and fixup otherwise. */
+extern unsigned long search_exception_table(unsigned long);
+
+
+extern long strncpy_from_user(char *dst, const char __user *src, long count);
+extern long strnlen_user(const char __user *src, long count);
+extern long __strncpy_from_user(char *dst, const char __user *src, long count);
+
+/*
+ * The exception table consists of pairs of addresses: the first is the
+ * address of an instruction that is allowed to fault, and the second is
+ * the address at which the program should continue. No registers are
+ * modified, so it is entirely up to the continuation code to figure out
+ * what to do.
+ *
+ * All the routines below use bits of fixup code that are out of line
+ * with the main instruction path. This means when everything is well,
+ * we don't even have to jump over them. Further, they do not intrude
+ * on our cache or tlb entries.
+ */
+struct exception_table_entry {
+	unsigned long insn, fixup;
+};
+
+#endif  /* __ASSEMBLY__ */
+#endif /* __KERNEL__ */
+
+#endif /* _ASM_MICROBLAZE_UACCESS_H */
arch/microblaze/lib/uaccess.c new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#38 lore raw

PATCH 38/57 microblaze_v7: headers for irq

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/hardirq.h  |   29 ++++++++
 arch/microblaze/include/asm/irq_regs.h |    1 +
 arch/microblaze/include/asm/irqflags.h |  123 ++++++++++++++++++++++++++++++++
 3 files changed, 153 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/hardirq.h
 create mode 100644 arch/microblaze/include/asm/hw_irq.h
 create mode 100644 arch/microblaze/include/asm/irq_regs.h
 create mode 100644 arch/microblaze/include/asm/irqflags.h
arch/microblaze/include/asm/hardirq.h new file +29 -0
new file mode 100644
index 0000000..0f2d6b0
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#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 <linux/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 */
arch/microblaze/include/asm/hw_irq.h new file +0 -0
new file mode 100644
index 0000000..e69de29
arch/microblaze/include/asm/irq_regs.h new file +1 -0
new file mode 100644
index 0000000..3dd9c0b
@@ -0,0 +1 @@
+#include <asm-generic/irq_regs.h>
arch/microblaze/include/asm/irqflags.h new file +123 -0

123 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#24 lore raw

PATCH 24/57 microblaze_v7: process and init task function

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/kernel/init_task.c |   27 +++++
 arch/microblaze/kernel/process.c   |  185 ++++++++++++++++++++++++++++++++++++
 2 files changed, 212 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/init_task.c
 create mode 100644 arch/microblaze/kernel/process.c
arch/microblaze/kernel/init_task.c new file +27 -0
new file mode 100644
index 0000000..1abdfdb
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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/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 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);
arch/microblaze/kernel/process.c new file +185 -0

185 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#37 lore raw

PATCH 37/57 microblaze_v7: dma support

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/dma-mapping.h |  131 +++++++++++++++++++++++++++++
 arch/microblaze/include/asm/dma.h         |   16 ++++
 arch/microblaze/include/asm/scatterlist.h |   28 ++++++
 3 files changed, 175 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/dma-mapping.h
 create mode 100644 arch/microblaze/include/asm/dma.h
 create mode 100644 arch/microblaze/include/asm/scatterlist.h
arch/microblaze/include/asm/dma-mapping.h new file +131 -0
new file mode 100644
index 0000000..e6f1246
@@ -0,0 +1,131 @@
+/*
+ * 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) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_DMA_MAPPING_H
+#define _ASM_MICROBLAZE_DMA_MAPPING_H
+
+#include <asm/cacheflush.h>
+#include <linux/io.h>
+#include <linux/bug.h>
+
+struct scatterlist;
+
+#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
+#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
+
+/* FIXME */
+static inline int
+dma_supported(struct device *dev, u64 mask)
+{
+	return 1;
+}
+
+static inline dma_addr_t
+dma_map_page(struct device *dev, struct page *page,
+	unsigned long offset, size_t size,
+	enum dma_data_direction direction)
+{
+	BUG();
+	return 0;
+}
+
+static inline void
+dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
+	enum dma_data_direction direction)
+{
+	BUG();
+}
+
+static inline int
+dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
+	enum dma_data_direction direction)
+{
+	BUG();
+	return 0;
+}
+
+static inline void
+dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
+	enum dma_data_direction direction)
+{
+	BUG();
+}
+
+static inline void
+dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
+			enum dma_data_direction direction)
+{
+	BUG();
+}
+
+static inline void
+dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
+		size_t size, enum dma_data_direction direction)
+{
+	BUG();
+}
+
+static inline void
+dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
+		enum dma_data_direction direction)
+{
+	BUG();
+}
+
+static inline void
+dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
+		enum dma_data_direction direction)
+{
+	BUG();
+}
+
+static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
+{
+	return 0;
+}
+
+static inline void *dma_alloc_coherent(struct device *dev, size_t size,
+				dma_addr_t *dma_handle, int flag)
+{
+	return NULL; /* consistent_alloc(flag, size, dma_handle); */
+}
+
+static inline void dma_free_coherent(struct device *dev, size_t size,
+			void *vaddr, dma_addr_t dma_handle)
+{
+	BUG();
+}
+
+static inline dma_addr_t
+dma_map_single(struct device *dev, void *ptr, size_t size,
+	enum dma_data_direction direction)
+{
+	BUG_ON(direction == DMA_NONE);
+
+	return virt_to_bus(ptr);
+}
+
+static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
+				    size_t size,
+				    enum dma_data_direction direction)
+{
+	switch (direction) {
+	case DMA_FROM_DEVICE:
+		flush_dcache_range((unsigned)dma_addr,
+			(unsigned)dma_addr + size);
+			/* Fall through */
+	case DMA_TO_DEVICE:
+		break;
+	default:
+		BUG();
+	}
+}
+
+#endif /* _ASM_MICROBLAZE_DMA_MAPPING_H */
arch/microblaze/include/asm/dma.h new file +16 -0
new file mode 100644
index 0000000..0967fa0
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#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)
+
+#endif /* _ASM_MICROBLAZE_DMA_H */
arch/microblaze/include/asm/scatterlist.h new file +28 -0
new file mode 100644
index 0000000..08ff1d0
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2008 Michal Simek <[email protected]>
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_SCATTERLIST_H
+#define _ASM_MICROBLAZE_SCATTERLIST_H
+
+struct scatterlist {
+#ifdef CONFIG_DEBUG_SG
+	unsigned long	sg_magic;
+#endif
+	unsigned long	page_link;
+	dma_addr_t	dma_address;
+	unsigned int	offset;
+	unsigned int	length;
+};
+
+#define sg_dma_address(sg)      ((sg)->dma_address)
+#define sg_dma_len(sg)          ((sg)->length)
+
+#define ISA_DMA_THRESHOLD (~0UL)
+
+#endif /* _ASM_MICROBLAZE_SCATTERLIST_H */
Signature · 1 line
1.5.5.1
author maintainer
#39 lore raw

PATCH 39/57 microblaze_v7: atomic.h bitops.h swab.h byteorder.h

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/atomic.h    |  123 +++++++++++++++++++++++++++++++
 arch/microblaze/include/asm/bitops.h    |   27 +++++++
 arch/microblaze/include/asm/byteorder.h |    6 ++
 arch/microblaze/include/asm/swab.h      |    8 ++
 4 files changed, 164 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/atomic.h
 create mode 100644 arch/microblaze/include/asm/bitops.h
 create mode 100644 arch/microblaze/include/asm/byteorder.h
 create mode 100644 arch/microblaze/include/asm/swab.h
arch/microblaze/include/asm/atomic.h new file +123 -0
new file mode 100644
index 0000000..a448d94
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_ATOMIC_H
+#define _ASM_MICROBLAZE_ATOMIC_H
+
+#include <linux/types.h>
+#include <linux/compiler.h> /* likely */
+#include <asm/system.h> /* local_irq_XXX and friends */
+
+#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 ret;
+	unsigned long flags;
+
+	local_irq_save(flags);
+	ret = v->counter;
+	if (likely(ret == old))
+		v->counter = new;
+	local_irq_restore(flags);
+
+	return ret;
+}
+
+static inline int atomic_add_unless(atomic_t *v, int a, int u)
+{
+	int c, old;
+
+	c = atomic_read(v);
+	while (c != u && (old = atomic_cmpxchg((v), c, c + a)) != c)
+		c = old;
+	return c != u;
+}
+
+static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
+{
+	unsigned long flags;
+
+	local_irq_save(flags);
+	*addr &= ~mask;
+	local_irq_restore(flags);
+}
+
+/**
+ * atomic_add_return - add and return
+ * @i: integer value to add
+ * @v: pointer of type atomic_t
+ *
+ * Atomically adds @i to @v and returns @i + @v
+ */
+static inline int atomic_add_return(int i, atomic_t *v)
+{
+	unsigned long flags;
+	int val;
+
+	local_irq_save(flags);
+	val = v->counter;
+	v->counter = val += i;
+	local_irq_restore(flags);
+
+	return val;
+}
+
+static inline int atomic_sub_return(int i, atomic_t *v)
+{
+	return atomic_add_return(-i, v);
+}
+
+/*
+ * Atomically test *v and decrement if it is greater than 0.
+ * The function returns the old value of *v minus 1.
+ */
+static inline int atomic_dec_if_positive(atomic_t *v)
+{
+	unsigned long flags;
+	int res;
+
+	local_irq_save(flags);
+	res = v->counter - 1;
+	if (res >= 0)
+		v->counter = res;
+	local_irq_restore(flags);
+
+	return res;
+}
+
+#define atomic_add_negative(a, v)	(atomic_add_return((a), (v)) < 0)
+#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
+
+/* Atomic operations are already serializing */
+#define smp_mb__before_atomic_dec()	barrier()
+#define smp_mb__after_atomic_dec()	barrier()
+#define smp_mb__before_atomic_inc()	barrier()
+#define smp_mb__after_atomic_inc()	barrier()
+
+#include <asm-generic/atomic.h>
+
+#endif /* _ASM_MICROBLAZE_ATOMIC_H */
arch/microblaze/include/asm/bitops.h new file +27 -0
new file mode 100644
index 0000000..d6df1fd
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_BITOPS_H
+#define _ASM_MICROBLAZE_BITOPS_H
+
+/*
+ * Copyright 1992, Linus Torvalds.
+ */
+
+#include <asm/byteorder.h> /* swab32 */
+#include <asm/system.h> /* save_flags */
+
+/*
+ * clear_bit() doesn't provide any barrier for the compiler.
+ */
+#define smp_mb__before_clear_bit()	barrier()
+#define smp_mb__after_clear_bit()	barrier()
+#include <asm-generic/bitops.h>
+#include <asm-generic/bitops/__fls.h>
+
+#endif /* _ASM_MICROBLAZE_BITOPS_H */
arch/microblaze/include/asm/byteorder.h new file +6 -0
new file mode 100644
index 0000000..ce9c587
@@ -0,0 +1,6 @@
+#ifndef _ASM_MICROBLAZE_BYTEORDER_H
+#define _ASM_MICROBLAZE_BYTEORDER_H
+
+#include <linux/byteorder/big_endian.h>
+
+#endif /* _ASM_MICROBLAZE_BYTEORDER_H */
arch/microblaze/include/asm/swab.h new file +8 -0
new file mode 100644
index 0000000..b375d7b
@@ -0,0 +1,8 @@
+#ifndef _ASM_MICROBLAZE_SWAB_H
+#define _ASM_MICROBLAZE_SWAB_H
+
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
+#define __SWAB_64_THRU_32__
+#endif
+
+#endif /* _ASM_MICROBLAZE_SWAB_H */
Signature · 1 line
1.5.5.1
author maintainer
#22 lore raw

PATCH 22/57 microblaze_v7: setup.c, setup.h - system setting

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/setup.h |   43 ++++++++
 arch/microblaze/kernel/setup.c      |  198 +++++++++++++++++++++++++++++++++++
 2 files changed, 241 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/setup.h
 create mode 100644 arch/microblaze/kernel/setup.c
arch/microblaze/include/asm/setup.h new file +43 -0
new file mode 100644
index 0000000..70075fe
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2007-2008 Michal Simek <[email protected]>
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_SETUP_H
+#define _ASM_MICROBLAZE_SETUP_H
+
+# ifndef __ASSEMBLY__
+
+#  ifdef __KERNEL__
+extern unsigned int boot_cpuid; /* move to smp.h */
+
+#  define COMMAND_LINE_SIZE	256
+extern char cmd_line[COMMAND_LINE_SIZE];
+#  endif/* __KERNEL__ */
+
+void early_printk(const char *fmt, ...);
+
+int setup_early_printk(char *opt);
+void disable_early_printk(void);
+
+void heartbeat(void);
+void setup_heartbeat(void);
+
+unsigned long long sched_clock(void);
+
+void time_init(void);
+void init_IRQ(void);
+void 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 /* __ASSEMBLY__ */
+#endif /* _ASM_MICROBLAZE_SETUP_H */
arch/microblaze/kernel/setup.c new file +198 -0

198 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#41 lore raw

PATCH 41/57 microblaze_v7: system.h processor.h

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/processor.h |   93 +++++++++++++++++++++++++++++++
 arch/microblaze/include/asm/system.h    |   91 ++++++++++++++++++++++++++++++
 2 files changed, 184 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/processor.h
 create mode 100644 arch/microblaze/include/asm/system.h
arch/microblaze/include/asm/processor.h new file +93 -0
new file mode 100644
index 0000000..d8e1543
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2008 Michal Simek
+ * Copyright (C) 2008 PetaLogix
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_PROCESSOR_H
+#define _ASM_MICROBLAZE_PROCESSOR_H
+
+#include <asm/ptrace.h>
+#include <asm/setup.h>
+#include <asm/registers.h>
+#include <asm/segment.h>
+
+# ifndef __ASSEMBLY__
+/* from kernel/cpu/mb.c */
+extern const struct seq_operations cpuinfo_op;
+
+# define cpu_relax()		barrier()
+# define cpu_sleep()		do {} while (0)
+# define prepare_to_copy(tsk)	do {} while (0)
+
+# endif /* __ASSEMBLY__ */
+
+/*
+ * 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
+
+/* definition in include/linux/sched.h */
+struct task_struct;
+
+/* thread_struct is gone. use thread_info instead. */
+struct thread_struct { };
+# define INIT_THREAD	{ }
+
+/* Do necessary setup to start up a newly executed thread. */
+static inline void start_thread(struct pt_regs *regs,
+				unsigned long pc,
+				unsigned long usp)
+{
+	regs->pc = pc;
+	regs->r1 = usp;
+	regs->kernel_mode = 0;
+}
+
+/* Free all resources held by a thread. */
+static inline void release_thread(struct task_struct *dead_task)
+{
+}
+
+/* Free all resources held by a thread. */
+static inline void exit_thread(void)
+{
+}
+
+extern unsigned long thread_saved_pc(struct task_struct *t);
+
+extern unsigned long get_wchan(struct task_struct *p);
+
+/*
+ * create a kernel thread without removing it from tasklists
+ */
+extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
+
+# define task_pt_regs(tsk) \
+		(((struct pt_regs *)(THREAD_SIZE + task_stack_page(tsk))) - 1)
+
+# define KSTK_EIP(tsk)	(0)
+# define KSTK_ESP(tsk)	(0)
+
+#endif /* _ASM_MICROBLAZE_PROCESSOR_H */
arch/microblaze/include/asm/system.h new file +91 -0

91 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#18 lore raw

PATCH 18/57 microblaze_v7: checksum support

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/checksum.h |   98 +++++++++++++++++++
 arch/microblaze/lib/checksum.c         |  166 ++++++++++++++++++++++++++++++++
 2 files changed, 264 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/checksum.h
 create mode 100644 arch/microblaze/lib/checksum.c
arch/microblaze/include/asm/checksum.h new file +98 -0
new file mode 100644
index 0000000..92b3076
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2008 Michal Simek <[email protected]>
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_CHECKSUM_H
+#define _ASM_MICROBLAZE_CHECKSUM_H
+
+#include <linux/in6.h>
+
+/*
+ * computes the checksum of the TCP/UDP pseudo-header
+ * returns a 16-bit checksum, already complemented
+ */
+static inline __wsum
+csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
+		   unsigned short proto, __wsum sum)
+{
+	__asm__("add %0, %0, %1\n\t"
+		"addc %0, %0, %2\n\t"
+		"addc %0, %0, %3\n\t"
+		"addc %0, %0, r0\n\t"
+		: "+&d" (sum)
+		: "d" (saddr), "d" (daddr), "d" (len + proto));
+
+	return sum;
+}
+
+/*
+ * computes the checksum of a memory block at buff, length len,
+ * and adds in "sum" (32-bit)
+ *
+ * returns a 32-bit number suitable for feeding into itself
+ * or csum_tcpudp_magic
+ *
+ * this function must be called with even lengths, except
+ * for the last fragment, which may be odd
+ *
+ * it's best to have buff aligned on a 32-bit boundary
+ */
+extern __wsum csum_partial(const void *buff, int len, __wsum sum);
+
+/*
+ * the same as csum_partial, but copies from src while it
+ * checksums
+ *
+ * here even more important to align src and dst on a 32-bit (or even
+ * better 64-bit) boundary
+ */
+extern __wsum csum_partial_copy(const char *src, char *dst, int len, int sum);
+
+/*
+ * the same as csum_partial_copy, but copies from user space.
+ *
+ * here even more important to align src and dst on a 32-bit (or even
+ * better 64-bit) boundary
+ */
+extern __wsum csum_partial_copy_from_user(const char *src, char *dst,
+					int len, int sum, int *csum_err);
+
+#define csum_partial_copy_nocheck(src, dst, len, sum)	\
+	csum_partial_copy((src), (dst), (len), (sum))
+
+/*
+ *	This is a version of ip_compute_csum() optimized for IP headers,
+ *	which always checksum on 4 octet boundaries.
+ *
+ */
+extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
+
+/*
+ *	Fold a partial checksum
+ */
+static inline __sum16 csum_fold(unsigned int sum)
+{
+	sum = (sum & 0xffff) + (sum >> 16);
+	sum = (sum & 0xffff) + (sum >> 16);
+	return ~sum;
+}
+
+static inline __sum16
+csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
+		  unsigned short proto, __wsum sum)
+{
+	return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
+}
+
+/*
+ * this routine is used for miscellaneous IP-like checksums, mainly
+ * in icmp.c
+ */
+extern __sum16 ip_compute_csum(const unsigned char *buff, int len);
+
+#endif /* _ASM_MICROBLAZE_CHECKSUM_H */
arch/microblaze/lib/checksum.c new file +166 -0

166 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#30 lore raw

PATCH 30/57 microblaze_v7: page.h, segment.h, unaligned.h

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/page.h      |  139 +++++++++++++++++++++++++++++++
 arch/microblaze/include/asm/segment.h   |   43 ++++++++++
 arch/microblaze/include/asm/unaligned.h |   22 +++++
 3 files changed, 204 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/page.h
 create mode 100644 arch/microblaze/include/asm/segment.h
 create mode 100644 arch/microblaze/include/asm/unaligned.h
arch/microblaze/include/asm/page.h new file +139 -0
new file mode 100644
index 0000000..15db1ea
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2008 Michal Simek
+ * Copyright (C) 2008 PetaLogix
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ * Changes for MMU support:
+ *    Copyright (C) 2007 Xilinx, Inc.  All rights reserved.
+ *
+ * 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_PAGE_H
+#define _ASM_MICROBLAZE_PAGE_H
+
+#include <linux/pfn.h>
+#include <asm/setup.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__
+
+#ifndef __ASSEMBLY__
+
+#define PAGE_UP(addr)	(((addr)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1)))
+#define PAGE_DOWN(addr)	((addr)&(~((PAGE_SIZE)-1)))
+
+/* align addr on a size boundary - adjust address up/down if needed */
+#define _ALIGN_UP(addr, size)	(((addr)+((size)-1))&(~((size)-1)))
+#define _ALIGN_DOWN(addr, size)	((addr)&(~((size)-1)))
+
+/* align addr on a size boundary - adjust address up if needed */
+#define _ALIGN(addr, size)	_ALIGN_UP(addr, size)
+
+/*
+ * PAGE_OFFSET -- the first address of the first page of memory. When not
+ * using MMU this corresponds to the first free page in physical memory (aligned
+ * on a page boundary).
+ */
+extern unsigned int __page_offset;
+#define PAGE_OFFSET __page_offset
+
+#define copy_page(to, from)			memcpy((to), (from), PAGE_SIZE)
+#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 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 page *pgtable_t;
+typedef struct { unsigned long	pte; }		pte_t;
+typedef struct { unsigned long	pgprot; }	pgprot_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;
+
+
+#define pte_val(x)	((x).pte)
+#define pgprot_val(x)	((x).pgprot)
+#define pmd_val(x)	((x).ste[0])
+#define pud_val(x)	((x).pue[0])
+#define pgd_val(x)	((x).pge[0])
+
+#define __pte(x)	((pte_t) { (x) })
+#define __pmd(x)	((pmd_t) { (x) })
+#define __pgd(x)	((pgd_t) { (x) })
+#define __pgprot(x)	((pgprot_t) { (x) })
+
+/**
+ * Conversions for virtual address, physical address, pfn, and struct
+ * page are defined in the following files.
+ *
+ * virt -+
+ *	 | asm-microblaze/page.h
+ * phys -+
+ *	 | linux/pfn.h
+ *  pfn -+
+ *	 | asm-generic/memory_model.h
+ * page -+
+ *
+ */
+
+extern unsigned long max_low_pfn;
+extern unsigned long min_low_pfn;
+extern unsigned long max_pfn;
+
+#define __pa(vaddr)		((unsigned long) (vaddr))
+#define __va(paddr)		((void *) (paddr))
+
+#define phys_to_pfn(phys)	(PFN_DOWN(phys))
+#define pfn_to_phys(pfn)	(PFN_PHYS(pfn))
+
+#define virt_to_pfn(vaddr)	(phys_to_pfn((__pa(vaddr))))
+#define pfn_to_virt(pfn)	__va(pfn_to_phys((pfn)))
+
+#define virt_to_page(vaddr)	(pfn_to_page(virt_to_pfn(vaddr)))
+#define page_to_virt(page)	(pfn_to_virt(page_to_pfn(page)))
+
+#define page_to_phys(page)	(pfn_to_phys(page_to_pfn(page)))
+#define page_to_bus(page)	(page_to_phys(page))
+#define phys_to_page(paddr)	(pfn_to_page(phys_to_pfn(paddr)))
+
+extern unsigned int memory_start;
+extern unsigned int memory_end;
+extern unsigned int memory_size;
+
+#define pfn_valid(pfn)		((pfn) >= min_low_pfn && (pfn) < max_mapnr)
+
+#define ARCH_PFN_OFFSET		(PAGE_OFFSET >> PAGE_SHIFT)
+
+#endif /* __ASSEMBLY__ */
+
+#define virt_addr_valid(vaddr)	(pfn_valid(virt_to_pfn(vaddr)))
+
+/* Convert between virtual and physical address for MMU.  */
+/* Handle MicroBlaze processor with virtual memory.  */
+#define __virt_to_phys(addr)	addr
+#define __phys_to_virt(addr)	addr
+#define tophys(rd,rs)	addik rd,rs,0
+#define tovirt(rd,rs)	addik rd,rs,0
+
+#define TOPHYS(addr)  __virt_to_phys(addr)
+
+#endif /* __KERNEL__ */
+
+#include <asm-generic/memory_model.h>
+#include <asm-generic/page.h>
+
+#endif /* _ASM_MICROBLAZE_PAGE_H */
arch/microblaze/include/asm/segment.h new file +43 -0

43 lines not on this page · raw message

arch/microblaze/include/asm/unaligned.h new file +22 -0
new file mode 100644
index 0000000..9d66b64
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2008 Michal Simek <[email protected]>
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_UNALIGNED_H
+#define _ASM_MICROBLAZE_UNALIGNED_H
+
+# ifdef __KERNEL__
+
+# include <linux/unaligned/access_ok.h>
+# include <linux/unaligned/generic.h>
+
+# define get_unaligned	__get_unaligned_be
+# define put_unaligned	__put_unaligned_be
+
+# endif	/* __KERNEL__ */
+#endif /* _ASM_MICROBLAZE_UNALIGNED_H */
Signature · 1 line
1.5.5.1
author maintainer
#35 lore raw

PATCH 35/57 microblaze_v7: io.h IO operations

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/io.h |  209 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 209 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/io.h
arch/microblaze/include/asm/io.h new file +209 -0
new file mode 100644
index 0000000..4ff514e
@@ -0,0 +1,209 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_IO_H
+#define _ASM_MICROBLAZE_IO_H
+
+#include <asm/byteorder.h>
+#include <asm/page.h>
+#include <linux/types.h>
+#include <asm/page.h>
+
+#define IO_SPACE_LIMIT ~(0UL)
+
+static inline unsigned char __raw_readb(const volatile void __iomem *addr)
+{
+	return *(volatile unsigned char __force *)addr;
+}
+static inline unsigned short __raw_readw(const volatile void __iomem *addr)
+{
+	return *(volatile unsigned short __force *)addr;
+}
+static inline unsigned int __raw_readl(const volatile void __iomem *addr)
+{
+	return *(volatile unsigned int __force *)addr;
+}
+static inline unsigned long __raw_readq(const volatile void __iomem *addr)
+{
+	return *(volatile unsigned long __force *)addr;
+}
+static inline void __raw_writeb(unsigned char v, volatile void __iomem *addr)
+{
+	*(volatile unsigned char __force *)addr = v;
+}
+static inline void __raw_writew(unsigned short v, volatile void __iomem *addr)
+{
+	*(volatile unsigned short __force *)addr = v;
+}
+static inline void __raw_writel(unsigned int v, volatile void __iomem *addr)
+{
+	*(volatile unsigned int __force *)addr = v;
+}
+static inline void __raw_writeq(unsigned long v, volatile void __iomem *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 2.4 for Microblaze had this wrong.
+ */
+static inline unsigned char readb(const volatile void __iomem *addr)
+{
+	return *(volatile unsigned char __force *)addr;
+}
+static inline unsigned short readw(const volatile void __iomem *addr)
+{
+	return le16_to_cpu(*(volatile unsigned short __force *)addr);
+}
+static inline unsigned int readl(const volatile void __iomem *addr)
+{
+	return le32_to_cpu(*(volatile unsigned int __force *)addr);
+}
+static inline void writeb(unsigned char v, volatile void __iomem *addr)
+{
+	*(volatile unsigned char __force *)addr = v;
+}
+static inline void writew(unsigned short v, volatile void __iomem *addr)
+{
+	*(volatile unsigned short __force *)addr = cpu_to_le16(v);
+}
+static inline void writel(unsigned int v, volatile void __iomem *addr)
+{
+	*(volatile unsigned int __force *)addr = cpu_to_le32(v);
+}
+
+/* ioread and iowrite variants. thease are for now same as __raw_
+ * variants of accessors. we might check for endianess in the feature
+ */
+#define ioread8(addr)		__raw_readb((u8 *)(addr))
+#define ioread16(addr)		__raw_readw((u16 *)(addr))
+#define ioread32(addr)		__raw_readl((u32 *)(addr))
+#define iowrite8(v, addr)	__raw_writeb((u8)(v), (u8 *)(addr))
+#define iowrite16(v, addr)	__raw_writew((u16)(v), (u16 *)(addr))
+#define iowrite32(v, addr)	__raw_writel((u32)(v), (u32 *)(addr))
+
+/* These are the definitions for the x86 IO instructions
+ * inb/inw/inl/outb/outw/outl, the "string" versions
+ * insb/insw/insl/outsb/outsw/outsl, and the "pausing" versions
+ * inb_p/inw_p/...
+ * The macros don't do byte-swapping.
+ */
+#define inb(port)		readb((u8 *)((port)))
+#define outb(val, port)		writeb((val), (u8 *)((unsigned long)(port)))
+#define inw(port)		readw((u16 *)((port)))
+#define outw(val, port)		writew((val), (u16 *)((unsigned long)(port)))
+#define inl(port)		readl((u32 *)((port)))
+#define outl(val, port)		writel((val), (u32 *)((unsigned long)(port)))
+
+#define inb_p(port)		inb((port))
+#define outb_p(val, port)	outb((val), (port))
+#define inw_p(port)		inw((port))
+#define outw_p(val, port)	outw((val), (port))
+#define inl_p(port)		inl((port))
+#define outl_p(val, port)	outl((val), (port))
+
+#define memset_io(a, b, c)	memset((void *)(a), (b), (c))
+#define memcpy_fromio(a, b, c)	memcpy((a), (void *)(b), (c))
+#define memcpy_toio(a, b, c)	memcpy((void *)(a), (b), (c))
+
+/**
+ *	virt_to_phys - map virtual addresses to physical
+ *	@address: address to remap
+ *
+ *	The returned physical address is the physical (CPU) mapping for
+ *	the memory address given. It is only valid to use this function on
+ *	addresses directly mapped or allocated via kmalloc.
+ *
+ *	This function does not give bus mappings for DMA transfers. In
+ *	almost all conceivable cases a device driver should not be using
+ *	this function
+ */
+static inline unsigned long __iomem virt_to_phys(volatile void *address)
+{
+	return __pa((unsigned long)address);
+}
+
+#define virt_to_bus virt_to_phys
+
+/**
+ *	phys_to_virt - map physical address to virtual
+ *	@address: address to remap
+ *
+ *	The returned virtual address is a current CPU mapping for
+ *	the memory address given. It is only valid to use this function on
+ *	addresses that have a kernel mapping
+ *
+ *	This function does not handle bus mappings for DMA transfers. In
+ *	almost all conceivable cases a device driver should not be using
+ *	this function
+ */
+static inline void *phys_to_virt(unsigned long address)
+{
+	return (void *)__va(address);
+}
+
+#define bus_to_virt(a) phys_to_virt(a)
+
+static inline void __iomem *__ioremap(phys_addr_t address, unsigned long size,
+			unsigned long flags)
+{
+	return (void *)address;
+}
+
+#define ioremap(physaddr, size)	((void __iomem *)(unsigned long)(physaddr))
+#define iounmap(addr)		((void)0)
+#define ioremap_nocache(physaddr, size)	ioremap(physaddr, size)
+
+/*
+ * Convert a physical pointer to a virtual kernel pointer for /dev/mem
+ * access
+ */
+#define xlate_dev_mem_ptr(p)	__va(p)
+
+/*
+ * Convert a virtual cached pointer to an uncached pointer
+ */
+#define xlate_dev_kmem_ptr(p)	p
+
+/*
+ * Big Endian
+ */
+#define out_be32(a, v) __raw_writel((v), (void __iomem __force *)(a))
+#define out_be16(a, v) __raw_writew((v), (a))
+
+#define in_be32(a) __raw_readl((const void __iomem __force *)(a))
+#define in_be16(a) __raw_readw(a)
+
+/*
+ * Little endian
+ */
+
+#define out_le32(a, v) __raw_writel(__cpu_to_le32(v), (a));
+#define out_le16(a, v) __raw_writew(__cpu_to_le16(v), (a))
+
+#define in_le32(a) __le32_to_cpu(__raw_readl(a))
+#define in_le16(a) __le16_to_cpu(__raw_readw(a))
+
+/* Byte ops */
+#define out_8(a, v) __raw_writeb((v), (a))
+#define in_8(a) __raw_readb(a)
+
+/* FIXME */
+static inline void __iomem *ioport_map(unsigned long port, unsigned int len)
+{
+	return (void __iomem *) (port);
+}
+
+static inline void ioport_unmap(void __iomem *addr)
+{
+	/* Nothing to do */
+}
+
+#endif /* _ASM_MICROBLAZE_IO_H */
Signature · 1 line
1.5.5.1
author maintainer
#27 lore raw

PATCH 27/57 microblaze_v7: IPC support

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/ipc.h       |    1 +
 arch/microblaze/include/asm/ipcbuf.h    |   36 +++++
 arch/microblaze/kernel/sys_microblaze.c |  226 +++++++++++++++++++++++++++++++
 3 files changed, 263 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/ipc.h
 create mode 100644 arch/microblaze/include/asm/ipcbuf.h
 create mode 100644 arch/microblaze/kernel/sys_microblaze.c
arch/microblaze/include/asm/ipc.h new file +1 -0
new file mode 100644
index 0000000..a46e3d9
@@ -0,0 +1 @@
+#include <asm-generic/ipc.h>
arch/microblaze/include/asm/ipcbuf.h new file +36 -0
new file mode 100644
index 0000000..b056fa4
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_IPCBUF_H
+#define _ASM_MICROBLAZE_IPCBUF_H
+
+/*
+ * The user_ipc_perm structure for microblaze 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 short		__pad1;
+	unsigned short		seq;
+	unsigned short		__pad2;
+	unsigned long		__unused1;
+	unsigned long		__unused2;
+};
+
+#endif /* _ASM_MICROBLAZE_IPCBUF_H */
arch/microblaze/kernel/sys_microblaze.c new file +226 -0

226 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#53 lore raw

PATCH 53/57 microblaze_v7: string.h thread_info.h

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/string.h      |   24 +++++
 arch/microblaze/include/asm/thread_info.h |  152 +++++++++++++++++++++++++++++
 2 files changed, 176 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/string.h
 create mode 100644 arch/microblaze/include/asm/thread_info.h
arch/microblaze/include/asm/string.h new file +24 -0
new file mode 100644
index 0000000..f7728c9
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_STRING_H
+#define _ASM_MICROBLAZE_STRING_H
+
+#ifndef __KERNEL__
+
+#define __HAVE_ARCH_MEMSET
+#define __HAVE_ARCH_MEMCPY
+#define __HAVE_ARCH_MEMMOVE
+
+extern void *memset(void *, int, __kernel_size_t);
+extern void *memcpy(void *, const void *, __kernel_size_t);
+extern void *memmove(void *, const void *, __kernel_size_t);
+
+#endif /* __KERNEL__ */
+
+#endif /* _ASM_MICROBLAZE_STRING_H */
arch/microblaze/include/asm/thread_info.h new file +152 -0

152 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#46 lore raw

PATCH 46/57 microblaze_v7: headers simple files - empty or redirect to asm-generic

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/cputime.h           |    1 +
 arch/microblaze/include/asm/div64.h             |    1 +
 arch/microblaze/include/asm/emergency-restart.h |    1 +
 arch/microblaze/include/asm/errno.h             |    1 +
 arch/microblaze/include/asm/futex.h             |    1 +
 arch/microblaze/include/asm/gpio.h              |   56 +++++++++++++++++++++++
 arch/microblaze/include/asm/kdebug.h            |    1 +
 arch/microblaze/include/asm/local.h             |    1 +
 arch/microblaze/include/asm/mutex.h             |    1 +
 arch/microblaze/include/asm/percpu.h            |    1 +
 arch/microblaze/include/asm/resource.h          |    1 +
 arch/microblaze/include/asm/serial.h            |   14 ++++++
 12 files changed, 80 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/auxvec.h
 create mode 100644 arch/microblaze/include/asm/cputable.h
 create mode 100644 arch/microblaze/include/asm/cputime.h
 create mode 100644 arch/microblaze/include/asm/div64.h
 create mode 100644 arch/microblaze/include/asm/emergency-restart.h
 create mode 100644 arch/microblaze/include/asm/errno.h
 create mode 100644 arch/microblaze/include/asm/futex.h
 create mode 100644 arch/microblaze/include/asm/gpio.h
 create mode 100644 arch/microblaze/include/asm/kdebug.h
 create mode 100644 arch/microblaze/include/asm/local.h
 create mode 100644 arch/microblaze/include/asm/mutex.h
 create mode 100644 arch/microblaze/include/asm/percpu.h
 create mode 100644 arch/microblaze/include/asm/resource.h
 create mode 100644 arch/microblaze/include/asm/serial.h
 create mode 100644 arch/microblaze/include/asm/user.h
arch/microblaze/include/asm/auxvec.h new file +0 -0
new file mode 100644
index 0000000..e69de29
arch/microblaze/include/asm/cputable.h new file +0 -0
new file mode 100644
index 0000000..e69de29
arch/microblaze/include/asm/cputime.h new file +1 -0
new file mode 100644
index 0000000..6d68ad7
@@ -0,0 +1 @@
+#include <asm-generic/cputime.h>
arch/microblaze/include/asm/div64.h new file +1 -0
new file mode 100644
index 0000000..6cd978c
@@ -0,0 +1 @@
+#include <asm-generic/div64.h>
arch/microblaze/include/asm/emergency-restart.h new file +1 -0
new file mode 100644
index 0000000..3711bd9
@@ -0,0 +1 @@
+#include <asm-generic/emergency-restart.h>
arch/microblaze/include/asm/errno.h new file +1 -0
new file mode 100644
index 0000000..4c82b50
@@ -0,0 +1 @@
+#include <asm-generic/errno.h>
arch/microblaze/include/asm/futex.h new file +1 -0
new file mode 100644
index 0000000..0b74582
@@ -0,0 +1 @@
+#include <asm-generic/futex.h>
arch/microblaze/include/asm/gpio.h new file +56 -0

56 lines not on this page · raw message

arch/microblaze/include/asm/kdebug.h new file +1 -0
new file mode 100644
index 0000000..6ece1b0
@@ -0,0 +1 @@
+#include <asm-generic/kdebug.h>
arch/microblaze/include/asm/local.h new file +1 -0
new file mode 100644
index 0000000..c11c530
@@ -0,0 +1 @@
+#include <asm-generic/local.h>
arch/microblaze/include/asm/mutex.h new file +1 -0
new file mode 100644
index 0000000..ff6101a
@@ -0,0 +1 @@
+#include <asm-generic/mutex-dec.h>
arch/microblaze/include/asm/percpu.h new file +1 -0
new file mode 100644
index 0000000..06a959d
@@ -0,0 +1 @@
+#include <asm-generic/percpu.h>
arch/microblaze/include/asm/resource.h new file +1 -0
new file mode 100644
index 0000000..04bc4db
@@ -0,0 +1 @@
+#include <asm-generic/resource.h>
arch/microblaze/include/asm/serial.h new file +14 -0
new file mode 100644
index 0000000..39bfc8c
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2009 Michal Simek <[email protected]>
+ *
+ * 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_SERIAL_H
+#define _ASM_MICROBLAZE_SERIAL_H
+
+# define BASE_BAUD (1843200 / 16)
+
+#endif /* _ASM_MICROBLAZE_SERIAL_H */
arch/microblaze/include/asm/user.h new file +0 -0
new file mode 100644
index 0000000..e69de29
Signature · 1 line
1.5.5.1
author maintainer
#48 lore raw

PATCH 48/57 microblaze_v7: headers files entry.h current.h mman.h registers.h sembuf.h

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/current.h   |   21 ++++++++++++++++++
 arch/microblaze/include/asm/entry.h     |   35 +++++++++++++++++++++++++++++++
 arch/microblaze/include/asm/mman.h      |   25 ++++++++++++++++++++++
 arch/microblaze/include/asm/registers.h |   33 +++++++++++++++++++++++++++++
 arch/microblaze/include/asm/sembuf.h    |   34 ++++++++++++++++++++++++++++++
 5 files changed, 148 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/current.h
 create mode 100644 arch/microblaze/include/asm/entry.h
 create mode 100644 arch/microblaze/include/asm/mman.h
 create mode 100644 arch/microblaze/include/asm/registers.h
 create mode 100644 arch/microblaze/include/asm/sembuf.h
arch/microblaze/include/asm/current.h new file +21 -0
new file mode 100644
index 0000000..8375ea9
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#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 /* __ASSEMBLY__ */
+
+#endif /* _ASM_MICROBLAZE_CURRENT_H */
arch/microblaze/include/asm/entry.h new file +35 -0
new file mode 100644
index 0000000..7f57e42
@@ -0,0 +1,35 @@
+/*
+ * Definitions used by low-level trap handlers
+ *
+ * Copyright (C) 2008 Michal Simek
+ * Copyright (C) 2007 - 2008 PetaLogix
+ * Copyright (C) 2007 John Williams <[email protected]>
+ *
+ * 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_ENTRY_H
+#define _ASM_MICROBLAZE_ENTRY_H
+
+#include <asm/percpu.h>
+#include <asm/ptrace.h>
+
+/*
+ * These are per-cpu variables required in entry.S, among other
+ * places
+ */
+
+#define PER_CPU(var) per_cpu__##var
+
+# ifndef __ASSEMBLY__
+DECLARE_PER_CPU(unsigned int, KSP); /* Saved kernel stack pointer */
+DECLARE_PER_CPU(unsigned int, KM); /* Kernel/user mode */
+DECLARE_PER_CPU(unsigned int, ENTRY_SP); /* Saved SP on kernel entry */
+DECLARE_PER_CPU(unsigned int, R11_SAVE); /* Temp variable for entry */
+DECLARE_PER_CPU(unsigned int, CURRENT_SAVE); /* Saved current pointer */
+DECLARE_PER_CPU(unsigned int, SYSCALL_SAVE); /* Saved syscall number */
+# endif /* __ASSEMBLY__ */
+
+#endif /* _ASM_MICROBLAZE_ENTRY_H */
arch/microblaze/include/asm/mman.h new file +25 -0
new file mode 100644
index 0000000..4914b13
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_MMAN_H
+#define _ASM_MICROBLAZE_MMAN_H
+
+#include <asm-generic/mman.h>
+
+#define MAP_GROWSDOWN	0x0100 /* stack-like segment */
+#define MAP_DENYWRITE	0x0800 /* ETXTBSY */
+#define MAP_EXECUTABLE	0x1000 /* mark it as an executable */
+#define MAP_LOCKED	0x2000 /* pages are locked */
+#define MAP_NORESERVE	0x4000 /* don't check for reservations */
+#define MAP_POPULATE	0x8000 /* populate (prefault) pagetables */
+#define MAP_NONBLOCK	0x10000 /* do not block on IO */
+
+#define MCL_CURRENT	1 /* lock all current mappings */
+#define MCL_FUTURE	2 /* lock all future mappings */
+
+#endif /* _ASM_MICROBLAZE_MMAN_H */
arch/microblaze/include/asm/registers.h new file +33 -0
new file mode 100644
index 0000000..834142d
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2008 Michal Simek
+ * Copyright (C) 2008 PetaLogix
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_REGISTERS_H
+#define _ASM_MICROBLAZE_REGISTERS_H
+
+#define MSR_BE	(1<<0) /* 0x001 */
+#define MSR_IE	(1<<1) /* 0x002 */
+#define MSR_C	(1<<2) /* 0x004 */
+#define MSR_BIP	(1<<3) /* 0x008 */
+#define MSR_FSL	(1<<4) /* 0x010 */
+#define MSR_ICE	(1<<5) /* 0x020 */
+#define MSR_DZ	(1<<6) /* 0x040 */
+#define MSR_DCE	(1<<7) /* 0x080 */
+#define MSR_EE	(1<<8) /* 0x100 */
+#define MSR_EIP	(1<<9) /* 0x200 */
+#define MSR_CC	(1<<31)
+
+/* Floating Point Status Register (FSR) Bits */
+#define FSR_IO		(1<<4) /* Invalid operation */
+#define FSR_DZ		(1<<3) /* Divide-by-zero */
+#define FSR_OF		(1<<2) /* Overflow */
+#define FSR_UF		(1<<1) /* Underflow */
+#define FSR_DO		(1<<0) /* Denormalized operand error */
+
+#endif /* _ASM_MICROBLAZE_REGISTERS_H */
arch/microblaze/include/asm/sembuf.h new file +34 -0
new file mode 100644
index 0000000..b804ed7
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_SEMBUF_H
+#define _ASM_MICROBLAZE_SEMBUF_H
+
+/*
+ * The semid64_ds structure for microblaze 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 semid64_ds {
+	struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
+	__kernel_time_t	sem_otime; /* last semop time */
+	unsigned long	__unused1;
+	__kernel_time_t	sem_ctime; /* last change time */
+	unsigned long	__unused2;
+	unsigned long	sem_nsems; /* no. of semaphores in array */
+	unsigned long	__unused3;
+	unsigned long	__unused4;
+};
+
+
+#endif /* _ASM_MICROBLAZE_SEMBUF_H */
Signature · 1 line
1.5.5.1
author maintainer
#44 lore raw

PATCH 44/57 microblaze_v7: termbits.h termios.h

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/termbits.h |  203 ++++++++++++++++++++++++++++++++
 arch/microblaze/include/asm/termios.h  |   88 ++++++++++++++
 2 files changed, 291 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/termbits.h
 create mode 100644 arch/microblaze/include/asm/termios.h
arch/microblaze/include/asm/termbits.h new file +203 -0
new file mode 100644
index 0000000..a1b64bc
@@ -0,0 +1,203 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#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 12
+#define VDISCARD 13
+#define VWERASE 14
+#define VLNEXT 15
+#define VEOL2 16
+
+/* c_iflag bits */
+
+#define IGNBRK	0000001
+#define BRKINT	0000002
+#define IGNPAR	0000004
+#define PARMRK	0000010
+#define INPCK	0000020
+#define ISTRIP	0000040
+#define INLCR	0000100
+#define IGNCR	0000200
+#define ICRNL	0000400
+#define IUCLC	0001000
+#define IXON	0002000
+#define IXANY	0004000
+#define IXOFF	0010000
+#define IMAXBEL	0020000
+#define IUTF8	0040000
+
+/* c_oflag bits */
+
+#define OPOST	0000001
+#define OLCUC	0000002
+#define ONLCR	0000004
+#define OCRNL	0000010
+#define ONOCR	0000020
+#define ONLRET	0000040
+#define OFILL	0000100
+#define OFDEL	0000200
+#define NLDLY	0000400
+#define NL0	0000000
+#define NL1	0000400
+#define CRDLY	0003000
+#define CR0	0000000
+#define CR1	0001000
+#define CR2	0002000
+#define CR3	0003000
+#define TABDLY	0014000
+#define TAB0	0000000
+#define TAB1	0004000
+#define TAB2	0010000
+#define TAB3	0014000
+#define XTABS	0014000
+#define BSDLY	0020000
+#define BS0	0000000
+#define BS1	0020000
+#define VTDLY	0040000
+#define VT0	0000000
+#define VT1	0040000
+#define FFDLY	0100000
+#define FF0	0000000
+#define FF1	0100000
+
+/* c_cflag bit meaning */
+
+#define CBAUD	0010017
+#define B0	0000000 /* hang up */
+#define B50	0000001
+#define B75	0000002
+#define B110	0000003
+#define B134	0000004
+#define B150	0000005
+#define B200	0000006
+#define B300	0000007
+#define B600	0000010
+#define B1200	0000011
+#define B1800	0000012
+#define B2400	0000013
+#define B4800	0000014
+#define B9600	0000015
+#define B19200	0000016
+#define B38400	0000017
+#define EXTA B19200
+#define EXTB B38400
+#define CSIZE	0000060
+#define CS5	0000000
+#define CS6	0000020
+#define CS7	0000040
+#define CS8	0000060
+#define CSTOPB	0000100
+#define CREAD	0000200
+#define PARENB	0000400
+#define PARODD	0001000
+#define HUPCL	0002000
+#define CLOCAL	0004000
+#define CBAUDEX	0010000
+#define B57600	0010001
+#define B115200	0010002
+#define B230400	0010003
+#define B460800	0010004
+#define B500000	0010005
+#define B576000	0010006
+#define B921600	0010007
+#define BOTHER		0010000
+#define B1000000	0010010
+#define B1152000	0010011
+#define B1500000	0010012
+#define B2000000	0010013
+#define B2500000	0010014
+#define B3000000	0010015
+#define B3500000	0010016
+#define B4000000	0010017
+#define CIBAUD		002003600000 /* input baud rate (not used) */
+#define CMSPAR		010000000000 /* mark or space (stick) parity */
+#define CRTSCTS		020000000000 /* flow control */
+
+#define IBSHIFT	16		/* Shift from CBAUD to CIBAUD */
+
+/* c_lflag bits */
+
+#define ISIG	0000001
+#define ICANON	0000002
+#define XCASE	0000004
+#define ECHO	0000010
+#define ECHOE	0000020
+#define ECHOK	0000040
+#define ECHONL	0000100
+#define NOFLSH	0000200
+#define TOSTOP	0000400
+#define ECHOCTL	0001000
+#define ECHOPRT	0002000
+#define ECHOKE	0004000
+#define FLUSHO	0010000
+#define PENDIN	0040000
+#define IEXTEN	0100000
+
+/* tcflow() and TCXONC use these */
+
+#define	TCOOFF		0
+#define	TCOON		1
+#define	TCIOFF		2
+#define	TCION		3
+
+/* tcflush() and TCFLSH use these */
+
+#define	TCIFLUSH	0
+#define	TCOFLUSH	1
+#define	TCIOFLUSH	2
+
+/* tcsetattr uses these */
+
+#define	TCSANOW		0
+#define	TCSADRAIN	1
+#define	TCSAFLUSH	2
+
+#endif /* _ASM_MICROBLAZE_TERMBITS_H */
arch/microblaze/include/asm/termios.h new file +88 -0

88 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#26 lore raw

PATCH 26/57 microblaze_v7: ptrace support

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/ptrace.h |   68 +++++++++
 arch/microblaze/kernel/ptrace.c      |  252 ++++++++++++++++++++++++++++++++++
 2 files changed, 320 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/ptrace.h
 create mode 100644 arch/microblaze/kernel/ptrace.c
arch/microblaze/include/asm/ptrace.h new file +68 -0
new file mode 100644
index 0000000..f1f0348
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_PTRACE_H
+#define _ASM_MICROBLAZE_PTRACE_H
+
+#ifndef __ASSEMBLY__
+#include <linux/types.h>
+
+typedef unsigned long microblaze_reg_t;
+
+struct pt_regs {
+	microblaze_reg_t r0;
+	microblaze_reg_t r1;
+	microblaze_reg_t r2;
+	microblaze_reg_t r3;
+	microblaze_reg_t r4;
+	microblaze_reg_t r5;
+	microblaze_reg_t r6;
+	microblaze_reg_t r7;
+	microblaze_reg_t r8;
+	microblaze_reg_t r9;
+	microblaze_reg_t r10;
+	microblaze_reg_t r11;
+	microblaze_reg_t r12;
+	microblaze_reg_t r13;
+	microblaze_reg_t r14;
+	microblaze_reg_t r15;
+	microblaze_reg_t r16;
+	microblaze_reg_t r17;
+	microblaze_reg_t r18;
+	microblaze_reg_t r19;
+	microblaze_reg_t r20;
+	microblaze_reg_t r21;
+	microblaze_reg_t r22;
+	microblaze_reg_t r23;
+	microblaze_reg_t r24;
+	microblaze_reg_t r25;
+	microblaze_reg_t r26;
+	microblaze_reg_t r27;
+	microblaze_reg_t r28;
+	microblaze_reg_t r29;
+	microblaze_reg_t r30;
+	microblaze_reg_t r31;
+	microblaze_reg_t pc;
+	microblaze_reg_t msr;
+	microblaze_reg_t ear;
+	microblaze_reg_t esr;
+	microblaze_reg_t fsr;
+	int kernel_mode;
+};
+
+#define kernel_mode(regs)		((regs)->kernel_mode)
+#define user_mode(regs)			(!kernel_mode(regs))
+
+#define instruction_pointer(regs)	((regs)->pc)
+#define profile_pc(regs)		instruction_pointer(regs)
+
+void show_regs(struct pt_regs *);
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* _ASM_MICROBLAZE_PTRACE_H */
arch/microblaze/kernel/ptrace.c new file +252 -0

252 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#29 lore raw

PATCH 29/57 microblaze_v7: memory inicialization, MMU, TLB

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/mmu.h         |   19 +++
 arch/microblaze/include/asm/mmu_context.h |   21 +++
 arch/microblaze/include/asm/tlb.h         |   16 +++
 arch/microblaze/include/asm/tlbflush.h    |   20 +++
 arch/microblaze/mm/init.c                 |  197 +++++++++++++++++++++++++++++
 5 files changed, 273 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/mmu.h
 create mode 100644 arch/microblaze/include/asm/mmu_context.h
 create mode 100644 arch/microblaze/include/asm/tlb.h
 create mode 100644 arch/microblaze/include/asm/tlbflush.h
 create mode 100644 arch/microblaze/mm/init.c
arch/microblaze/include/asm/mmu.h new file +19 -0
new file mode 100644
index 0000000..0e0431d
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_MMU_H
+#define _ASM_MICROBLAZE_MMU_H
+
+#ifndef __ASSEMBLY__
+typedef struct {
+	struct vm_list_struct	*vmlist;
+	unsigned long		end_brk;
+} mm_context_t;
+#endif /* __ASSEMBLY__ */
+
+#endif /* _ASM_MICROBLAZE_MMU_H */
arch/microblaze/include/asm/mmu_context.h new file +21 -0
new file mode 100644
index 0000000..150ca01
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_MMU_CONTEXT_H
+#define _ASM_MICROBLAZE_MMU_CONTEXT_H
+
+# define init_new_context(tsk, mm)		({ 0; })
+
+# define enter_lazy_tlb(mm, tsk)		do {} while (0)
+# define change_mm_context(old, ctx, _pml4)	do {} while (0)
+# define destroy_context(mm)			do {} while (0)
+# define deactivate_mm(tsk, mm)			do {} while (0)
+# define switch_mm(prev, next, tsk)		do {} while (0)
+# define activate_mm(prev, next)		do {} while (0)
+
+#endif /* _ASM_MICROBLAZE_MMU_CONTEXT_H */
arch/microblaze/include/asm/tlb.h new file +16 -0
new file mode 100644
index 0000000..d1dfe37
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_TLB_H
+#define _ASM_MICROBLAZE_TLB_H
+
+#define tlb_flush(tlb)	do {} while (0)
+
+#include <asm-generic/tlb.h>
+
+#endif /* _ASM_MICROBLAZE_TLB_H */
arch/microblaze/include/asm/tlbflush.h new file +20 -0
new file mode 100644
index 0000000..d7fe762
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_TLBFLUSH_H
+#define _ASM_MICROBLAZE_TLBFLUSH_H
+
+#define flush_tlb()				BUG()
+#define flush_tlb_all()				BUG()
+#define flush_tlb_mm(mm)			BUG()
+#define flush_tlb_page(vma, addr)		BUG()
+#define flush_tlb_range(mm, start, end)		BUG()
+#define flush_tlb_pgtables(mm, start, end)	BUG()
+#define flush_tlb_kernel_range(start, end)	BUG()
+
+#endif /* _ASM_MICROBLAZE_TLBFLUSH_H */
arch/microblaze/mm/init.c new file +197 -0

197 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author maintainer
#52 lore raw

PATCH 52/57 microblaze_v7: unistd.h

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/unistd.h |  419 ++++++++++++++++++++++++++++++++++
 1 files changed, 419 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/unistd.h
arch/microblaze/include/asm/unistd.h new file +419 -0
new file mode 100644
index 0000000..7191fa0
@@ -0,0 +1,419 @@
+/*
+ * Copyright (C) 2007-2008 Michal Simek <[email protected]>
+ * Copyright (C) 2006 Atmark Techno, 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_UNISTD_H
+#define _ASM_MICROBLAZE_UNISTD_H
+
+#define __NR_restart_syscall	0 /* ok */
+#define __NR_exit		1 /* ok */
+#define __NR_fork		2 /* not for no MMU - weird */
+#define __NR_read		3 /* ok */
+#define __NR_write		4 /* ok */
+#define __NR_open		5 /* openat */
+#define __NR_close		6 /* ok */
+#define __NR_waitpid		7 /* waitid */
+#define __NR_creat		8 /* openat */
+#define __NR_link		9 /* linkat */
+#define __NR_unlink		10 /* unlinkat */
+#define __NR_execve		11 /* ok */
+#define __NR_chdir		12 /* ok */
+#define __NR_time		13 /* obsolete -> sys_gettimeofday */
+#define __NR_mknod		14 /* mknodat */
+#define __NR_chmod		15 /* fchmodat */
+#define __NR_lchown		16 /* ok */
+#define __NR_break		17 /* don't know */
+#define __NR_oldstat		18 /* remove */
+#define __NR_lseek		19 /* ok */
+#define __NR_getpid		20 /* ok */
+#define __NR_mount		21 /* ok */
+#define __NR_umount		22 /* ok */  /* use only umount2 */
+#define __NR_setuid		23 /* ok */
+#define __NR_getuid		24 /* ok */
+#define __NR_stime		25 /* obsolete -> sys_settimeofday */
+#define __NR_ptrace		26 /* ok */
+#define __NR_alarm		27 /* obsolete -> sys_setitimer */
+#define __NR_oldfstat		28 /* remove */
+#define __NR_pause		29 /* obsolete -> sys_rt_sigtimedwait */
+#define __NR_utime		30 /* obsolete -> sys_utimesat */
+#define __NR_stty		31 /* remove */
+#define __NR_gtty		32 /* remove */
+#define __NR_access		33 /* faccessat */
+#define __NR_nice		34 /* can be implemented by sys_setpriority */
+#define __NR_ftime		35 /* remove */
+#define __NR_sync		36 /* ok */
+#define __NR_kill		37 /* ok */
+#define __NR_rename		38 /* renameat */
+#define __NR_mkdir		39 /* mkdirat */
+#define __NR_rmdir		40 /* unlinkat */
+#define __NR_dup		41 /* ok */
+#define __NR_pipe		42 /* ok */
+#define __NR_times		43 /* ok */
+#define __NR_prof		44 /* remove */
+#define __NR_brk		45 /* ok -mmu, nommu specific */
+#define __NR_setgid		46 /* ok */
+#define __NR_getgid		47 /* ok */
+#define __NR_signal		48 /* obsolete -> sys_rt_sigaction */
+#define __NR_geteuid		49 /* ok */
+#define __NR_getegid		50 /* ok */
+#define __NR_acct		51 /* add it and then I can disable it */
+#define __NR_umount2		52 /* remove */
+#define __NR_lock		53 /* remove */
+#define __NR_ioctl		54 /* ok */
+#define __NR_fcntl		55 /* ok -> 64bit version*/
+#define __NR_mpx		56 /* remove */
+#define __NR_setpgid		57 /* ok */
+#define __NR_ulimit		58 /* remove */
+#define __NR_oldolduname	59 /* remove */
+#define __NR_umask		60 /* ok */
+#define __NR_chroot		61 /* ok */
+#define __NR_ustat		62 /* obsolete -> statfs64 */
+#define __NR_dup2		63 /* ok */
+#define __NR_getppid		64 /* ok */
+#define __NR_getpgrp		65 /* obsolete -> sys_getpgid */
+#define __NR_setsid		66 /* ok */
+#define __NR_sigaction		67 /* obsolete -> rt_sigaction */
+#define __NR_sgetmask		68 /* obsolete -> sys_rt_sigprocmask */
+#define __NR_ssetmask		69 /* obsolete ->sys_rt_sigprocmask */
+#define __NR_setreuid		70 /* ok */
+#define __NR_setregid		71 /* ok */
+#define __NR_sigsuspend		72 /* obsolete -> rt_sigsuspend */
+#define __NR_sigpending		73 /* obsolete -> sys_rt_sigpending */
+#define __NR_sethostname	74 /* ok */
+#define __NR_setrlimit		75 /* ok */
+#define __NR_getrlimit		76 /* ok Back compatible 2Gig limited rlimit */
+#define __NR_getrusage		77 /* ok */
+#define __NR_gettimeofday	78 /* ok */
+#define __NR_settimeofday	79 /* ok */
+#define __NR_getgroups		80 /* ok */
+#define __NR_setgroups		81 /* ok */
+#define __NR_select		82 /* obsolete -> sys_pselect7 */
+#define __NR_symlink		83 /* symlinkat */
+#define __NR_oldlstat		84 /* remove */
+#define __NR_readlink		85 /* obsolete -> sys_readlinkat */
+#define __NR_uselib		86 /* remove */
+#define __NR_swapon		87 /* ok */
+#define __NR_reboot		88 /* ok */
+#define __NR_readdir		89 /* remove ? */
+#define __NR_mmap		90 /* obsolete -> sys_mmap2 */
+#define __NR_munmap		91 /* ok - mmu and nommu */
+#define __NR_truncate		92 /* ok or truncate64 */
+#define __NR_ftruncate		93 /* ok or ftruncate64 */
+#define __NR_fchmod		94 /* ok */
+#define __NR_fchown		95 /* ok */
+#define __NR_getpriority	96 /* ok */
+#define __NR_setpriority	97 /* ok */
+#define __NR_profil		98 /* remove */
+#define __NR_statfs		99 /* ok or statfs64 */
+#define __NR_fstatfs		100  /* ok or fstatfs64 */
+#define __NR_ioperm		101 /* remove */
+#define __NR_socketcall		102 /* remove */
+#define __NR_syslog		103 /* ok */
+#define __NR_setitimer		104 /* ok */
+#define __NR_getitimer		105 /* ok */
+#define __NR_stat		106 /* remove */
+#define __NR_lstat		107 /* remove */
+#define __NR_fstat		108 /* remove */
+#define __NR_olduname		109 /* remove */
+#define __NR_iopl		110 /* remove */
+#define __NR_vhangup		111 /* ok */
+#define __NR_idle		112 /* remove */
+#define __NR_vm86old		113 /* remove */
+#define __NR_wait4		114 /* obsolete -> waitid */
+#define __NR_swapoff		115 /* ok */
+#define __NR_sysinfo		116 /* ok */
+#define __NR_ipc		117 /* remove - direct call */
+#define __NR_fsync		118 /* ok */
+#define __NR_sigreturn		119 /* obsolete -> sys_rt_sigreturn */
+#define __NR_clone		120 /* ok */
+#define __NR_setdomainname	121 /* ok */
+#define __NR_uname		122 /* remove */
+#define __NR_modify_ldt		123 /* remove */
+#define __NR_adjtimex		124 /* ok */
+#define __NR_mprotect		125 /* remove */
+#define __NR_sigprocmask	126 /* obsolete -> sys_rt_sigprocmask */
+#define __NR_create_module	127 /* remove */
+#define __NR_init_module	128 /* ok */
+#define __NR_delete_module	129 /* ok */
+#define __NR_get_kernel_syms	130 /* remove */
+#define __NR_quotactl		131 /* ok */
+#define __NR_getpgid		132 /* ok */
+#define __NR_fchdir		133 /* ok */
+#define __NR_bdflush		134 /* remove */
+#define __NR_sysfs		135 /* needed for busybox */
+#define __NR_personality	136 /* ok */
+#define __NR_afs_syscall	137 /* Syscall for Andrew File System */
+#define __NR_setfsuid		138 /* ok */
+#define __NR_setfsgid		139 /* ok */
+#define __NR__llseek		140 /* remove only lseek */
+#define __NR_getdents		141 /* ok or getdents64 */
+#define __NR__newselect		142 /* remove */
+#define __NR_flock		143 /* ok */
+#define __NR_msync		144 /* remove */
+#define __NR_readv		145 /* ok */
+#define __NR_writev		146 /* ok */
+#define __NR_getsid		147 /* ok */
+#define __NR_fdatasync		148 /* ok */
+#define __NR__sysctl		149 /* remove */
+#define __NR_mlock		150 /* ok - nommu or mmu */
+#define __NR_munlock		151 /* ok - nommu or mmu */
+#define __NR_mlockall		152 /* ok - nommu or mmu */
+#define __NR_munlockall		153 /* ok - nommu or mmu */
+#define __NR_sched_setparam		154 /* ok */
+#define __NR_sched_getparam		155 /* ok */
+#define __NR_sched_setscheduler		156 /* ok */
+#define __NR_sched_getscheduler		157 /* ok */
+#define __NR_sched_yield		158 /* ok */
+#define __NR_sched_get_priority_max	159 /* ok */
+#define __NR_sched_get_priority_min	160 /* ok */
+#define __NR_sched_rr_get_interval	161 /* ok */
+#define __NR_nanosleep		162 /* ok */
+#define __NR_mremap		163 /* ok - nommu or mmu */
+#define __NR_setresuid		164 /* ok */
+#define __NR_getresuid		165 /* ok */
+#define __NR_vm86		166 /* remove */
+#define __NR_query_module	167 /* ok */
+#define __NR_poll		168 /* obsolete -> sys_ppoll */
+#define __NR_nfsservctl		169 /* ok */
+#define __NR_setresgid		170 /* ok */
+#define __NR_getresgid		171 /* ok */
+#define __NR_prctl		172 /* ok */
+#define __NR_rt_sigreturn	173 /* ok */
+#define __NR_rt_sigaction	174 /* ok */
+#define __NR_rt_sigprocmask	175 /* ok */
+#define __NR_rt_sigpending	176 /* ok */
+#define __NR_rt_sigtimedwait	177 /* ok */
+#define __NR_rt_sigqueueinfo	178 /* ok */
+#define __NR_rt_sigsuspend	179 /* ok */
+#define __NR_pread64		180 /* ok */
+#define __NR_pwrite64		181 /* ok */
+#define __NR_chown		182 /* obsolete -> fchownat */
+#define __NR_getcwd		183 /* ok */
+#define __NR_capget		184 /* ok */
+#define __NR_capset		185 /* ok */
+#define __NR_sigaltstack	186 /* remove */
+#define __NR_sendfile		187 /* ok -> exist 64bit version*/
+#define __NR_getpmsg		188 /* remove - some people actually want streams */
+#define __NR_putpmsg		189 /* remove - some people actually want streams */
+#define __NR_vfork		190 /* for noMMU - group with clone -> maybe remove */
+#define __NR_ugetrlimit		191 /* remove - SuS compliant getrlimit */
+#define __NR_mmap2		192 /* ok */
+#define __NR_truncate64		193 /* ok */
+#define __NR_ftruncate64	194 /* ok */
+#define __NR_stat64		195 /* remove _ARCH_WANT_STAT64 */
+#define __NR_lstat64		196 /* remove _ARCH_WANT_STAT64 */
+#define __NR_fstat64		197 /* remove _ARCH_WANT_STAT64 */
+#define __NR_lchown32		198 /* ok - without 32 */
+#define __NR_getuid32		199 /* ok - without 32 */
+#define __NR_getgid32		200 /* ok - without 32 */
+#define __NR_geteuid32		201 /* ok - without 32 */
+#define __NR_getegid32		202 /* ok - without 32 */
+#define __NR_setreuid32		203 /* ok - without 32 */
+#define __NR_setregid32		204 /* ok - without 32 */
+#define __NR_getgroups32	205 /* ok - without 32 */
+#define __NR_setgroups32	206 /* ok - without 32 */
+#define __NR_fchown32		207 /* ok - without 32 */
+#define __NR_setresuid32	208 /* ok - without 32 */
+#define __NR_getresuid32	209 /* ok - without 32 */
+#define __NR_setresgid32	210 /* ok - without 32 */
+#define __NR_getresgid32	211 /* ok - without 32 */
+#define __NR_chown32		212 /* ok - without 32 -obsolete -> fchownat */
+#define __NR_setuid32		213 /* ok - without 32 */
+#define __NR_setgid32		214 /* ok - without 32 */
+#define __NR_setfsuid32		215 /* ok - without 32 */
+#define __NR_setfsgid32		216 /* ok - without 32 */
+#define __NR_pivot_root		217 /* ok */
+#define __NR_mincore		218 /* ok */
+#define __NR_madvise		219 /* ok */
+//#define __NR_madvise1		219 /* remove delete when C lib stub is removed */
+#define __NR_getdents64		220 /* ok */
+#define __NR_fcntl64		221 /* ok */
+/* 223 is unused */
+#define __NR_gettid		224 /* ok */
+#define __NR_readahead		225 /* ok */
+#define __NR_setxattr		226 /* ok */
+#define __NR_lsetxattr		227 /* ok */
+#define __NR_fsetxattr		228 /* ok */
+#define __NR_getxattr		229 /* ok */
+#define __NR_lgetxattr		230 /* ok */
+#define __NR_fgetxattr		231 /* ok */
+#define __NR_listxattr		232 /* ok */
+#define __NR_llistxattr		233 /* ok */
+#define __NR_flistxattr		234 /* ok */
+#define __NR_removexattr	235 /* ok */
+#define __NR_lremovexattr	236 /* ok */
+#define __NR_fremovexattr	237 /* ok */
+#define __NR_tkill		238 /* ok */
+#define __NR_sendfile64		239 /* ok */
+#define __NR_futex		240 /* ok */
+#define __NR_sched_setaffinity	241 /* ok */
+#define __NR_sched_getaffinity	242 /* ok */
+#define __NR_set_thread_area	243 /* remove */
+#define __NR_get_thread_area	244 /* remove */
+#define __NR_io_setup		245 /* ok */
+#define __NR_io_destroy		246 /* ok */
+#define __NR_io_getevents	247 /* ok */
+#define __NR_io_submit		248 /* ok */
+#define __NR_io_cancel		249 /* ok */
+#define __NR_fadvise64		250 /* remove -> sys_fadvise64_64 */
+/* 251 is available for reuse (was briefly sys_set_zone_reclaim) */
+#define __NR_exit_group		252 /* ok */
+#define __NR_lookup_dcookie	253 /* ok */
+#define __NR_epoll_create	254 /* ok */
+#define __NR_epoll_ctl		255 /* ok */
+#define __NR_epoll_wait		256 /* obsolete -> sys_epoll_pwait */
+#define __NR_remap_file_pages	257 /* only for mmu */
+#define __NR_set_tid_address	258 /* ok */
+#define __NR_timer_create	259 /* ok */
+#define __NR_timer_settime	(__NR_timer_create+1) /* 260 */ /* ok */
+#define __NR_timer_gettime	(__NR_timer_create+2) /* 261 */ /* ok */
+#define __NR_timer_getoverrun	(__NR_timer_create+3) /* 262 */ /* ok */
+#define __NR_timer_delete	(__NR_timer_create+4) /* 263 */ /* ok */
+#define __NR_clock_settime	(__NR_timer_create+5) /* 264 */ /* ok */
+#define __NR_clock_gettime	(__NR_timer_create+6) /* 265 */ /* ok */
+#define __NR_clock_getres	(__NR_timer_create+7) /* 266 */ /* ok */
+#define __NR_clock_nanosleep	(__NR_timer_create+8) /* 267 */ /* ok */
+#define __NR_statfs64		268 /* ok */
+#define __NR_fstatfs64		269 /* ok */
+#define __NR_tgkill		270 /* ok */
+#define __NR_utimes		271 /* obsolete -> sys_futimesat */
+#define __NR_fadvise64_64	272 /* ok */
+#define __NR_vserver		273 /* ok */
+#define __NR_mbind		274 /* only for mmu */
+#define __NR_get_mempolicy	275 /* only for mmu */
+#define __NR_set_mempolicy	276 /* only for mmu */
+#define __NR_mq_open		277 /* ok */
+#define __NR_mq_unlink		(__NR_mq_open+1) /* 278 */ /* ok */
+#define __NR_mq_timedsend	(__NR_mq_open+2) /* 279 */ /* ok */
+#define __NR_mq_timedreceive	(__NR_mq_open+3) /* 280 */ /* ok */
+#define __NR_mq_notify		(__NR_mq_open+4) /* 281 */ /* ok */
+#define __NR_mq_getsetattr	(__NR_mq_open+5) /* 282 */ /* ok */
+#define __NR_kexec_load		283 /* ok */
+#define __NR_waitid		284 /* ok */
+/* #define __NR_sys_setaltroot	285 */
+#define __NR_add_key		286 /* ok */
+#define __NR_request_key	287 /* ok */
+#define __NR_keyctl		288 /* ok */
+#define __NR_ioprio_set		289 /* ok */
+#define __NR_ioprio_get		290 /* ok */
+#define __NR_inotify_init	291 /* ok */
+#define __NR_inotify_add_watch	292 /* ok */
+#define __NR_inotify_rm_watch	293 /* ok */
+#define __NR_migrate_pages	294 /* mmu */
+#define __NR_openat		295 /* ok */
+#define __NR_mkdirat		296 /* ok */
+#define __NR_mknodat		297 /* ok */
+#define __NR_fchownat		298 /* ok */
+#define __NR_futimesat		299 /* obsolete -> sys_utimesat */
+#define __NR_fstatat64		300 /* stat64 */
+#define __NR_unlinkat		301 /* ok */
+#define __NR_renameat		302 /* ok */
+#define __NR_linkat		303 /* ok */
+#define __NR_symlinkat		304 /* ok */
+#define __NR_readlinkat		305 /* ok */
+#define __NR_fchmodat		306 /* ok */
+#define __NR_faccessat		307 /* ok */
+#define __NR_pselect6		308 /* obsolete -> sys_pselect7 */
+#define __NR_ppoll		309 /* ok */
+#define __NR_unshare		310 /* ok */
+#define __NR_set_robust_list	311 /* ok */
+#define __NR_get_robust_list	312 /* ok */
+#define __NR_splice		313 /* ok */
+#define __NR_sync_file_range	314 /* ok */
+#define __NR_tee		315 /* ok */
+#define __NR_vmsplice		316 /* ok */
+#define __NR_move_pages		317 /* mmu */
+#define __NR_getcpu		318 /* ok */
+#define __NR_epoll_pwait	319 /* ok */
+#define __NR_utimensat		320 /* ok */
+#define __NR_signalfd		321 /* ok */
+#define __NR_timerfd_create	322 /* ok */
+#define __NR_eventfd		323 /* ok */
+#define __NR_fallocate		324 /* ok */
+#define __NR_semtimedop		325 /* ok - semaphore group */
+#define __NR_timerfd_settime	326 /* ok */
+#define __NR_timerfd_gettime	327 /* ok */
+/* sysv ipc syscalls */
+#define __NR_semctl		328 /* ok */
+#define __NR_semget		329 /* ok */
+#define __NR_semop		330 /* ok */
+#define __NR_msgctl		331 /* ok */
+#define __NR_msgget		332 /* ok */
+#define __NR_msgrcv		333 /* ok */
+#define __NR_msgsnd		334 /* ok */
+#define __NR_shmat		335 /* ok */
+#define __NR_shmctl		336 /* ok */
+#define __NR_shmdt		337 /* ok */
+#define __NR_shmget		338 /* ok */
+
+
+#define __NR_signalfd4		339 /* new */
+#define __NR_eventfd2		340 /* new */
+#define __NR_epoll_create1	341 /* new */
+#define __NR_dup3		342 /* new */
+#define __NR_pipe2		343 /* new */
+#define __NR_inotify_init1	344 /* new */
+#define __NR_socket		345 /* new */
+#define __NR_socketpair		346 /* new */
+#define __NR_bind		347 /* new */
+#define __NR_listen		348 /* new */
+#define __NR_accept		349 /* new */
+#define __NR_connect		350 /* new */
+#define __NR_getsockname	351 /* new */
+#define __NR_getpeername	352 /* new */
+#define __NR_sendto		353 /* new */
+#define __NR_send		354 /* new */
+#define __NR_recvfrom		355 /* new */
+#define __NR_recv		356 /* new */
+#define __NR_setsockopt		357 /* new */
+#define __NR_getsockopt		358 /* new */
+#define __NR_shutdown		359 /* new */
+#define __NR_sendmsg		360 /* new */
+#define __NR_recvmsg		361 /* new */
+#define __NR_accept04		362 /* new */
+
+#define __NR_syscalls		363
+
+#ifdef __KERNEL__
+#ifndef __ASSEMBLY__
+
+#define __ARCH_WANT_IPC_PARSE_VERSION
+/* #define __ARCH_WANT_OLD_READDIR */
+/* #define __ARCH_WANT_OLD_STAT */
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+/* #define __ARCH_WANT_SYS_OLD_GETRLIMIT */
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#define __ARCH_WANT_SYS_RT_SIGACTION
+/* #define __ARCH_WANT_SYS_RT_SIGSUSPEND */
+
+/*
+ * "Conditional" syscalls
+ *
+ * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
+ * but it doesn't work on all toolchains, so we just do it by hand
+ */
+#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
+
+#endif /* __ASSEMBLY__ */
+#endif /* __KERNEL__ */
+#endif /* _ASM_MICROBLAZE_UNISTD_H */
Signature · 1 line
1.5.5.1
author maintainer
#17 lore raw

PATCH 17/57 microblaze_v7: supported function for memory - kernel/lib

In reply to [email protected]

From: Michal Simek <[email protected]>

---
 arch/microblaze/lib/fastcopy.S |  660 ++++++++++++++++++++++++++++++++++++++++
 arch/microblaze/lib/memcpy.c   |  160 ++++++++++
 arch/microblaze/lib/memmove.c  |  174 +++++++++++
 arch/microblaze/lib/memset.c   |   81 +++++
 4 files changed, 1075 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/lib/fastcopy.S
 create mode 100644 arch/microblaze/lib/memcpy.c
 create mode 100644 arch/microblaze/lib/memmove.c
 create mode 100644 arch/microblaze/lib/memset.c
arch/microblaze/lib/fastcopy.S new file +660 -0
new file mode 100644
index 0000000..df5e4ad
@@ -0,0 +1,660 @@
+/*
+ * Copyright 2008 (c) Jim Law - Iris LP  All rights reserved.
+ *
+ * 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 Jim Law <[email protected]>
+ *
+ * intended to replace:
+ *	memcpy in memcpy.c and
+ *	memmove in memmove.c
+ * ... in arch/microblaze/lib
+ *
+ *
+ * assly_fastcopy.S
+ *
+ * Attempt at quicker memcpy and memmove for MicroBlaze
+ *	Input :	Operand1 in Reg r5 - destination address
+ *		Operand2 in Reg r6 - source address
+ *		Operand3 in Reg r7 - number of bytes to transfer
+ *	Output: Result in Reg r3 - starting destinaition address
+ *
+ *
+ * Explanation:
+ *	Perform (possibly unaligned) copy of a block of memory
+ *	between mem locations with size of xfer spec'd in bytes
+ */
+
+#include <linux/linkage.h>
+
+	.globl	memcpy
+	.ent	memcpy
+
+memcpy:
+fast_memcpy_ascending:
+	/* move d to return register as value of function */
+	addi	r3, r5, 0
+
+	addi	r4, r0, 4	/* n = 4 */
+	cmpu	r4, r4, r7	/* n = c - n  (unsigned) */
+	blti	r4, a_xfer_end	/* if n < 0, less than one word to transfer */
+
+	/* transfer first 0~3 bytes to get aligned dest address */
+	andi	r4, r5, 3		/* n = d & 3 */
+	/* if zero, destination already aligned */
+	beqi	r4, a_dalign_done
+	/* n = 4 - n (yields 3, 2, 1 transfers for 1, 2, 3 addr offset) */
+	rsubi	r4, r4, 4
+	rsub	r7, r4, r7		/* c = c - n adjust c */
+
+a_xfer_first_loop:
+	/* if no bytes left to transfer, transfer the bulk */
+	beqi	r4, a_dalign_done
+	lbui	r11, r6, 0		/* h = *s */
+	sbi	r11, r5, 0		/* *d = h */
+	addi	r6, r6, 1		/* s++ */
+	addi	r5, r5, 1		/* d++ */
+	brid	a_xfer_first_loop	/* loop */
+	addi	r4, r4, -1		/* n-- (IN DELAY SLOT) */
+
+a_dalign_done:
+	addi	r4, r0, 32		/* n = 32 */
+	cmpu	r4, r4, r7		/* n = c - n  (unsigned) */
+	/* if n < 0, less than one block to transfer */
+	blti	r4, a_block_done
+
+a_block_xfer:
+	andi	r4, r7, 0xffffffe0	/* n = c & ~31 */
+	rsub	r7, r4, r7		/* c = c - n */
+
+	andi	r9, r6, 3		/* t1 = s & 3 */
+	/* if temp != 0, unaligned transfers needed */
+	bnei	r9, a_block_unaligned
+
+a_block_aligned:
+	lwi	r9, r6, 0		/* t1 = *(s + 0) */
+	lwi	r10, r6, 4		/* t2 = *(s + 4) */
+	lwi	r11, r6, 8		/* t3 = *(s + 8) */
+	lwi	r12, r6, 12		/* t4 = *(s + 12) */
+	swi	r9, r5, 0		/* *(d + 0) = t1 */
+	swi	r10, r5, 4		/* *(d + 4) = t2 */
+	swi	r11, r5, 8		/* *(d + 8) = t3 */
+	swi	r12, r5, 12		/* *(d + 12) = t4 */
+	lwi	r9, r6, 16		/* t1 = *(s + 16) */
+	lwi	r10, r6, 20		/* t2 = *(s + 20) */
+	lwi	r11, r6, 24		/* t3 = *(s + 24) */
+	lwi	r12, r6, 28		/* t4 = *(s + 28) */
+	swi	r9, r5, 16		/* *(d + 16) = t1 */
+	swi	r10, r5, 20		/* *(d + 20) = t2 */
+	swi	r11, r5, 24		/* *(d + 24) = t3 */
+	swi	r12, r5, 28		/* *(d + 28) = t4 */
+	addi	r6, r6, 32		/* s = s + 32 */
+	addi	r4, r4, -32		/* n = n - 32 */
+	bneid	r4, a_block_aligned	/* while (n) loop */
+	addi	r5, r5, 32		/* d = d + 32 (IN DELAY SLOT) */
+	bri	a_block_done
+
+a_block_unaligned:
+	andi	r8, r6, 0xfffffffc	/* as = s & ~3 */
+	add	r6, r6, r4		/* s = s + n */
+	lwi	r11, r8, 0		/* h = *(as + 0) */
+
+	addi	r9, r9, -1
+	beqi	r9, a_block_u1		/* t1 was 1 => 1 byte offset */
+	addi	r9, r9, -1
+	beqi	r9, a_block_u2		/* t1 was 2 => 2 byte offset */
+
+a_block_u3:
+	bslli	r11, r11, 24	/* h = h << 24 */
+a_bu3_loop:
+	lwi	r12, r8, 4	/* v = *(as + 4) */
+	bsrli	r9, r12, 8	/* t1 = v >> 8 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 0	/* *(d + 0) = t1 */
+	bslli	r11, r12, 24	/* h = v << 24 */
+	lwi	r12, r8, 8	/* v = *(as + 8) */
+	bsrli	r9, r12, 8	/* t1 = v >> 8 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 4	/* *(d + 4) = t1 */
+	bslli	r11, r12, 24	/* h = v << 24 */
+	lwi	r12, r8, 12	/* v = *(as + 12) */
+	bsrli	r9, r12, 8	/* t1 = v >> 8 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 8	/* *(d + 8) = t1 */
+	bslli	r11, r12, 24	/* h = v << 24 */
+	lwi	r12, r8, 16	/* v = *(as + 16) */
+	bsrli	r9, r12, 8	/* t1 = v >> 8 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 12	/* *(d + 12) = t1 */
+	bslli	r11, r12, 24	/* h = v << 24 */
+	lwi	r12, r8, 20	/* v = *(as + 20) */
+	bsrli	r9, r12, 8	/* t1 = v >> 8 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 16	/* *(d + 16) = t1 */
+	bslli	r11, r12, 24	/* h = v << 24 */
+	lwi	r12, r8, 24	/* v = *(as + 24) */
+	bsrli	r9, r12, 8	/* t1 = v >> 8 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 20	/* *(d + 20) = t1 */
+	bslli	r11, r12, 24	/* h = v << 24 */
+	lwi	r12, r8, 28	/* v = *(as + 28) */
+	bsrli	r9, r12, 8	/* t1 = v >> 8 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 24	/* *(d + 24) = t1 */
+	bslli	r11, r12, 24	/* h = v << 24 */
+	lwi	r12, r8, 32	/* v = *(as + 32) */
+	bsrli	r9, r12, 8	/* t1 = v >> 8 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 28	/* *(d + 28) = t1 */
+	bslli	r11, r12, 24	/* h = v << 24 */
+	addi	r8, r8, 32	/* as = as + 32 */
+	addi	r4, r4, -32	/* n = n - 32 */
+	bneid	r4, a_bu3_loop	/* while (n) loop */
+	addi	r5, r5, 32	/* d = d + 32 (IN DELAY SLOT) */
+	bri	a_block_done
+
+a_block_u1:
+	bslli	r11, r11, 8	/* h = h << 8 */
+a_bu1_loop:
+	lwi	r12, r8, 4	/* v = *(as + 4) */
+	bsrli	r9, r12, 24	/* t1 = v >> 24 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 0	/* *(d + 0) = t1 */
+	bslli	r11, r12, 8	/* h = v << 8 */
+	lwi	r12, r8, 8	/* v = *(as + 8) */
+	bsrli	r9, r12, 24	/* t1 = v >> 24 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 4	/* *(d + 4) = t1 */
+	bslli	r11, r12, 8	/* h = v << 8 */
+	lwi	r12, r8, 12	/* v = *(as + 12) */
+	bsrli	r9, r12, 24	/* t1 = v >> 24 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 8	/* *(d + 8) = t1 */
+	bslli	r11, r12, 8	/* h = v << 8 */
+	lwi	r12, r8, 16	/* v = *(as + 16) */
+	bsrli	r9, r12, 24	/* t1 = v >> 24 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 12	/* *(d + 12) = t1 */
+	bslli	r11, r12, 8	/* h = v << 8 */
+	lwi	r12, r8, 20	/* v = *(as + 20) */
+	bsrli	r9, r12, 24	/* t1 = v >> 24 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 16	/* *(d + 16) = t1 */
+	bslli	r11, r12, 8	/* h = v << 8 */
+	lwi	r12, r8, 24	/* v = *(as + 24) */
+	bsrli	r9, r12, 24	/* t1 = v >> 24 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 20	/* *(d + 20) = t1 */
+	bslli	r11, r12, 8	/* h = v << 8 */
+	lwi	r12, r8, 28	/* v = *(as + 28) */
+	bsrli	r9, r12, 24	/* t1 = v >> 24 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 24	/* *(d + 24) = t1 */
+	bslli	r11, r12, 8	/* h = v << 8 */
+	lwi	r12, r8, 32	/* v = *(as + 32) */
+	bsrli	r9, r12, 24	/* t1 = v >> 24 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 28	/* *(d + 28) = t1 */
+	bslli	r11, r12, 8	/* h = v << 8 */
+	addi	r8, r8, 32	/* as = as + 32 */
+	addi	r4, r4, -32	/* n = n - 32 */
+	bneid	r4, a_bu1_loop	/* while (n) loop */
+	addi	r5, r5, 32	/* d = d + 32 (IN DELAY SLOT) */
+	bri	a_block_done
+
+a_block_u2:
+	bslli	r11, r11, 16	/* h = h << 16 */
+a_bu2_loop:
+	lwi	r12, r8, 4	/* v = *(as + 4) */
+	bsrli	r9, r12, 16	/* t1 = v >> 16 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 0	/* *(d + 0) = t1 */
+	bslli	r11, r12, 16	/* h = v << 16 */
+	lwi	r12, r8, 8	/* v = *(as + 8) */
+	bsrli	r9, r12, 16	/* t1 = v >> 16 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 4	/* *(d + 4) = t1 */
+	bslli	r11, r12, 16	/* h = v << 16 */
+	lwi	r12, r8, 12	/* v = *(as + 12) */
+	bsrli	r9, r12, 16	/* t1 = v >> 16 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 8	/* *(d + 8) = t1 */
+	bslli	r11, r12, 16	/* h = v << 16 */
+	lwi	r12, r8, 16	/* v = *(as + 16) */
+	bsrli	r9, r12, 16	/* t1 = v >> 16 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 12	/* *(d + 12) = t1 */
+	bslli	r11, r12, 16	/* h = v << 16 */
+	lwi	r12, r8, 20	/* v = *(as + 20) */
+	bsrli	r9, r12, 16	/* t1 = v >> 16 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 16	/* *(d + 16) = t1 */
+	bslli	r11, r12, 16	/* h = v << 16 */
+	lwi	r12, r8, 24	/* v = *(as + 24) */
+	bsrli	r9, r12, 16	/* t1 = v >> 16 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 20	/* *(d + 20) = t1 */
+	bslli	r11, r12, 16	/* h = v << 16 */
+	lwi	r12, r8, 28	/* v = *(as + 28) */
+	bsrli	r9, r12, 16	/* t1 = v >> 16 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 24	/* *(d + 24) = t1 */
+	bslli	r11, r12, 16	/* h = v << 16 */
+	lwi	r12, r8, 32	/* v = *(as + 32) */
+	bsrli	r9, r12, 16	/* t1 = v >> 16 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 28	/* *(d + 28) = t1 */
+	bslli	r11, r12, 16	/* h = v << 16 */
+	addi	r8, r8, 32	/* as = as + 32 */
+	addi	r4, r4, -32	/* n = n - 32 */
+	bneid	r4, a_bu2_loop	/* while (n) loop */
+	addi	r5, r5, 32	/* d = d + 32 (IN DELAY SLOT) */
+
+a_block_done:
+	addi	r4, r0, 4	/* n = 4 */
+	cmpu	r4, r4, r7	/* n = c - n  (unsigned) */
+	blti	r4, a_xfer_end	/* if n < 0, less than one word to transfer */
+
+a_word_xfer:
+	andi	r4, r7, 0xfffffffc	/* n = c & ~3 */
+	addi	r10, r0, 0		/* offset = 0 */
+
+	andi	r9, r6, 3		/* t1 = s & 3 */
+	/* if temp != 0, unaligned transfers needed */
+	bnei	r9, a_word_unaligned
+
+a_word_aligned:
+	lw	r9, r6, r10		/* t1 = *(s+offset) */
+	sw	r9, r5, r10		/* *(d+offset) = t1 */
+	addi	r4, r4,-4		/* n-- */
+	bneid	r4, a_word_aligned	/* loop */
+	addi	r10, r10, 4		/* offset++ (IN DELAY SLOT) */
+
+	bri	a_word_done
+
+a_word_unaligned:
+	andi	r8, r6, 0xfffffffc	/* as = s & ~3 */
+	lwi	r11, r8, 0		/* h = *(as + 0) */
+	addi	r8, r8, 4		/* as = as + 4 */
+
+	addi	r9, r9, -1
+	beqi	r9, a_word_u1		/* t1 was 1 => 1 byte offset */
+	addi	r9, r9, -1
+	beqi	r9, a_word_u2		/* t1 was 2 => 2 byte offset */
+
+a_word_u3:
+	bslli	r11, r11, 24	/* h = h << 24 */
+a_wu3_loop:
+	lw	r12, r8, r10	/* v = *(as + offset) */
+	bsrli	r9, r12, 8	/* t1 = v >> 8 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	sw	r9, r5, r10	/* *(d + offset) = t1 */
+	bslli	r11, r12, 24	/* h = v << 24 */
+	addi	r4, r4,-4	/* n = n - 4 */
+	bneid	r4, a_wu3_loop	/* while (n) loop */
+	addi	r10, r10, 4	/* offset = ofset + 4 (IN DELAY SLOT) */
+
+	bri	a_word_done
+
+a_word_u1:
+	bslli	r11, r11, 8	/* h = h << 8 */
+a_wu1_loop:
+	lw	r12, r8, r10	/* v = *(as + offset) */
+	bsrli	r9, r12, 24	/* t1 = v >> 24 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	sw	r9, r5, r10	/* *(d + offset) = t1 */
+	bslli	r11, r12, 8	/* h = v << 8 */
+	addi	r4, r4,-4	/* n = n - 4 */
+	bneid	r4, a_wu1_loop	/* while (n) loop */
+	addi	r10, r10, 4	/* offset = ofset + 4 (IN DELAY SLOT) */
+
+	bri	a_word_done
+
+a_word_u2:
+	bslli	r11, r11, 16	/* h = h << 16 */
+a_wu2_loop:
+	lw	r12, r8, r10	/* v = *(as + offset) */
+	bsrli	r9, r12, 16	/* t1 = v >> 16 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	sw	r9, r5, r10	/* *(d + offset) = t1 */
+	bslli	r11, r12, 16	/* h = v << 16 */
+	addi	r4, r4,-4	/* n = n - 4 */
+	bneid	r4, a_wu2_loop	/* while (n) loop */
+	addi	r10, r10, 4	/* offset = ofset + 4 (IN DELAY SLOT) */
+
+a_word_done:
+	add	r5, r5, r10	/* d = d + offset */
+	add	r6, r6, r10	/* s = s + offset */
+	rsub	r7, r10, r7	/* c = c - offset */
+
+a_xfer_end:
+a_xfer_end_loop:
+	beqi	r7, a_done		/* while (c) */
+	lbui	r9, r6, 0		/* t1 = *s */
+	addi	r6, r6, 1		/* s++ */
+	sbi	r9, r5, 0		/* *d = t1 */
+	addi	r7, r7, -1		/* c-- */
+	brid	a_xfer_end_loop		/* loop */
+	addi	r5, r5, 1		/* d++ (IN DELAY SLOT) */
+
+a_done:
+	rtsd	r15, 8
+	nop
+
+.end memcpy
+/*----------------------------------------------------------------------------*/
+	.globl	memmove
+	.ent	memmove
+
+memmove:
+	cmpu	r4, r5, r6	/* n = s - d */
+	bgei	r4,fast_memcpy_ascending
+
+fast_memcpy_descending:
+	/* move d to return register as value of function */
+	addi	r3, r5, 0
+
+	add	r5, r5, r7	/* d = d + c */
+	add	r6, r6, r7	/* s = s + c */
+
+	addi	r4, r0, 4	/* n = 4 */
+	cmpu	r4, r4, r7	/* n = c - n  (unsigned) */
+	blti	r4,d_xfer_end	/* if n < 0, less than one word to transfer */
+
+	/* transfer first 0~3 bytes to get aligned dest address */
+	andi	r4, r5, 3		/* n = d & 3 */
+	/* if zero, destination already aligned */
+	beqi	r4,d_dalign_done
+	rsub	r7, r4, r7		/* c = c - n adjust c */
+
+d_xfer_first_loop:
+	/* if no bytes left to transfer, transfer the bulk */
+	beqi	r4,d_dalign_done
+	addi	r6, r6, -1		/* s-- */
+	addi	r5, r5, -1		/* d-- */
+	lbui	r11, r6, 0		/* h = *s */
+	sbi	r11, r5, 0		/* *d = h */
+	brid	d_xfer_first_loop	/* loop */
+	addi	r4, r4, -1		/* n-- (IN DELAY SLOT) */
+
+d_dalign_done:
+	addi	r4, r0, 32	/* n = 32 */
+	cmpu	r4, r4, r7	/* n = c - n  (unsigned) */
+	/* if n < 0, less than one block to transfer */
+	blti	r4, d_block_done
+
+d_block_xfer:
+	andi	r4, r7, 0xffffffe0	/* n = c & ~31 */
+	rsub	r7, r4, r7		/* c = c - n */
+
+	andi	r9, r6, 3		/* t1 = s & 3 */
+	/* if temp != 0, unaligned transfers needed */
+	bnei	r9, d_block_unaligned
+
+d_block_aligned:
+	addi	r6, r6, -32		/* s = s - 32 */
+	addi	r5, r5, -32		/* d = d - 32 */
+	lwi	r9, r6, 28		/* t1 = *(s + 28) */
+	lwi	r10, r6, 24		/* t2 = *(s + 24) */
+	lwi	r11, r6, 20		/* t3 = *(s + 20) */
+	lwi	r12, r6, 16		/* t4 = *(s + 16) */
+	swi	r9, r5, 28		/* *(d + 28) = t1 */
+	swi	r10, r5, 24		/* *(d + 24) = t2 */
+	swi	r11, r5, 20		/* *(d + 20) = t3 */
+	swi	r12, r5, 16		/* *(d + 16) = t4 */
+	lwi	r9, r6, 12		/* t1 = *(s + 12) */
+	lwi	r10, r6, 8		/* t2 = *(s + 8) */
+	lwi	r11, r6, 4		/* t3 = *(s + 4) */
+	lwi	r12, r6, 0		/* t4 = *(s + 0) */
+	swi	r9, r5, 12		/* *(d + 12) = t1 */
+	swi	r10, r5, 8		/* *(d + 8) = t2 */
+	swi	r11, r5, 4		/* *(d + 4) = t3 */
+	addi	r4, r4, -32		/* n = n - 32 */
+	bneid	r4, d_block_aligned	/* while (n) loop */
+	swi	r12, r5, 0		/* *(d + 0) = t4 (IN DELAY SLOT) */
+	bri	d_block_done
+
+d_block_unaligned:
+	andi	r8, r6, 0xfffffffc	/* as = s & ~3 */
+	rsub	r6, r4, r6		/* s = s - n */
+	lwi	r11, r8, 0		/* h = *(as + 0) */
+
+	addi	r9, r9, -1
+	beqi	r9,d_block_u1		/* t1 was 1 => 1 byte offset */
+	addi	r9, r9, -1
+	beqi	r9,d_block_u2		/* t1 was 2 => 2 byte offset */
+
+d_block_u3:
+	bsrli	r11, r11, 8	/* h = h >> 8 */
+d_bu3_loop:
+	addi	r8, r8, -32	/* as = as - 32 */
+	addi	r5, r5, -32	/* d = d - 32 */
+	lwi	r12, r8, 28	/* v = *(as + 28) */
+	bslli	r9, r12, 24	/* t1 = v << 24 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 28	/* *(d + 28) = t1 */
+	bsrli	r11, r12, 8	/* h = v >> 8 */
+	lwi	r12, r8, 24	/* v = *(as + 24) */
+	bslli	r9, r12, 24	/* t1 = v << 24 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 24	/* *(d + 24) = t1 */
+	bsrli	r11, r12, 8	/* h = v >> 8 */
+	lwi	r12, r8, 20	/* v = *(as + 20) */
+	bslli	r9, r12, 24	/* t1 = v << 24 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 20	/* *(d + 20) = t1 */
+	bsrli	r11, r12, 8	/* h = v >> 8 */
+	lwi	r12, r8, 16	/* v = *(as + 16) */
+	bslli	r9, r12, 24	/* t1 = v << 24 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 16	/* *(d + 16) = t1 */
+	bsrli	r11, r12, 8	/* h = v >> 8 */
+	lwi	r12, r8, 12	/* v = *(as + 12) */
+	bslli	r9, r12, 24	/* t1 = v << 24 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 12	/* *(d + 112) = t1 */
+	bsrli	r11, r12, 8	/* h = v >> 8 */
+	lwi	r12, r8, 8	/* v = *(as + 8) */
+	bslli	r9, r12, 24	/* t1 = v << 24 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 8	/* *(d + 8) = t1 */
+	bsrli	r11, r12, 8	/* h = v >> 8 */
+	lwi	r12, r8, 4	/* v = *(as + 4) */
+	bslli	r9, r12, 24	/* t1 = v << 24 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 4	/* *(d + 4) = t1 */
+	bsrli	r11, r12, 8	/* h = v >> 8 */
+	lwi	r12, r8, 0	/* v = *(as + 0) */
+	bslli	r9, r12, 24	/* t1 = v << 24 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 0	/* *(d + 0) = t1 */
+	addi	r4, r4, -32	/* n = n - 32 */
+	bneid	r4, d_bu3_loop	/* while (n) loop */
+	bsrli	r11, r12, 8	/* h = v >> 8 (IN DELAY SLOT) */
+	bri	d_block_done
+
+d_block_u1:
+	bsrli	r11, r11, 24	/* h = h >> 24 */
+d_bu1_loop:
+	addi	r8, r8, -32	/* as = as - 32 */
+	addi	r5, r5, -32	/* d = d - 32 */
+	lwi	r12, r8, 28	/* v = *(as + 28) */
+	bslli	r9, r12, 8	/* t1 = v << 8 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 28	/* *(d + 28) = t1 */
+	bsrli	r11, r12, 24	/* h = v >> 24 */
+	lwi	r12, r8, 24	/* v = *(as + 24) */
+	bslli	r9, r12, 8	/* t1 = v << 8 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 24	/* *(d + 24) = t1 */
+	bsrli	r11, r12, 24	/* h = v >> 24 */
+	lwi	r12, r8, 20	/* v = *(as + 20) */
+	bslli	r9, r12, 8	/* t1 = v << 8 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 20	/* *(d + 20) = t1 */
+	bsrli	r11, r12, 24	/* h = v >> 24 */
+	lwi	r12, r8, 16	/* v = *(as + 16) */
+	bslli	r9, r12, 8	/* t1 = v << 8 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 16	/* *(d + 16) = t1 */
+	bsrli	r11, r12, 24	/* h = v >> 24 */
+	lwi	r12, r8, 12	/* v = *(as + 12) */
+	bslli	r9, r12, 8	/* t1 = v << 8 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 12	/* *(d + 112) = t1 */
+	bsrli	r11, r12, 24	/* h = v >> 24 */
+	lwi	r12, r8, 8	/* v = *(as + 8) */
+	bslli	r9, r12, 8	/* t1 = v << 8 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 8	/* *(d + 8) = t1 */
+	bsrli	r11, r12, 24	/* h = v >> 24 */
+	lwi	r12, r8, 4	/* v = *(as + 4) */
+	bslli	r9, r12, 8	/* t1 = v << 8 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 4	/* *(d + 4) = t1 */
+	bsrli	r11, r12, 24	/* h = v >> 24 */
+	lwi	r12, r8, 0	/* v = *(as + 0) */
+	bslli	r9, r12, 8	/* t1 = v << 8 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 0	/* *(d + 0) = t1 */
+	addi	r4, r4, -32	/* n = n - 32 */
+	bneid	r4, d_bu1_loop	/* while (n) loop */
+	bsrli	r11, r12, 24	/* h = v >> 24 (IN DELAY SLOT) */
+	bri	d_block_done
+
+d_block_u2:
+	bsrli	r11, r11, 16	/* h = h >> 16 */
+d_bu2_loop:
+	addi	r8, r8, -32	/* as = as - 32 */
+	addi	r5, r5, -32	/* d = d - 32 */
+	lwi	r12, r8, 28	/* v = *(as + 28) */
+	bslli	r9, r12, 16	/* t1 = v << 16 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 28	/* *(d + 28) = t1 */
+	bsrli	r11, r12, 16	/* h = v >> 16 */
+	lwi	r12, r8, 24	/* v = *(as + 24) */
+	bslli	r9, r12, 16	/* t1 = v << 16 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 24	/* *(d + 24) = t1 */
+	bsrli	r11, r12, 16	/* h = v >> 16 */
+	lwi	r12, r8, 20	/* v = *(as + 20) */
+	bslli	r9, r12, 16	/* t1 = v << 16 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 20	/* *(d + 20) = t1 */
+	bsrli	r11, r12, 16	/* h = v >> 16 */
+	lwi	r12, r8, 16	/* v = *(as + 16) */
+	bslli	r9, r12, 16	/* t1 = v << 16 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 16	/* *(d + 16) = t1 */
+	bsrli	r11, r12, 16	/* h = v >> 16 */
+	lwi	r12, r8, 12	/* v = *(as + 12) */
+	bslli	r9, r12, 16	/* t1 = v << 16 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 12	/* *(d + 112) = t1 */
+	bsrli	r11, r12, 16	/* h = v >> 16 */
+	lwi	r12, r8, 8	/* v = *(as + 8) */
+	bslli	r9, r12, 16	/* t1 = v << 16 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 8	/* *(d + 8) = t1 */
+	bsrli	r11, r12, 16	/* h = v >> 16 */
+	lwi	r12, r8, 4	/* v = *(as + 4) */
+	bslli	r9, r12, 16	/* t1 = v << 16 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 4	/* *(d + 4) = t1 */
+	bsrli	r11, r12, 16	/* h = v >> 16 */
+	lwi	r12, r8, 0	/* v = *(as + 0) */
+	bslli	r9, r12, 16	/* t1 = v << 16 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	swi	r9, r5, 0	/* *(d + 0) = t1 */
+	addi	r4, r4, -32	/* n = n - 32 */
+	bneid	r4, d_bu2_loop	/* while (n) loop */
+	bsrli	r11, r12, 16	/* h = v >> 16 (IN DELAY SLOT) */
+
+d_block_done:
+	addi	r4, r0, 4	/* n = 4 */
+	cmpu	r4, r4, r7	/* n = c - n  (unsigned) */
+	blti	r4,d_xfer_end	/* if n < 0, less than one word to transfer */
+
+d_word_xfer:
+	andi	r4, r7, 0xfffffffc	/* n = c & ~3 */
+	rsub	r5, r4, r5		/* d = d - n */
+	rsub	r6, r4, r6		/* s = s - n */
+	rsub	r7, r4, r7		/* c = c - n */
+
+	andi	r9, r6, 3		/* t1 = s & 3 */
+	/* if temp != 0, unaligned transfers needed */
+	bnei	r9, d_word_unaligned
+
+d_word_aligned:
+	addi	r4, r4,-4		/* n-- */
+	lw	r9, r6, r4		/* t1 = *(s+n) */
+	bneid	r4, d_word_aligned	/* loop */
+	sw	r9, r5, r4		/* *(d+n) = t1 (IN DELAY SLOT) */
+
+	bri	d_word_done
+
+d_word_unaligned:
+	andi	r8, r6, 0xfffffffc	/* as = s & ~3 */
+	lw	r11, r8, r4		/* h = *(as + n) */
+
+	addi	r9, r9, -1
+	beqi	r9,d_word_u1		/* t1 was 1 => 1 byte offset */
+	addi	r9, r9, -1
+	beqi	r9,d_word_u2		/* t1 was 2 => 2 byte offset */
+
+d_word_u3:
+	bsrli	r11, r11, 8	/* h = h >> 8 */
+d_wu3_loop:
+	addi	r4, r4,-4	/* n = n - 4 */
+	lw	r12, r8, r4	/* v = *(as + n) */
+	bslli	r9, r12, 24	/* t1 = v << 24 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	sw	r9, r5, r4	/* *(d + n) = t1 */
+	bneid	r4, d_wu3_loop	/* while (n) loop */
+	bsrli	r11, r12, 8	/* h = v >> 8 (IN DELAY SLOT) */
+
+	bri	d_word_done
+
+d_word_u1:
+	bsrli	r11, r11, 24	/* h = h >> 24 */
+d_wu1_loop:
+	addi	r4, r4,-4	/* n = n - 4 */
+	lw	r12, r8, r4	/* v = *(as + n) */
+	bslli	r9, r12, 8	/* t1 = v << 8 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	sw	r9, r5, r4	/* *(d + n) = t1 */
+	bneid	r4, d_wu1_loop	/* while (n) loop */
+	bsrli	r11, r12, 24	/* h = v >> 24 (IN DELAY SLOT) */
+
+	bri	d_word_done
+
+d_word_u2:
+	bsrli	r11, r11, 16	/* h = h >> 16 */
+d_wu2_loop:
+	addi	r4, r4,-4	/* n = n - 4 */
+	lw	r12, r8, r4	/* v = *(as + n) */
+	bslli	r9, r12, 16	/* t1 = v << 16 */
+	or	r9, r11, r9	/* t1 = h | t1 */
+	sw	r9, r5, r4	/* *(d + n) = t1 */
+	bneid	r4, d_wu2_loop	/* while (n) loop */
+	bsrli	r11, r12, 16	/* h = v >> 16 (IN DELAY SLOT) */
+
+d_word_done:
+
+d_xfer_end:
+d_xfer_end_loop:
+	beqi	r7, a_done		/* while (c) */
+	addi	r6, r6, -1		/* s-- */
+	lbui	r9, r6, 0		/* t1 = *s */
+	addi	r5, r5, -1		/* d-- */
+	sbi	r9, r5, 0		/* *d = t1 */
+	brid	d_xfer_end_loop		/* loop */
+	addi	r7, r7, -1		/* c-- (IN DELAY SLOT) */
+
+d_done:
+	rtsd	r15, 8
+	nop
+
+.end memmove
arch/microblaze/lib/memcpy.c new file +160 -0

160 lines not on this page · raw message

arch/microblaze/lib/memmove.c new file +174 -0

174 lines not on this page · raw message

arch/microblaze/lib/memset.c new file +81 -0

81 lines not on this page · raw message

Signature · 1 line
1.5.5.1
#98 lore raw
In reply to [email protected]
Quoted 5 lines · * [email protected] <[email protected]> wrote:

Hi all,

I think that is the right time to send you next pack with Microblaze support. It is seventh pack - some previous packs was review by community and I hope there are not any big faults.

I have not done a deep review, but there's a lot of avoidable easy style bugs in the patches. All the patches together, passed through scripts/checkpatch.pl give ~200 errors:

total: 40 errors, 146 warnings, 15737 lines checked

A quick look suggests that most of the warnings pinpoint real problems. (and you can ignore false positives)

Thanks,

Ingo

author maintainer
#99 lore raw

Hi Ingo,

Quoted 6 lines
Quoted 5 lines

Hi all,

I think that is the right time to send you next pack with Microblaze support. It is seventh pack - some previous packs was review by community and I hope there are not any big faults.

Quoted 8 lines

I have not done a deep review, but there's a lot of avoidable easy style bugs in the patches. All the patches together, passed through scripts/checkpatch.pl give ~200 errors:

total: 40 errors, 146 warnings, 15737 lines checked

A quick look suggests that most of the warnings pinpoint real problems. (and you can ignore false positives)

I fixed coding style issue which was there. Some of them are false positive. I don't want to disturb people with next big pack and next version that's why I updated only branch on git (Patches has name microblaze_v8-pre) Below is part of log with faults which are announcing with checkpatch.pl script
+ my comments. I remove patches without any fault.

Thanks for noticing me in cases where I am wrong.

Thanks,
Michal

Quoted 4 lines

Thanks,

Ingo

ERROR: spaces prohibited around that ':' (ctx:WxW) #2588: FILE: arch/microblaze/kernel/prom_parse.c:637:
+ cells = prop ? *(u32 *)prop : of_n_addr_cells(dn);
^

ERROR: spaces prohibited around that ':' (ctx:WxW) #2594: FILE: arch/microblaze/kernel/prom_parse.c:643:
+ cells = prop ? *(u32 *)prop : of_n_size_cells(dn);
^

total: 2 errors, 0 warnings, 2910 lines checked

0004-microblaze_v8-pre-Open-firmware-files.patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

I think that this is correct coding style (Same for PowerPC)
-------------------------------------------------------------------------------------------

WARNING: do not add new typedefs
#127: FILE: arch/microblaze/include/asm/signal.h:107:
+typedef unsigned long old_sigset_t; /* at least 32 bits */

WARNING: do not add new typedefs
#129: FILE: arch/microblaze/include/asm/signal.h:109:
+typedef struct {

WARNING: do not add new typedefs
#161: FILE: arch/microblaze/include/asm/signal.h:141:
+typedef unsigned long sigset_t;

WARNING: do not add new typedefs
#178: FILE: arch/microblaze/include/asm/signal.h:158:
+typedef struct sigaltstack {

total: 0 errors, 4 warnings, 701 lines checked

0007-microblaze_v8-pre-Signal-support.patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

False positive.
-------------------------------------------------------------------------------------------

WARNING: do not add new typedefs
#57: FILE: arch/microblaze/include/asm/module.h:35:
+typedef struct { volatile int counter; } module_t;

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt #57: FILE: arch/microblaze/include/asm/module.h:35:
+typedef struct { volatile int counter; } module_t;

WARNING: externs should be avoided in .c files #92: FILE: arch/microblaze/kernel/microblaze_ksyms.c:27:
+extern void __ashldi3(void);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #93: FILE: arch/microblaze/kernel/microblaze_ksyms.c:28:
+EXPORT_SYMBOL(__ashldi3);

WARNING: externs should be avoided in .c files #94: FILE: arch/microblaze/kernel/microblaze_ksyms.c:29:
+extern void __ashrdi3(void);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #95: FILE: arch/microblaze/kernel/microblaze_ksyms.c:30:
+EXPORT_SYMBOL(__ashrdi3);

WARNING: externs should be avoided in .c files #96: FILE: arch/microblaze/kernel/microblaze_ksyms.c:31:
+extern void __divsi3(void);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #97: FILE: arch/microblaze/kernel/microblaze_ksyms.c:32:
+EXPORT_SYMBOL(__divsi3);

WARNING: externs should be avoided in .c files #98: FILE: arch/microblaze/kernel/microblaze_ksyms.c:33:
+extern void __lshrdi3(void);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #99: FILE: arch/microblaze/kernel/microblaze_ksyms.c:34:
+EXPORT_SYMBOL(__lshrdi3);

WARNING: externs should be avoided in .c files #100: FILE: arch/microblaze/kernel/microblaze_ksyms.c:35:
+extern void __modsi3(void);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #101: FILE: arch/microblaze/kernel/microblaze_ksyms.c:36:
+EXPORT_SYMBOL(__modsi3);

WARNING: externs should be avoided in .c files #102: FILE: arch/microblaze/kernel/microblaze_ksyms.c:37:
+extern void __mulsi3(void);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #103: FILE: arch/microblaze/kernel/microblaze_ksyms.c:38:
+EXPORT_SYMBOL(__mulsi3);

WARNING: externs should be avoided in .c files #104: FILE: arch/microblaze/kernel/microblaze_ksyms.c:39:
+extern void __muldi3(void);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #105: FILE: arch/microblaze/kernel/microblaze_ksyms.c:40:
+EXPORT_SYMBOL(__muldi3);

WARNING: externs should be avoided in .c files #106: FILE: arch/microblaze/kernel/microblaze_ksyms.c:41:
+extern void __ucmpdi2(void);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #107: FILE: arch/microblaze/kernel/microblaze_ksyms.c:42:
+EXPORT_SYMBOL(__ucmpdi2);

WARNING: externs should be avoided in .c files #108: FILE: arch/microblaze/kernel/microblaze_ksyms.c:43:
+extern void __udivsi3(void);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #109: FILE: arch/microblaze/kernel/microblaze_ksyms.c:44:
+EXPORT_SYMBOL(__udivsi3);

WARNING: externs should be avoided in .c files #110: FILE: arch/microblaze/kernel/microblaze_ksyms.c:45:
+extern void __umodsi3(void);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #111: FILE: arch/microblaze/kernel/microblaze_ksyms.c:46:
+EXPORT_SYMBOL(__umodsi3);

total: 0 errors, 22 warnings, 231 lines checked

0011-microblaze_v8-pre-kernel-modules-support.patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

False positive
-------------------------------------------------------------------------------------------

WARNING: usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus(), for_each_possible_cpu(), etc
#367: FILE: arch/microblaze/kernel/cpu/mb.c:130:
+ return i < NR_CPUS ? (void *) (i + 1) : NULL;

total: 0 errors, 1 warnings, 438 lines checked

0013-microblaze_v8-pre-PVR-support-cpuinfo-support.patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

NR_CPUS is used almost in all arch (x86 use it too)
-------------------------------------------------------------------------------------------

ERROR: Don't use kernel_thread(): see Documentation/feature-removal-schedule.txt #216: FILE: arch/microblaze/kernel/process.c:163:
+int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)

total: 1 errors, 0 warnings, 213 lines checked

0024-microblaze_v8-pre-process-and-init-task-function.patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

I am not sure but I found implementation of kernel_thread in x86, powerpc has asm implementation. Arm use C implementation as we have for MB.
-------------------------------------------------------------------------------------------

WARNING: do not add new typedefs
#112: FILE: arch/microblaze/include/asm/timex.h:14:
+typedef unsigned long cycles_t;

total: 0 errors, 1 warnings, 90 lines checked

0025-microblaze_v8-pre-delay.h-timex.h.patch has style problems, please review.
If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
WARNING: do not add new typedefs
#35: FILE: arch/microblaze/include/asm/ptrace.h:15:
+typedef unsigned long microblaze_reg_t;

total: 0 errors, 1 warnings, 250 lines checked

0026-microblaze_v8-pre-ptrace-support.patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

False positive
-------------------------------------------------------------------------------------------

WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#41: FILE: arch/microblaze/kernel/traps.c:23:
+void __bad_xchg(volatile void *ptr, int size)

total: 0 errors, 1 warnings, 105 lines checked

0028-microblaze_v8-pre-traps-support.patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

ARM has the same implemtation - I think that's ok.

-------------------------------------------------------------------------------------------
WARNING: do not add new typedefs
#39: FILE: arch/microblaze/include/asm/mmu.h:13:
+typedef struct {

total: 0 errors, 1 warnings, 277 lines checked

0029-microblaze_v8-pre-memory-inicialization-MMU-TLB.patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

false positive
-------------------------------------------------------------------------------------------

WARNING: do not add new typedefs
#82: FILE: arch/microblaze/include/asm/page.h:60:
+typedef struct page *pgtable_t;

WARNING: do not add new typedefs
#83: FILE: arch/microblaze/include/asm/page.h:61:
+typedef struct { unsigned long pte; } pte_t;

WARNING: do not add new typedefs
#84: FILE: arch/microblaze/include/asm/page.h:62:
+typedef struct { unsigned long pgprot; } pgprot_t;

WARNING: do not add new typedefs
#85: FILE: arch/microblaze/include/asm/page.h:63:
+typedef struct { unsigned long ste[64]; } pmd_t;

WARNING: do not add new typedefs
#86: FILE: arch/microblaze/include/asm/page.h:64:
+typedef struct { pmd_t pue[1]; } pud_t;

WARNING: do not add new typedefs
#87: FILE: arch/microblaze/include/asm/page.h:65:
+typedef struct { pud_t pge[1]; } pgd_t;

WARNING: do not add new typedefs
#184: FILE: arch/microblaze/include/asm/segment.h:16:
+typedef struct {

total: 0 errors, 7 warnings, 205 lines checked

0030-microblaze_v8-pre-page.h-segment.h-unaligned.h.patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

false positive
-------------------------------------------------------------------------------------------

WARNING: do not add new typedefs
#38: FILE: arch/microblaze/include/asm/posix_types.h:18:
+typedef unsigned long __kernel_ino_t;

WARNING: do not add new typedefs
#39: FILE: arch/microblaze/include/asm/posix_types.h:19:
+typedef unsigned int __kernel_mode_t;

WARNING: do not add new typedefs
#40: FILE: arch/microblaze/include/asm/posix_types.h:20:
+typedef unsigned int __kernel_nlink_t;

WARNING: do not add new typedefs
#41: FILE: arch/microblaze/include/asm/posix_types.h:21:
+typedef long __kernel_off_t;

WARNING: do not add new typedefs
#42: FILE: arch/microblaze/include/asm/posix_types.h:22:
+typedef int __kernel_pid_t;

WARNING: do not add new typedefs
#43: FILE: arch/microblaze/include/asm/posix_types.h:23:
+typedef unsigned int __kernel_ipc_pid_t;

WARNING: do not add new typedefs
#44: FILE: arch/microblaze/include/asm/posix_types.h:24:
+typedef unsigned int __kernel_uid_t;

WARNING: do not add new typedefs
#45: FILE: arch/microblaze/include/asm/posix_types.h:25:
+typedef unsigned int __kernel_gid_t;

WARNING: do not add new typedefs
#46: FILE: arch/microblaze/include/asm/posix_types.h:26:
+typedef unsigned long __kernel_size_t;

WARNING: do not add new typedefs
#47: FILE: arch/microblaze/include/asm/posix_types.h:27:
+typedef long __kernel_ssize_t;

WARNING: do not add new typedefs
#48: FILE: arch/microblaze/include/asm/posix_types.h:28:
+typedef int __kernel_ptrdiff_t;

WARNING: do not add new typedefs
#49: FILE: arch/microblaze/include/asm/posix_types.h:29:
+typedef long __kernel_time_t;

WARNING: do not add new typedefs
#50: FILE: arch/microblaze/include/asm/posix_types.h:30:
+typedef long __kernel_suseconds_t;

WARNING: do not add new typedefs
#51: FILE: arch/microblaze/include/asm/posix_types.h:31:
+typedef long __kernel_clock_t;

WARNING: do not add new typedefs
#52: FILE: arch/microblaze/include/asm/posix_types.h:32:
+typedef int __kernel_timer_t;

WARNING: do not add new typedefs
#53: FILE: arch/microblaze/include/asm/posix_types.h:33:
+typedef int __kernel_clockid_t;

WARNING: do not add new typedefs
#54: FILE: arch/microblaze/include/asm/posix_types.h:34:
+typedef int __kernel_daddr_t;

WARNING: do not add new typedefs
#55: FILE: arch/microblaze/include/asm/posix_types.h:35:
+typedef char *__kernel_caddr_t;

WARNING: do not add new typedefs
#56: FILE: arch/microblaze/include/asm/posix_types.h:36:
+typedef unsigned short __kernel_uid16_t;

WARNING: do not add new typedefs
#57: FILE: arch/microblaze/include/asm/posix_types.h:37:
+typedef unsigned short __kernel_gid16_t;

WARNING: do not add new typedefs
#58: FILE: arch/microblaze/include/asm/posix_types.h:38:
+typedef unsigned int __kernel_uid32_t;

WARNING: do not add new typedefs
#59: FILE: arch/microblaze/include/asm/posix_types.h:39:
+typedef unsigned int __kernel_gid32_t;

WARNING: do not add new typedefs
#62: FILE: arch/microblaze/include/asm/posix_types.h:42:
+typedef long long __kernel_loff_t;

WARNING: do not add new typedefs
#65: FILE: arch/microblaze/include/asm/posix_types.h:45:
+typedef struct {

WARNING: do not add new typedefs
#119: FILE: arch/microblaze/include/asm/types.h:24:
+typedef unsigned short umode_t;

false positive
-------------------------------------------------------------------------------------------

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#37: FILE: arch/microblaze/include/asm/io.h:19:
+static inline unsigned char __raw_readb(const volatile void __iomem *addr)

WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#39: FILE: arch/microblaze/include/asm/io.h:21:
+ return *(volatile unsigned char __force *)addr;

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#41: FILE: arch/microblaze/include/asm/io.h:23:
+static inline unsigned short __raw_readw(const volatile void __iomem *addr)

WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#43: FILE: arch/microblaze/include/asm/io.h:25:
+ return *(volatile unsigned short __force *)addr;

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#45: FILE: arch/microblaze/include/asm/io.h:27:
+static inline unsigned int __raw_readl(const volatile void __iomem *addr)

WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#47: FILE: arch/microblaze/include/asm/io.h:29:
+ return *(volatile unsigned int __force *)addr;

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#49: FILE: arch/microblaze/include/asm/io.h:31:
+static inline unsigned long __raw_readq(const volatile void __iomem *addr)

WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#51: FILE: arch/microblaze/include/asm/io.h:33:
+ return *(volatile unsigned long __force *)addr;

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#53: FILE: arch/microblaze/include/asm/io.h:35:
+static inline void __raw_writeb(unsigned char v, volatile void __iomem *addr)

WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#55: FILE: arch/microblaze/include/asm/io.h:37:
+ *(volatile unsigned char __force *)addr = v;

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#57: FILE: arch/microblaze/include/asm/io.h:39:
+static inline void __raw_writew(unsigned short v, volatile void __iomem *addr)

WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#59: FILE: arch/microblaze/include/asm/io.h:41:
+ *(volatile unsigned short __force *)addr = v;

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#61: FILE: arch/microblaze/include/asm/io.h:43:
+static inline void __raw_writel(unsigned int v, volatile void __iomem *addr)

WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#63: FILE: arch/microblaze/include/asm/io.h:45:
+ *(volatile unsigned int __force *)addr = v;

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#65: FILE: arch/microblaze/include/asm/io.h:47:
+static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr)

WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#67: FILE: arch/microblaze/include/asm/io.h:49:
+ *(volatile unsigned long __force *)addr = v;

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#75: FILE: arch/microblaze/include/asm/io.h:57:
+static inline unsigned char readb(const volatile void __iomem *addr)

WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#77: FILE: arch/microblaze/include/asm/io.h:59:
+ return *(volatile unsigned char __force *)addr;

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#79: FILE: arch/microblaze/include/asm/io.h:61:
+static inline unsigned short readw(const volatile void __iomem *addr)

WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#81: FILE: arch/microblaze/include/asm/io.h:63:
+ return le16_to_cpu(*(volatile unsigned short __force *)addr);

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#83: FILE: arch/microblaze/include/asm/io.h:65:
+static inline unsigned int readl(const volatile void __iomem *addr)

WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#85: FILE: arch/microblaze/include/asm/io.h:67:
+ return le32_to_cpu(*(volatile unsigned int __force *)addr);

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#87: FILE: arch/microblaze/include/asm/io.h:69:
+static inline void writeb(unsigned char v, volatile void __iomem *addr)

WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#89: FILE: arch/microblaze/include/asm/io.h:71:
+ *(volatile unsigned char __force *)addr = v;

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#91: FILE: arch/microblaze/include/asm/io.h:73:
+static inline void writew(unsigned short v, volatile void __iomem *addr)

WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#93: FILE: arch/microblaze/include/asm/io.h:75:
+ *(volatile unsigned short __force *)addr = cpu_to_le16(v);

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#95: FILE: arch/microblaze/include/asm/io.h:77:
+static inline void writel(unsigned int v, volatile void __iomem *addr)

WARNING: Use of volatile is usually wrong: see
Documentation/volatile-considered-harmful.txt
#97: FILE: arch/microblaze/include/asm/io.h:79:
+ *(volatile unsigned int __force *)addr = cpu_to_le32(v);

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#146: FILE: arch/microblaze/include/asm/io.h:128:
+static inline unsigned long __iomem virt_to_phys(volatile void *address)

total: 0 errors, 29 warnings, 209 lines checked

0035-microblaze_v8-pre-io.h-IO-operations.patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

false positive - same as powerpc
-------------------------------------------------------------------------------------------

WARNING: do not add new typedefs
#44: FILE: arch/microblaze/include/asm/hardirq.h:21:
+typedef struct {

total: 0 errors, 1 warnings, 153 lines checked

0038-microblaze_v8-pre-headers-for-irq.patch has style problems, please review.
If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

false positive
-------------------------------------------------------------------------------------------

ERROR: Don't use kernel_thread(): see Documentation/feature-removal-schedule.txt #105: FILE: arch/microblaze/include/asm/processor.h:85:
+extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt #162: FILE: arch/microblaze/include/asm/system.h:43:
+void __bad_xchg(volatile void *ptr, int size);

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
#164: FILE: arch/microblaze/include/asm/system.h:45:
+static inline unsigned long __xchg(unsigned long x, volatile void *ptr,

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt #173: FILE: arch/microblaze/include/asm/system.h:54:
+ ret = *(volatile unsigned char *)ptr;

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt #174: FILE: arch/microblaze/include/asm/system.h:55:
+ *(volatile unsigned char *)ptr = x;

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt #180: FILE: arch/microblaze/include/asm/system.h:61:
+ ret = *(volatile unsigned long *)ptr;

WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt #181: FILE: arch/microblaze/include/asm/system.h:62:
+ *(volatile unsigned long *)ptr = x;

total: 1 errors, 6 warnings, 184 lines checked

0041-microblaze_v8-pre-system.h-processor.h.patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

kernel thread - as above. xchg -> sam as arm. Am I right?

-------------------------------------------------------------------------------------------

WARNING: do not add new typedefs
#34: FILE: arch/microblaze/include/asm/termbits.h:14:
+typedef unsigned char cc_t;

WARNING: do not add new typedefs
#35: FILE: arch/microblaze/include/asm/termbits.h:15:
+typedef unsigned int speed_t;

WARNING: do not add new typedefs
#36: FILE: arch/microblaze/include/asm/termbits.h:16:
+typedef unsigned int tcflag_t;

total: 0 errors, 3 warnings, 291 lines checked

0044-microblaze_v8-pre-termbits.h-termios.h.patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

false positive
-------------------------------------------------------------------------------------------

ERROR: Aspace prohibited after that '&' (ctx:WxW) #152: FILE: arch/microblaze/include/asm/thread_info.h:102:
+ return (struct thread_info *)(sp & ~(THREAD_SIZE-1));
^

total: 1 errors, 0 warnings, 176 lines checked

0053-microblaze_v8-pre-string.h-thread_info.h.patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

I think here is correct coding style.
-------------------------------------------------------------------------------------------

That's all.
M

Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
#100 lore raw
Quoted 72 lines · Michal Simek

WARNING: externs should be avoided in .c files #92: FILE: arch/microblaze/kernel/microblaze_ksyms.c:27:
+extern void __ashldi3(void);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #93: FILE: arch/microblaze/kernel/microblaze_ksyms.c:28:
+EXPORT_SYMBOL(__ashldi3);

WARNING: externs should be avoided in .c files #94: FILE: arch/microblaze/kernel/microblaze_ksyms.c:29:
+extern void __ashrdi3(void);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #95: FILE: arch/microblaze/kernel/microblaze_ksyms.c:30:
+EXPORT_SYMBOL(__ashrdi3);

WARNING: externs should be avoided in .c files #96: FILE: arch/microblaze/kernel/microblaze_ksyms.c:31:
+extern void __divsi3(void);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #97: FILE: arch/microblaze/kernel/microblaze_ksyms.c:32:
+EXPORT_SYMBOL(__divsi3);

WARNING: externs should be avoided in .c files #98: FILE: arch/microblaze/kernel/microblaze_ksyms.c:33:
+extern void __lshrdi3(void);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #99: FILE: arch/microblaze/kernel/microblaze_ksyms.c:34:
+EXPORT_SYMBOL(__lshrdi3);

WARNING: externs should be avoided in .c files #100: FILE: arch/microblaze/kernel/microblaze_ksyms.c:35:
+extern void __modsi3(void);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #101: FILE: arch/microblaze/kernel/microblaze_ksyms.c:36:
+EXPORT_SYMBOL(__modsi3);

WARNING: externs should be avoided in .c files #102: FILE: arch/microblaze/kernel/microblaze_ksyms.c:37:
+extern void __mulsi3(void);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #103: FILE: arch/microblaze/kernel/microblaze_ksyms.c:38:
+EXPORT_SYMBOL(__mulsi3);

WARNING: externs should be avoided in .c files #104: FILE: arch/microblaze/kernel/microblaze_ksyms.c:39:
+extern void __muldi3(void);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #105: FILE: arch/microblaze/kernel/microblaze_ksyms.c:40:
+EXPORT_SYMBOL(__muldi3);

WARNING: externs should be avoided in .c files #106: FILE: arch/microblaze/kernel/microblaze_ksyms.c:41:
+extern void __ucmpdi2(void);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #107: FILE: arch/microblaze/kernel/microblaze_ksyms.c:42:
+EXPORT_SYMBOL(__ucmpdi2);

WARNING: externs should be avoided in .c files #108: FILE: arch/microblaze/kernel/microblaze_ksyms.c:43:
+extern void __udivsi3(void);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #109: FILE: arch/microblaze/kernel/microblaze_ksyms.c:44:
+EXPORT_SYMBOL(__udivsi3);

Quoted 7 lines

WARNING: externs should be avoided in .c files #110: FILE: arch/microblaze/kernel/microblaze_ksyms.c:45:
+extern void __umodsi3(void);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #111: FILE: arch/microblaze/kernel/microblaze_ksyms.c:46:
+EXPORT_SYMBOL(__umodsi3);

externs should be in header files.

The rest indeed looks like false positives. Thanks for addressing these things so quickly!

Ingo

author maintainer
#101 lore raw

Hi Ingo,

Quoted 6 lines · Michal Simek
Quoted 5 lines

WARNING: externs should be avoided in .c files #110: FILE: arch/microblaze/kernel/microblaze_ksyms.c:45:
+extern void __umodsi3(void);

Quoted 8 lines
Quoted 3 lines

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #111: FILE: arch/microblaze/kernel/microblaze_ksyms.c:46:
+EXPORT_SYMBOL(__umodsi3);

externs should be in header files.

The rest indeed looks like false positives. Thanks for addressing these things so quickly!

you are welcome - I can quickly test and add all changes to git.

Is it good style separate extern definition and EXPORT_SYMBOL?

I have three choices?
1. keep extern + EXPORT_SYMBOL below - current style
2. move only extern to header file
3. move extern and EXPORT_SYMBOL to header.

What is preferable way?

Thanks,
Michal

Quoted 2 lines

Ingo

Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
#102 lore raw
Quoted 10 lines · Michal Simek

you are welcome - I can quickly test and add all changes to git.

Is it good style separate extern definition and EXPORT_SYMBOL?

I have three choices?
1. keep extern + EXPORT_SYMBOL below - current style
2. move only extern to header file
3. move extern and EXPORT_SYMBOL to header.

What is preferable way?

externs should be in header files

EXPORT_SYMBOL should immediately follow its function/variable should normally be in source files like : arch/x86/kernel/process.c and if required can also be defined in header files like:
arch/x86/include/asm/percpu.h

--
JSR

#104 lore raw
In reply to Michal Simek
Quoted 18 lines · Michal Simek

Hi Ingo,

Quoted 6 lines · Michal Simek
Quoted 5 lines

WARNING: externs should be avoided in .c files #110: FILE: arch/microblaze/kernel/microblaze_ksyms.c:45:
+extern void __umodsi3(void);

Quoted 8 lines
Quoted 3 lines

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #111: FILE: arch/microblaze/kernel/microblaze_ksyms.c:46:
+EXPORT_SYMBOL(__umodsi3);

externs should be in header files.

The rest indeed looks like false positives. Thanks for addressing these things so quickly!

you are welcome - I can quickly test and add all changes to git.

Quoted 8 lines

Is it good style separate extern definition and EXPORT_SYMBOL?

I have three choices?
1. keep extern + EXPORT_SYMBOL below - current style
2. move only extern to header file
3. move extern and EXPORT_SYMBOL to header.

What is preferable way?

Where are the symbols defined - by gcc's library?

Ingo

author maintainer
#105 lore raw
Quoted 20 lines · Ingo Molnar
Quoted 18 lines · Michal Simek

Hi Ingo,

Quoted 6 lines · Michal Simek
Quoted 5 lines

WARNING: externs should be avoided in .c files #110: FILE: arch/microblaze/kernel/microblaze_ksyms.c:45:
+extern void __umodsi3(void);

Quoted 7 lines
Quoted 3 lines

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #111: FILE: arch/microblaze/kernel/microblaze_ksyms.c:46:
+EXPORT_SYMBOL(__umodsi3);

externs should be in header files.

The rest indeed looks like false positives. Thanks for addressing these things so quickly!

you are welcome - I can quickly test and add all changes to git.

Is it good style separate extern definition and EXPORT_SYMBOL?

Quoted 8 lines
Quoted 6 lines

I have three choices?
1. keep extern + EXPORT_SYMBOL below - current style
2. move only extern to header file
3. move extern and EXPORT_SYMBOL to header.

What is preferable way?

Where are the symbols defined - by gcc's library?

yes.

M

Quoted 1 line

Ingo

Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
#106 lore raw
Quoted 26 lines · Michal Simek
Quoted 25 lines · Ingo Molnar
Quoted 23 lines · Michal Simek

Hi Ingo,

Quoted 6 lines · Michal Simek
Quoted 5 lines

WARNING: externs should be avoided in .c files #110: FILE: arch/microblaze/kernel/microblaze_ksyms.c:45:
+extern void __umodsi3(void);

Quoted 7 lines
Quoted 3 lines

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #111: FILE: arch/microblaze/kernel/microblaze_ksyms.c:46:
+EXPORT_SYMBOL(__umodsi3);

externs should be in header files.

The rest indeed looks like false positives. Thanks for addressing these things so quickly!

you are welcome - I can quickly test and add all changes to git.

Is it good style separate extern definition and EXPORT_SYMBOL?

I have three choices?
1. keep extern + EXPORT_SYMBOL below - current style
2. move only extern to header file
3. move extern and EXPORT_SYMBOL to header.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

What is preferable way?

Where are the symbols defined - by gcc's library?

yes.

i suspect it's borderline in that case, and your solution is fine. The other solution would be to stuff the externs into a header and have a continuous block of exports with a comment that says:

/*
* GCC library functions:
*/
EXPORT_SYMBOL(...);
EXPORT_SYMBOL(...);
EXPORT_SYMBOL(...);

Ingo

author maintainer
#107 lore raw
Quoted 36 lines · Ingo Molnar
Quoted 21 lines · Michal Simek
Quoted 20 lines · Ingo Molnar
Quoted 18 lines · Michal Simek

Hi Ingo,

Quoted 6 lines · Michal Simek
Quoted 5 lines

WARNING: externs should be avoided in .c files #110: FILE: arch/microblaze/kernel/microblaze_ksyms.c:45:
+extern void __umodsi3(void);

Quoted 7 lines
Quoted 3 lines

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #111: FILE: arch/microblaze/kernel/microblaze_ksyms.c:46:
+EXPORT_SYMBOL(__umodsi3);

externs should be in header files.

The rest indeed looks like false positives. Thanks for addressing these things so quickly!

you are welcome - I can quickly test and add all changes to git.

Is it good style separate extern definition and EXPORT_SYMBOL?

Quoted 8 lines
Quoted 7 lines
Quoted 6 lines

I have three choices?
1. keep extern + EXPORT_SYMBOL below - current style
2. move only extern to header file
3. move extern and EXPORT_SYMBOL to header.

What is preferable way?

Where are the symbols defined - by gcc's library?

yes.

i suspect it's borderline in that case, and your solution is fine. The other solution would be to stuff the externs into a header and have a continuous block of exports with a comment that says:

Quoted 6 lines

/*
* GCC library functions:
*/
EXPORT_SYMBOL(...);
EXPORT_SYMBOL(...);
EXPORT_SYMBOL(...);

Ok. I keep it in current style. Everything is one file and there is comment about.

Thanks,
Michal

Quoted 1 line

Ingo

author maintainer
#103 lore raw
In reply to Jaswinder Singh Rajput
Quoted 11 lines · Jaswinder Singh Rajput
Quoted 9 lines · Michal Simek

you are welcome - I can quickly test and add all changes to git.

Is it good style separate extern definition and EXPORT_SYMBOL?

I have three choices?
1. keep extern + EXPORT_SYMBOL below - current style
2. move only extern to header file
3. move extern and EXPORT_SYMBOL to header.

Quoted 6 lines
Quoted 1 line

What is preferable way?

externs should be in header files

EXPORT_SYMBOL should immediately follow its function/variable should normally be in source files like : arch/x86/kernel/process.c

Yes, I know -> is should be in all microblaze code (for example arch/microblaze/lib folder)

Quoted 2 lines

and if required can also be defined in header files like:
arch/x86/include/asm/percpu.h

As wrote Ingo this is a little bit different case.

Thanks for you comments,
Michal

Quoted 4 lines

--
JSR

Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
#66 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

In reply to [email protected]

Michal,

arch/microblaze/kernel/irq.c line 51

Quoted 12 lines · On Wed, 18 Mar 2009, [email protected] wrote:
arch/microblaze/kernel/irq.c new file +12 -0
+static u32 concurrent_irq;
+
+void do_IRQ(struct pt_regs *regs)
+{
+	unsigned int irq;
+	struct pt_regs *old_regs = set_irq_regs(regs);
+
+	irq_enter();
+	irq = get_irq(regs);
+next_irq:
+	BUG_ON(irq == -1U);
+	__do_IRQ(irq);

You use irq chips now and you set the type handlers (edge/level), but you still call __do_IRQ() the all in one fits nothing handler, which is going to be deprecated and removed.

Please call

       generic_handle_irq(irq);

which will call the correct flow handlers.

arch/microblaze/kernel/timer.c line 122

Quoted 4 lines
arch/microblaze/kernel/timer.c new file +4 -0
+static int microblaze_timer_set_next_event(unsigned long delta,
+					 struct clock_event_device *dev)
+{
+	printk(KERN_INFO "next event, delta %x, %d\n", (u32)delta, (u32)delta);

This should be pr_debug() or do you want to flood the syslog in every timer interrupt ?

arch/microblaze/kernel/timer.c line 134

Quoted 12 lines
arch/microblaze/kernel/timer.c new file +12 -0
+	microblaze_timer_start(delta);
+	return 0;
+}
+
+static void microblaze_timer_set_mode(enum clock_event_mode mode,
+				    struct clock_event_device *evt)
+{
+	microblaze_timer_stop();
+
+	switch (mode) {
+	case CLOCK_EVT_MODE_PERIODIC:
+		printk(KERN_INFO "%s: periodic\n", __func__);

pr_debug as well. That's not very informative

arch/microblaze/kernel/timer.c line 170

Quoted 9 lines
arch/microblaze/kernel/timer.c new file +9 -0
+static irqreturn_t timer_interrupt(int irq, void *dev_id)
+{
+	struct clock_event_device *evt = &clockevent_microblaze_timer;
+#ifdef CONFIG_HEART_BEAT
+	heartbeat();
+#endif
+	timer_ack();
+
+	mb_tick_cnt += cpuinfo.freq_div_hz;

Hmm. How does that work with oneshot timers ?

arch/microblaze/kernel/timer.c line 178

Quoted 7 lines
arch/microblaze/kernel/timer.c new file +7 -0
+	evt->event_handler(evt);
+	return IRQ_HANDLED;
+}
+
+static struct irqaction timer_irqaction = {
+	.handler = timer_interrupt,
+	.flags = IRQF_DISABLED,

IRQF_DISABLED | IRQF_TIMER,

arch/microblaze/kernel/timer.c line 242

Quoted 4 lines
arch/microblaze/kernel/timer.c new file +4 -0
+	xtime.tv_sec = mktime(2007, 1, 1, 0, 0, 0);
+	xtime.tv_nsec = 0;
+	set_normalized_timespec(&wall_to_monotonic,
+				-xtime.tv_sec, -xtime.tv_nsec);

Yuck. What's that ? wall_to_monotonic is maintained by the generic code.

Thanks,

tglx

author maintainer
#67 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

Hi Thomas,

Quoted 17 lines

arch/microblaze/kernel/irq.c line 51

Quoted 13 lines
arch/microblaze/kernel/irq.c new file +12 -0
+static u32 concurrent_irq;
+
+void do_IRQ(struct pt_regs *regs)
+{
+	unsigned int irq;
+	struct pt_regs *old_regs = set_irq_regs(regs);
+
+	irq_enter();
+	irq = get_irq(regs);
+next_irq:
+	BUG_ON(irq == -1U);
+	__do_IRQ(irq);

You use irq chips now and you set the type handlers (edge/level), but you still call __do_IRQ() the all in one fits nothing handler, which is going to be deprecated and removed.

I know about.

Quoted 5 lines

Please call

       generic_handle_irq(irq);

which will call the correct flow handlers.

I would like to use it but don't work with edge interrupt. __do_IRQ handle it in right way.

I used this implementation but I did some change edge/level handling and I can't use it.
http://developer.petalogix.com/git/gitweb.cgi?p=linux-2.6-microblaze.git;a=blob_plain;f=arch/microblaze/kernel/irq.c;hb=3645d887ad6443a262bbeddf384038321172db2b

Any hints what could be wrong?

First of all I have one question to you about MB timer.c. It is about this function - microblaze_read.

static cycle_t mb_tick_cnt; /* store counter ticks */

static cycle_t microblaze_read(void)

{
	u64 temp = (u64)mb_tick_cnt + (u64)((u32)cpuinfo.freq_div_hz
					- (u32)in_be32(TIMER_BASE + TCR0));
	return temp;
}

MB has 32bit periodic down counter and I need to use u64 value that's why I do these operation above. cpuinfo.freq_div_hz store freq/HZ value - number of ticks for 1/HZ. I subtract current timer value + mb_tick_cnt which store number of count. The problem I have is that gettimeofday LTP test failed on it -> announce that time is going backward.
Simple returning only mb_tick_cnt pass this test but of course I am losing information about time till 1/HZ.
Do I have to add any specific amount of time which take counting of it?

And the second question is about shift and rating values. I wrote one message in past http://lkml.org/lkml/2009/1/11/291
Here is the important of part of that message.

...

And the second part is about shift and rating values. Rating is describe(linux/clocksource.h) and seems to me that should be corresponded with CONFIG_HZ value,right?
And I found any explanation of shift value -> max value for equation (2-5) * freq << shift / NSEC_PER_SEC should be for my case still 32bit number, where (2-5s) are because of NTP

The second thing which seems to me weird in comparing with others log I have seen is .resolution value. Full (proc/timer_lists is below) My .resolution: 10000000 nsecs which
is 1/HZ in nsec. (On others log I saw 1nsec values). My the lowest resolution is 1/freq = 8nsec (for 125MHz). Is that OK or not.
...

Quoted 8 lines

arch/microblaze/kernel/timer.c line 122

Quoted 5 lines
arch/microblaze/kernel/timer.c new file +4 -0
+static int microblaze_timer_set_next_event(unsigned long delta,
+					 struct clock_event_device *dev)
+{
+	printk(KERN_INFO "next event, delta %x, %d\n", (u32)delta, (u32)delta);

This should be pr_debug() or do you want to flood the syslog in every timer interrupt ?

This not flood the syslog. I don't know why (maybe because of missing ONESHOT) but this code is never called in periodic mode. But you are right if this function is called a lot it is necessary to use pr_debug -> but this is not my case in this implementation.

Quoted 15 lines

arch/microblaze/kernel/timer.c line 134

Quoted 13 lines
arch/microblaze/kernel/timer.c new file +12 -0
+	microblaze_timer_start(delta);
+	return 0;
+}
+
+static void microblaze_timer_set_mode(enum clock_event_mode mode,
+				    struct clock_event_device *evt)
+{
+	microblaze_timer_stop();
+
+	switch (mode) {
+	case CLOCK_EVT_MODE_PERIODIC:
+		printk(KERN_INFO "%s: periodic\n", __func__);

pr_debug as well. That's not very informative

It is only information that timer work in periodic mode.

Part of kernel log which is there - nothing more.

microblaze_timer_set_mode: shutdown
microblaze_timer_set_mode: periodic

Quoted 12 lines

arch/microblaze/kernel/timer.c line 170

Quoted 10 lines
arch/microblaze/kernel/timer.c new file +9 -0
+static irqreturn_t timer_interrupt(int irq, void *dev_id)
+{
+	struct clock_event_device *evt = &clockevent_microblaze_timer;
+#ifdef CONFIG_HEART_BEAT
+	heartbeat();
+#endif
+	timer_ack();
+
+	mb_tick_cnt += cpuinfo.freq_div_hz;

Hmm. How does that work with oneshot timers ?

Oneshot is not supported yet - only periodic mode. I had to add it mb_tick_cnt counting because
I don't know reason but without it ( kernel and timer in periodic mode )not update system time.

Quoted 10 lines

arch/microblaze/kernel/timer.c line 178

Quoted 8 lines
arch/microblaze/kernel/timer.c new file +7 -0
+	evt->event_handler(evt);
+	return IRQ_HANDLED;
+}
+
+static struct irqaction timer_irqaction = {
+	.handler = timer_interrupt,
+	.flags = IRQF_DISABLED,

IRQF_DISABLED | IRQF_TIMER,

OK. I'll add it.

Quoted 9 lines

arch/microblaze/kernel/timer.c line 242

Quoted 6 lines
arch/microblaze/kernel/timer.c new file +4 -0
+	xtime.tv_sec = mktime(2007, 1, 1, 0, 0, 0);
+	xtime.tv_nsec = 0;
+	set_normalized_timespec(&wall_to_monotonic,
+				-xtime.tv_sec, -xtime.tv_nsec);

Yuck. What's that ? wall_to_monotonic is maintained by the generic code.

I take this part of code from arch/blackfin/kernel/time-ts.c:217-219. arch/x86/xen/time.c use it too. And arch/arm/kernel/time.c use similar implemetation.

Thanks,
Michal

Quoted 6 lines

Thanks,

tglx

Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
#108 lore raw
In reply to [email protected]
Quoted 6 lines · [email protected] wrote:

Hi all,

I think that is the right time to send you next pack with Microblaze support. It is seventh pack - some previous packs was review by community and I hope there are not any big faults.

Quoted 8 lines

We tested this kernel on some boards.
We have GIT server up and gitweb is available at http://developer.petalogix.com/git/gitweb.cgi

All information about git clone you can find on gitweb.
This pack is available in for-linus branch. Information about other branches are on gitweb too.

More information about microblaze fdt kernel you can find at www.monstr.eu/fdt/ If you want to test kernel with microblaze toolchain let me know.

Hi Michal,

Is there an x86-hosted cross-tool chain available? If so, where?

Quoted 4 lines

I added only uart16550 and uartlite support - that's enought for first merge.

Thanks for you comments and especially for your ACK,

Thanks,

Signature · 1 line
~Randy
author maintainer
#109 lore raw

Hi Randy,

Quoted 13 lines
Quoted 12 lines · [email protected] wrote:

Hi all,

I think that is the right time to send you next pack with Microblaze support. It is seventh pack - some previous packs was review by community and I hope there are not any big faults.

We tested this kernel on some boards.
We have GIT server up and gitweb is available at http://developer.petalogix.com/git/gitweb.cgi

All information about git clone you can find on gitweb.
This pack is available in for-linus branch. Information about other branches are on gitweb too.

Quoted 7 lines
Quoted 2 lines

More information about microblaze fdt kernel you can find at www.monstr.eu/fdt/ If you want to test kernel with microblaze toolchain let me know.

Hi Michal,

Is there an x86-hosted cross-tool chain available? If so, where?

yes it is. I use old 3.4.1 gcc and we are preparing 4.1.2 version.(We have 4.1.2 for MMU with glibc). I hope will be ready soon. Of course is possible to compile kernel with that tool too.

The first way is download that code from svn server.

Here is the link directly to svn folder (Name guest, without password)
https://developer.petalogix.com/pr/internal/petalinux/trunk/tools/linux-i386/microblaze-uclinux-tools/

The second way is download full distribution (360MB)
http://developer.petalogix.com/downloads/petalinux-v0.30-rc1.tar.gz

There is . setting.sh script which only add toolchain to your patches or you can add it by hand. (Location is in tools/linux-i386/microblaze-uclinux-tools).

If you want gcc 4.1.2 pack for MMU (Just for kernel build) I can provide you prebuilt package too.

Thanks,
Michal

Quoted 7 lines
Quoted 5 lines

I added only uart16550 and uartlite support - that's enought for first merge.

Thanks for you comments and especially for your ACK,

Thanks,

Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
#68 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

In reply to Michal Simek

Michal,

Quoted 13 lines · Michal Simek
Quoted 5 lines

arch/microblaze/kernel/irq.c line 51

Quoted 1 line
arch/microblaze/kernel/irq.c new file +1 -0
+	__do_IRQ(irq);

You use irq chips now and you set the type handlers (edge/level), but you still call __do_IRQ() the all in one fits nothing handler, which is going to be deprecated and removed.

I know about.

Quoted 5 lines

Please call

       generic_handle_irq(irq);

which will call the correct flow handlers.

Quoted 8 lines

I would like to use it but don't work with edge interrupt. __do_IRQ handle it in right way.

I used this implementation but I did some change edge/level handling and I can't use it.
http://developer.petalogix.com/git/gitweb.cgi?p=linux-2.6-microblaze.git;a=blob_plain;f=arch/microblaze/kernel/irq.c;hb=3645d887ad6443a262bbeddf384038321172db2b

Any hints what could be wrong?

Look at the different handling schemes of __do_IRQ and handle_edge_irq vs. the chip functions:

__do_IRQ() does:

{
	   chip->ack();
	   
	   handle_IRQ_event();

	   chip->end();
}

handle_edge_irq() does:

{
	if ((desc->status & (IRQ_INPROGRESS | IRQ_DISABLED)) ||
                    !desc->action)) {
                desc->status |= (IRQ_PENDING | IRQ_MASKED);
                mask_ack_irq(desc, irq);
		goto out_unlock;
	}

	chip->ack();
	handle_IRQ_event();

}

I guess the problem is in your chip->xxx functions.

Quoted 13 lines

First of all I have one question to you about MB timer.c. It is about this function - microblaze_read.

static cycle_t mb_tick_cnt; /* store counter ticks */

static cycle_t microblaze_read(void)

{
	u64 temp = (u64)mb_tick_cnt + (u64)((u32)cpuinfo.freq_div_hz
					- (u32)in_be32(TIMER_BASE + TCR0));
	return temp;
}
Quoted 8 lines

MB has 32bit periodic down counter and I need to use u64 value that's why I do these operation above. cpuinfo.freq_div_hz store freq/HZ value - number of ticks for 1/HZ. I subtract current timer value + mb_tick_cnt which store number of count. The problem I have is that gettimeofday LTP test failed on it -> announce that time is going backward.
Simple returning only mb_tick_cnt pass this test but of course I am losing information about time till 1/HZ.
Do I have to add any specific amount of time which take counting of it?

You do not neeed 64 bit values. The return value is masked with the clocksource->mask anyway. So when your clocksource has less than 64 bits it's covered.

So if your timer counts down from 0xFFFFFFFF to 0 and wraps around you just need to return (cycle_t) ~(timer->count);

But I think I know where your real problem is. You use the same timer for both timekeeping and the periodic tick. That's why you can not support one shot mode. I bet the machine has two timers.

So the best way to handle this is:

Use timer A in free running mode - up or down counting does not matter - for the timekeeping. That way you have an ever increasing monotonic time.

Use timer B either for periodic mode or for one shot and all your problems are gone. In periodic mode use autoreload and in one shot mode just follow the instructions of the generic code via the timer_set_next_event() function.

Quoted 4 lines

And the second question is about shift and rating values. I wrote one message in past http://lkml.org/lkml/2009/1/11/291
Here is the important of part of that message.

Quoted 8 lines

...

And the second part is about shift and rating values. Rating is describe(linux/clocksource.h) and seems to me that should be corresponded with CONFIG_HZ value,right?
And I found any explanation of shift value -> max value for equation (2-5) * freq << shift / NSEC_PER_SEC should be for my case still 32bit number, where (2-5s) are because of NTP

@John, can you explain the shift vlaue please ?

Quoted 6 lines

The second thing which seems to me weird in comparing with others log I have seen is .resolution value. Full (proc/timer_lists is below) My .resolution: 10000000 nsecs which
is 1/HZ in nsec. (On others log I saw 1nsec values). My the lowest resolution is 1/freq = 8nsec (for 125MHz). Is that OK or not.
...

The 1ns is theoretical and indicates that the kernel has high resolution timer support. Your resolution is just HZ.

Quoted 9 lines
Quoted 8 lines

arch/microblaze/kernel/timer.c line 122

Quoted 5 lines
arch/microblaze/kernel/timer.c new file +4 -0
+static int microblaze_timer_set_next_event(unsigned long delta,
+					 struct clock_event_device *dev)
+{
+	printk(KERN_INFO "next event, delta %x, %d\n", (u32)delta, (u32)delta);

This should be pr_debug() or do you want to flood the syslog in every timer interrupt ?

Quoted 4 lines

This not flood the syslog. I don't know why (maybe because of missing ONESHOT) but this code is never called in periodic mode. But you are right if this function is called a lot it is necessary to use pr_debug -> but this is not my case in this implementation.

Well. Either you have one shot mode, then better make it work and useable or just remove the one shot support until you figure out how to do it.

Quoted 16 lines
Quoted 15 lines

arch/microblaze/kernel/timer.c line 134

Quoted 13 lines
arch/microblaze/kernel/timer.c new file +12 -0
+	microblaze_timer_start(delta);
+	return 0;
+}
+
+static void microblaze_timer_set_mode(enum clock_event_mode mode,
+				    struct clock_event_device *evt)
+{
+	microblaze_timer_stop();
+
+	switch (mode) {
+	case CLOCK_EVT_MODE_PERIODIC:
+		printk(KERN_INFO "%s: periodic\n", __func__);

pr_debug as well. That's not very informative

Quoted 6 lines

It is only information that timer work in periodic mode.

Part of kernel log which is there - nothing more.

microblaze_timer_set_mode: shutdown
microblaze_timer_set_mode: periodic

Nothing a normal user is interested in I guess, but ok.

Quoted 12 lines
Quoted 11 lines

arch/microblaze/kernel/timer.c line 170

Quoted 9 lines
arch/microblaze/kernel/timer.c new file +9 -0
+static irqreturn_t timer_interrupt(int irq, void *dev_id)
+{
+	struct clock_event_device *evt = &clockevent_microblaze_timer;
+#ifdef CONFIG_HEART_BEAT
+	heartbeat();
+#endif
+	timer_ack();
+
+	mb_tick_cnt += cpuinfo.freq_div_hz;

Hmm. How does that work with oneshot timers ?

Quoted 4 lines

Oneshot is not supported yet - only periodic mode. I had to add it mb_tick_cnt counting because
I don't know reason but without it ( kernel and timer in periodic mode )not update system time.

I don't know how that timer works. Do you have a pointer to hardware docs + chapter reference ?

Quoted 11 lines
Quoted 7 lines

arch/microblaze/kernel/timer.c line 242

Quoted 4 lines
arch/microblaze/kernel/timer.c new file +4 -0
+	xtime.tv_sec = mktime(2007, 1, 1, 0, 0, 0);
+	xtime.tv_nsec = 0;
+	set_normalized_timespec(&wall_to_monotonic,
+				-xtime.tv_sec, -xtime.tv_nsec);

Yuck. What's that ? wall_to_monotonic is maintained by the generic code.

I take this part of code from arch/blackfin/kernel/time-ts.c:217-219. arch/x86/xen/time.c use it too. And arch/arm/kernel/time.c use similar implemetation.

Right. All of them are similar nonsense. If we want a 1/1/2007 base date if there is no RTC which tells us the real date/time then we should do this in the generic code and not implement 10 variations all over the place.

tglx

#69 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

Quoted 10 lines · Thomas Gleixner
Quoted 9 lines · Michal Simek

And the second question is about shift and rating values. I wrote one message in past http://lkml.org/lkml/2009/1/11/291
Here is the important of part of that message.

...

And the second part is about shift and rating values. Rating is describe(linux/clocksource.h) and seems to me that should be corresponded with CONFIG_HZ value,right?

Not sure where the idea of correspondence w/ CONFIG_HZ came from. The rating value just provides a relative ordering of preferences between possible clocksources. Since different hardware may have a number of different clocksources available, we just need to have a method of selecting a preferred clocksource, and the rating value is used for that.

The guide in linux/clocksource.h is just a guide. Most arches, which only have one or two clocksource options probably won't need much care, and a rating of 200 or 300 will probably suffice. Or if there really isn't any option about it and there is only one which is a must-use clocksource, 400.

Quoted 5 lines
Quoted 3 lines

And I found any explanation of shift value -> max value for equation (2-5) * freq << shift / NSEC_PER_SEC should be for my case still 32bit number, where (2-5s) are because of NTP

@John, can you explain the shift vlaue please ?

The shift value is a bit more difficult to explain. The algorithm you describe above is used by sparc to generate shift, and I think it will work, but may not be optimal.

This question comes up over and over, so I figured I should sit down and really solve it.

Basically the constraint is you want to calculate a mult value using the highest shift possible. However we have to be careful not to overflow 64bits when we multiply ~5second worth of cycles times the mult value.

So I finally put this down into code and here it is. No promises that it is 100% right, but from my simple test examples it worked ok.

Let me know if it helps.

thanks
-john

Add helper functions to calculate ideal clocksource shift values given its frequency (either hz or khz). Lightly tested, use with care. Also fixes a few old-old-old timesource (well, timsource) references my find and replace attempts failed on.

include/linux/clocksource.h +6 -2
index f88d32f..9ef062d 100644
@@ -116,7 +116,7 @@ extern struct clocksource *clock;	/* current clocksource */
  * @khz:		Clocksource frequency in KHz
  * @shift_constant:	Clocksource shift factor
  *
- * Helper functions that converts a khz counter frequency to a timsource
+ * Helper functions that converts a khz counter frequency to a clocksource
  * multiplier, given the clocksource shift value
  */
 static inline u32 clocksource_khz2mult(u32 khz, u32 shift_constant)
@@ -142,7 +142,7 @@ static inline u32 clocksource_khz2mult(u32 khz, u32 shift_constant)
  * @shift_constant:	Clocksource shift factor
  *
  * Helper functions that converts a hz counter
- * frequency to a timsource multiplier, given the
+ * frequency to a clocksource multiplier, given the
  * clocksource shift value
  */
 static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
@@ -162,6 +162,10 @@ static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
 	return (u32)tmp;
 }
 
+extern u32 clocksource_khz2shift(u32 freq_khz);
+extern u32 clocksource_hz2shift(u32 freq_hz);
+
+
 /**
  * clocksource_read: - Access the clocksource's current cycle value
  * @cs:		pointer to clocksource being read
kernel/time/clocksource.c +77 -0

83 lines not on this page · raw message

author maintainer
#77 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

In reply to Thomas Gleixner

Hi Thomas,

Quoted 45 lines

Michal,

Quoted 9 lines · Michal Simek
Quoted 4 lines

arch/microblaze/kernel/irq.c line 51

Quoted 1 line
arch/microblaze/kernel/irq.c new file +1 -0
+	__do_IRQ(irq);

You use irq chips now and you set the type handlers (edge/level), but you still call __do_IRQ() the all in one fits nothing handler, which is going to be deprecated and removed.

I know about.

Quoted 4 lines

Please call

       generic_handle_irq(irq);

which will call the correct flow handlers.

Quoted 8 lines

I would like to use it but don't work with edge interrupt. __do_IRQ handle it in right way.

I used this implementation but I did some change edge/level handling and I can't use it.
http://developer.petalogix.com/git/gitweb.cgi?p=linux-2.6-microblaze.git;a=blob_plain;f=arch/microblaze/kernel/irq.c;hb=3645d887ad6443a262bbeddf384038321172db2b

Any hints what could be wrong?

Look at the different handling schemes of __do_IRQ and handle_edge_irq vs. the chip functions:

__do_IRQ() does:

{
	   chip->ack();
	   
	   handle_IRQ_event();

	   chip->end();
}

handle_edge_irq() does:

{
	if ((desc->status & (IRQ_INPROGRESS | IRQ_DISABLED)) ||
                    !desc->action)) {
                desc->status |= (IRQ_PENDING | IRQ_MASKED);
                mask_ack_irq(desc, irq);
		goto out_unlock;
	}

	chip->ack();
	handle_IRQ_event();
Quoted 3 lines

}

I guess the problem is in your chip->xxx functions.

OK. I look at it in detail.

Quoted 23 lines
Quoted 14 lines

First of all I have one question to you about MB timer.c. It is about this function - microblaze_read.

static cycle_t mb_tick_cnt; /* store counter ticks */

static cycle_t microblaze_read(void)

{
	u64 temp = (u64)mb_tick_cnt + (u64)((u32)cpuinfo.freq_div_hz
					- (u32)in_be32(TIMER_BASE + TCR0));
	return temp;
}
Quoted 8 lines

MB has 32bit periodic down counter and I need to use u64 value that's why I do these operation above. cpuinfo.freq_div_hz store freq/HZ value - number of ticks for 1/HZ. I subtract current timer value + mb_tick_cnt which store number of count. The problem I have is that gettimeofday LTP test failed on it -> announce that time is going backward.
Simple returning only mb_tick_cnt pass this test but of course I am losing information about time till 1/HZ.
Do I have to add any specific amount of time which take counting of it?

Quoted 6 lines

You do not neeed 64 bit values. The return value is masked with the clocksource->mask anyway. So when your clocksource has less than 64 bits it's covered.

So if your timer counts down from 0xFFFFFFFF to 0 and wraps around you just need to return (cycle_t) ~(timer->count);

Counts down from specific value to 0. That specific value and number of tick for 1/HZ. That mean that I need (cycle_t) (specific_value - timer->count)

Quoted 4 lines

But I think I know where your real problem is. You use the same timer for both timekeeping and the periodic tick. That's why you can not support one shot mode. I bet the machine has two timers.

yes. I have no problem to use another counter too. It is FPGA and my timer IP support two independent timers. ( Her is the link to doc
http://www.xilinx.com/support/documentation/ip_documentation/xps_timer.pdf)

Quoted 11 lines

So the best way to handle this is:

Use timer A in free running mode - up or down counting does not matter - for the timekeeping. That way you have an ever increasing monotonic time.

Use timer B either for periodic mode or for one shot and all your problems are gone. In periodic mode use autoreload and in one shot mode just follow the instructions of the generic code via the timer_set_next_event() function.

OK. That mean you timer A as clocksource and the second clock as event device. I try to do it.

Quoted 32 lines
Quoted 5 lines

And the second question is about shift and rating values. I wrote one message in past http://lkml.org/lkml/2009/1/11/291
Here is the important of part of that message.

Quoted 8 lines

...

And the second part is about shift and rating values. Rating is describe(linux/clocksource.h) and seems to me that should be corresponded with CONFIG_HZ value,right?
And I found any explanation of shift value -> max value for equation (2-5) * freq << shift / NSEC_PER_SEC should be for my case still 32bit number, where (2-5s) are because of NTP

@John, can you explain the shift vlaue please ?

Quoted 6 lines

The second thing which seems to me weird in comparing with others log I have seen is .resolution value. Full (proc/timer_lists is below) My .resolution: 10000000 nsecs which
is 1/HZ in nsec. (On others log I saw 1nsec values). My the lowest resolution is 1/freq = 8nsec (for 125MHz). Is that OK or not.
...

The 1ns is theoretical and indicates that the kernel has high resolution timer support. Your resolution is just HZ.

Quoted 6 lines
Quoted 6 lines

arch/microblaze/kernel/timer.c line 122

Quoted 4 lines
arch/microblaze/kernel/timer.c new file +4 -0
+static int microblaze_timer_set_next_event(unsigned long delta,
+					 struct clock_event_device *dev)
+{
+	printk(KERN_INFO "next event, delta %x, %d\n", (u32)delta, (u32)delta);

This should be pr_debug() or do you want to flood the syslog in every timer interrupt ?

Quoted 8 lines
Quoted 4 lines

This not flood the syslog. I don't know why (maybe because of missing ONESHOT) but this code is never called in periodic mode. But you are right if this function is called a lot it is necessary to use pr_debug -> but this is not my case in this implementation.

Well. Either you have one shot mode, then better make it work and useable or just remove the one shot support until you figure out how to do it.

I don't have it - this feature is not there. There is only printk message in set_mode function.

What is the best timer implementation in kernel? (For inspiration)

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

arch/microblaze/kernel/timer.c line 134

Quoted 13 lines
arch/microblaze/kernel/timer.c new file +12 -0
+	microblaze_timer_start(delta);
+	return 0;
+}
+
+static void microblaze_timer_set_mode(enum clock_event_mode mode,
+				    struct clock_event_device *evt)
+{
+	microblaze_timer_stop();
+
+	switch (mode) {
+	case CLOCK_EVT_MODE_PERIODIC:
+		printk(KERN_INFO "%s: periodic\n", __func__);

pr_debug as well. That's not very informative

Quoted 8 lines
Quoted 6 lines

It is only information that timer work in periodic mode.

Part of kernel log which is there - nothing more.

microblaze_timer_set_mode: shutdown
microblaze_timer_set_mode: periodic

Nothing a normal user is interested in I guess, but ok.

ok

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

arch/microblaze/kernel/timer.c line 170

Quoted 10 lines
arch/microblaze/kernel/timer.c new file +9 -0
+static irqreturn_t timer_interrupt(int irq, void *dev_id)
+{
+	struct clock_event_device *evt = &clockevent_microblaze_timer;
+#ifdef CONFIG_HEART_BEAT
+	heartbeat();
+#endif
+	timer_ack();
+
+	mb_tick_cnt += cpuinfo.freq_div_hz;

Hmm. How does that work with oneshot timers ?

Quoted 7 lines
Quoted 4 lines

Oneshot is not supported yet - only periodic mode. I had to add it mb_tick_cnt counting because
I don't know reason but without it ( kernel and timer in periodic mode )not update system time.

I don't know how that timer works. Do you have a pointer to hardware docs + chapter reference ?

Look at link above. Look at programming model chapter.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

arch/microblaze/kernel/timer.c line 242

Quoted 5 lines
arch/microblaze/kernel/timer.c new file +4 -0
+	xtime.tv_sec = mktime(2007, 1, 1, 0, 0, 0);
+	xtime.tv_nsec = 0;
+	set_normalized_timespec(&wall_to_monotonic,
+				-xtime.tv_sec, -xtime.tv_nsec);

Yuck. What's that ? wall_to_monotonic is maintained by the generic code.

Quoted 8 lines
Quoted 3 lines

I take this part of code from arch/blackfin/kernel/time-ts.c:217-219. arch/x86/xen/time.c use it too. And arch/arm/kernel/time.c use similar implemetation.

Right. All of them are similar nonsense. If we want a 1/1/2007 base date if there is no RTC which tells us the real date/time then we should do this in the generic code and not implement 10 variations all over the place.

I have no problem to start from 1970 and remove this part of code. Do nothing important to me.

Thanks,
Michal

Quoted 2 lines

tglx

Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
author maintainer
#70 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

In reply to John Stultz

Hi John S,

Quoted 19 lines · Thomas Gleixner
Quoted 10 lines · Michal Simek
Quoted 9 lines

And the second question is about shift and rating values. I wrote one message in past http://lkml.org/lkml/2009/1/11/291
Here is the important of part of that message.

...

And the second part is about shift and rating values. Rating is describe(linux/clocksource.h) and seems to me that should be corresponded with CONFIG_HZ value,right?

Not sure where the idea of correspondence w/ CONFIG_HZ came from. The rating value just provides a relative ordering of preferences between possible clocksources. Since different hardware may have a number of different clocksources available, we just need to have a method of selecting a preferred clocksource, and the rating value is used for that.

Quoted 5 lines

The guide in linux/clocksource.h is just a guide. Most arches, which only have one or two clocksource options probably won't need much care, and a rating of 200 or 300 will probably suffice. Or if there really isn't any option about it and there is only one which is a must-use clocksource, 400.

ok. That mean that for my case (only one clocksource) I should set rating to 400
- I have one clocksource and is perfect for me.

Quoted 14 lines
Quoted 6 lines
Quoted 5 lines

And I found any explanation of shift value -> max value for equation (2-5) * freq << shift / NSEC_PER_SEC should be for my case still 32bit number, where (2-5s) are because of NTP

@John, can you explain the shift vlaue please ?

The shift value is a bit more difficult to explain. The algorithm you describe above is used by sparc to generate shift, and I think it will work, but may not be optimal.

This question comes up over and over, so I figured I should sit down and really solve it.

Quoted 6 lines

Basically the constraint is you want to calculate a mult value using the highest shift possible. However we have to be careful not to overflow 64bits when we multiply ~5second worth of cycles times the mult value.

So I finally put this down into code and here it is. No promises that it is 100% right, but from my simple test examples it worked ok.

OK. Please check my case of that value.
MB can run from 5Mhz till 150MHz I think.
I need generic approach that's why I have to calculate with max value (150MHz). My timer can tick on that freq too. (There is no different time bases in HW).

I need to find out how many ticks takes ~5s.
150MHz means that I need for 1sec 150 000 000 timer ticks.
One tick takes 1/150MHz = ~6-7ns - in the best case I can recognize and set 6-7ns (this is only theoretical value because of overhead)

~5s takes 750 000 000 ticks = 0x2CB4 1780. And I have 32bit counter.

That my question is how big could be a shift of value above till overflow. 0x2CB4 1780 << shift not exceed 0xffff ffff ffff ffff.

Here is that table for my case
shift
0 = 0x2CB4 1780
1 = 0x5968 2F00
2 = 0xB2D0 5E00
3 = 0x1 65A0 BC00

4 = 0x2 CB41 7800
5 = 0x5 9682 F000
6 = 0xB 2D05 E000
7 = 0x16 5A0B C000

Quoted 1 line

From first value I can tell that I can shift that value with 32 + 3 => 35 is the

first shift with overflow 64bit. Am I right? If yes, I haven't found that big value in any arch.

For example avr has shift 16, rating 50 (arch/avr32/kernel/time.c) (BTW: Sets time from 2007 too)

And the next my question is about difference in clocksource and clock event value. Situation is the same. Is it mean that I should set the same rating and shift value for both. (It doesn't matter if I use one or two timer -> they are the same).

And about high resolution timer. I can recognize in the best case ~6-7ns. That mean that measuring values around 100-200ns make sense and should work. Could I use it?

Thanks,
Michal

Quoted 136 lines

Let me know if it helps.

thanks
-john

Add helper functions to calculate ideal clocksource shift values given its frequency (either hz or khz). Lightly tested, use with care. Also fixes a few old-old-old timesource (well, timsource) references my find and replace attempts failed on.

include/linux/clocksource.h +6 -2
index f88d32f..9ef062d 100644
@@ -116,7 +116,7 @@ extern struct clocksource *clock;	/* current clocksource */
  * @khz:		Clocksource frequency in KHz
  * @shift_constant:	Clocksource shift factor
  *
- * Helper functions that converts a khz counter frequency to a timsource
+ * Helper functions that converts a khz counter frequency to a clocksource
  * multiplier, given the clocksource shift value
  */
 static inline u32 clocksource_khz2mult(u32 khz, u32 shift_constant)
@@ -142,7 +142,7 @@ static inline u32 clocksource_khz2mult(u32 khz, u32 shift_constant)
  * @shift_constant:	Clocksource shift factor
  *
  * Helper functions that converts a hz counter
- * frequency to a timsource multiplier, given the
+ * frequency to a clocksource multiplier, given the
  * clocksource shift value
  */
 static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
@@ -162,6 +162,10 @@ static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
 	return (u32)tmp;
 }
 
+extern u32 clocksource_khz2shift(u32 freq_khz);
+extern u32 clocksource_hz2shift(u32 freq_hz);
+
+
 /**
  * clocksource_read: - Access the clocksource's current cycle value
  * @cs:		pointer to clocksource being read
kernel/time/clocksource.c +77 -0
index ca89e15..0a2538d 100644
@@ -212,6 +212,83 @@ static void clocksource_check_watchdog(struct clocksource *cs)
 static inline void clocksource_resume_watchdog(void) { }
 #endif
 
+
+/* Maximum seconds worth of cycles we consider valid */
+#define MAX_SEC_OF_CYCLES 5ULL
+
+/**
+ * clocksource_khz2shift - calculates shift from khz
+ * @freq_khz:		Clocksource frequency in KHz
+ *
+ * Helper functions that converts a khz counter
+ * frequency to a clocksource shift.
+ */
+u32 clocksource_khz2shift(u32 freq_khz)
+{
+	s32 shift = 32;
+	u32 mult;
+
+	while (1) {
+		s64 tmp;
+		u64 cycles;
+		mult = clocksource_khz2mult(freq_khz, shift);
+
+		cycles = (u64)freq_khz*1000*MAX_SEC_OF_CYCLES;
+		tmp = (cycles * mult) >> shift;
+
+		tmp = (MAX_SEC_OF_CYCLES*NSEC_PER_SEC) - tmp;
+		if (tmp < 0)
+			tmp = -tmp;
+
+		/* if we are witin one mult unit, we're good */
+		if (tmp < cycles>>shift)
+			break;
+
+		shift--;
+		if (shift < 1)
+			BUG();
+	}
+	return shift;
+}
+
+/**
+ * clocksource_hz2shift - calculates shift from hz
+ * @freq_hz:		Clocksource frequency in Hz
+ *
+ * Helper functions that converts a hz counter
+ * frequency to a clocksource shift.
+ */
+
+u32 clocksource_hz2shift(u32 freq_hz)
+{
+	s32 shift = 32;
+	u32 mult;
+
+	while (1) {
+		s64 tmp;
+		u64 cycles;
+		mult = clocksource_hz2mult(freq_hz, shift);
+
+		cycles = (u64)freq_hz*MAX_SEC_OF_CYCLES;
+		tmp = (cycles * mult) >> shift;
+
+		tmp = MAX_SEC_OF_CYCLES*NSEC_PER_SEC - tmp;
+		if (tmp < 0)
+			tmp = -tmp;
+
+		/* if we are witin one mult unit, we're good */
+		if (tmp < cycles>>shift)
+			break;
+
+		shift--;
+		if (shift < 1)
+			BUG();
+	}
+	return shift;
+}
+
+
+
 /**
  * clocksource_resume - resume the clocksource(s)
  */
Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
author maintainer
#79 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

In reply to Thomas Gleixner

Thomas,

just one other question.
For me will be useful to use second timer which is inside timer IP core. There are two timers with one interrupt line. And I can of course resolve which counter cause it. That's no problem.

My question is about timer_irqaction where is dev_id. What should be there? Point to clocksource structure or clockevent?

static struct irqaction timer_irqaction = {
.handler = timer_interrupt,
.flags = IRQF_DISABLED | IRQF_TIMER,
.name = "timer",
.dev_id = &clocksource_microblaze,
};

Thanks,
Michal

Quoted 189 lines

Michal,

Quoted 9 lines · Michal Simek
Quoted 4 lines

arch/microblaze/kernel/irq.c line 51

Quoted 1 line
arch/microblaze/kernel/irq.c new file +1 -0
+	__do_IRQ(irq);

You use irq chips now and you set the type handlers (edge/level), but you still call __do_IRQ() the all in one fits nothing handler, which is going to be deprecated and removed.

I know about.

Quoted 4 lines

Please call

       generic_handle_irq(irq);

which will call the correct flow handlers.

Quoted 8 lines

I would like to use it but don't work with edge interrupt. __do_IRQ handle it in right way.

I used this implementation but I did some change edge/level handling and I can't use it.
http://developer.petalogix.com/git/gitweb.cgi?p=linux-2.6-microblaze.git;a=blob_plain;f=arch/microblaze/kernel/irq.c;hb=3645d887ad6443a262bbeddf384038321172db2b

Any hints what could be wrong?

Look at the different handling schemes of __do_IRQ and handle_edge_irq vs. the chip functions:

__do_IRQ() does:

{
	   chip->ack();
	   
	   handle_IRQ_event();

	   chip->end();
}

handle_edge_irq() does:

{
	if ((desc->status & (IRQ_INPROGRESS | IRQ_DISABLED)) ||
                    !desc->action)) {
                desc->status |= (IRQ_PENDING | IRQ_MASKED);
                mask_ack_irq(desc, irq);
		goto out_unlock;
	}

	chip->ack();
	handle_IRQ_event();

}

I guess the problem is in your chip->xxx functions.

Quoted 13 lines

First of all I have one question to you about MB timer.c. It is about this function - microblaze_read.

static cycle_t mb_tick_cnt; /* store counter ticks */

static cycle_t microblaze_read(void)

{
	u64 temp = (u64)mb_tick_cnt + (u64)((u32)cpuinfo.freq_div_hz
					- (u32)in_be32(TIMER_BASE + TCR0));
	return temp;
}
Quoted 8 lines

MB has 32bit periodic down counter and I need to use u64 value that's why I do these operation above. cpuinfo.freq_div_hz store freq/HZ value - number of ticks for 1/HZ. I subtract current timer value + mb_tick_cnt which store number of count. The problem I have is that gettimeofday LTP test failed on it -> announce that time is going backward.
Simple returning only mb_tick_cnt pass this test but of course I am losing information about time till 1/HZ.
Do I have to add any specific amount of time which take counting of it?

You do not neeed 64 bit values. The return value is masked with the clocksource->mask anyway. So when your clocksource has less than 64 bits it's covered.

So if your timer counts down from 0xFFFFFFFF to 0 and wraps around you just need to return (cycle_t) ~(timer->count);

But I think I know where your real problem is. You use the same timer for both timekeeping and the periodic tick. That's why you can not support one shot mode. I bet the machine has two timers.

So the best way to handle this is:

Use timer A in free running mode - up or down counting does not matter - for the timekeeping. That way you have an ever increasing monotonic time.

Use timer B either for periodic mode or for one shot and all your problems are gone. In periodic mode use autoreload and in one shot mode just follow the instructions of the generic code via the timer_set_next_event() function.

Quoted 4 lines

And the second question is about shift and rating values. I wrote one message in past http://lkml.org/lkml/2009/1/11/291
Here is the important of part of that message.

Quoted 8 lines

...

And the second part is about shift and rating values. Rating is describe(linux/clocksource.h) and seems to me that should be corresponded with CONFIG_HZ value,right?
And I found any explanation of shift value -> max value for equation (2-5) * freq << shift / NSEC_PER_SEC should be for my case still 32bit number, where (2-5s) are because of NTP

@John, can you explain the shift vlaue please ?

Quoted 6 lines

The second thing which seems to me weird in comparing with others log I have seen is .resolution value. Full (proc/timer_lists is below) My .resolution: 10000000 nsecs which
is 1/HZ in nsec. (On others log I saw 1nsec values). My the lowest resolution is 1/freq = 8nsec (for 125MHz). Is that OK or not.
...

The 1ns is theoretical and indicates that the kernel has high resolution timer support. Your resolution is just HZ.

Quoted 10 lines
Quoted 6 lines

arch/microblaze/kernel/timer.c line 122

Quoted 4 lines
arch/microblaze/kernel/timer.c new file +4 -0
+static int microblaze_timer_set_next_event(unsigned long delta,
+					 struct clock_event_device *dev)
+{
+	printk(KERN_INFO "next event, delta %x, %d\n", (u32)delta, (u32)delta);

This should be pr_debug() or do you want to flood the syslog in every timer interrupt ?

This not flood the syslog. I don't know why (maybe because of missing ONESHOT) but this code is never called in periodic mode. But you are right if this function is called a lot it is necessary to use pr_debug -> but this is not my case in this implementation.

Well. Either you have one shot mode, then better make it work and useable or just remove the one shot support until you figure out how to do it.

Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
arch/microblaze/kernel/timer.c new file +5 -0
+	microblaze_timer_start(delta);
+	return 0;
+}
+
+static void microblaze_timer_set_mode(enum clock_event_mode mode,
Quoted 8 lines

arch/microblaze/kernel/timer.c line 134

Quoted 7 lines
arch/microblaze/kernel/timer.c new file +7 -0
+				    struct clock_event_device *evt)
+{
+	microblaze_timer_stop();
+
+	switch (mode) {
+	case CLOCK_EVT_MODE_PERIODIC:
+		printk(KERN_INFO "%s: periodic\n", __func__);

pr_debug as well. That's not very informative

Quoted 6 lines

It is only information that timer work in periodic mode.

Part of kernel log which is there - nothing more.

microblaze_timer_set_mode: shutdown
microblaze_timer_set_mode: periodic

Nothing a normal user is interested in I guess, but ok.

Quoted 10 lines
Quoted 10 lines

arch/microblaze/kernel/timer.c line 170

Quoted 9 lines
arch/microblaze/kernel/timer.c new file +9 -0
+static irqreturn_t timer_interrupt(int irq, void *dev_id)
+{
+	struct clock_event_device *evt = &clockevent_microblaze_timer;
+#ifdef CONFIG_HEART_BEAT
+	heartbeat();
+#endif
+	timer_ack();
+
+	mb_tick_cnt += cpuinfo.freq_div_hz;

Hmm. How does that work with oneshot timers ?

Quoted 4 lines

Oneshot is not supported yet - only periodic mode. I had to add it mb_tick_cnt counting because
I don't know reason but without it ( kernel and timer in periodic mode )not update system time.

I don't know how that timer works. Do you have a pointer to hardware docs + chapter reference ?

Quoted 9 lines
Quoted 6 lines

arch/microblaze/kernel/timer.c line 242

Quoted 4 lines
arch/microblaze/kernel/timer.c new file +4 -0
+	xtime.tv_sec = mktime(2007, 1, 1, 0, 0, 0);
+	xtime.tv_nsec = 0;
+	set_normalized_timespec(&wall_to_monotonic,
+				-xtime.tv_sec, -xtime.tv_nsec);

Yuck. What's that ? wall_to_monotonic is maintained by the generic code.

I take this part of code from arch/blackfin/kernel/time-ts.c:217-219. arch/x86/xen/time.c use it too. And arch/arm/kernel/time.c use similar implemetation.

Right. All of them are similar nonsense. If we want a 1/1/2007 base date if there is no RTC which tells us the real date/time then we should do this in the generic code and not implement 10 variations all over the place.

tglx

Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
#80 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

Quoted 10 lines · Michal Simek

Thomas,

just one other question.
For me will be useful to use second timer which is inside timer IP core. There are two timers with one interrupt line. And I can of course resolve which counter cause it. That's no problem.

My question is about timer_irqaction where is dev_id. What should be there? Point to clocksource structure or clockevent?

Quoted 6 lines

static struct irqaction timer_irqaction = {
.handler = timer_interrupt,
.flags = IRQF_DISABLED | IRQF_TIMER,
.name = "timer",
.dev_id = &clocksource_microblaze,
};

The clockevent of course. It's the one which emits the interrupts.

Just for clarification. The clocksource is basically a counter to read out the current time. Such a counter usually does not deliver interrupts. It wraps at some point, but that is handled by the generic time keeping code. If you setup the 32 bit counter to count up and let it run free then the counter will wrap from 0xffffffff to 0. Nothing you have to worry about. You just provide a function to read it.

The clockevent is the device which delivers either periodic or oneshot interrupts. Sa you dont have to worry about the shared interrupt line in that case.

Thanks,

tglx

#78 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

In reply to Michal Simek
Quoted 8 lines · Michal Simek
Quoted 3 lines

Well. Either you have one shot mode, then better make it work and useable or just remove the one shot support until you figure out how to do it.

I don't have it - this feature is not there. There is only printk message in set_mode function.

What is the best timer implementation in kernel? (For inspiration)

There is no best :) All timers have usualy some weird hardware constraints so that code is always ugly. But just as an example:

static int lapic_next_event(unsigned long delta, struct clock_event_device *evt)

{
        apic_write(APIC_TMICT, delta);
        return 0;
}

I think that's pretty close to your hardware. delta is the number of timer cycles until the next event. There is no other magic with the one shot mode :)

Thanks,

tglx

author maintainer
#81 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

In reply to Thomas Gleixner

Hi Thomas,

Quoted 19 lines · Michal Simek
Quoted 11 lines

Thomas,

just one other question.
For me will be useful to use second timer which is inside timer IP core. There are two timers with one interrupt line. And I can of course resolve which counter cause it. That's no problem.

My question is about timer_irqaction where is dev_id. What should be there? Point to clocksource structure or clockevent?

Quoted 6 lines

static struct irqaction timer_irqaction = {
.handler = timer_interrupt,
.flags = IRQF_DISABLED | IRQF_TIMER,
.name = "timer",
.dev_id = &clocksource_microblaze,
};

Quoted 8 lines

The clockevent of course. It's the one which emits the interrupts.

Just for clarification. The clocksource is basically a counter to read out the current time. Such a counter usually does not deliver interrupts. It wraps at some point, but that is handled by the generic time keeping code. If you setup the 32 bit counter to count up and let it run free then the counter will wrap from 0xffffffff to 0. Nothing you have to worry about. You just provide a function to read it.

That's is crucial information which I haven't found.

Quoted 4 lines

The clockevent is the device which delivers either periodic or oneshot interrupts. Sa you dont have to worry about the shared interrupt line in that case.

I have working implementation. I just need to clear some thing relate with HW - some checking mechanism that two timer must be there + some selfmod test. I'll send it soon and do some LTP test too but I believe that I clean that code. I take a look at irq code too.

Below is timer_list log.

I can paste current my code but people don't like it attachment and in-line code.I'll do regular one patch with git and send it.

Why is my .resolution: 10000000 nsecs? It seems to me weird.

I'll wait for John's answer for fixing shift and rating values too.

Thanks a lot,
Michal

Quoted 4 lines

Thanks,

tglx

# cat /proc/timer_list
Timer List Version: v0.4
HRTIMER_MAX_CLOCK_BASES: 2
now at 193684779856 nsecs

cpu: 0
clock 0:
.base: 902774d0
.index: 0
.resolution: 10000000 nsecs
.get_time: ktime_get_real
active timers:
clock 1:
.base: 902774f4
.index: 1
.resolution: 10000000 nsecs
.get_time: ktime_get
active timers:
#0: <9e2d3a48>, hrtimer_wakeup, S:01, <9e2d3a48>, inetd/54

 # expires at 194110626631-194111626591 nsecs [in 425846775 to 426846735 nsecs]
 #1: <9e0e5a48>, hrtimer_wakeup, S:01, <9e0e5a48>, thttpd/50
 # expires at 249711205338-249811205338 nsecs [in 56026425482 to 56126425482 nsecs]

Tick Device: mode: 0
Per CPU device: 0
Clock Event Device: microblaze_clockevent

 max_delta_ns:   2147483647
 min_delta_ns:   1000
 mult:           536870912
 shift:          32
 mode:           2
 next_event:     2147483646999999999 nsecs

set_next_event: microblaze_timer_set_next_event
set_mode: microblaze_timer_set_mode
event_handler: tick_handle_periodic

# cat /proc/timer_list
Timer List Version: v0.4
HRTIMER_MAX_CLOCK_BASES: 2
now at 198714389017 nsecs

cpu: 0
clock 0:
.base: 902774d0
.index: 0
.resolution: 10000000 nsecs
.get_time: ktime_get_real
active timers:
clock 1:
.base: 902774f4
.index: 1
.resolution: 10000000 nsecs
.get_time: ktime_get
active timers:
#0: <9e2d3a48>, hrtimer_wakeup, S:01, <9e2d3a48>, inetd/54

 # expires at 199160628442-199161628402 nsecs [in 446239425 to 447239385 nsecs]
 #1: <9e0e5a48>, hrtimer_wakeup, S:01, <9e0e5a48>, thttpd/50
 # expires at 249711205338-249811205338 nsecs [in 50996816321 to 51096816321 nsecs]

Tick Device: mode: 0
Per CPU device: 0
Clock Event Device: microblaze_clockevent

 max_delta_ns:   2147483647
 min_delta_ns:   1000
 mult:           536870912
 shift:          32
 mode:           2
 next_event:     2147483646999999999 nsecs

set_next_event: microblaze_timer_set_next_event
set_mode: microblaze_timer_set_mode
event_handler: tick_handle_periodic

#

#82 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

Quoted 1 line · Michal Simek

Why is my .resolution: 10000000 nsecs? It seems to me weird.

Well. The resulution there is the granularity which the kernel uses to expire application timers. Once the kernel switches to high resolution mode it sets the granularity to 1ns.

To get high resolution mode you need two things:

1) a suitable clocksource - which needs to have the CLOCK_SOURCE_IS_CONTINUOUS flag set

2) a clock event device which has CLOCK_EVT_FEAT_PERIODIC flag set.

3) CONFIG_HIGH_RES_TIMERS=y

Thanks,

tglx

author maintainer
#83 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

Quoted 7 lines · Thomas Gleixner
Quoted 1 line · Michal Simek

Why is my .resolution: 10000000 nsecs? It seems to me weird.

Well. The resulution there is the granularity which the kernel uses to expire application timers. Once the kernel switches to high resolution mode it sets the granularity to 1ns.

Quoted 7 lines

To get high resolution mode you need two things:

1) a suitable clocksource - which needs to have the CLOCK_SOURCE_IS_CONTINUOUS flag set

2) a clock event device which has CLOCK_EVT_FEAT_PERIODIC flag set.

You meant ONESHOT feature, right?

Quoted 1 line

3) CONFIG_HIGH_RES_TIMERS=y

Below are kernel logs which I am getting.

Thanks,
Michal

Quoted 3 lines

Thanks,

tglx

Here is .config fragment
#
# Processor type and features
#
CONFIG_TICK_ONESHOT=y
# CONFIG_NO_HZ is not set
CONFIG_HIGH_RES_TIMERS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set
CONFIG_HZ_100=y
# CONFIG_HZ_250 is not set
# CONFIG_HZ_300 is not set
# CONFIG_HZ_1000 is not set
CONFIG_HZ=100
CONFIG_SCHED_HRTICK=y

Only Periodic mode

early_printk_console is enabled at 0x84000000
Ramdisk addr 0x90c80040, FDT 0x90780000
Found romfs @ 0x90c80040 (0x001bf000)
#### klimit 902f5000 ####
Moving 0x001bf000 bytes from 0x90c80040 to 0x902f42a8
New klimit: 0x904b4000
Found FDT at 0x90780000
Linux version 2.6.29-rc8-00471-g965e2a5-dirty ([email protected]) (gcc version 3.4.1 ( PetaLinux 0.20 Build -rc1 050607 )) #46 Fri Mar 20 12:20:22 CET 2009
setup_cpuinfo: initialising
setup_cpuinfo: Using full CPU PVR support
setup_memory: Main mem: 0x90000000-0xa0000000, size 0x10000000
setup_memory: kernel addr=0x90000000-0x904b4000 size=0x004b4000
setup_memory: max_mapnr: 0x10000
setup_memory: min_low_pfn: 0x90000
setup_memory: max_low_pfn: 0xa0000
On node 0 totalpages: 65536
free_area_init_node: node 0, pgdat 902842f0, node_mem_map 904b4000
Normal zone: 512 pages used for memmap
Normal zone: 0 pages reserved
Normal zone: 65024 pages, LIFO batch:15
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024 Kernel command line: console=ttyUL0,115200 highres=on xlnx,xps-intc-1.00.a #0 at 0x81800000, num_irq=9, edge=0x100
PID hash table entries: 1024 (order: 10, 4096 bytes) xlnx,xps-timer-1.00.a #0 at 0x83c00000, irq=3
Heartbeat GPIO at 0x81400000
microblaze_timer_set_mode: shutdown
microblaze_timer_set_mode: periodic

periodic mode
--------------------------------------------------------------------------------------
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes) Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 254848k/262144k available
ODEBUG: selftest passed
Calibrating delay loop... 61.64 BogoMIPS (lpj=308224) Mount-cache hash table entries: 512
net_namespace: 544 bytes
NET: Registered protocol family 16
bio: create slab <bio-0> at 0
NET: Registered protocol family 2
IP route cache hash table entries: 2048 (order: 1, 8192 bytes) TCP established hash table entries: 8192 (order: 4, 65536 bytes) TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 8192 bind 8192) TCP reno registered
NET: Registered protocol family 1
msgmni has been set to 498
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
84000000.serial: ttyUL0 at MMIO 0x84000003 (irq = 8) is a uartlite console [ttyUL0] enabled
brd: module loaded
nbd: registered device at major 43
uclinux[mtd]: RAM probe address=0x902f42a8 size=0x1bf000 Creating 1 MTD partitions on "RAM":
0x000000000000-0x0000001bf000 : "ROMfs"
uclinux[mtd]: set ROMfs to be root filesystem index=0 TCP cubic registered
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
VFS: Mounted root (romfs filesystem) readonly on device 31:0. Freeing unused kernel memory: 96k freed
Mounting proc:
Mounting var:
Populating /var:
Running local start scripts.
Mounting /etc/config:
Populating /etc/config:
flatfsd: Nonexistent or bad flatfs (-48), creating new one...
flatfsd: Failed to write flatfs (-48): No such device
flatfsd: Created 6 configuration files (310 bytes) Mounting sysfs:
Setting hostname:
Setting up interface lo:
Setting up interface eth0:
SIOCSIFADDR: No such device
Starting thttpd:

uclinux login: root
Password:

# cat /proc/timer_list
Timer List Version: v0.4
HRTIMER_MAX_CLOCK_BASES: 2
now at 21135463800 nsecs

cpu: 0
clock 0:
.base: 9027a4d0
.index: 0
.resolution: 10000000 nsecs
.get_time: ktime_get_real
.offset: 0 nsecs
active timers:
clock 1:
.base: 9027a4fc
.index: 1
.resolution: 10000000 nsecs
.get_time: ktime_get
.offset: 0 nsecs
active timers:
#0: <9f2d3a48>, hrtimer_wakeup, S:01, <9f2d3a48>, inetd/54

 # expires at 21380356677-21381356634 nsecs [in 244892877 to 245892834 nsecs]
 #1: <9e127a48>, hrtimer_wakeup, S:01, <9e127a48>, thttpd/50
 # expires at 129627877707-129727877707 nsecs [in 108492413907 to 108592413907
nsecs]
  .expires_next   : 2147483646999999999 nsecs
  .hres_active    : 0
  .nr_events      : 0
  .nohz_mode      : 0
  .idle_tick      : 0 nsecs
  .tick_stopped   : 0
  .idle_jiffies   : 0
  .idle_calls     : 0
  .idle_sleeps    : 0
  .idle_entrytime : 0 nsecs
  .idle_waketime  : 0 nsecs
  .idle_exittime  : 0 nsecs
  .idle_sleeptime : 0 nsecs
  .last_jiffies   : 0
  .next_jiffies   : 0
  .idle_expires   : 0 nsecs
jiffies: 4294939392

Tick Device: mode: 0
Per CPU device: 0
Clock Event Device: microblaze_clockevent

 max_delta_ns:   2147483647
 min_delta_ns:   1000
 mult:           536870912
 shift:          32
 mode:           2
 next_event:     2147483646999999999 nsecs

set_next_event: microblaze_timer_set_next_event
set_mode: microblaze_timer_set_mode
event_handler: tick_handle_periodic

#

--------------------------------------------------------------------------------------
only shot mode

early_printk_console is enabled at 0x84000000
Ramdisk addr 0x90c80040, FDT 0x90780000
Found romfs @ 0x90c80040 (0x001bf000)
#### klimit 902f5000 ####
Moving 0x001bf000 bytes from 0x90c80040 to 0x902f42a8
New klimit: 0x904b4000
Found FDT at 0x90780000
Linux version 2.6.29-rc8-00471-g965e2a5-dirty ([email protected]) (gcc version 3.4.1 ( PetaLinux 0.20 Build -rc1 050607 )) #47 Fri Mar 20 12:23:08 CET 2009
setup_cpuinfo: initialising
setup_cpuinfo: Using full CPU PVR support
setup_memory: Main mem: 0x90000000-0xa0000000, size 0x10000000
setup_memory: kernel addr=0x90000000-0x904b4000 size=0x004b4000
setup_memory: max_mapnr: 0x10000
setup_memory: min_low_pfn: 0x90000
setup_memory: max_low_pfn: 0xa0000
On node 0 totalpages: 65536
free_area_init_node: node 0, pgdat 902842f0, node_mem_map 904b4000
Normal zone: 512 pages used for memmap
Normal zone: 0 pages reserved
Normal zone: 65024 pages, LIFO batch:15
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024 Kernel command line: console=ttyUL0,115200 highres=on xlnx,xps-intc-1.00.a #0 at 0x81800000, num_irq=9, edge=0x100
PID hash table entries: 1024 (order: 10, 4096 bytes) xlnx,xps-timer-1.00.a #0 at 0x83c00000, irq=3
Heartbeat GPIO at 0x81400000
microblaze_timer_set_mode: shutdown
microblaze_timer_set_mode: oneshot

one shot mode here
--------------------------------------------------------------------------------------
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes) Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 254848k/262144k available
ODEBUG: selftest passed
Calibrating delay loop... 62.25 BogoMIPS (lpj=311296) Mount-cache hash table entries: 512
net_namespace: 544 bytes
NET: Registered protocol family 16
bio: create slab <bio-0> at 0
Switched to high resolution mode on CPU 0
NET: Registered protocol family 2
IP route cache hash table entries: 2048 (order: 1, 8192 bytes) TCP established hash table entries: 8192 (order: 4, 65536 bytes) TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 8192 bind 8192) TCP reno registered
NET: Registered protocol family 1
msgmni has been set to 498
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
84000000.serial: ttyUL0 at MMIO 0x84000003 (irq = 8) is a uartlite console [ttyUL0] enabled
brd: module loaded
nbd: registered device at major 43
uclinux[mtd]: RAM probe address=0x902f42a8 size=0x1bf000 Creating 1 MTD partitions on "RAM":
0x000000000000-0x0000001bf000 : "ROMfs"
uclinux[mtd]: set ROMfs to be root filesystem index=0 TCP cubic registered
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
VFS: Mounted root (romfs filesystem) readonly on device 31:0. Freeing unused kernel memory: 96k freed
Mounting proc:
Mounting var:
Populating /var:
Running local start scripts.
Mounting /etc/config:
Populating /etc/config:
flatfsd: Nonexistent or bad flatfs (-48), creating new one...
flatfsd: Failed to write flatfs (-48): No such device
flatfsd: Created 6 configuration files (310 bytes) Mounting sysfs:
Setting hostname:
Setting up interface lo:
Setting up interface eth0:
SIOCSIFADDR: No such device
Starting thttpd:

uclinux login: root
Password:

# cat /proc/timer_list
Timer List Version: v0.4
HRTIMER_MAX_CLOCK_BASES: 2
now at 20996421657 nsecs

cpu: 0
clock 0:
.base: 9027a4d0
.index: 0
.resolution: 1 nsecs
.get_time: ktime_get_real
.offset: 0 nsecs
active timers:
clock 1:
.base: 9027a4fc
.index: 1
.resolution: 1 nsecs
.get_time: ktime_get
.offset: 0 nsecs
active timers:
#0: per_cpu__tick_cpu_sched, tick_sched_timer, S:01, <800005a6>, swapper/1

 # expires at 21000000000-21000000000 nsecs [in 3578343 to 3578343 nsecs]
 #1: <9f2d3a48>, hrtimer_wakeup, S:01, <9f2d3a48>, inetd/54
 # expires at 21467819124-21468819081 nsecs [in 471397467 to 472397424 nsecs]
 #2: <9e127a48>, hrtimer_wakeup, S:01, <9e127a48>, thttpd/50
 # expires at 129753940928-129853940928 nsecs [in 108757519271 to 108857519271
nsecs]
  .expires_next   : 21000000000 nsecs
  .hres_active    : 1
  .nr_events      : 2011
  .nohz_mode      : 0
  .idle_tick      : 0 nsecs
  .tick_stopped   : 0
  .idle_jiffies   : 0
  .idle_calls     : 0
  .idle_sleeps    : 0
  .idle_entrytime : 0 nsecs
  .idle_waketime  : 0 nsecs
  .idle_exittime  : 0 nsecs
  .idle_sleeptime : 0 nsecs
  .last_jiffies   : 0
  .next_jiffies   : 0
  .idle_expires   : 0 nsecs
jiffies: 4294939395

Tick Device: mode: 1
Per CPU device: 0
Clock Event Device: microblaze_clockevent

 max_delta_ns:   2147483647
 min_delta_ns:   1000
 mult:           536870912
 shift:          32
 mode:           3
 next_event:     21000000000 nsecs

set_next_event: microblaze_timer_set_next_event
set_mode: microblaze_timer_set_mode
event_handler: hrtimer_interrupt

#

---------------------------------------------------------------------------------------------
both mode in features

early_printk_console is enabled at 0x84000000
Ramdisk addr 0x90c80040, FDT 0x90780000
Found romfs @ 0x90c80040 (0x001bf000)
#### klimit 902f5000 ####
Moving 0x001bf000 bytes from 0x90c80040 to 0x902f42a8
New klimit: 0x904b4000
Found FDT at 0x90780000
Linux version 2.6.29-rc8-00471-g965e2a5-dirty ([email protected]) (gcc version 3.4.1 ( PetaLinux 0.20 Build -rc1 050607 )) #48 Fri Mar 20 12:26:44 CET 2009
setup_cpuinfo: initialising
setup_cpuinfo: Using full CPU PVR support
setup_memory: Main mem: 0x90000000-0xa0000000, size 0x10000000
setup_memory: kernel addr=0x90000000-0x904b4000 size=0x004b4000
setup_memory: max_mapnr: 0x10000
setup_memory: min_low_pfn: 0x90000
setup_memory: max_low_pfn: 0xa0000
On node 0 totalpages: 65536
free_area_init_node: node 0, pgdat 902842f0, node_mem_map 904b4000
Normal zone: 512 pages used for memmap
Normal zone: 0 pages reserved
Normal zone: 65024 pages, LIFO batch:15
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024 Kernel command line: console=ttyUL0,115200 highres=on xlnx,xps-intc-1.00.a #0 at 0x81800000, num_irq=9, edge=0x100
PID hash table entries: 1024 (order: 10, 4096 bytes) xlnx,xps-timer-1.00.a #0 at 0x83c00000, irq=3
Heartbeat GPIO at 0x81400000
microblaze_timer_set_mode: shutdown
microblaze_timer_set_mode: periodic
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes) Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 254848k/262144k available
ODEBUG: selftest passed
Calibrating delay loop... 61.64 BogoMIPS (lpj=308224)
Mount-cache hash table entries: 512
net_namespace: 544 bytes
NET: Registered protocol family 16
bio: create slab <bio-0> at 0
microblaze_timer_set_mode: oneshot
Switched to high resolution mode on CPU 0
NET: Registered protocol family 2
IP route cache hash table entries: 2048 (order: 1, 8192 bytes) TCP established hash table entries: 8192 (order: 4, 65536 bytes) TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP reno registered
NET: Registered protocol family 1
msgmni has been set to 498
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
84000000.serial: ttyUL0 at MMIO 0x84000003 (irq = 8) is a uartlite console [ttyUL0] enabled
brd: module loaded
nbd: registered device at major 43
uclinux[mtd]: RAM probe address=0x902f42a8 size=0x1bf000
Creating 1 MTD partitions on "RAM":
0x000000000000-0x0000001bf000 : "ROMfs"
uclinux[mtd]: set ROMfs to be root filesystem index=0
TCP cubic registered
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
VFS: Mounted root (romfs filesystem) readonly on device 31:0. Freeing unused kernel memory: 96k freed
Mounting proc:
Mounting var:
Populating /var:
Running local start scripts.
Mounting /etc/config:
Populating /etc/config:
flatfsd: Nonexistent or bad flatfs (-48), creating new one...
flatfsd: Failed to write flatfs (-48): No such device
flatfsd: Created 6 configuration files (310 bytes)
Mounting sysfs:
Setting hostname:
Setting up interface lo:
Setting up interface eth0:
SIOCSIFADDR: No such device
Starting thttpd:

uclinux login: root
Password:

# cat /proc/timer_list
Timer List Version: v0.4
HRTIMER_MAX_CLOCK_BASES: 2
now at 17205889582 nsecs

cpu: 0
clock 0:
.base: 9027a4d0
.index: 0
.resolution: 1 nsecs
.get_time: ktime_get_real
.offset: 0 nsecs
active timers:
clock 1:
.base: 9027a4fc
.index: 1
.resolution: 1 nsecs
.get_time: ktime_get
.offset: 0 nsecs
active timers:
#0: per_cpu__tick_cpu_sched, tick_sched_timer, S:01, <800005a6>, swapper/1

 # expires at 17210000000-17210000000 nsecs [in 4110418 to 4110418 nsecs]
 #1: <9f2d3a48>, hrtimer_wakeup, S:01, <9f2d3a48>, inetd/54
 # expires at 17430563969-17431563926 nsecs [in 224674387 to 225674344 nsecs]
 #2: <9e127a48>, hrtimer_wakeup, S:01, <9e127a48>, thttpd/50
 # expires at 129748538823-129848538823 nsecs [in 112542649241 to 112642649241
nsecs]
  .expires_next   : 17210000000 nsecs
  .hres_active    : 1
  .nr_events      : 1627
  .nohz_mode      : 0
  .idle_tick      : 0 nsecs
  .tick_stopped   : 0
  .idle_jiffies   : 0
  .idle_calls     : 0
  .idle_sleeps    : 0
  .idle_entrytime : 0 nsecs
  .idle_waketime  : 0 nsecs
  .idle_exittime  : 0 nsecs
  .idle_sleeptime : 0 nsecs
  .last_jiffies   : 0
  .next_jiffies   : 0
  .idle_expires   : 0 nsecs
jiffies: 4294939016

Tick Device: mode: 1
Per CPU device: 0
Clock Event Device: microblaze_clockevent

 max_delta_ns:   2147483647
 min_delta_ns:   1000
 mult:           536870912
 shift:          32
 mode:           3
 next_event:     17210000000 nsecs

set_next_event: microblaze_timer_set_next_event
set_mode: microblaze_timer_set_mode
event_handler: hrtimer_interrupt

#

#84 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

Quoted 3 lines · Michal Simek
Quoted 1 line

2) a clock event device which has CLOCK_EVT_FEAT_PERIODIC flag set.

You meant ONESHOT feature, right?

Sure :)

Quoted 21 lines
# cat /proc/timer_list
Timer List Version: v0.4
HRTIMER_MAX_CLOCK_BASES: 2
now at 17205889582 nsecs

cpu: 0
clock 0:
.base: 9027a4d0
.index: 0
.resolution: 1 nsecs
.get_time: ktime_get_real
.offset: 0 nsecs
active timers:
clock 1:
.base: 9027a4fc
.index: 1
.resolution: 1 nsecs
.get_time: ktime_get
.offset: 0 nsecs
active timers:
#0: per_cpu__tick_cpu_sched, tick_sched_timer, S:01, <800005a6>, swapper/1

Quoted 8 lines
 # expires at 17210000000-17210000000 nsecs [in 4110418 to 4110418 nsecs]
 #1: <9f2d3a48>, hrtimer_wakeup, S:01, <9f2d3a48>, inetd/54
 # expires at 17430563969-17431563926 nsecs [in 224674387 to 225674344 nsecs]
 #2: <9e127a48>, hrtimer_wakeup, S:01, <9e127a48>, thttpd/50
 # expires at 129748538823-129848538823 nsecs [in 112542649241 to 112642649241
nsecs]
  .expires_next   : 17210000000 nsecs
  .hres_active    : 1

Looks good. Now you can enable CONFIG_NOHZ as well. :) That needs just the following extras in your idle loop:

-->             tick_nohz_stop_sched_tick(1);
	        while (!need_resched())
		        idle();

--> tick_nohz_restart_sched_tick();

Thanks,

tglx

author maintainer
#85 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

Quoted 36 lines · Thomas Gleixner
Quoted 2 lines · Michal Simek
Quoted 1 line

2) a clock event device which has CLOCK_EVT_FEAT_PERIODIC flag set.

You meant ONESHOT feature, right?

Sure :)

Quoted 21 lines
# cat /proc/timer_list
Timer List Version: v0.4
HRTIMER_MAX_CLOCK_BASES: 2
now at 17205889582 nsecs

cpu: 0
clock 0:
.base: 9027a4d0
.index: 0
.resolution: 1 nsecs
.get_time: ktime_get_real
.offset: 0 nsecs
active timers:
clock 1:
.base: 9027a4fc
.index: 1
.resolution: 1 nsecs
.get_time: ktime_get
.offset: 0 nsecs
active timers:
#0: per_cpu__tick_cpu_sched, tick_sched_timer, S:01, <800005a6>, swapper/1

Quoted 8 lines
 # expires at 17210000000-17210000000 nsecs [in 4110418 to 4110418 nsecs]
 #1: <9f2d3a48>, hrtimer_wakeup, S:01, <9f2d3a48>, inetd/54
 # expires at 17430563969-17431563926 nsecs [in 224674387 to 225674344 nsecs]
 #2: <9e127a48>, hrtimer_wakeup, S:01, <9e127a48>, thttpd/50
 # expires at 129748538823-129848538823 nsecs [in 112542649241 to 112642649241
nsecs]
  .expires_next   : 17210000000 nsecs
  .hres_active    : 1
Quoted 8 lines

Looks good. Now you can enable CONFIG_NOHZ as well. :) That needs just the following extras in your idle loop:

-->             tick_nohz_stop_sched_tick(1);
	        while (!need_resched())
		        idle();

--> tick_nohz_restart_sched_tick();

Yes, it is already in cpu_idle function. ->arch/microblaze/kernel/process.c file Seems that work too. Look below. I am going to take a look at __do_IRQ issue.

Thanks,
Michal

Quoted 3 lines

Thanks,

tglx

early_printk_console is enabled at 0x84000000
Ramdisk addr 0x90c80040, FDT 0x90780000
Found romfs @ 0x90c80040 (0x001bf000)
#### klimit 902f7000 ####
Moving 0x001bf000 bytes from 0x90c80040 to 0x902f62ac
New klimit: 0x904b6000
Found FDT at 0x90780000
Linux version 2.6.29-rc8-00473-g1219507-dirty ([email protected]) (gcc version 3.4.1 ( PetaLinux 0.20 Build -rc1 050607 )) #51 Fri Mar 20 12:56:11 CET 2009
setup_cpuinfo: initialising
setup_cpuinfo: Using full CPU PVR support
setup_memory: Main mem: 0x90000000-0xa0000000, size 0x10000000
setup_memory: kernel addr=0x90000000-0x904b6000 size=0x004b6000
setup_memory: max_mapnr: 0x10000
setup_memory: min_low_pfn: 0x90000
setup_memory: max_low_pfn: 0xa0000
On node 0 totalpages: 65536
free_area_init_node: node 0, pgdat 902852f4, node_mem_map 904b6000
Normal zone: 512 pages used for memmap
Normal zone: 0 pages reserved
Normal zone: 65024 pages, LIFO batch:15
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024 Kernel command line: console=ttyUL0,115200 highres=on xlnx,xps-intc-1.00.a #0 at 0x81800000, num_irq=9, edge=0x100
PID hash table entries: 1024 (order: 10, 4096 bytes) xlnx,xps-timer-1.00.a #0 at 0x83c00000, irq=3
Heartbeat GPIO at 0x81400000
microblaze_timer_set_mode: shutdown
microblaze_timer_set_mode: periodic
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes) Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 254848k/262144k available
ODEBUG: selftest passed
Calibrating delay loop... 61.44 BogoMIPS (lpj=307200)
Mount-cache hash table entries: 512
net_namespace: 544 bytes
NET: Registered protocol family 16
bio: create slab <bio-0> at 0
microblaze_timer_set_mode: oneshot
Switched to high resolution mode on CPU 0
NET: Registered protocol family 2
IP route cache hash table entries: 2048 (order: 1, 8192 bytes) TCP established hash table entries: 8192 (order: 4, 65536 bytes) TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP reno registered
NET: Registered protocol family 1
msgmni has been set to 498
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
84000000.serial: ttyUL0 at MMIO 0x84000003 (irq = 8) is a uartlite console [ttyUL0] enabled
brd: module loaded
nbd: registered device at major 43
uclinux[mtd]: RAM probe address=0x902f62ac size=0x1bf000
Creating 1 MTD partitions on "RAM":
0x000000000000-0x0000001bf000 : "ROMfs"
uclinux[mtd]: set ROMfs to be root filesystem index=0
TCP cubic registered
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
VFS: Mounted root (romfs filesystem) readonly on device 31:0. Freeing unused kernel memory: 96k freed
Mounting proc:
Mounting var:
Populating /var:
Running local start scripts.
Mounting /etc/config:
Populating /etc/config:
flatfsd: Nonexistent or bad flatfs (-48), creating new one...
flatfsd: Failed to write flatfs (-48): No such device
flatfsd: Created 6 configuration files (310 bytes)
Mounting sysfs:
Setting hostname:
Setting up interface lo:
Setting up interface eth0:
SIOCSIFADDR: No such device
Starting thttpd:

uclinux login: root
Password:

# ls
bin   dev   etc   home  lib   mnt   proc  sys   tmp   usr   var
# uptime
 00:00:19 up 0 min, load average: 0.21, 0.04, 0.01
# uptime
 00:00:20 up 0 min, load average: 0.19, 0.04, 0.01
# uptime
 00:00:21 up 0 min, load average: 0.19, 0.04, 0.01
# gunzip < /proc/config.gz
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.29-rc8
# Fri Mar 20 12:52:15 2009
#
CONFIG_MICROBLAZE=y
# 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_GENERIC_TIME=y
# CONFIG_GENERIC_TIME_VSYSCALL is not set
CONFIG_GENERIC_CLOCKEVENTS=y
# CONFIG_PCI is not set
# CONFIG_NO_DMA is not set

...

#
# Processor type and features
#
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set
CONFIG_HZ_100=y
# CONFIG_HZ_250 is not set
# CONFIG_HZ_300 is not set
# CONFIG_HZ_1000 is not set
CONFIG_HZ=100
CONFIG_SCHED_HRTICK=y

author maintainer
#86 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

In reply to Thomas Gleixner

Hi Thomas,

Quoted 43 lines · Michal Simek
Quoted 9 lines
Quoted 4 lines

arch/microblaze/kernel/irq.c line 51

Quoted 1 line
arch/microblaze/kernel/irq.c new file +1 -0
+	__do_IRQ(irq);

You use irq chips now and you set the type handlers (edge/level), but you still call __do_IRQ() the all in one fits nothing handler, which is going to be deprecated and removed.

I know about.

Quoted 4 lines

Please call

       generic_handle_irq(irq);

which will call the correct flow handlers.

Quoted 8 lines

I would like to use it but don't work with edge interrupt. __do_IRQ handle it in right way.

I used this implementation but I did some change edge/level handling and I can't use it.
http://developer.petalogix.com/git/gitweb.cgi?p=linux-2.6-microblaze.git;a=blob_plain;f=arch/microblaze/kernel/irq.c;hb=3645d887ad6443a262bbeddf384038321172db2b

Any hints what could be wrong?

Look at the different handling schemes of __do_IRQ and handle_edge_irq vs. the chip functions:

__do_IRQ() does:

{
	   chip->ack();
	   
	   handle_IRQ_event();

	   chip->end();
}

handle_edge_irq() does:

{
	if ((desc->status & (IRQ_INPROGRESS | IRQ_DISABLED)) ||
                    !desc->action)) {
                desc->status |= (IRQ_PENDING | IRQ_MASKED);
                mask_ack_irq(desc, irq);
		goto out_unlock;
	}

	chip->ack();
	handle_IRQ_event();
Quoted 3 lines

}

I guess the problem is in your chip->xxx functions.

I fixed it. There were one additional line.
+ I set GENERIC_HARDIRQS_NO__DO_IRQ=y.

BTW: Below is full chip description where function enable is unmask and disable is mask. Do I have keep there enable and disable function pointers? I commented them and works without them too.

static struct irq_chip intc_dev = {
.name = "Xilinx INTC",
.enable = intc_enable_or_unmask,
.unmask = intc_enable_or_unmask,
.disable = intc_disable_or_mask,
.mask = intc_disable_or_mask,
.ack = intc_ack,
.mask_ack = intc_mask_ack,
.end = intc_end,
};

Thanks,
Michal

#87 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

Michal,

Quoted 4 lines · Michal Simek
Quoted 1 line

I guess the problem is in your chip->xxx functions.

I fixed it. There were one additional line.
+ I set GENERIC_HARDIRQS_NO__DO_IRQ=y.

Cool.

Quoted 3 lines

BTW: Below is full chip description where function enable is unmask and disable is mask. Do I have keep there enable and disable function pointers? I commented them and works without them too.

Right. The generic code does:

        if (!chip->enable)
                chip->enable = default_enable;
        if (!chip->disable)
                chip->disable = default_disable;

Thanks,

tglx

author maintainer
#88 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

Thomas,

Quoted 8 lines

Michal,

Quoted 3 lines · Michal Simek
Quoted 1 line

I guess the problem is in your chip->xxx functions.

I fixed it. There were one additional line.
+ I set GENERIC_HARDIRQS_NO__DO_IRQ=y.

Cool.

:-)

NO_HZ works too. Here is the log.

# cat /proc/interrupts
                CPU0
  3:       3827     level     INTC  timer
  8:       1834      edge     INTC  uartlite
# uptime
 00:16:47 up 16 min, load average: 0.00, 0.00, 0.00
# uptime
 00:17:53 up 17 min, load average: 0.00, 0.00, 0.00
# cat /proc/interrupts
                CPU0
  3:       4105     level     INTC  timer
  8:       1913      edge     INTC  uartlite
# uptime
 00:21:44 up 21 min, load average: 0.00, 0.00, 0.00
# cat /proc/interrupts
                CPU0
  3:       4615     level     INTC  timer
  8:       1970      edge     INTC  uartlite
#
Quoted 11 lines
Quoted 4 lines

BTW: Below is full chip description where function enable is unmask and disable is mask. Do I have keep there enable and disable function pointers? I commented them and works without them too.

Right. The generic code does:

        if (!chip->enable)
                chip->enable = default_enable;
        if (!chip->disable)
                chip->disable = default_disable;

I look at default implementation and seems to me that I can save some instruction when I use my enable function not generic one and for disabling is default function faster because do nothing.
I am going to send one email with full intc.c + 2 changes - one in irq.c and second in Kconfig.

Thanks,
Michal

Quoted 4 lines

Thanks,

tglx

Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
#71 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

In reply to Michal Simek
Quoted 21 lines · Michal Simek

Hi John S,

Quoted 19 lines · Thomas Gleixner
Quoted 10 lines · Michal Simek
Quoted 9 lines

And the second question is about shift and rating values. I wrote one message in past http://lkml.org/lkml/2009/1/11/291
Here is the important of part of that message.

...

And the second part is about shift and rating values. Rating is describe(linux/clocksource.h) and seems to me that should be corresponded with CONFIG_HZ value,right?

Not sure where the idea of correspondence w/ CONFIG_HZ came from. The rating value just provides a relative ordering of preferences between possible clocksources. Since different hardware may have a number of different clocksources available, we just need to have a method of selecting a preferred clocksource, and the rating value is used for that.

Quoted 8 lines
Quoted 5 lines

The guide in linux/clocksource.h is just a guide. Most arches, which only have one or two clocksource options probably won't need much care, and a rating of 200 or 300 will probably suffice. Or if there really isn't any option about it and there is only one which is a must-use clocksource, 400.

ok. That mean that for my case (only one clocksource) I should set rating to 400
- I have one clocksource and is perfect for me.

As long as there will never be another clocksource used on that architecture, 400 is probably ok. Since its sometimes hard to tell, you might want to pick a more moderate 300.

But again, its a relative scale and doesn't matter all that much, as long as the right clocksource is always selected at boot for the hardware.

Quoted 19 lines
Quoted 12 lines
Quoted 4 lines
Quoted 3 lines

And I found any explanation of shift value -> max value for equation (2-5) * freq << shift / NSEC_PER_SEC should be for my case still 32bit number, where (2-5s) are because of NTP

@John, can you explain the shift vlaue please ?

The shift value is a bit more difficult to explain. The algorithm you describe above is used by sparc to generate shift, and I think it will work, but may not be optimal.

This question comes up over and over, so I figured I should sit down and really solve it.

Quoted 6 lines

Basically the constraint is you want to calculate a mult value using the highest shift possible. However we have to be careful not to overflow 64bits when we multiply ~5second worth of cycles times the mult value.

So I finally put this down into code and here it is. No promises that it is 100% right, but from my simple test examples it worked ok.

Quoted 7 lines

OK. Please check my case of that value.
MB can run from 5Mhz till 150MHz I think.
I need generic approach that's why I have to calculate with max value (150MHz). My timer can tick on that freq too. (There is no different time bases in HW).

I need to find out how many ticks takes ~5s. 150MHz means that I need for 1sec 150 000 000 timer ticks.

I think you mean counter cycles instead of timer ticks. Timer tick terminology usually describes a timer based interrupt.

Quoted 7 lines

One tick takes 1/150MHz = ~6-7ns - in the best case I can recognize and set 6-7ns (this is only theoretical value because of overhead)

~5s takes 750 000 000 ticks = 0x2CB4 1780. And I have 32bit counter.

That my question is how big could be a shift of value above till overflow. 0x2CB4 1780 << shift not exceed 0xffff ffff ffff ffff.

Almost. Its not the shift that causes the problem right off, but the resulting mult value calculated from a shift. Again, the key points are, you want to make sure that:

1) that mult value for the given shift fits in 32 bits. and
2) mult * 5sec of cycles doesn't overflow 64bits (really is only an issue for very very fast counters that run faster then 1Ghz).

So let's follow my algorithm and start by picking a shift value of 32.

We calculate the mult, which would be (using clocksource_khz2mult()):

	(1Million * 2^32) / 150,000 = 28633115307 which overflows 32bits.

BZZZZZZ.

	1Million * 2^31 / 150,000 = 14316557653 (to big. BZZZZZZZ)
	

	1Million * 2^30 / 150,000 = 7158278827 (to big. BZZZZZZZ)


	1Million * 2^29 / 150,000 = 3579139413 (BING! it fits!)

Now the test:

	(750000000 * 3579139413)>>29 ?= 5 seconds
	2684354559750000000 (doesn't overflow!) >> 29
	4999999999ns ?= 5seconds (within the error range, so we're good!)

Now take care, because the slower the clocksource, often the lower the shift value we can use, because the nsecs per cycle value that mult approximates is much larger.

So for 5mhz (using

	1Million * 2^29 / 5,000 = 107374182400 (32bit overflow!)
	...
	1Million * 2^24 / 5,000 = 3355443200 (fits!)

Now the test:

	(25000000 * 3355443200)>>24 ?= 5 seconds
	83886080000000000 (doesn't overflow!) >> 24 ?=
	5000000000ns ?= 5seconds (BING!)

So you can either dynamically calculate the best shift value for the actual freq using the helper functions I provided, or just use 24 and be safe, your pick.

Quoted 2 lines

For example avr has shift 16, rating 50 (arch/avr32/kernel/time.c) (BTW: Sets time from 2007 too)

Most arches probably low ball the shift to be safe. Mainly because explaining how to calculate the optimal shift was hard and there weren't helper functions.

As an aside (feel free to ignore for the microblaze bits):
Some complexity may grow here as well, since 5 seconds of cycles may
prove too short as folks become more interested running w/ NOHZ and avoiding interrupts for extreme lengths of time (I've heard 30 minutes!?). For those situations we will need lower shift values, since 30 minutes of cycles * a large mult value close to (1<<32) will likely overflow 64bits. But that trades off how finely we can tweak the clock steering. Probably converting folks to use the helper functions will be the best approach, as it will allow us to configure that depending on NOHZ or not.

thanks
-john

author maintainer
#72 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

Hi John,

Quoted 29 lines · Michal Simek
Quoted 20 lines

Hi John S,

Quoted 18 lines · Thomas Gleixner
Quoted 10 lines · Michal Simek
Quoted 9 lines

And the second question is about shift and rating values. I wrote one message in past http://lkml.org/lkml/2009/1/11/291
Here is the important of part of that message.

...

And the second part is about shift and rating values. Rating is describe(linux/clocksource.h) and seems to me that should be corresponded with CONFIG_HZ value,right?

Not sure where the idea of correspondence w/ CONFIG_HZ came from. The rating value just provides a relative ordering of preferences between possible clocksources. Since different hardware may have a number of different clocksources available, we just need to have a method of selecting a preferred clocksource, and the rating value is used for that.

Quoted 7 lines
Quoted 5 lines

The guide in linux/clocksource.h is just a guide. Most arches, which only have one or two clocksource options probably won't need much care, and a rating of 200 or 300 will probably suffice. Or if there really isn't any option about it and there is only one which is a must-use clocksource, 400.

ok. That mean that for my case (only one clocksource) I should set rating to 400
- I have one clocksource and is perfect for me.

Quoted 7 lines

As long as there will never be another clocksource used on that architecture, 400 is probably ok. Since its sometimes hard to tell, you might want to pick a more moderate 300.

But again, its a relative scale and doesn't matter all that much, as long as the right clocksource is always selected at boot for the hardware.

OK that mean that rating do the same work for clockevent sources too, right?

Quoted 24 lines
Quoted 24 lines
Quoted 13 lines
Quoted 6 lines
Quoted 5 lines

And I found any explanation of shift value -> max value for equation (2-5) * freq << shift / NSEC_PER_SEC should be for my case still 32bit number, where (2-5s) are because of NTP

@John, can you explain the shift vlaue please ?

The shift value is a bit more difficult to explain. The algorithm you describe above is used by sparc to generate shift, and I think it will work, but may not be optimal.

This question comes up over and over, so I figured I should sit down and really solve it.

Quoted 6 lines

Basically the constraint is you want to calculate a mult value using the highest shift possible. However we have to be careful not to overflow 64bits when we multiply ~5second worth of cycles times the mult value.

So I finally put this down into code and here it is. No promises that it is 100% right, but from my simple test examples it worked ok.

OK. Please check my case of that value.
MB can run from 5Mhz till 150MHz I think.
I need generic approach that's why I have to calculate with max value (150MHz). My timer can tick on that freq too. (There is no different time bases in HW).

Quoted 5 lines
Quoted 2 lines

I need to find out how many ticks takes ~5s. 150MHz means that I need for 1sec 150 000 000 timer ticks.

I think you mean counter cycles instead of timer ticks. Timer tick terminology usually describes a timer based interrupt.

yes.

Quoted 9 lines
Quoted 8 lines

One tick takes 1/150MHz = ~6-7ns - in the best case I can recognize and set 6-7ns (this is only theoretical value because of overhead)

~5s takes 750 000 000 ticks = 0x2CB4 1780. And I have 32bit counter.

That my question is how big could be a shift of value above till overflow. 0x2CB4 1780 << shift not exceed 0xffff ffff ffff ffff.

Quoted 6 lines

Almost. Its not the shift that causes the problem right off, but the resulting mult value calculated from a shift. Again, the key points are, you want to make sure that:

1) that mult value for the given shift fits in 32 bits. and

ok. Formula.

For mult 1GHz * 2^shift/timer_freq < (u32)
=> const=1GHz/timer_freq, const * 2^shift < (u32)

2^30=0x4000 0000
2^29=0x2000 0000
2^28=0x1000 0000

2^26=0x 400 0000
2^25=0x 200 0000
2^24=0x 100 0000
For shift in test
2^20=0x 10 0000
2^8= 0x 100

For 150MHz ->const = 6,6666 -> 30 is over, 29 fits.
For 5MHz -> const = 200 -> 25 is over, 24 fits.
For 1GHz -> const = 1 -> 32 is over, 31 fits - that's correct

For your test case below ->
(5 * timer_freq * 1GHz * 2^shift/timer_freq)>>shift <= 5sec in ns

=>(5 *              1GHz * 2^shift           )>>shift <= 5sec in ns
=>(                 5GHz * 2^shift           )>>shift <= 5sec in ns
=>(                 1GHz * 2^shift           )>>shift <= 1sec in ns
=>                  1GHz                              <= 1sec in ns

=> I think this is no test -> this is equal for every values.

Am I right?

If yes.

min_delta_ns is set to (const<1000 ? 1000 : const) -> I think that only for slower machines than 1MHx uses const value.
max_delta_ns is for 32bit timer 2^31 -1 and for 64bit arch 2^63 - 1

Quoted 37 lines

2) mult * 5sec of cycles doesn't overflow 64bits (really is only an issue for very very fast counters that run faster then 1Ghz).

So let's follow my algorithm and start by picking a shift value of 32.

We calculate the mult, which would be (using clocksource_khz2mult()):

	(1Million * 2^32) / 150,000 = 28633115307 which overflows 32bits.

BZZZZZZ.

	1Million * 2^31 / 150,000 = 14316557653 (to big. BZZZZZZZ)
	

	1Million * 2^30 / 150,000 = 7158278827 (to big. BZZZZZZZ)


	1Million * 2^29 / 150,000 = 3579139413 (BING! it fits!)

Now the test:

	(750 000 000 * 3 579 139 413)>>29 ?= 5 seconds
	2684354559750000000 (doesn't overflow!) >> 29
	4999999999ns ?= 5seconds (within the error range, so we're good!)

Now take care, because the slower the clocksource, often the lower the shift value we can use, because the nsecs per cycle value that mult approximates is much larger.

So for 5mhz (using

	1Million * 2^29 / 5,000 = 107374182400 (32bit overflow!)
	...
	1Million * 2^24 / 5,000 = 3355443200 (fits!)

Now the test:

Quoted 8 lines
	(25000000 * 3355443200)>>24 ?= 5 seconds
	83886080000000000 (doesn't overflow!) >> 24 ?=
	5000000000ns ?= 5seconds (BING!)

So you can either dynamically calculate the best shift value for the actual freq using the helper functions I provided, or just use 24 and be safe, your pick.

ok. we will talk what the smaller freq is.

Quoted 9 lines
Quoted 5 lines

For example avr has shift 16, rating 50 (arch/avr32/kernel/time.c) (BTW: Sets time from 2007 too)

Most arches probably low ball the shift to be safe. Mainly because explaining how to calculate the optimal shift was hard and there weren't helper functions.

I hope that our discussion clear this.

Quoted 11 lines

As an aside (feel free to ignore for the microblaze bits):
Some complexity may grow here as well, since 5 seconds of cycles may
prove too short as folks become more interested running w/ NOHZ and avoiding interrupts for extreme lengths of time (I've heard 30 minutes!?). For those situations we will need lower shift values, since 30 minutes of cycles * a large mult value close to (1<<32) will likely overflow 64bits. But that trades off how finely we can tweak the clock steering. Probably converting folks to use the helper functions will be the best approach, as it will allow us to configure that depending on NOHZ or not.

ok.Let's talk about NOHZ case.
I enabled NOHZ choice in menuconfig. I am sourcing source two Kconfigs (kernel/time/Kconfig and kernel/Kconfig.hz)
Here is the fragment from my .config file.

CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_PREEMPT_NONE=y
...
CONFIG_HZ_100=y
# CONFIG_HZ_250 is not set
# CONFIG_HZ_300 is not set
# CONFIG_HZ_1000 is not set
CONFIG_HZ=100

For NO_HZ val I shouldn't use HZ value because of NO_HZ and HZ values shouldn't be in .config file. Am I right?

If yes I have still problem in my code.

I have there these two parts.
Just counting value for periodic mode but depends on HZ value.

	cpuinfo.freq_div_hz = cpuinfo.cpu_clock_freq / HZ;

+ usage in periodic mode.

	case CLOCK_EVT_MODE_PERIODIC:
		printk(KERN_INFO "%s: periodic\n", __func__);
		microblaze_timer0_start_periodic(cpuinfo.freq_div_hz);
		break;

Here is the part of my kernel log. At the beginning is setup periodic mode and then is switched to oneshot mode. And for periodic mode I use HZ value which shouldn't be there.

microblaze_timer_set_mode: shutdown
microblaze_timer_set_mode: periodic
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes) Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 254848k/262144k available
ODEBUG: selftest passed
Calibrating delay loop... 60.82 BogoMIPS (lpj=304128) Mount-cache hash table entries: 512
net_namespace: 544 bytes
NET: Registered protocol family 16
bio: create slab <bio-0> at 0
NET: Registered protocol family 2
microblaze_timer_set_mode: oneshot ------------------------- switch to oneshot
Switched to high resolution mode on CPU 0

What is the correct solution for NO_HZ case?

BTW: I just tried to remove Kconfig.hz sourcing and I am getting faults in include/linux/jiffies.h and I expect the problems in other code too.

Thanks,
Michal

Quoted 5 lines

thanks
-john

Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
#73 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

Quoted 8 lines · Michal Simek

CONFIG_HZ_100=y
# CONFIG_HZ_250 is not set
# CONFIG_HZ_300 is not set
# CONFIG_HZ_1000 is not set
CONFIG_HZ=100

For NO_HZ val I shouldn't use HZ value because of NO_HZ and HZ values shouldn't be in .config file. Am I right?

No. NO_HZ does not remove the HZ value from the kernel. There is way too much code depending on it. What NO_HZ does is to supress the periodic tick when the system goes idle and the next timer expiry is farther away than 1 HZ. When the system is non idle then the periodic tick runs again. NO_HZ is merily for power saving.

In a normal kernel when the machine is idle then we wake up every HZ to find out that there is no work to do and we go idle again. But if you think about it then this is stupid, because the kernel knows when the next timer is due to expire. So if the next timer expiry is e.g. 100ms away, then we can sleep for full 100ms instead of sleeping 10 * 10ms (HZ=100) or 100 * 1ms (HZ=1000). This allows systems to go into deeper power saving states.

You should be able to observe the difference by monitoring /proc/interrupts. A nohz enabled kernel should have significantly less timer interrupts on an idle system.

Thanks,

tglx

author maintainer
#74 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

Quoted 24 lines · Thomas Gleixner
Quoted 8 lines · Michal Simek

CONFIG_HZ_100=y
# CONFIG_HZ_250 is not set
# CONFIG_HZ_300 is not set
# CONFIG_HZ_1000 is not set
CONFIG_HZ=100

For NO_HZ val I shouldn't use HZ value because of NO_HZ and HZ values shouldn't be in .config file. Am I right?

No. NO_HZ does not remove the HZ value from the kernel. There is way too much code depending on it. What NO_HZ does is to supress the periodic tick when the system goes idle and the next timer expiry is farther away than 1 HZ. When the system is non idle then the periodic tick runs again. NO_HZ is merily for power saving.

In a normal kernel when the machine is idle then we wake up every HZ to find out that there is no work to do and we go idle again. But if you think about it then this is stupid, because the kernel knows when the next timer is due to expire. So if the next timer expiry is e.g. 100ms away, then we can sleep for full 100ms instead of sleeping 10 * 10ms (HZ=100) or 100 * 1ms (HZ=1000). This allows systems to go into deeper power saving states.

Quoted 3 lines

You should be able to observe the difference by monitoring /proc/interrupts. A nohz enabled kernel should have significantly less timer interrupts on an idle system.

Yes, I see it. I think I sent my log in any previous email in this thread too + I see it on my heartbeat led too.

Thanks for explanation,
Michal

Quoted 4 lines

Thanks,

tglx

Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
#75 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

Quoted 4 lines · Michal Simek

Yes, I see it. I think I sent my log in any previous email in this thread too + I see it on my heartbeat led too.

Thanks for explanation,

Welcome. Thanks for working on the review issues. I looked through your timer and interrupt code and I'm quite happy with it.

Please add: Reviewed-by: Thomas Gleixner <[email protected]>

to both.

Thanks,

tglx

author maintainer
#76 lore raw

Re: [PATCH 08/57] microblaze_v7: Interrupt handling, timer support, selfmod code

Quoted 4 lines · Thomas Gleixner
Quoted 3 lines · Michal Simek

Yes, I see it. I think I sent my log in any previous email in this thread too + I see it on my heartbeat led too.

Quoted 8 lines
Quoted 1 line

Thanks for explanation,

Welcome. Thanks for working on the review issues. I looked through your timer and interrupt code and I'm quite happy with it.

Please add: Reviewed-by: Thomas Gleixner <[email protected]>

to both.

I want to fix rating and shift value nothing other. I'll add it.

Thanks for your help,
Michal

Quoted 4 lines

Thanks,

tglx

Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
#91 lore raw

Re: [PATCH 04/57] microblaze_v7: Open firmware files

In reply to [email protected]
Quoted 11 lines · On Wednesday 18 March 2009, [email protected] wrote:

From: Michal Simek <[email protected]>
=20
=20

---
=A0arch/microblaze/include/asm/of_device.h =A0 | =A0 45 ++ =A0arch/microblaze/include/asm/of_platform.h | =A0 64 ++ =A0arch/microblaze/include/asm/prom.h =A0 =A0 =A0 =A0| =A0313 ++++++++ =A0arch/microblaze/kernel/of_device.c =A0 =A0 =A0 =A0| =A0115 +++ =A0arch/microblaze/kernel/of_platform.c =A0 =A0 =A0| =A0201 +++++ =A0arch/microblaze/kernel/prom.c =A0 =A0 =A0 =A0 =A0 =A0 | 1147 +++++++++=

++++++++++++++++++++

Quoted 1 line

=A0arch/microblaze/kernel/prom_parse.c =A0 =A0 =A0 | 1025 +++++++++++++++=

+++++++++++

Quoted 8 lines

=A07 files changed, 2910 insertions(+), 0 deletions(-) =A0create mode 100644 arch/microblaze/include/asm/of_device.h =A0create mode 100644 arch/microblaze/include/asm/of_platform.h =A0create mode 100644 arch/microblaze/include/asm/prom.h =A0create mode 100644 arch/microblaze/kernel/of_device.c =A0create mode 100644 arch/microblaze/kernel/of_platform.c =A0create mode 100644 arch/microblaze/kernel/prom.c =A0create mode 100644 arch/microblaze/kernel/prom_parse.c

Since these files are derived from the powerpc versions, what is the plan on them? IIRC, you had them in a common directory in an earlier version. Are you planning to merge them at some point in the future or do you intend to maintain a fork?

	Arnd <><
#89 lore raw

Re: [PATCH 07/57] microblaze_v7: Signal support

In reply to [email protected]
Quoted 15 lines · On Wednesday 18 March 2009, [email protected] wrote:

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/signal.h |  165 +++++++++++ arch/microblaze/kernel/signal.c      |  536 ++++++++++++++++++++++++++++++++++

 2 files changed, 701 insertions(+), 0 deletions(-)

 create mode 100644 arch/microblaze/include/asm/signal.h create mode 100644 arch/microblaze/kernel/signal.c

From: Michal Simek <[email protected]>

Quoted 8 lines
---
 arch/microblaze/include/asm/ipc.h       |    1 +
 arch/microblaze/include/asm/ipcbuf.h    |   36 +++++
 arch/microblaze/kernel/sys_microblaze.c |  226 +++++++++++++++++++++++++++++++
 3 files changed, 263 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/ipc.h
 create mode 100644 arch/microblaze/include/asm/ipcbuf.h
 create mode 100644 arch/microblaze/kernel/sys_microblaze.c

I don't quite remember what the outcome of this discussion was the last time, but what is your plan for the deprecated syscalls like the legacy syscalls you add here?

Have you tried changing uClibc and/or glibc so you don't need them? Are you planning to remove them soon once they are not needed any more?

What about the syscalls that are not needed but you just get from common code (e.g. oldumount, time, old_readdir, ...)?

	Arnd <><
#61 lore raw

Re: [PATCH 44/57] microblaze_v7: termbits.h termios.h

In reply to [email protected]
Quoted 10 lines · On Wednesday 18 March 2009, [email protected] wrote:

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/termbits.h |  203 ++++++++++++++++++++++++++++++++ arch/microblaze/include/asm/termios.h  |   88 ++++++++++++++

 2 files changed, 291 insertions(+), 0 deletions(-)

 create mode 100644 arch/microblaze/include/asm/termbits.h create mode 100644 arch/microblaze/include/asm/termios.h

Did you take at the header files I have in git://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/#generic-headers?

I haven't gotten around to posting them for review, but I still think it would be great if we can at least make sure they are identical so we can remove your versions as soon as we have the asm-generic ones.

	Arnd <><
#92 lore raw

Re: [PATCH 04/57] microblaze_v7: Open firmware files

In reply to Arnd Bergmann
Quoted 22 lines · Arnd Bergmann
Quoted 12 lines · On Wednesday 18 March 2009, [email protected] wrote:

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/of_device.h   |   45 ++ arch/microblaze/include/asm/of_platform.h |   64 ++ arch/microblaze/include/asm/prom.h        |  313 ++++++++ arch/microblaze/kernel/of_device.c        |  115 +++ arch/microblaze/kernel/of_platform.c      |  201 +++++ arch/microblaze/kernel/prom.c             | 1147 +++++++++++++++++++++++++++++ arch/microblaze/kernel/prom_parse.c       | 1025 ++++++++++++++++++++++++++

Quoted 8 lines
 7 files changed, 2910 insertions(+), 0 deletions(-)

 create mode 100644 arch/microblaze/include/asm/of_device.h create mode 100644 arch/microblaze/include/asm/of_platform.h create mode 100644 arch/microblaze/include/asm/prom.h create mode 100644 arch/microblaze/kernel/of_device.c create mode 100644 arch/microblaze/kernel/of_platform.c create mode 100644 arch/microblaze/kernel/prom.c create mode 100644 arch/microblaze/kernel/prom_parse.c

Quoted 4 lines

Since these files are derived from the powerpc versions, what is the plan on them? IIRC, you had them in a common directory in an earlier version. Are you planning to merge them at some point in the future or do you intend to maintain a fork?

Actually, it's trivial to factor out all the common code out of arch/powerpc/ to drivers/of/.

It took me approx. 4 hours to factor out the code and make a proof-of-concept FDT support for a little-endian ARM platform. ;-) (The device tree was only describing a cpu and a nor flash, though. No support for interrupt- and gpio-controllers. And no support for U-Boot, I just built the dtb file into the kernel).

I never got around to clean it up and send though, but for sure, there is absolutely no reason to duplicate the code across the platforms.

Thanks,

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
author maintainer
#94 lore raw

Re: [PATCH 04/57] microblaze_v7: Open firmware files

In reply to Arnd Bergmann

Hi Arnd,

nice to hear you.

Quoted 23 lines · On Wednesday 18 March 2009, [email protected] wrote:
Quoted 11 lines

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/of_device.h   |   45 ++
 arch/microblaze/include/asm/of_platform.h |   64 ++
 arch/microblaze/include/asm/prom.h        |  313 ++++++++
 arch/microblaze/kernel/of_device.c        |  115 +++
 arch/microblaze/kernel/of_platform.c      |  201 +++++
 arch/microblaze/kernel/prom.c             | 1147

+++++++++++++++++++++++++++++

Quoted 1 line
 arch/microblaze/kernel/prom_parse.c       | 1025

++++++++++++++++++++++++++

Quoted 8 lines
 7 files changed, 2910 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/of_device.h
 create mode 100644 arch/microblaze/include/asm/of_platform.h
 create mode 100644 arch/microblaze/include/asm/prom.h
 create mode 100644 arch/microblaze/kernel/of_device.c
 create mode 100644 arch/microblaze/kernel/of_platform.c
 create mode 100644 arch/microblaze/kernel/prom.c
 create mode 100644 arch/microblaze/kernel/prom_parse.c
Quoted 4 lines

Since these files are derived from the powerpc versions, what is the plan on them? IIRC, you had them in a common directory in an earlier version. Are you planning to merge them at some point in the future or do you intend to maintain a fork?

yes, these files are defived from PPC version. Yes, I added them to generic location and in this version
are in arch folder. It is easier for me to have them in arch folder till Microblaze will be in linus tree.
And then create patch which will synchronize them.

I prefer to have this code in generic location as much as possible but first stage should be add microblaze code to tree and
then add it to generic location and remove it from all archs which use it.

Thanks,
Michal

Quoted 4 lines

       Arnd <><
author maintainer
#90 lore raw

Re: [PATCH 07/57] microblaze_v7: Signal support

In reply to Arnd Bergmann
Quoted 29 lines · Arnd Bergmann
Quoted 15 lines · On Wednesday 18 March 2009, [email protected] wrote:

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/signal.h |  165 +++++++++++
 arch/microblaze/kernel/signal.c      |  536 ++++++++++++++++++++++++++++++++++
 2 files changed, 701 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/signal.h
 create mode 100644 arch/microblaze/kernel/signal.c

From: Michal Simek <[email protected]>

Quoted 8 lines
---
 arch/microblaze/include/asm/ipc.h       |    1 +
 arch/microblaze/include/asm/ipcbuf.h    |   36 +++++
 arch/microblaze/kernel/sys_microblaze.c |  226 +++++++++++++++++++++++++++++++
 3 files changed, 263 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/ipc.h
 create mode 100644 arch/microblaze/include/asm/ipcbuf.h
 create mode 100644 arch/microblaze/kernel/sys_microblaze.c

I don't quite remember what the outcome of this discussion was the last time, but what is your plan for the deprecated syscalls like the legacy syscalls you add here?

Quoted 6 lines

Have you tried changing uClibc and/or glibc so you don't need them? Are you planning to remove them soon once they are not needed any more?

What about the syscalls that are not needed but you just get from common code (e.g. oldumount, time, old_readdir, ...)?

I think that my emails from yesterday don't go through.

Here are our updated results in this area.
We have noMMU and MMU microblaze version and we use almost the same syscall table for them. That's not correct in all cases but we have it.

Quoted 1 line

From noMMU and uClibc perspective. We are still using gcc 3.4.1 and we are

working on gcc 4.1.2 with latest uClibc.

Quoted 1 line

From uClibc perspective. is almost all clear. We have latest version and when

new gcc are ready I start to work on it and of course add new syscall to uClibc will take a time but I believe that is only work which is not so hard.

Quoted 1 line

From MMU and glibc perspective. We have and use gcc 4.1.2 with any ancient glibc

version.
Glibc version with Microblaze support is not based on any public version and we can't easily create patches and upgrade them to latest version. We are preparing work on it but this will be a long time project.

I am trying to add only noMMU kernel because MMU kernel is still new (only 2 month with FDT) and I do LTP test on it MMU kernel share a lot of code with noMMU version and reviewing is easier. MMU version will come in future for reviewing too.

That's the current state.
I don't like this situation but I have to work with it. On the base on information which are above I have only some choices.
1. Wait till both tools are ready for syscall cleanup and then try to add microblaze to kernel.org.
2. Update only uClibc but latest uClibc version needs newer gcc which I don't have now.
3. Keep old syscalls and sys_ipc for example which are tested and are used for a long time.

I hope you understand our situation. That's why I decided to have old syscalls. Both version(noMMU and MMU) work. And we are working on new libcs. They will need a time for testing too.
For me is better to have working stable version and in future remove old syscalls and clean code (for example sys_ipc).

Thanks,
Michal

Quoted 1 line
	Arnd <><
Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
author maintainer
#95 lore raw

Re: [PATCH 04/57] microblaze_v7: Open firmware files

In reply to Arnd Bergmann
Quoted 22 lines · Arnd Bergmann
Quoted 4 lines · On Wednesday 18 March 2009, [email protected] wrote:

From: Michal Simek <[email protected]>

Quoted 16 lines
---
 arch/microblaze/include/asm/of_device.h   |   45 ++
 arch/microblaze/include/asm/of_platform.h |   64 ++
 arch/microblaze/include/asm/prom.h        |  313 ++++++++
 arch/microblaze/kernel/of_device.c        |  115 +++
 arch/microblaze/kernel/of_platform.c      |  201 +++++
 arch/microblaze/kernel/prom.c             | 1147 +++++++++++++++++++++++++++++
 arch/microblaze/kernel/prom_parse.c       | 1025 ++++++++++++++++++++++++++
 7 files changed, 2910 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/of_device.h
 create mode 100644 arch/microblaze/include/asm/of_platform.h
 create mode 100644 arch/microblaze/include/asm/prom.h
 create mode 100644 arch/microblaze/kernel/of_device.c
 create mode 100644 arch/microblaze/kernel/of_platform.c
 create mode 100644 arch/microblaze/kernel/prom.c
 create mode 100644 arch/microblaze/kernel/prom_parse.c
Quoted 4 lines

Since these files are derived from the powerpc versions, what is the plan on them? IIRC, you had them in a common directory in an earlier version. Are you planning to merge them at some point in the future or do you intend to maintain a fork?

yes, these files are defived from PPC version. Yes, I added them to generic location and in this version are in arch folder. It is easier for me to have them in arch folder till Microblaze will be in linus tree.
And then create patch which will synchronize them.

I prefer to have this code in generic location as much as possible but first stage from my perspective should be add microblaze code to tree and then add it to generic location and remove it from all archs which use it.

Thanks,
Michal

Quoted 1 line
	Arnd <><
Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
author maintainer
#62 lore raw

Re: [PATCH 44/57] microblaze_v7: termbits.h termios.h

In reply to Arnd Bergmann
Quoted 12 lines · Arnd Bergmann
Quoted 10 lines · On Wednesday 18 March 2009, [email protected] wrote:

From: Michal Simek <[email protected]>

---
 arch/microblaze/include/asm/termbits.h |  203 ++++++++++++++++++++++++++++++++
 arch/microblaze/include/asm/termios.h  |   88 ++++++++++++++
 2 files changed, 291 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/include/asm/termbits.h
 create mode 100644 arch/microblaze/include/asm/termios.h
Quoted 6 lines

Did you take at the header files I have in git://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/#generic-headers?

I haven't gotten around to posting them for review, but I still think it would be great if we can at least make sure they are identical so we can remove your versions as soon as we have the asm-generic ones.

I tested it some min ago. I just take your termios.h and termbits.h from asm-generic folder. I miss there only #include <asm/uaccess.h> in termion.h.

Compilation is OK and kernel works with your files too. For me is easy to use your version. If they are there, I'll use them.

Thanks,
Michal

Quoted 1 line
	Arnd <><
Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
#63 lore raw

Re: [PATCH 44/57] microblaze_v7: termbits.h termios.h

Quoted 9 lines · Michal Simek
Quoted 3 lines

I haven't gotten around to posting them for review, but I still think it would be great if we can at least make sure they are identical so we can remove your versions as soon as we have the asm-generic ones.

I tested it some min ago. I just take your termios.h and termbits.h from asm-generic folder. I miss there only #include <asm/uaccess.h> in termion.h.

Compilation is OK and kernel works with your files too. For me is easy to use your version. If they are there, I'll use them.

Ok. I did not just mean these specific files, but all the headers in general. I assume that you have not had a chance to look into the other header files, which is ok. Remis is currently cleaning up bits of the generic header files in Linux based on my work, and I asked him to look into your tree to see how much can be shared.

Note that there is a problem of binary compatibility with certain headers. If e.g. the constants from termbits.h or some data structures slightly change, user space will still compile but no longer be compatible with other kernel versions, so this needs to be done very carefully.

	Arnd <><
#64 lore raw

Re: [PATCH 44/57] microblaze_v7: termbits.h termios.h

Hi Arnd,

Quoted 17 lines · Arnd Bergmann
Quoted 9 lines · Michal Simek
Quoted 3 lines

I haven't gotten around to posting them for review, but I still think it would be great if we can at least make sure they are identical so we can remove your versions as soon as we have the asm-generic ones.

I tested it some min ago. I just take your termios.h and termbits.h from asm-generic folder. I miss there only #include <asm/uaccess.h> in termion.h.

Compilation is OK and kernel works with your files too. For me is easy to use your version. If they are there, I'll use them.

Ok. I did not just mean these specific files, but all the headers in general. I assume that you have not had a chance to look into the other header files, which is ok. Remis is currently cleaning up bits of the generic header files in Linux based on my work, and I asked him to look into your tree to see how much can be shared.

Quoted 4 lines

Note that there is a problem of binary compatibility with certain headers. If e.g. the constants from termbits.h or some data structures slightly change, user space will still compile but no longer be compatible with other kernel versions, so this needs to be done very carefully.

We are viewing this kernel as a clean break from the past (2.6.20 maintained outside kernel.org).

There will be a new toolchain/glibc/uClibc built against these modern kernel headers, so I think the binary compatibility issue will have minimal impact on the existing userbase. They will just have to rebuild their apps. In the space where MicroBlaze finds itself, it's typical to rebuild an entire system image from source. Certainly I'm not aware of anyone moving RPMs around containing MicroBlaze binaries!

Regards,

John

Signature · 3 lines
John Williams,
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com  p: +61-7-30090663  f: +61-7-30090663
author maintainer
#65 lore raw

Re: [PATCH 44/57] microblaze_v7: termbits.h termios.h

In reply to Arnd Bergmann
Quoted 16 lines · Arnd Bergmann
Quoted 8 lines · Michal Simek
Quoted 3 lines

I haven't gotten around to posting them for review, but I still think it would be great if we can at least make sure they are identical so we can remove your versions as soon as we have the asm-generic ones.

I tested it some min ago. I just take your termios.h and termbits.h from asm-generic folder. I miss there only #include <asm/uaccess.h> in termion.h.

Compilation is OK and kernel works with your files too. For me is easy to use your version. If they are there, I'll use them.

Ok. I did not just mean these specific files, but all the headers in general. I assume that you have not had a chance to look into the other header files, which is ok. Remis is currently cleaning up bits of the generic header files in Linux based on my work, and I asked him to look into your tree to see how much can be shared.

Quoted 4 lines

Note that there is a problem of binary compatibility with certain headers. If e.g. the constants from termbits.h or some data structures slightly change, user space will still compile but no longer be compatible with other kernel versions, so this needs to be done very carefully.

As John wrote. It is completely new kernel and we do (will do) new toolchain against new headers. I am open to use all generic approaches which will be in kernel.

Thanks,
Michal

Quoted 2 lines
	Arnd <><
Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Acked-by
#111 lore raw
In reply to Michal Simek
Quoted 5 lines

-----Original Message-----
From: Michal Simek [mailto:[email protected]]
Sent: Tuesday, March 24, 2009 9:27 AM
To: [email protected]
Cc: [email protected]; [email protected]; John

Linn; Arnd Bergmann; Thomas

Quoted 12 lines

Gleixner; Randy Dunlap; Ingo Molnar; [email protected]
Subject: Re: Microblaze linux support

Hi all,

Quoted 8 lines

Hi all,

I think that is the right time to send you next pack with Microblaze support. It is seventh pack - some previous packs was review by community and I hope there are not any big faults.

We tested this kernel on some boards.
We have GIT server up and gitweb is available at

http://developer.petalogix.com/git/gitweb.cgi

Quoted 3 lines
Quoted 3 lines

All information about git clone you can find on gitweb. This pack is available in for-linus branch. Information about other

branches are on gitweb too.

Quoted 2 lines
Quoted 2 lines

More information about microblaze fdt kernel you can find at

www.monstr.eu/fdt/

Quoted 3 lines
Quoted 3 lines

If you want to test kernel with microblaze toolchain let me know.

I added only uart16550 and uartlite support - that's enought for

first merge.

Quoted 8 lines
Quoted 5 lines

Thanks for you comments and especially for your ACK, Michal

It is a week ago when I sent v7 pack to LKML for reviewing.

I have got ACK from John Williams who is the best person from

microblaze

Quoted 7 lines

linux community.
I got ACK from Randy Dunlap for Kconfig and Makefile patches. Thomas Gleixner reviewed IRQ and Timer code.
Ingo Molnar confirms me that all coding style violation (checking with checkpatch.pl) are false positive.

John L: Could you give me ACK from Xilinx?

Thanks for all your work to move this forward.

-- John

Quoted 10 lines

Thanks,
Michal

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe

linux-kernel" in

Quoted 10 lines
Quoted 4 lines

the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

--
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

author maintainer
#112 lore raw
Quoted 33 lines · John Linn
Quoted 9 lines

Hi all,

Quoted 8 lines

Hi all,

I think that is the right time to send you next pack with Microblaze support. It is seventh pack - some previous packs was review by community and I hope there are not any big faults.

We tested this kernel on some boards.
We have GIT server up and gitweb is available at

http://developer.petalogix.com/git/gitweb.cgi

Quoted 2 lines
Quoted 2 lines

All information about git clone you can find on gitweb. This pack is available in for-linus branch. Information about other

branches are on gitweb too.

Quoted 1 line
Quoted 1 line

More information about microblaze fdt kernel you can find at

www.monstr.eu/fdt/

Quoted 3 lines
Quoted 3 lines

If you want to test kernel with microblaze toolchain let me know.

I added only uart16550 and uartlite support - that's enought for

first merge.

Quoted 7 lines
Quoted 4 lines

Thanks for you comments and especially for your ACK, Michal

It is a week ago when I sent v7 pack to LKML for reviewing.

I have got ACK from John Williams who is the best person from

microblaze

Quoted 6 lines

linux community.
I got ACK from Randy Dunlap for Kconfig and Makefile patches. Thomas Gleixner reviewed IRQ and Timer code.
Ingo Molnar confirms me that all coding style violation (checking with checkpatch.pl) are false positive.

Quoted 5 lines
Quoted 1 line

John L: Could you give me ACK from Xilinx?

Thanks for all your work to move this forward.

Thanks too.

Michal

Quoted 6 lines

-- John

Quoted 3 lines

Thanks,
Michal

author maintainer
#110 lore raw
In reply to [email protected]

Hi all,

Quoted 12 lines

Hi all,

I think that is the right time to send you next pack with Microblaze support. It is seventh pack - some previous packs was review by community and I hope there are not any big faults.

We tested this kernel on some boards.
We have GIT server up and gitweb is available at http://developer.petalogix.com/git/gitweb.cgi

All information about git clone you can find on gitweb.
This pack is available in for-linus branch. Information about other branches are on gitweb too.

Quoted 9 lines

More information about microblaze fdt kernel you can find at www.monstr.eu/fdt/ If you want to test kernel with microblaze toolchain let me know.

I added only uart16550 and uartlite support - that's enought for first merge.

Thanks for you comments and especially for your ACK, Michal

It is a week ago when I sent v7 pack to LKML for reviewing.

I have got ACK from John Williams who is the best person from microblaze linux community.
I got ACK from Randy Dunlap for Kconfig and Makefile patches. Thomas Gleixner reviewed IRQ and Timer code.
Ingo Molnar confirms me that all coding style violation (checking with checkpatch.pl) are false positive.

John L: Could you give me ACK from Xilinx?

Thanks,
Michal

Quoted 8 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
#58 lore raw

Re: [PATCH 57/57] microblaze_v7: Uartlite for Microblaze

In reply to [email protected]

Hi all,

Here is the small part of code which enable uartlite and serial of code driver for Microblaze cpu.

Peter: I got ack from you in past. I believe that I still have it. Could I keep your ACK there?

Thanks,
Michal

Quoted 31 lines

From: Michal Simek <[email protected]>

---
 drivers/serial/Kconfig |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/serial/Kconfig +2 -2
index 7d7f576..131901b 100644
@@ -833,7 +833,7 @@ config SERIAL_IMX_CONSOLE
 
 config SERIAL_UARTLITE
 	tristate "Xilinx uartlite serial port support"
-	depends on PPC32
+	depends on PPC32 || MICROBLAZE
 	select SERIAL_CORE
 	help
 	  Say Y here if you want to use the Xilinx uartlite serial controller.
@@ -1319,7 +1319,7 @@ config SERIAL_NETX_CONSOLE
 
 config SERIAL_OF_PLATFORM
 	tristate "Serial port on Open Firmware platform bus"
-	depends on PPC_OF
+	depends on PPC_OF || MICROBLAZE
 	depends on SERIAL_8250 || SERIAL_OF_PLATFORM_NWPSERIAL
 	help
 	  If you have a PowerPC based system that has serial ports
Signature · 3 lines
Michal Simek, Ing. (M.Eng)
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663
#59 lore raw

Re: [PATCH 57/57] microblaze_v7: Uartlite for Microblaze

Quoted 7 lines · Michal Simek
Quoted 7 lines

 config SERIAL_OF_PLATFORM
      tristate "Serial port on Open Firmware platform bus"
-     depends on PPC_OF
+     depends on PPC_OF || MICROBLAZE
      depends on SERIAL_8250 || SERIAL_OF_PLATFORM_NWPSERIAL help
        If you have a PowerPC based system that has serial ports

Trivial tweak - update the help text to "PowerPC or MicroBlaze"

John
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#60 lore raw

Re: [PATCH 57/57] microblaze_v7: Uartlite for Microblaze

In reply to Michal Simek
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Michal" == Michal Simek <[email protected]> writes:

Michal> Hi all,
Michal> Here is the small part of code which enable uartlite and serial of code Michal> driver for Microblaze cpu.

Michal> Peter: I got ack from you in past. I believe that I still have it. Could Michal> I keep your ACK there?

Yes, Acked-by: Peter Korsgaard <[email protected]>

Signature · 1 line
Bye, Peter Korsgaard
#113 lore raw
In reply to Michal Simek
Quoted 48 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Michal Simek
Sent: Tuesday, March 24, 2009 8:27 AM
To: [email protected]
Cc: [email protected]; [email protected]; John Linn; Arnd Bergmann; Thomas Gleixner; Randy Dunlap; Ingo Molnar; [email protected]
Subject: [microblaze-uclinux] Re: Microblaze linux support

Hi all,

Quoted 8 lines

Hi all,

I think that is the right time to send you next pack with Microblaze support. It is seventh pack - some previous packs was review by community and I hope there are not any big faults.

We tested this kernel on some boards.
We have GIT server up and gitweb is available at

http://developer.petalogix.com/git/gitweb.cgi

Quoted 3 lines

All information about git clone you can find on gitweb. This pack is available in for-linus branch. Information

about other branches are on gitweb too.

Quoted 2 lines

More information about microblaze fdt kernel you can find

at www.monstr.eu/fdt/

Quoted 3 lines

If you want to test kernel with microblaze toolchain let me know.

I added only uart16550 and uartlite support - that's

enought for first merge.

Quoted 5 lines

Thanks for you comments and especially for your ACK, Michal

It is a week ago when I sent v7 pack to LKML for reviewing.

I have got ACK from John Williams who is the best person from microblaze
linux community.
I got ACK from Randy Dunlap for Kconfig and Makefile patches. Thomas Gleixner reviewed IRQ and Timer code.
Ingo Molnar confirms me that all coding style violation (checking with checkpatch.pl) are false positive.

Quoted 4 lines

John L: Could you give me ACK from Xilinx?

Thanks,
Michal

Steve

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

#96 lore raw

Re: [PATCH 01/57] microblaze_v7: Kconfig patches

In reply to [email protected]
Quoted 9 lines · On Wednesday 18 March 2009, [email protected] wrote:

From: Michal Simek <[email protected]>

---
 arch/microblaze/Kconfig                       |  136 +++++++++++++++++++++++++ arch/microblaze/Kconfig.debug                 |   26 +++++ arch/microblaze/platform/Kconfig.platform     |   85 +++++++++++++++ arch/microblaze/platform/generic/Kconfig.auto |   62 +++++++++++

Quoted 5 lines
 4 files changed, 309 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

As a general rule for future updates, you should make sure that the order of your patches is so that you don't get a broken version in the middle. In your current series, it's not important, because nothing works really until all your patches are in there.

	Arnd <><
author maintainer
#97 lore raw

Re: [PATCH 01/57] microblaze_v7: Kconfig patches

Quoted 16 lines · Arnd Bergmann
Quoted 4 lines · On Wednesday 18 March 2009, [email protected] wrote:

From: Michal Simek <[email protected]>

Quoted 10 lines
---
 arch/microblaze/Kconfig                       |  136 +++++++++++++++++++++++++
 arch/microblaze/Kconfig.debug                 |   26 +++++
 arch/microblaze/platform/Kconfig.platform     |   85 +++++++++++++++
 arch/microblaze/platform/generic/Kconfig.auto |   62 +++++++++++
 4 files changed, 309 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
Quoted 4 lines

As a general rule for future updates, you should make sure that the order of your patches is so that you don't get a broken version in the middle. In your current series, it's not important, because nothing works really until all your patches are in there.

Thanks for your advice.
I am trying to do in all project where I work.

Thanks,
Michal

Quoted 1 line
	Arnd <><
Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
#93 lore raw

Re: [PATCH 04/57] microblaze_v7: Open firmware files

In reply to Anton Vorontsov
Quoted 5 lines · Anton Vorontsov

It took me approx. 4 hours to factor out the code and make a proof-of-concept FDT support for a little-endian ARM platform. ;-) (The device tree was only describing a cpu and a nor flash, though. No support for interrupt- and gpio-controllers. And no support for U-Boot, I just built the dtb file into the kernel).

ARM could benefit tremendously I believe from a similar virtualized interrupt mapping & OF tree to powerpc for their gazillions of weirdly cascaded interrupt controller setups :-)

Ben.