linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Microblaze patches V2
@ 2008-05-04 11:40 monstr
  2008-05-04 11:40 ` [PATCH 01/56] microblaze_v2: Kconfig patches monstr
  2008-05-05  2:30 ` Microblaze patches V2 John Williams
  0 siblings, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely

Hi All,

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

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

Please send me all your suggestions.

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

All changes are available on git.monstr.eu.

Thanks for your review,
Michal Simek



^ permalink raw reply	[flat|nested] 170+ messages in thread

* [PATCH 01/56] microblaze_v2: Kconfig patches
  2008-05-04 11:40 Microblaze patches V2 monstr
@ 2008-05-04 11:40 ` monstr
  2008-05-04 11:40   ` [PATCH 02/56] microblaze_v2: Makefiles for Microblaze cpu monstr
                     ` (2 more replies)
  2008-05-05  2:30 ` Microblaze patches V2 John Williams
  1 sibling, 3 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


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

diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
new file mode 100644
index 0000000..49767d1
--- /dev/null
+++ b/arch/microblaze/Kconfig
@@ -0,0 +1,149 @@
+# For a description of the syntax of this configuration file,
+# see Documentation/kbuild/kconfig-language.txt.
+
+mainmenu "Linux/Microblaze Kernel Configuration"
+
+config MICROBLAZE
+	def_bool y
+	select HAVE_LMB
+
+config MMU
+	def_bool n
+
+config SWAP
+	def_bool n
+
+config RWSEM_GENERIC_SPINLOCK
+	def_bool y
+
+config RWSEM_XCHGADD_ALGORITHM
+	bool
+
+config ARCH_HAS_ILOG2_U32
+	def_bool n
+
+config ARCH_HAS_ILOG2_U64
+	def_bool n
+
+config GENERIC_FIND_NEXT_BIT
+	def_bool y
+
+config GENERIC_HWEIGHT
+	def_bool y
+
+config GENERIC_HARDIRQS
+	def_bool y
+
+config GENERIC_IRQ_PROBE
+	def_bool y
+
+config GENERIC_CALIBRATE_DELAY
+	def_bool y
+
+config PCI
+	def_bool n
+
+config NO_DMA
+	def_bool y
+
+config UID16
+	def_bool y
+
+config HZ
+	int
+	default 100
+
+config DEFCONFIG_LIST
+	string
+	default "arch/$ARCH/defconfig"
+
+source "init/Kconfig"
+
+source "arch/microblaze/platform/Kconfig.platform"
+
+menu "Processor type and features"
+
+config PREEMPT
+	bool "Preemptible Kernel"
+	help
+	  This option reduces the latency of the kernel when reacting to
+	  real-time or interactive events by allowing a low priority process to
+	  be preempted even if it is in kernel mode executing a system call.
+	  This allows applications to run more reliably even when the system is
+	  under load.
+
+	  Say Y here if you are building a kernel for a desktop, embedded
+	  or real-time system.  Say N if you are unsure.
+
+config PREEMPT_TIMES
+	bool "Collect preemption latency times"
+	depends on PREEMPT
+	help
+	  Allow collection for preemption latency times.
+
+config XILINX_UNCACHED_SHADOW
+	bool "Are you using uncached shadow for RAM ?"
+	depends on MICROBLAZE
+	default y
+	help
+	  This is needed to be able to allocate uncachable memory regions.
+	  The feature requires the design to define the RAM memory controller window
+	  to be twice as large as the actual physical memory.
+
+config LARGE_ALLOCS
+	bool "Allow allocating large blocks (> 1MB) of memory"
+	help
+	  Allow the slab memory allocator to keep chains for very large
+	  memory sizes - up to 32MB. You may need this if your system has
+	  a lot of RAM, and you need to able to allocate very large
+	  contiguous chunks. If unsure, say N.
+
+comment "Boot options"
+
+config CMDLINE
+	string "Default kernel command string"
+	default ""
+	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"
+	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
+
+endmenu
+
+config APM_EMULATION
+	bool
+
+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"
diff --git a/arch/microblaze/Kconfig.debug b/arch/microblaze/Kconfig.debug
new file mode 100644
index 0000000..d15f8b0
--- /dev/null
+++ b/arch/microblaze/Kconfig.debug
@@ -0,0 +1,35 @@
+# 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
+	def_bool y
+
+config EARLY_PRINTK_UARTLITE_ADDRESS
+	hex "Physical address where UART Lite for early printk is mapped"
+	depends on EARLY_PRINTK
+	default "0x40100000"
+	help
+	  Please enter physical address where your uart lite is mapped.
+
+config HEART_BEAT
+	bool "Heart beat function for kernel"
+	help
+	  This option turns on/off heart beat kernel functionality on selected
+	  GPIO address.
+
+config HEART_BEAT_ADDRESS
+	hex "Physical address for heart beat LED"
+	depends on HEART_BEAT
+	default "0x40600000"
+	help
+	  Please enter physical address GPIO LED.
+
+config DEBUG_BOOTMEM
+	depends on DEBUG_KERNEL
+	bool "Debug BOOTMEM initialization"
+
+endmenu
diff --git a/arch/microblaze/platform/Kconfig.platform b/arch/microblaze/platform/Kconfig.platform
new file mode 100644
index 0000000..64cbb80
--- /dev/null
+++ b/arch/microblaze/platform/Kconfig.platform
@@ -0,0 +1,63 @@
+# For a description of the syntax of this configuration file,
+# see Documentation/kbuild/kconfig-language.txt.
+#
+# Platform selection Kconfig menu for MicroBlaze targets
+#
+
+menu "Platform options"
+choice
+	prompt "Platform"
+	default PLATFORM_MICROBLAZE_AUTO
+	help
+	  Choose which hardware board/platform you are targeting.
+
+config PLATFORM_GENERIC
+	bool "Generic"
+	help
+	  Choose this option for the Generic platform.
+
+endchoice
+
+config HACK
+	bool "Increase performance"
+	default y
+
+config OPT_LIB_FUNCTION
+	bool "Optimalized lib function"
+	default y
+	help
+	  Allows turn on optimalized library function (memcpy and memmove).
+	  They are optimized by using unsigned alignment. This will work
+	  fine if both source and destination are aligned on the same
+	  boundary. However, if they are aligned on different boundaries
+	  shifts will be necessary. This might result in bad performance
+	  on MicroBlaze systems without a barrel shifter.
+
+# This is still a bit broken - disabling for now JW 20070504
+config ALLOW_EDIT_AUTO
+	bool "Permit Display/edit of Kconfig.auto platform settings"
+	default n
+	help
+	  Allows the editing of auto-generated platform settings from
+	  the Kconfig.auto file. Obviously this does not change the
+	  underlying hardware, so be very careful if you go editing
+	  these settings.
+
+	  Also, if you enable this, and edit various Kconfig.auto
+	  settings, YOUR CHANGES WILL BE LOST if you then disable it
+	  again. You have been warned!
+
+	  If unsure, say no.
+
+# Ok, the platform is chosen. Source the kconfig.auto to get all of the
+# system settings.
+# If user selected CONFIG_EDIT_AUTO, these will be rendered in gory detail
+# and be able to be edited
+comment "Automatic platform settings from Kconfig.auto"
+	depends on ALLOW_EDIT_AUTO
+
+if PLATFORM_GENERIC=y
+	source "arch/microblaze/platform/generic/Kconfig.auto"
+endif
+
+endmenu
diff --git a/arch/microblaze/platform/generic/Kconfig.auto b/arch/microblaze/platform/generic/Kconfig.auto
new file mode 100644
index 0000000..5dc8c15
--- /dev/null
+++ b/arch/microblaze/platform/generic/Kconfig.auto
@@ -0,0 +1,52 @@
+# For a description of the syntax of this configuration file,
+# see Documentation/kbuild/kconfig-language.txt.
+#
+# Platform Kconfig menu for Microblaze generic board
+#
+
+comment "Definitions for MICROBLAZE0"
+	depends on ALLOW_EDIT_AUTO
+
+config KERNEL_BASE_ADDR
+	hex "Physical address where Linux Kernel is"
+	default "0x20000000"
+	help
+	  BASE Address for kernel
+
+config XILINX_ERAM_SIZE
+	hex "Memory size of XILINX_RAM"
+	depends on XILINX_UNCACHED_SHADOW
+	default 0x02000000
+
+config XILINX_MICROBLAZE0_FAMILY
+	string "Targetted FPGA family" if ALLOW_EDIT_AUTO
+	default spartan3e
+
+config XILINX_MICROBLAZE0_HW_VER
+	string "Core version number" if ALLOW_EDIT_AUTO
+	default 5.00.c
+
+config XILINX_MICROBLAZE0_USE_MSR_INSTR
+	int "USE_MSR_INSTR" if ALLOW_EDIT_AUTO
+	default 1
+	range 0 1
+
+config XILINX_MICROBLAZE0_USE_BARREL
+	int "USE_BARREL" if ALLOW_EDIT_AUTO
+	default 1
+	range 0 1
+
+config XILINX_MICROBLAZE0_USE_DIV
+	int "USE_DIV" if ALLOW_EDIT_AUTO
+	default 1
+	range 0 1
+
+config XILINX_MICROBLAZE0_USE_HW_MUL
+	int "USE_HW_MUL" if ALLOW_EDIT_AUTO
+	default 1
+	range 0 2
+
+config XILINX_MICROBLAZE0_USE_FPU
+	int "USE_FPU" if ALLOW_EDIT_AUTO
+	default 0
+	range 0 1
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 02/56] microblaze_v2: Makefiles for Microblaze cpu
  2008-05-04 11:40 ` [PATCH 01/56] microblaze_v2: Kconfig patches monstr
@ 2008-05-04 11:40   ` monstr
  2008-05-04 11:40     ` [PATCH 03/56] microblaze_v2: Cpuinfo handling monstr
  2008-05-05  1:47     ` [PATCH 02/56] microblaze_v2: Makefiles for Microblaze cpu John Williams
  2008-05-04 21:24   ` [PATCH 01/56] microblaze_v2: Kconfig patches Grant Likely
  2008-05-05  1:42   ` John Williams
  2 siblings, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


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

diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
new file mode 100644
index 0000000..fb80b49
--- /dev/null
+++ b/arch/microblaze/Makefile
@@ -0,0 +1,63 @@
+UTS_SYSNAME = -DUTS_SYSNAME=\"uClinux\"
+
+# What CPU vesion are we building for, and crack it open
+# as major.minor.rev
+CPU_VER=$(subst ",,$(CONFIG_XILINX_MICROBLAZE0_HW_VER) )
+CPU_MAJOR=$(shell echo $(CPU_VER) | cut -d '.' -f 1)
+CPU_MINOR=$(shell echo $(CPU_VER) | cut -d '.' -f 2)
+CPU_REV=$(shell echo $(CPU_VER) | cut -d '.' -f 3)
+
+export CPU_VER CPU_MAJOR CPU_MINOR CPU_REV
+
+# Use cpu-related CONFIG_ vars to set compile options.
+
+# Work out HW multipler support.  This is icky.
+# 1. Spartan2 has no HW multiplers.
+# 2. MicroBlaze v3.x always uses them, except in Spartan 2
+# 3. All other FPGa/CPU ver combos, we can trust the CONFIG_ settings
+ifeq (,$(findstring spartan2,$(CONFIG_XILINX_MICROBLAZE0_FAMILY)))
+  ifeq ($(CPU_MAJOR),3)
+    CPUFLAGS-1 += -mno-xl-soft-mul
+  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
+
+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
diff --git a/arch/microblaze/boot/Makefile b/arch/microblaze/boot/Makefile
new file mode 100644
index 0000000..844edf4
--- /dev/null
+++ b/arch/microblaze/boot/Makefile
@@ -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
diff --git a/arch/microblaze/kernel/Makefile b/arch/microblaze/kernel/Makefile
new file mode 100644
index 0000000..716a0a5
--- /dev/null
+++ b/arch/microblaze/kernel/Makefile
@@ -0,0 +1,17 @@
+#
+# Makefile
+#
+
+extra-y := head.o vmlinux.lds
+
+obj-y += entry.o exceptions.o \
+	hw_exception_handler.o init_task.o intc.o irq.o \
+	process.o prom.o ptrace.o \
+	setup.o signal.o sys_microblaze.o time.o timer.o traps.o
+
+obj-y += cpu/
+
+obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
+obj-$(CONFIG_HACK)		+= hack.o
+obj-$(CONFIG_HEART_BEAT)	+= heartbeat.o
+obj-$(CONFIG_MODULES)		+= microblaze_ksyms.o module.o
diff --git a/arch/microblaze/kernel/cpu/Makefile b/arch/microblaze/kernel/cpu/Makefile
new file mode 100644
index 0000000..20646e5
--- /dev/null
+++ b/arch/microblaze/kernel/cpu/Makefile
@@ -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
diff --git a/arch/microblaze/lib/Makefile b/arch/microblaze/lib/Makefile
new file mode 100644
index 0000000..fa18e83
--- /dev/null
+++ b/arch/microblaze/lib/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile
+#
+
+lib-y := checksum.o memcpy.o memmove.o memset.o uaccess.o
diff --git a/arch/microblaze/mm/Makefile b/arch/microblaze/mm/Makefile
new file mode 100644
index 0000000..bf9e447
--- /dev/null
+++ b/arch/microblaze/mm/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile
+#
+
+obj-y := init.o
diff --git a/arch/microblaze/platform/Makefile b/arch/microblaze/platform/Makefile
new file mode 100644
index 0000000..8797e83
--- /dev/null
+++ b/arch/microblaze/platform/Makefile
@@ -0,0 +1,3 @@
+#
+# Makefile for arch/microblaze/platform directory
+#
diff --git a/arch/microblaze/platform/generic/Makefile b/arch/microblaze/platform/generic/Makefile
new file mode 100644
index 0000000..9a8b1bd
--- /dev/null
+++ b/arch/microblaze/platform/generic/Makefile
@@ -0,0 +1,3 @@
+#
+# Empty Makefile to keep make clean happy
+#
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 03/56] microblaze_v2: Cpuinfo handling
  2008-05-04 11:40   ` [PATCH 02/56] microblaze_v2: Makefiles for Microblaze cpu monstr
@ 2008-05-04 11:40     ` monstr
  2008-05-04 11:40       ` [PATCH 04/56] microblaze_v2: Open firmware files monstr
  2008-05-05  1:52       ` [PATCH 03/56] microblaze_v2: Cpuinfo handling John Williams
  2008-05-05  1:47     ` [PATCH 02/56] microblaze_v2: Makefiles for Microblaze cpu John Williams
  1 sibling, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


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

diff --git a/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c b/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
new file mode 100644
index 0000000..fa061a3
--- /dev/null
+++ b/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
@@ -0,0 +1,83 @@
+/*
+ * arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
+ *
+ * Support for MicroBlaze PVR (processor version register)
+ *
+ * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
+ * Copyright (C) 2007 PetaLogix
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ */
+
+#include <linux/init.h>
+#include <linux/string.h>
+#include <linux/autoconf.h>
+#include <asm/pvr.h>
+#include <asm/cpuinfo.h>
+
+/*
+ * Helper macro to map between fields in our struct cpuinfo, and
+ * the PVR macros in pvr.h.
+ */
+
+#define CI(c, p) ci->c = PVR_##p(pvr)
+
+void set_cpuinfo_pvr_full(struct cpuinfo *ci)
+{
+	struct pvr_s pvr;
+	get_pvr(&pvr);
+
+	CI(use_barrel, USE_BARREL);
+	CI(use_divider, USE_DIV);
+	CI(use_mult, USE_HW_MUL);
+	CI(use_fpu, USE_FPU);
+
+	CI(use_mul_64, USE_MUL64);
+	CI(use_msr_instr, USE_MSR_INSTR);
+	CI(use_pcmp_instr, USE_PCMP_INSTR);
+	CI(ver_code, VERSION);
+
+	CI(use_icache, USE_ICACHE);
+	CI(icache_tagbits, ICACHE_ADDR_TAG_BITS);
+	CI(icache_write, ICACHE_ALLOW_WR);
+	CI(icache_line, ICACHE_LINE_LEN);
+	CI(icache_size, ICACHE_BYTE_SIZE);
+	CI(icache_base, ICACHE_BASEADDR);
+	CI(icache_high, ICACHE_HIGHADDR);
+
+	CI(use_dcache, USE_DCACHE);
+	CI(dcache_tagbits, DCACHE_ADDR_TAG_BITS);
+	CI(dcache_write, DCACHE_ALLOW_WR);
+	CI(dcache_line, DCACHE_LINE_LEN);
+	CI(dcache_size, DCACHE_BYTE_SIZE);
+	CI(dcache_base, DCACHE_BASEADDR);
+	CI(dcache_high, DCACHE_HIGHADDR);
+
+	CI(use_dopb, D_OPB);
+	CI(use_iopb, I_OPB);
+	CI(use_dlmb, D_LMB);
+	CI(use_ilmb, I_LMB);
+	CI(num_fsl, FSL_LINKS);
+
+	CI(irq_edge, INTERRUPT_IS_EDGE);
+	CI(irq_positive, EDGE_IS_POSITIVE);
+
+	CI(area_optimised, AREA_OPTIMISED);
+	CI(opcode_0_illegal, OPCODE_0x0_ILLEGAL);
+	CI(exc_unaligned, UNALIGNED_EXCEPTION);
+	CI(exc_ill_opcode, ILL_OPCODE_EXCEPTION);
+	CI(exc_iopb, IOPB_BUS_EXCEPTION);
+	CI(exc_dopb, DOPB_BUS_EXCEPTION);
+	CI(exc_div_zero, DIV_ZERO_EXCEPTION);
+	CI(exc_fpu, FPU_EXCEPTION);
+
+	CI(hw_debug, DEBUG_ENABLED);
+	CI(num_pc_brk, NUMBER_OF_PC_BRK);
+	CI(num_rd_brk, NUMBER_OF_RD_ADDR_BRK);
+	CI(num_wr_brk, NUMBER_OF_WR_ADDR_BRK);
+
+	CI(fpga_family_code, TARGET_FAMILY);
+}
diff --git a/arch/microblaze/kernel/cpu/cpuinfo-static.c b/arch/microblaze/kernel/cpu/cpuinfo-static.c
new file mode 100644
index 0000000..054260a
--- /dev/null
+++ b/arch/microblaze/kernel/cpu/cpuinfo-static.c
@@ -0,0 +1,117 @@
+/*
+ * arch/microblaze/kernel/cpu/cpuinfo-static.c
+ *
+ * Copyright (C) 2007-2008 Michal Simek <monstr@monstr.eu>
+ * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
+ * Copyright (C) 2007 PetaLogix
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/string.h>
+#include <linux/autoconf.h>
+#include <asm/cpuinfo.h>
+
+const static char family_string[] = CONFIG_XILINX_MICROBLAZE0_FAMILY;
+const static char cpu_ver_string[] = CONFIG_XILINX_MICROBLAZE0_HW_VER;
+
+void __init set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu)
+{
+	int i;
+
+	ci->use_barrel = fcpu(cpu, "xlnx,use-barrel");
+	ci->use_divider = fcpu(cpu, "xlnx,use-div");
+	ci->use_mult = fcpu(cpu, "xlnx,use-hw-mul");
+	ci->use_fpu = fcpu(cpu, "xlnx,use-fpu");
+	ci->use_mul_64 = (ci->use_mult == 2 ? 1 : 0);
+	ci->use_msr_instr = fcpu(cpu, "xlnx,use-msr-instr");
+	ci->use_pcmp_instr = fcpu(cpu, "xlnx,use-pcmp-instr");
+
+	ci->use_exception = fcpu(cpu, "xlnx,unaligned-exceptions") ||
+			fcpu(cpu, "xlnx,ill-opcode-exception") ||
+			fcpu(cpu, "xlnx,iopb-bus-exception") ||
+			fcpu(cpu, "xlnx,dopb-bus-exception") ||
+			fcpu(cpu, "xlnx,div-zero-exception") ||
+			fcpu(cpu, "xlnx,fpu-exception");
+
+	ci->exc_unaligned = fcpu(cpu, "xlnx,unaligned-exceptions");
+	ci->exc_unaligned = fcpu(cpu, "xlnx,ill-opcode-exception");
+	ci->exc_iopb = fcpu(cpu, "xlnx,iopb-bus-exception");
+	ci->exc_dopb = fcpu(cpu, "xlnx,dopb-bus-exception");
+	ci->exc_fpu = fcpu(cpu, "xlnx,fpu-exception");
+	ci->exc_div_zero = fcpu(cpu, "xlnx,div-zero-exception");
+	ci->opcode_0_illegal = fcpu(cpu, "xlnx,opcode-0x0-illegal");
+
+	ci->use_icache = fcpu(cpu, "xlnx,use-icache");
+	ci->icache_tagbits = fcpu(cpu, "xlnx,addr-tag-bits");
+	ci->icache_write = fcpu(cpu, "xlnx,allow-icache-wr");
+	ci->icache_line = fcpu(cpu, "xlnx,icache-line-len") << 2;
+	if (!ci->icache_line) {
+		if (fcpu(cpu, "xlnx,icache-use-fsl"))
+			ci->icache_line = 4 << 2;
+		else
+			ci->icache_line = 1 << 2;
+	}
+	ci->icache_size = fcpu(cpu, "i-cache-size");
+	ci->icache_base = fcpu(cpu, "i-cache-baseaddr");
+	ci->icache_high = fcpu(cpu, "i-cache-highaddr");
+
+	ci->use_dcache = fcpu(cpu, "xlnx,use-dcache");
+	ci->dcache_tagbits = fcpu(cpu, "xlnx,dcache-addr-tag");
+	ci->dcache_write = fcpu(cpu, "xlnx,allow-dcache-wr");
+	ci->dcache_line = fcpu(cpu, "xlnx,dcache-line-len") << 2;
+	if (!ci->dcache_line) {
+		if (fcpu(cpu, "xlnx,dcache-use-fsl"))
+			ci->dcache_line = 4 << 2;
+		else
+			ci->dcache_line = 1 << 2;
+	}
+	ci->dcache_size = fcpu(cpu, "d-cache-size");
+	ci->dcache_base = fcpu(cpu, "d-cache-baseaddr");
+	ci->dcache_high = fcpu(cpu, "d-cache-highaddr");
+
+	ci->use_dopb = fcpu(cpu, "xlnx,d-opb");
+	ci->use_iopb = fcpu(cpu, "xlnx,i-opb");
+	ci->use_dlmb = fcpu(cpu, "xlnx,d-lmb");
+	ci->use_ilmb = fcpu(cpu, "xlnx,i-lmb");
+
+	ci->num_fsl = fcpu(cpu, "xlnx,fsl-links");
+	ci->irq_edge = fcpu(cpu, "xlnx,interrupt-is-edge");
+	ci->irq_positive = fcpu(cpu, "xlnx,edge-is-positive");
+	ci->area_optimised = 0;
+
+	ci->hw_debug = fcpu(cpu, "xlnx,debug-enabled");
+	ci->num_pc_brk = fcpu(cpu, "xlnx,number-of-pc-brk");
+	ci->num_rd_brk = fcpu(cpu, "xlnx,number-of-rd-addr-brk");
+	ci->num_wr_brk = fcpu(cpu, "xlnx,number-of-wr-addr-brk");
+
+	ci->cpu_clock_freq = fcpu(cpu, "timebase-frequency");
+
+	ci->ver_code = 0;
+	ci->fpga_family_code = 0;
+
+	/* Do various fixups based on CPU version and FPGA family strings */
+
+	/* Resolved the CPU version code */
+	for (i = 0; cpu_ver_lookup[i].s != NULL; i++) {
+		if (strcmp(cpu_ver_lookup[i].s, cpu_ver_string) == 0)
+			ci->ver_code = cpu_ver_lookup[i].k;
+	}
+
+	/* Resolved the fpga family code */
+	for (i = 0; family_string_lookup[i].s != NULL; i++) {
+		if (strcmp(family_string_lookup[i].s, family_string) == 0)
+			ci->fpga_family_code = family_string_lookup[i].k;
+	}
+
+	/* FIXME - mb3 and spartan2 do not exist in PVR */
+	/* This is mb3 and on a non Spartan2 */
+	if (ci->ver_code == 0x20 && ci->fpga_family_code != 0xf0)
+		/* Hardware Multiplier in use */
+		ci->use_mult = 1;
+}
diff --git a/arch/microblaze/kernel/cpu/cpuinfo.c b/arch/microblaze/kernel/cpu/cpuinfo.c
new file mode 100644
index 0000000..2b2bc68
--- /dev/null
+++ b/arch/microblaze/kernel/cpu/cpuinfo.c
@@ -0,0 +1,91 @@
+/*
+ * arch/microblaze/kernel/cpu/cpuinfo.c
+ *
+ * Copyright (C) 2007-2008 Michal Simek <monstr@monstr.eu>
+ * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
+ * Copyright (C) 2007 PetaLogix
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ */
+
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/autoconf.h>
+#include <asm/cpuinfo.h>
+#include <asm/pvr.h>
+
+const struct cpu_ver_key cpu_ver_lookup[] = {
+	/* These key value are as per MBV field in PVR0 */
+	{"5.00.a", 0x01},
+	{"5.00.b", 0x02},
+	{"5.00.c", 0x03},
+	{"6.00.a", 0x04},
+	{"6.00.b", 0x06},
+	{"7.00.a", 0x05},
+	{"7.00.b", 0x07},
+	{"7.10.a", 0x08},
+	/* FIXME There is no keycode defined in MBV for these versions */
+	{"2.10.a", 0x10},
+	{"3.00.a", 0x20},
+	{"4.00.a", 0x30},
+	{"4.00.b", 0x40},
+	{NULL, 0},
+};
+
+/*
+ * FIXME Not sure if the actual key is defined by Xilinx in the PVR
+ */
+const struct family_string_key family_string_lookup[] = {
+	{"virtex2", 0x4},
+	{"virtex2pro", 0x5},
+	{"spartan3", 0x6},
+	{"virtex4", 0x7},
+	{"virtex5", 0x8},
+	{"spartan3e", 0x9},
+	{"spartan3a", 0xa},
+	{"spartan3an", 0xb},
+	{"spartan3adsp", 0xc},
+	/* FIXME There is no key code defined for spartan2 */
+	{"spartan2", 0xf0},
+	{NULL, 0},
+};
+
+struct cpuinfo cpuinfo;
+
+void __init setup_cpuinfo(void)
+{
+	struct device_node *cpu = NULL;
+
+	cpu = (struct device_node *) of_find_node_by_type(NULL, "cpu");
+	if (!cpu)
+		printk(KERN_ERR "You don't have cpu!!!\n");
+
+	printk(KERN_INFO "%s: initialising\n", __func__);
+
+	switch (cpu_has_pvr()) {
+	case 0:
+		printk(KERN_WARNING
+			"%s: No PVR support. Using static CPU info from FDT\n",
+			__func__);
+			set_cpuinfo_static(&cpuinfo, cpu);
+		break;
+#if 0
+	case 1:
+		set_cpuinfo_pvr_partial(cpuinfo);
+		break;
+/* FIXME I found weird behavior with MB 7 */
+#endif
+	case 2:
+		printk(KERN_INFO "%s: Using full CPU PVR support\n",
+			__func__);
+		set_cpuinfo_pvr_full(&cpuinfo);
+		cpuinfo.cpu_clock_freq = fcpu(cpu, "timebase-frequency");
+		break;
+	default:
+		WARN_ON(1);
+		set_cpuinfo_static(&cpuinfo, cpu);
+	}
+}
diff --git a/include/asm-microblaze/cpuinfo.h b/include/asm-microblaze/cpuinfo.h
new file mode 100644
index 0000000..885a945
--- /dev/null
+++ b/include/asm-microblaze/cpuinfo.h
@@ -0,0 +1,116 @@
+/*
+ * include/asm-microblaze/cpuinfo.h
+ *
+ * Generic support for queying CPU info
+ *
+ * Copyright (C) 2007-2008 Michal Simek <monstr@monstr.eu>
+ * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
+ * Copyright (C) 2007 PetaLogix
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ */
+
+#ifndef _ASM_MICROBLAZE_CPUINFO_H
+#define _ASM_MICROBLAZE_CPUINFO_H
+
+#include <asm/prom.h>
+
+extern unsigned long loops_per_jiffy;
+
+/* 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_barrel;
+	int use_divider;
+	int use_mult;
+	int use_fpu;
+	int use_exception;
+	int use_mul_64;
+	int use_msr_instr;
+	int use_pcmp_instr;
+
+	int ver_code;
+
+	/* 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 support for CPU exceptions */
+	int opcode_0_illegal;
+	int exc_unaligned;
+	int exc_ill_opcode;
+	int exc_iopb;
+	int exc_dopb;
+	int exc_div_zero;
+	int exc_fpu;
+
+	/* HW debug support */
+	int hw_debug;
+	int num_pc_brk;
+	int num_rd_brk;
+	int num_wr_brk;
+	int cpu_clock_freq;
+
+	/* FPGA family */
+	int fpga_family_code;
+};
+
+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_partial(struct cpuinfo *ci);
+void set_cpuinfo_pvr_full(struct cpuinfo *ci);
+
+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 */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 04/56] microblaze_v2: Open firmware files
  2008-05-04 11:40     ` [PATCH 03/56] microblaze_v2: Cpuinfo handling monstr
@ 2008-05-04 11:40       ` monstr
  2008-05-04 11:40         ` [PATCH 05/56] microblaze_v2: Support for semaphores monstr
                           ` (3 more replies)
  2008-05-05  1:52       ` [PATCH 03/56] microblaze_v2: Cpuinfo handling John Williams
  1 sibling, 4 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


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

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
new file mode 100644
index 0000000..7c9793a
--- /dev/null
+++ b/arch/microblaze/kernel/prom.c
@@ -0,0 +1,1653 @@
+/*
+ * Procedures for creating, accessing and interpreting the device tree.
+ *
+ * Paul Mackerras	August 1996.
+ * Copyright (C) 1996-2005 Paul Mackerras.
+ *
+ *  Adapted for 64bit PowerPC by Dave Engebretsen and Peter Bergner.
+ *    {engebret|bergner}@us.ibm.com
+ *
+ *      This program is free software; you can redistribute it and/or
+ *      modify it under the terms of the GNU General Public License
+ *      as published by the Free Software Foundation; either version
+ *      2 of the License, or (at your option) any later version.
+ */
+
+#undef DEBUG
+
+#include <stdarg.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/init.h>
+#include <linux/threads.h>
+#include <linux/spinlock.h>
+#include <linux/types.h>
+#include <linux/pci.h>
+#include <linux/stringify.h>
+#include <linux/delay.h>
+#include <linux/initrd.h>
+#include <linux/bitops.h>
+#include <linux/module.h>
+#include <linux/kexec.h>
+#include <linux/debugfs.h>
+#include <linux/irq.h>
+#include <linux/lmb.h>
+
+#include <asm/prom.h>
+#include <asm/page.h>
+#include <asm/processor.h>
+#include <asm/irq.h>
+#include <asm/io.h>
+#include <asm/system.h>
+#include <asm/mmu.h>
+#include <asm/pgtable.h>
+#include <asm/pci.h>
+#include <asm/sections.h>
+#include <asm/pci-bridge.h>
+
+#ifdef CONFIG_PPC_PSERIES
+#include <asm/rtas.h>
+#include <asm/kdump.h>
+#include <asm/smp.h>
+#include <asm/iommu.h>
+#include <asm/btext.h>
+#include <asm/machdep.h>
+#include <asm/pSeries_reconfig.h>
+#include <asm/phyp_dump.h>
+#include <asm/kexec.h>
+#endif
+
+static int __initdata dt_root_addr_cells;
+static int __initdata dt_root_size_cells;
+
+#ifdef CONFIG_PPC64
+int __initdata iommu_is_off;
+int __initdata iommu_force_on;
+unsigned long tce_alloc_start, tce_alloc_end;
+#endif
+
+typedef u32 cell_t;
+
+#if 0
+static struct boot_param_header *initial_boot_params __initdata;
+#else
+struct boot_param_header *initial_boot_params;
+#endif
+
+extern struct device_node *allnodes;	/* temporary while merging */
+
+extern rwlock_t devtree_lock;	/* temporary while merging */
+
+/* export that to outside world */
+struct device_node *of_chosen;
+
+static inline char *find_flat_dt_string(u32 offset)
+{
+	return ((char *)initial_boot_params) +
+		initial_boot_params->off_dt_strings + offset;
+}
+
+/**
+ * This function is used to scan the flattened device-tree, it is
+ * used to extract the memory informations at boot before we can
+ * unflatten the tree
+ */
+int __init of_scan_flat_dt(int (*it)(unsigned long node,
+				     const char *uname, int depth,
+				     void *data),
+			   void *data)
+{
+	unsigned long p = ((unsigned long)initial_boot_params) +
+		initial_boot_params->off_dt_struct;
+	int rc = 0;
+	int depth = -1;
+
+	do {
+		u32 tag = *((u32 *)p);
+		char *pathp;
+
+		p += 4;
+		if (tag == OF_DT_END_NODE) {
+			depth--;
+			continue;
+		}
+		if (tag == OF_DT_NOP)
+			continue;
+		if (tag == OF_DT_END)
+			break;
+		if (tag == OF_DT_PROP) {
+			u32 sz = *((u32 *)p);
+			p += 8;
+			if (initial_boot_params->version < 0x10)
+				p = _ALIGN(p, sz >= 8 ? 8 : 4);
+			p += sz;
+			p = _ALIGN(p, 4);
+			continue;
+		}
+		if (tag != OF_DT_BEGIN_NODE) {
+			printk(KERN_WARNING "Invalid tag %x scanning flattened"
+				" device tree !\n", tag);
+			return -EINVAL;
+		}
+		depth++;
+		pathp = (char *)p;
+		p = _ALIGN(p + strlen(pathp) + 1, 4);
+		if ((*pathp) == '/') {
+			char *lp, *np;
+			for (lp = NULL, np = pathp; *np; np++)
+				if ((*np) == '/')
+					lp = np+1;
+			if (lp != NULL)
+				pathp = lp;
+		}
+		rc = it(p, pathp, depth, data);
+		if (rc != 0)
+			break;
+	} while (1);
+
+	return rc;
+}
+
+unsigned long __init of_get_flat_dt_root(void)
+{
+	unsigned long p = ((unsigned long)initial_boot_params) +
+		initial_boot_params->off_dt_struct;
+
+	while (*((u32 *)p) == OF_DT_NOP)
+		p += 4;
+	BUG_ON(*((u32 *)p) != OF_DT_BEGIN_NODE);
+	p += 4;
+	return _ALIGN(p + strlen((char *)p) + 1, 4);
+}
+
+/**
+ * This function can be used within scan_flattened_dt callback to get
+ * access to properties
+ */
+void* __init of_get_flat_dt_prop(unsigned long node, const char *name,
+				unsigned long *size)
+{
+	unsigned long p = node;
+
+	do {
+		u32 tag = *((u32 *)p);
+		u32 sz, noff;
+		const char *nstr;
+
+		p += 4;
+		if (tag == OF_DT_NOP)
+			continue;
+		if (tag != OF_DT_PROP)
+			return NULL;
+
+		sz = *((u32 *)p);
+		noff = *((u32 *)(p + 4));
+		p += 8;
+		if (initial_boot_params->version < 0x10)
+			p = _ALIGN(p, sz >= 8 ? 8 : 4);
+
+		nstr = find_flat_dt_string(noff);
+		if (nstr == NULL) {
+			printk(KERN_WARNING "Can't find property index"
+				" name !\n");
+			return NULL;
+		}
+		if (strcmp(name, nstr) == 0) {
+			if (size)
+				*size = sz;
+			return (void *)p;
+		}
+		p += sz;
+		p = _ALIGN(p, 4);
+	} while (1);
+}
+
+int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
+{
+	const char *cp;
+	unsigned long cplen, l;
+
+	cp = of_get_flat_dt_prop(node, "compatible", &cplen);
+	if (cp == NULL)
+		return 0;
+	while (cplen > 0) {
+		if (strncasecmp(cp, compat, strlen(compat)) == 0)
+			return 1;
+		l = strlen(cp) + 1;
+		cp += l;
+		cplen -= l;
+	}
+
+	return 0;
+}
+
+static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
+					unsigned long align)
+{
+	void *res;
+
+	*mem = _ALIGN(*mem, align);
+	res = (void *)*mem;
+	*mem += size;
+
+	return res;
+}
+
+static unsigned long __init unflatten_dt_node(unsigned long mem,
+					unsigned long *p,
+					struct device_node *dad,
+					struct device_node ***allnextpp,
+					unsigned long fpsize)
+{
+	struct device_node *np;
+	struct property *pp, **prev_pp = NULL;
+	char *pathp;
+	u32 tag;
+	unsigned int l, allocl;
+	int has_name = 0;
+	int new_format = 0;
+
+	tag = *((u32 *)(*p));
+	if (tag != OF_DT_BEGIN_NODE) {
+		printk("Weird tag at start of node: %x\n", tag);
+		return mem;
+	}
+	*p += 4;
+	pathp = (char *)*p;
+	l = allocl = strlen(pathp) + 1;
+	*p = _ALIGN(*p + l, 4);
+
+	/* version 0x10 has a more compact unit name here instead of the full
+	 * path. we accumulate the full path size using "fpsize", we'll rebuild
+	 * it later. We detect this because the first character of the name is
+	 * not '/'.
+	 */
+	if ((*pathp) != '/') {
+		new_format = 1;
+		if (fpsize == 0) {
+			/* root node: special case. fpsize accounts for path
+			 * plus terminating zero. root node only has '/', so
+			 * fpsize should be 2, but we want to avoid the first
+			 * level nodes to have two '/' so we use fpsize 1 here
+			 */
+			fpsize = 1;
+			allocl = 2;
+		} else {
+			/* account for '/' and path size minus terminal 0
+			 * already in 'l'
+			 */
+			fpsize += l;
+			allocl = fpsize;
+		}
+	}
+
+	np = unflatten_dt_alloc(&mem, sizeof(struct device_node) + allocl,
+				__alignof__(struct device_node));
+	if (allnextpp) {
+		memset(np, 0, sizeof(*np));
+		np->full_name = ((char *)np) + sizeof(struct device_node);
+		if (new_format) {
+			char *p = np->full_name;
+			/* rebuild full path for new format */
+			if (dad && dad->parent) {
+				strcpy(p, dad->full_name);
+#ifdef DEBUG
+				if ((strlen(p) + l + 1) != allocl) {
+					pr_debug("%s: p: %d, l: %d, a: %d\n",
+						pathp, (int)strlen(p),
+						l, allocl);
+				}
+#endif
+				p += strlen(p);
+			}
+			*(p++) = '/';
+			memcpy(p, pathp, l);
+		} else
+			memcpy(np->full_name, pathp, l);
+		prev_pp = &np->properties;
+		**allnextpp = np;
+		*allnextpp = &np->allnext;
+		if (dad != NULL) {
+			np->parent = dad;
+			/* we temporarily use the next field as `last_child'*/
+			if (dad->next == 0)
+				dad->child = np;
+			else
+				dad->next->sibling = np;
+			dad->next = np;
+		}
+		kref_init(&np->kref);
+	}
+	while (1) {
+		u32 sz, noff;
+		char *pname;
+
+		tag = *((u32 *)(*p));
+		if (tag == OF_DT_NOP) {
+			*p += 4;
+			continue;
+		}
+		if (tag != OF_DT_PROP)
+			break;
+		*p += 4;
+		sz = *((u32 *)(*p));
+		noff = *((u32 *)((*p) + 4));
+		*p += 8;
+		if (initial_boot_params->version < 0x10)
+			*p = _ALIGN(*p, sz >= 8 ? 8 : 4);
+
+		pname = find_flat_dt_string(noff);
+		if (pname == NULL) {
+			printk(KERN_INFO
+				"Can't find property name in list !\n");
+			break;
+		}
+		if (strcmp(pname, "name") == 0)
+			has_name = 1;
+		l = strlen(pname) + 1;
+		pp = unflatten_dt_alloc(&mem, sizeof(struct property),
+					__alignof__(struct property));
+		if (allnextpp) {
+			if (strcmp(pname, "linux,phandle") == 0) {
+				np->node = *((u32 *)*p);
+				if (np->linux_phandle == 0)
+					np->linux_phandle = np->node;
+			}
+			if (strcmp(pname, "ibm,phandle") == 0)
+				np->linux_phandle = *((u32 *)*p);
+			pp->name = pname;
+			pp->length = sz;
+			pp->value = (void *)*p;
+			*prev_pp = pp;
+			prev_pp = &pp->next;
+		}
+		*p = _ALIGN((*p) + sz, 4);
+	}
+	/* with version 0x10 we may not have the name property, recreate
+	 * it here from the unit name if absent
+	 */
+	if (!has_name) {
+		char *p = pathp, *ps = pathp, *pa = NULL;
+		int sz;
+
+		while (*p) {
+			if ((*p) == '@')
+				pa = p;
+			if ((*p) == '/')
+				ps = p + 1;
+			p++;
+		}
+		if (pa < ps)
+			pa = p;
+		sz = (pa - ps) + 1;
+		pp = unflatten_dt_alloc(&mem, sizeof(struct property) + sz,
+					__alignof__(struct property));
+		if (allnextpp) {
+			pp->name = "name";
+			pp->length = sz;
+			pp->value = pp + 1;
+			*prev_pp = pp;
+			prev_pp = &pp->next;
+			memcpy(pp->value, ps, sz - 1);
+			((char *)pp->value)[sz - 1] = 0;
+			pr_debug("fixed up name for %s -> %s\n", pathp,
+				(char *)pp->value);
+		}
+	}
+	if (allnextpp) {
+		*prev_pp = NULL;
+		np->name = of_get_property(np, "name", NULL);
+		np->type = of_get_property(np, "device_type", NULL);
+
+		if (!np->name)
+			np->name = "<NULL>";
+		if (!np->type)
+			np->type = "<NULL>";
+	}
+	while (tag == OF_DT_BEGIN_NODE) {
+		mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);
+		tag = *((u32 *)(*p));
+	}
+	if (tag != OF_DT_END_NODE) {
+		printk(KERN_INFO "Weird tag at end of node: %x\n", tag);
+		return mem;
+	}
+	*p += 4;
+	return mem;
+}
+
+#ifdef CONFIG_PPC_PSERIES
+static int __init early_parse_mem(char *p)
+{
+	if (!p)
+		return 1;
+
+	memory_limit = PAGE_ALIGN(memparse(p, &p));
+	pr_debug("memory limit = 0x%lx\n", memory_limit);
+
+	return 0;
+}
+early_param("mem", early_parse_mem);
+
+/**
+ * move_device_tree - move tree to an unused area, if needed.
+ *
+ * The device tree may be allocated beyond our memory limit, or inside the
+ * crash kernel region for kdump. If so, move it out of the way.
+ */
+static void __init move_device_tree(void)
+{
+	unsigned long start, size;
+	void *p;
+
+	pr_debug("-> move_device_tree\n");
+
+	start = __pa(initial_boot_params);
+	size = initial_boot_params->totalsize;
+
+	if ((memory_limit && (start + size) > memory_limit) ||
+			overlaps_crashkernel(start, size)) {
+		p = __va(lmb_alloc_base(size, PAGE_SIZE, lmb.rmo_size));
+		memcpy(p, initial_boot_params, size);
+		initial_boot_params = (struct boot_param_header *)p;
+		pr_debug("Moved device tree to 0x%p\n", p);
+	}
+
+	pr_debug("<- move_device_tree\n");
+}
+#endif
+
+/**
+ * unflattens the device-tree passed by the firmware, creating the
+ * tree of struct device_node. It also fills the "name" and "type"
+ * pointers of the nodes so the normal device-tree walking functions
+ * can be used (this used to be done by finish_device_tree)
+ */
+void __init unflatten_device_tree(void)
+{
+	unsigned long start, mem, size;
+	struct device_node **allnextp = &allnodes;
+
+	pr_debug(" -> unflatten_device_tree()\n");
+
+	/* First pass, scan for size */
+	start = ((unsigned long)initial_boot_params) +
+		initial_boot_params->off_dt_struct;
+	size = unflatten_dt_node(0, &start, NULL, NULL, 0);
+	size = (size | 3) + 1;
+
+	pr_debug("  size is %lx, allocating...\n", size);
+
+	/* Allocate memory for the expanded device tree */
+	mem = lmb_alloc(size + 4, __alignof__(struct device_node));
+	mem = (unsigned long) __va(mem);
+
+	((u32 *)mem)[size / 4] = 0xdeadbeef;
+
+	pr_debug("  unflattening %lx...\n", mem);
+
+	/* Second pass, do actual unflattening */
+	start = ((unsigned long)initial_boot_params) +
+		initial_boot_params->off_dt_struct;
+	unflatten_dt_node(mem, &start, NULL, &allnextp, 0);
+	if (*((u32 *)start) != OF_DT_END)
+		printk(KERN_WARNING "Weird tag at end of tree: %08x\n",
+			*((u32 *)start));
+	if (((u32 *)mem)[size / 4] != 0xdeadbeef)
+		printk(KERN_WARNING "End of tree marker overwritten: %08x\n",
+			((u32 *)mem)[size / 4]);
+	*allnextp = NULL;
+
+	/* Get pointer to OF "/chosen" node for use everywhere */
+	of_chosen = of_find_node_by_path("/chosen");
+	if (of_chosen == NULL)
+		of_chosen = of_find_node_by_path("/chosen@0");
+
+	pr_debug(" <- unflatten_device_tree()\n");
+}
+
+#ifdef CONFIG_PPC_PSERIES
+/*
+ * ibm,pa-features is a per-cpu property that contains a string of
+ * attribute descriptors, each of which has a 2 byte header plus up
+ * to 254 bytes worth of processor attribute bits.  First header
+ * byte specifies the number of bytes following the header.
+ * Second header byte is an "attribute-specifier" type, of which
+ * zero is the only currently-defined value.
+ * Implementation:  Pass in the byte and bit offset for the feature
+ * that we are interested in.  The function will return -1 if the
+ * pa-features property is missing, or a 1/0 to indicate if the feature
+ * is supported/not supported.  Note that the bit numbers are
+ * big-endian to match the definition in PAPR.
+ */
+static struct ibm_pa_feature {
+	unsigned long	cpu_features;	/* CPU_FTR_xxx bit */
+	unsigned int	cpu_user_ftrs;	/* PPC_FEATURE_xxx bit */
+	unsigned char	pabyte;		/* byte number in ibm,pa-features */
+	unsigned char	pabit;		/* bit number (big-endian) */
+	unsigned char	invert;		/* if 1, pa bit set => clear feature */
+} ibm_pa_features[] __initdata = {
+	{0, PPC_FEATURE_HAS_MMU,	0, 0, 0},
+	{0, PPC_FEATURE_HAS_FPU,	0, 1, 0},
+	{CPU_FTR_SLB, 0,		0, 2, 0},
+	{CPU_FTR_CTRL, 0,		0, 3, 0},
+	{CPU_FTR_NOEXECUTE, 0,		0, 6, 0},
+	{CPU_FTR_NODSISRALIGN, 0,	1, 1, 1},
+	{CPU_FTR_CI_LARGE_PAGE, 0,	1, 2, 0},
+	{CPU_FTR_REAL_LE, PPC_FEATURE_TRUE_LE, 5, 0, 0},
+};
+
+static void __init scan_features(unsigned long node, unsigned char *ftrs,
+				 unsigned long tablelen,
+				 struct ibm_pa_feature *fp,
+				 unsigned long ft_size)
+{
+	unsigned long i, len, bit;
+
+	/* find descriptor with type == 0 */
+	for (;;) {
+		if (tablelen < 3)
+			return;
+		len = 2 + ftrs[0];
+		if (tablelen < len)
+			return;		/* descriptor 0 not found */
+		if (ftrs[1] == 0)
+			break;
+		tablelen -= len;
+		ftrs += len;
+	}
+
+	/* loop over bits we know about */
+	for (i = 0; i < ft_size; ++i, ++fp) {
+		if (fp->pabyte >= ftrs[0])
+			continue;
+		bit = (ftrs[2 + fp->pabyte] >> (7 - fp->pabit)) & 1;
+		if (bit ^ fp->invert) {
+			cur_cpu_spec->cpu_features |= fp->cpu_features;
+			cur_cpu_spec->cpu_user_features |= fp->cpu_user_ftrs;
+		} else {
+			cur_cpu_spec->cpu_features &= ~fp->cpu_features;
+			cur_cpu_spec->cpu_user_features &= ~fp->cpu_user_ftrs;
+		}
+	}
+}
+
+static void __init check_cpu_pa_features(unsigned long node)
+{
+	unsigned char *pa_ftrs;
+	unsigned long tablelen;
+
+	pa_ftrs = of_get_flat_dt_prop(node, "ibm,pa-features", &tablelen);
+	if (pa_ftrs == NULL)
+		return;
+
+	scan_features(node, pa_ftrs, tablelen,
+		      ibm_pa_features, ARRAY_SIZE(ibm_pa_features));
+}
+
+#ifdef CONFIG_PPC64
+static void __init check_cpu_slb_size(unsigned long node)
+{
+	u32 *slb_size_ptr;
+
+	slb_size_ptr = of_get_flat_dt_prop(node, "ibm,slb-size", NULL);
+	if (slb_size_ptr != NULL) {
+		mmu_slb_size = *slb_size_ptr;
+	}
+}
+#else
+#define check_cpu_slb_size(node) do { } while(0)
+#endif
+
+static struct feature_property {
+	const char *name;
+	u32 min_value;
+	unsigned long cpu_feature;
+	unsigned long cpu_user_ftr;
+} feature_properties[] __initdata = {
+#ifdef CONFIG_ALTIVEC
+	{"altivec", 0, CPU_FTR_ALTIVEC, PPC_FEATURE_HAS_ALTIVEC},
+	{"ibm,vmx", 1, CPU_FTR_ALTIVEC, PPC_FEATURE_HAS_ALTIVEC},
+#endif /* CONFIG_ALTIVEC */
+#ifdef CONFIG_PPC64
+	{"ibm,dfp", 1, 0, PPC_FEATURE_HAS_DFP},
+	{"ibm,purr", 1, CPU_FTR_PURR, 0},
+	{"ibm,spurr", 1, CPU_FTR_SPURR, 0},
+#endif /* CONFIG_PPC64 */
+};
+
+#if defined(CONFIG_44x) && defined(CONFIG_PPC_FPU)
+static inline void identical_pvr_fixup(unsigned long node)
+{
+	unsigned int pvr;
+	char *model = of_get_flat_dt_prop(node, "model", NULL);
+
+	/*
+	 * Since 440GR(x)/440EP(x) processors have the same pvr,
+	 * we check the node path and set bit 28 in the cur_cpu_spec
+	 * pvr for EP(x) processor version. This bit is always 0 in
+	 * the "real" pvr. Then we call identify_cpu again with
+	 * the new logical pvr to enable FPU support.
+	 */
+	if (model && strstr(model, "440EP")) {
+		pvr = cur_cpu_spec->pvr_value | 0x8;
+		identify_cpu(0, pvr);
+		DBG("Using logical pvr %x for %s\n", pvr, model);
+	}
+}
+#else
+#define identical_pvr_fixup(node) do { } while(0)
+#endif
+
+static void __init check_cpu_feature_properties(unsigned long node)
+{
+	unsigned long i;
+	struct feature_property *fp = feature_properties;
+	const u32 *prop;
+
+	for (i = 0; i < ARRAY_SIZE(feature_properties); ++i, ++fp) {
+		prop = of_get_flat_dt_prop(node, fp->name, NULL);
+		if (prop && *prop >= fp->min_value) {
+			cur_cpu_spec->cpu_features |= fp->cpu_feature;
+			cur_cpu_spec->cpu_user_features |= fp->cpu_user_ftr;
+		}
+	}
+}
+
+#endif /* CONFIG_PPC_PSERIES */
+
+static int __init early_init_dt_scan_cpus(unsigned long node,
+					  const char *uname, int depth,
+					  void *data)
+{
+	static int logical_cpuid;
+	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
+#ifdef CONFIG_PPC_PSERIES
+	const u32 *prop;
+#endif
+	const u32 *intserv;
+	int i, nthreads;
+	unsigned long len;
+	int found = 0;
+
+	/* We are scanning "cpu" nodes only */
+	if (type == NULL || strcmp(type, "cpu") != 0)
+		return 0;
+
+	/* Get physical cpuid */
+	intserv = of_get_flat_dt_prop(node, "ibm,ppc-interrupt-server#s", &len);
+	if (intserv) {
+		nthreads = len / sizeof(int);
+	} else {
+		intserv = of_get_flat_dt_prop(node, "reg", NULL);
+		nthreads = 1;
+	}
+
+	/*
+	 * Now see if any of these threads match our boot cpu.
+	 * NOTE: This must match the parsing done in smp_setup_cpu_maps.
+	 */
+	for (i = 0; i < nthreads; i++) {
+		/*
+		 * version 2 of the kexec param format adds the phys cpuid of
+		 * booted proc.
+		 */
+		if (initial_boot_params && initial_boot_params->version >= 2) {
+			if (intserv[i] ==
+					initial_boot_params->boot_cpuid_phys) {
+				found = 1;
+				break;
+			}
+		} else {
+			/*
+			 * Check if it's the boot-cpu, set it's hw index now,
+			 * unfortunately this format did not support booting
+			 * off secondary threads.
+			 */
+			if (of_get_flat_dt_prop(node,
+					"linux,boot-cpu", NULL) != NULL) {
+				found = 1;
+				break;
+			}
+		}
+
+#ifdef CONFIG_SMP
+		/* logical cpu id is always 0 on UP kernels */
+		logical_cpuid++;
+#endif
+	}
+
+	if (found) {
+		pr_debug("boot cpu: logical %d physical %d\n", logical_cpuid,
+			intserv[i]);
+		boot_cpuid = logical_cpuid;
+#ifdef CONFIG_PPC_PSERIES
+		set_hard_smp_processor_id(boot_cpuid, intserv[i]);
+
+		/*
+		 * PAPR defines "logical" PVR values for cpus that
+		 * meet various levels of the architecture:
+		 * 0x0f000001	Architecture version 2.04
+		 * 0x0f000002	Architecture version 2.05
+		 * If the cpu-version property in the cpu node contains
+		 * such a value, we call identify_cpu again with the
+		 * logical PVR value in order to use the cpu feature
+		 * bits appropriate for the architecture level.
+		 *
+		 * A POWER6 partition in "POWER6 architected" mode
+		 * uses the 0x0f000002 PVR value; in POWER5+ mode
+		 * it uses 0x0f000001.
+		 */
+		prop = of_get_flat_dt_prop(node, "cpu-version", NULL);
+		if (prop && (*prop & 0xff000000) == 0x0f000000)
+			identify_cpu(0, *prop);
+
+		identical_pvr_fixup(node);
+#endif
+	}
+
+#ifdef CONFIG_PPC_PSERIES
+	check_cpu_feature_properties(node);
+	check_cpu_pa_features(node);
+	check_cpu_slb_size(node);
+
+	if (nthreads > 1)
+		cur_cpu_spec->cpu_features |= CPU_FTR_SMT;
+	else
+		cur_cpu_spec->cpu_features &= ~CPU_FTR_SMT;
+#endif
+	return 0;
+}
+
+#ifdef CONFIG_BLK_DEV_INITRD
+static void __init early_init_dt_check_for_initrd(unsigned long node)
+{
+	unsigned long l;
+	u32 *prop;
+
+	pr_debug("Looking for initrd properties... ");
+
+	prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
+	if (prop) {
+		initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4));
+
+		prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
+		if (prop) {
+			initrd_end = (unsigned long)
+					__va(of_read_ulong(prop, l/4));
+			initrd_below_start_ok = 1;
+		} else {
+			initrd_start = 0;
+		}
+	}
+
+	pr_debug("initrd_start=0x%lx  initrd_end=0x%lx\n",
+					initrd_start, initrd_end);
+}
+#else
+static inline void early_init_dt_check_for_initrd(unsigned long node)
+{
+}
+#endif /* CONFIG_BLK_DEV_INITRD */
+
+static int __init early_init_dt_scan_chosen(unsigned long node,
+				const char *uname, int depth, void *data)
+{
+	unsigned long l;
+	char *p;
+
+	pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
+
+	if (depth != 1 ||
+		(strcmp(uname, "chosen") != 0 &&
+				strcmp(uname, "chosen@0") != 0))
+		return 0;
+
+#ifdef CONFIG_PPC64
+	/* check if iommu is forced on or off */
+	if (of_get_flat_dt_prop(node, "linux,iommu-off", NULL) != NULL)
+		iommu_is_off = 1;
+	if (of_get_flat_dt_prop(node, "linux,iommu-force-on", NULL) != NULL)
+		iommu_force_on = 1;
+#endif
+
+#ifdef CONFIG_PPC_PSERIES
+	/* mem=x on the command line is the preferred mechanism */
+	lprop = of_get_flat_dt_prop(node, "linux,memory-limit", NULL);
+	if (lprop)
+		memory_limit = *lprop;
+#endif
+
+#ifdef CONFIG_PPC64
+	lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-start", NULL);
+	if (lprop)
+		tce_alloc_start = *lprop;
+	lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-end", NULL);
+	if (lprop)
+		tce_alloc_end = *lprop;
+#endif
+
+#ifdef CONFIG_KEXEC
+	lprop = (u64 *)of_get_flat_dt_prop(node,
+				"linux,crashkernel-base", NULL);
+	if (lprop)
+		crashk_res.start = *lprop;
+
+	lprop = (u64 *)of_get_flat_dt_prop(node,
+				"linux,crashkernel-size", NULL);
+	if (lprop)
+		crashk_res.end = crashk_res.start + *lprop - 1;
+#endif
+
+	early_init_dt_check_for_initrd(node);
+
+	/* Retreive command line */
+	p = of_get_flat_dt_prop(node, "bootargs", &l);
+	if (p != NULL && l > 0)
+		strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
+
+#ifdef CONFIG_CMDLINE
+	if (p == NULL || l == 0 || (l == 1 && (*p) == 0))
+		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
+#endif /* CONFIG_CMDLINE */
+
+	pr_debug("Command line is: %s\n", cmd_line);
+
+	/* break now */
+	return 1;
+}
+
+static int __init early_init_dt_scan_root(unsigned long node,
+				const char *uname, int depth, void *data)
+{
+	u32 *prop;
+
+	if (depth != 0)
+		return 0;
+
+	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
+	dt_root_size_cells = (prop == NULL) ? 1 : *prop;
+	pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells);
+
+	prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
+	dt_root_addr_cells = (prop == NULL) ? 2 : *prop;
+	pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells);
+
+	/* break now */
+	return 1;
+}
+
+static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
+{
+	cell_t *p = *cellp;
+
+	*cellp = p + s;
+	return of_read_number(p, s);
+}
+
+#ifdef CONFIG_PPC_PSERIES
+/*
+ * Interpret the ibm,dynamic-memory property in the
+ * /ibm,dynamic-reconfiguration-memory node.
+ * This contains a list of memory blocks along with NUMA affinity
+ * information.
+ */
+static int __init early_init_dt_scan_drconf_memory(unsigned long node)
+{
+	cell_t *dm, *ls;
+	unsigned long l, n, flags;
+	u64 base, size, lmb_size;
+
+	ls = (cell_t *)of_get_flat_dt_prop(node, "ibm,lmb-size", &l);
+	if (ls == NULL || l < dt_root_size_cells * sizeof(cell_t))
+		return 0;
+	lmb_size = dt_mem_next_cell(dt_root_size_cells, &ls);
+
+	dm = (cell_t *)of_get_flat_dt_prop(node, "ibm,dynamic-memory", &l);
+	if (dm == NULL || l < sizeof(cell_t))
+		return 0;
+
+	n = *dm++;	/* number of entries */
+	if (l < (n * (dt_root_addr_cells + 4) + 1) * sizeof(cell_t))
+		return 0;
+
+	for (; n != 0; --n) {
+		base = dt_mem_next_cell(dt_root_addr_cells, &dm);
+		flags = dm[3];
+		/* skip DRC index, pad, assoc. list index, flags */
+		dm += 4;
+		/* skip this block if the reserved bit is set in flags (0x80)
+		   or if the block is not assigned to this partition (0x8) */
+		if ((flags & 0x80) || !(flags & 0x8))
+			continue;
+		size = lmb_size;
+		if (iommu_is_off) {
+			if (base >= 0x80000000ul)
+				continue;
+			if ((base + size) > 0x80000000ul)
+				size = 0x80000000ul - base;
+		}
+		lmb_add(base, size);
+	}
+	lmb_dump_all();
+	return 0;
+}
+#else
+#define early_init_dt_scan_drconf_memory(node)	0
+#endif /* CONFIG_PPC_PSERIES */
+
+static int __init early_init_dt_scan_memory(unsigned long node,
+				const char *uname, int depth, void *data)
+{
+	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
+	cell_t *reg, *endp;
+	unsigned long l;
+
+	/* Look for the ibm,dynamic-reconfiguration-memory node */
+	if (depth == 1 &&
+		strcmp(uname, "ibm,dynamic-reconfiguration-memory") == 0)
+		return early_init_dt_scan_drconf_memory(node);
+
+	/* We are scanning "memory" nodes only */
+	if (type == NULL) {
+		/*
+		 * The longtrail doesn't have a device_type on the
+		 * /memory node, so look for the node called /memory@0.
+		 */
+		if (depth != 1 || strcmp(uname, "memory@0") != 0)
+			return 0;
+	} else if (strcmp(type, "memory") != 0)
+		return 0;
+
+	reg = (cell_t *)of_get_flat_dt_prop(node, "linux,usable-memory", &l);
+	if (reg == NULL)
+		reg = (cell_t *)of_get_flat_dt_prop(node, "reg", &l);
+	if (reg == NULL)
+		return 0;
+
+	endp = reg + (l / sizeof(cell_t));
+
+	pr_debug("memory scan node %s, reg size %ld, data: %x %x %x %x,\n",
+		uname, l, reg[0], reg[1], reg[2], reg[3]);
+
+	while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
+		u64 base, size;
+
+		base = dt_mem_next_cell(dt_root_addr_cells, &reg);
+		size = dt_mem_next_cell(dt_root_size_cells, &reg);
+
+		if (size == 0)
+			continue;
+		pr_debug(" - %llx ,  %llx\n", (unsigned long long)base,
+			(unsigned long long)size);
+
+#ifdef CONFIG_PPC64
+		if (iommu_is_off) {
+			if (base >= 0x80000000ul)
+				continue;
+			if ((base + size) > 0x80000000ul)
+				size = 0x80000000ul - base;
+		}
+#endif
+		lmb_add(base, size);
+	}
+	return 0;
+}
+
+#ifdef CONFIG_PPC_PSERIES
+static void __init early_reserve_mem(void)
+{
+	u64 base, size;
+	u64 *reserve_map;
+	unsigned long self_base;
+	unsigned long self_size;
+
+	reserve_map = (u64 *)(((unsigned long)initial_boot_params) +
+					initial_boot_params->off_mem_rsvmap);
+
+	/* before we do anything, lets reserve the dt blob */
+	self_base = __pa((unsigned long)initial_boot_params);
+	self_size = initial_boot_params->totalsize;
+	lmb_reserve(self_base, self_size);
+
+#ifdef CONFIG_BLK_DEV_INITRD
+	/* then reserve the initrd, if any */
+	if (initrd_start && (initrd_end > initrd_start))
+		lmb_reserve(__pa(initrd_start), initrd_end - initrd_start);
+#endif /* CONFIG_BLK_DEV_INITRD */
+
+#ifdef CONFIG_PPC32
+	/*
+	 * Handle the case where we might be booting from an old kexec
+	 * image that setup the mem_rsvmap as pairs of 32-bit values
+	 */
+	if (*reserve_map > 0xffffffffull) {
+		u32 base_32, size_32;
+		u32 *reserve_map_32 = (u32 *)reserve_map;
+
+		while (1) {
+			base_32 = *(reserve_map_32++);
+			size_32 = *(reserve_map_32++);
+			if (size_32 == 0)
+				break;
+			/* skip if the reservation is for the blob */
+			if (base_32 == self_base && size_32 == self_size)
+				continue;
+			pr_debug("reserving: %x -> %x\n", base_32, size_32);
+			lmb_reserve(base_32, size_32);
+		}
+		return;
+	}
+#endif
+	while (1) {
+		base = *(reserve_map++);
+		size = *(reserve_map++);
+		if (size == 0)
+			break;
+		pr_debug("reserving: %llx -> %llx\n", base, size);
+		lmb_reserve(base, size);
+	}
+
+#if 0
+	pr_debug("memory reserved, lmbs :\n");
+	lmb_dump_all();
+#endif
+}
+#endif
+
+#ifdef CONFIG_PHYP_DUMP
+/**
+ * phyp_dump_calculate_reserve_size() - reserve variable boot area 5% or arg
+ *
+ * Function to find the largest size we need to reserve
+ * during early boot process.
+ *
+ * It either looks for boot param and returns that OR
+ * returns larger of 256 or 5% rounded down to multiples of 256MB.
+ *
+ */
+static inline unsigned long phyp_dump_calculate_reserve_size(void)
+{
+	unsigned long tmp;
+
+	if (phyp_dump_info->reserve_bootvar)
+		return phyp_dump_info->reserve_bootvar;
+
+	/* divide by 20 to get 5% of value */
+	tmp = lmb_end_of_DRAM();
+	do_div(tmp, 20);
+
+	/* round it down in multiples of 256 */
+	tmp = tmp & ~0x0FFFFFFFUL;
+
+	return (tmp > PHYP_DUMP_RMR_END ? tmp : PHYP_DUMP_RMR_END);
+}
+
+/**
+ * phyp_dump_reserve_mem() - reserve all not-yet-dumped mmemory
+ *
+ * This routine may reserve memory regions in the kernel only
+ * if the system is supported and a dump was taken in last
+ * boot instance or if the hardware is supported and the
+ * scratch area needs to be setup. In other instances it returns
+ * without reserving anything. The memory in case of dump being
+ * active is freed when the dump is collected (by userland tools).
+ */
+static void __init phyp_dump_reserve_mem(void)
+{
+	unsigned long base, size;
+	unsigned long variable_reserve_size;
+
+	if (!phyp_dump_info->phyp_dump_configured) {
+		printk(KERN_ERR "Phyp-dump not supported on this hardware\n");
+		return;
+	}
+
+	if (!phyp_dump_info->phyp_dump_at_boot) {
+		printk(KERN_INFO "Phyp-dump disabled at boot time\n");
+		return;
+	}
+
+	variable_reserve_size = phyp_dump_calculate_reserve_size();
+
+	if (phyp_dump_info->phyp_dump_is_active) {
+		/* Reserve *everything* above RMR.Area freed by userland tools*/
+		base = variable_reserve_size;
+		size = lmb_end_of_DRAM() - base;
+
+		/* XXX crashed_ram_end is wrong, since it may be beyond
+		 * the memory_limit, it will need to be adjusted. */
+		lmb_reserve(base, size);
+
+		phyp_dump_info->init_reserve_start = base;
+		phyp_dump_info->init_reserve_size = size;
+	} else {
+		size = phyp_dump_info->cpu_state_size +
+			phyp_dump_info->hpte_region_size +
+			variable_reserve_size;
+		base = lmb_end_of_DRAM() - size;
+		lmb_reserve(base, size);
+		phyp_dump_info->init_reserve_start = base;
+		phyp_dump_info->init_reserve_size = size;
+	}
+}
+#else
+static inline void __init phyp_dump_reserve_mem(void) {}
+#endif /* CONFIG_PHYP_DUMP  && CONFIG_PPC_RTAS */
+
+void __init early_init_devtree(void *params)
+{
+	pr_debug(" -> early_init_devtree(%p)\n", params);
+
+	/* Setup flat device-tree pointer */
+	initial_boot_params = params;
+
+#ifdef CONFIG_PPC_RTAS
+	/* Some machines might need RTAS info for debugging, grab it now. */
+	of_scan_flat_dt(early_init_dt_scan_rtas, NULL);
+#endif
+
+#ifdef CONFIG_PHYP_DUMP
+	/* scan tree to see if dump occured during last boot */
+	of_scan_flat_dt(early_init_dt_scan_phyp_dump, NULL);
+#endif
+
+	/* Retrieve various informations from the /chosen node of the
+	 * device-tree, including the platform type, initrd location and
+	 * size, TCE reserve, and more ...
+	 */
+	of_scan_flat_dt(early_init_dt_scan_chosen, NULL);
+
+	/* Scan memory nodes and rebuild LMBs */
+	lmb_init();
+	of_scan_flat_dt(early_init_dt_scan_root, NULL);
+	of_scan_flat_dt(early_init_dt_scan_memory, NULL);
+
+	/* Save command line for /proc/cmdline and then parse parameters */
+	strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
+	parse_early_param();
+
+#ifdef CONFIG_PPC_PSERIES
+	/* Reserve LMB regions used by kernel, initrd, dt, etc... */
+	lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
+	reserve_kdump_trampoline();
+	reserve_crashkernel();
+	early_reserve_mem();
+	phyp_dump_reserve_mem();
+
+	lmb_enforce_memory_limit(memory_limit);
+#endif
+
+	lmb_analyze();
+
+	pr_debug("Phys. mem: %lx\n", lmb_phys_mem_size());
+
+#ifdef CONFIG_PPC_PSERIES
+	/* We may need to relocate the flat tree, do it now.
+	 * FIXME .. and the initrd too? */
+	move_device_tree();
+#endif
+	pr_debug("Scanning CPUs ...\n");
+
+	/* Retreive CPU related informations from the flat tree
+	 * (altivec support, boot CPU ID, ...)
+	 */
+	of_scan_flat_dt(early_init_dt_scan_cpus, NULL);
+
+	pr_debug(" <- early_init_devtree()\n");
+}
+
+/**
+ * Indicates whether the root node has a given value in its
+ * compatible property.
+ */
+int machine_is_compatible(const char *compat)
+{
+	struct device_node *root;
+	int rc = 0;
+
+	root = of_find_node_by_path("/");
+	if (root) {
+		rc = of_device_is_compatible(root, compat);
+		of_node_put(root);
+	}
+	return rc;
+}
+EXPORT_SYMBOL(machine_is_compatible);
+
+/*******
+ *
+ * New implementation of the OF "find" APIs, return a refcounted
+ * object, call of_node_put() when done.  The device tree and list
+ * are protected by a rw_lock.
+ *
+ * Note that property management will need some locking as well,
+ * this isn't dealt with yet.
+ *
+ *******/
+
+/**
+ *	of_find_node_by_phandle - Find a node given a phandle
+ *	@handle:	phandle of the node to find
+ *
+ *	Returns a node pointer with refcount incremented, use
+ *	of_node_put() on it when done.
+ */
+struct device_node *of_find_node_by_phandle(phandle handle)
+{
+	struct device_node *np;
+
+	read_lock(&devtree_lock);
+	for (np = allnodes; np != 0; np = np->allnext)
+		if (np->linux_phandle == handle)
+			break;
+	of_node_get(np);
+	read_unlock(&devtree_lock);
+	return np;
+}
+EXPORT_SYMBOL(of_find_node_by_phandle);
+
+/**
+ *	of_find_all_nodes - Get next node in global list
+ *	@prev:	Previous node or NULL to start iteration
+ *		of_node_put() will be called on it
+ *
+ *	Returns a node pointer with refcount incremented, use
+ *	of_node_put() on it when done.
+ */
+struct device_node *of_find_all_nodes(struct device_node *prev)
+{
+	struct device_node *np;
+
+	read_lock(&devtree_lock);
+	np = prev ? prev->allnext : allnodes;
+	for (; np != 0; np = np->allnext)
+		if (of_node_get(np))
+			break;
+	of_node_put(prev);
+	read_unlock(&devtree_lock);
+	return np;
+}
+EXPORT_SYMBOL(of_find_all_nodes);
+
+/**
+ *	of_node_get - Increment refcount of a node
+ *	@node:	Node to inc refcount, NULL is supported to
+ *		simplify writing of callers
+ *
+ *	Returns node.
+ */
+struct device_node *of_node_get(struct device_node *node)
+{
+	if (node)
+		kref_get(&node->kref);
+	return node;
+}
+EXPORT_SYMBOL(of_node_get);
+
+static inline struct device_node *kref_to_device_node(struct kref *kref)
+{
+	return container_of(kref, struct device_node, kref);
+}
+
+/**
+ *	of_node_release - release a dynamically allocated node
+ *	@kref:  kref element of the node to be released
+ *
+ *	In of_node_put() this function is passed to kref_put()
+ *	as the destructor.
+ */
+static void of_node_release(struct kref *kref)
+{
+	struct device_node *node = kref_to_device_node(kref);
+	struct property *prop = node->properties;
+
+	/* We should never be releasing nodes that haven't been detached. */
+	if (!of_node_check_flag(node, OF_DETACHED)) {
+		printk(KERN_INFO "WARNING: Bad of_node_put() on %s\n",
+			node->full_name);
+		dump_stack();
+		kref_init(&node->kref);
+		return;
+	}
+
+	if (!of_node_check_flag(node, OF_DYNAMIC))
+		return;
+
+	while (prop) {
+		struct property *next = prop->next;
+		kfree(prop->name);
+		kfree(prop->value);
+		kfree(prop);
+		prop = next;
+
+		if (!prop) {
+			prop = node->deadprops;
+			node->deadprops = NULL;
+		}
+	}
+	kfree(node->full_name);
+	kfree(node->data);
+	kfree(node);
+}
+
+/**
+ *	of_node_put - Decrement refcount of a node
+ *	@node:	Node to dec refcount, NULL is supported to
+ *		simplify writing of callers
+ *
+ */
+void of_node_put(struct device_node *node)
+{
+	if (node)
+		kref_put(&node->kref, of_node_release);
+}
+EXPORT_SYMBOL(of_node_put);
+
+/*
+ * Plug a device node into the tree and global list.
+ */
+void of_attach_node(struct device_node *np)
+{
+	unsigned long flags;
+
+	write_lock_irqsave(&devtree_lock, flags);
+	np->sibling = np->parent->child;
+	np->allnext = allnodes;
+	np->parent->child = np;
+	allnodes = np;
+	write_unlock_irqrestore(&devtree_lock, flags);
+}
+
+/*
+ * "Unplug" a node from the device tree.  The caller must hold
+ * a reference to the node.  The memory associated with the node
+ * is not freed until its refcount goes to zero.
+ */
+void of_detach_node(struct device_node *np)
+{
+	struct device_node *parent;
+	unsigned long flags;
+
+	write_lock_irqsave(&devtree_lock, flags);
+
+	parent = np->parent;
+	if (!parent)
+		goto out_unlock;
+
+	if (allnodes == np)
+		allnodes = np->allnext;
+	else {
+		struct device_node *prev;
+		for (prev = allnodes;
+		     prev->allnext != np;
+		     prev = prev->allnext)
+			;
+		prev->allnext = np->allnext;
+	}
+
+	if (parent->child == np)
+		parent->child = np->sibling;
+	else {
+		struct device_node *prevsib;
+		for (prevsib = np->parent->child;
+		     prevsib->sibling != np;
+		     prevsib = prevsib->sibling)
+			;
+		prevsib->sibling = np->sibling;
+	}
+
+	of_node_set_flag(np, OF_DETACHED);
+
+out_unlock:
+	write_unlock_irqrestore(&devtree_lock, flags);
+}
+
+#ifdef CONFIG_PPC_PSERIES
+/*
+ * Fix up the uninitialized fields in a new device node:
+ * name, type and pci-specific fields
+ */
+
+static int of_finish_dynamic_node(struct device_node *node)
+{
+	struct device_node *parent = of_get_parent(node);
+	int err = 0;
+	const phandle *ibm_phandle;
+
+	node->name = of_get_property(node, "name", NULL);
+	node->type = of_get_property(node, "device_type", NULL);
+
+	if (!node->name)
+		node->name = "<NULL>";
+	if (!node->type)
+		node->type = "<NULL>";
+
+	if (!parent) {
+		err = -ENODEV;
+		goto out;
+	}
+
+	/* We don't support that function on PowerMac, at least
+	 * not yet
+	 */
+	if (machine_is(powermac))
+		return -ENODEV;
+
+	/* fix up new node's linux_phandle field */
+	if ((ibm_phandle = of_get_property(node, "ibm,phandle", NULL)))
+		node->linux_phandle = *ibm_phandle;
+
+out:
+	of_node_put(parent);
+	return err;
+}
+
+static int prom_reconfig_notifier(struct notifier_block *nb,
+				  unsigned long action, void *node)
+{
+	int err;
+
+	switch (action) {
+	case PSERIES_RECONFIG_ADD:
+		err = of_finish_dynamic_node(node);
+		if (err < 0) {
+			printk(KERN_ERR "finish_node returned %d\n", err);
+			err = NOTIFY_BAD;
+		}
+		break;
+	default:
+		err = NOTIFY_DONE;
+		break;
+	}
+	return err;
+}
+
+static struct notifier_block prom_reconfig_nb = {
+	.notifier_call = prom_reconfig_notifier,
+	.priority = 10, /* This one needs to run first */
+};
+
+static int __init prom_reconfig_setup(void)
+{
+	return pSeries_reconfig_notifier_register(&prom_reconfig_nb);
+}
+__initcall(prom_reconfig_setup);
+#endif
+
+/*
+ * Add a property to a node
+ */
+int prom_add_property(struct device_node *np, struct property *prop)
+{
+	struct property **next;
+	unsigned long flags;
+
+	prop->next = NULL;
+	write_lock_irqsave(&devtree_lock, flags);
+	next = &np->properties;
+	while (*next) {
+		if (strcmp(prop->name, (*next)->name) == 0) {
+			/* duplicate ! don't insert it */
+			write_unlock_irqrestore(&devtree_lock, flags);
+			return -1;
+		}
+		next = &(*next)->next;
+	}
+	*next = prop;
+	write_unlock_irqrestore(&devtree_lock, flags);
+
+#ifdef CONFIG_PROC_DEVICETREE
+	/* try to add to proc as well if it was initialized */
+	if (np->pde)
+		proc_device_tree_add_prop(np->pde, prop);
+#endif /* CONFIG_PROC_DEVICETREE */
+
+	return 0;
+}
+
+/*
+ * Remove a property from a node.  Note that we don't actually
+ * remove it, since we have given out who-knows-how-many pointers
+ * to the data using get-property.  Instead we just move the property
+ * to the "dead properties" list, so it won't be found any more.
+ */
+int prom_remove_property(struct device_node *np, struct property *prop)
+{
+	struct property **next;
+	unsigned long flags;
+	int found = 0;
+
+	write_lock_irqsave(&devtree_lock, flags);
+	next = &np->properties;
+	while (*next) {
+		if (*next == prop) {
+			/* found the node */
+			*next = prop->next;
+			prop->next = np->deadprops;
+			np->deadprops = prop;
+			found = 1;
+			break;
+		}
+		next = &(*next)->next;
+	}
+	write_unlock_irqrestore(&devtree_lock, flags);
+
+	if (!found)
+		return -ENODEV;
+
+#ifdef CONFIG_PROC_DEVICETREE
+	/* try to remove the proc node as well */
+	if (np->pde)
+		proc_device_tree_remove_prop(np->pde, prop);
+#endif /* CONFIG_PROC_DEVICETREE */
+
+	return 0;
+}
+
+/*
+ * Update a property in a node.  Note that we don't actually
+ * remove it, since we have given out who-knows-how-many pointers
+ * to the data using get-property.  Instead we just move the property
+ * to the "dead properties" list, and add the new property to the
+ * property list
+ */
+int prom_update_property(struct device_node *np,
+			 struct property *newprop,
+			 struct property *oldprop)
+{
+	struct property **next;
+	unsigned long flags;
+	int found = 0;
+
+	write_lock_irqsave(&devtree_lock, flags);
+	next = &np->properties;
+	while (*next) {
+		if (*next == oldprop) {
+			/* found the node */
+			newprop->next = oldprop->next;
+			*next = newprop;
+			oldprop->next = np->deadprops;
+			np->deadprops = oldprop;
+			found = 1;
+			break;
+		}
+		next = &(*next)->next;
+	}
+	write_unlock_irqrestore(&devtree_lock, flags);
+
+	if (!found)
+		return -ENODEV;
+
+#ifdef CONFIG_PROC_DEVICETREE
+	/* try to add to proc as well if it was initialized */
+	if (np->pde)
+		proc_device_tree_update_prop(np->pde, newprop, oldprop);
+#endif /* CONFIG_PROC_DEVICETREE */
+
+	return 0;
+}
+
+/* Find the device node for a given logical cpu number, also returns the cpu
+ * local thread number (index in ibm,interrupt-server#s) if relevant and
+ * asked for (non NULL)
+ */
+struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
+{
+	int hardid;
+	struct device_node *np;
+
+	hardid = boot_cpuid; /* get_hard_smp_processor_id(cpu);*/
+
+	for_each_node_by_type(np, "cpu") {
+		const u32 *intserv;
+		unsigned int plen, t;
+
+		/* Check for ibm,ppc-interrupt-server#s. If it doesn't exist
+		 * fallback to "reg" property and assume no threads
+		 */
+		intserv = of_get_property(np, "ibm,ppc-interrupt-server#s",
+				&plen);
+		if (intserv == NULL) {
+			const u32 *reg = of_get_property(np, "reg", NULL);
+			if (reg == NULL)
+				continue;
+			if (*reg == hardid) {
+				if (thread)
+					*thread = 0;
+				return np;
+			}
+		} else {
+			plen /= sizeof(u32);
+			for (t = 0; t < plen; t++) {
+				if (hardid == intserv[t]) {
+					if (thread)
+						*thread = t;
+					return np;
+				}
+			}
+		}
+	}
+	return NULL;
+}
+EXPORT_SYMBOL(of_get_cpu_node);
+
+#if defined(CONFIG_DEBUG_FS) && defined(DEBUG)
+static struct debugfs_blob_wrapper flat_dt_blob;
+
+static int __init export_flat_device_tree(void)
+{
+	struct dentry *d;
+
+	flat_dt_blob.data = initial_boot_params;
+	flat_dt_blob.size = initial_boot_params->totalsize;
+
+	d = debugfs_create_blob("flat-device-tree", S_IFREG | S_IRUSR,
+				of_debugfs_root, &flat_dt_blob);
+	if (!d)
+		return 1;
+
+	return 0;
+}
+__initcall(export_flat_device_tree);
+#endif
diff --git a/include/asm-microblaze/of_device.h b/include/asm-microblaze/of_device.h
new file mode 100644
index 0000000..5a324cf
--- /dev/null
+++ b/include/asm-microblaze/of_device.h
@@ -0,0 +1,41 @@
+/*
+ * include/asm-microblaze/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 struct of_device *of_device_alloc(struct device_node *np,
+					 const char *bus_id,
+					 struct device *parent);
+
+extern ssize_t of_device_get_modalias(struct of_device *ofdev,
+					char *str, ssize_t len);
+extern int of_device_uevent(struct device *dev,
+			    struct kobj_uevent_env *env);
+
+/* This is just here during the transition */
+#include <linux/of_device.h>
+
+#endif /* __KERNEL__ */
+#endif /* _ASM_MICROBLAZE_OF_DEVICE_H */
diff --git a/include/asm-microblaze/of_platform.h b/include/asm-microblaze/of_platform.h
new file mode 100644
index 0000000..9c6f8cc
--- /dev/null
+++ b/include/asm-microblaze/of_platform.h
@@ -0,0 +1,45 @@
+/*
+ * include/asm-microblaze/of_platform.h
+ *
+ * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
+ *			<benh@kernel.crashing.org>
+ *
+ * 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.
+ *
+ */
+
+#ifndef _ASM_MICROBLAZE_OF_PLATFORM_H
+#define _ASM_MICROBLAZE_OF_PLATFORM_H
+
+/* This is just here during the transition */
+#include <linux/of_platform.h>
+
+/* Platform drivers register/unregister */
+static inline int of_register_platform_driver(struct of_platform_driver *drv)
+{
+	return of_register_driver(drv, &of_platform_bus_type);
+}
+static inline void of_unregister_platform_driver(struct of_platform_driver *drv)
+{
+	of_unregister_driver(drv);
+}
+
+/* Platform devices and busses creation */
+extern struct of_device *of_platform_device_create(struct device_node *np,
+						const char *bus_id,
+						struct device *parent);
+/* pseudo "matches" value to not do deep probe */
+#define OF_NO_DEEP_PROBE ((struct of_device_id *)-1)
+
+extern int of_platform_bus_probe(struct device_node *root,
+				const struct of_device_id *matches,
+				struct device *parent);
+
+extern struct of_device *of_find_device_by_phandle(phandle ph);
+
+extern void of_instantiate_rtc(void);
+
+#endif /* _ASM_MICROBLAZE_OF_PLATFORM_H */
diff --git a/include/asm-microblaze/prom.h b/include/asm-microblaze/prom.h
new file mode 100644
index 0000000..2f439b4
--- /dev/null
+++ b/include/asm-microblaze/prom.h
@@ -0,0 +1,311 @@
+/*
+ * include/asm-microblaze/prom.h
+ *
+ * Definitions for talking to the Open Firmware PROM on
+ * Power Macintosh computers.
+ *
+ * Copyright (C) 1996-2005 Paul Mackerras.
+ *
+ * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
+ *
+ * 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.
+ */
+
+#ifndef _ASM_MICROBLAZE_PROM_H
+#define _ASM_MICROBLAZE_PROM_H
+#ifdef __KERNEL__
+
+#include <linux/types.h>
+#include <linux/proc_fs.h>
+#include <linux/platform_device.h>
+#include <asm/irq.h>
+#include <asm/atomic.h>
+
+#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT	1
+#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT	1
+
+#define of_compat_cmp(s1, s2, l)	strncasecmp((s1), (s2), (l))
+#define of_prop_cmp(s1, s2)		strcmp((s1), (s2))
+#define of_node_cmp(s1, s2)		strcasecmp((s1), (s2))
+
+/* Definitions used by the flattened device tree */
+#define OF_DT_HEADER		0xd00dfeed /* marker */
+#define OF_DT_BEGIN_NODE	0x1 /* Start of node, full name */
+#define OF_DT_END_NODE		0x2 /* End node */
+#define OF_DT_PROP		0x3 /* Property: name off, size, content */
+#define OF_DT_NOP		0x4 /* nop */
+#define OF_DT_END		0x9
+
+#define OF_DT_VERSION		0x10
+
+/*
+ * This is what gets passed to the kernel by prom_init or kexec
+ *
+ * The dt struct contains the device tree structure, full pathes and
+ * property contents. The dt strings contain a separate block with just
+ * the strings for the property names, and is fully page aligned and
+ * self contained in a page, so that it can be kept around by the kernel,
+ * each property name appears only once in this page (cheap compression)
+ *
+ * the mem_rsvmap contains a map of reserved ranges of physical memory,
+ * passing it here instead of in the device-tree itself greatly simplifies
+ * the job of everybody. It's just a list of u64 pairs (base/size) that
+ * ends when size is 0
+ */
+struct boot_param_header {
+	u32	magic; /* magic word OF_DT_HEADER */
+	u32	totalsize; /* total size of DT block */
+	u32	off_dt_struct; /* offset to structure */
+	u32	off_dt_strings; /* offset to strings */
+	u32	off_mem_rsvmap; /* offset to memory reserve map */
+	u32	version; /* format version */
+	u32	last_comp_version; /* last compatible version */
+	/* version 2 fields below */
+	u32	boot_cpuid_phys; /* Physical CPU id we're booting on */
+	/* version 3 fields below */
+	u32	dt_strings_size; /* size of the DT strings block */
+	/* version 17 fields below */
+	u32	dt_struct_size; /* size of the DT structure block */
+};
+
+typedef u32 phandle;
+typedef u32 ihandle;
+
+struct property {
+	char	*name;
+	int	length;
+	void	*value;
+	struct property *next;
+};
+
+struct device_node {
+	const char *name;
+	const char *type;
+	phandle	node;
+	phandle linux_phandle;
+	char	*full_name;
+
+	struct	property *properties;
+	struct	property *deadprops; /* removed properties */
+	struct	device_node *parent;
+	struct	device_node *child;
+	struct	device_node *sibling;
+	struct	device_node *next; /* next device of same type */
+	struct	device_node *allnext; /* next in list of all nodes */
+	struct	proc_dir_entry *pde; /* this node's proc directory */
+	struct	kref kref;
+	unsigned long _flags;
+	void	*data;
+};
+
+extern struct device_node *of_chosen;
+
+static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
+{
+	return test_bit(flag, &n->_flags);
+}
+
+static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
+{
+	set_bit(flag, &n->_flags);
+}
+
+#define HAVE_ARCH_DEVTREE_FIXUPS
+
+static inline void set_node_proc_entry(struct device_node *dn,
+					struct proc_dir_entry *de)
+{
+	dn->pde = de;
+}
+
+extern struct device_node *of_find_all_nodes(struct device_node *prev);
+extern struct device_node *of_node_get(struct device_node *node);
+extern void of_node_put(struct device_node *node);
+
+/* For scanning the flat device-tree at boot time */
+extern int __init of_scan_flat_dt(int (*it)(unsigned long node,
+					const char *uname, int depth,
+					void *data),
+				void *data);
+extern void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
+					unsigned long *size);
+extern int __init
+		of_flat_dt_is_compatible(unsigned long node, const char *name);
+extern unsigned long __init of_get_flat_dt_root(void);
+
+/* For updating the device tree at runtime */
+extern void of_attach_node(struct device_node *);
+extern void of_detach_node(struct device_node *);
+
+/* Other Prototypes */
+extern void finish_device_tree(void);
+extern void unflatten_device_tree(void);
+extern void early_init_devtree(void *);
+extern int machine_is_compatible(const char *compat);
+extern void print_properties(struct device_node *node);
+extern int prom_n_intr_cells(struct device_node *np);
+extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
+extern int prom_add_property(struct device_node *np, struct property *prop);
+extern int prom_remove_property(struct device_node *np, struct property *prop);
+extern int prom_update_property(struct device_node *np,
+				struct property *newprop,
+				struct property *oldprop);
+
+extern struct resource *request_OF_resource(struct device_node *node,
+				int index, const char *name_postfix);
+extern int release_OF_resource(struct device_node *node, int index);
+
+/*
+ * OF address retreival & translation
+ */
+
+/* Helper to read a big number; size is in cells (not bytes) */
+static inline u64 of_read_number(const u32 *cell, int size)
+{
+	u64 r = 0;
+	while (size--)
+		r = (r << 32) | *(cell++);
+	return r;
+}
+
+/* Like of_read_number, but we want an unsigned long result */
+#define of_read_ulong(cell, size)	of_read_number(cell, size)
+
+/* Translate an OF address block into a CPU physical address
+ */
+extern u64 of_translate_address(struct device_node *np, const u32 *addr);
+
+/* Extract an address from a device, returns the region size and
+ * the address space flags too. The PCI version uses a BAR number
+ * instead of an absolute index
+ */
+extern const u32 *of_get_address(struct device_node *dev, int index,
+			u64 *size, unsigned int *flags);
+extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no,
+			u64 *size, unsigned int *flags);
+
+/* Get an address as a resource. Note that if your address is
+ * a PIO address, the conversion will fail if the physical address
+ * can't be internally converted to an IO token with
+ * pci_address_to_pio(), that is because it's either called to early
+ * or it can't be matched to any host bridge IO space
+ */
+extern int of_address_to_resource(struct device_node *dev, int index,
+				struct resource *r);
+extern int of_pci_address_to_resource(struct device_node *dev, int bar,
+				struct resource *r);
+
+/* Parse the ibm,dma-window property of an OF node into the busno, phys and
+ * size parameters.
+ */
+void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
+		unsigned long *busno, unsigned long *phys, unsigned long *size);
+
+extern void kdump_move_device_tree(void);
+
+/* CPU OF node matching */
+struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
+
+/* Get the MAC address */
+extern const void *of_get_mac_address(struct device_node *np);
+
+/*
+ * OF interrupt mapping
+ */
+
+/* This structure is returned when an interrupt is mapped. The controller
+ * field needs to be put() after use
+ */
+
+#define OF_MAX_IRQ_SPEC		4 /* We handle specifiers of at most 4 cells */
+
+struct of_irq {
+	struct device_node *controller; /* Interrupt controller node */
+	u32 size; /* Specifier size */
+	u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */
+};
+
+/**
+ * of_irq_map_init - Initialize the irq remapper
+ * @flags:	flags defining workarounds to enable
+ *
+ * Some machines have bugs in the device-tree which require certain workarounds
+ * to be applied. Call this before any interrupt mapping attempts to enable
+ * those workarounds.
+ */
+#define OF_IMAP_OLDWORLD_MAC	0x00000001
+#define OF_IMAP_NO_PHANDLE	0x00000002
+
+extern void of_irq_map_init(unsigned int flags);
+
+/**
+ * of_irq_map_raw - Low level interrupt tree parsing
+ * @parent:	the device interrupt parent
+ * @intspec:	interrupt specifier ("interrupts" property of the device)
+ * @ointsize:	size of the passed in interrupt specifier
+ * @addr:	address specifier (start of "reg" property of the device)
+ * @out_irq:	structure of_irq filled by this function
+ *
+ * Returns 0 on success and a negative number on error
+ *
+ * This function is a low-level interrupt tree walking function. It
+ * can be used to do a partial walk with synthetized reg and interrupts
+ * properties, for example when resolving PCI interrupts when no device
+ * node exist for the parent.
+ *
+ */
+
+extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec,
+			u32 ointsize, const u32 *addr,
+			struct of_irq *out_irq);
+
+/**
+ * of_irq_map_one - Resolve an interrupt for a device
+ * @device:	the device whose interrupt is to be resolved
+ * @index:	index of the interrupt to resolve
+ * @out_irq:	structure of_irq filled by this function
+ *
+ * This function resolves an interrupt, walking the tree, for a given
+ * device-tree node. It's the high level pendant to of_irq_map_raw().
+ * It also implements the workarounds for OldWolrd Macs.
+ */
+extern int of_irq_map_one(struct device_node *device, int index,
+			struct of_irq *out_irq);
+
+/**
+ * of_irq_map_pci - Resolve the interrupt for a PCI device
+ * @pdev:	the device whose interrupt is to be resolved
+ * @out_irq:	structure of_irq filled by this function
+ *
+ * This function resolves the PCI interrupt for a given PCI device. If a
+ * device-node exists for a given pci_dev, it will use normal OF tree
+ * walking. If not, it will implement standard swizzling and walk up the
+ * PCI tree until an device-node is found, at which point it will finish
+ * resolving using the OF tree walking.
+ */
+struct pci_dev;
+extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
+
+extern int of_irq_to_resource(struct device_node *dev, int index,
+			struct resource *r);
+
+/**
+ * of_iomap - Maps the memory mapped IO for a given device_node
+ * @device:	the device whose io range will be mapped
+ * @index:	index of the io range
+ *
+ * Returns a pointer to the mapped memory
+ */
+extern void __iomem *of_iomap(struct device_node *device, int index);
+
+/*
+ * NB: This is here while we transition from using asm/prom.h
+ * to linux/of.h
+ */
+#include <linux/of.h>
+
+#endif /* __KERNEL__ */
+#endif /* _ASM_MICROBLAZE_PROM_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 05/56] microblaze_v2: Support for semaphores
  2008-05-04 11:40       ` [PATCH 04/56] microblaze_v2: Open firmware files monstr
@ 2008-05-04 11:40         ` monstr
  2008-05-04 11:40           ` [PATCH 06/56] microblaze_v2: exception handling monstr
  2008-05-05 14:24         ` [PATCH 04/56] microblaze_v2: Open firmware files Grant Likely
                           ` (2 subsequent siblings)
  3 siblings, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


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

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


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 06/56] microblaze_v2: exception handling
  2008-05-04 11:40         ` [PATCH 05/56] microblaze_v2: Support for semaphores monstr
@ 2008-05-04 11:40           ` monstr
  2008-05-04 11:40             ` [PATCH 07/56] microblaze_v2: Signal support monstr
  0 siblings, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


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

diff --git a/arch/microblaze/kernel/exceptions.c b/arch/microblaze/kernel/exceptions.c
new file mode 100644
index 0000000..9b92e56
--- /dev/null
+++ b/arch/microblaze/kernel/exceptions.c
@@ -0,0 +1,78 @@
+/*
+ * arch/microblaze/kernel/exceptions.c - HW exception handling
+ *
+ * Copyright (C) 2007 Xilinx, Inc.
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <asm/exceptions.h>
+#include <asm/entry.h>		/* For KM CPU var */
+
+/* Initialize_exception_handlers() - called from setup.c/trap_init() */
+void initialize_exception_handlers(void)
+{
+}
+
+#define MICROBLAZE_ILL_OPCODE_EXCEPTION	0x02
+#define MICROBLAZE_IOPB_BUS_EXCEPTION	0x03
+#define MICROBLAZE_DOPB_BUS_EXCEPTION	0x04
+#define MICROBLAZE_DIV_ZERO_EXCEPTION	0x05
+#define MICROBLAZE_FPU_EXCEPTION	0x06
+
+static void handle_unexpected_exception(unsigned int esr,
+				unsigned int kernel_mode, unsigned int addr)
+{
+	printk(KERN_WARNING "Unexpected exception %02x in %s mode, PC=%08x\n",
+		esr, kernel_mode ? "kernel" : "user", addr);
+}
+
+static void handle_exception(const char *message, int signal,
+				unsigned int kernel_mode, unsigned int addr)
+{
+	if (kernel_mode)
+		panic("%s in the kernel mode, PC=%08x\n", message, addr);
+	else
+		force_sig(signal, current);
+}
+
+asmlinkage void other_exception_handler(unsigned int esr, unsigned int addr)
+{
+	unsigned int kernel_mode = per_cpu(KM, 0);
+
+	switch (esr) {
+
+	case MICROBLAZE_ILL_OPCODE_EXCEPTION:
+		handle_exception("Illegal instruction", SIGILL,
+						kernel_mode, addr);
+		break;
+
+	case MICROBLAZE_IOPB_BUS_EXCEPTION:
+		handle_exception("Instruction bus error", SIGBUS,
+						kernel_mode, addr);
+		break;
+
+	case MICROBLAZE_DOPB_BUS_EXCEPTION:
+		handle_exception("Data bus error", SIGBUS, kernel_mode, addr);
+		break;
+
+	case MICROBLAZE_DIV_ZERO_EXCEPTION:
+		handle_exception("Divide by zero", SIGILL, kernel_mode, addr);
+		break;
+
+	case MICROBLAZE_FPU_EXCEPTION:
+		handle_exception("FPU error", SIGFPE, kernel_mode, addr);
+		break;
+
+	default:
+		handle_unexpected_exception(esr, kernel_mode, addr);
+	}
+
+	return;
+}
diff --git a/arch/microblaze/kernel/hw_exception_handler.S b/arch/microblaze/kernel/hw_exception_handler.S
new file mode 100644
index 0000000..4c3b41b
--- /dev/null
+++ b/arch/microblaze/kernel/hw_exception_handler.S
@@ -0,0 +1,395 @@
+/*
+ *
+ * arch/microblaze/kernel/hw_exception_handler.S
+ *
+ * Unaligned exception handling for Microblaze
+ *
+ * cleanup code (C) 2007 Michal Simek <monstr@monstr.eu>
+ * uClinux customisation (C) 2005 John Williams
+ *
+ * Original code
+ * Copyright (C) 2004 Xilinx, Inc. All rights reserved.
+ *
+ * Xilinx, Inc.
+ * XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
+ * COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
+ * ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
+ * STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
+ * IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
+ * FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
+ * XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
+ * THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
+ * ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
+ * FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Id: hw_exception_handler.S,v 1.1.2.1 2007/03/16 16:09:57 imanuilov Exp $
+ *
+ */
+
+/*
+ * Microblaze HW Exception Handler
+ * - Non self-modifying exception handler for the following exception conditions
+ * - Unalignment
+ * - Instruction bus error
+ * - Data bus error
+ * - Illegal instruction opcode
+ * - Divide-by-zero
+ *
+ * Note we disable interrupts during exception handling, otherwise we will
+ * possibly get multiple re-entrancy if interrupt handles themselves cause
+ * exceptions. JW
+ */
+
+#include <linux/autoconf.h>
+#include <asm/exceptions.h>
+#include <asm/unistd.h>
+
+/* Helpful Macros */
+#define EX_HANDLER_STACK_SIZ	(4*19)
+#define RMSR_OFFSET		0
+#define REG_OFFSET(regnum)	(4*regnum)
+#define NUM_TO_REG(num)		r ## num
+
+#define R3_TO_STACK(regnum)	swi	r3, r1, REG_OFFSET(regnum)
+#define R3_FROM_STACK(regnum)	lwi	r3, r1, REG_OFFSET(regnum)
+
+#define PUSH_REG(regnum)	swi NUM_TO_REG(regnum), r1, REG_OFFSET(regnum)
+#define POP_REG(regnum)		lwi NUM_TO_REG(regnum), r1, REG_OFFSET(regnum)
+
+/* Uses r5 */
+#define PUSH_MSR					\
+	mfs	r5, rmsr;				\
+	swi	r5, r1, RMSR_OFFSET;
+
+#define PUSH_MSR_AND_ENABLE_EXC				\
+	mfs	r5, rmsr;				\
+	swi	r5, r1, RMSR_OFFSET;			\
+	ori	r5, r5, 0x100; /* Turn ON the EE bit */	\
+	andi	r5, r5, ~2; /* Disable interrupts */	\
+	mts	rmsr, r5;
+
+/* Uses r5 */
+#define POP_MSR						\
+	lwi	r5, r1, RMSR_OFFSET;			\
+	mts	rmsr, r5;
+
+#define LWREG_NOP					\
+	bri	ex_handler_unhandled;			\
+	nop;
+
+#define SWREG_NOP					\
+	bri	ex_handler_unhandled;			\
+	nop;
+
+/* r3 is the source */
+#define R3_TO_LWREG_V(regnum)				\
+	R3_TO_STACK(regnum);				\
+	bri	ex_handler_done;
+
+/* r3 is the source */
+#define R3_TO_LWREG(regnum)				\
+	or	NUM_TO_REG (regnum), r0, r3;		\
+	bri	ex_handler_done;
+
+/* r3 is the target */
+#define SWREG_TO_R3_V(regnum)				\
+	R3_FROM_STACK (regnum);				\
+	bri	ex_sw_tail;
+
+/* r3 is the target */
+#define SWREG_TO_R3(regnum)				\
+	or	r3, r0, NUM_TO_REG (regnum);		\
+	bri	ex_sw_tail;
+
+.extern other_exception_handler /* Defined in exception.c */
+
+/*
+ * hw_exception_handler - Handler for unaligned exceptions
+ * Exception handler notes:
+ * - Does not handle exceptions other than unaligned exceptions
+ * - Does not handle exceptions during load into r17, r1, r0.
+ * - Does not handle exceptions during store from r17 (cannot be done)
+ *	and r1 (slows down common case)
+ *
+ * Relevant register structures
+ *
+ * EAR	- |----|----|----|----|----|----|----|----|
+ *	- <  ##   32 bit faulting address     ##  >
+ *
+ * ESR	- |----|----|----|----|----| - | - |-----|-----|
+ *	-			     W   S   REG   EXC
+ *
+ *
+ * STACK FRAME STRUCTURE
+ * ---------------------
+ *
+ *	+-------------+		+ 0
+ *	|     MSR     |
+ *	+-------------+		+ 4
+ *	|     r1      |
+ *	|      .      |
+ *	|      .      |
+ *	|      .      |
+ *	|      .      |
+ *	|     r18     |
+ *	+-------------+		+ 76
+ *	|      .      |
+ *	|      .      |
+ */
+
+.global _hw_exception_handler
+.section .text
+.align 4
+.ent _hw_exception_handler
+_hw_exception_handler:
+	addik	r1, r1, -(EX_HANDLER_STACK_SIZ); /* Create stack frame */
+	PUSH_REG(3);
+	PUSH_REG(4);
+	PUSH_REG(5);
+	PUSH_REG(6);
+	mfs	r3, resr;
+
+	andi	r5, r3, 0x1000;
+	beqi	r5, not_in_delay_slot;
+	mfs	r17, rbtr;
+not_in_delay_slot:
+
+	PUSH_REG(17);
+	/* Exceptions enabled here. This will allow nested exceptions */
+	PUSH_MSR_AND_ENABLE_EXC;
+
+	andi	r5, r3, 0x1F; /* Extract ESR[EXC] */
+
+	xori	r6, r5, 1; /* 00001 = Unaligned Exception */
+	/* Jump to unalignment exception handler */
+	beqi	r6, handle_unaligned_ex;
+
+handle_other_ex: /* Handle Other exceptions here */
+	/* Save other volatiles before we make procedure calls below */
+	PUSH_REG(7);
+	PUSH_REG(8);
+	PUSH_REG(9);
+	PUSH_REG(10);
+	PUSH_REG(11);
+	PUSH_REG(12);
+	PUSH_REG(14);
+	PUSH_REG(15);
+	PUSH_REG(18);
+
+	andi	r5, r3, 0x1F; /* Load ESR[EC] */
+	addk	r6, r17, r0; /* Load exception address */
+	bralid	r15, other_exception_handler; /* Branch to the handler */
+	nop;
+
+	/*
+	* Trigger execution of the signal handler by enabling
+	* interrupts and calling an invalid syscall.
+	*/
+	mfs	r5, rmsr;
+	ori	r5, r5, 2;
+	mts	rmsr, r5;
+	addi	r12, r0, NR_syscalls;
+	brki	r14, 0x08;
+	mfs	r5, rmsr;
+	andi	r5, r5, ~2;
+	mts	rmsr, r5;
+
+	POP_REG(7); /* Restore other volatiles */
+	POP_REG(8);
+	POP_REG(9);
+	POP_REG(10);
+	POP_REG(11);
+	POP_REG(12);
+	POP_REG(14);
+	POP_REG(15);
+	POP_REG(18);
+
+	bri	ex_handler_done; /* Complete exception handling */
+handle_unaligned_ex:
+	andi	r6, r3, 0x3E0; /* Mask and extract the register operand */
+	srl	r6, r6; /* r6 >> 5 */
+	srl	r6, r6;
+	srl	r6, r6;
+	srl	r6, r6;
+	srl	r6, r6;
+	/* Store the register operand in a temporary location */
+	sbi	r6, r0, ex_reg_op;
+	mfs	r4, rear;
+	andi	r6, r3, 0x400; /* Extract ESR[S] */
+	bnei	r6, ex_sw;
+ex_lw:
+	andi	r6, r3, 0x800; /* Extract ESR[W] */
+	beqi	r6, ex_lhw;
+	lbui	r5, r4, 0; /* Exception address in r4 */
+	/* Load a word, byte-by-byte from destination address
+		and save it in tmp space */
+	sbi	r5, r0, ex_tmp_data_loc_0;
+	lbui	r5, r4, 1;
+	sbi	r5, r0, ex_tmp_data_loc_1;
+	lbui	r5, r4, 2;
+	sbi	r5, r0, ex_tmp_data_loc_2;
+	lbui	r5, r4, 3;
+	sbi	r5, r0, ex_tmp_data_loc_3;
+	/* Get the destination register value into r3 */
+	lwi	r3, r0, ex_tmp_data_loc_0;
+	bri	ex_lw_tail;
+ex_lhw:
+	lbui	r5, r4, 0; /* Exception address in r4 */
+	/* Load a half-word, byte-by-byte from destination
+		address and save it in tmp space */
+	sbi	r5, r0, ex_tmp_data_loc_0;
+	lbui	r5, r4, 1;
+	sbi	r5, r0, ex_tmp_data_loc_1;
+	/* Get the destination register value into r3 */
+	lhui	r3, r0, ex_tmp_data_loc_0;
+ex_lw_tail:
+	/* Get the destination register number into r5 */
+	lbui	r5, r0, ex_reg_op;
+	/* Form load_word jump table offset (lw_table + (8 * regnum)) */
+	la	r6, r0, lw_table;
+	addk	r5, r5, r5;
+	addk	r5, r5, r5;
+	addk	r5, r5, r5;
+	addk	r5, r5, r6;
+	bra	r5;
+ex_lw_end: /* Exception handling of load word, ends */
+ex_sw:
+	/* Get the destination register number into r5 */
+	lbui	r5, r0, ex_reg_op;
+	/* Form store_word jump table offset (sw_table + (8 * regnum)) */
+	la	r6, r0, sw_table;
+	add	r5, r5, r5;
+	add	r5, r5, r5;
+	add	r5, r5, r5;
+	add	r5, r5, r6;
+	bra	r5;
+ex_sw_tail:
+	mfs	r6, resr;
+	andi	r6, r6, 0x800; /* Extract ESR[W] */
+	beqi	r6, ex_shw;
+	swi	r3, r0, ex_tmp_data_loc_0;
+	/* Store the word, byte-by-byte into destination address */
+	lbui	r3, r0, ex_tmp_data_loc_0;
+	sbi	r3, r4, 0;
+	lbui	r3, r0, ex_tmp_data_loc_1;
+	sbi	r3, r4, 1;
+	lbui	r3, r0, ex_tmp_data_loc_2;
+	sbi	r3, r4, 2;
+	lbui	r3, r0, ex_tmp_data_loc_3;
+	sbi	r3, r4, 3;
+	bri	ex_handler_done;
+ex_shw:
+	/* Store the lower half-word, byte-by-byte into destination address */
+	swi	r3, r0, ex_tmp_data_loc_0;
+	lbui	r3, r0, ex_tmp_data_loc_2;
+	sbi	r3, r4, 0;
+	lbui	r3, r0, ex_tmp_data_loc_3;
+	sbi	r3, r4, 1;
+ex_sw_end: /* Exception handling of store word, ends. */
+
+ex_handler_done:
+	POP_MSR;
+	POP_REG(3);
+	POP_REG(4);
+	POP_REG(5);
+	POP_REG(6);
+	POP_REG(17);
+	rted	r17, 0
+	addik	r1, r1, (EX_HANDLER_STACK_SIZ); /* Restore stack frame */
+ex_handler_unhandled:
+	bri 0 /* UNHANDLED. TRAP HERE */
+.end _hw_exception_handler
+
+/*
+* hw_exception_handler Jump Table
+* - Contains code snippets for each register that caused the unaligned exception
+* - Hence exception handler is NOT self-modifying
+* - Separate table for load exceptions and store exceptions.
+* - Each table is of size: (8 * 32) = 256 bytes
+*/
+
+.section .text
+.align 4
+lw_table:
+lw_r0:	R3_TO_LWREG	(0);
+lw_r1:	LWREG_NOP;
+lw_r2:	R3_TO_LWREG	(2);
+lw_r3:	R3_TO_LWREG_V	(3);
+lw_r4:	R3_TO_LWREG_V	(4);
+lw_r5:	R3_TO_LWREG_V	(5);
+lw_r6:	R3_TO_LWREG_V	(6);
+lw_r7:	R3_TO_LWREG	(7);
+lw_r8:	R3_TO_LWREG	(8);
+lw_r9:	R3_TO_LWREG	(9);
+lw_r10:	R3_TO_LWREG	(10);
+lw_r11:	R3_TO_LWREG	(11);
+lw_r12:	R3_TO_LWREG	(12);
+lw_r13:	R3_TO_LWREG	(13);
+lw_r14:	R3_TO_LWREG	(14);
+lw_r15:	R3_TO_LWREG	(15);
+lw_r16:	R3_TO_LWREG	(16);
+lw_r17:	LWREG_NOP;
+lw_r18:	R3_TO_LWREG	(18);
+lw_r19:	R3_TO_LWREG	(19);
+lw_r20:	R3_TO_LWREG	(20);
+lw_r21:	R3_TO_LWREG	(21);
+lw_r22:	R3_TO_LWREG	(22);
+lw_r23:	R3_TO_LWREG	(23);
+lw_r24:	R3_TO_LWREG	(24);
+lw_r25:	R3_TO_LWREG	(25);
+lw_r26:	R3_TO_LWREG	(26);
+lw_r27:	R3_TO_LWREG	(27);
+lw_r28:	R3_TO_LWREG	(28);
+lw_r29:	R3_TO_LWREG	(29);
+lw_r30:	R3_TO_LWREG	(30);
+lw_r31:	R3_TO_LWREG	(31);
+
+sw_table:
+sw_r0:	SWREG_TO_R3	(0);
+sw_r1:	SWREG_NOP;
+sw_r2:	SWREG_TO_R3	(2);
+sw_r3:	SWREG_TO_R3_V	(3);
+sw_r4:	SWREG_TO_R3_V	(4);
+sw_r5:	SWREG_TO_R3_V	(5);
+sw_r6:	SWREG_TO_R3_V	(6);
+sw_r7:	SWREG_TO_R3	(7);
+sw_r8:	SWREG_TO_R3	(8);
+sw_r9:	SWREG_TO_R3	(9);
+sw_r10:	SWREG_TO_R3	(10);
+sw_r11:	SWREG_TO_R3	(11);
+sw_r12:	SWREG_TO_R3	(12);
+sw_r13:	SWREG_TO_R3	(13);
+sw_r14:	SWREG_TO_R3	(14);
+sw_r15:	SWREG_TO_R3	(15);
+sw_r16:	SWREG_TO_R3	(16);
+sw_r17:	SWREG_NOP;
+sw_r18:	SWREG_TO_R3	(18);
+sw_r19:	SWREG_TO_R3	(19);
+sw_r20:	SWREG_TO_R3	(20);
+sw_r21:	SWREG_TO_R3	(21);
+sw_r22:	SWREG_TO_R3	(22);
+sw_r23:	SWREG_TO_R3	(23);
+sw_r24:	SWREG_TO_R3	(24);
+sw_r25:	SWREG_TO_R3	(25);
+sw_r26:	SWREG_TO_R3	(26);
+sw_r27:	SWREG_TO_R3	(27);
+sw_r28:	SWREG_TO_R3	(28);
+sw_r29:	SWREG_TO_R3	(29);
+sw_r30:	SWREG_TO_R3	(30);
+sw_r31:	SWREG_TO_R3	(31);
+
+/* Temporary data structures used in the handler */
+.section .data
+.align 4
+ex_tmp_data_loc_0:
+	.byte 0
+ex_tmp_data_loc_1:
+	.byte 0
+ex_tmp_data_loc_2:
+	.byte 0
+ex_tmp_data_loc_3:
+	.byte 0
+ex_reg_op:
+	.byte 0
+
diff --git a/include/asm-microblaze/exceptions.h b/include/asm-microblaze/exceptions.h
new file mode 100644
index 0000000..02dc186
--- /dev/null
+++ b/include/asm-microblaze/exceptions.h
@@ -0,0 +1,66 @@
+/*
+ * include/asm-microblaze/exceptions.h
+ *
+ * Preliminary support for HW exception handing for Microblaze
+ *
+ * Copyright (C) 2005 John Williams <jwilliams@itee.uq.edu.au>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ */
+
+#ifndef _ASM_MICROBLAZE_EXCEPTIONS_H
+#define _ASM_MICROBLAZE_EXCEPTIONS_H
+
+#include <linux/autoconf.h>
+
+#ifndef __ASSEMBLY__
+
+void initialize_exception_handlers(void);
+asmlinkage void other_exception_handler(unsigned int esr, unsigned int addr);
+
+/* 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;			\
+				ori	r12, r12, %0;			\
+				mts	rmsr, r12;			\
+				nop; "					\
+				:					\
+				: "i" (HWEX_MSR_BIT)			\
+				: "memory", "r12")
+
+#define __disable_hw_exceptions()					\
+	__asm__ __volatile__ ("						\
+				mfs	r12, rmsr;			\
+				andi	r12, r12, ~%0;			\
+				mts	rmsr, r12;			\
+				nop; "					\
+				:					\
+				: "i" (HWEX_MSR_BIT)			\
+				: "memory", "r12")
+#endif /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */
+
+#endif /*__ASSEMBLY__ */
+
+#endif /* _ASM_MICROBLAZE_EXCEPTIONS_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 07/56] microblaze_v2: Signal support
  2008-05-04 11:40           ` [PATCH 06/56] microblaze_v2: exception handling monstr
@ 2008-05-04 11:40             ` monstr
  2008-05-04 11:40               ` [PATCH 08/56] microblaze_v2: Interrupt handling, timer support, supported function monstr
                                 ` (2 more replies)
  0 siblings, 3 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


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

diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c
new file mode 100644
index 0000000..dc9f273
--- /dev/null
+++ b/arch/microblaze/kernel/signal.c
@@ -0,0 +1,534 @@
+/*
+ * arch/microblaze/kernel/signal.c -- Signal handling
+ *
+ * Copyright (C) 2003,2004 John Williams <jwilliams@itee.uq.edu.au>
+ * Copyright (C) 2001 NEC Corporation
+ * Copyright (C) 2001 Miles Bader <miles@gnu.org>
+ * Copyright (C) 1999,2000 Niibe Yutaka & Kaz Kojima
+ * Copyright (C) 1991,1992 Linus Torvalds
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson
+ *
+ * This file was was derived from the sh version, arch/sh/kernel/signal.c
+ */
+
+#include <linux/sched.h>
+#include <linux/mm.h>
+#include <linux/smp.h>
+#include <linux/smp_lock.h>
+#include <linux/kernel.h>
+#include <linux/signal.h>
+#include <linux/errno.h>
+#include <linux/wait.h>
+#include <linux/ptrace.h>
+#include <linux/unistd.h>
+#include <linux/stddef.h>
+#include <linux/personality.h>
+#include <linux/percpu.h>
+#include <asm/entry.h>
+#include <asm/ucontext.h>
+#include <asm/uaccess.h>
+#include <asm/pgtable.h>
+#include <asm/pgalloc.h>
+#include <asm/signal.h>
+
+#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
+
+asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset, int in_sycall);
+
+/*
+ * Atomically swap in the new signal mask, and wait for a signal.
+ */
+asmlinkage int
+sys_sigsuspend(old_sigset_t mask, struct pt_regs *regs)
+{
+	sigset_t saveset;
+
+	mask &= _BLOCKABLE;
+	spin_lock_irq(&current->sighand->siglock);
+	saveset = current->blocked;
+	siginitset(&current->blocked, mask);
+	recalc_sigpending();
+	spin_unlock_irq(&current->sighand->siglock);
+
+	regs->r3 = -EINTR;
+	while (1) {
+		current->state = TASK_INTERRUPTIBLE;
+		schedule();
+		if (do_signal(regs, &saveset, 1))
+			return -EINTR;
+	}
+}
+
+asmlinkage int
+sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize,
+		struct pt_regs *regs)
+{
+	sigset_t saveset, newset;
+
+	/* XXX: Don't preclude handling different sized sigset_t's. */
+	if (sigsetsize != sizeof(sigset_t))
+		return -EINVAL;
+
+	if (copy_from_user(&newset, unewset, sizeof(newset)))
+		return -EFAULT;
+	sigdelsetmask(&newset, ~_BLOCKABLE);
+	spin_lock_irq(&current->sighand->siglock);
+	saveset = current->blocked;
+	current->blocked = newset;
+	recalc_sigpending();
+	spin_unlock_irq(&current->sighand->siglock);
+
+	regs->r3 = -EINTR;
+	while (1) {
+		current->state = TASK_INTERRUPTIBLE;
+		schedule();
+		if (do_signal(regs, &saveset, 1))
+			return -EINTR;
+	}
+}
+
+asmlinkage int
+sys_sigaction(int sig, const struct old_sigaction *act,
+		struct old_sigaction *oact)
+{
+	struct k_sigaction new_ka, old_ka;
+	int ret;
+
+	if (act) {
+		old_sigset_t mask;
+		if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
+			__get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
+			__get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
+			return -EFAULT;
+		__get_user(new_ka.sa.sa_flags, &act->sa_flags);
+		__get_user(mask, &act->sa_mask);
+		siginitset(&new_ka.sa.sa_mask, mask);
+	}
+
+	ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
+
+	if (!ret && oact) {
+		if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
+			__put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
+			__put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
+			return -EFAULT;
+		__put_user(old_ka.sa.sa_flags, &oact->sa_flags);
+		__put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
+	}
+
+	return ret;
+}
+
+asmlinkage int
+sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
+		struct pt_regs *regs)
+{
+	return do_sigaltstack(uss, uoss, regs->r1);
+}
+
+/*
+ * Do a signal return; undo the signal stack.
+ */
+
+struct sigframe {
+	struct sigcontext sc;
+	unsigned long extramask[_NSIG_WORDS-1];
+	unsigned long tramp[2];	/* signal trampoline */
+};
+
+struct rt_sigframe {
+	struct siginfo info;
+	struct ucontext uc;
+	unsigned long tramp[2];	/* signal trampoline */
+};
+
+static int
+restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc, int *rval_p)
+{
+	unsigned int err = 0;
+
+#define COPY(x)		err |= __get_user(regs->x, &sc->regs.x)
+	COPY(r0);	COPY(r1);
+	COPY(r2);	COPY(r3);	COPY(r4);	COPY(r5);
+	COPY(r6);	COPY(r7);	COPY(r8);	COPY(r9);
+	COPY(r10);	COPY(r11);	COPY(r12);	COPY(r13);
+	COPY(r14);	COPY(r15);	COPY(r16);	COPY(r17);
+	COPY(r18);	COPY(r19);	COPY(r20);	COPY(r21);
+	COPY(r22);	COPY(r23);	COPY(r24);	COPY(r25);
+	COPY(r26);	COPY(r27);	COPY(r28);	COPY(r29);
+	COPY(r30);	COPY(r31);
+	COPY(pc);	COPY(ear);	COPY(esr);	COPY(fsr);
+#undef COPY
+
+	*rval_p = regs->r3;
+
+	return err;
+}
+
+asmlinkage int sys_sigreturn(struct pt_regs *regs)
+{
+	struct sigframe *frame = (struct sigframe *)regs->r1;
+	sigset_t set;
+	int rval;
+
+	if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
+		goto badframe;
+
+	if (__get_user(set.sig[0], &frame->sc.oldmask)
+		|| (_NSIG_WORDS > 1
+		&& __copy_from_user(&set.sig[1], &frame->extramask,
+					sizeof(frame->extramask))))
+		goto badframe;
+
+	sigdelsetmask(&set, ~_BLOCKABLE);
+
+	spin_lock_irq(&current->sighand->siglock);
+	current->blocked = set;
+	recalc_sigpending();
+	spin_unlock_irq(&current->sighand->siglock);
+
+	if (restore_sigcontext(regs, &frame->sc, &rval))
+		goto badframe;
+	return rval;
+
+badframe:
+	force_sig(SIGSEGV, current);
+	return 0;
+}
+
+asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
+{
+	struct rt_sigframe *frame = (struct rt_sigframe *)regs->r1;
+	sigset_t set;
+	stack_t st;
+	int rval;
+
+	if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
+		goto badframe;
+
+	if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
+		goto badframe;
+
+	sigdelsetmask(&set, ~_BLOCKABLE);
+	spin_lock_irq(&current->sighand->siglock);
+	current->blocked = set;
+	recalc_sigpending();
+	spin_unlock_irq(&current->sighand->siglock);
+
+	if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &rval))
+		goto badframe;
+
+	if (__copy_from_user((void *)&st, &frame->uc.uc_stack, sizeof(st)))
+		goto badframe;
+	/* It is more difficult to avoid calling this function than to
+	 call it and ignore errors. */
+	do_sigaltstack(&st, NULL, regs->r1);
+
+	return rval;
+
+badframe:
+	force_sig(SIGSEGV, current);
+	return 0;
+}
+
+/*
+ * Set up a signal frame.
+ */
+
+static int
+setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs,
+		unsigned long mask)
+{
+	int err = 0;
+
+#define COPY(x)		err |= __put_user(regs->x, &sc->regs.x)
+	COPY(r0);	COPY(r1);
+	COPY(r2);	COPY(r3);	COPY(r4);	COPY(r5);
+	COPY(r6);	COPY(r7);	COPY(r8);	COPY(r9);
+	COPY(r10);	COPY(r11);	COPY(r12);	COPY(r13);
+	COPY(r14);	COPY(r15);	COPY(r16);	COPY(r17);
+	COPY(r18);	COPY(r19);	COPY(r20);	COPY(r21);
+	COPY(r22);	COPY(r23);	COPY(r24);	COPY(r25);
+	COPY(r26);	COPY(r27);	COPY(r28);	COPY(r29);
+	COPY(r30);	COPY(r31);
+	COPY(pc);	COPY(ear);	COPY(esr);	COPY(fsr);
+#undef COPY
+
+	err |= __put_user(mask, &sc->oldmask);
+
+	return err;
+}
+
+/*
+ * Determine which stack to use..
+ */
+static inline void *
+get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
+{
+	/* Default to using normal stack */
+	unsigned long sp = regs->r1;
+
+	if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && !on_sig_stack(sp))
+		sp = current->sas_ss_sp + current->sas_ss_size;
+
+	return (void *)((sp - frame_size) & -8UL);
+}
+
+static void setup_frame(int sig, struct k_sigaction *ka,
+			sigset_t *set, struct pt_regs *regs)
+{
+	struct sigframe *frame;
+	int err = 0;
+	int signal;
+
+	frame = get_sigframe(ka, regs, sizeof(*frame));
+
+	if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
+		goto give_sigsegv;
+
+	signal = current_thread_info()->exec_domain
+		&& current_thread_info()->exec_domain->signal_invmap
+		&& sig < 32
+		? current_thread_info()->exec_domain->signal_invmap[sig]
+		: sig;
+
+	err |= setup_sigcontext(&frame->sc, regs, set->sig[0]);
+
+	if (_NSIG_WORDS > 1) {
+		err |= __copy_to_user(frame->extramask, &set->sig[1],
+					sizeof(frame->extramask));
+	}
+
+	/* Set up to return from userspace. If provided, use a stub
+	 already in userspace. */
+	/* minus 8 is offset to cater for "rtsd r15,8" offset */
+	if (ka->sa.sa_flags & SA_RESTORER) {
+		regs->r15 = ((unsigned long)ka->sa.sa_restorer)-8;
+	} else {
+		/* Note, these encodings are _big endian_! */
+
+		/* addi r12, r0, __NR_sigreturn */
+		err |= __put_user(0x31800000 | __NR_sigreturn ,
+				frame->tramp + 0);
+		/* brki r14, 0x8 */
+		err |= __put_user(0xb9cc0008, frame->tramp + 1);
+
+		/* Return from sighandler will jump to the tramp.
+		 Negative 8 offset because return is rtsd r15, 8 */
+		regs->r15 = ((unsigned long)frame->tramp)-8;
+
+#if 0
+		flush_cache_sigtramp((unsigned long)frame->tramp);
+#endif
+	}
+
+	if (err)
+		goto give_sigsegv;
+
+	/* Set up registers for signal handler */
+	regs->r1 = (unsigned long) frame;
+	/* Signal handler args: */
+	regs->r5 = signal; /* Arg 0: signum */
+	regs->r6 = (unsigned long) &frame->sc; /* arg 1: sigcontext */
+
+	/* Offset of 4 to handle microblaze rtid r14, 0 */
+	regs->pc = (unsigned long)ka->sa.sa_handler;
+
+	set_fs(USER_DS);
+
+#ifdef DEBUG_SIG
+	printk(KERN_INFO "SIG deliver (%s:%d): sp=%p pc=%08lx\n",
+		current->comm, current->pid, frame, regs->pc);
+#endif
+
+	return;
+
+give_sigsegv:
+	if (sig == SIGSEGV)
+		ka->sa.sa_handler = SIG_DFL;
+	force_sig(SIGSEGV, current);
+}
+
+static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
+			sigset_t *set, struct pt_regs *regs)
+{
+	struct rt_sigframe *frame;
+	int err = 0;
+	int signal;
+
+	frame = get_sigframe(ka, regs, sizeof(*frame));
+
+	if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
+		goto give_sigsegv;
+
+	signal = current_thread_info()->exec_domain
+		&& current_thread_info()->exec_domain->signal_invmap
+		&& sig < 32
+		? current_thread_info()->exec_domain->signal_invmap[sig]
+		: sig;
+
+	err |= copy_siginfo_to_user(&frame->info, info);
+
+	/* Create the ucontext. */
+	err |= __put_user(0, &frame->uc.uc_flags);
+	err |= __put_user(0, &frame->uc.uc_link);
+	err |= __put_user((void *)current->sas_ss_sp,
+			&frame->uc.uc_stack.ss_sp);
+	err |= __put_user(sas_ss_flags(regs->r1),
+			&frame->uc.uc_stack.ss_flags);
+	err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
+	err |= setup_sigcontext(&frame->uc.uc_mcontext,
+			regs, set->sig[0]);
+	err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
+
+	/* Set up to return from userspace. If provided, use a stub
+	 already in userspace. */
+	/* minus 8 is offset to cater for "rtsd r15,8" */
+	if (ka->sa.sa_flags & SA_RESTORER) {
+		regs->r15 = ((unsigned long)ka->sa.sa_restorer)-8;
+	} else {
+		/* addi r12, r0, __NR_sigreturn */
+		err |= __put_user(0x31800000 | __NR_rt_sigreturn ,
+				frame->tramp + 0);
+		/* brki r14, 0x8 */
+		err |= __put_user(0xb9cc0008, frame->tramp + 1);
+
+		/* Return from sighandler will jump to the tramp.
+		 Negative 8 offset because return is rtsd r15, 8 */
+		regs->r15 = ((unsigned long)frame->tramp)-8;
+
+#if 0
+		flush_cache_sigtramp((unsigned long)frame->tramp);
+#endif
+	}
+
+	if (err)
+		goto give_sigsegv;
+
+	/* Set up registers for signal handler */
+	regs->r1 = (unsigned long) frame;
+	/* Signal handler args: */
+	regs->r5 = signal; /* arg 0: signum */
+	regs->r6 = (unsigned long) &frame->info; /* arg 1: siginfo */
+	regs->r7 = (unsigned long) &frame->uc; /* arg2: ucontext */
+	/* Offset to handle microblaze rtid r14, 0 */
+	regs->pc = (unsigned long)ka->sa.sa_handler;
+
+	set_fs(USER_DS);
+
+#ifdef DEBUG_SIG
+	printk(KERN_INFO "SIG deliver (%s:%d): sp=%p pc=%08lx\n",
+		current->comm, current->pid, frame, regs->pc);
+#endif
+
+	return;
+
+give_sigsegv:
+	if (sig == SIGSEGV)
+		ka->sa.sa_handler = SIG_DFL;
+	force_sig(SIGSEGV, current);
+}
+
+/* Handle restarting system calls */
+static inline void
+handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
+{
+	switch (regs->r3) {
+	case -ERESTART_RESTARTBLOCK:
+	case -ERESTARTNOHAND:
+		if (!has_handler)
+			goto do_restart;
+		regs->r3 = -EINTR;
+		break;
+	case -ERESTARTSYS:
+		if (has_handler && !(ka->sa.sa_flags & SA_RESTART)) {
+			regs->r3 = -EINTR;
+			break;
+	}
+	/* fallthrough */
+	case -ERESTARTNOINTR:
+do_restart:
+		/* offset of 4 bytes to re-execute trap (brki) instruction */
+		regs->pc -= 4;
+		break;
+	}
+}
+
+/*
+ * OK, we're invoking a handler
+ */
+
+static void
+handle_signal(unsigned long sig, struct k_sigaction *ka,
+		siginfo_t *info, sigset_t *oldset, struct pt_regs *regs)
+{
+	/* Set up the stack frame */
+	if (ka->sa.sa_flags & SA_SIGINFO)
+		setup_rt_frame(sig, ka, info, oldset, regs);
+	else
+		setup_frame(sig, ka, oldset, regs);
+
+	if (ka->sa.sa_flags & SA_ONESHOT)
+		ka->sa.sa_handler = SIG_DFL;
+
+	if (!(ka->sa.sa_flags & SA_NODEFER)) {
+		spin_lock_irq(&current->sighand->siglock);
+		sigorsets(&current->blocked,
+				&current->blocked, &ka->sa.sa_mask);
+		sigaddset(&current->blocked, sig);
+		recalc_sigpending();
+		spin_unlock_irq(&current->sighand->siglock);
+	}
+}
+
+/*
+ * Note that 'init' is a special process: it doesn't get signals it doesn't
+ * want to handle. Thus you cannot kill init even with a SIGKILL even by
+ * mistake.
+ *
+ * Note that we go through the signals twice: once to check the signals that
+ * the kernel can handle, and then we build all the user-level signal handling
+ * stack-frames in one go after that.
+ */
+int do_signal(struct pt_regs *regs, sigset_t *oldset, int in_syscall)
+{
+	siginfo_t info;
+	int signr;
+	struct k_sigaction ka;
+#ifdef DEBUG_SIG
+	printk(KERN_INFO "do signal: %p %p %d\n", regs, oldset, in_syscall);
+	printk(KERN_INFO "do signal2: %lx %lx %ld [%lx]\n", regs->pc, regs->r1,
+			regs->r12, current_thread_info()->flags);
+#endif
+	/*
+	 * We want the common case to go fast, which
+	 * is why we may in certain cases get here from
+	 * kernel mode. Just return without doing anything
+	 * if so.
+	 */
+	if (!user_mode(regs))
+		return 1;
+
+	if (!oldset)
+		oldset = &current->blocked;
+
+	signr = get_signal_to_deliver(&info, &ka, regs, NULL);
+	if (signr > 0) {
+		/* Whee! Actually deliver the signal. */
+		if (in_syscall)
+			handle_restart(regs, &ka, 1);
+		handle_signal(signr, &ka, &info, oldset, regs);
+		return 1;
+	}
+
+	if (in_syscall)
+		handle_restart(regs, NULL, 0);
+
+	/* Did we come from a system call? */
+	return 0;
+}
diff --git a/include/asm-microblaze/signal.h b/include/asm-microblaze/signal.h
new file mode 100644
index 0000000..9121389
--- /dev/null
+++ b/include/asm-microblaze/signal.h
@@ -0,0 +1,199 @@
+/*
+ * include/asm-microblaze/signal.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.
+ *
+ * Authors:
+ * Yasushi SHOJI <yashi@atmark-techno.com>
+ * Tetsuya OHKAWA <tetsuya@atmark-techno.com>
+ */
+
+#ifndef _ASM_MICROBLAZE_SIGNAL_H
+#define _ASM_MICROBLAZE_SIGNAL_H
+
+#ifndef __ASSEMBLY__
+#include <linux/types.h>
+#include <linux/linkage.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;
+
+#else /* !__KERNEL__ */
+
+/* Here we must cater to libcs that poke about in kernel headers. */
+
+#define NSIG		32
+typedef unsigned long sigset_t;
+
+#endif /* __KERNEL__ */
+
+#endif /* __ASSEMBLY__ */
+
+#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 <asm-generic/signal.h>
+
+#ifdef __KERNEL__
+
+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;
+};
+
+#else /* !__KERNEL__ */
+
+/* Here we must cater to libcs that poke about in kernel headers. */
+
+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;
+
+#ifdef __KERNEL__
+
+#include <asm/sigcontext.h>
+#undef __HAVE_ARCH_SIG_BITOPS
+
+#define ptrace_signal_deliver(regs, cookie) do { } while (0)
+
+#endif /* __KERNEL__ */
+
+asmlinkage int sys_sigsuspend(old_sigset_t mask, struct pt_regs *regs);
+asmlinkage int sys_rt_sigsuspend(sigset_t *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 /* __ASSEMBLY__ */
+
+#endif /* _ASM_MICROBLAZE_SIGNAL_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 08/56] microblaze_v2: Interrupt handling, timer support, supported function
  2008-05-04 11:40             ` [PATCH 07/56] microblaze_v2: Signal support monstr
@ 2008-05-04 11:40               ` monstr
  2008-05-04 11:40                 ` [PATCH 09/56] microblaze_v2: cache support monstr
                                   ` (2 more replies)
  2008-05-04 19:52               ` [PATCH 07/56] microblaze_v2: Signal support Arnd Bergmann
  2008-05-05 21:32               ` Stephen Neuendorffer
  2 siblings, 3 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


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

diff --git a/arch/microblaze/kernel/hack.c b/arch/microblaze/kernel/hack.c
new file mode 100644
index 0000000..855e3c2
--- /dev/null
+++ b/arch/microblaze/kernel/hack.c
@@ -0,0 +1,82 @@
+/*
+ * arch/microblaze/kernel/hack.c
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2007 Michal Simek <monstr@monstr.eu>
+ */
+
+#include <linux/interrupt.h>
+#include <asm/hack.h>
+
+#undef DEBUG
+
+/* NOTE
+ * self-modified part of code for improvement of interrupt controller
+ * save instruction in interrupt rutine
+ */
+void function_hack(const int *arr_fce, const unsigned int base)
+{
+	unsigned int flags = 0;
+	unsigned int j, i;
+	unsigned int *addr = NULL;
+
+	local_irq_save(flags);
+	__disable_icache();
+
+	/* zero terminated array */
+	for (j = 0; arr_fce[j] != 0; j++) {
+		/* get start address of function */
+		addr = (unsigned int *) arr_fce[j];
+		pr_debug("%s: func(%d) at 0x%x\n",
+					__func__, j, (unsigned int) addr);
+		for (i = 0;; i++) {
+			pr_debug("%s: instruction code at %d: 0x%x\n",
+						__func__, i, addr[i]);
+			if (addr[i] == 0xb0001234) {
+				/* detecting of lwi or swi instruction */
+				if ((addr[i+1] & 0xec00ff00) == 0xe800ff00) {
+					pr_debug("%s: curr instr, "
+						"(%d):0x%x, "
+						"next(%d):0x%x\n",
+						 __func__, i, addr[i], i+1,
+								addr[i+1]);
+					addr[i] = 0xb0000000 + (base >> 16);
+					addr[i+1] = (addr[i+1] & 0xffff00ff) +
+							(base & 0xffff);
+					__invalidate_icache(addr[i]);
+					__invalidate_icache(addr[i+1]);
+					pr_debug("%s: hack instr, "
+						"(%d):0x%x, "
+						"next(%d):0x%x\n",
+						 __func__, i, addr[i], i+1,
+								addr[i+1]);
+				} else /* detection addik for ack */
+				if ((addr[i+1] & 0xfc00ff00) == 0x3000ff00) {
+					pr_debug("%s: curr instr, "
+						"(%d):0x%x, "
+						"next(%d):0x%x\n",
+						 __func__, i, addr[i], i+1,
+								addr[i+1]);
+					addr[i] = 0xb0000000 + (base >> 16);
+					addr[i+1] = (addr[i+1] & 0xffff00ff) +
+							(base & 0xffff);
+					__invalidate_icache(addr[i]);
+					__invalidate_icache(addr[i+1]);
+					pr_debug("%s: hack instr, "
+						"(%d):0x%x, "
+						"next(%d):0x%x\n",
+						 __func__, i, addr[i], i+1,
+								addr[i+1]);
+				}
+			} else if (addr[i] == 0xb60f0008) {
+				pr_debug("%s: end of array %d\n",
+							__func__, i);
+				break;
+			}
+		}
+	}
+	local_irq_restore(flags);
+} /* end of self-modified code */
diff --git a/arch/microblaze/kernel/intc.c b/arch/microblaze/kernel/intc.c
new file mode 100644
index 0000000..6632e82
--- /dev/null
+++ b/arch/microblaze/kernel/intc.c
@@ -0,0 +1,186 @@
+/*
+ * arch/microblaze/kernel/intc.c
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2007 Michal Simek <monstr@monstr.eu>
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+#include <linux/init.h>
+#include <linux/irq.h>
+#include <linux/autoconf.h>
+#include <asm/page.h>
+#include <asm/io.h>
+
+#include <asm/prom.h>
+#include <asm/irq.h>
+
+#ifdef CONFIG_HACK
+#include <asm/hack.h>
+#else
+static unsigned int intc_baseaddr;
+#endif
+
+unsigned int NR_IRQ;
+
+/* No one else should require these constants, so define them locally here. */
+#define ISR 0x00			/* Interrupt Status Register */
+#define IPR 0x04			/* Interrupt Pending Register */
+#define IER 0x08			/* Interrupt Enable Register */
+#define IAR 0x0c			/* Interrupt Acknowledge Register */
+#define SIE 0x10			/* Set Interrupt Enable bits */
+#define CIE 0x14			/* Clear Interrupt Enable bits */
+#define IVR 0x18			/* Interrupt Vector Register */
+#define MER 0x1c			/* Master Enable Register */
+
+#define MER_ME (1<<0)
+#define MER_HIE (1<<1)
+
+static void intc_enable(unsigned int irq)
+{
+	unsigned int mask = (0x00000001 << (irq & 31));
+	pr_debug("enable: %d\n", irq);
+#ifdef CONFIG_HACK
+	iowrite32(mask, HACK_BASE_ADDR + SIE);
+#else
+	iowrite32(mask, intc_baseaddr + SIE);
+#endif
+}
+
+static void intc_disable(unsigned int irq)
+{
+	unsigned long mask = (0x00000001 << (irq & 31));
+	pr_debug("disable: %d\n", irq);
+#ifdef CONFIG_HACK
+	iowrite32(mask, HACK_BASE_ADDR + CIE);
+#else
+	iowrite32(mask, intc_baseaddr + CIE);
+#endif
+}
+
+static void intc_disable_and_ack(unsigned int irq)
+{
+	unsigned long mask = (0x00000001 << (irq & 31));
+	pr_debug("disable_and_ack: %d\n", irq);
+#ifdef CONFIG_HACK
+	iowrite32(mask, HACK_BASE_ADDR + CIE);
+	/* ack edge triggered intr */
+	if (!(irq_desc[irq].status & IRQ_LEVEL))
+		iowrite32(mask, HACK_BASE_ADDR + IAR);
+#else
+	iowrite32(mask, intc_baseaddr + CIE);
+	/* ack edge triggered intr */
+	if (!(irq_desc[irq].status & IRQ_LEVEL))
+		iowrite32(mask, intc_baseaddr + IAR);
+#endif
+}
+
+static void intc_end(unsigned int irq)
+{
+	unsigned long mask = (0x00000001 << (irq & 31));
+
+	pr_debug("end: %d\n", irq);
+	if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
+#ifdef CONFIG_HACK
+		iowrite32(mask, HACK_BASE_ADDR + SIE);
+		/* ack level sensitive intr */
+		if (irq_desc[irq].status & IRQ_LEVEL)
+			iowrite32(mask, HACK_BASE_ADDR + IAR);
+#else
+		iowrite32(mask, intc_baseaddr + SIE);
+		/* ack level sensitive intr */
+		if (irq_desc[irq].status & IRQ_LEVEL)
+			iowrite32(mask, intc_baseaddr + IAR);
+#endif
+	}
+}
+
+static struct irq_chip intc_dev = {
+	.name = "INTC",
+	.enable = intc_enable,
+	.disable = intc_disable,
+	.ack = intc_disable_and_ack,
+	.end = intc_end,
+};
+
+unsigned int get_irq(struct pt_regs *regs)
+{
+	int irq;
+
+	/*
+	 * NOTE: This function is the one that needs to be improved in
+	 * order to handle multiple interrupt controllers. It currently
+	 * is hardcoded to check for interrupts only on the first INTC.
+	 */
+#ifdef CONFIG_HACK
+	irq = ioread32(HACK_BASE_ADDR + IVR);
+#else
+	irq = ioread32(intc_baseaddr + IVR);
+#endif
+	pr_debug("get_irq: %d\n", irq);
+
+	return irq;
+}
+
+void __init init_IRQ(void)
+{
+	int i, j = 0;
+	int handle = 0x010;
+	struct device_node *intc = NULL;
+#ifdef CONFIG_HACK
+	unsigned int intc_baseaddr = 0;
+	static int arr_func[] = {
+				(int)&get_irq,
+				(int)&intc_enable,
+				(int)&intc_disable,
+				(int)&intc_disable_and_ack,
+				(int)&intc_end,
+				0
+			};
+#endif
+	static char *intc_list[] = {
+				"xlnx,xps-intc-1.00.a",
+				"xlnx,opb-intc-1.00.c",
+				"xlnx,opb-intc-1.00.b",
+				"xlnx,opb-intc-1.00.a",
+				NULL
+			};
+
+	for (j = 0; intc_list[j] != NULL; j++) {
+		intc = of_find_compatible_node(NULL, NULL, intc_list[j]);
+		if (intc)
+			break;
+	}
+
+	intc_baseaddr = *(int *) of_get_property(intc, "reg", NULL);
+	intc_baseaddr = (unsigned long) ioremap(intc_baseaddr, PAGE_SIZE);
+	NR_IRQ = *(int *) of_get_property(intc, "xlnx,num-intr-inputs", NULL);
+#ifdef CONFIG_HACK
+	function_hack((int *) arr_func, intc_baseaddr);
+#endif
+	printk(KERN_INFO "%s #0 at 0x%08x, irq=%d\n",
+		intc_list[j], intc_baseaddr, handle);
+
+	/*
+	 * Disable all external interrupts until they are
+	 * explicity requested.
+	 */
+	iowrite32(0, intc_baseaddr + IER);
+
+	/* Acknowledge any pending interrupts just in case. */
+	iowrite32(0xffffffff, intc_baseaddr + IAR);
+
+	/* Turn on the Master Enable. */
+	iowrite32(MER_HIE|MER_ME, intc_baseaddr + MER);
+
+	for (i = 0; i < NR_IRQ; ++i) {
+		irq_desc[i].chip = &intc_dev;
+
+		if (handle & (0x00000001 << i))
+			irq_desc[i].status &= ~IRQ_LEVEL;
+		else
+			irq_desc[i].status |= IRQ_LEVEL;
+	}
+}
diff --git a/arch/microblaze/kernel/irq.c b/arch/microblaze/kernel/irq.c
new file mode 100644
index 0000000..4cd30aa
--- /dev/null
+++ b/arch/microblaze/kernel/irq.c
@@ -0,0 +1,100 @@
+/*
+ * arch/microblaze/kernel/process.c
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/hardirq.h>
+#include <linux/interrupt.h>
+#include <linux/irqflags.h>
+#include <linux/seq_file.h>
+#include <linux/kernel_stat.h>
+
+#include <asm/irq.h>
+#include <asm/prom.h>
+
+unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
+{
+	struct of_irq oirq;
+
+	if (of_irq_map_one(dev, index, &oirq))
+		return NO_IRQ;
+
+	return oirq.specifier[0];
+}
+EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
+
+/*
+ * 'what should we do if we get a hw irq event on an illegal vector'.
+ * each architecture has to answer this themselves.
+ */
+void ack_bad_irq(unsigned int irq)
+{
+	printk(KERN_WARNING "unexpected IRQ trap at vector %02x\n", irq);
+}
+
+void do_IRQ(struct pt_regs *regs)
+{
+	unsigned int irq;
+
+	irq_enter();
+	set_irq_regs(regs);
+	irq = get_irq(regs);
+	BUG_ON(irq == -1U);
+	__do_IRQ(irq);
+
+	irq_exit();
+}
+
+int show_interrupts(struct seq_file *p, void *v)
+{
+	int i = *(loff_t *) v, j;
+	struct irqaction *action;
+	unsigned long flags;
+
+	if (i == 0) {
+		seq_printf(p, "		");
+		for_each_online_cpu(j)
+			seq_printf(p, "CPU%-8d", j);
+		seq_putc(p, '\n');
+	}
+
+	if (i < NR_IRQ) {
+		spin_lock_irqsave(&irq_desc[i].lock, flags);
+		action = irq_desc[i].action;
+		if (!action)
+			goto skip;
+		seq_printf(p, "%3d: ", i);
+#ifndef CONFIG_SMP
+		seq_printf(p, "%10u ", kstat_irqs(i));
+#else
+		for_each_online_cpu(j)
+			seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
+#endif
+		seq_printf(p, " %8s", irq_desc[i].status &
+					IRQ_LEVEL ? "level": "edge");
+		seq_printf(p, " %8s", irq_desc[i].chip->name);
+		seq_printf(p, "  %s", action->name);
+
+		for (action = action->next; action; action = action->next)
+			seq_printf(p, ", %s", action->name);
+
+		seq_putc(p, '\n');
+skip:
+		spin_unlock_irqrestore(&irq_desc[i].lock, flags);
+	}
+	return 0;
+}
+
+/*unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
+{
+	printk ("ERROR %s\n",__FUNCTION__);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(irq_of_parse_and_map);*/
diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c
new file mode 100644
index 0000000..421a4f3
--- /dev/null
+++ b/arch/microblaze/kernel/timer.c
@@ -0,0 +1,164 @@
+/*
+ * arch/microblaze/kernel/timer.c
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2007 Michal Simek <monstr@monstr.eu>
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/param.h>
+#include <linux/interrupt.h>
+#include <linux/profile.h>
+#include <linux/irq.h>
+#include <asm/io.h>
+#include <asm/cpuinfo.h>
+#include <asm/setup.h>
+
+#include <asm/prom.h>
+#include <asm/irq.h>
+
+#ifdef CONFIG_HACK
+#include <asm/hack.h>
+#else
+static unsigned int timer_baseaddr;
+#endif
+
+#define TCSR0	(0x00)
+#define TLR0	(0x04)
+#define TCR0	(0x08)
+#define TCSR1	(0x10)
+#define TLR1	(0x14)
+#define TCR1	(0x18)
+
+#define TCSR_MDT	(1<<0)
+#define TCSR_UDT	(1<<1)
+#define TCSR_GENT	(1<<2)
+#define TCSR_CAPT	(1<<3)
+#define TCSR_ARHT	(1<<4)
+#define TCSR_LOAD	(1<<5)
+#define TCSR_ENIT	(1<<6)
+#define TCSR_ENT	(1<<7)
+#define TCSR_TINT	(1<<8)
+#define TCSR_PWMA	(1<<9)
+#define TCSR_ENALL	(1<<10)
+
+static void timer_ack(void)
+{
+#ifdef CONFIG_HACK
+	iowrite32(ioread32(HACK_BASE_ADDR + TCSR0), HACK_BASE_ADDR + TCSR0);
+#else
+	iowrite32(ioread32(timer_baseaddr + TCSR0), timer_baseaddr + TCSR0);
+#endif
+}
+
+irqreturn_t timer_interrupt(int irq, void *dev_id)
+{
+#ifdef CONFIG_HEART_BEAT
+	heartbeat();
+#endif
+	timer_ack();
+
+	write_seqlock(&xtime_lock);
+
+	do_timer(1);
+	update_process_times(user_mode(get_irq_regs()));
+	profile_tick(CPU_PROFILING);
+
+	write_sequnlock(&xtime_lock);
+
+	return IRQ_HANDLED;
+}
+
+static struct irqaction timer_irqaction = {
+	.handler = timer_interrupt,
+	.flags = IRQF_DISABLED,
+	.name = "timer",
+};
+
+unsigned long do_gettimeoffset(void)
+{
+#ifdef CONFIG_HACK
+	/* Current counter value */
+	unsigned int tcr = ioread32(HACK_BASE_ADDR + TCR0);
+
+	/* Load register value (couting down */
+	unsigned int tcmp = ioread32(HACK_BASE_ADDR + TLR0);
+#else
+	/* Current counter value */
+	unsigned int tcr = ioread32(timer_baseaddr + TCR0);
+
+	/* Load register value (couting down */
+	unsigned int tcmp = ioread32(timer_baseaddr + TLR0);
+#endif
+
+	/* Offset, in nanoseconds */
+	/* FIXME remove loading from structure - build in is faster */
+	unsigned long offset = (tcmp-tcr)/(cpuinfo.cpu_clock_freq/1000000);
+
+	return offset;
+}
+
+void system_timer_init(void)
+{
+	int irq, j = 0;
+	struct device_node *timer = NULL;
+#ifdef CONFIG_HACK
+	unsigned int timer_baseaddr = 0;
+	int arr_func[] = {
+				(int)&do_gettimeoffset,
+				(int)&timer_ack,
+				0
+			};
+#endif
+	char *timer_list[] = {
+				"xlnx,xps-timer-1.00.a",
+				"xlnx,opb-timer-1.00.b",
+				"xlnx,opb-timer-1.00.a",
+				NULL
+			};
+
+	for (j = 0; timer_list[j] != NULL; j++) {
+		timer = of_find_compatible_node(NULL, NULL, timer_list[j]);
+		if (timer)
+			break;
+	}
+
+	timer_baseaddr = *(int *) of_get_property(timer, "reg", NULL);
+	timer_baseaddr = (unsigned long) ioremap(timer_baseaddr, PAGE_SIZE);
+	irq = *(int *) of_get_property(timer, "interrupts", NULL);
+#ifdef CONFIG_HACK
+	function_hack((int *) arr_func, timer_baseaddr);
+#endif
+	printk(KERN_INFO "%s #0 at 0x%08x, irq=%d\n",
+		timer_list[j], timer_baseaddr, irq);
+
+	/* set the initial value to the load register */
+	iowrite32(cpuinfo.cpu_clock_freq/HZ, timer_baseaddr + TLR0);
+
+	/* load the initial value */
+	iowrite32(TCSR_LOAD, timer_baseaddr + TCSR0);
+
+	/* see timer data sheet for detail
+	 * !ENALL - don't enable 'em all
+	 * !PWMA - disable pwm
+	 * TINT - clear interrupt status
+	 * ENT- enable timer itself
+	 * EINT - enable interrupt
+	 * !LOAD - clear the bit to let go
+	 * ARHT - auto reload
+	 * !CAPT - no external trigger
+	 * !GENT - no external signal
+	 * UDT - set the timer as down counter
+	 * !MDT0 - generate mode
+	 *
+	 */
+	iowrite32(TCSR_TINT|TCSR_ENT|TCSR_ENIT|TCSR_ARHT|TCSR_UDT,
+			timer_baseaddr + TCSR0);
+
+	setup_irq(irq, &timer_irqaction);
+}
diff --git a/include/asm-microblaze/hack.h b/include/asm-microblaze/hack.h
new file mode 100644
index 0000000..b0ea20a
--- /dev/null
+++ b/include/asm-microblaze/hack.h
@@ -0,0 +1,24 @@
+/*
+ * include/asm-microblaze/hack.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2007 Michal Simek <monstr@monstr.eu>
+ */
+
+#ifndef _ASM_MICROBLAZE_HACK_H
+#define _ASM_MICROBLAZE_HACK_H
+
+/*
+ * HACK_BASE_ADDR is constant address for hack function.
+ * do not change this value - it is hardcoded in hack function
+ * arch/microblaze/kernel/hack.c:function_hack()
+ */
+
+#define HACK_BASE_ADDR	0x1234ff00
+
+void function_hack(const int *arr_fce, const unsigned int base);
+
+#endif /* _ASM_MICROBLAZE_HACK_H */
diff --git a/include/asm-microblaze/irq.h b/include/asm-microblaze/irq.h
new file mode 100644
index 0000000..89e0f87
--- /dev/null
+++ b/include/asm-microblaze/irq.h
@@ -0,0 +1,44 @@
+/*
+ * include/asm-microblaze/irq.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_IRQ_H
+#define _ASM_MICROBLAZE_IRQ_H
+
+#include <linux/seq_file.h>
+#define NR_IRQS 32
+#include <linux/irq.h>
+
+extern unsigned int NR_IRQ;
+extern void ledoff(void);
+
+#define NO_IRQ (-1)
+
+static inline int irq_canonicalize(int irq)
+{
+	return (irq);
+}
+
+struct pt_regs;
+extern void do_IRQ(struct pt_regs *regs);
+extern void __init init_IRQ(void);
+int show_interrupts(struct seq_file *p, void *v);
+irqreturn_t timer_interrupt(int irq, void *dev_id);
+
+/* 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);
+
+#endif /* _ASM_MICROBLAZE_IRQ_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 09/56] microblaze_v2: cache support
  2008-05-04 11:40               ` [PATCH 08/56] microblaze_v2: Interrupt handling, timer support, supported function monstr
@ 2008-05-04 11:40                 ` monstr
  2008-05-04 11:40                   ` [PATCH 10/56] microblaze_v2: Generic dts file for platforms monstr
                                     ` (3 more replies)
  2008-05-05  1:58                 ` [PATCH 08/56] microblaze_v2: Interrupt handling, timer support, supported function John Williams
  2008-05-07  7:04                 ` Thomas Gleixner
  2 siblings, 4 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


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

diff --git a/arch/microblaze/kernel/cpu/cache.c b/arch/microblaze/kernel/cpu/cache.c
new file mode 100644
index 0000000..d6a1eab
--- /dev/null
+++ b/arch/microblaze/kernel/cpu/cache.c
@@ -0,0 +1,256 @@
+/*
+ * arch/microblaze/kernel/cpu/cache.c
+ * Cache control for MicroBlaze cache memories
+ *
+ * Copyright (C) 2007 Michal Simek <monstr@monstr.eu>
+ * Copyright (C) 2007 PetaLogix
+ * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ */
+
+#include <asm/cacheflush.h>
+#include <asm/cache.h>
+#include <asm/cpuinfo.h>
+
+/* Exported functions */
+
+void _enable_icache(void)
+{
+	if (cpuinfo.use_icache) {
+#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
+		__asm__ __volatile__ ("					\
+				msrset	r0, %0;				\
+				nop; "					\
+				:					\
+				: "i" (MSR_ICE)				\
+				: "memory");
+#else
+		__asm__ __volatile__ ("					\
+				mfs	r12, rmsr;			\
+				ori	r12, r12, %0;			\
+				mts	rmsr, r12;			\
+				nop; "					\
+				:					\
+				: "i" (MSR_ICE)				\
+				: "memory", "r12");
+#endif
+	}
+}
+
+void _disable_icache(void)
+{
+	if (cpuinfo.use_icache) {
+#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
+		__asm__ __volatile__ ("					\
+				msrclr r0, %0;				\
+				nop; "					\
+				:					\
+				: "i" (MSR_ICE)				\
+				: "memory");
+#else
+		__asm__ __volatile__ ("					\
+				mfs	r12, rmsr;			\
+				andi	r12, r12, ~%0;			\
+				mts	rmsr, r12;			\
+				nop; "					\
+				:					\
+				: "i" (MSR_ICE)				\
+				: "memory", "r12");
+#endif
+	}
+}
+
+void _invalidate_icache(unsigned int addr)
+{
+	if (cpuinfo.use_icache) {
+		__asm__ __volatile__ ("					\
+				wic	%0, r0"				\
+				:					\
+				: "r" (addr));
+	}
+}
+
+void _enable_dcache(void)
+{
+	if (cpuinfo.use_dcache) {
+#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
+		__asm__ __volatile__ ("					\
+				msrset	r0, %0;				\
+				nop; "					\
+				:					\
+				: "i" (MSR_DCE)				\
+				: "memory");
+#else
+		__asm__ __volatile__ ("					\
+				mfs	r12, rmsr;			\
+				ori	r12, r12, %0;			\
+				mts	rmsr, r12;			\
+				nop; "					\
+				:					\
+				: "i" (MSR_DCE)			\
+				: "memory", "r12");
+#endif
+	}
+}
+
+void _disable_dcache(void)
+{
+	if (cpuinfo.use_dcache) {
+#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
+		__asm__ __volatile__ ("					\
+				msrclr	r0, %0;				\
+				nop; "					\
+				:					\
+				: "i" (MSR_DCE)			\
+				: "memory");
+#else
+		__asm__ __volatile__ ("					\
+				mfs	r12, rmsr;			\
+				andi	r12, r12, ~%0;			\
+				mts	rmsr, r12;			\
+				nop; "					\
+				:					\
+				: "i" (MSR_DCE)			\
+				: "memory", "r12");
+#endif
+	}
+}
+
+void _invalidate_dcache(unsigned int addr)
+{
+	if (cpuinfo.use_dcache)
+		__asm__ __volatile__ ("					\
+				wdc	%0, r0"				\
+				:					\
+				: "r" (addr));
+}
+
+void __flush_icache_all(void)
+{
+	unsigned int i;
+	unsigned flags;
+
+	if (cpuinfo.use_icache) {
+		local_irq_save(flags);
+		__disable_icache();
+
+		/* Just loop through cache size and invalidate, no need to add
+			CACHE_BASE address */
+		for (i = 0; i < cpuinfo.icache_size;
+			i += cpuinfo.icache_line)
+				__invalidate_icache(i);
+
+		__enable_icache();
+		local_irq_restore(flags);
+	}
+}
+
+void __flush_icache_range(unsigned long start, unsigned long end)
+{
+	unsigned int i;
+	unsigned flags;
+	unsigned int align;
+
+	if (cpuinfo.use_icache) {
+		/*
+		 * No need to cover entire cache range,
+		 * just cover cache footprint
+		 */
+		end = min(start + cpuinfo.icache_size, end);
+		align = ~(cpuinfo.icache_line - 1);
+		start &= align; /* Make sure we are aligned */
+		/* Push end up to the next cache line */
+		end = ((end & align) + cpuinfo.icache_line);
+
+		local_irq_save(flags);
+		__disable_icache();
+
+		for (i = start; i < end; i += cpuinfo.icache_line)
+			__invalidate_icache(i);
+
+		__enable_icache();
+		local_irq_restore(flags);
+	}
+}
+
+void __flush_icache_page(struct vm_area_struct *vma, struct page *page)
+{
+	__flush_icache_all();
+}
+
+void __flush_icache_user_range(struct vm_area_struct *vma,
+				struct page *page, unsigned long adr,
+				int len)
+{
+	__flush_icache_all();
+}
+
+void __flush_cache_sigtramp(unsigned long addr)
+{
+	__flush_icache_range(addr, addr + 8);
+}
+
+void __flush_dcache_all(void)
+{
+	unsigned int i;
+	unsigned flags;
+
+	if (cpuinfo.use_dcache) {
+		local_irq_save(flags);
+		__disable_dcache();
+
+		/*
+		 * Just loop through cache size and invalidate,
+		 * no need to add CACHE_BASE address
+		 */
+		for (i = 0; i < cpuinfo.dcache_size;
+			i += cpuinfo.dcache_line)
+				__invalidate_dcache(i);
+
+		__enable_dcache();
+		local_irq_restore(flags);
+	}
+}
+
+void __flush_dcache_range(unsigned long start, unsigned long end)
+{
+	unsigned int i;
+	unsigned flags;
+	unsigned int align;
+
+	if (cpuinfo.use_dcache) {
+		/*
+		 * No need to cover entire cache range,
+		 * just cover cache footprint
+		 */
+		end = min(start + cpuinfo.dcache_size, end);
+		align = ~(cpuinfo.dcache_line - 1);
+		start &= align; /* Make sure we are aligned */
+		/* Push end up to the next cache line */
+		end = ((end & align) + cpuinfo.dcache_line);
+		local_irq_save(flags);
+		__disable_dcache();
+
+		for (i = start; i < end; i += cpuinfo.dcache_line)
+			__invalidate_dcache(i);
+
+		__enable_dcache();
+		local_irq_restore(flags);
+	}
+}
+
+void __flush_dcache_page(struct vm_area_struct *vma, struct page *page)
+{
+	__flush_dcache_all();
+}
+
+void __flush_dcache_user_range(struct vm_area_struct *vma,
+				struct page *page, unsigned long adr,
+				int len)
+{
+	__flush_dcache_all();
+}
diff --git a/include/asm-microblaze/cache.h b/include/asm-microblaze/cache.h
new file mode 100644
index 0000000..6aa1abd
--- /dev/null
+++ b/include/asm-microblaze/cache.h
@@ -0,0 +1,47 @@
+/*
+ * include/asm-microblaze/cache.h
+ *
+ * Cache operations
+ *
+ * Copyright (C) 2007 Michal Simek <monstr@monstr.eu>
+ * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ */
+
+#ifndef _ASM_MICROBLAZE_CACHE_H
+#define _ASM_MICROBLAZE_CACHE_H
+
+#include <asm/registers.h>
+#include <linux/autoconf.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 */
diff --git a/include/asm-microblaze/cacheflush.h b/include/asm-microblaze/cacheflush.h
new file mode 100644
index 0000000..ba7339d
--- /dev/null
+++ b/include/asm-microblaze/cacheflush.h
@@ -0,0 +1,72 @@
+/*
+ * include/asm-microblaze/cacheflush.h
+ *
+ * Copyright (C) 2007 PetaLogix
+ * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
+ * based on v850 version which was
+ * Copyright (C) 2001,02,03 NEC Electronics Corporation
+ * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ */
+
+#ifndef _ASM_MICROBLAZE_CACHEFLUSH_H
+#define _ASM_MICROBLAZE_CACHEFLUSH_H
+
+/* Somebody depends on this; sigh... */
+#include <linux/mm.h>
+
+#define flush_cache_all()			__flush_cache_all()
+#define flush_cache_mm(mm)			do { } while (0)
+#define flush_cache_range(vma, start, end)	__flush_cache_all()
+#define flush_cache_page(vma, vmaddr, pfn)	do { } while (0)
+
+#define flush_dcache_range(start, end)	__flush_dcache_range(start, end)
+#define flush_dcache_page(page)		do { } while (0)
+#define flush_dcache_mmap_lock(mapping)		do { } while (0)
+#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
+
+#define flush_icache_range(start, len)	__flush_icache_range(start, len)
+#define flush_icache_page(vma, pg)		do { } while (0)
+#define flush_icache_user_range(start, len)	do { } while (0)
+
+#define flush_cache_vmap(start, end)		do { } while (0)
+#define flush_cache_vunmap(start, end)		do { } while (0)
+
+struct page;
+struct mm_struct;
+struct vm_area_struct;
+
+/* see arch/microblaze/kernel/cache.c */
+extern void __flush_icache_all(void);
+extern void __flush_icache_range(unsigned long start, unsigned long end);
+extern void __flush_icache_page(struct vm_area_struct *vma, struct page *page);
+extern void __flush_icache_user_range(struct vm_area_struct *vma,
+				struct page *page,
+				unsigned long adr, int len);
+extern void __flush_cache_sigtramp(unsigned long addr);
+
+extern void __flush_dcache_all(void);
+extern void __flush_dcache_range(unsigned long start, unsigned long end);
+extern void __flush_dcache_page(struct vm_area_struct *vma, struct page *page);
+extern void __flush_dcache_user_range(struct vm_area_struct *vma,
+				struct page *page,
+				unsigned long adr, int len);
+
+extern inline void __flush_cache_all(void)
+{
+	__flush_icache_all();
+	__flush_dcache_all();
+}
+
+#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
+do { memcpy(dst, src, len); \
+	flush_icache_user_range(vma, page, vaddr, len); \
+} while (0)
+#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
+	memcpy(dst, src, len)
+
+#endif /* _ASM_MICROBLAZE_CACHEFLUSH_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 10/56] microblaze_v2: Generic dts file for platforms
  2008-05-04 11:40                 ` [PATCH 09/56] microblaze_v2: cache support monstr
@ 2008-05-04 11:40                   ` monstr
  2008-05-04 11:41                     ` [PATCH 11/56] microblaze_v2: kernel modules support monstr
                                       ` (2 more replies)
  2008-05-05  2:09                   ` [PATCH 09/56] microblaze_v2: cache support John Williams
                                     ` (2 subsequent siblings)
  3 siblings, 3 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


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

diff --git a/arch/microblaze/platform/generic/system.dts b/arch/microblaze/platform/generic/system.dts
new file mode 100644
index 0000000..91eac31
--- /dev/null
+++ b/arch/microblaze/platform/generic/system.dts
@@ -0,0 +1,137 @@
+/*
+ * (C) Copyright 2007 Michal Simek
+ *
+ * Michal SIMEK <monstr@monstr.eu>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ * CAUTION: This file is automatically generated by libgen.
+ * Version: Xilinx EDK 9.2 EDK_Jm.16
+ * Generate by U-BOOT v4.00.b
+ */
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+	compatible = "ibm,opb";
+	model = "testing";
+	DDR_SDRAM_32Mx16: memory@44000000 {
+		device_type = "memory";
+		reg = < 44000000 2000000 >;
+	} ;
+	chosen {
+		bootargs = "root=mtdblock0";
+	} ;
+	cpus {
+		#address-cells = <1>;
+		#cpus = <1>;
+		#size-cells = <0>;
+		microblaze,5.00.c@0 {
+			clock-frequency = <3f940ab>;
+			d-cache-baseaddr = <44000000>;
+			d-cache-highaddr = <47ffffff>;
+			d-cache-line-size = <10>;
+			d-cache-size = <2000>;
+			device_type = "cpu";
+			i-cache-baseaddr = <44000000>;
+			i-cache-highaddr = <47ffffff>;
+			i-cache-line-size = <10>;
+			i-cache-size = <2000>;
+			reg = <0>;
+			timebase-frequency = <3f940ab>;
+			xlnx,addr-tag-bits = <d>;
+			xlnx,allow-dcache-wr = <1>;
+			xlnx,allow-icache-wr = <1>;
+			xlnx,cache-byte-size = <2000>;
+			xlnx,d-lmb = <1>;
+			xlnx,d-opb = <1>;
+			xlnx,data-size = <20>;
+			xlnx,dcache-addr-tag = <d>;
+			xlnx,dcache-byte-size = <2000>;
+			xlnx,dcache-line-len = <4>;
+			xlnx,dcache-use-fsl = <1>;
+			xlnx,debug-enabled = <1>;
+			xlnx,div-zero-exception = <0>;
+			xlnx,dopb-bus-exception = <0>;
+			xlnx,dynamic-bus-sizing = <1>;
+			xlnx,edge-is-positive = <1>;
+			xlnx,fpu-exception = <0>;
+			xlnx,fsl-data-size = <20>;
+			xlnx,fsl-links = <1>;
+			xlnx,i-lmb = <1>;
+			xlnx,i-opb = <1>;
+			xlnx,icache-line-len = <4>;
+			xlnx,icache-use-fsl = <1>;
+			xlnx,ill-opcode-exception = <0>;
+			xlnx,instance = "microblaze_0";
+			xlnx,interrupt-is-edge = <0>;
+			xlnx,iopb-bus-exception = <0>;
+			xlnx,number-of-pc-brk = <2>;
+			xlnx,number-of-rd-addr-brk = <0>;
+			xlnx,number-of-wr-addr-brk = <0>;
+			xlnx,opcode-0x0-illegal = <0>;
+			xlnx,pvr = <2>;
+			xlnx,pvr-user1 = <0>;
+			xlnx,pvr-user2 = <0>;
+			xlnx,reset-msr = <0>;
+			xlnx,sco = <0>;
+			xlnx,unaligned-exceptions = <0>;
+			xlnx,use-barrel = <1>;
+			xlnx,use-dcache = <1>;
+			xlnx,use-div = <1>;
+			xlnx,use-fpu = <0>;
+			xlnx,use-hw-mul = <1>;
+			xlnx,use-icache = <1>;
+			xlnx,use-msr-instr = <1>;
+			xlnx,use-pcmp-instr = <1>;
+		} ;
+	} ;
+	opb_v20 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "xlnx,opb-v20-1.10.c", "xlnx,opb-v20";
+		RS232_DTE: serial@40600000 {
+			compatible = "xlnx,opb-uartlite-1.00.b", "xlnx,opb-uartlite", "xilinx,uartlite";
+			interrupt-parent = <&opb_intc_0>;
+			interrupts = < 2 0 >;
+			reg = < 40600000 10000 >;
+			xlnx,baudrate = <1c200>;
+			xlnx,clk-freq = <3f940ab>;
+			xlnx,data-bits = <8>;
+			xlnx,odd-parity = <0>;
+			xlnx,use-parity = <0>;
+		} ;
+		opb_intc_0: interrupt-controller@41200000 {
+			#interrupt-cells = <2>;
+			compatible = "xlnx,opb-intc-1.00.c", "xlnx,opb-intc";
+			interrupt-controller ;
+			reg = < 41200000 10000 >;
+			xlnx,num-intr-inputs = <5>;
+		} ;
+		opb_timer_0: opb-timer@41c00000 {
+			compatible = "xlnx,opb-timer-1.00.b", "xlnx,opb-timer";
+			interrupt-parent = <&opb_intc_0>;
+			interrupts = < 0 0 >;
+			reg = < 41c00000 10000 >;
+			xlnx,count-width = <20>;
+			xlnx,gen0-assert = <1>;
+			xlnx,gen1-assert = <1>;
+			xlnx,one-timer-only = <1>;
+			xlnx,trig0-assert = <1>;
+			xlnx,trig1-assert = <1>;
+		} ;
+	} ;
+}  ;
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 11/56] microblaze_v2: kernel modules support
  2008-05-04 11:40                   ` [PATCH 10/56] microblaze_v2: Generic dts file for platforms monstr
@ 2008-05-04 11:41                     ` monstr
  2008-05-04 11:41                       ` [PATCH 12/56] microblaze_v2: lmb support monstr
  2008-05-05 14:31                     ` [PATCH 10/56] microblaze_v2: Generic dts file for platforms Grant Likely
  2008-05-05 17:25                     ` Stephen Neuendorffer
  2 siblings, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


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

diff --git a/arch/microblaze/kernel/microblaze_ksyms.c b/arch/microblaze/kernel/microblaze_ksyms.c
new file mode 100644
index 0000000..3efa1a1
--- /dev/null
+++ b/arch/microblaze/kernel/microblaze_ksyms.c
@@ -0,0 +1,49 @@
+/*
+ * arch/microblaze/kernel/microblaze_ksyms.c
+ *
+ * Copyright (C) 2008 Michal Simek <monstr@monstr.eu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/module.h>
+#include <linux/string.h>
+#include <linux/cryptohash.h>
+#include <linux/delay.h>
+#include <linux/in6.h>
+#include <linux/syscalls.h>
+
+#include <asm/checksum.h>
+#include <asm/io.h>
+#include <asm/page.h>
+#include <asm/system.h>
+#include <asm/uaccess.h>
+
+/*
+ * libgcc functions - functions that are used internally by the
+ * compiler... (prototypes are not correct though, but that
+ * doesn't really matter since they're not versioned).
+ */
+extern void __ashldi3(void);
+EXPORT_SYMBOL(__ashldi3);
+extern void __ashrdi3(void);
+EXPORT_SYMBOL(__ashrdi3);
+extern void __divsi3(void);
+EXPORT_SYMBOL(__divsi3);
+extern void __lshrdi3(void);
+EXPORT_SYMBOL(__lshrdi3);
+extern void __modsi3(void);
+EXPORT_SYMBOL(__modsi3);
+extern void __mulsi3(void);
+EXPORT_SYMBOL(__mulsi3);
+extern void __muldi3(void);
+EXPORT_SYMBOL(__muldi3);
+extern void __ucmpdi2(void);
+EXPORT_SYMBOL(__ucmpdi2);
+extern void __udivsi3(void);
+EXPORT_SYMBOL(__udivsi3);
+extern void __umodsi3(void);
+EXPORT_SYMBOL(__umodsi3);
+/*extern void fpundefinstr(void);
+extern void fp_enter(void);*/
diff --git a/arch/microblaze/kernel/module.c b/arch/microblaze/kernel/module.c
new file mode 100644
index 0000000..efef0ba
--- /dev/null
+++ b/arch/microblaze/kernel/module.c
@@ -0,0 +1,149 @@
+/*
+ * linux/arch/microblaze/kernel/module.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+#include <linux/module.h>
+#include <linux/moduleloader.h>
+#include <linux/kernel.h>
+#include <linux/elf.h>
+#include <linux/vmalloc.h>
+#include <linux/slab.h>
+#include <linux/fs.h>
+#include <linux/string.h>
+
+#include <asm/pgtable.h>
+
+#if 0
+#define DBPRINTK(...) printk(__VA_ARGS__)
+#else
+#define DBPRINTK(...)
+#endif
+
+void *module_alloc(unsigned long size)
+{
+	void *ret;
+	ret = (size == 0) ? NULL : vmalloc(size);
+	DBPRINTK("module_alloc (%08lx@%08lx)\n", size, (unsigned long int)ret);
+	return ret;
+}
+
+void module_free(struct module *module, void *region)
+{
+	DBPRINTK("module_free(%s,%08lx)\n", module->name, region);
+	vfree(region);
+}
+
+int module_frob_arch_sections(Elf_Ehdr *hdr,
+				Elf_Shdr *sechdrs,
+				char *secstrings,
+				struct module *mod)
+{
+	return 0;
+}
+
+int
+apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
+		unsigned int relsec, struct module *module)
+{
+
+	printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n",
+		module->name);
+	return -ENOEXEC;
+
+}
+
+int
+apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
+	unsigned int symindex, unsigned int relsec, struct module *module)
+{
+
+	unsigned int i;
+	Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr;
+	Elf32_Sym *sym;
+	unsigned long int *location;
+	unsigned long int locoffs;
+	unsigned long int value;
+	unsigned long int old_value;
+
+	DBPRINTK("Applying add relocation section %u to %u\n",
+		relsec, sechdrs[relsec].sh_info);
+
+	for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rela); i++) {
+
+		location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr +
+				rela[i].r_offset;
+		sym = (Elf32_Sym *)sechdrs[symindex].sh_addr +
+			ELF32_R_SYM(rela[i].r_info);
+		value = sym->st_value + rela[i].r_addend;
+
+		switch (ELF32_R_TYPE(rela[i].r_info)) {
+
+		/*
+		 * Be careful! mb-gcc / mb-ld splits the relocs between the
+		 * text and the reloc table. In general this means we must
+		 * read the current contents of (*location), add any offset
+		 * then store the result back in
+		 */
+
+		case R_MICROBLAZE_32:
+			old_value = *location;
+			*location = value + old_value;
+			DBPRINTK("R_MICROBLAZE_32 (%08lx->%08lx)\n",
+				old_value, value);
+			break;
+
+		case R_MICROBLAZE_64:
+			old_value = ((location[0] & 0x0000FFFF) << 16) |
+				((location[1] & 0x0000FFFF));
+			value += old_value;
+			location[0] = (location[0] & 0xFFFF0000) |
+					(value >> 16);
+			location[1] = (location[1] & 0xFFFF0000) |
+					(value & 0xFFFF);
+			DBPRINTK("R_MICROBLAZE_64 (%08lx->%08lx)\n",
+				old_value, value);
+			break;
+
+		case R_MICROBLAZE_64_PCREL:
+			locoffs = (location[0] & 0xFFFF) << 16 |
+				(location[1] & 0xFFFF);
+			value -= (unsigned long int)(location) + 4 +
+				locoffs;
+			location[0] = (location[0] & 0xFFFF0000) |
+					(value >> 16);
+			location[1] = (location[1] & 0xFFFF0000) |
+					(value & 0xFFFF);
+			DBPRINTK("R_MICROBLAZE_64_PCREL (%08lx)\n",
+				value);
+			break;
+
+		case R_MICROBLAZE_NONE:
+			DBPRINTK("R_MICROBLAZE_NONE\n");
+			break;
+
+		default:
+			printk(KERN_ERR "module %s: "
+				"Unknown relocation: %u\n",
+				module->name,
+				ELF32_R_TYPE(rela->r_info));
+			return -ENOEXEC;
+		}
+	}
+	return 0;
+}
+
+int
+module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs,
+		struct module *module)
+{
+	return 0;
+}
+
+void
+module_arch_cleanup(struct module *mod)
+{
+}
diff --git a/include/asm-microblaze/module.h b/include/asm-microblaze/module.h
new file mode 100644
index 0000000..8ee1bba
--- /dev/null
+++ b/include/asm-microblaze/module.h
@@ -0,0 +1,41 @@
+/*
+ * include/asm-microblaze/module.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_MODULE_H
+#define _ASM_MICROBLAZE_MODULE_H
+
+#define EM_XILINX_MICROBLAZE 0xbaab
+
+/* 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 */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 12/56] microblaze_v2: lmb support
  2008-05-04 11:41                     ` [PATCH 11/56] microblaze_v2: kernel modules support monstr
@ 2008-05-04 11:41                       ` monstr
  2008-05-04 11:41                         ` [PATCH 13/56] microblaze_v2: PVR support, cpuinfo support monstr
  2008-05-05  2:11                         ` [PATCH 12/56] microblaze_v2: lmb support John Williams
  0 siblings, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


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

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


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 13/56] microblaze_v2: PVR support, cpuinfo support
  2008-05-04 11:41                       ` [PATCH 12/56] microblaze_v2: lmb support monstr
@ 2008-05-04 11:41                         ` monstr
  2008-05-04 11:41                           ` [PATCH 14/56] microblaze_v2: defconfig file monstr
  2008-05-05  2:14                           ` [PATCH 13/56] microblaze_v2: PVR support, cpuinfo support John Williams
  2008-05-05  2:11                         ` [PATCH 12/56] microblaze_v2: lmb support John Williams
  1 sibling, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


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

diff --git a/arch/microblaze/kernel/cpu/mb.c b/arch/microblaze/kernel/cpu/mb.c
new file mode 100644
index 0000000..44a911c
--- /dev/null
+++ b/arch/microblaze/kernel/cpu/mb.c
@@ -0,0 +1,115 @@
+/*
+ * arch/microblaze/kernel/cpu/mb.c
+ *
+ * CPU-version specific code
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2007 Michal Simek <monstr@monstr.eu>
+ * Copyright (C) 2006 PetaLogix
+ */
+
+#include <linux/init.h>
+#include <linux/string.h>
+#include <linux/seq_file.h>
+#include <linux/cpu.h>
+#include <linux/initrd.h>
+
+#include <asm/cpuinfo.h>
+#include <asm/setup.h>
+#include <asm/sections.h>
+#include <asm/page.h>
+#include <asm/io.h>
+#include <asm/bug.h>
+#include <asm/param.h>
+
+static int show_cpuinfo(struct seq_file *m, void *v)
+{
+	int count = 0;
+	char *fpga_family = "Unknown";
+	char *cpu_ver = "Unknown";
+	int i;
+
+	/* Denormalised to get the fpga family string */
+	for (i = 0; family_string_lookup[i].s != NULL; i++) {
+		if (cpuinfo.fpga_family_code == family_string_lookup[i].k) {
+			fpga_family = (char *)family_string_lookup[i].s;
+			break;
+		}
+	}
+
+	/* Denormalised to get the hw version string */
+	for (i = 0; cpu_ver_lookup[i].s != NULL; i++) {
+		if (cpuinfo.ver_code == cpu_ver_lookup[i].k) {
+			cpu_ver = (char *)cpu_ver_lookup[i].s;
+			break;
+		}
+	}
+
+	count = seq_printf(m,
+			"CPU-Family:	MicroBlaze\n"
+			"FPGA-Arch:	%s\n"
+			"CPU-Ver:	%s\n"
+			"CPU-MHz:	%d.%02d\n"
+			"BogoMips:	%lu.%02lu\n",
+			fpga_family,
+			cpu_ver,
+			cpuinfo.cpu_clock_freq /
+			1000000,
+			cpuinfo.cpu_clock_freq %
+			1000000,
+			loops_per_jiffy / (500000 / HZ),
+			(loops_per_jiffy / (5000 / HZ)) % 100);
+
+	count += seq_printf(m,
+			"HW-Div:\t\t%s\n"
+			"HW-Shift:\t%s\n",
+			cpuinfo.use_divider ? "yes" : "no",
+			cpuinfo.use_barrel ? "yes" : "no");
+
+	if (cpuinfo.use_icache)
+		count += seq_printf(m,
+				"Icache:\t\t%ukB\n",
+				cpuinfo.icache_size >> 10);
+	else
+		count += seq_printf(m, "Icache:\t\tno\n");
+
+	if (cpuinfo.use_dcache)
+		count += seq_printf(m,
+				"Dcache:\t\t%ukB\n",
+				cpuinfo.dcache_size >> 10);
+	else
+		count += seq_printf(m, "Dcache:\t\tno\n");
+
+	count += seq_printf(m,
+			"HW-Debug:\t%s\n",
+			cpuinfo.hw_debug ? "yes" : "no");
+
+	return 0;
+}
+
+static void *c_start(struct seq_file *m, loff_t *pos)
+{
+	int i = *pos;
+
+	return i < NR_CPUS ? (void *) (i + 1) : NULL;
+}
+
+static void *c_next(struct seq_file *m, void *v, loff_t *pos)
+{
+	++*pos;
+	return c_start(m, pos);
+}
+
+static void c_stop(struct seq_file *m, void *v)
+{
+}
+
+struct seq_operations cpuinfo_op = {
+	.start = c_start,
+	.next = c_next,
+	.stop = c_stop,
+	.show = show_cpuinfo,
+};
diff --git a/arch/microblaze/kernel/cpu/pvr.c b/arch/microblaze/kernel/cpu/pvr.c
new file mode 100644
index 0000000..19d99a8
--- /dev/null
+++ b/arch/microblaze/kernel/cpu/pvr.c
@@ -0,0 +1,83 @@
+/*
+ * arch/microblaze/kernel/cpu/pvr.c
+ *
+ * Support for MicroBlaze PVR (processor version register)
+ *
+ * Copyright (C) 2007 Michal Simek <monstr@monstr.eu>
+ * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
+ * Copyright (C) 2007 PetaLogix
+ */
+
+#include <linux/kernel.h>
+#include <linux/compiler.h>
+#include <asm/system.h>
+#include <asm/exceptions.h>
+#include <asm/pvr.h>
+
+/*
+ * Until we get an assembler that knows about the pvr registers,
+ * this horrible cruft will have to do.
+ * That hardcoded opcode is mfs r3, rpvrNN
+ */
+
+#define get_single_pvr(pvrid, val)				\
+{								\
+	register unsigned tmp __asm__("r3");			\
+	tmp = 0x0;	/* Prevent warning about unused */	\
+	__asm__ __volatile__ (					\
+			".byte 0x94,0x60,0xa0, " #pvrid "\n\t"	\
+			: "=r" (tmp):: "memory"); 		\
+	val = tmp;						\
+}
+
+/*
+ * Does the CPU support the PVR register?
+ * return value:
+ * 0: no PVR
+ * 1: simple PVR
+ * 2: full PVR
+ *
+ * This must work on all CPU versions, including those before the
+ * PVR was even an option.
+ */
+
+int cpu_has_pvr(void)
+{
+	unsigned flags;
+	unsigned pvr0;
+	int ret = 0;
+
+	local_irq_save(flags);
+
+	/* PVR bit in MSR tells us if there is any support */
+	if (!(flags & PVR_MSR_BIT))
+		goto out;
+
+	get_single_pvr(0x00, pvr0);
+	pr_debug("%s: pvr0 is 0x%08x\n", __func__, pvr0);
+
+	if (pvr0 & PVR0_PVR_FULL_MASK)
+		ret = 2;
+	else
+		ret = 1;
+
+out:
+	local_irq_restore(flags);
+	return ret;
+}
+
+void get_pvr(struct pvr_s *p)
+{
+	get_single_pvr(0, p->pvr[0]);
+	get_single_pvr(1, p->pvr[1]);
+	get_single_pvr(2, p->pvr[2]);
+	get_single_pvr(3, p->pvr[3]);
+	get_single_pvr(4, p->pvr[4]);
+	get_single_pvr(5, p->pvr[5]);
+	get_single_pvr(6, p->pvr[6]);
+	get_single_pvr(7, p->pvr[7]);
+	get_single_pvr(8, p->pvr[8]);
+	get_single_pvr(9, p->pvr[9]);
+	get_single_pvr(10, p->pvr[10]);
+	get_single_pvr(11, p->pvr[11]);
+}
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 14/56] microblaze_v2: defconfig file
  2008-05-04 11:41                         ` [PATCH 13/56] microblaze_v2: PVR support, cpuinfo support monstr
@ 2008-05-04 11:41                           ` monstr
  2008-05-04 11:41                             ` [PATCH 15/56] microblaze_v2: head.S + linker script monstr
  2008-05-05  2:14                           ` [PATCH 13/56] microblaze_v2: PVR support, cpuinfo support John Williams
  1 sibling, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


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

diff --git a/arch/microblaze/defconfig b/arch/microblaze/defconfig
new file mode 100644
index 0000000..5092d19
--- /dev/null
+++ b/arch/microblaze/defconfig
@@ -0,0 +1,604 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.25
+# Wed Apr 23 20:28:29 2008
+#
+CONFIG_MICROBLAZE=y
+# CONFIG_MMU is not set
+# CONFIG_SWAP is not set
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+# CONFIG_ARCH_HAS_ILOG2_U32 is not set
+# CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+# CONFIG_PCI is not set
+CONFIG_UID16=y
+CONFIG_HZ=100
+CONFIG_DEFCONFIG_LIST="arch/$ARCH/defconfig"
+
+#
+# General setup
+#
+# CONFIG_EXPERIMENTAL is not set
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION=""
+# CONFIG_LOCALVERSION_AUTO is not set
+# CONFIG_SYSVIPC is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_AUDIT is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_CGROUPS is not set
+# CONFIG_GROUP_SCHED is not set
+CONFIG_SYSFS_DEPRECATED=y
+CONFIG_SYSFS_DEPRECATED_V2=y
+# CONFIG_RELAY is not set
+# CONFIG_NAMESPACES is not set
+# CONFIG_BLK_DEV_INITRD is not set
+CONFIG_SYSCTL=y
+CONFIG_EMBEDDED=y
+CONFIG_SYSCTL_SYSCALL=y
+# CONFIG_KALLSYMS is not set
+# CONFIG_HOTPLUG is not set
+CONFIG_PRINTK=y
+# CONFIG_BUG is not set
+CONFIG_ELF_CORE=y
+CONFIG_COMPAT_BRK=y
+# CONFIG_BASE_FULL is not set
+# CONFIG_FUTEX is not set
+CONFIG_ANON_INODES=y
+# CONFIG_EPOLL is not set
+CONFIG_SIGNALFD=y
+# CONFIG_TIMERFD is not set
+CONFIG_EVENTFD=y
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+# CONFIG_MARKERS is not set
+# CONFIG_HAVE_OPROFILE is not set
+# CONFIG_HAVE_KPROBES is not set
+# CONFIG_HAVE_KRETPROBES is not set
+CONFIG_SLABINFO=y
+CONFIG_TINY_SHMEM=y
+CONFIG_BASE_SMALL=1
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+# CONFIG_KMOD is not set
+CONFIG_BLOCK=y
+# CONFIG_LBD is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_LSF 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"
+CONFIG_CLASSIC_RCU=y
+
+#
+# Platform options
+#
+CONFIG_PLATFORM_GENERIC=y
+CONFIG_HACK=y
+CONFIG_OPT_LIB_FUNCTION=y
+CONFIG_ALLOW_EDIT_AUTO=y
+
+#
+# Automatic platform settings from Kconfig.auto
+#
+
+#
+# Definitions for MICROBLAZE0
+#
+CONFIG_KERNEL_BASE_ADDR=0x20000000
+CONFIG_XILINX_MICROBLAZE0_FAMILY="spartan3e"
+CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR=1
+CONFIG_XILINX_MICROBLAZE0_USE_BARREL=1
+CONFIG_XILINX_MICROBLAZE0_USE_DIV=1
+CONFIG_XILINX_MICROBLAZE0_USE_HW_MULT=2
+CONFIG_XILINX_MICROBLAZE0_USE_FPU=0
+CONFIG_XILINX_MICROBLAZE0_HW_VER="7.00.b"
+
+#
+# Processor type and features
+#
+# CONFIG_PREEMPT is not set
+# CONFIG_XILINX_UNCACHED_SHADOW is not set
+# CONFIG_LARGE_ALLOCS is not set
+
+#
+# Boot options
+#
+CONFIG_CMDLINE="root=/dev/mtdblock0"
+CONFIG_CMDLINE_FORCE=y
+CONFIG_OF=y
+CONFIG_OF_DEVICE=y
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+# CONFIG_SPARSEMEM_STATIC is not set
+# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
+CONFIG_SPLIT_PTLOCK_CPUS=4
+# CONFIG_RESOURCES_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_BINFMT_MISC is not set
+
+#
+# Networking
+#
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+# CONFIG_PACKET_MMAP is not set
+CONFIG_UNIX=y
+CONFIG_XFRM=y
+# CONFIG_XFRM_USER 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_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_IPV6 is not set
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE 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_NET_SCHED 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
+
+#
+# Wireless
+#
+# CONFIG_CFG80211 is not set
+# CONFIG_WIRELESS_EXT is not set
+# CONFIG_MAC80211 is not set
+# CONFIG_IEEE80211 is not set
+# CONFIG_RFKILL is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_STANDALONE=y
+# CONFIG_PREVENT_FIRMWARE_BUILD 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_REDBOOT_PARTS is not set
+CONFIG_MTD_CMDLINE_PARTS=y
+
+#
+# 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
+
+#
+# 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_EEPROM_93CX6 is not set
+# CONFIG_ENCLOSURE_SERVICES is not set
+# CONFIG_HAVE_IDE 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 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_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_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_I2C is not set
+
+#
+# SPI support
+#
+# CONFIG_SPI is not set
+# CONFIG_SPI_MASTER 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_WATCHDOG is not set
+
+#
+# Sonics Silicon Backplane
+#
+CONFIG_SSB_POSSIBLE=y
+# CONFIG_SSB is not set
+
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 is not set
+
+#
+# Multimedia devices
+#
+# CONFIG_VIDEO_DEV is not set
+# CONFIG_DVB_CORE is not set
+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
+
+#
+# Sound
+#
+# 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
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+#
+# CONFIG_USB_GADGET is not set
+# CONFIG_MMC is not set
+# CONFIG_MEMSTICK is not set
+# CONFIG_NEW_LEDS is not set
+# CONFIG_RTC_CLASS is not set
+# CONFIG_UIO is not set
+
+#
+# File systems
+#
+# CONFIG_EXT2_FS is not set
+# CONFIG_EXT3_FS is not set
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+# CONFIG_FS_POSIX_ACL is not set
+# CONFIG_XFS_FS is not set
+# CONFIG_OCFS2_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
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_JFFS2_FS is not set
+CONFIG_CRAMFS=y
+# CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_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 is not set
+# CONFIG_NFSD 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
+
+#
+# Partition Types
+#
+# CONFIG_PARTITION_ADVANCED is not set
+CONFIG_MSDOS_PARTITION=y
+# CONFIG_NLS is not set
+
+#
+# Kernel hacking
+#
+# CONFIG_PRINTK_TIME is not set
+CONFIG_ENABLE_WARN_DEPRECATED=y
+# CONFIG_ENABLE_MUST_CHECK is not set
+# CONFIG_MAGIC_SYSRQ is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+# CONFIG_DEBUG_FS is not set
+# CONFIG_HEADERS_CHECK is not set
+# CONFIG_DEBUG_KERNEL is not set
+# CONFIG_SAMPLES is not set
+CONFIG_EARLY_PRINTK=y
+CONFIG_EARLY_PRINTK_UARTLITE_ADDRESS=0x40100000
+CONFIG_HEART_BEAT=y
+CONFIG_HEART_BEAT_ADDRESS=0x40600000
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+# CONFIG_CRYPTO_MANAGER 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_PCBC is not set
+
+#
+# Hash modes
+#
+# CONFIG_CRYPTO_HMAC 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_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_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
+CONFIG_CRYPTO_HW=y
+
+#
+# Library routines
+#
+# CONFIG_CRC_CCITT is not set
+# CONFIG_CRC16 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_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 15/56] microblaze_v2: head.S + linker script
  2008-05-04 11:41                           ` [PATCH 14/56] microblaze_v2: defconfig file monstr
@ 2008-05-04 11:41                             ` monstr
  2008-05-04 11:41                               ` [PATCH 16/56] microblaze_v2: supported function for memory - kernel/lib monstr
  0 siblings, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


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

diff --git a/arch/microblaze/kernel/head.S b/arch/microblaze/kernel/head.S
new file mode 100644
index 0000000..8ca148b
--- /dev/null
+++ b/arch/microblaze/kernel/head.S
@@ -0,0 +1,40 @@
+/*
+ * arch/microblaze/kernel/head.S
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2007 Michal Simek <monstr@monstr.eu>
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#include <linux/linkage.h>
+#include <asm/thread_info.h>
+
+	.text
+ENTRY(_start)
+	mfs	r1, rmsr
+	andi	r1, r1, ~2
+	mts	rmsr, r1
+
+	/* Initialize small data anchors */
+	la	r13, r0, _KERNEL_SDA_BASE_
+	la	r2, r0, _KERNEL_SDA2_BASE_
+
+	/* Initialize stack pointer */
+	la	r1, r0, init_thread_union + THREAD_SIZE - 4
+
+	/* Initialize r31 with current task address */
+	la	r31, r0, init_task
+
+	/* Call platform dependent initialize function.
+	 * Please see $(ARCH)/mach-$(SUBARCH)/setup.c for
+	 * the function. */
+	la	r8, r0, machine_early_init
+	brald	r15, r8
+	nop
+
+	la	r15, r0, machine_halt
+	braid	start_kernel
+	nop
diff --git a/arch/microblaze/kernel/vmlinux.lds.S b/arch/microblaze/kernel/vmlinux.lds.S
new file mode 100644
index 0000000..8940f1f
--- /dev/null
+++ b/arch/microblaze/kernel/vmlinux.lds.S
@@ -0,0 +1,145 @@
+/*
+ * arch/microblaze/kernel/vmlinux.lds.S
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+OUTPUT_FORMAT("elf32-microblaze", "elf32-microblaze", "elf32-microblaze")
+OUTPUT_ARCH(microblaze)
+ENTRY(_start)
+
+#include <linux/autoconf.h>
+#include <asm-generic/vmlinux.lds.h>
+
+jiffies = jiffies_64 + 4;
+
+SECTIONS {
+	. = CONFIG_KERNEL_BASE_ADDR;
+
+	.text : {
+		_text = . ;
+		_stext = . ;
+		TEXT_TEXT
+		SCHED_TEXT
+		LOCK_TEXT
+		. = ALIGN (4) ;
+		_etext = . ;
+	}
+
+	. = ALIGN(16);
+	RODATA
+
+	/* sdata2 section can go anywhere, but must be word aligned
+	 and SDA2_BASE must point to the middle of it */
+	.sdata2 : {
+		_ssrw = .;
+		. = ALIGN(0x8);
+		*(.sdata2)
+	. = ALIGN(8);
+	_essrw = .;
+	_ssrw_size = _essrw - _ssrw;
+	_KERNEL_SDA2_BASE_ = _ssrw + (_ssrw_size / 2);
+	}
+
+	_sdata = . ;
+	.data ALIGN (0x4) : {
+		DATA_DATA
+	}
+	. = ALIGN(32);
+	.data.cacheline_aligned : { *(.data.cacheline_aligned) }
+	_edata = . ;
+
+	/* 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) ;
+	}
+
+	. = ALIGN(16);
+	__start___ex_table = .;
+	__ex_table : { *(__ex_table) }
+	__stop___ex_table = .;
+
+	__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);
+		. = ALIGN(4096);/* Pad init.ramfs up to page boundary, so
+				that __init_end == __bss_start. This will
+				make image.elf consistent with the image.bin */
+	}
+
+	__init_end = .;
+
+	.bss ALIGN (4096) : {
+		__bss_start = . ;
+			*(.bss*)
+			*(COMMON)
+		. = ALIGN (4) ;
+		__bss_stop = . ;
+		_ebss = . ;
+	}
+	. = ALIGN(4096);
+	_end = .;
+}
+
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 16/56] microblaze_v2: supported function for memory - kernel/lib
  2008-05-04 11:41                             ` [PATCH 15/56] microblaze_v2: head.S + linker script monstr
@ 2008-05-04 11:41                               ` monstr
  2008-05-04 11:41                                 ` [PATCH 17/56] microblaze_v2: checksum support monstr
  0 siblings, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


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

diff --git a/arch/microblaze/lib/memcpy.c b/arch/microblaze/lib/memcpy.c
new file mode 100644
index 0000000..8dc5b90
--- /dev/null
+++ b/arch/microblaze/lib/memcpy.c
@@ -0,0 +1,162 @@
+/*
+ * arch/microblaze/lib/memcpy.c
+ *
+ * Copyright (C) 2008 Michal Simek <monstr@monstr.eu>
+ *
+ * Reasonably optimised generic C-code for memcpy on Microblaze
+ * This is generic C code to do efficient, alignment-aware memcpy.
+ *
+ * It is based on demo code originally Copyright 2001 by Intel Corp, taken from
+ * http://www.embedded.com/showArticle.jhtml?articleID=19205567
+ *
+ * Attempts were made, unsuccesfully, to contact the original
+ * author of this code (Michael Morrow, Intel).  Below is the original
+ * copyright notice.
+ *
+ * This software has been developed by Intel Corporation.
+ * Intel specifically disclaims all warranties, express or
+ * implied, and all liability, including consequential and
+ * other indirect damages, for the use of this program, including
+ * liability for infringement of any proprietary rights,
+ * and including the warranties of merchantability and fitness
+ * for a particular purpose. Intel does not assume any
+ * responsibility for and errors which may appear in this program
+ * not any responsibility to update it.
+ */
+
+#include <linux/types.h>
+#include <linux/stddef.h>
+#include <linux/compiler.h>
+#include <linux/module.h>
+
+#include <asm/string.h>
+#include <asm/system.h>
+
+#ifdef __HAVE_ARCH_MEMCPY
+void *memcpy(void *v_dst, const void *v_src, __kernel_size_t c)
+{
+	const char *src = v_src;
+	char *dst = v_dst;
+#ifndef CONFIG_OPT_LIB_FUNCTION
+	/* Simple, byte oriented memcpy. */
+	while (c--)
+		*dst++ = *src++;
+
+	return v_dst;
+#else
+	/* The following code tries to optimize the copy by using unsigned
+	 * alignment. This will work fine if both source and destination are
+	 * aligned on the same boundary. However, if they are aligned on
+	 * different boundaries shifts will be necessary. This might result in
+	 * bad performance on MicroBlaze systems without a barrel shifter.
+	 */
+	const uint32_t *i_src;
+	uint32_t *i_dst;
+
+	if (c >= 4) {
+		unsigned  value, buf_hold;
+
+		/* Align the dstination to a word boundry. */
+		/* This is done in an endian independant manner. */
+		switch ((unsigned long)dst & 3) {
+		case 1:
+			*dst++ = *src++;
+			--c;
+		case 2:
+			*dst++ = *src++;
+			--c;
+		case 3:
+			*dst++ = *src++;
+			--c;
+		}
+
+		i_dst = (void *)dst;
+
+		/* Choose a copy scheme based on the source */
+		/* alignment relative to dstination. */
+		switch ((unsigned long)src & 3) {
+		case 0x0:	/* Both byte offsets are aligned */
+			i_src  = (const void *)src;
+
+			for (; c >= 4; c -= 4)
+				*i_dst++ = *i_src++;
+
+			src  = (const void *)i_src;
+			break;
+		case 0x1:	/* Unaligned - Off by 1 */
+			/* Word align the source */
+			i_src = (const void *) ((unsigned)src & ~3);
+
+			/* Load the holding buffer */
+			buf_hold = *i_src++ << 8;
+
+			for (; c >= 4; c -= 4) {
+				value = *i_src++;
+				*i_dst++ = buf_hold | value >> 24;
+				buf_hold = value << 8;
+			}
+
+			/* Realign the source */
+			src = (const void *)i_src;
+			src -= 3;
+			break;
+		case 0x2:	/* Unaligned - Off by 2 */
+			/* Word align the source */
+			i_src = (const void *) ((unsigned)src & ~3);
+
+			/* Load the holding buffer */
+			buf_hold = *i_src++ << 16;
+
+			for (; c >= 4; c -= 4) {
+				value = *i_src++;
+				*i_dst++ = buf_hold | value >> 16;
+				buf_hold = value << 16;
+			}
+
+			/* Realign the source */
+			src = (const void *)i_src;
+			src -= 2;
+			break;
+		case 0x3:	/* Unaligned - Off by 3 */
+			/* Word align the source */
+			i_src = (const void *) ((unsigned)src & ~3);
+
+			/* Load the holding buffer */
+			buf_hold = *i_src++ << 24;
+
+			for (; c >= 4; c -= 4) {
+				value = *i_src++;
+				*i_dst++ = buf_hold | value >> 8;
+				buf_hold = value << 24;
+			}
+
+			/* Realign the source */
+			src = (const void *)i_src;
+			src -= 1;
+			break;
+		}
+		dst = (void *)i_dst;
+	}
+
+	/* Finish off any remaining bytes */
+	/* simple fast copy, ... unless a cache boundry is crossed */
+	switch (c) {
+	case 3:
+		*dst++ = *src++;
+	case 2:
+		*dst++ = *src++;
+	case 1:
+		*dst++ = *src++;
+	}
+
+	return v_dst;
+#endif
+}
+EXPORT_SYMBOL(memcpy);
+#endif /* __HAVE_ARCH_MEMCPY */
+
+
+void *cacheable_memcpy(void *d, const void *s, __kernel_size_t c)
+{
+	return memcpy(d, s, c);
+}
diff --git a/arch/microblaze/lib/memmove.c b/arch/microblaze/lib/memmove.c
new file mode 100644
index 0000000..99233be
--- /dev/null
+++ b/arch/microblaze/lib/memmove.c
@@ -0,0 +1,176 @@
+/*
+ * arch/microblaze/lib/memmove.c
+ *
+ * Copyright (C) 2008 Michal Simek <monstr@monstr.eu>
+ *
+ * Reasonably optimised generic C-code for memcpy on Microblaze
+ * This is generic C code to do efficient, alignment-aware memmove.
+ *
+ * It is based on demo code originally Copyright 2001 by Intel Corp, taken from
+ * http://www.embedded.com/showArticle.jhtml?articleID=19205567
+ *
+ * Attempts were made, unsuccesfully, to contact the original
+ * author of this code (Michael Morrow, Intel).  Below is the original
+ * copyright notice.
+ *
+ * This software has been developed by Intel Corporation.
+ * Intel specifically disclaims all warranties, express or
+ * implied, and all liability, including consequential and
+ * other indirect damages, for the use of this program, including
+ * liability for infringement of any proprietary rights,
+ * and including the warranties of merchantability and fitness
+ * for a particular purpose. Intel does not assume any
+ * responsibility for and errors which may appear in this program
+ * not any responsibility to update it.
+ */
+
+#include <linux/types.h>
+#include <linux/stddef.h>
+#include <linux/compiler.h>
+#include <linux/module.h>
+
+#include <asm/string.h>
+
+#ifdef __HAVE_ARCH_MEMMOVE
+void *memmove(void *v_dst, const void *v_src, __kernel_size_t c)
+{
+	const char *src = v_src;
+	char *dst = v_dst;
+
+#ifdef CONFIG_OPT_LIB_FUNCTION
+	const uint32_t *i_src;
+	uint32_t *i_dst;
+#endif
+
+	if (!c)
+		return v_dst;
+
+	/* Use memcpy when source is higher than dest */
+	if (v_dst <= v_src)
+		return memcpy(v_dst, v_src, c);
+
+#ifndef CONFIG_OPT_LIB_FUNCTION
+	/* copy backwards, from end to beginning */
+	src += c;
+	dst += c;
+
+	/* Simple, byte oriented memmove. */
+	while (c--)
+		*--dst = *--src;
+
+	return v_dst;
+#else
+	/* The following code tries to optimize the copy by using unsigned
+	 * alignment. This will work fine if both source and destination are
+	 * aligned on the same boundary. However, if they are aligned on
+	 * different boundaries shifts will be necessary. This might result in
+	 * bad performance on MicroBlaze systems without a barrel shifter.
+	 */
+	/* FIXME this part needs more test */
+	/* Do a descending copy - this is a bit trickier! */
+	dst += c;
+	src += c;
+
+	if (c >= 4) {
+		unsigned  value, buf_hold;
+
+		/* Align the destination to a word boundry. */
+		/* This is done in an endian independant manner. */
+
+		switch ((unsigned long)dst & 3) {
+		case 3:
+			*--dst = *--src;
+			--c;
+		case 2:
+			*--dst = *--src;
+			--c;
+		case 1:
+			*--dst = *--src;
+			--c;
+		}
+
+		i_dst = (void *)dst;
+		/* Choose a copy scheme based on the source */
+		/* alignment relative to dstination. */
+		switch ((unsigned long)src & 3) {
+		case 0x0:	/* Both byte offsets are aligned */
+
+			i_src  = (const void *)src;
+
+			for (; c >= 4; c -= 4)
+				*--i_dst = *--i_src;
+
+			src  = (const void *)i_src;
+			break;
+		case 0x1:	/* Unaligned - Off by 1 */
+			/* Word align the source */
+			i_src = (const void *) (((unsigned)src + 4) & ~3);
+
+			/* Load the holding buffer */
+			buf_hold = *--i_src >> 24;
+
+			for (; c >= 4; c -= 4) {
+				value = *--i_src;
+				*--i_dst = buf_hold << 8 | value;
+				buf_hold = value >> 24;
+			}
+
+			/* Realign the source */
+			src = (const void *)i_src;
+			src += 1;
+			break;
+		case 0x2:	/* Unaligned - Off by 2 */
+			/* Word align the source */
+			i_src = (const void *) (((unsigned)src + 4) & ~3);
+
+			/* Load the holding buffer */
+			buf_hold = *--i_src >> 16;
+
+			for (; c >= 4; c -= 4) {
+				value = *--i_src;
+				*--i_dst = buf_hold << 16 | value;
+				buf_hold = value >> 16;
+			}
+
+			/* Realign the source */
+			src = (const void *)i_src;
+			src += 2;
+			break;
+		case 0x3:	/* Unaligned - Off by 3 */
+			/* Word align the source */
+			i_src = (const void *) (((unsigned)src + 4) & ~3);
+
+			/* Load the holding buffer */
+			buf_hold = *--i_src >> 8;
+
+			for (; c >= 4; c -= 4) {
+				value = *--i_src;
+				*--i_dst = buf_hold << 24 | value;
+				buf_hold = value >> 8;
+			}
+
+			/* Realign the source */
+			src = (const void *)i_src;
+			src += 3;
+			break;
+		}
+		dst = (void *)i_dst;
+	}
+
+	/* simple fast copy, ... unless a cache boundry is crossed */
+	/* Finish off any remaining bytes */
+	switch (c) {
+	case 4:
+		*--dst = *--src;
+	case 3:
+		*--dst = *--src;
+	case 2:
+		*--dst = *--src;
+	case 1:
+		*--dst = *--src;
+	}
+	return v_dst;
+#endif
+}
+EXPORT_SYMBOL(memmove);
+#endif /* __HAVE_ARCH_MEMMOVE */
diff --git a/arch/microblaze/lib/memset.c b/arch/microblaze/lib/memset.c
new file mode 100644
index 0000000..5697d66
--- /dev/null
+++ b/arch/microblaze/lib/memset.c
@@ -0,0 +1,77 @@
+/*
+ * arch/microblaze/lib/memset.c
+ *
+ * Copyright (C) 2008 Michal Simek <monstr@monstr.eu>
+ *
+ * Reasonably optimised generic C-code for memset on Microblaze
+ * This is generic C code to do efficient, alignment-aware memcpy.
+ *
+ * It is based on demo code originally Copyright 2001 by Intel Corp, taken from
+ * http://www.embedded.com/showArticle.jhtml?articleID=19205567
+ *
+ * Attempts were made, unsuccesfully, to contact the original
+ * author of this code (Michael Morrow, Intel).  Below is the original
+ * copyright notice.
+ *
+ * This software has been developed by Intel Corporation.
+ * Intel specifically disclaims all warranties, express or
+ * implied, and all liability, including consequential and
+ * other indirect damages, for the use of this program, including
+ * liability for infringement of any proprietary rights,
+ * and including the warranties of merchantability and fitness
+ * for a particular purpose. Intel does not assume any
+ * responsibility for and errors which may appear in this program
+ * not any responsibility to update it.
+ */
+
+#include <linux/types.h>
+#include <linux/stddef.h>
+#include <linux/compiler.h>
+#include <linux/module.h>
+
+#include <asm/string.h>
+
+#ifdef __HAVE_ARCH_MEMSET
+void *memset(void *v_src, int c, __kernel_size_t n)
+{
+	char *src = v_src;
+	uint32_t *i_src;
+	uint32_t w32;
+
+	/* Truncate c to 8 bits */
+	w32 = c = (c & 0xFF);
+
+	/* Make a repeating word out of it */
+	w32 |= w32 << 8;
+	w32 |= w32 << 8;
+	w32 |= w32 << 8;
+
+	if (n >= 4) {
+		/* Align the destination to a word boundary */
+		/* This is done in an endian independant manner */
+		switch ((unsigned) src & 3) {
+		case 1: *src++ = c;
+			--n;
+		case 2: *src++ = c;
+			--n;
+		case 3: *src++ = c;
+			--n;
+		}
+
+		i_src  = (void *)src;
+
+		/* Do as many full-word copies as we can */
+		for (; c >= 4; c -= 4)
+			*i_src++ = w32;
+
+		src  = (void *)i_src;
+	}
+
+	/* Finish off the rest as byte sets */
+	while (n--)
+		*src++ = c;
+
+	return v_src;
+}
+EXPORT_SYMBOL(memset);
+#endif /* __HAVE_ARCH_MEMSET */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 17/56] microblaze_v2: checksum support
  2008-05-04 11:41                               ` [PATCH 16/56] microblaze_v2: supported function for memory - kernel/lib monstr
@ 2008-05-04 11:41                                 ` monstr
  2008-05-04 11:41                                   ` [PATCH 18/56] microblaze_v2: early_printk support monstr
  2008-05-04 19:59                                   ` [PATCH 17/56] microblaze_v2: checksum support Arnd Bergmann
  0 siblings, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


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

diff --git a/arch/microblaze/lib/checksum.c b/arch/microblaze/lib/checksum.c
new file mode 100644
index 0000000..1f4646f
--- /dev/null
+++ b/arch/microblaze/lib/checksum.c
@@ -0,0 +1,166 @@
+/*
+ * arch/microblaze/lib/checksum.c
+ *
+ * Copyright (C) 2008 Michal Simek <monstr@monstr.eu>
+ *
+ * INET		An implementation of the TCP/IP protocol suite for the LINUX
+ *		operating system.  INET is implemented using the  BSD Socket
+ *		interface as the means of communication with the user level.
+ *
+ *		IP/TCP/UDP checksumming routines
+ *
+ * Authors:	Jorge Cwik, <jorge@laser.satlink.net>
+ *		Arnt Gulbrandsen, <agulbra@nvg.unit.no>
+ *		Tom May, <ftom@netcom.com>
+ *		Andreas Schwab, <schwab@issan.informatik.uni-dortmund.de>
+ *		Lots of code moved from tcp.c and ip.c; see those files
+ *		for more names.
+ *
+ * 03/02/96	Jes Sorensen, Andreas Schwab, Roman Hodek:
+ *		Fixed some nasty bugs, causing some horrible crashes.
+ *		A: At some points, the sum (%0) was used as
+ *		length-counter instead of the length counter
+ *		(%1). Thanks to Roman Hodek for pointing this out.
+ *		B: GCC seems to mess up if one uses too many
+ *		data-registers to hold input values and one tries to
+ *		specify d0 and d1 as scratch registers. Letting gcc choose these
+ *      registers itself solves the problem.
+ *
+ *		This program is free software; you can redistribute it and/or
+ *		modify it under the terms of the GNU General Public License
+ *		as published by the Free Software Foundation; either version
+ *		2 of the License, or (at your option) any later version.
+ */
+
+/* Revised by Kenneth Albanowski for m68knommu. Basic problem: unaligned access
+ kills, so most of the assembly has to go. */
+
+#include <net/checksum.h>
+#include <asm/checksum.h>
+#include <linux/module.h>
+
+static inline unsigned short from32to16(unsigned long x)
+{
+	/* add up 16-bit and 16-bit for 16+c bit */
+	x = (x & 0xffff) + (x >> 16);
+	/* add up carry.. */
+	x = (x & 0xffff) + (x >> 16);
+	return x;
+}
+
+static unsigned long do_csum(const unsigned char *buff, int len)
+{
+	int odd, count;
+	unsigned long result = 0;
+
+	if (len <= 0)
+		goto out;
+	odd = 1 & (unsigned long) buff;
+	if (odd) {
+		result = *buff;
+		len--;
+		buff++;
+	}
+	count = len >> 1;		/* nr of 16-bit words.. */
+	if (count) {
+		if (2 & (unsigned long) buff) {
+			result += *(unsigned short *) buff;
+			count--;
+			len -= 2;
+			buff += 2;
+		}
+		count >>= 1;		/* nr of 32-bit words.. */
+		if (count) {
+			unsigned long carry = 0;
+			do {
+				unsigned long w = *(unsigned long *) buff;
+				count--;
+				buff += 4;
+				result += carry;
+				result += w;
+				carry = (w > result);
+			} while (count);
+			result += carry;
+			result = (result & 0xffff) + (result >> 16);
+		}
+		if (len & 2) {
+			result += *(unsigned short *) buff;
+			buff += 2;
+		}
+	}
+	if (len & 1)
+		result += (*buff << 8);
+	result = from32to16(result);
+	if (odd)
+		result = ((result >> 8) & 0xff) | ((result & 0xff) << 8);
+out:
+	return result;
+}
+
+/*
+ *	This is a version of ip_compute_csum() optimized for IP headers,
+ *	which always checksum on 4 octet boundaries.
+ */
+unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl)
+{
+	return ~do_csum(iph, ihl*4);
+}
+
+/*
+ * 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
+ */
+unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum)
+{
+	unsigned int result = do_csum(buff, len);
+
+	/* add in old sum, and carry.. */
+	result += sum;
+	if (sum > result)
+		result += 1;
+	return result;
+}
+EXPORT_SYMBOL(csum_partial);
+
+/*
+ * this routine is used for miscellaneous IP-like checksums, mainly
+ * in icmp.c
+ */
+unsigned short ip_compute_csum(const unsigned char *buff, int len)
+{
+	return ~do_csum(buff, len);
+}
+EXPORT_SYMBOL(ip_compute_csum);
+
+/*
+ * copy from fs while checksumming, otherwise like csum_partial
+ */
+unsigned int
+csum_partial_copy_from_user(const char __user *src, char *dst, int len,
+						int sum, int *csum_err)
+{
+	if (csum_err)
+		*csum_err = 0;
+	memcpy(dst, src, len);
+	return csum_partial(dst, len, sum);
+}
+EXPORT_SYMBOL(csum_partial_copy_from_user);
+
+/*
+ * copy from ds while checksumming, otherwise like csum_partial
+ */
+unsigned int
+csum_partial_copy(const char *src, char *dst, int len, int sum)
+{
+	memcpy(dst, src, len);
+	return csum_partial(dst, len, sum);
+}
+EXPORT_SYMBOL(csum_partial_copy);
diff --git a/include/asm-microblaze/checksum.h b/include/asm-microblaze/checksum.h
new file mode 100644
index 0000000..fc05cca
--- /dev/null
+++ b/include/asm-microblaze/checksum.h
@@ -0,0 +1,101 @@
+/*
+ * include/asm-microblaze/checksum.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_CHECKSUM_H
+#define _ASM_MICROBLAZE_CHECKSUM_H
+
+#include <linux/in6.h>
+
+/*
+ * 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
+ */
+unsigned int csum_partial(const unsigned char *buff, int len,
+						unsigned int 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
+ */
+unsigned int 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 unsigned int 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 unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl);
+
+/*
+ *	Fold a partial checksum
+ */
+static inline unsigned int csum_fold(unsigned int sum)
+{
+	sum = (sum & 0xffff) + (sum >> 16);
+	sum = (sum & 0xffff) + (sum >> 16);
+	return ~sum;
+}
+
+/*
+ * computes the checksum of the TCP/UDP pseudo-header
+ * returns a 16-bit checksum, already complemented
+ */
+static inline unsigned int
+csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
+		unsigned short proto, unsigned int sum)
+{
+	__asm__("add %0, %4, %1\n\t"
+		"addc %0, %4, %2\n\t"
+		"addc %0, %4, %3\n\t"
+		"addc %0, %4, r0\n\t"
+		: "=d" (sum)
+		: "d" (saddr), "d" (daddr), "d" (len + proto),
+		"0"(sum));
+
+	return sum;
+}
+
+static inline unsigned short int
+csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
+		unsigned short proto, unsigned int 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 unsigned short ip_compute_csum(const unsigned char *buff, int len);
+
+#endif /* _ASM_MICROBLAZE_CHECKSUM_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 18/56] microblaze_v2: early_printk support
  2008-05-04 11:41                                 ` [PATCH 17/56] microblaze_v2: checksum support monstr
@ 2008-05-04 11:41                                   ` monstr
  2008-05-04 11:41                                     ` [PATCH 19/56] microblaze_v2: uaccess files monstr
                                                       ` (2 more replies)
  2008-05-04 19:59                                   ` [PATCH 17/56] microblaze_v2: checksum support Arnd Bergmann
  1 sibling, 3 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


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

diff --git a/arch/microblaze/kernel/early_printk.c b/arch/microblaze/kernel/early_printk.c
new file mode 100644
index 0000000..0f533ff
--- /dev/null
+++ b/arch/microblaze/kernel/early_printk.c
@@ -0,0 +1,115 @@
+/*
+ * arch/microblaze/kernel/early_printk.c
+ *
+ * Copyright (C) 2007 Michal Simek <monstr@monstr.eu>
+ * Copyright (C) 2003-2006 Yasushi SHOJI <yashi@atmark-techno.com>
+ *
+ * Early printk support for Microblaze.
+ *
+ * Once we got some system without uart light, we need to refactor.
+ */
+
+#include <linux/console.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/string.h>
+#include <linux/tty.h>
+#include <asm/io.h>
+#include <asm/processor.h>
+#include <asm/fcntl.h>
+#include <asm/setup.h>
+
+#ifdef CONFIG_EARLY_PRINTK
+#define BASE_ADDR ((unsigned char *)CONFIG_EARLY_PRINTK_UARTLITE_ADDRESS)
+
+#define RX_FIFO	BASE_ADDR
+#define TX_FIFO	((unsigned long *)(BASE_ADDR + 4))
+#define STATUS	((unsigned long *)(BASE_ADDR + 8))
+#define CONTROL	((unsigned long *)(BASE_ADDR + 12))
+
+static void early_printk_putc(char c)
+{
+	while (ioread32(STATUS) & (1<<3));
+	iowrite32((c & 0xff), TX_FIFO);
+}
+
+static void early_printk_write(struct console *unused,
+					const char *s, unsigned n)
+{
+	while (*s && n-- > 0) {
+		early_printk_putc(*s);
+		if (*s == '\n')
+			early_printk_putc('\r');
+		s++;
+	}
+}
+
+static struct console early_serial_console = {
+	.name = "earlyser",
+	.write = early_printk_write,
+	.flags = CON_PRINTBUFFER,
+	.index = -1,
+};
+
+/* Direct interface for emergencies */
+static struct console *early_console = &early_serial_console;
+static int early_console_initialized;
+
+void early_printk(const char *fmt, ...)
+{
+	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);
+	}
+}
+
+static int __initdata keep_early;
+
+int __init setup_early_printk(char *opt)
+{
+	char *space;
+	char buf[256];
+
+	if (early_console_initialized)
+		return 1;
+
+	strlcpy(buf, opt, sizeof(buf));
+	space = strchr(buf, ' ');
+	if (space)
+		*space = 0;
+
+	if (strstr(buf, "keep"))
+		keep_early = 1;
+
+	early_console = &early_serial_console;
+	early_console_initialized = 1;
+	register_console(early_console);
+	return 0;
+}
+#if 0
+static void __init disable_early_printk(void)
+{
+	if (!early_console_initialized || !early_console)
+		return;
+	if (!keep_early) {
+		printk(KERN_INFO "disabling early console\n");
+		unregister_console(early_console);
+		early_console_initialized = 0;
+	} else
+		printk(KERN_INFO "keeping early console\n");
+}
+#endif
+
+__setup("earlyprintk=", setup_early_printk);
+
+#else
+void early_printk(const char *fmt, ...)
+{
+}
+#endif
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 19/56] microblaze_v2: uaccess files
  2008-05-04 11:41                                   ` [PATCH 18/56] microblaze_v2: early_printk support monstr
@ 2008-05-04 11:41                                     ` monstr
  2008-05-04 11:41                                       ` [PATCH 20/56] microblaze_v2: heartbeat file monstr
  2008-05-05 14:36                                     ` [PATCH 18/56] microblaze_v2: early_printk support Grant Likely
  2008-05-05 23:22                                     ` John Williams
  2 siblings, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 arch/microblaze/lib/uaccess.c    |   43 +++++++++++++
 include/asm-microblaze/uaccess.h |  126 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 169 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/lib/uaccess.c
 create mode 100644 include/asm-microblaze/uaccess.h

diff --git a/arch/microblaze/lib/uaccess.c b/arch/microblaze/lib/uaccess.c
new file mode 100644
index 0000000..9a36778
--- /dev/null
+++ b/arch/microblaze/lib/uaccess.c
@@ -0,0 +1,43 @@
+/*
+ * arch/microblaze/lib/uaccess.c
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#include <linux/string.h>
+#include <asm/uaccess.h>
+
+#include <asm/bug.h>
+
+long strnlen_user(const char __user *s, long n)
+{
+	return strlen(s) + 1;
+}
+
+#define __do_strncpy_from_user(dst, src, count, res)			\
+	do {								\
+		char *tmp;						\
+		strncpy(dst, src, count);				\
+		for (tmp = dst; *tmp && count > 0; tmp++, count--)	\
+			;						\
+		res = (tmp - dst);					\
+	} while (0)
+
+long __strncpy_from_user(char *dst, const char __user *src, long count)
+{
+	long res;
+	__do_strncpy_from_user(dst, src, count, res);
+	return res;
+}
+
+long strncpy_from_user(char *dst, const char *src, long count)
+{
+	long res = -EFAULT;
+	if (access_ok(VERIFY_READ, src, 1))
+		__do_strncpy_from_user(dst, src, count, res);
+	return res;
+}
diff --git a/include/asm-microblaze/uaccess.h b/include/asm-microblaze/uaccess.h
new file mode 100644
index 0000000..e6adda3
--- /dev/null
+++ b/include/asm-microblaze/uaccess.h
@@ -0,0 +1,126 @@
+/*
+ * include/asm-microblaze/uaccess.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_UACCESS_H
+#define _ASM_MICROBLAZE_UACCESS_H
+
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <asm/segment.h>
+#include <asm/string.h>
+
+#include <linux/sched.h> /* RLIMIT_FSIZE */
+/* #include <linux/errno.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;
+}
+
+#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)
+
+/*
+ * 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;
+};
+
+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 *src, long count);
+extern long strnlen_user(const char *src, long count);
+extern long __strncpy_from_user(char *dst, const char *src, long count);
+
+#endif /* _ASM_MICROBLAZE_UACCESS_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 20/56] microblaze_v2: heartbeat file
  2008-05-04 11:41                                     ` [PATCH 19/56] microblaze_v2: uaccess files monstr
@ 2008-05-04 11:41                                       ` monstr
  2008-05-04 11:41                                         ` [PATCH 21/56] microblaze_v2: setup.c - system setting monstr
  0 siblings, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 arch/microblaze/kernel/heartbeat.c |   37 ++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/heartbeat.c

diff --git a/arch/microblaze/kernel/heartbeat.c b/arch/microblaze/kernel/heartbeat.c
new file mode 100644
index 0000000..508b463
--- /dev/null
+++ b/arch/microblaze/kernel/heartbeat.c
@@ -0,0 +1,37 @@
+/*
+ * arch/microblaze/kernel/heartbeat.c
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#include <linux/sched.h>
+#include <asm/page.h>
+#include <asm/io.h>
+#include <asm/setup.h>
+
+void heartbeat(void)
+{
+	static unsigned int cnt, period, dist;
+
+	if (cnt == 0 || cnt == dist)
+		iowrite32(1, CONFIG_HEART_BEAT_ADDRESS);
+	else if (cnt == 7 || cnt == dist + 7)
+		iowrite32(0, CONFIG_HEART_BEAT_ADDRESS);
+
+	if (++cnt > period) {
+		cnt = 0;
+
+		/*
+		 * The hyperbolic function below modifies the heartbeat period
+		 * length in dependency of the current (5min) load. It goes
+		 * through the points f(0)=126, f(1)=86, f(5)=51, f(inf)->30.
+		 */
+		period = ((672 << FSHIFT) / (5 * avenrun[0] +
+					(7 << FSHIFT))) + 30;
+		dist = period / 4;
+	}
+}
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 21/56] microblaze_v2: setup.c - system setting
  2008-05-04 11:41                                       ` [PATCH 20/56] microblaze_v2: heartbeat file monstr
@ 2008-05-04 11:41                                         ` monstr
  2008-05-04 11:41                                           ` [PATCH 22/56] microblaze_v2: asm-offsets monstr
  2008-05-05  2:15                                           ` [PATCH 21/56] microblaze_v2: setup.c - system setting John Williams
  0 siblings, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 arch/microblaze/kernel/setup.c |  189 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 189 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/setup.c

diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
new file mode 100644
index 0000000..afd2786
--- /dev/null
+++ b/arch/microblaze/kernel/setup.c
@@ -0,0 +1,189 @@
+/*
+ * arch/microblaze/kernel/setup.c
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2008 Michal Simek <monstr@monstr.eu>
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#include <linux/init.h>
+#include <linux/string.h>
+#include <linux/seq_file.h>
+#include <linux/cpu.h>
+#include <linux/initrd.h>
+#include <linux/console.h>
+#include <linux/debugfs.h>
+
+#include <asm/setup.h>
+#include <asm/sections.h>
+#include <asm/page.h>
+#include <asm/io.h>
+#include <asm/bug.h>
+#include <asm/param.h>
+#include <asm/cache.h>
+#include <asm/cacheflush.h>
+#include <asm/entry.h>
+#include <asm/cpuinfo.h>
+
+#include <asm/system.h>
+#include <asm/prom.h>
+#include <asm/pgtable.h>
+
+DEFINE_PER_CPU(unsigned int, KSP);	/* Saved kernel stack pointer */
+DEFINE_PER_CPU(unsigned int, KM);	/* Kernel/user mode */
+DEFINE_PER_CPU(unsigned int, ENTRY_SP);	/* Saved SP on kernel entry */
+DEFINE_PER_CPU(unsigned int, R11_SAVE);	/* Temp variable for entry */
+DEFINE_PER_CPU(unsigned int, CURRENT_SAVE);	/* Saved current pointer */
+
+unsigned int boot_cpuid;
+char cmd_line[COMMAND_LINE_SIZE];
+static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
+
+void __init setup_arch(char **cmdline_p)
+{
+	console_verbose();
+
+	unflatten_device_tree();
+	/* NOTE I think that this function is not necessary to call */
+	/* irq_early_init(); */
+	setup_cpuinfo();
+
+	__flush_icache_all();
+	__enable_icache();
+
+	__flush_dcache_all();
+	__enable_dcache();
+
+	panic_timeout = 120;
+
+	setup_memory();
+	paging_init();
+#ifdef CONFIG_HACK
+	printk(KERN_NOTICE "HACK function enable\n");
+#else
+	printk(KERN_NOTICE "HACK function disable\n");
+#endif
+
+#ifdef CONFIG_VT
+#if defined(CONFIG_XILINX_CONSOLE)
+	conswitchp = &xil_con;
+#elif defined(CONFIG_DUMMY_CONSOLE)
+	conswitchp = &dummy_con;
+#endif
+#endif
+}
+
+#ifdef CONFIG_MTD_UCLINUX
+/* Handle both romfs and cramfs types, without generating unnecessary
+ code (ie no point checking for CRAMFS if it's not even enabled) */
+inline unsigned get_romfs_len(unsigned *addr)
+{
+#ifdef CONFIG_ROMFS_FS
+	if (memcmp(&addr[0], "-rom1fs-", 8) == 0) /* romfs */
+		return be32_to_cpu(addr[2]);
+#endif
+
+#ifdef CONFIG_CRAMFS
+	if (addr[0] == le32_to_cpu(0x28cd3d45)) /* cramfs */
+		return le32_to_cpu(addr[1]);
+#endif
+	return 0;
+}
+#endif	/* CONFIG_MTD_UCLINUX_EBSS */
+
+void __init machine_early_init(const char *cmdline, unsigned int ram,
+		unsigned int fdt)
+{
+	unsigned long *src, *dst = (unsigned long *)0x0;
+	early_printk("Ramdisk addr 0x%08x, FDT 0x%08x\n", ram, fdt);
+
+#ifdef CONFIG_MTD_UCLINUX
+	{
+		int size;
+		unsigned int romfs_base;
+		romfs_base = (ram ? ram : (unsigned int)&__init_end);
+		/* if CONFIG_MTD_UCLINUX_EBSS is defined, assume ROMFS is at the
+		 * end of kernel, which is ROMFS_LOCATION defined above. */
+		size = PAGE_ALIGN(get_romfs_len((unsigned *)romfs_base));
+		early_printk("Found romfs @ 0x%08x (0x%08x)\n",
+				romfs_base, size);
+		early_printk("#### klimit %p ####\n", klimit);
+		BUG_ON(size < 0); /* What else can we do? */
+
+		/* Use memmove to handle likely case of memory overlap */
+		early_printk("Moving 0x%08x bytes from 0x%08x to 0x%08x\n",
+			size, romfs_base, (unsigned)&_ebss);
+		memmove(&_ebss, (int *)romfs_base, size);
+
+		/* update klimit */
+		klimit += PAGE_ALIGN(size);
+		early_printk("New klimit: 0x%08x\n", (unsigned)klimit);
+	}
+#endif
+
+	memset(__bss_start, 0, __bss_stop-__bss_start);
+	memset(_ssbss, 0, _esbss-_ssbss);
+
+	printk(KERN_NOTICE "Found FDT at 0x%08x\n", fdt);
+	early_init_devtree((void *)fdt);
+
+	/* Copy command line passed from bootloader, or use default
+	 if none provided, or forced */
+#ifndef CONFIG_CMDLINE_FORCE
+	if (cmdline && cmdline[0] != '\0')
+		strlcpy(cmd_line, cmdline, COMMAND_LINE_SIZE);
+	else
+#endif
+		strlcpy(cmd_line, default_command_line, COMMAND_LINE_SIZE);
+
+	for (src = __ivt_start; src < __ivt_end; src++, dst++)
+		*dst = *src;
+
+	/* Initialize global data */
+	per_cpu(KM, 0) = 0x1;	/* We start in kernel mode */
+	per_cpu(CURRENT_SAVE, 0) = (unsigned long)current;
+}
+
+#ifdef CONFIG_DEBUG_FS
+struct dentry *of_debugfs_root;
+
+static int microblaze_debugfs_init(void)
+{
+	of_debugfs_root = debugfs_create_dir("microblaze", NULL);
+
+	return of_debugfs_root == NULL;
+}
+arch_initcall(microblaze_debugfs_init);
+#endif
+
+void machine_restart(char *cmd)
+{
+	printk(KERN_NOTICE "Machine restart...\n");
+	dump_stack();
+	while (1)
+		;
+}
+
+void machine_shutdown(void)
+{
+	printk(KERN_NOTICE "Machine shutdown...\n");
+	while (1)
+		;
+}
+
+void machine_halt(void)
+{
+	printk(KERN_NOTICE "Machine halt...\n");
+	while (1)
+		;
+}
+
+void machine_power_off(void)
+{
+	printk(KERN_NOTICE "Machine power off...\n");
+	while (1)
+		;
+}
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 22/56] microblaze_v2: asm-offsets
  2008-05-04 11:41                                         ` [PATCH 21/56] microblaze_v2: setup.c - system setting monstr
@ 2008-05-04 11:41                                           ` monstr
  2008-05-04 11:41                                             ` [PATCH 23/56] microblaze_v2: process and init task function monstr
  2008-05-05  2:15                                           ` [PATCH 21/56] microblaze_v2: setup.c - system setting John Williams
  1 sibling, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 arch/microblaze/kernel/asm-offsets.c |  118 ++++++++++++++++++++++++++++++++++
 1 files changed, 118 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/asm-offsets.c

diff --git a/arch/microblaze/kernel/asm-offsets.c b/arch/microblaze/kernel/asm-offsets.c
new file mode 100644
index 0000000..f01aa3b
--- /dev/null
+++ b/arch/microblaze/kernel/asm-offsets.c
@@ -0,0 +1,118 @@
+/*
+ * arch/microblaze/kernel/asm-offset.c
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2007 PetaLogix
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#include <linux/stddef.h>
+#include <linux/sched.h>
+#include <linux/kernel_stat.h>
+#include <linux/ptrace.h>
+#include <linux/hardirq.h>
+#include <linux/thread_info.h>
+
+#define DEFINE(sym, val) asm volatile("\n->" #sym " %0 " #val : : "i" (val))
+#define BLANK() asm volatile("\n->" : :)
+
+int main(int argc, char *argv[])
+{
+	/* struct pt_regs */
+	DEFINE(PT_SIZE, sizeof(struct pt_regs));
+	DEFINE(PT_MSR, offsetof(struct pt_regs, msr));
+	DEFINE(PT_EAR, offsetof(struct pt_regs, ear));
+	DEFINE(PT_ESR, offsetof(struct pt_regs, esr));
+	DEFINE(PT_FSR, offsetof(struct pt_regs, fsr));
+	DEFINE(PT_PC, offsetof(struct pt_regs, pc));
+	DEFINE(PT_R0, offsetof(struct pt_regs, r0));
+	DEFINE(PT_R1, offsetof(struct pt_regs, r1));
+	DEFINE(PT_R2, offsetof(struct pt_regs, r2));
+	DEFINE(PT_R3, offsetof(struct pt_regs, r3));
+	DEFINE(PT_R4, offsetof(struct pt_regs, r4));
+	DEFINE(PT_R5, offsetof(struct pt_regs, r5));
+	DEFINE(PT_R6, offsetof(struct pt_regs, r6));
+	DEFINE(PT_R7, offsetof(struct pt_regs, r7));
+	DEFINE(PT_R8, offsetof(struct pt_regs, r8));
+	DEFINE(PT_R9, offsetof(struct pt_regs, r9));
+	DEFINE(PT_R10, offsetof(struct pt_regs, r10));
+	DEFINE(PT_R11, 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_SP, offsetof(struct cpu_context, sp)); /* 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;
+}
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 23/56] microblaze_v2: process and init task function
  2008-05-04 11:41                                           ` [PATCH 22/56] microblaze_v2: asm-offsets monstr
@ 2008-05-04 11:41                                             ` monstr
  2008-05-04 11:41                                               ` [PATCH 24/56] microblaze_v2: time support monstr
  0 siblings, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 arch/microblaze/kernel/init_task.c |   31 +++++++++
 arch/microblaze/kernel/process.c   |  129 ++++++++++++++++++++++++++++++++++++
 2 files changed, 160 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/init_task.c
 create mode 100644 arch/microblaze/kernel/process.c

diff --git a/arch/microblaze/kernel/init_task.c b/arch/microblaze/kernel/init_task.c
new file mode 100644
index 0000000..7c6bce3
--- /dev/null
+++ b/arch/microblaze/kernel/init_task.c
@@ -0,0 +1,31 @@
+/*
+ * arch/microblaze/kernel/init_task.c
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/init_task.h>
+#include <linux/fs.h>
+#include <linux/mqueue.h>
+
+#include <asm/pgtable.h>
+
+static struct fs_struct init_fs = INIT_FS;
+static struct files_struct init_files = INIT_FILES;
+static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
+static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
+struct mm_struct init_mm = INIT_MM(init_mm);
+EXPORT_SYMBOL(init_mm);
+
+union thread_union init_thread_union
+	__attribute__((__section__(".data.init_task"))) =
+{ INIT_THREAD_INFO(init_task) };
+
+struct task_struct init_task = INIT_TASK(init_task);
+EXPORT_SYMBOL(init_task);
diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
new file mode 100644
index 0000000..679fe19
--- /dev/null
+++ b/arch/microblaze/kernel/process.c
@@ -0,0 +1,129 @@
+/*
+ * arch/microblaze/kernel/process.c
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/pm.h>
+
+#include <asm/system.h>
+
+/* FIXME */
+void show_regs(struct pt_regs *regs)
+{
+	unsigned long *p;
+	int i;
+	printk(KERN_INFO "pc:\t0x%08lx\tsp:\t0x%08lx\n", regs->pc, regs->r1);
+	printk(KERN_INFO
+		"flags:\t0x%08lx\tear:\t0x%08lx\tesr:\t"
+		"0x%08lx\tfsr:\t0x%08lx\n",
+		regs->msr, regs->ear, regs->esr, regs->fsr);
+	printk(KERN_INFO
+		"r0:\t0x%08lx\tr1:\t0x%08lx\tr2:\t0x%08lx\tr3\t0x%08lx\n",
+		0L, regs->r1, regs->r2, regs->r3);
+	for (i = 4, p = &(regs->r4); i < 32; i += 4, p += 4) {
+		printk(KERN_INFO "r%i:\t0x%08lx\tr%i:\t0x%08lx\tr%i:\t"
+			"0x%08lx\tr%i:\t0x%08lx\n",
+			i, *p, i+1, *(p+1), i+2, *(p+2), i+3, *(p+3));
+	}
+	printk(KERN_INFO "\n");
+}
+
+void (*pm_power_off)(void) = NULL;
+EXPORT_SYMBOL(pm_power_off);
+
+void cpu_idle(void)
+{
+	set_thread_flag(TIF_POLLING_NRFLAG);
+
+	while (1) {
+		while (!need_resched())
+			cpu_relax();
+
+		preempt_enable_no_resched();
+		schedule();
+		preempt_disable();
+	}
+}
+
+void flush_thread(void)
+{
+}
+
+int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
+		unsigned long unused,
+		struct task_struct *p, struct pt_regs *regs)
+{
+	struct pt_regs *childregs = task_pt_regs(p);
+	struct thread_info *ti = task_thread_info(p);
+
+	*childregs = *regs;
+
+	if (user_mode(regs))
+		childregs->r1 = usp;
+	else
+		childregs->r1 = ((unsigned long) ti) + THREAD_SIZE;
+
+	memset(&ti->cpu_context, 0, sizeof(struct cpu_context));
+	ti->cpu_context.sp = (unsigned long)childregs;
+	ti->cpu_context.msr = (unsigned long)childregs->msr;
+	ti->cpu_context.r15 = (unsigned long)ret_from_fork - 8;
+
+	if (clone_flags & CLONE_SETTLS)
+		;/* FIXME: not sure what to do */
+
+	return 0;
+}
+
+/*
+ * Return saved PC of a blocked thread.
+ * FIXME this needs to be checked
+ */
+unsigned long thread_saved_pc(struct task_struct *tsk)
+{
+	struct cpu_context *ctx =
+		&(((struct thread_info *)(tsk->stack))->cpu_context);
+
+	/* Check whether the thread is blocked in resume() */
+	if (in_sched_functions(ctx->r15))
+		return ((unsigned long)ctx->r15);
+	else
+		return ctx->r14;
+}
+
+static void kernel_thread_helper(int (*fn)(void *), void *arg)
+{
+	fn(arg);
+	do_exit(-1);
+}
+
+int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
+{
+	struct pt_regs regs;
+	int ret;
+
+	memset(&regs, 0, sizeof(regs));
+	/* store them in non-volatile registers */
+	regs.r5 = (unsigned long)fn;
+	regs.r6 = (unsigned long)arg;
+	local_save_flags(regs.msr);
+	regs.pc = (unsigned long)kernel_thread_helper;
+	regs.kernel_mode = 1;
+
+	ret = do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0,
+			&regs, 0, NULL, NULL);
+
+	return ret;
+}
+
+unsigned long get_wchan(struct task_struct *p)
+{
+/* TBD (used by procfs) */
+	return 0;
+}
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 24/56] microblaze_v2: time support
  2008-05-04 11:41                                             ` [PATCH 23/56] microblaze_v2: process and init task function monstr
@ 2008-05-04 11:41                                               ` monstr
  2008-05-04 11:41                                                 ` [PATCH 25/56] microblaze_v2: ptrace support monstr
                                                                   ` (2 more replies)
  0 siblings, 3 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 arch/microblaze/kernel/time.c  |   90 ++++++++++++++++++++++++++++++++++++++++
 include/asm-microblaze/delay.h |   33 +++++++++++++++
 include/asm-microblaze/timex.h |   20 +++++++++
 3 files changed, 143 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/time.c
 create mode 100644 include/asm-microblaze/delay.h
 create mode 100644 include/asm-microblaze/timex.h

diff --git a/arch/microblaze/kernel/time.c b/arch/microblaze/kernel/time.c
new file mode 100644
index 0000000..d5ebdff
--- /dev/null
+++ b/arch/microblaze/kernel/time.c
@@ -0,0 +1,90 @@
+/*
+ * arch/microblaze/kernel/time.c
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/param.h>
+#include <linux/jiffies.h>
+#include <linux/time.h>
+#include <linux/hrtimer.h>
+#include <asm/bug.h>
+#include <asm/setup.h>
+
+void time_init(void)
+{
+	system_timer_init();
+}
+
+int do_settimeofday(struct timespec *tv)
+{
+	if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
+		return -EINVAL;
+
+	write_seqlock_irq(&xtime_lock);
+
+	/* This is revolting. We need to set the xtime.tv_nsec
+	 * correctly. However, the value in this location is
+	 * is value at the last tick.
+	 * Discover what correction gettimeofday
+	 * would have done, and then undo it!
+	 */
+#if 0
+	tv->tv_nsec -= mach_gettimeoffset() * 1000;
+#endif
+
+	while (tv->tv_nsec < 0) {
+		tv->tv_nsec += NSEC_PER_SEC;
+		tv->tv_sec--;
+	}
+
+	xtime.tv_sec = tv->tv_sec;
+	xtime.tv_nsec = tv->tv_nsec;
+
+	time_adjust = 0;
+	time_status |= STA_UNSYNC;
+	time_maxerror = NTP_PHASE_LIMIT;
+	time_esterror = NTP_PHASE_LIMIT;
+
+	write_sequnlock_irq(&xtime_lock);
+	clock_was_set();
+	return 0;
+}
+EXPORT_SYMBOL(do_settimeofday);
+
+/*
+ * This version of gettimeofday has near microsecond resolution.
+ */
+void do_gettimeofday(struct timeval *tv)
+{
+	unsigned long seq;
+	unsigned long usec, sec;
+	/* unsigned long max_ntp_tick = tick_usec - tickadj; */
+
+	do {
+		seq = read_seqbegin(&xtime_lock);
+		usec = do_gettimeoffset();
+		sec = xtime.tv_sec;
+		usec += (xtime.tv_nsec / 1000);
+	} while (read_seqretry(&xtime_lock, seq));
+
+	while (usec >= 1000000) {
+		usec -= 1000000;
+		sec++;
+	}
+
+	tv->tv_sec = sec;
+	tv->tv_usec = usec;
+}
+EXPORT_SYMBOL(do_gettimeofday);
+
+unsigned long long sched_clock(void)
+{
+	return (unsigned long long)jiffies * (1000000000 / HZ);
+}
diff --git a/include/asm-microblaze/delay.h b/include/asm-microblaze/delay.h
new file mode 100644
index 0000000..481359c
--- /dev/null
+++ b/include/asm-microblaze/delay.h
@@ -0,0 +1,33 @@
+/*
+ * 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) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_DELAY_H
+#define _ASM_MICROBLAZE_DELAY_H
+
+#include <asm/param.h>
+
+static 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));
+}
+
+static inline void udelay(unsigned long usec)
+{
+	unsigned long long tmp = usec;
+	unsigned long loops = (tmp * 4295 * HZ * loops_per_jiffy) >> 32;
+	__delay(loops);
+}
+
+#endif /* _ASM_MICROBLAZE_DELAY_H */
diff --git a/include/asm-microblaze/timex.h b/include/asm-microblaze/timex.h
new file mode 100644
index 0000000..b3e77ef
--- /dev/null
+++ b/include/asm-microblaze/timex.h
@@ -0,0 +1,20 @@
+/*
+ * include/asm-microblaze/timex.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_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 */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 25/56] microblaze_v2: ptrace support
  2008-05-04 11:41                                               ` [PATCH 24/56] microblaze_v2: time support monstr
@ 2008-05-04 11:41                                                 ` monstr
  2008-05-04 11:41                                                   ` [PATCH 26/56] microblaze_v2: traps support monstr
  2008-05-05  2:19                                                 ` [PATCH 24/56] microblaze_v2: time support John Williams
  2008-05-07  7:22                                                 ` Thomas Gleixner
  2 siblings, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 arch/microblaze/kernel/ptrace.c |  206 +++++++++++++++++++++++++++++++++++++++
 include/asm-microblaze/ptrace.h |   70 +++++++++++++
 2 files changed, 276 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/ptrace.c
 create mode 100644 include/asm-microblaze/ptrace.h

diff --git a/arch/microblaze/kernel/ptrace.c b/arch/microblaze/kernel/ptrace.c
new file mode 100644
index 0000000..958f076
--- /dev/null
+++ b/arch/microblaze/kernel/ptrace.c
@@ -0,0 +1,206 @@
+/*
+ * arch/microblaze/kernel/ptrace.c -- `ptrace' system call
+ *
+ * Copyright (C) 2008 Michal Simek <monstr@monstr.eu>
+ * Copyright (C) 2007 PetaLogix
+ * Copyright (C) 2004-07 John Williams <john.williams@petalogix.com>
+ *
+ * derived from arch/v850/kernel/ptrace.c
+ *
+ * Copyright (C) 2002,03 NEC Electronics Corporation
+ * Copyright (C) 2002,03 Miles Bader <miles@gnu.org>
+ *
+ * Derived from arch/mips/kernel/ptrace.c:
+ *
+ * Copyright (C) 1992 Ross Biro
+ * Copyright (C) Linus Torvalds
+ * Copyright (C) 1994, 95, 96, 97, 98, 2000 Ralf Baechle
+ * Copyright (C) 1996 David S. Miller
+ * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
+ * Copyright (C) 1999 MIPS Technologies, Inc.
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file COPYING in the main directory of this
+ * archive for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/sched.h>
+#include <linux/smp_lock.h>
+#include <linux/ptrace.h>
+#include <linux/signal.h>
+
+#include <asm/errno.h>
+#include <asm/ptrace.h>
+#include <asm/processor.h>
+#include <asm/uaccess.h>
+#include <asm/asm-offsets.h>
+
+/* Returns the address where the register at REG_OFFS in P is stashed away. */
+static microblaze_reg_t *reg_save_addr(unsigned reg_offs,
+					struct task_struct *t)
+{
+	struct pt_regs *regs;
+
+	/*
+	 * Three basic cases:
+	 *
+	 * (1)	A register normally saved before calling the scheduler, is
+	 *	available in the kernel entry pt_regs structure at the top
+	 *	of the kernel stack. The kernel trap/irq exit path takes
+	 *	care to save/restore almost all registers for ptrace'd
+	 *	processes.
+	 *
+	 * (2)	A call-clobbered register, where the process P entered the
+	 *	kernel via [syscall] trap, is not stored anywhere; that's
+	 *	OK, because such registers are not expected to be preserved
+	 *	when the trap returns anyway (so we don't actually bother to
+	 *	test for this case).
+	 *
+	 * (3)	A few registers not used at all by the kernel, and so
+	 *	normally never saved except by context-switches, are in the
+	 *	context switch state.
+	 */
+
+	/* Register saved during kernel entry (or not available). */
+	regs = task_pt_regs(t);
+
+	return (microblaze_reg_t *)((char *)regs + reg_offs);
+}
+
+long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+{
+	int rval;
+
+	switch (request) {
+		unsigned long val, copied;
+
+	case PTRACE_PEEKTEXT: /* read word at location addr. */
+	case PTRACE_PEEKDATA:
+		pr_debug("PEEKTEXT/PEEKDATA at %08lX\n", addr);
+		copied = access_process_vm(child, addr, &val, sizeof(val), 0);
+		rval = -EIO;
+		if (copied != sizeof(val))
+			break;
+		rval = put_user(val, (unsigned long *)data);
+		goto out;
+
+	case PTRACE_POKETEXT: /* write the word at location addr. */
+	case PTRACE_POKEDATA:
+		pr_debug("POKETEXT/POKEDATA to %08lX\n", addr);
+		rval = 0;
+		if (access_process_vm(child, addr, &data, sizeof(data), 1)
+			== sizeof(data))
+			break;
+		rval = -EIO;
+		goto out;
+
+	/* Read/write the word at location ADDR in the registers. */
+	case PTRACE_PEEKUSR:
+	case PTRACE_POKEUSR:
+		pr_debug("PEEKUSR/POKEUSR : 0x%08lx\n", addr);
+		rval = 0;
+		if (addr >= PT_SIZE && request == PTRACE_PEEKUSR) {
+			/* Special requests that don't actually correspond
+			 to offsets in struct pt_regs. */
+			if (addr == PT_TEXT_ADDR) {
+				val = child->mm->start_code;
+			} else if (addr == PT_DATA_ADDR) {
+				val = child->mm->start_data;
+			} else if (addr == PT_TEXT_LEN) {
+				val = child->mm->end_code
+					- child->mm->start_code;
+			} else {
+				rval = -EIO;
+			}
+		} else if (addr >= 0 && addr < PT_SIZE && (addr & 0x3) == 0) {
+			microblaze_reg_t *reg_addr = reg_save_addr(addr, child);
+			if (request == PTRACE_PEEKUSR)
+				val = *reg_addr;
+			else
+				*reg_addr = data;
+		} else
+			rval = -EIO;
+
+		if (rval == 0 && request == PTRACE_PEEKUSR)
+			rval = put_user(val, (unsigned long *)data);
+		goto out;
+
+	/* Continue and stop at next (return from) syscall */
+	case PTRACE_SYSCALL:
+		pr_debug("PTRACE_SYSCALL\n");
+	case PTRACE_SINGLESTEP:
+		pr_debug("PTRACE_SINGLESTEP\n");
+	/* Restart after a signal. */
+	case PTRACE_CONT:
+		pr_debug("PTRACE_CONT\n");
+		rval = -EIO;
+		if (!valid_signal(data))
+			break;
+
+		if (request == PTRACE_SYSCALL)
+			set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
+		else
+			clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
+
+		child->exit_code = data;
+		pr_debug("wakeup_process\n");
+		wake_up_process(child);
+		rval = 0;
+		break;
+
+	/*
+	 * make the child exit. Best I can do is send it a sigkill.
+	 * perhaps it should be put in the status that it wants to
+	 * exit.
+	 */
+	case PTRACE_KILL:
+		pr_debug("PTRACE_KILL\n");
+		rval = 0;
+		if (child->exit_state == EXIT_ZOMBIE)	/* already dead */
+			break;
+		child->exit_code = SIGKILL;
+		wake_up_process(child);
+		break;
+
+	case PTRACE_DETACH: /* detach a process that was attached. */
+		pr_debug("PTRACE_DETACH\n");
+		rval = ptrace_detach(child, data);
+		break;
+
+	default:
+		rval = -EIO;
+		goto out;
+	}
+ out:
+	return rval;
+}
+
+#if 0
+static asmlinkage void syscall_trace(void)
+{
+	if (!test_thread_flag(TIF_SYSCALL_TRACE))
+		return;
+	if (!(current->ptrace & PT_PTRACED))
+		return;
+	/* The 0x80 provides a way for the tracing parent to distinguish
+	 between a syscall stop and SIGTRAP delivery */
+	ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
+				? 0x80 : 0));
+	/*
+	 * this isn't the same as continuing with a signal, but it will do
+	 * for normal use. strace only continues with a signal if the
+	 * stopping signal is not SIGTRAP. -brl
+	 */
+	if (current->exit_code) {
+		send_sig(current->exit_code, current, 1);
+		current->exit_code = 0;
+	}
+}
+#endif
+
+void ptrace_disable(struct task_struct *child)
+{
+	/* nothing to do */
+}
diff --git a/include/asm-microblaze/ptrace.h b/include/asm-microblaze/ptrace.h
new file mode 100644
index 0000000..f7ba49c
--- /dev/null
+++ b/include/asm-microblaze/ptrace.h
@@ -0,0 +1,70 @@
+/*
+ * include/asm-microblaze/ptrace.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_PTRACE_H
+#define _ASM_MICROBLAZE_PTRACE_H
+
+#ifndef __ASSEMBLY__
+#include <asm/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)
+
+extern void show_regs(struct pt_regs *);
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* _ASM_MICROBLAZE_PTRACE_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 26/56] microblaze_v2: traps support
  2008-05-04 11:41                                                 ` [PATCH 25/56] microblaze_v2: ptrace support monstr
@ 2008-05-04 11:41                                                   ` monstr
  2008-05-04 11:41                                                     ` [PATCH 27/56] microblaze_v2: support for a.out monstr
  0 siblings, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 arch/microblaze/kernel/traps.c |   88 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 88 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/traps.c

diff --git a/arch/microblaze/kernel/traps.c b/arch/microblaze/kernel/traps.c
new file mode 100644
index 0000000..eb8202b
--- /dev/null
+++ b/arch/microblaze/kernel/traps.c
@@ -0,0 +1,88 @@
+/*
+ * arch/microblaze/kernel/traps.c
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#include <linux/kernel.h>
+#include <linux/kallsyms.h>
+#include <linux/module.h>
+#include <linux/sched.h>
+
+#include <asm/exceptions.h>
+#include <asm/system.h>
+
+void trap_init(void)
+{
+	initialize_exception_handlers();
+	__enable_hw_exceptions();
+}
+
+void __bad_xchg(volatile void *ptr, int size)
+{
+	printk(KERN_INFO "xchg: bad data size: pc 0x%p, ptr 0x%p, size %d\n",
+		__builtin_return_address(0), ptr, size);
+	BUG();
+}
+EXPORT_SYMBOL(__bad_xchg);
+
+static int kstack_depth_to_print = 24;
+
+void show_trace(struct task_struct *task, unsigned long *stack)
+{
+	unsigned long addr;
+
+	if (!stack)
+		stack = (unsigned long *)&stack;
+
+	printk(KERN_INFO "Call Trace: ");
+#ifdef CONFIG_KALLSYMS
+	printk(KERN_INFO "\n");
+#endif
+	while (!kstack_end(stack)) {
+		addr = *stack++;
+		if (__kernel_text_address(addr)) {
+			printk(KERN_INFO "[<%08lx>] ", addr);
+			print_symbol("%s\n", addr);
+		}
+	}
+	printk(KERN_INFO "\n");
+}
+
+void show_stack(struct task_struct *task, unsigned long *sp)
+{
+	unsigned long *stack;
+	int i;
+
+	if (sp == NULL) {
+		if (task)
+			sp = (unsigned long *) ((struct thread_info *)
+						(task->stack))->cpu_context.sp;
+		else
+			sp = (unsigned long *)&sp;
+	}
+
+	stack = 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);
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 27/56] microblaze_v2: support for a.out
  2008-05-04 11:41                                                   ` [PATCH 26/56] microblaze_v2: traps support monstr
@ 2008-05-04 11:41                                                     ` monstr
  2008-05-04 11:41                                                       ` [PATCH 28/56] microblaze_v2: memory inicialization, MMU, TLB monstr
  0 siblings, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/a.out.h |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/a.out.h

diff --git a/include/asm-microblaze/a.out.h b/include/asm-microblaze/a.out.h
new file mode 100644
index 0000000..31729e4
--- /dev/null
+++ b/include/asm-microblaze/a.out.h
@@ -0,0 +1,14 @@
+/*
+ * include/asm-microblaze/a.out.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_A_OUT_H
+#define _ASM_MICROBLAZE_A_OUT_H
+
+#endif /* _ASM_MICROBLAZE_A_OUT_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 28/56] microblaze_v2: memory inicialization, MMU, TLB
  2008-05-04 11:41                                                     ` [PATCH 27/56] microblaze_v2: support for a.out monstr
@ 2008-05-04 11:41                                                       ` monstr
  2008-05-04 11:41                                                         ` [PATCH 29/56] microblaze_v2: page.h, segment.h, unaligned.h monstr
  0 siblings, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 arch/microblaze/mm/init.c            |  184 ++++++++++++++++++++++++++++++++++
 include/asm-microblaze/mmu.h         |   19 ++++
 include/asm-microblaze/mmu_context.h |   24 +++++
 include/asm-microblaze/tlb.h         |   18 ++++
 include/asm-microblaze/tlbflush.h    |   22 ++++
 5 files changed, 267 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/mm/init.c
 create mode 100644 include/asm-microblaze/mmu.h
 create mode 100644 include/asm-microblaze/mmu_context.h
 create mode 100644 include/asm-microblaze/tlb.h
 create mode 100644 include/asm-microblaze/tlbflush.h

diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
new file mode 100644
index 0000000..d3c042a
--- /dev/null
+++ b/arch/microblaze/mm/init.c
@@ -0,0 +1,184 @@
+/*
+ * arch/microblaze/mm/init.c
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2007 Michal Simek <monstr@monstr.eu>
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#include <linux/autoconf.h>
+#include <linux/init.h>
+#include <linux/mm.h>
+#include "../../../mm/internal.h"
+#include <linux/swap.h>
+#include <linux/bootmem.h>
+#include <linux/pfn.h>
+#include <asm/sections.h>
+
+#include <asm/lmb.h>
+#include <asm/uaccess.h>
+#include <asm/system.h>
+#include <asm/pgtable.h>
+
+#undef DEBUG
+
+char *klimit = _end;
+static unsigned int memory_start;
+static unsigned int memory_end;
+
+unsigned int __page_offset;
+EXPORT_SYMBOL(__page_offset);
+
+void __init setup_memory(void)
+{
+	int i;
+	unsigned int start, end;
+	unsigned long map_size;
+	unsigned long start_pfn = 0;
+	unsigned long end_pfn = 0;
+
+	/* Find main memory where is the kernel */
+	for (i = 0; i < lmb.memory.cnt; i++) {
+		start_pfn = lmb.memory.region[i].base >> PAGE_SHIFT;
+		end_pfn = start_pfn + lmb_size_pages(&lmb.memory, i);
+		if ((start_pfn <= (((int)_text) >> PAGE_SHIFT)) &&
+			(((int)_text >> PAGE_SHIFT) <= end_pfn)) {
+			memory_end = (end_pfn << PAGE_SHIFT) - 1;
+			PAGE_OFFSET = memory_start = start_pfn << PAGE_SHIFT;
+			pr_debug("%s: Main mem: 0x%x-0x%x\n", __func__,
+				memory_start, memory_end);
+			break;
+		}
+	}
+	/*
+	 * start_pfn - start page - starting point
+	 * end_pfn - first unused page
+	 * memory_start - base physical address of main memory
+	 * memory_end - end physical address of main memory
+	 * PAGE_OFFSET - moving of first page
+	 *
+	 * Kernel:
+	 * start: base phys address of kernel - page align
+	 * end: base phys address of kernel - page align
+	 *
+	 * min_low_pfn - the first page (mm/bootmem.c - node_boot_start)
+	 * max_low_pfn
+	 * max_mapnr - the first unused page (mm/bootmem.c - node_low_pfn)
+	 * num_physpages - number of all pages
+	 *
+	 */
+
+	/* reservation of region where is the kernel */
+	start = PFN_DOWN((int)_text) << PAGE_SHIFT;
+	end = PAGE_ALIGN((unsigned long)klimit);
+	lmb_reserve(start, end - start);
+	pr_debug("%s: kernel addr 0x%08x-0x%08x\n", __func__, start, end);
+
+	/* calculate free pages, etc. */
+	min_low_pfn = PFN_UP(start_pfn << PAGE_SHIFT);
+	max_mapnr = PFN_DOWN((end_pfn << PAGE_SHIFT));
+	max_low_pfn = max_mapnr - min_low_pfn;
+	num_physpages = max_mapnr - min_low_pfn + 1;
+	printk(KERN_INFO "%s: max_mapnr: %#lx\n", __func__, max_mapnr);
+	printk(KERN_INFO "%s: min_low_pfn: %#lx\n", __func__, min_low_pfn);
+	printk(KERN_INFO "%s: max_low_pfn: %#lx\n", __func__, max_low_pfn);
+
+	/* add place for data pages */
+	map_size = init_bootmem_node(NODE_DATA(0), PFN_UP(end),
+			min_low_pfn, max_mapnr);
+	lmb_reserve(PFN_UP(end) << PAGE_SHIFT, map_size);
+
+	/* free bootmem is whole main memory */
+	free_bootmem(start_pfn << PAGE_SHIFT,
+			((end_pfn - start_pfn) << PAGE_SHIFT) - 1);
+
+	/* reserve allocate blocks */
+	for (i = 1; i < lmb.reserved.cnt; i++) {
+		pr_debug("reserved %d - 0x%08x-0x%08x\n", i,
+			(u32) lmb.reserved.region[i].base,
+			(u32) lmb_size_bytes(&lmb.reserved, i));
+		reserve_bootmem(lmb.reserved.region[i].base,
+			lmb_size_bytes(&lmb.reserved, i) - 1, BOOTMEM_DEFAULT);
+	}
+}
+
+void __init paging_init(void)
+{
+	int i;
+	unsigned long zones_size[MAX_NR_ZONES];
+
+	/* we can DMA to/from any address.  put all page into
+	 * ZONE_DMA. */
+	zones_size[ZONE_NORMAL] = max_low_pfn;
+
+	/* every other zones are empty */
+	for (i = 1; i < MAX_NR_ZONES; i++)
+		zones_size[i] = 0;
+
+	free_area_init_node(0, NODE_DATA(0), zones_size,
+		NODE_DATA(0)->bdata->node_boot_start >> PAGE_SHIFT, NULL);
+}
+
+void free_init_pages(char *what, unsigned long begin, unsigned long end)
+{
+	unsigned long addr;
+
+	for (addr = begin; addr < end; addr += PAGE_SIZE) {
+		ClearPageReserved(virt_to_page(addr));
+		init_page_count(virt_to_page(addr));
+		memset((void *)addr, 0xcc, PAGE_SIZE);
+		free_page(addr);
+		totalram_pages++;
+	}
+	printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
+}
+
+#ifdef CONFIG_BLK_DEV_INITRD
+void free_initrd_mem(unsigned long start, unsigned long end)
+{
+	int pages = 0;
+	for (; start < end; start += PAGE_SIZE) {
+		ClearPageReserved(virt_to_page(start));
+		set_page_count(virt_to_page(start), 1);
+		free_page(start);
+		totalram_pages++;
+		pages++;
+	}
+	printk(KERN_NOTICE "Freeing initrd memory: %dk freed\n", pages);
+}
+#endif
+
+void free_initmem(void)
+{
+	free_init_pages("unused kernel memory",
+			(unsigned long)(&__init_begin),
+			(unsigned long)(&__init_end));
+}
+
+/* FIXME from arch/powerpc/mm/mem.c*/
+void show_mem(void)
+{
+	printk(KERN_NOTICE "%s\n", __func__);
+}
+
+void __init mem_init(void)
+{
+	high_memory = (void *)(memory_end);
+
+	/* this will put all memory onto the freelists */
+	totalram_pages += free_all_bootmem();
+
+	printk(KERN_INFO "Memory: %luk/%luk available\n",
+	       (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
+	       num_physpages << (PAGE_SHIFT-10));
+}
+
+/* Check against bounds of physical memory */
+int ___range_ok(unsigned long addr, unsigned long size)
+{
+	return ((addr < memory_start) ||
+		((addr + size) >= memory_end));
+}
diff --git a/include/asm-microblaze/mmu.h b/include/asm-microblaze/mmu.h
new file mode 100644
index 0000000..f1e158f
--- /dev/null
+++ b/include/asm-microblaze/mmu.h
@@ -0,0 +1,19 @@
+/*
+ * include/asm-microblaze/mmu.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_MMU_H
+#define _ASM_MICROBLAZE_MMU_H
+
+typedef struct {
+	struct vm_list_struct	*vmlist;
+	unsigned long		end_brk;
+} mm_context_t;
+
+#endif /* _ASM_MICROBLAZE_MMU_H */
diff --git a/include/asm-microblaze/mmu_context.h b/include/asm-microblaze/mmu_context.h
new file mode 100644
index 0000000..f5433c7
--- /dev/null
+++ b/include/asm-microblaze/mmu_context.h
@@ -0,0 +1,24 @@
+/*
+ * include/asm-microblaze/mmu_context.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_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 */
diff --git a/include/asm-microblaze/tlb.h b/include/asm-microblaze/tlb.h
new file mode 100644
index 0000000..60c4df6
--- /dev/null
+++ b/include/asm-microblaze/tlb.h
@@ -0,0 +1,18 @@
+/*
+ * include/asm-microblaze/tlb.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_TLB_H
+#define _ASM_MICROBLAZE_TLB_H
+
+#define tlb_flush(tlb)	do {} while (0)
+
+#include <asm-generic/tlb.h>
+
+#endif /* _ASM_MICROBLAZE_TLB_H */
diff --git a/include/asm-microblaze/tlbflush.h b/include/asm-microblaze/tlbflush.h
new file mode 100644
index 0000000..e1b4f6b
--- /dev/null
+++ b/include/asm-microblaze/tlbflush.h
@@ -0,0 +1,22 @@
+/*
+ * include/asm-microblaze/tlbflush.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_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 */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 29/56] microblaze_v2: page.h, segment.h, unaligned.h
  2008-05-04 11:41                                                       ` [PATCH 28/56] microblaze_v2: memory inicialization, MMU, TLB monstr
@ 2008-05-04 11:41                                                         ` monstr
  2008-05-04 11:41                                                           ` [PATCH 30/56] microblaze_v2: includes SHM*, msgbuf monstr
  0 siblings, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/page.h      |  119 ++++++++++++++++++++++++++++++++++++
 include/asm-microblaze/segment.h   |   42 +++++++++++++
 include/asm-microblaze/unaligned.h |   16 +++++
 3 files changed, 177 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/page.h
 create mode 100644 include/asm-microblaze/segment.h
 create mode 100644 include/asm-microblaze/unaligned.h

diff --git a/include/asm-microblaze/page.h b/include/asm-microblaze/page.h
new file mode 100644
index 0000000..5c7c262
--- /dev/null
+++ b/include/asm-microblaze/page.h
@@ -0,0 +1,119 @@
+/*
+ * include/asm-microblaze/page.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_PAGE_H
+#define _ASM_MICROBLAZE_PAGE_H
+
+#include <linux/autoconf.h>
+#include <linux/pfn.h>
+
+/* PAGE_SHIFT determines the page size */
+
+#define PAGE_SHIFT	(12)
+#define PAGE_SIZE	(1UL << PAGE_SHIFT)
+#define PAGE_MASK	(~(PAGE_SIZE-1))
+
+#ifdef __KERNEL__
+
+#include <asm/setup.h>
+
+#ifndef __ASSEMBLY__
+
+#define get_user_page(vaddr)			__get_free_page(GFP_KERNEL)
+#define free_user_page(page, addr)		free_page(addr)
+
+#define clear_page(pgaddr)			memset((pgaddr), 0, PAGE_SIZE)
+#define copy_page(to, from)			memcpy((to), (from), PAGE_SIZE)
+
+#define clear_user_page(pgaddr, vaddr, page)	memset((pgaddr), 0, PAGE_SIZE)
+#define copy_user_page(vto, vfrom, vaddr, topg) \
+			memcpy((vto), (vfrom), PAGE_SIZE)
+
+/*
+ * These are used to make use of C type-checking..
+ */
+typedef struct { unsigned long	pte; }		pte_t;
+typedef struct { unsigned long	ste[64]; }	pmd_t;
+typedef struct { pmd_t		pue[1]; }	pud_t;
+typedef struct { pud_t		pge[1]; }	pgd_t;
+typedef struct { unsigned long	pgprot; }	pgprot_t;
+typedef struct page *pgtable_t;
+
+#define pte_val(x)	((x).pte)
+#define pmd_val(x)	((x).ste[0])
+#define pud_val(x)	((x).pue[0])
+#define pgd_val(x)	((x).pge[0])
+#define pgprot_val(x)	((x).pgprot)
+
+#define __pte(x)	((pte_t) { (x) })
+#define __pmd(x)	((pmd_t) { (x) })
+#define __pgd(x)	((pgd_t) { (x) })
+#define __pgprot(x)	((pgprot_t) { (x) })
+
+/* 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)
+
+/* to align the pointer to the (next) page boundary */
+#define PAGE_ALIGN(addr)	(((addr) + PAGE_SIZE - 1) & PAGE_MASK)
+
+extern unsigned int __page_offset;
+#define PAGE_OFFSET __page_offset
+
+/**
+ * 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)))
+
+#define pfn_valid(pfn)		((pfn) >= min_low_pfn && (pfn) < max_mapnr)
+#define	virt_addr_valid(vaddr)	(pfn_valid(virt_to_pfn(vaddr)))
+
+#define ARCH_PFN_OFFSET		(PAGE_OFFSET >> PAGE_SHIFT)
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* __KERNEL__ */
+
+#include <asm-generic/memory_model.h>
+#include <asm-generic/page.h>
+
+#endif /* _ASM_MICROBLAZE_PAGE_H */
diff --git a/include/asm-microblaze/segment.h b/include/asm-microblaze/segment.h
new file mode 100644
index 0000000..af0ddf0
--- /dev/null
+++ b/include/asm-microblaze/segment.h
@@ -0,0 +1,42 @@
+/*
+ * include/asm-microblaze/segment.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_SEGMENT_H
+#define _ASM_MICROBLAZE_SEGMENT_H
+
+#ifndef __ASSEMBLY__
+
+typedef struct {
+	unsigned long seg;
+} mm_segment_t;
+
+/*
+ * The fs value determines whether argument validity checking should be
+ * performed or not. If get_fs() == USER_DS, checking is performed, with
+ * get_fs() == KERNEL_DS, checking is bypassed.
+ *
+ * For historical reasons, these macros are grossly misnamed.
+ *
+ * For non-MMU arch like Microblaze, KERNEL_DS and USER_DS is equal.
+ */
+#define KERNEL_DS	((mm_segment_t){0})
+#define USER_DS		KERNEL_DS
+
+#define get_ds()	(KERNEL_DS)
+#define get_fs()	(current_thread_info()->addr_limit)
+#define set_fs(x) \
+		do { current_thread_info()->addr_limit = (x); } while (0)
+
+#define segment_eq(a, b)		((a).seg == (b).seg)
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* _ASM_MICROBLAZE_SEGMENT_H */
diff --git a/include/asm-microblaze/unaligned.h b/include/asm-microblaze/unaligned.h
new file mode 100644
index 0000000..aff800d
--- /dev/null
+++ b/include/asm-microblaze/unaligned.h
@@ -0,0 +1,16 @@
+/*
+ * include/asm-microblaze/unaligned.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_UNALIGNED_H
+#define _ASM_MICROBLAZE_UNALIGNED_H
+
+#include <asm-generic/unaligned.h>
+
+#endif /* _ASM_MICROBLAZE_UNALIGNED_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 30/56] microblaze_v2: includes SHM*, msgbuf
  2008-05-04 11:41                                                         ` [PATCH 29/56] microblaze_v2: page.h, segment.h, unaligned.h monstr
@ 2008-05-04 11:41                                                           ` monstr
  2008-05-04 11:41                                                             ` [PATCH 31/56] microblaze_v2: bug headers files monstr
  2008-05-04 21:10                                                             ` [PATCH 30/56] microblaze_v2: includes SHM*, msgbuf Arnd Bergmann
  0 siblings, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/msgbuf.h   |   41 +++++++++++++++++++++++++++++
 include/asm-microblaze/shmbuf.h   |   52 +++++++++++++++++++++++++++++++++++++
 include/asm-microblaze/shmparam.h |   16 +++++++++++
 3 files changed, 109 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/msgbuf.h
 create mode 100644 include/asm-microblaze/shmbuf.h
 create mode 100644 include/asm-microblaze/shmparam.h

diff --git a/include/asm-microblaze/msgbuf.h b/include/asm-microblaze/msgbuf.h
new file mode 100644
index 0000000..e2f93f4
--- /dev/null
+++ b/include/asm-microblaze/msgbuf.h
@@ -0,0 +1,41 @@
+/*
+ * include/asm-microblaze/msgbuf.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_MSGBUF_H
+#define _ASM_MICROBLAZE_MSGBUF_H
+
+/*
+ * The msqid64_ds structure for m68k architecture.
+ * Note extra padding because this structure is passed back and forth
+ * between kernel and user space.
+ *
+ * Pad space is left for:
+ * - 64-bit time_t to solve y2038 problem
+ * - 2 miscellaneous 32-bit values
+ */
+
+struct msqid64_ds {
+	struct ipc64_perm msg_perm;
+	__kernel_time_t msg_stime; /* last msgsnd time */
+	unsigned long __unused1;
+	__kernel_time_t msg_rtime; /* last msgrcv time */
+	unsigned long __unused2;
+	__kernel_time_t msg_ctime; /* last change time */
+	unsigned long __unused3;
+	unsigned long msg_cbytes; /* current number of bytes on queue */
+	unsigned long msg_qnum; /* number of messages in queue */
+	unsigned long msg_qbytes; /* max number of bytes on queue */
+	__kernel_pid_t msg_lspid; /* pid of last msgsnd */
+	__kernel_pid_t msg_lrpid; /* last receive pid */
+	unsigned long __unused4;
+	unsigned long __unused5;
+};
+
+#endif /* _ASM_MICROBLAZE_MSGBUF_H */
diff --git a/include/asm-microblaze/shmbuf.h b/include/asm-microblaze/shmbuf.h
new file mode 100644
index 0000000..e3d759f
--- /dev/null
+++ b/include/asm-microblaze/shmbuf.h
@@ -0,0 +1,52 @@
+/*
+ * include/asm-microblaze/shmbuf.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_SHMBUF_H
+#define _ASM_MICROBLAZE_SHMBUF_H
+
+/*
+ * The shmid64_ds structure for m68k architecture.
+ * Note extra padding because this structure is passed back and forth
+ * between kernel and user space.
+ *
+ * Pad space is left for:
+ * - 64-bit time_t to solve y2038 problem
+ * - 2 miscellaneous 32-bit values
+ */
+
+struct shmid64_ds {
+	struct ipc64_perm	shm_perm; /* operation perms */
+	size_t			shm_segsz; /* size of segment (bytes) */
+	__kernel_time_t		shm_atime; /* last attach time */
+	unsigned long		__unused1;
+	__kernel_time_t		shm_dtime; /* last detach time */
+	unsigned long		__unused2;
+	__kernel_time_t		shm_ctime; /* last change time */
+	unsigned long		__unused3;
+	__kernel_pid_t		shm_cpid; /* pid of creator */
+	__kernel_pid_t		shm_lpid; /* pid of last operator */
+	unsigned long		shm_nattch; /* no. of current attaches */
+	unsigned long		__unused4;
+	unsigned long		__unused5;
+};
+
+struct shminfo64 {
+	unsigned long	shmmax;
+	unsigned long	shmmin;
+	unsigned long	shmmni;
+	unsigned long	shmseg;
+	unsigned long	shmall;
+	unsigned long	__unused1;
+	unsigned long	__unused2;
+	unsigned long	__unused3;
+	unsigned long	__unused4;
+};
+
+#endif /* _ASM_MICROBLAZE_SHMBUF_H */
diff --git a/include/asm-microblaze/shmparam.h b/include/asm-microblaze/shmparam.h
new file mode 100644
index 0000000..38e9be0
--- /dev/null
+++ b/include/asm-microblaze/shmparam.h
@@ -0,0 +1,16 @@
+/*
+ * include/asm-microblaze/shmparam.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_SHMPARAM_H
+#define _ASM_MICROBLAZE_SHMPARAM_H
+
+#define SHMLBA	PAGE_SIZE /* attach addr a multiple of this */
+
+#endif /* _ASM_MICROBLAZE_SHMPARAM_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 31/56] microblaze_v2: bug headers files
  2008-05-04 11:41                                                           ` [PATCH 30/56] microblaze_v2: includes SHM*, msgbuf monstr
@ 2008-05-04 11:41                                                             ` monstr
  2008-05-04 11:41                                                               ` [PATCH 32/56] microblaze_v2: definitions of types monstr
  2008-05-04 21:10                                                             ` [PATCH 30/56] microblaze_v2: includes SHM*, msgbuf Arnd Bergmann
  1 sibling, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/bug.h  |   17 +++++++++++++++++
 include/asm-microblaze/bugs.h |   19 +++++++++++++++++++
 2 files changed, 36 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/bug.h
 create mode 100644 include/asm-microblaze/bugs.h

diff --git a/include/asm-microblaze/bug.h b/include/asm-microblaze/bug.h
new file mode 100644
index 0000000..a0f58d1
--- /dev/null
+++ b/include/asm-microblaze/bug.h
@@ -0,0 +1,17 @@
+/*
+ * include/asm-microblaze/bug.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_BUG_H
+#define _ASM_MICROBLAZE_BUG_H
+
+#include <linux/kernel.h>
+#include <asm-generic/bug.h>
+
+#endif /* _ASM_MICROBLAZE_BUG_H */
diff --git a/include/asm-microblaze/bugs.h b/include/asm-microblaze/bugs.h
new file mode 100644
index 0000000..09256e7
--- /dev/null
+++ b/include/asm-microblaze/bugs.h
@@ -0,0 +1,19 @@
+/*
+ * include/asm-microblaze/bugs.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_BUGS_H
+#define _ASM_MICROBLAZE_BUGS_H
+
+static inline void check_bugs(void)
+{
+	/* nothing to do */
+}
+
+#endif /* _ASM_MICROBLAZE_BUGS_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 32/56] microblaze_v2: definitions of types
  2008-05-04 11:41                                                             ` [PATCH 31/56] microblaze_v2: bug headers files monstr
@ 2008-05-04 11:41                                                               ` monstr
  2008-05-04 11:41                                                                 ` [PATCH 33/56] microblaze_v2: ioctl support monstr
  2008-05-04 21:28                                                                 ` [PATCH 32/56] microblaze_v2: definitions of types Arnd Bergmann
  0 siblings, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/posix_types.h |   75 ++++++++++++++++++++++++++++++++++
 include/asm-microblaze/types.h       |   64 +++++++++++++++++++++++++++++
 2 files changed, 139 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/posix_types.h
 create mode 100644 include/asm-microblaze/types.h

diff --git a/include/asm-microblaze/posix_types.h b/include/asm-microblaze/posix_types.h
new file mode 100644
index 0000000..a4aa46e
--- /dev/null
+++ b/include/asm-microblaze/posix_types.h
@@ -0,0 +1,75 @@
+/*
+ * include/asm-microblaze/posix_types.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_POSIX_TYPES_H
+#define _ASM_MICROBLAZE_POSIX_TYPES_H
+
+/*
+ * This file is generally used by user-level software, so you need to
+ * be a little careful about namespace pollution etc. Also, we cannot
+ * assume GCC is being used.
+ */
+
+typedef unsigned long	__kernel_ino_t;
+typedef unsigned short	__kernel_mode_t;
+typedef unsigned short	__kernel_nlink_t;
+typedef long		__kernel_off_t;
+typedef int		__kernel_pid_t;
+typedef unsigned short	__kernel_ipc_pid_t;
+typedef unsigned short	__kernel_uid_t;
+typedef unsigned short	__kernel_gid_t;
+typedef unsigned int	__kernel_size_t;
+typedef int		__kernel_ssize_t;
+typedef int		__kernel_ptrdiff_t;
+typedef long		__kernel_time_t;
+typedef long		__kernel_suseconds_t;
+typedef long		__kernel_clock_t;
+typedef int		__kernel_timer_t;
+typedef int		__kernel_clockid_t;
+typedef int		__kernel_daddr_t;
+typedef char *		__kernel_caddr_t;
+typedef unsigned short	__kernel_uid16_t;
+typedef unsigned short	__kernel_gid16_t;
+typedef unsigned int	__kernel_uid32_t;
+typedef unsigned int	__kernel_gid32_t;
+
+typedef unsigned short	__kernel_old_uid_t;
+typedef unsigned short	__kernel_old_gid_t;
+typedef unsigned short	__kernel_old_dev_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 */
diff --git a/include/asm-microblaze/types.h b/include/asm-microblaze/types.h
new file mode 100644
index 0000000..052cc8f
--- /dev/null
+++ b/include/asm-microblaze/types.h
@@ -0,0 +1,64 @@
+/*
+ * include/asm-microblaze/types.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_TYPES_H
+#define _ASM_MICROBLAZE_TYPES_H
+
+#ifndef __ASSEMBLY__
+
+typedef unsigned short umode_t;
+
+/*
+ * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
+ * header files exported to user space
+ */
+
+typedef __signed__ char __s8;
+typedef unsigned char __u8;
+
+typedef __signed__ short __s16;
+typedef unsigned short __u16;
+
+typedef __signed__ int __s32;
+typedef unsigned int __u32;
+
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+typedef __signed__ long long __s64;
+typedef unsigned long long __u64;
+#endif
+
+/*
+ * These aren't exported outside the kernel to avoid name space clashes
+ */
+#ifdef __KERNEL__
+
+typedef __signed__ char s8;
+typedef unsigned char u8;
+
+typedef __signed__ short s16;
+typedef unsigned short u16;
+
+typedef __signed__ int s32;
+typedef unsigned int u32;
+
+typedef __signed__ long long s64;
+typedef unsigned long long u64;
+
+
+#define BITS_PER_LONG 32
+
+/* Dma addresses are 32-bits wide. */
+
+typedef u32 dma_addr_t;
+
+#endif/* __KERNEL__ */
+#endif
+
+#endif /* _ASM_MICROBLAZE_TYPES_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 33/56] microblaze_v2: ioctl support
  2008-05-04 11:41                                                               ` [PATCH 32/56] microblaze_v2: definitions of types monstr
@ 2008-05-04 11:41                                                                 ` monstr
  2008-05-04 11:41                                                                   ` [PATCH 34/56] microblaze_v2: io.h IO operations monstr
  2008-05-04 21:34                                                                   ` [PATCH 33/56] microblaze_v2: ioctl support Arnd Bergmann
  2008-05-04 21:28                                                                 ` [PATCH 32/56] microblaze_v2: definitions of types Arnd Bergmann
  1 sibling, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/ioctl.h  |   84 +++++++++++++++++++++++++++++++++++
 include/asm-microblaze/ioctls.h |   93 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 177 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/ioctl.h
 create mode 100644 include/asm-microblaze/ioctls.h

diff --git a/include/asm-microblaze/ioctl.h b/include/asm-microblaze/ioctl.h
new file mode 100644
index 0000000..7cfaaea
--- /dev/null
+++ b/include/asm-microblaze/ioctl.h
@@ -0,0 +1,84 @@
+/*
+ * include/asm-microblaze/ioctl.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_IOCTL_H
+#define _ASM_MICROBLAZE_IOCTL_H
+
+/*
+ * this was copied from the alpha as it's a bit cleaner there.
+ * -- Cort
+ */
+
+#define _IOC_NRBITS	8
+#define _IOC_TYPEBITS	8
+#define _IOC_SIZEBITS	13
+#define _IOC_DIRBITS	3
+
+#define _IOC_NRMASK	((1 << _IOC_NRBITS)-1)
+#define _IOC_TYPEMASK	((1 << _IOC_TYPEBITS)-1)
+#define _IOC_SIZEMASK	((1 << _IOC_SIZEBITS)-1)
+#define _IOC_DIRMASK	((1 << _IOC_DIRBITS)-1)
+
+#define _IOC_NRSHIFT	0
+#define _IOC_TYPESHIFT	(_IOC_NRSHIFT+_IOC_NRBITS)
+#define _IOC_SIZESHIFT	(_IOC_TYPESHIFT+_IOC_TYPEBITS)
+#define _IOC_DIRSHIFT	(_IOC_SIZESHIFT+_IOC_SIZEBITS)
+
+/*
+ * Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit.
+ * And this turns out useful to catch old ioctl numbers in header
+ * files for us.
+ */
+#define _IOC_NONE	1U
+#define _IOC_READ	2U
+#define _IOC_WRITE	4U
+
+#define _IOC(dir, type, nr, size) \
+	(((dir) << _IOC_DIRSHIFT) | \
+	((type) << _IOC_TYPESHIFT) | \
+	((nr) << _IOC_NRSHIFT) | \
+	((size) << _IOC_SIZESHIFT))
+
+/* provoke compile error for invalid uses of size argument */
+extern unsigned int __invalid_size_argument_for_IOC;
+#define _IOC_TYPECHECK(t) \
+	((sizeof(t) == sizeof(t[1]) && \
+	sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
+	sizeof(t) : __invalid_size_argument_for_IOC)
+
+/* used to create numbers */
+#define _IO(type, nr)		_IOC(_IOC_NONE, (type), (nr), 0)
+#define _IOR(type, nr, size) \
+			_IOC(_IOC_READ, (type), (nr), (_IOC_TYPECHECK(size)))
+#define _IOW(type, nr, size) \
+			_IOC(_IOC_WRITE, (type), (nr), (_IOC_TYPECHECK(size)))
+#define _IOWR(type, nr, size) \
+		_IOC(_IOC_READ|_IOC_WRITE, (type), (nr), (_IOC_TYPECHECK(size)))
+#define _IOR_BAD(type, nr, size) \
+			_IOC(_IOC_READ, (type), (nr), sizeof(size))
+#define _IOW_BAD(type, nr, size) \
+			_IOC(_IOC_WRITE, (type), (nr), sizeof(size))
+#define _IOWR_BAD(type, nr, size) \
+			_IOC(_IOC_READ|_IOC_WRITE, (type), (nr), sizeof(size))
+
+/* used to decode them.. */
+#define _IOC_DIR(nr)		(((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
+#define _IOC_TYPE(nr)		(((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
+#define _IOC_NR(nr)		(((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
+#define _IOC_SIZE(nr)		(((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
+
+/* various drivers, such as the pcmcia stuff, need these... */
+#define IOC_IN		(_IOC_WRITE << _IOC_DIRSHIFT)
+#define IOC_OUT		(_IOC_READ << _IOC_DIRSHIFT)
+#define IOC_INOUT	((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
+#define IOCSIZE_MASK	(_IOC_SIZEMASK << _IOC_SIZESHIFT)
+#define IOCSIZE_SHIFT	(_IOC_SIZESHIFT)
+
+#endif /* _ASM_MICROBLAZE_IOCTL_H */
diff --git a/include/asm-microblaze/ioctls.h b/include/asm-microblaze/ioctls.h
new file mode 100644
index 0000000..4bc5fd4
--- /dev/null
+++ b/include/asm-microblaze/ioctls.h
@@ -0,0 +1,93 @@
+/*
+ * include/asm-microblaze/ioctls.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_IOCTLS_H
+#define _ASM_MICROBLAZE_IOCTLS_H
+
+#include <asm/ioctl.h>
+
+/* 0x54 is just a magic number to make these relatively unique ('T') */
+
+#define TCGETS		0x5401
+#define TCSETS		0x5402
+#define TCSETSW		0x5403
+#define TCSETSF		0x5404
+#define TCGETA		0x5405
+#define TCSETA		0x5406
+#define TCSETAW		0x5407
+#define TCSETAF		0x5408
+#define TCSBRK		0x5409
+#define TCXONC		0x540A
+#define TCFLSH		0x540B
+#define TIOCEXCL	0x540C
+#define TIOCNXCL	0x540D
+#define TIOCSCTTY	0x540E
+#define TIOCGPGRP	0x540F
+#define TIOCSPGRP	0x5410
+#define TIOCOUTQ	0x5411
+#define TIOCSTI		0x5412
+#define TIOCGWINSZ	0x5413
+#define TIOCSWINSZ	0x5414
+#define TIOCMGET	0x5415
+#define TIOCMBIS	0x5416
+#define TIOCMBIC	0x5417
+#define TIOCMSET	0x5418
+#define TIOCGSOFTCAR	0x5419
+#define TIOCSSOFTCAR	0x541A
+#define FIONREAD	0x541B
+#define TIOCINQ		FIONREAD
+#define TIOCLINUX	0x541C
+#define TIOCCONS	0x541D
+#define TIOCGSERIAL	0x541E
+#define TIOCSSERIAL	0x541F
+#define TIOCPKT		0x5420
+#define FIONBIO		0x5421
+#define TIOCNOTTY	0x5422
+#define TIOCSETD	0x5423
+#define TIOCGETD	0x5424
+#define TCSBRKP		0x5425 /* Needed for POSIX tcsendbreak() */
+#define TIOCTTYGSTRUCT	0x5426 /* For debugging only */
+#define TIOCSBRK	0x5427 /* BSD compatibility */
+#define TIOCCBRK	0x5428 /* BSD compatibility */
+#define TIOCGSID	0x5429 /* Return the session ID of FD */
+/* Get Pty Number (of pty-mux device) */
+#define TIOCGPTN	_IOR('T', 0x30, unsigned int)
+#define TIOCSPTLCK	_IOW('T', 0x31, int) /* Lock/unlock Pty */
+
+#define FIONCLEX	0x5450 /* these numbers need to be adjusted. */
+#define FIOCLEX		0x5451
+#define FIOASYNC	0x5452
+#define TIOCSERCONFIG	0x5453
+#define TIOCSERGWILD	0x5454
+#define TIOCSERSWILD	0x5455
+#define TIOCGLCKTRMIOS	0x5456
+#define TIOCSLCKTRMIOS	0x5457
+#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
+#define TIOCSERGETLSR	0x5459 /* Get line status register */
+#define TIOCSERGETMULTI 0x545A /* Get multiport config */
+#define TIOCSERSETMULTI 0x545B /* Set multiport config */
+
+#define TIOCMIWAIT	0x545C /* wait for a change on serial input line(s) */
+#define TIOCGICOUNT	0x545D /* read serial port inline interrupt counts */
+
+#define	FIOQSIZE	0x545E
+
+/* Used for packet mode */
+#define TIOCPKT_DATA		0
+#define TIOCPKT_FLUSHREAD	1
+#define TIOCPKT_FLUSHWRITE	2
+#define TIOCPKT_STOP		4
+#define TIOCPKT_START		8
+#define TIOCPKT_NOSTOP		16
+#define TIOCPKT_DOSTOP		32
+
+#define TIOCSER_TEMT	0x01 /* Transmitter physically empty */
+
+#endif /* _ASM_MICROBLAZE_IOCTLS_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 34/56] microblaze_v2: io.h IO operations
  2008-05-04 11:41                                                                 ` [PATCH 33/56] microblaze_v2: ioctl support monstr
@ 2008-05-04 11:41                                                                   ` monstr
  2008-05-04 11:41                                                                     ` [PATCH 35/56] microblaze_v2: headers for executables format FLAT, ELF monstr
  2008-05-04 21:34                                                                   ` [PATCH 33/56] microblaze_v2: ioctl support Arnd Bergmann
  1 sibling, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/io.h |  210 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 210 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/io.h

diff --git a/include/asm-microblaze/io.h b/include/asm-microblaze/io.h
new file mode 100644
index 0000000..d2c492f
--- /dev/null
+++ b/include/asm-microblaze/io.h
@@ -0,0 +1,210 @@
+/*
+ * include/asm-microblaze/io.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_IO_H
+#define _ASM_MICROBLAZE_IO_H
+
+#include <asm/byteorder.h>
+#include <asm/page.h>
+
+static inline unsigned char __raw_readb(const volatile void *addr)
+{
+	return *(volatile unsigned char __force *)addr;
+}
+static inline unsigned short __raw_readw(const volatile void *addr)
+{
+	return *(volatile unsigned short __force *)addr;
+}
+static inline unsigned int __raw_readl(const volatile void *addr)
+{
+	return *(volatile unsigned int __force *)addr;
+}
+static inline unsigned long __raw_readq(const volatile void *addr)
+{
+	return *(volatile unsigned long __force *)addr;
+}
+static inline void __raw_writeb(unsigned char v, volatile void *addr)
+{
+	*(volatile unsigned char __force *)addr = v;
+}
+static inline void __raw_writew(unsigned short v, volatile void *addr)
+{
+	*(volatile unsigned short __force *)addr = v;
+}
+static inline void __raw_writel(unsigned int v, volatile void *addr)
+{
+	*(volatile unsigned int __force *)addr = v;
+}
+static inline void __raw_writeq(unsigned long v, volatile void *addr)
+{
+	*(volatile unsigned long __force *)addr = v;
+}
+
+/*
+ * read (readb, readw, readl, readq) and write (writeb, writew,
+ * writel, writeq) accessors are for PCI and thus littel endian.
+ * Linux 2.4 for Microblaze had this wrong.
+ */
+static inline unsigned char readb(const volatile void *addr)
+{
+	return *(volatile unsigned char __force *)addr;
+}
+static inline unsigned short readw(const volatile void *addr)
+{
+	return le16_to_cpu(*(volatile unsigned short __force *)addr);
+}
+static inline unsigned int readl(const volatile void *addr)
+{
+	return le32_to_cpu(*(volatile unsigned int __force *)addr);
+}
+static inline void writeb(unsigned char v, volatile void *addr)
+{
+	*(volatile unsigned char __force *)addr = v;
+}
+static inline void writew(unsigned short v, volatile void *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 *__ioremap(unsigned long address, unsigned long size,
+			unsigned long flags)
+{
+	return (void *)address;
+}
+
+
+#define IO_SPACE_LIMIT ~(0UL)
+
+#define ioremap(physaddr, size)	((void *)(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), (a))
+#define out_be16(a, v) __raw_writew((v), (a))
+
+#define in_be32(a) __raw_readl(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 */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 35/56] microblaze_v2: headers for executables format FLAT, ELF
  2008-05-04 11:41                                                                   ` [PATCH 34/56] microblaze_v2: io.h IO operations monstr
@ 2008-05-04 11:41                                                                     ` monstr
  2008-05-04 11:41                                                                       ` [PATCH 36/56] microblaze_v2: dma support monstr
  2008-05-05  2:24                                                                       ` [PATCH 35/56] microblaze_v2: headers for executables format FLAT, ELF John Williams
  0 siblings, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/elf.h  |   24 +++++++++++
 include/asm-microblaze/flat.h |   93 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 117 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/elf.h
 create mode 100644 include/asm-microblaze/flat.h

diff --git a/include/asm-microblaze/elf.h b/include/asm-microblaze/elf.h
new file mode 100644
index 0000000..4a14fa0
--- /dev/null
+++ b/include/asm-microblaze/elf.h
@@ -0,0 +1,24 @@
+/*
+ * include/asm-microblaze/elf.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_ELF_H
+#define _ASM_MICROBLAZE_ELF_H
+
+#define EM_XILINX_MICROBLAZE 0xbaab
+#define ELF_ARCH	EM_XILINX_MICROBLAZE
+
+#define elf_check_arch(x) ((x)->e_machine == EM_XILINX_MICROBLAZE)
+
+/*
+ * These are used to set parameters in the core dumps.
+ */
+#define ELF_CLASS	ELFCLASS32
+
+#endif /* _ASM_MICROBLAZE_ELF_H */
diff --git a/include/asm-microblaze/flat.h b/include/asm-microblaze/flat.h
new file mode 100644
index 0000000..77ef8a2
--- /dev/null
+++ b/include/asm-microblaze/flat.h
@@ -0,0 +1,93 @@
+/*
+ * include/asm-microblaze/flat.h
+ *
+ * uClinux flat-format executables
+ *
+ * Copyright (C) 2005 John Williams <jwilliams@itee.uq.edu.au>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ */
+
+#ifndef _ASM_MICROBLAZE_FLAT_H
+#define _ASM_MICROBLAZE_FLAT_H
+
+#include <asm/unaligned.h>
+
+#define	flat_stack_align(sp) /* nothing needed */
+#define	flat_argvp_envp_on_stack()	0
+#define	flat_old_ram_flag(flags)	(flags)
+#define	flat_reloc_valid(reloc, size)	((reloc) <= (size))
+#define	flat_set_persistent(relval, p)		0
+
+/*
+ * Microblaze works a little differently from other arches, because
+ * of the MICROBLAZE_64 reloc type. Here, a 32 bit address is split
+ * over two instructions, an 'imm' instruction which provides the top
+ * 16 bits, then the instruction "proper" which provides the low 16
+ * bits.
+ */
+
+/*
+ * Crack open a symbol reference and extract the address to be
+ * relocated. rp is a potentially unaligned pointer to the
+ * reference
+ */
+
+static inline unsigned long
+flat_get_addr_from_rp(unsigned long *rp, unsigned long relval,
+			unsigned long flags, unsigned long *persistent)
+{
+	unsigned long addr;
+	(void)flags;
+
+	/* Is it a split 64/32 reference? */
+	if (relval & 0x80000000) {
+		/* Grab the two halves of the reference */
+		unsigned long val_hi, val_lo;
+
+		val_hi = get_unaligned(rp);
+		val_lo = get_unaligned(rp+1);
+
+		/* Crack the address out */
+		addr = ((val_hi & 0xffff) << 16) + (val_lo & 0xffff);
+	} else {
+		/* Get the address straight out */
+		addr = get_unaligned(rp);
+	}
+
+	return addr;
+}
+
+/*
+ * Insert an address into the symbol reference at rp. rp is potentially
+ * unaligned.
+ */
+
+static inline void
+flat_put_addr_at_rp(unsigned long *rp, unsigned long addr, unsigned long relval)
+{
+	/* Is this a split 64/32 reloc? */
+	if (relval & 0x80000000) {
+		/* Get the two "halves" */
+		unsigned long val_hi = get_unaligned(rp);
+		unsigned long val_lo = get_unaligned(rp + 1);
+
+		/* insert the address */
+		val_hi = (val_hi & 0xffff0000) | addr >> 16;
+		val_lo = (val_lo & 0xffff0000) | (addr & 0xffff);
+
+		/* store the two halves back into memory */
+		put_unaligned(val_hi, rp);
+		put_unaligned(val_lo, rp+1);
+	} else {
+		/* Put it straight in, no messing around */
+		put_unaligned(addr, rp);
+	}
+}
+
+#define	flat_get_relocate_addr(rel)	(rel & 0x7fffffff)
+
+#endif /* _ASM_MICROBLAZE_FLAT_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 36/56] microblaze_v2: dma support
  2008-05-04 11:41                                                                     ` [PATCH 35/56] microblaze_v2: headers for executables format FLAT, ELF monstr
@ 2008-05-04 11:41                                                                       ` monstr
  2008-05-04 11:41                                                                         ` [PATCH 37/56] microblaze_v2: headers for irq monstr
  2008-05-05  2:25                                                                         ` [PATCH 36/56] microblaze_v2: dma support John Williams
  2008-05-05  2:24                                                                       ` [PATCH 35/56] microblaze_v2: headers for executables format FLAT, ELF John Williams
  1 sibling, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/dma-mapping.h |   17 +++++++++++++++++
 include/asm-microblaze/dma.h         |   20 ++++++++++++++++++++
 include/asm-microblaze/scatterlist.h |   21 +++++++++++++++++++++
 3 files changed, 58 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/dma-mapping.h
 create mode 100644 include/asm-microblaze/dma.h
 create mode 100644 include/asm-microblaze/scatterlist.h

diff --git a/include/asm-microblaze/dma-mapping.h b/include/asm-microblaze/dma-mapping.h
new file mode 100644
index 0000000..7227661
--- /dev/null
+++ b/include/asm-microblaze/dma-mapping.h
@@ -0,0 +1,17 @@
+/*
+ * include/asm-microblaze/dma-mapping.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2008 Michal Simek <monstr@monstr.eu>
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_DMA_MAPPING_H
+#define _ASM_MICROBLAZE_DMA_MAPPING_H
+
+#include <asm-generic/dma-mapping.h>
+
+#endif /* _ASM_MICROBLAZE_DMA_MAPPING_H */
diff --git a/include/asm-microblaze/dma.h b/include/asm-microblaze/dma.h
new file mode 100644
index 0000000..e36619f
--- /dev/null
+++ b/include/asm-microblaze/dma.h
@@ -0,0 +1,20 @@
+/*
+ * include/asm-microblaze/dma.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_DMA_H
+#define _ASM_MICROBLAZE_DMA_H
+
+/* we don't have dma address limit. define it as zero to be
+ * unlimited. */
+#define MAX_DMA_ADDRESS		(0)
+
+#define ISA_DMA_THRESHOLD	(0)
+
+#endif /* _ASM_MICROBLAZE_DMA_H */
diff --git a/include/asm-microblaze/scatterlist.h b/include/asm-microblaze/scatterlist.h
new file mode 100644
index 0000000..76fab58
--- /dev/null
+++ b/include/asm-microblaze/scatterlist.h
@@ -0,0 +1,21 @@
+/*
+ * include/asm-microblaze/scatterlist.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_SCATTERLIST_H
+#define _ASM_MICROBLAZE_SCATTERLIST_H
+
+struct scatterlist {
+	unsigned long page_link;
+	unsigned int	offset;
+	dma_addr_t	dma_address;
+	unsigned int	length;
+};
+
+#endif /* _ASM_MICROBLAZE_SCATTERLIST_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 37/56] microblaze_v2: headers for irq
  2008-05-04 11:41                                                                       ` [PATCH 36/56] microblaze_v2: dma support monstr
@ 2008-05-04 11:41                                                                         ` monstr
  2008-05-04 11:41                                                                           ` [PATCH 38/56] microblaze_v2: atomic.h bitops.h byteorder.h monstr
  2008-05-07  7:26                                                                           ` [PATCH 37/56] microblaze_v2: headers for irq Thomas Gleixner
  2008-05-05  2:25                                                                         ` [PATCH 36/56] microblaze_v2: dma support John Williams
  1 sibling, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/hardirq.h  |   31 +++++++++++++++++++++++++++++++
 include/asm-microblaze/hw_irq.h   |   19 +++++++++++++++++++
 include/asm-microblaze/irq_regs.h |   19 +++++++++++++++++++
 3 files changed, 69 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/hardirq.h
 create mode 100644 include/asm-microblaze/hw_irq.h
 create mode 100644 include/asm-microblaze/irq_regs.h

diff --git a/include/asm-microblaze/hardirq.h b/include/asm-microblaze/hardirq.h
new file mode 100644
index 0000000..8a143fa
--- /dev/null
+++ b/include/asm-microblaze/hardirq.h
@@ -0,0 +1,31 @@
+/*
+ * include/asm-microblaze/hardirq.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_HARDIRQ_H
+#define _ASM_MICROBLAZE_HARDIRQ_H
+
+#include <linux/cache.h>
+#include <linux/irq.h>
+#include <asm/irq.h>
+#include <asm/current.h>
+#include <asm/ptrace.h>
+
+/* should be defined in each interrupt controller driver */
+extern unsigned int get_irq(struct pt_regs *regs);
+
+typedef struct {
+	unsigned int __softirq_pending;
+} ____cacheline_aligned irq_cpustat_t;
+
+void ack_bad_irq(unsigned int irq);
+
+#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
+
+#endif /* _ASM_MICROBLAZE_HARDIRQ_H */
diff --git a/include/asm-microblaze/hw_irq.h b/include/asm-microblaze/hw_irq.h
new file mode 100644
index 0000000..467fa26
--- /dev/null
+++ b/include/asm-microblaze/hw_irq.h
@@ -0,0 +1,19 @@
+/*
+ * include/asm-microblaze/hw_irq.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_HW_IRQ_H
+#define _ASM_MICROBLAZE_HW_IRQ_H
+
+static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i)
+{
+	/* Nothing to do */
+}
+
+#endif /* _ASM_MICROBLAZE_HW_IRQ_H */
diff --git a/include/asm-microblaze/irq_regs.h b/include/asm-microblaze/irq_regs.h
new file mode 100644
index 0000000..0876847
--- /dev/null
+++ b/include/asm-microblaze/irq_regs.h
@@ -0,0 +1,19 @@
+/*
+ * include/asm-microblaze/irq_regs.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_IRQ_REGS_H
+#define _ASM_MICROBLAZE_IRQ_REGS_H
+
+#include <asm-generic/irq_regs.h>
+
+#endif /* _ASM_MICROBLAZE_IRQ_REGS_H */
+
+
+
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 38/56] microblaze_v2: atomic.h bitops.h byteorder.h
  2008-05-04 11:41                                                                         ` [PATCH 37/56] microblaze_v2: headers for irq monstr
@ 2008-05-04 11:41                                                                           ` monstr
  2008-05-04 11:41                                                                             ` [PATCH 39/56] microblaze_v2: headers pgalloc.h pgtable.h monstr
  2008-05-04 21:58                                                                             ` [PATCH 38/56] microblaze_v2: atomic.h bitops.h byteorder.h Arnd Bergmann
  2008-05-07  7:26                                                                           ` [PATCH 37/56] microblaze_v2: headers for irq Thomas Gleixner
  1 sibling, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/atomic.h    |  108 ++++++++++++++++++++++++++++++++++++
 include/asm-microblaze/bitops.h    |   29 ++++++++++
 include/asm-microblaze/byteorder.h |   23 ++++++++
 3 files changed, 160 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/atomic.h
 create mode 100644 include/asm-microblaze/bitops.h
 create mode 100644 include/asm-microblaze/byteorder.h

diff --git a/include/asm-microblaze/atomic.h b/include/asm-microblaze/atomic.h
new file mode 100644
index 0000000..d0afdc5
--- /dev/null
+++ b/include/asm-microblaze/atomic.h
@@ -0,0 +1,108 @@
+/*
+ * include/asm-microblaze/atomic.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_ATOMIC_H
+#define _ASM_MICROBLAZE_ATOMIC_H
+
+#include <linux/compiler.h> /* likely */
+#include <asm/system.h> /* local_irq_XXX and friends */
+
+typedef struct { volatile int counter; } atomic_t;
+
+#define ATOMIC_INIT(i)		{ (i) }
+#define atomic_read(v)		((v)->counter)
+#define atomic_set(v, i)	(((v)->counter) = (i))
+
+#define atomic_inc(v)		(atomic_add_return(1, (v)))
+#define atomic_dec(v)		(atomic_sub_return(1, (v)))
+
+#define atomic_add(i, v)	(atomic_add_return(i, (v)))
+#define atomic_sub(i, v)	(atomic_sub_return(i, (v)))
+
+#define atomic_inc_return(v)	(atomic_add_return(1, (v)))
+#define atomic_dec_return(v)	(atomic_sub_return(1, (v)))
+
+#define atomic_inc_and_test(v)	(atomic_add_return(1, (v)) == 0)
+#define atomic_dec_and_test(v)	(atomic_sub_return(1, (v)) == 0)
+
+#define atomic_inc_not_zero(v)	(atomic_add_unless((v), 1, 0))
+
+#define atomic_sub_and_test(i, v) (atomic_sub_return((i), (v)) == 0)
+
+static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
+{
+	int 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);
+}
+
+#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 */
diff --git a/include/asm-microblaze/bitops.h b/include/asm-microblaze/bitops.h
new file mode 100644
index 0000000..6665561
--- /dev/null
+++ b/include/asm-microblaze/bitops.h
@@ -0,0 +1,29 @@
+/*
+ * include/asm-microblaze/bitops.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_BITOPS_H
+#define _ASM_MICROBLAZE_BITOPS_H
+
+/*
+ * Copyright 1992, Linus Torvalds.
+ */
+
+#include <linux/autoconf.h>
+#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>
+
+#endif /* _ASM_MICROBLAZE_BITOPS_H */
diff --git a/include/asm-microblaze/byteorder.h b/include/asm-microblaze/byteorder.h
new file mode 100644
index 0000000..83ce88a
--- /dev/null
+++ b/include/asm-microblaze/byteorder.h
@@ -0,0 +1,23 @@
+/*
+ * include/asm-microblaze/byteorder.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_BYTEORDER_H
+#define _ASM_MICROBLAZE_BYTEORDER_H
+
+#include <asm/types.h>
+
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
+#define __BYTEORDER_HAS_U64__
+#define __SWAB_64_THRU_32__
+#endif
+
+#include <linux/byteorder/big_endian.h>
+
+#endif /* _ASM_MICROBLAZE_BYTEORDER_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 39/56] microblaze_v2: headers pgalloc.h pgtable.h
  2008-05-04 11:41                                                                           ` [PATCH 38/56] microblaze_v2: atomic.h bitops.h byteorder.h monstr
@ 2008-05-04 11:41                                                                             ` monstr
  2008-05-04 11:41                                                                               ` [PATCH 40/56] microblaze_v2: system.h pvr.h processor.h monstr
  2008-05-04 21:58                                                                             ` [PATCH 38/56] microblaze_v2: atomic.h bitops.h byteorder.h Arnd Bergmann
  1 sibling, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/pgalloc.h |   16 ++++++++++++
 include/asm-microblaze/pgtable.h |   50 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/pgalloc.h
 create mode 100644 include/asm-microblaze/pgtable.h

diff --git a/include/asm-microblaze/pgalloc.h b/include/asm-microblaze/pgalloc.h
new file mode 100644
index 0000000..adb41b9
--- /dev/null
+++ b/include/asm-microblaze/pgalloc.h
@@ -0,0 +1,16 @@
+/*
+ * include/asm-microblaze/pgalloc.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_PGALLOC_H
+#define _ASM_MICROBLAZE_PGALLOC_H
+
+#define check_pgt_cache()	do {} while (0)
+
+#endif /* _ASM_MICROBLAZE_PGALLOC_H */
diff --git a/include/asm-microblaze/pgtable.h b/include/asm-microblaze/pgtable.h
new file mode 100644
index 0000000..d454df1
--- /dev/null
+++ b/include/asm-microblaze/pgtable.h
@@ -0,0 +1,50 @@
+/*
+ * include/asm-microblaze/pgtable.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_PGTABLE_H
+#define _ASM_MICROBLAZE_PGTABLE_H
+
+#define pgd_present(pgd)	(1) /* pages are always present on NO_MM */
+#define pgd_none(pgd)		(0)
+#define pgd_bad(pgd)		(0)
+#define pgd_clear(pgdp)
+#define kern_addr_valid(addr)	(1)
+#define	pmd_offset(a, b)	((void *) 0)
+
+#define PAGE_NONE		__pgprot(0) /* these mean nothing to NO_MM */
+#define PAGE_SHARED		__pgprot(0) /* these mean nothing to NO_MM */
+#define PAGE_COPY		__pgprot(0) /* these mean nothing to NO_MM */
+#define PAGE_READONLY		__pgprot(0) /* these mean nothing to NO_MM */
+#define PAGE_KERNEL		__pgprot(0) /* these mean nothing to NO_MM */
+
+#define __swp_type(x)		(0)
+#define __swp_offset(x)		(0)
+#define __swp_entry(typ, off)	((swp_entry_t) { ((typ) | ((off) << 7)) })
+#define __pte_to_swp_entry(pte)	((swp_entry_t) { pte_val(pte) })
+#define __swp_entry_to_pte(x)	((pte_t) { (x).val })
+
+#ifndef __ASSEMBLY__
+static inline int pte_file(pte_t pte) { return 0; }
+#endif
+
+#define ZERO_PAGE(vaddr)	({ BUG(); NULL; })
+
+#define swapper_pg_dir ((pgd_t *) NULL)
+
+#define pgtable_cache_init()	do {} while (0)
+
+#define io_remap_pfn_range(vma, vaddr, pfn, size, prot)		\
+		remap_pfn_range(vma, vaddr, pfn, size, prot)
+
+#define arch_enter_lazy_cpu_mode()	do {} while (0)
+
+void paging_init(void);
+
+#endif /* _ASM_MICROBLAZE_PGTABLE_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 40/56] microblaze_v2: system.h pvr.h processor.h
  2008-05-04 11:41                                                                             ` [PATCH 39/56] microblaze_v2: headers pgalloc.h pgtable.h monstr
@ 2008-05-04 11:41                                                                               ` monstr
  2008-05-04 11:41                                                                                 ` [PATCH 41/56] microblaze_v2: clinkage.h linkage.h sections.h kmap_types.h monstr
  0 siblings, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/processor.h |   89 +++++++++++++++++
 include/asm-microblaze/pvr.h       |  185 +++++++++++++++++++++++++++++++++++
 include/asm-microblaze/system.h    |  190 ++++++++++++++++++++++++++++++++++++
 3 files changed, 464 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/processor.h
 create mode 100644 include/asm-microblaze/pvr.h
 create mode 100644 include/asm-microblaze/system.h

diff --git a/include/asm-microblaze/processor.h b/include/asm-microblaze/processor.h
new file mode 100644
index 0000000..6fd391c
--- /dev/null
+++ b/include/asm-microblaze/processor.h
@@ -0,0 +1,89 @@
+/*
+ * include/asm-microblaze/processor.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_PROCESSOR_H
+#define _ASM_MICROBLAZE_PROCESSOR_H
+
+#include <asm/ptrace.h>
+#include <asm/setup.h>
+
+/*
+ * User space process size: memory size
+ *
+ * TASK_SIZE on MMU cpu is usually 1GB. However, on no-MMU arch, both
+ * user processes and the kernel is on the same memory region. They
+ * both share the memory space and that is limited by the amount of
+ * physical memory. thus, we set TASK_SIZE == amount of total memory.
+ */
+
+#define TASK_SIZE	(0x81000000 - 0x80000000)
+
+/*
+ * Default implementation of macro that returns current
+ * instruction pointer ("program counter").
+ */
+#define current_text_addr() ({ __label__ _l; _l: &&_l; })
+
+/*
+ * This decides where the kernel will search for a free chunk of vm
+ * space during mmap's. We won't be using it
+ */
+#define TASK_UNMAPPED_BASE	0
+
+struct task_struct;
+
+/* thread_struct is gone. use thread_info instead. */
+struct thread_struct { };
+#define INIT_THREAD	{ }
+
+/* Do 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);
+
+/* FIXME */
+#define cpu_relax()		do {} while (0)
+#define prepare_to_copy(tsk)	do {} while (0)
+
+/*
+ * create a kernel thread without removing it from tasklists
+ */
+extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
+
+/* #define task_thread_info(task) (task)->thread_info */
+/* #define task_stack_page(task) ((void*)((task)->thread_info)) */
+
+#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 */
diff --git a/include/asm-microblaze/pvr.h b/include/asm-microblaze/pvr.h
new file mode 100644
index 0000000..2805dbe
--- /dev/null
+++ b/include/asm-microblaze/pvr.h
@@ -0,0 +1,185 @@
+/*
+ * include/asm-microblaze/pvr.h
+ *
+ * Support for the MicroBlaze PVR (Processor Version Register)
+ *
+ * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
+ * Copyright (C) 2007 PetaLogix
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ */
+#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_EXCEPTION_MASK		0x04000000
+#define PVR0_USE_ICACHE_MASK		0x02000000
+#define PVR0_USE_DCACHE_MASK		0x01000000
+#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_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_OPCODE_0x0_ILLEGAL_MASK	0x00000040
+#define PVR2_UNALIGNED_EXCEPTION_MASK	0x00000020
+#define PVR2_ILL_OPCODE_EXCEPTION_MASK	0x00000010
+#define PVR2_IOPB_BUS_EXCEPTION_MASK	0x00000008
+#define PVR2_DOPB_BUS_EXCEPTION_MASK	0x00000004
+#define PVR2_DIV_ZERO_EXCEPTION_MASK	0x00000002
+#define PVR2_FPU_EXCEPTION_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
+
+/* 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_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_ILLEGAL_MASK)
+#define PVR_UNALIGNED_EXCEPTION(pvr) \
+			(pvr.pvr[2] & PVR2_UNALIGNED_EXCEPTION_MASK)
+#define PVR_ILL_OPCODE_EXCEPTION(pvr) \
+			(pvr.pvr[2] & PVR2_ILL_OPCODE_EXCEPTION_MASK)
+#define PVR_IOPB_BUS_EXCEPTION(pvr) \
+			(pvr.pvr[2] & PVR2_IOPB_BUS_EXCEPTION_MASK)
+#define PVR_DOPB_BUS_EXCEPTION(pvr) \
+			(pvr.pvr[2] & PVR2_DOPB_BUS_EXCEPTION_MASK)
+#define PVR_DIV_ZERO_EXCEPTION(pvr) \
+			(pvr.pvr[2] & PVR2_DIV_ZERO_EXCEPTION_MASK)
+#define PVR_FPU_EXCEPTION(pvr)		(pvr.pvr[2] & PVR2_FPU_EXCEPTION_MASK)
+
+#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)
+
+int cpu_has_pvr(void);
+void get_pvr(struct pvr_s *pvr);
+
+#endif /* _ASM_MICROBLAZE_PVR_H */
diff --git a/include/asm-microblaze/system.h b/include/asm-microblaze/system.h
new file mode 100644
index 0000000..76fb22f
--- /dev/null
+++ b/include/asm-microblaze/system.h
@@ -0,0 +1,190 @@
+/*
+ * include/asm-microblaze/system.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_SYSTEM_H
+#define _ASM_MICROBLAZE_SYSTEM_H
+
+#include <linux/autoconf.h>
+#include <asm/registers.h>
+#include <asm/setup.h>
+
+struct task_struct;
+struct thread_info;
+
+extern struct task_struct *_switch_to(struct thread_info *prev,
+					struct thread_info *next);
+
+#define switch_to(prev, next, last)					\
+	do {								\
+		(last) = _switch_to(task_thread_info(prev),		\
+					task_thread_info(next));	\
+	} while (0)
+
+#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
+
+#define local_irq_save(flags)				\
+	do {						\
+		asm volatile ("# local_irq_save	\n\t"	\
+				"msrclr %0, %1	\n\t"	\
+				: "=r"(flags)		\
+				: "i"(MSR_IE)		\
+				: "memory");		\
+	} while (0)
+
+#define local_irq_disable()					\
+	do {							\
+		asm volatile ("# local_irq_disable \n\t"	\
+				"msrclr r0, %0 \n\t"		\
+				:				\
+				: "i"(MSR_IE)			\
+				: "memory");			\
+	} while (0)
+
+#define local_irq_enable()					\
+	do {							\
+		asm volatile ("# local_irq_enable \n\t"		\
+				"msrset	r0, %0 \n\t"		\
+				:				\
+				: "i"(MSR_IE)			\
+				: "memory");			\
+	} while (0)
+
+#else /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR == 0 */
+
+#define local_irq_save(flags)					\
+	do {							\
+		register unsigned tmp;				\
+		asm volatile ("# local_irq_save	\n\t"		\
+				"mfs	%0, rmsr \n\t"		\
+				"andi	%1, %0, %2 \n\t"	\
+				"mts	rmsr, %1 \n\t"		\
+				"nop \n\t"			\
+				: "=r"(flags), "=r" (tmp)	\
+				: "i"(~MSR_IE)			\
+				: "memory");			\
+	} while (0)
+
+#define local_irq_disable()					\
+	do {							\
+		register unsigned tmp;				\
+		asm volatile ("# local_irq_disable \n\t"	\
+				"mfs	%0, rmsr \n\t"		\
+				"andi	%0, %0, %1 \n\t"	\
+				"mts	rmsr, %0 \n\t"		\
+				"nop \n\t"			\
+				: "=r"(tmp)			\
+				: "i"(~MSR_IE)			\
+				: "memory");			\
+	} while (0)
+
+#define local_irq_enable()					\
+	do {							\
+		register unsigned tmp;				\
+		asm volatile ("# local_irq_enable \n\t"		\
+				"mfs	%0, rmsr \n\t"		\
+				"ori	%0, %0, %1 \n\t"	\
+				"mts	rmsr, %0 \n\t"		\
+				"nop \n\t"			\
+				: "=r"(tmp)			\
+				: "i"(MSR_IE)			\
+				: "memory");			\
+	} while (0)
+
+#endif /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */
+
+#define local_save_flags(flags)					\
+	do {							\
+		asm volatile ("# local_save_flags \n\t"		\
+				"mfs	%0, rmsr \n\t"		\
+				: "=r"(flags)			\
+				:				\
+				: "memory");			\
+	} while (0)
+
+#define local_irq_restore(flags)			\
+	do {						\
+		asm volatile ("# local_irq_restore \n\t"\
+				"mts	rmsr, %0 \n\t"	\
+				:			\
+				:"r"(flags)		\
+				: "memory");		\
+	} while (0)
+
+static inline int irqs_disabled(void)
+{
+	unsigned long flags;
+
+	local_save_flags(flags);
+	return ((flags & MSR_IE) == 0);
+}
+
+#define smp_read_barrier_depends()	do {} while (0)
+#define read_barrier_depends()		do {} while (0)
+
+#define nop()			asm volatile ("nop")
+#define mb()			barrier()
+#define rmb()			mb()
+#define wmb()			mb()
+#define set_mb(var, value)	do { var = value; mb(); } while (0)
+#define set_wmb(var, value)	do { var = value; wmb(); } while (0)
+
+#define smp_mb()		mb()
+#define smp_rmb()		rmb()
+#define smp_wmb()		wmb()
+
+void show_trace(struct task_struct *task, unsigned long *stack);
+void __bad_xchg(volatile void *ptr, int size);
+
+static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
+								int size)
+{
+	unsigned long ret;
+	unsigned long flags;
+
+	switch (size) {
+	case 1:
+		local_irq_save(flags);
+		ret = *(volatile unsigned char *)ptr;
+		*(volatile unsigned char *)ptr = x;
+		local_irq_restore(flags);
+		break;
+
+	case 4:
+		local_irq_save(flags);
+		ret = *(volatile unsigned long *)ptr;
+		*(volatile unsigned long *)ptr = x;
+		local_irq_restore(flags);
+		break;
+	default:
+		__bad_xchg(ptr, size), ret = 0;
+		break;
+	}
+
+	return ret;
+}
+
+#define xchg(ptr,x) \
+	((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
+
+extern void *cacheable_memcpy(void *, const void *, unsigned int);
+void free_init_pages(char *what, unsigned long begin, unsigned long end);
+void free_initmem(void);
+extern char *klimit;
+extern void ret_from_fork(void);
+
+#ifdef CONFIG_DEBUG_FS
+extern struct dentry *of_debugfs_root;
+#endif
+
+#ifdef CONFIG_MTD_UCLINUX
+extern char *_ebss;
+#endif
+
+#endif /* _ASM_MICROBLAZE_SYSTEM_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 41/56] microblaze_v2: clinkage.h linkage.h sections.h kmap_types.h
  2008-05-04 11:41                                                                               ` [PATCH 40/56] microblaze_v2: system.h pvr.h processor.h monstr
@ 2008-05-04 11:41                                                                                 ` monstr
  2008-05-04 11:41                                                                                   ` [PATCH 42/56] microblaze_v2: stats headers monstr
  0 siblings, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/clinkage.h   |   29 +++++++++++++++++++++++++++++
 include/asm-microblaze/kmap_types.h |   31 +++++++++++++++++++++++++++++++
 include/asm-microblaze/linkage.h    |   17 +++++++++++++++++
 include/asm-microblaze/sections.h   |   19 +++++++++++++++++++
 4 files changed, 96 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/clinkage.h
 create mode 100644 include/asm-microblaze/kmap_types.h
 create mode 100644 include/asm-microblaze/linkage.h
 create mode 100644 include/asm-microblaze/sections.h

diff --git a/include/asm-microblaze/clinkage.h b/include/asm-microblaze/clinkage.h
new file mode 100644
index 0000000..28dcd1c
--- /dev/null
+++ b/include/asm-microblaze/clinkage.h
@@ -0,0 +1,29 @@
+/*
+ * include/asm-microblaze/clinkage.h
+ *
+ * Macros to reflect C symbol-naming conventions
+ *
+ * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
+ * Copyright (C) 2001,2002 NEC Corporatione
+ * Copyright (C) 2001,2002 Miles Bader <miles@gnu.org>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ * Written by Miles Bader <miles@gnu.org>
+ * Microblaze port by John Williams
+ */
+
+#ifndef _ASM_MICROBLAZE_CLINKAGE_H
+#define _ASM_MICROBLAZE_CLINKAGE_H
+
+#define __ASSEMBLY__
+
+#include <linux/linkage.h>
+
+#define C_SYMBOL_NAME(name)	name
+#define C_ENTRY(name)		.globl name; .align 4; name
+#define C_END(name)
+
+#endif /* _ASM_MICROBLAZE_CLINKAGE_H */
diff --git a/include/asm-microblaze/kmap_types.h b/include/asm-microblaze/kmap_types.h
new file mode 100644
index 0000000..5b53f6e
--- /dev/null
+++ b/include/asm-microblaze/kmap_types.h
@@ -0,0 +1,31 @@
+/*
+ * include/asm-microblaze/kmap_types.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#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 */
diff --git a/include/asm-microblaze/linkage.h b/include/asm-microblaze/linkage.h
new file mode 100644
index 0000000..7d5197a
--- /dev/null
+++ b/include/asm-microblaze/linkage.h
@@ -0,0 +1,17 @@
+/*
+ * include/asm-microblaze/linkage.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_LINKAGE_H
+#define _ASM_MICROBLAZE_LINKAGE_H
+
+#define __ALIGN		.align 4
+#define __ALIGN_STR	".align 4"
+
+#endif /* _ASM_MICROBLAZE_LINKAGE_H */
diff --git a/include/asm-microblaze/sections.h b/include/asm-microblaze/sections.h
new file mode 100644
index 0000000..0ff7c69
--- /dev/null
+++ b/include/asm-microblaze/sections.h
@@ -0,0 +1,19 @@
+/*
+ * include/asm-microblaze/sections.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_SECTIONS_H
+#define _ASM_MICROBLAZE_SECTIONS_H
+
+#include <asm-generic/sections.h>
+
+extern char _ssbss[], _esbss[];
+extern unsigned long __ivt_start[], __ivt_end[];
+
+#endif /* _ASM_MICROBLAZE_SECTIONS_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 42/56] microblaze_v2: stats headers
  2008-05-04 11:41                                                                                 ` [PATCH 41/56] microblaze_v2: clinkage.h linkage.h sections.h kmap_types.h monstr
@ 2008-05-04 11:41                                                                                   ` monstr
  2008-05-04 11:41                                                                                     ` [PATCH 43/56] microblaze_v2: termbits.h termios.h monstr
  2008-05-04 22:31                                                                                     ` [PATCH 42/56] microblaze_v2: stats headers Arnd Bergmann
  0 siblings, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/stat.h   |   75 +++++++++++++++++++++++++++++++++++++++
 include/asm-microblaze/statfs.h |   16 ++++++++
 2 files changed, 91 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/stat.h
 create mode 100644 include/asm-microblaze/statfs.h

diff --git a/include/asm-microblaze/stat.h b/include/asm-microblaze/stat.h
new file mode 100644
index 0000000..4289f6b
--- /dev/null
+++ b/include/asm-microblaze/stat.h
@@ -0,0 +1,75 @@
+/*
+ * include/asm-microblaze/stat.h
+ *
+ * Microblaze stat structure
+ *
+ * Copyright (C) 2001,02,03 NEC Electronics Corporation
+ * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ * Written by Miles Bader <miles@gnu.org>
+ */
+
+#ifndef _ASM_MICROBLAZE_STAT_H
+#define _ASM_MICROBLAZE_STAT_H
+
+#include <asm/posix_types.h>
+
+struct stat {
+	unsigned int	st_dev;
+	unsigned long	st_ino;
+	unsigned int	st_mode;
+	unsigned int	st_nlink;
+	unsigned int	st_uid;
+	unsigned int	st_gid;
+	unsigned int	st_rdev;
+	long		st_size;
+	unsigned long	st_blksize;
+	unsigned long	st_blocks;
+	unsigned long	st_atime;
+	unsigned long	__unused1;
+	unsigned long	st_mtime;
+	unsigned long	__unused2;
+	unsigned long	st_ctime;
+	unsigned long	__unused3;
+	unsigned long	__unused4;
+	unsigned long	__unused5;
+};
+
+struct stat64 {
+	unsigned long long	st_dev;
+	unsigned long	__unused1;
+
+	unsigned long long	st_ino;
+
+	unsigned int	st_mode;
+	unsigned int	st_nlink;
+
+	unsigned int	st_uid;
+	unsigned int	st_gid;
+
+	unsigned long long	st_rdev;
+	unsigned long	__unused3;
+
+	long long	st_size;
+	unsigned long	st_blksize;
+
+	unsigned long	st_blocks; /* No. of 512-byte blocks allocated */
+	unsigned long	__unused4; /* 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 */
diff --git a/include/asm-microblaze/statfs.h b/include/asm-microblaze/statfs.h
new file mode 100644
index 0000000..81351b7
--- /dev/null
+++ b/include/asm-microblaze/statfs.h
@@ -0,0 +1,16 @@
+/*
+ * include/asm-microblaze/statfs.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_STATFS_H
+#define _ASM_MICROBLAZE_STATFS_H
+
+#include <asm-generic/statfs.h>
+
+#endif /* _ASM_MICROBLAZE_STATFS_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 43/56] microblaze_v2: termbits.h termios.h
  2008-05-04 11:41                                                                                   ` [PATCH 42/56] microblaze_v2: stats headers monstr
@ 2008-05-04 11:41                                                                                     ` monstr
  2008-05-04 11:41                                                                                       ` [PATCH 44/56] microblaze_v2: sigcontext.h siginfo.h monstr
  2008-05-05  9:50                                                                                       ` [PATCH 43/56] microblaze_v2: termbits.h termios.h Arnd Bergmann
  2008-05-04 22:31                                                                                     ` [PATCH 42/56] microblaze_v2: stats headers Arnd Bergmann
  1 sibling, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/termbits.h |  203 +++++++++++++++++++++++++++++++++++++
 include/asm-microblaze/termios.h  |   86 ++++++++++++++++
 2 files changed, 289 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/termbits.h
 create mode 100644 include/asm-microblaze/termios.h

diff --git a/include/asm-microblaze/termbits.h b/include/asm-microblaze/termbits.h
new file mode 100644
index 0000000..695f370
--- /dev/null
+++ b/include/asm-microblaze/termbits.h
@@ -0,0 +1,203 @@
+/*
+ * include/asm-microblaze/termbits.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_TERMBITS_H
+#define _ASM_MICROBLAZE_TERMBITS_H
+
+#include <linux/posix_types.h>
+
+typedef unsigned char	cc_t;
+typedef unsigned int	speed_t;
+typedef unsigned int	tcflag_t;
+
+#define NCCS 19
+struct termios {
+	tcflag_t c_iflag; /* input mode flags */
+	tcflag_t c_oflag; /* output mode flags */
+	tcflag_t c_cflag; /* control mode flags */
+	tcflag_t c_lflag; /* local mode flags */
+	cc_t c_line; /* line discipline */
+	cc_t c_cc[NCCS]; /* control characters */
+};
+
+struct ktermios {
+	tcflag_t c_iflag; /* input mode flags */
+	tcflag_t c_oflag; /* output mode flags */
+	tcflag_t c_cflag; /* control mode flags */
+	tcflag_t c_lflag; /* local mode flags */
+	cc_t c_line; /* line discipline */
+	cc_t c_cc[NCCS]; /* control characters */
+	speed_t c_ispeed; /* input speed */
+	speed_t c_ospeed; /* output speed */
+};
+
+
+/* c_cc characters */
+
+#define VINTR 0
+#define VQUIT 1
+#define VERASE 2
+#define VKILL 3
+#define VEOF 4
+#define VTIME 5
+#define VMIN 6
+#define VSWTC 7
+#define VSTART 8
+#define VSTOP 9
+#define VSUSP 10
+#define VEOL 11
+#define VREPRINT 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 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 */
+
+/* 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 */
diff --git a/include/asm-microblaze/termios.h b/include/asm-microblaze/termios.h
new file mode 100644
index 0000000..61ac2cf
--- /dev/null
+++ b/include/asm-microblaze/termios.h
@@ -0,0 +1,86 @@
+/*
+ * include/asm-microblaze/termios.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_TERMIOS_H
+#define _ASM_MICROBLAZE_TERMIOS_H
+
+#include <linux/string.h>
+#include <asm/termbits.h>
+#include <asm/ioctls.h>
+
+struct winsize {
+	unsigned short ws_row;
+	unsigned short ws_col;
+	unsigned short ws_xpixel;
+	unsigned short ws_ypixel;
+};
+
+#define NCC 8
+struct termio {
+	unsigned short c_iflag; /* input mode flags */
+	unsigned short c_oflag; /* output mode flags */
+	unsigned short c_cflag; /* control mode flags */
+	unsigned short c_lflag; /* local mode flags */
+	unsigned char c_line; /* line discipline */
+	unsigned char c_cc[NCC]; /* control characters */
+};
+
+#ifdef __KERNEL__
+/*	intr=^C		quit=^|		erase=del	kill=^U
+	eof=^D		vtime=\0	vmin=\1		sxtc=\0
+	start=^Q	stop=^S		susp=^Z		eol=\0
+	reprint=^R	discard=^U	werase=^W	lnext=^V
+	eol2=\0
+*/
+#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
+#endif
+
+/* Modem lines */
+
+#define TIOCM_LE	0x001
+#define TIOCM_DTR	0x002
+#define TIOCM_RTS	0x004
+#define TIOCM_ST	0x008
+#define TIOCM_SR	0x010
+#define TIOCM_CTS	0x020
+#define TIOCM_CAR	0x040
+#define TIOCM_RNG	0x080
+#define TIOCM_DSR	0x100
+#define TIOCM_CD	TIOCM_CAR
+#define TIOCM_RI	TIOCM_RNG
+#define TIOCM_OUT1	0x2000
+#define TIOCM_OUT2	0x4000
+#define TIOCM_LOOP	0x8000
+
+/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
+
+/* Line disciplines */
+
+#define N_TTY		0
+#define N_SLIP		1
+#define N_MOUSE		2
+#define N_PPP		3
+#define N_STRIP		4
+#define N_AX25		5
+#define N_X25		6 /* X.25 async */
+#define N_6PACK		7
+#define N_MASC		8 /* Reserved for Mobitex module <kaz@cafe.net> */
+#define N_R3964		9 /* Reserved for Simatic R3964 module */
+#define N_PROFIBUS_FDL	10 /* Reserved for Profibus <Dave@mvhi.com> */
+#define N_IRDA		11 /* Linux IR - http://irda.sourceforge.net/ */
+#define N_SMSBLOCK	12 /* SMS block mode - for talking to GSM data cards
+				about SMS messages */
+#define N_HDLC		13 /* synchronous HDLC */
+#define N_SYNC_PPP	14
+#define N_HCI		15 /* Bluetooth HCI UART */
+
+#include <asm-generic/termios.h>
+
+#endif /* _ASM_MICROBLAZE_TERMIOS_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 44/56] microblaze_v2: sigcontext.h siginfo.h
  2008-05-04 11:41                                                                                     ` [PATCH 43/56] microblaze_v2: termbits.h termios.h monstr
@ 2008-05-04 11:41                                                                                       ` monstr
  2008-05-04 11:41                                                                                         ` [PATCH 45/56] microblaze_v2: headers simple files - empty or redirect to asm-generic monstr
  2008-05-05  9:50                                                                                       ` [PATCH 43/56] microblaze_v2: termbits.h termios.h Arnd Bergmann
  1 sibling, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/sigcontext.h |   21 +++++++++++++++++++++
 include/asm-microblaze/siginfo.h    |   17 +++++++++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/sigcontext.h
 create mode 100644 include/asm-microblaze/siginfo.h

diff --git a/include/asm-microblaze/sigcontext.h b/include/asm-microblaze/sigcontext.h
new file mode 100644
index 0000000..b35dd88
--- /dev/null
+++ b/include/asm-microblaze/sigcontext.h
@@ -0,0 +1,21 @@
+/*
+ * include/asm-microblaze/sigcontext.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_SIGCONTEXT_H
+#define _ASM_MICROBLAZE_SIGCONTEXT_H
+
+#include <asm/ptrace.h>
+
+struct sigcontext {
+	struct pt_regs regs;
+	unsigned long oldmask;
+};
+
+#endif /* _ASM_MICROBLAZE_SIGCONTEXT_H */
diff --git a/include/asm-microblaze/siginfo.h b/include/asm-microblaze/siginfo.h
new file mode 100644
index 0000000..ef15636
--- /dev/null
+++ b/include/asm-microblaze/siginfo.h
@@ -0,0 +1,17 @@
+/*
+ * include/asm-microblaze/siginfo.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_SIGINFO_H
+#define _ASM_MICROBLAZE_SIGINFO_H
+
+#include <linux/types.h>
+#include <asm-generic/siginfo.h>
+
+#endif /* _ASM_MICROBLAZE_SIGINFO_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 45/56] microblaze_v2: headers simple files - empty or redirect to asm-generic
  2008-05-04 11:41                                                                                       ` [PATCH 44/56] microblaze_v2: sigcontext.h siginfo.h monstr
@ 2008-05-04 11:41                                                                                         ` monstr
  2008-05-04 11:41                                                                                           ` [PATCH 46/56] microblaze_v2: headers files entry.h current.h mman.h registers.h sembuf.h monstr
  2008-05-05  2:34                                                                                           ` [PATCH 45/56] microblaze_v2: headers simple files - empty or redirect to asm-generic John Williams
  0 siblings, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/auxvec.h            |   14 ++++++++++++++
 include/asm-microblaze/cputime.h           |   16 ++++++++++++++++
 include/asm-microblaze/div64.h             |   16 ++++++++++++++++
 include/asm-microblaze/emergency-restart.h |   16 ++++++++++++++++
 include/asm-microblaze/errno.h             |   16 ++++++++++++++++
 include/asm-microblaze/futex.h             |   16 ++++++++++++++++
 include/asm-microblaze/kdebug.h            |   19 +++++++++++++++++++
 include/asm-microblaze/local.h             |   16 ++++++++++++++++
 include/asm-microblaze/mutex.h             |   16 ++++++++++++++++
 include/asm-microblaze/namei.h             |   24 ++++++++++++++++++++++++
 include/asm-microblaze/percpu.h            |   16 ++++++++++++++++
 include/asm-microblaze/resource.h          |   16 ++++++++++++++++
 include/asm-microblaze/user.h              |   18 ++++++++++++++++++
 13 files changed, 219 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/auxvec.h
 create mode 100644 include/asm-microblaze/cputime.h
 create mode 100644 include/asm-microblaze/div64.h
 create mode 100644 include/asm-microblaze/emergency-restart.h
 create mode 100644 include/asm-microblaze/errno.h
 create mode 100644 include/asm-microblaze/futex.h
 create mode 100644 include/asm-microblaze/kdebug.h
 create mode 100644 include/asm-microblaze/local.h
 create mode 100644 include/asm-microblaze/mutex.h
 create mode 100644 include/asm-microblaze/namei.h
 create mode 100644 include/asm-microblaze/percpu.h
 create mode 100644 include/asm-microblaze/resource.h
 create mode 100644 include/asm-microblaze/user.h

diff --git a/include/asm-microblaze/auxvec.h b/include/asm-microblaze/auxvec.h
new file mode 100644
index 0000000..73c0fb0
--- /dev/null
+++ b/include/asm-microblaze/auxvec.h
@@ -0,0 +1,14 @@
+/*
+ * include/asm-microblaze/auxvec.h
+ *
+ * This file is subject to the terms and 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_AUXVEC_H
+#define _ASM_MICROBLAZE_AUXVEC_H
+
+#endif /* _ASM_MICROBLAZE_AUXVEC_H */
diff --git a/include/asm-microblaze/cputime.h b/include/asm-microblaze/cputime.h
new file mode 100644
index 0000000..e0e4d65
--- /dev/null
+++ b/include/asm-microblaze/cputime.h
@@ -0,0 +1,16 @@
+/*
+ * include/asm-microblaze/cputime.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_CPUTIME_H
+#define _ASM_MICROBLAZE_CPUTIME_H
+
+#include <asm-generic/cputime.h>
+
+#endif /* _ASM_MICROBLAZE_CPUTIME_H */
diff --git a/include/asm-microblaze/div64.h b/include/asm-microblaze/div64.h
new file mode 100644
index 0000000..5c8a45c
--- /dev/null
+++ b/include/asm-microblaze/div64.h
@@ -0,0 +1,16 @@
+/*
+ * include/asm-microblaze/div64.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_DIV64_H
+#define _ASM_MICROBLAZE_DIV64_H
+
+#include <asm-generic/div64.h>
+
+#endif /* _ASM_MICROBLAZE_DIV64_H */
diff --git a/include/asm-microblaze/emergency-restart.h b/include/asm-microblaze/emergency-restart.h
new file mode 100644
index 0000000..831eee4
--- /dev/null
+++ b/include/asm-microblaze/emergency-restart.h
@@ -0,0 +1,16 @@
+/*
+ * include/asm-microblaze/emergency-restart.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_EMERGENCY_RESTART_H
+#define _ASM_MICROBLAZE_EMERGENCY_RESTART_H
+
+#include <asm-generic/emergency-restart.h>
+
+#endif /* _ASM_MICROBLAZE_EMERGENCY_RESTART_H */
diff --git a/include/asm-microblaze/errno.h b/include/asm-microblaze/errno.h
new file mode 100644
index 0000000..cc88e20
--- /dev/null
+++ b/include/asm-microblaze/errno.h
@@ -0,0 +1,16 @@
+/*
+ * include/asm-microblaze/errno.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_ERRNO_H
+#define _ASM_MICROBLAZE_ERRNO_H
+
+#include <asm-generic/errno.h>
+
+#endif /* _ASM_MICROBLAZE_ERRNO_H */
diff --git a/include/asm-microblaze/futex.h b/include/asm-microblaze/futex.h
new file mode 100644
index 0000000..8aa1f4d
--- /dev/null
+++ b/include/asm-microblaze/futex.h
@@ -0,0 +1,16 @@
+/*
+ * include/asm-microblaze/futex.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_FUTEX_H
+#define _ASM_MICROBLAZE_FUTEX_H
+
+#include <asm-generic/futex.h>
+
+#endif /* _ASM_MICROBLAZE_FUTEX_H */
diff --git a/include/asm-microblaze/kdebug.h b/include/asm-microblaze/kdebug.h
new file mode 100644
index 0000000..ac0cf63
--- /dev/null
+++ b/include/asm-microblaze/kdebug.h
@@ -0,0 +1,19 @@
+/*
+ * include/asm-microblaze/kdebug.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2007 Michal Simek <monstr@monstr.eu>
+ */
+
+#ifndef _ASM_MICROBLAZE_KDEBUG_H
+#define _ASM_MICROBLAZE_KDEBUG_H
+
+#include <asm-generic/kdebug.h>
+
+#endif /* _ASM_MICROBLAZE_KDEBUG_H */
+
+
+
diff --git a/include/asm-microblaze/local.h b/include/asm-microblaze/local.h
new file mode 100644
index 0000000..9909302
--- /dev/null
+++ b/include/asm-microblaze/local.h
@@ -0,0 +1,16 @@
+/*
+ * include/asm-microblaze/local.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_LOCAL_H
+#define _ASM_MICROBLAZE_LOCAL_H
+
+#include <asm-generic/local.h>
+
+#endif /* _ASM_MICROBLAZE_LOCAL_H */
diff --git a/include/asm-microblaze/mutex.h b/include/asm-microblaze/mutex.h
new file mode 100644
index 0000000..21d8731
--- /dev/null
+++ b/include/asm-microblaze/mutex.h
@@ -0,0 +1,16 @@
+/*
+ * include/asm-microblaze/mutex.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_MUTEX_H
+#define _ASM_MICROBLAZE_MUTEX_H
+
+#include <asm-generic/mutex-dec.h>
+
+#endif /* _ASM_MICROBLAZE_MUTEX_H */
diff --git a/include/asm-microblaze/namei.h b/include/asm-microblaze/namei.h
new file mode 100644
index 0000000..25cafbd
--- /dev/null
+++ b/include/asm-microblaze/namei.h
@@ -0,0 +1,24 @@
+/*
+ * include/asm-microblaze/namei.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_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 */
diff --git a/include/asm-microblaze/percpu.h b/include/asm-microblaze/percpu.h
new file mode 100644
index 0000000..5c9c24c
--- /dev/null
+++ b/include/asm-microblaze/percpu.h
@@ -0,0 +1,16 @@
+/*
+ * include/asm-microblaze/percpu.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_PERCPU_H
+#define _ASM_MICROBLAZE_PERCPU_H
+
+#include <asm-generic/percpu.h>
+
+#endif /* _ASM_MICROBLAZE_PERCPU_H */
diff --git a/include/asm-microblaze/resource.h b/include/asm-microblaze/resource.h
new file mode 100644
index 0000000..f8aac61
--- /dev/null
+++ b/include/asm-microblaze/resource.h
@@ -0,0 +1,16 @@
+/*
+ * include/asm-microblaze/resource.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_RESOURCE_H
+#define _ASM_MICROBLAZE_RESOURCE_H
+
+#include <asm-generic/resource.h>
+
+#endif /* _ASM_MICROBLAZE_RESOURCE_H */
diff --git a/include/asm-microblaze/user.h b/include/asm-microblaze/user.h
new file mode 100644
index 0000000..db2e303
--- /dev/null
+++ b/include/asm-microblaze/user.h
@@ -0,0 +1,18 @@
+/*
+ * include/asm-microblaze/user.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.
+ *
+ * Authors:
+ * Yasushi SHOJI <yashi@atmark-techno.com>
+ * Tetsuya OHKAWA <tetsuya@atmark-techno.com>
+ */
+
+#ifndef _ASM_MICROBLAZE_USER_H
+#define _ASM_MICROBLAZE_USER_H
+
+#endif /* _ASM_MICROBLAZE_USER_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 46/56] microblaze_v2: headers files entry.h current.h mman.h registers.h sembuf.h
  2008-05-04 11:41                                                                                         ` [PATCH 45/56] microblaze_v2: headers simple files - empty or redirect to asm-generic monstr
@ 2008-05-04 11:41                                                                                           ` monstr
  2008-05-04 11:41                                                                                             ` [PATCH 47/56] microblaze_v2: device.h param.h topology.h monstr
                                                                                                               ` (2 more replies)
  2008-05-05  2:34                                                                                           ` [PATCH 45/56] microblaze_v2: headers simple files - empty or redirect to asm-generic John Williams
  1 sibling, 3 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/current.h   |   25 +++++++++++++++++++++++++
 include/asm-microblaze/entry.h     |   32 ++++++++++++++++++++++++++++++++
 include/asm-microblaze/mman.h      |   27 +++++++++++++++++++++++++++
 include/asm-microblaze/registers.h |   26 ++++++++++++++++++++++++++
 include/asm-microblaze/sembuf.h    |   36 ++++++++++++++++++++++++++++++++++++
 5 files changed, 146 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/current.h
 create mode 100644 include/asm-microblaze/entry.h
 create mode 100644 include/asm-microblaze/mman.h
 create mode 100644 include/asm-microblaze/registers.h
 create mode 100644 include/asm-microblaze/sembuf.h

diff --git a/include/asm-microblaze/current.h b/include/asm-microblaze/current.h
new file mode 100644
index 0000000..342df9f
--- /dev/null
+++ b/include/asm-microblaze/current.h
@@ -0,0 +1,25 @@
+/*
+ * include/asm-microblaze/current.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_CURRENT_H
+#define _ASM_MICROBLAZE_CURRENT_H
+
+#ifndef __ASSEMBLY__
+
+/*
+ * Dedicate r31 to keeping the current task pointer
+ */
+register struct task_struct *current asm("r31");
+
+#define get_current() current
+
+#endif
+
+#endif /* _ASM_MICROBLAZE_CURRENT_H */
diff --git a/include/asm-microblaze/entry.h b/include/asm-microblaze/entry.h
new file mode 100644
index 0000000..9e55a95
--- /dev/null
+++ b/include/asm-microblaze/entry.h
@@ -0,0 +1,32 @@
+/*
+ * include/asm-microblaze/entry.h
+ *
+ * Definitions used by low-level trap handlers
+ *
+ * Copyright (C) 2007 PetaLogix
+ * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
+ *
+ * This file is subject to the terms and conditions of the 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 */
+
+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 /* _ASM_MICROBLAZE_ENTRY_H */
diff --git a/include/asm-microblaze/mman.h b/include/asm-microblaze/mman.h
new file mode 100644
index 0000000..4883114
--- /dev/null
+++ b/include/asm-microblaze/mman.h
@@ -0,0 +1,27 @@
+/*
+ * include/asm-microblaze/mman.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_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 */
diff --git a/include/asm-microblaze/registers.h b/include/asm-microblaze/registers.h
new file mode 100644
index 0000000..710e431
--- /dev/null
+++ b/include/asm-microblaze/registers.h
@@ -0,0 +1,26 @@
+/*
+ * include/asm-microblaze/registers.c
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_REGISTERS_H
+#define _ASM_MICROBLAZE_REGISTERS_H
+
+#define MSR_BE	(1<<0)
+#define MSR_IE	(1<<1)
+#define MSR_C	(1<<2)
+#define MSR_BIP	(1<<3)
+#define MSR_FSL	(1<<4)
+#define MSR_ICE	(1<<5)
+#define MSR_DZ	(1<<6)
+#define MSR_DCE	(1<<7)
+#define MSR_EE	(1<<8)
+#define MSR_EIP	(1<<9)
+#define MSR_CC	(1<<31)
+
+#endif /* _ASM_MICROBLAZE_REGISTERS_H */
diff --git a/include/asm-microblaze/sembuf.h b/include/asm-microblaze/sembuf.h
new file mode 100644
index 0000000..66eedc0
--- /dev/null
+++ b/include/asm-microblaze/sembuf.h
@@ -0,0 +1,36 @@
+/*
+ * include/asm-microblaze/sembuf.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_SEMBUF_H
+#define _ASM_MICROBLAZE_SEMBUF_H
+
+/*
+ * The semid64_ds structure for m68k architecture.
+ * Note extra padding because this structure is passed back and forth
+ * between kernel and user space.
+ *
+ * Pad space is left for:
+ * - 64-bit time_t to solve y2038 problem
+ * - 2 miscellaneous 32-bit values
+ */
+
+struct 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 */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 47/56] microblaze_v2: device.h param.h topology.h
  2008-05-04 11:41                                                                                           ` [PATCH 46/56] microblaze_v2: headers files entry.h current.h mman.h registers.h sembuf.h monstr
@ 2008-05-04 11:41                                                                                             ` monstr
  2008-05-04 11:41                                                                                               ` [PATCH 48/56] microblaze_v2: pool.h socket.h monstr
  2008-05-04 22:37                                                                                               ` [PATCH 47/56] microblaze_v2: device.h param.h topology.h Arnd Bergmann
  2008-05-05  9:54                                                                                             ` [PATCH 46/56] microblaze_v2: headers files entry.h current.h mman.h registers.h sembuf.h Arnd Bergmann
  2008-05-06 20:57                                                                                             ` Geert Uytterhoeven
  2 siblings, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/device.h   |   27 ++++++++
 include/asm-microblaze/param.h    |   36 +++++++++++
 include/asm-microblaze/topology.h |  119 +++++++++++++++++++++++++++++++++++++
 3 files changed, 182 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/device.h
 create mode 100644 include/asm-microblaze/param.h
 create mode 100644 include/asm-microblaze/topology.h

diff --git a/include/asm-microblaze/device.h b/include/asm-microblaze/device.h
new file mode 100644
index 0000000..c0e203c
--- /dev/null
+++ b/include/asm-microblaze/device.h
@@ -0,0 +1,27 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ */
+
+#ifndef _ASM_MICROBLAZE_DEVICE_H
+#define _ASM_MICROBLAZE_DEVICE_H
+
+struct dma_mapping_ops;
+struct device_node;
+
+struct dev_archdata {
+	/* Optional pointer to an OF device node */
+	struct device_node	*of_node;
+
+	/* DMA operations on that device */
+	struct dma_mapping_ops	*dma_ops;
+	void			*dma_data;
+
+	/* NUMA node if applicable */
+	int			numa_node;
+};
+
+#endif /* _ASM_MICROBLAZE_DEVICE_H */
+
+
diff --git a/include/asm-microblaze/param.h b/include/asm-microblaze/param.h
new file mode 100644
index 0000000..e6873a9
--- /dev/null
+++ b/include/asm-microblaze/param.h
@@ -0,0 +1,36 @@
+/*
+ * include/asm-microblaze/param.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_PARAM_H
+#define _ASM_MICROBLAZE_PARAM_H
+
+#ifdef __KERNEL__
+# define HZ		100 /* internal timer frequency */
+# define USER_HZ	100 /* for user interfaces in "ticks" */
+# define CLOCKS_PER_SEC (USER_HZ) /* frequnzy at which times() counts */
+#endif
+
+#ifndef NGROUPS
+#define NGROUPS		32
+#endif
+
+#ifndef NOGROUP
+#define NOGROUP		(-1)
+#endif
+
+#define EXEC_PAGESIZE	4096
+
+#ifndef HZ
+#define HZ 100
+#endif
+
+#define MAXHOSTNAMELEN	64 /* max length of hostname */
+
+#endif /* _ASM_MICROBLAZE_PARAM_H */
diff --git a/include/asm-microblaze/topology.h b/include/asm-microblaze/topology.h
new file mode 100644
index 0000000..07fa28a
--- /dev/null
+++ b/include/asm-microblaze/topology.h
@@ -0,0 +1,119 @@
+/*
+ * include/asm-microblaze/topology.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_TOPOLOGY_H
+#define _ASM_MICROBLAZE_TOPOLOGY_H
+#ifdef __KERNEL__
+
+struct sys_device;
+struct device_node;
+
+#ifdef CONFIG_NUMA
+
+#include <asm/mmzone.h>
+
+static inline int cpu_to_node(int cpu)
+{
+	return numa_cpu_lookup_table[cpu];
+}
+
+#define parent_node(node)	(node)
+
+static inline cpumask_t node_to_cpumask(int node)
+{
+	return numa_cpumask_lookup_table[node];
+}
+
+static inline int node_to_first_cpu(int node)
+{
+	cpumask_t tmp;
+	tmp = node_to_cpumask(node);
+	return first_cpu(tmp);
+}
+
+int of_node_to_nid(struct device_node *device);
+
+struct pci_bus;
+#ifdef CONFIG_PCI
+extern int pcibus_to_node(struct pci_bus *bus);
+#else
+static inline int pcibus_to_node(struct pci_bus *bus)
+{
+	return -1;
+}
+#endif
+
+#define pcibus_to_cpumask(bus)	(pcibus_to_node(bus) == -1 ? \
+					CPU_MASK_ALL : \
+					node_to_cpumask(pcibus_to_node(bus)) \
+				)
+
+/* sched_domains SD_NODE_INIT for PPC64 machines */
+#define SD_NODE_INIT (struct sched_domain) {		\
+	.span			= CPU_MASK_NONE,	\
+	.parent			= NULL,			\
+	.child			= NULL,			\
+	.groups			= NULL,			\
+	.min_interval		= 8,			\
+	.max_interval		= 32,			\
+	.busy_factor		= 32,			\
+	.imbalance_pct		= 125,			\
+	.cache_nice_tries	= 1,			\
+	.busy_idx		= 3,			\
+	.idle_idx		= 1,			\
+	.newidle_idx		= 2,			\
+	.wake_idx		= 1,			\
+	.flags			= SD_LOAD_BALANCE	\
+				| SD_BALANCE_EXEC	\
+				| SD_BALANCE_NEWIDLE	\
+				| SD_WAKE_IDLE		\
+				| SD_SERIALIZE		\
+				| SD_WAKE_BALANCE,	\
+	.last_balance		= jiffies,		\
+	.balance_interval	= 1,			\
+	.nr_balance_failed	= 0,			\
+}
+
+extern void __init dump_numa_cpu_topology(void);
+
+extern int sysfs_add_device_to_node(struct sys_device *dev, int nid);
+extern void sysfs_remove_device_from_node(struct sys_device *dev, int nid);
+
+#else
+
+static inline int of_node_to_nid(struct device_node *device)
+{
+	return 0;
+}
+
+static inline void dump_numa_cpu_topology(void) {}
+
+static inline int sysfs_add_device_to_node(struct sys_device *dev, int nid)
+{
+	return 0;
+}
+
+static inline void sysfs_remove_device_from_node(struct sys_device *dev,
+						int nid)
+{
+}
+
+#include <asm-generic/topology.h>
+
+#endif /* CONFIG_NUMA */
+
+#ifdef CONFIG_SMP
+#include <asm/cputable.h>
+#define smt_capable()		(cpu_has_feature(CPU_FTR_SMT))
+
+#endif
+
+#endif /* __KERNEL__ */
+#endif /* _ASM_MICROBLAZE_TOPOLOGY_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 48/56] microblaze_v2: pool.h socket.h
  2008-05-04 11:41                                                                                             ` [PATCH 47/56] microblaze_v2: device.h param.h topology.h monstr
@ 2008-05-04 11:41                                                                                               ` monstr
  2008-05-04 11:41                                                                                                 ` [PATCH 49/56] microblaze_v2: fcntl.h sockios.h ucontext.h monstr
  2008-05-04 22:39                                                                                                 ` [PATCH 48/56] microblaze_v2: pool.h socket.h Arnd Bergmann
  2008-05-04 22:37                                                                                               ` [PATCH 47/56] microblaze_v2: device.h param.h topology.h Arnd Bergmann
  1 sibling, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/poll.h   |   37 +++++++++++++++++++++
 include/asm-microblaze/socket.h |   68 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 105 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/poll.h
 create mode 100644 include/asm-microblaze/socket.h

diff --git a/include/asm-microblaze/poll.h b/include/asm-microblaze/poll.h
new file mode 100644
index 0000000..4b33ac7
--- /dev/null
+++ b/include/asm-microblaze/poll.h
@@ -0,0 +1,37 @@
+/*
+ * include/asm-microblaze/poll.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_POLL_H
+#define _ASM_MICROBLAZE_POLL_H
+
+#define POLLIN		0x0001
+#define POLLPRI		0x0002
+#define POLLOUT		0x0004
+
+#define POLLERR		0x0008
+#define POLLHUP		0x0010
+#define POLLNVAL	0x0020
+
+#define POLLRDNORM	0x0040
+#define POLLRDBAND	0x0080
+#define POLLWRNORM	POLLOUT
+#define POLLWRBAND	0x0100
+
+#define POLLMSG		0x0400
+#define POLLREMOVE	0x0800
+#define POLLRDHUP	0x2000
+
+struct pollfd {
+	int fd;
+	short events;
+	short revents;
+};
+
+#endif /* _ASM_MICROBLAZE_POLL_H */
diff --git a/include/asm-microblaze/socket.h b/include/asm-microblaze/socket.h
new file mode 100644
index 0000000..58d6e01
--- /dev/null
+++ b/include/asm-microblaze/socket.h
@@ -0,0 +1,68 @@
+/*
+ * include/asm-microblaze/socket.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_SOCKET_H
+#define _ASM_MICROBLAZE_SOCKET_H
+
+#include <asm/sockios.h>
+
+/* For setsockoptions(2) */
+#define SOL_SOCKET	1
+
+#define SO_DEBUG	1
+#define SO_REUSEADDR	2
+#define SO_TYPE		3
+#define SO_ERROR	4
+#define SO_DONTROUTE	5
+#define SO_BROADCAST	6
+#define SO_SNDBUF	7
+#define SO_RCVBUF	8
+#define SO_SNDBUFFORCE	32
+#define SO_RCVBUFFORCE	33
+#define SO_KEEPALIVE	9
+#define SO_OOBINLINE	10
+#define SO_NO_CHECK	11
+#define SO_PRIORITY	12
+#define SO_LINGER	13
+#define SO_BSDCOMPAT	14
+/* To add :#define SO_REUSEPORT 15 */
+#define SO_PASSCRED	16
+#define SO_PEERCRED	17
+#define SO_RCVLOWAT	18
+#define SO_SNDLOWAT	19
+#define SO_RCVTIMEO	20
+#define SO_SNDTIMEO	21
+
+/* Security levels - as per NRL IPv6 - don't actually do anything */
+#define SO_SECURITY_AUTHENTICATION		22
+#define SO_SECURITY_ENCRYPTION_TRANSPORT	23
+#define SO_SECURITY_ENCRYPTION_NETWORK		24
+
+#define SO_BINDTODEVICE	25
+
+/* Socket filtering */
+#define SO_ATTACH_FILTER	26
+#define SO_DETACH_FILTER	27
+
+#define SO_PEERNAME		28
+#define SO_TIMESTAMP		29
+#define SCM_TIMESTAMP		SO_TIMESTAMP
+
+#define SO_ACCEPTCONN		30
+
+#define SO_PEERSEC		31
+#define SO_PASSSEC		34
+
+#define SO_TIMESTAMPNS		35
+#define SCM_TIMESTAMPNS		SO_TIMESTAMPNS
+
+#define SO_MARK			36
+
+#endif /* _ASM_MICROBLAZE_SOCKET_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 49/56] microblaze_v2: fcntl.h sockios.h ucontext.h
  2008-05-04 11:41                                                                                               ` [PATCH 48/56] microblaze_v2: pool.h socket.h monstr
@ 2008-05-04 11:41                                                                                                 ` monstr
  2008-05-04 11:41                                                                                                   ` [PATCH 50/56] microblaze_v2: setup.h string.h thread_info.h monstr
  2008-05-04 22:43                                                                                                   ` [PATCH 49/56] microblaze_v2: fcntl.h sockios.h ucontext.h Arnd Bergmann
  2008-05-04 22:39                                                                                                 ` [PATCH 48/56] microblaze_v2: pool.h socket.h Arnd Bergmann
  1 sibling, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/fcntl.h    |  104 +++++++++++++++++++++++++++++++++++++
 include/asm-microblaze/sockios.h  |   25 +++++++++
 include/asm-microblaze/ucontext.h |   24 +++++++++
 3 files changed, 153 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/fcntl.h
 create mode 100644 include/asm-microblaze/sockios.h
 create mode 100644 include/asm-microblaze/ucontext.h

diff --git a/include/asm-microblaze/fcntl.h b/include/asm-microblaze/fcntl.h
new file mode 100644
index 0000000..b8706c9
--- /dev/null
+++ b/include/asm-microblaze/fcntl.h
@@ -0,0 +1,104 @@
+/*
+ * include/asm-microblaze/fcntl.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_FCNTL_H
+#define _ASM_MICROBLAZE_FCNTL_H
+
+/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+ located on an ext2 file system */
+#define O_ACCMODE	0003
+#define O_RDONLY	00
+#define O_WRONLY	01
+#define O_RDWR		02
+#define O_CREAT		0100 /* not fcntl */
+#define O_EXCL		0200 /* not fcntl */
+#define O_NOCTTY	0400 /* not fcntl */
+#define O_TRUNC		01000 /* not fcntl */
+#define O_APPEND	02000
+#define O_NONBLOCK	04000
+#define O_NDELAY	O_NONBLOCK
+#define O_SYNC		010000
+#define FASYNC		020000 /* fcntl, for BSD compatibility */
+#define O_DIRECTORY	040000 /* must be a directory */
+#define O_NOFOLLOW	0100000 /* don't follow links */
+#define O_LARGEFILE	0200000
+#define O_DIRECT	0400000 /* direct disk access hint */
+#define O_NOATIME	01000000
+#define O_CLOEXEC	02000000
+
+#define F_DUPFD		0 /* dup */
+#define F_GETFD		1 /* get close_on_exec */
+#define F_SETFD		2 /* set/clear close_on_exec */
+#define F_GETFL		3 /* get file->f_flags */
+#define F_SETFL		4 /* set file->f_flags */
+#define F_GETLK		5
+#define F_SETLK		6
+#define F_SETLKW	7
+
+#define F_SETOWN	8 /* for sockets. */
+#define F_GETOWN	9 /* for sockets. */
+#define F_SETSIG	10 /* for sockets. */
+#define F_GETSIG	11 /* for sockets. */
+
+#define F_GETLK64	12 /* using 'struct flock64' */
+#define F_SETLK64	13
+#define F_SETLKW64	14
+
+/* for F_[GET|SET]FL */
+#define FD_CLOEXEC	1 /* actually anything with low bit set goes */
+
+/* for posix fcntl() and lockf() */
+#define F_RDLCK		0
+#define F_WRLCK		1
+#define F_UNLCK		2
+
+/* for old implementation of bsd flock () */
+#define F_EXLCK		4 /* or 3 */
+#define F_SHLCK		8 /* or 4 */
+
+/* for leases */
+#define F_INPROGRESS	16
+
+/* operations for bsd flock(), also used by the kernel implementation */
+#define LOCK_SH		1 /* shared lock */
+#define LOCK_EX		2 /* exclusive lock */
+#define LOCK_NB		4 /* or'd with one of the above to prevent blocking */
+#define LOCK_UN		8 /* remove lock */
+
+#define LOCK_MAND	32 /* This is a mandatory flock */
+#define LOCK_READ	64 /* ... Which allows concurrent read operations */
+#define LOCK_WRITE	128 /* ... Which allows concurrent write operations */
+#define LOCK_RW		192 /* ... Which allows concurrent read & write ops */
+
+#ifdef __KERNEL__
+#define F_POSIX		1
+#define F_FLOCK		2
+#define F_BROKEN	4 /* broken flock() emulation */
+#endif /* __KERNEL__ */
+
+struct flock {
+	short l_type;
+	short l_whence;
+	off_t l_start;
+	off_t l_len;
+	pid_t l_pid;
+};
+
+struct flock64 {
+	short l_type;
+	short l_whence;
+	loff_t l_start;
+	loff_t l_len;
+	pid_t l_pid;
+};
+
+#define F_LINUX_SPECIFIC_BASE	1024
+
+#endif /* _ASM_MICROBLAZE_FCNTL_H */
diff --git a/include/asm-microblaze/sockios.h b/include/asm-microblaze/sockios.h
new file mode 100644
index 0000000..a11b12f
--- /dev/null
+++ b/include/asm-microblaze/sockios.h
@@ -0,0 +1,25 @@
+/*
+ * include/asm-microblaze/sockios.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_SOCKIOS_H
+#define _ASM_MICROBLAZE_SOCKIOS_H
+
+#include <asm/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 */
diff --git a/include/asm-microblaze/ucontext.h b/include/asm-microblaze/ucontext.h
new file mode 100644
index 0000000..7ece650
--- /dev/null
+++ b/include/asm-microblaze/ucontext.h
@@ -0,0 +1,24 @@
+/*
+ * include/asm-microblaze/ucontext.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_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 */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 50/56] microblaze_v2: setup.h string.h thread_info.h
  2008-05-04 11:41                                                                                                 ` [PATCH 49/56] microblaze_v2: fcntl.h sockios.h ucontext.h monstr
@ 2008-05-04 11:41                                                                                                   ` monstr
  2008-05-04 11:41                                                                                                     ` [PATCH 51/56] microblaze_v2: Kbuild file monstr
  2008-05-05  2:39                                                                                                     ` [PATCH 50/56] microblaze_v2: setup.h string.h thread_info.h John Williams
  2008-05-04 22:43                                                                                                   ` [PATCH 49/56] microblaze_v2: fcntl.h sockios.h ucontext.h Arnd Bergmann
  1 sibling, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/setup.h       |   42 +++++++++
 include/asm-microblaze/string.h      |   22 +++++
 include/asm-microblaze/thread_info.h |  155 ++++++++++++++++++++++++++++++++++
 3 files changed, 219 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/setup.h
 create mode 100644 include/asm-microblaze/string.h
 create mode 100644 include/asm-microblaze/thread_info.h

diff --git a/include/asm-microblaze/setup.h b/include/asm-microblaze/setup.h
new file mode 100644
index 0000000..ba4bf7d
--- /dev/null
+++ b/include/asm-microblaze/setup.h
@@ -0,0 +1,42 @@
+/*
+ * include/asm-microblaze/setup.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_SETUP_H
+#define _ASM_MICROBLAZE_SETUP_H
+
+#include <linux/init.h>
+
+extern unsigned int boot_cpuid;
+
+#define COMMAND_LINE_SIZE	256
+extern char cmd_line[COMMAND_LINE_SIZE];
+
+int __init setup_early_printk(char *opt);
+void early_printk(const char *fmt, ...);
+
+#ifdef CONFIG_HEART_BEAT
+void heartbeat(void);
+#endif
+
+void system_timer_init(void);
+unsigned long do_gettimeoffset(void);
+void time_init(void);
+unsigned long long sched_clock(void);
+
+void __init setup_memory(void);
+void __init machine_early_init(const char *cmdline, unsigned int ram,
+			unsigned int fdt);
+
+void machine_restart(char *cmd);
+void machine_shutdown(void);
+void machine_halt(void);
+void machine_power_off(void);
+
+#endif /* _ASM_MICROBLAZE_SETUP_H */
diff --git a/include/asm-microblaze/string.h b/include/asm-microblaze/string.h
new file mode 100644
index 0000000..bf2051c
--- /dev/null
+++ b/include/asm-microblaze/string.h
@@ -0,0 +1,22 @@
+/*
+ * include/asm-microblaze/string.h
+ *
+ * This 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_STRING_H
+#define _ASM_MICROBLAZE_STRING_H
+
+#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 /* _ASM_MICROBLAZE_STRING_H */
diff --git a/include/asm-microblaze/thread_info.h b/include/asm-microblaze/thread_info.h
new file mode 100644
index 0000000..8a46c14
--- /dev/null
+++ b/include/asm-microblaze/thread_info.h
@@ -0,0 +1,155 @@
+/*
+ * include/asm-microblaze/thread_info.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_THREAD_INFO_H
+#define _ASM_MICROBLAZE_THREAD_INFO_H
+
+#ifdef __KERNEL__
+
+/* we have 8k stack */
+#define THREAD_SHIFT		13
+#define THREAD_SIZE		(1 << THREAD_SHIFT)
+
+#ifndef __ASSEMBLY__
+# include <asm/processor.h>
+# include <asm/segment.h>
+
+/*
+ * low level task data that entry.S needs immediate access to
+ * - this struct should fit entirely inside of one cache line
+ * - this struct shares the supervisor stack pages
+ * - if the contents of this structure are changed, the assembly constants
+ *	 must also be changed
+ */
+
+struct cpu_context {
+	__u32	sp;
+	__u32	r2;
+	/* dedicated registers */
+	__u32	r13;
+	__u32	r14;
+	__u32	r15;
+	__u32	r16;
+	__u32	r17;
+	__u32	r18;
+	/* non-volatile registers */
+	__u32	r19;
+	__u32	r20;
+	__u32	r21;
+	__u32	r22;
+	__u32	r23;
+	__u32	r24;
+	__u32	r25;
+	__u32	r26;
+	__u32	r27;
+	__u32	r28;
+	__u32	r29;
+	__u32	r30;
+	/* special purpose registers */
+	__u32	msr;
+	__u32	ear;
+	__u32	esr;
+	__u32	fsr;
+};
+
+struct thread_info {
+	struct task_struct	*task; /* main task structure */
+	struct exec_domain	*exec_domain; /* execution domain */
+	unsigned long		flags; /* low level flags */
+	unsigned long		status; /* thread-synchronous flags */
+	__u32			cpu; /* current CPU */
+	__s32			preempt_count; /* 0 => preemptable,< 0 => BUG*/
+	mm_segment_t		addr_limit; /* thread address space */
+	struct restart_block	restart_block;
+
+	struct cpu_context	cpu_context;
+};
+
+/*
+ * macros/functions for gaining access to the thread information structure
+ *
+ * preempt_count needs to be 1 initially, until the scheduler is functional.
+ */
+#define INIT_THREAD_INFO(tsk)			\
+{						\
+	.task		= &tsk,			\
+	.exec_domain	= &default_exec_domain,	\
+	.flags		= 0,			\
+	.cpu		= 0,			\
+	.preempt_count	= 1,			\
+	.addr_limit	= KERNEL_DS,		\
+	.restart_block = {			\
+		.fn = do_no_restart_syscall,	\
+	},					\
+}
+
+#define init_thread_info	(init_thread_union.thread_info)
+#define init_stack		(init_thread_union.stack)
+
+/* how to get the thread information struct from C */
+static inline struct thread_info *current_thread_info(void)
+{
+	register unsigned long sp asm("r1");
+
+	return (struct thread_info *)(sp & ~(THREAD_SIZE-1));
+}
+
+/* thread information allocation */
+#define alloc_thread_info(tsk) \
+		((struct thread_info *) __get_free_pages(GFP_KERNEL, 1))
+#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
+
+#endif /* __ASSEMBLY__ */
+
+#define PREEMPT_ACTIVE		0x10000000
+
+/*
+ * thread information flags
+ * - these are process state flags that various assembly files may
+ *   need to access
+ * - pending work-to-be-done flags are in LSW
+ * - other flags in MSW
+ */
+#define TIF_SYSCALL_TRACE	0 /* syscall trace active */
+#define TIF_NOTIFY_RESUME	1 /* resumption notification requested */
+#define TIF_SIGPENDING		2 /* signal pending */
+#define TIF_NEED_RESCHED	3 /* rescheduling necessary */
+/* restore singlestep on return to user mode */
+#define TIF_SINGLESTEP		4
+#define TIF_IRET		5 /* return with iret */
+#define TIF_MEMDIE		6
+/* true if poll_idle() is polling TIF_NEED_RESCHED */
+#define TIF_POLLING_NRFLAG	16
+
+#define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
+#define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
+#define _TIF_SIGPENDING		(1<<TIF_SIGPENDING)
+#define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED)
+#define _TIF_SINGLESTEP		(1<<TIF_SINGLESTEP)
+#define _TIF_IRET		(1<<TIF_IRET)
+#define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)
+
+/* work to do on interrupt/exception return */
+#define _TIF_WORK_MASK		0x0000FFFE
+/* work to do on any return to u-space */
+#define _TIF_ALLWORK_MASK	0x0000FFFF
+
+/*
+ * Thread-synchronous status.
+ *
+ * This is different from the flags in that nobody else
+ * ever touches our thread-synchronous status, so we don't
+ * have to worry about atomic accesses.
+ */
+/* FPU was used by this task this quantum (SMP) */
+#define TS_USEDFPU		0x0001
+
+#endif /* __KERNEL__ */
+#endif /* _ASM_MICROBLAZE_THREAD_INFO_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 51/56] microblaze_v2: Kbuild file
  2008-05-04 11:41                                                                                                   ` [PATCH 50/56] microblaze_v2: setup.h string.h thread_info.h monstr
@ 2008-05-04 11:41                                                                                                     ` monstr
  2008-05-04 11:41                                                                                                       ` [PATCH 52/56] microblaze_v2: pci headers monstr
  2008-05-05  2:39                                                                                                     ` [PATCH 50/56] microblaze_v2: setup.h string.h thread_info.h John Williams
  1 sibling, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/Kbuild |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/Kbuild

diff --git a/include/asm-microblaze/Kbuild b/include/asm-microblaze/Kbuild
new file mode 100644
index 0000000..783296d
--- /dev/null
+++ b/include/asm-microblaze/Kbuild
@@ -0,0 +1,24 @@
+include include/asm-generic/Kbuild.asm
+
+header-y += auxvec.h
+header-y += cpuinfo.h
+header-y += errno.h
+header-y += fcntl.h
+header-y += ioctl.h
+header-y += ioctls.h
+header-y += ipcbuf.h
+header-y += linkage.h
+header-y += mman.h
+header-y += msgbuf.h
+header-y += poll.h
+header-y += resource.h
+header-y += sembuf.h
+header-y += shmbuf.h
+header-y += sigcontext.h
+header-y += siginfo.h
+header-y += socket.h
+header-y += sockios.h
+header-y += statfs.h
+header-y += stat.h
+header-y += termbits.h
+header-y += ucontext.h
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 52/56] microblaze_v2: pci headers
  2008-05-04 11:41                                                                                                     ` [PATCH 51/56] microblaze_v2: Kbuild file monstr
@ 2008-05-04 11:41                                                                                                       ` monstr
  2008-05-04 11:41                                                                                                         ` [PATCH 53/56] microblaze_v2: IPC headers monstr
  2008-05-04 22:45                                                                                                         ` [PATCH 52/56] microblaze_v2: pci headers Arnd Bergmann
  0 siblings, 2 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/pci-bridge.h |   17 +++++++++++++++++
 include/asm-microblaze/pci.h        |   19 +++++++++++++++++++
 2 files changed, 36 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/pci-bridge.h
 create mode 100644 include/asm-microblaze/pci.h

diff --git a/include/asm-microblaze/pci-bridge.h b/include/asm-microblaze/pci-bridge.h
new file mode 100644
index 0000000..3a74fd4
--- /dev/null
+++ b/include/asm-microblaze/pci-bridge.h
@@ -0,0 +1,17 @@
+/*
+ * include/asm-microblaze/pci-bridge.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2008 Michal Simek <monstr@monstr.eu>
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_PCI_BRIDGE_H
+#define _ASM_PCI_BRIDGE_H
+
+#include <linux/pci.h>
+
+#endif /* _ASM_PCI_BRIDGE_H */
diff --git a/include/asm-microblaze/pci.h b/include/asm-microblaze/pci.h
new file mode 100644
index 0000000..89bec79
--- /dev/null
+++ b/include/asm-microblaze/pci.h
@@ -0,0 +1,19 @@
+/*
+ * include/asm-microblaze/pci.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2008 Michal Simek <monstr@monstr.eu>
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_PCI_H
+#define _ASM_MICROBLAZE_PCI_H
+
+#ifdef __KERNEL__
+#include <asm/io.h>
+#endif
+
+#endif /* _ASM_MICROBLAZE_PCI_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 53/56] microblaze_v2: IPC headers
  2008-05-04 11:41                                                                                                       ` [PATCH 52/56] microblaze_v2: pci headers monstr
@ 2008-05-04 11:41                                                                                                         ` monstr
  2008-05-04 11:41                                                                                                           ` [PATCH 54/56] microblaze_v2: entry.S monstr
  2008-05-04 22:45                                                                                                         ` [PATCH 52/56] microblaze_v2: pci headers Arnd Bergmann
  1 sibling, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 include/asm-microblaze/ipc.h    |   18 ++++++++++++++++++
 include/asm-microblaze/ipcbuf.h |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-microblaze/ipc.h
 create mode 100644 include/asm-microblaze/ipcbuf.h

diff --git a/include/asm-microblaze/ipc.h b/include/asm-microblaze/ipc.h
new file mode 100644
index 0000000..cd0fe3a
--- /dev/null
+++ b/include/asm-microblaze/ipc.h
@@ -0,0 +1,18 @@
+/*
+ * include/asm-microblaze/ipc.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_IPC_H
+#define _ASM_MICROBLAZE_IPC_H
+
+#include <asm-generic/ipc.h>
+
+#endif /* _ASM_MICROBLAZE_IPC_H */
+
+
diff --git a/include/asm-microblaze/ipcbuf.h b/include/asm-microblaze/ipcbuf.h
new file mode 100644
index 0000000..4aadc52
--- /dev/null
+++ b/include/asm-microblaze/ipcbuf.h
@@ -0,0 +1,38 @@
+/*
+ * include/asm-microblaze/ipcbuf.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_IPCBUF_H
+#define _ASM_MICROBLAZE_IPCBUF_H
+
+/*
+ * The user_ipc_perm structure for m68k architecture.
+ * Note extra padding because this structure is passed back and forth
+ * between kernel and user space.
+ *
+ * Pad space is left for:
+ * - 32-bit mode_t and seq
+ * - 2 miscellaneous 32-bit values
+ */
+
+struct ipc64_perm {
+	__kernel_key_t		key;
+	__kernel_uid32_t	uid;
+	__kernel_gid32_t	gid;
+	__kernel_uid32_t	cuid;
+	__kernel_gid32_t	cgid;
+	__kernel_mode_t		mode;
+	unsigned short		__pad1;
+	unsigned short		seq;
+	unsigned short		__pad2;
+	unsigned long		__unused1;
+	unsigned long		__unused2;
+};
+
+#endif /* _ASM_MICROBLAZE_IPCBUF_H */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 54/56] microblaze_v2: entry.S
  2008-05-04 11:41                                                                                                         ` [PATCH 53/56] microblaze_v2: IPC headers monstr
@ 2008-05-04 11:41                                                                                                           ` monstr
  2008-05-04 11:41                                                                                                             ` [PATCH 55/56] microblaze_v2: sys_microblaze.c monstr
  0 siblings, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 arch/microblaze/kernel/entry.S |  597 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 597 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/entry.S

diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S
new file mode 100644
index 0000000..d0b487b
--- /dev/null
+++ b/arch/microblaze/kernel/entry.S
@@ -0,0 +1,597 @@
+/*
+ * arch/microblaze/kernel/entry.S
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#include <linux/linkage.h>
+#include <asm/thread_info.h>
+#include <asm/errno.h>
+#include <asm/asm-offsets.h>
+#include <asm/registers.h>
+#include <asm/unistd.h>
+#include <asm/percpu.h>
+#include <asm/signal.h>
+
+#define PER_CPU(var) per_cpu__##var
+
+#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
+	.macro	disable_irq
+	msrclr r0, MSR_IE
+	.endm
+
+	.macro	enable_irq
+	msrset r0, MSR_IE
+	.endm
+
+	.macro	clear_bip
+	msrclr r0, MSR_BIP
+	.endm
+#else
+	.macro	disable_irq
+	mfs r11, rmsr
+	andi r11, r11, ~MSR_IE
+	mts rmsr, r11
+	.endm
+
+	.macro	enable_irq
+	mfs r11, rmsr
+	ori r11, r11, MSR_IE
+	mts rmsr, r11
+	.endm
+
+	.macro	clear_bip
+	mfs r11, rmsr
+	andi r11, r11, ~MSR_BIP
+	mts rmsr, r11
+	.endm
+#endif
+
+ENTRY(_interrupt)
+	swi	r1, r0, PER_CPU(ENTRY_SP)	/* save the current sp */
+	swi	r11, r0, PER_CPU(R11_SAVE)	/* temporarily save r11 */
+	lwi	r11, r0, PER_CPU(KM)		/* load mode indicator */
+	beqid	r11, 1f
+	nop
+	brid	2f				/* jump over */
+	addik	r1, r1, (-PT_SIZE)	/* room for pt_regs (delay slot) */
+1:						/* switch to kernel stack */
+	lwi	r1, r0, PER_CPU(CURRENT_SAVE)	/* get the saved current */
+	lwi	r1, r1, TS_THREAD_INFO		/* get the thread info */
+	/* calculate kernel stack pointer */
+	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_SP
+	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_SP
+
+	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)
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 55/56] microblaze_v2: sys_microblaze.c
  2008-05-04 11:41                                                                                                           ` [PATCH 54/56] microblaze_v2: entry.S monstr
@ 2008-05-04 11:41                                                                                                             ` monstr
  2008-05-04 11:41                                                                                                               ` [PATCH 56/56] microblaze_v2: syscall_table.S and unistd.h monstr
  0 siblings, 1 reply; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 arch/microblaze/kernel/sys_microblaze.c |  287 +++++++++++++++++++++++++++++++
 1 files changed, 287 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/sys_microblaze.c

diff --git a/arch/microblaze/kernel/sys_microblaze.c b/arch/microblaze/kernel/sys_microblaze.c
new file mode 100644
index 0000000..1cf8efd
--- /dev/null
+++ b/arch/microblaze/kernel/sys_microblaze.c
@@ -0,0 +1,287 @@
+/*
+ * arch/microblaze/kernel/sys_microblaze.c
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ * Copyright (C) 2007 PetaLogix
+ *
+ * Authors:
+ * John Williams <john.williams@petalogix.com>
+ * Yasushi SHOJI <yashi@atmark-techno.com>
+ * Tetsuya OHKAWA <tetsuya@atmark-techno.com>
+ */
+
+#include <linux/errno.h>
+#include <linux/mm.h>
+#include <linux/smp.h>
+#include <linux/smp_lock.h>
+#include <linux/syscalls.h>
+#include <linux/sem.h>
+#include <linux/msg.h>
+#include <linux/shm.h>
+#include <linux/stat.h>
+#include <linux/mman.h>
+#include <linux/sys.h>
+#include <linux/ipc.h>
+#include <linux/utsname.h>
+#include <linux/file.h>
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/fs.h>
+
+#include <asm/uaccess.h>
+#include <linux/ipc.h>
+#include <asm/semaphore.h>
+#include <asm/unistd.h>
+
+/*
+ * sys_ipc() is the de-multiplexer for the SysV IPC calls..
+ *
+ * This is really horribly ugly.
+ */
+int
+sys_ipc(uint call, int first, int second, int third, void *ptr, long fifth)
+{
+	int version, ret;
+
+	version = call >> 16; /* hack for backward compatibility */
+	call &= 0xffff;
+
+	ret = -EINVAL;
+	switch (call) {
+	case SEMOP:
+		ret = sys_semop(first, (struct sembuf *)ptr, second);
+		break;
+	case SEMGET:
+		ret = sys_semget(first, second, third);
+		break;
+	case SEMCTL:
+	{
+		union semun fourth;
+
+		if (!ptr)
+			break;
+		if ((ret = access_ok(VERIFY_READ, ptr,
+					sizeof(long)) ? 0 : -EFAULT)
+			|| (ret = get_user(fourth.__pad, (void **)ptr)))
+			break;
+		ret = sys_semctl(first, second, third, fourth);
+		break;
+	}
+	case MSGSND:
+		ret = sys_msgsnd(first, (struct msgbuf *) ptr, second, third);
+		break;
+	case MSGRCV:
+		switch (version) {
+		case 0: {
+			struct ipc_kludge tmp;
+
+			if (!ptr)
+				break;
+			if ((ret = access_ok(VERIFY_READ, ptr,
+					sizeof(tmp)) ? 0 : -EFAULT)
+				|| (ret = copy_from_user(&tmp,
+						(struct ipc_kludge *) ptr,
+						sizeof(tmp))))
+				break;
+			ret = sys_msgrcv(first, tmp.msgp, second, tmp.msgtyp,
+					third);
+			break;
+			}
+		default:
+			ret = sys_msgrcv(first, (struct msgbuf *) ptr,
+					second, fifth, third);
+			break;
+		}
+		break;
+	case MSGGET:
+		ret = sys_msgget((key_t) first, second);
+		break;
+	case MSGCTL:
+		ret = sys_msgctl(first, second, (struct msqid_ds *) ptr);
+		break;
+	case SHMAT:
+		switch (version) {
+		default: {
+			ulong raddr;
+
+			if ((ret = access_ok(VERIFY_WRITE, (ulong *) third,
+					sizeof(ulong)) ? 0 : -EFAULT))
+				break;
+			ret = do_shmat(first, (char *) ptr, second, &raddr);
+			if (ret)
+				break;
+			ret = put_user(raddr, (ulong *) third);
+			break;
+			}
+		case 1:	/* iBCS2 emulator entry point */
+			if (!segment_eq(get_fs(), get_ds()))
+				break;
+			ret = do_shmat(first, (char *) ptr, second,
+					(ulong *) third);
+			break;
+		}
+		break;
+	case SHMDT:
+		ret = sys_shmdt((char *)ptr);
+		break;
+	case SHMGET:
+		ret = sys_shmget(first, second, third);
+		break;
+	case SHMCTL:
+		ret = sys_shmctl(first, second, (struct shmid_ds *) ptr);
+		break;
+	}
+
+	return ret;
+}
+
+long execve(const char *filename, char **argv, char **envp)
+{
+	struct pt_regs regs;
+	int ret;
+
+	memset(&regs, 0, sizeof(struct pt_regs));
+	local_save_flags(regs.msr);
+	ret = do_execve((char *)filename, (char __user * __user *)argv,
+			(char __user * __user *)envp, &regs);
+
+	if (ret < 0)
+		goto out;
+
+	/*
+	 * Save argc to the register structure for userspace.
+	 */
+	regs.r5 = ret; /* FIXME */
+
+	/*
+	 * We were successful. We won't be returning to our caller, but
+	 * instead to user space by manipulating the kernel stack.
+	 */
+	asm volatile ("addk	r5, r0, %0	\n\t"
+			"addk	r6, r0, %1	\n\t"
+			/* copy regs to top of stack */
+			"brlid	r15, memmove	\n\t"
+			"addik	r7, r0, %2	\n\t"
+			"brid	ret_to_user	\n\t"
+			/* reposition stack pointer */
+			"addk	r1, r0, r3	\n\t"
+			:
+			: "r" (task_pt_regs(current)),
+			"r" (&regs),
+			"i" (sizeof(regs))
+			: "r1", "r3", "r5", "r6", "r7", "r15", "memory");
+
+out:
+	return ret;
+}
+EXPORT_SYMBOL(execve);
+
+asmlinkage int sys_vfork(struct pt_regs *regs)
+{
+	return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->r1,
+						regs, 0, NULL, NULL);
+}
+
+asmlinkage int sys_clone(int flags, unsigned long stack, struct pt_regs *regs)
+{
+	if (!stack)
+		stack = regs->r1;
+	return do_fork(flags, stack, regs, 0, NULL, NULL);
+}
+
+asmlinkage int sys_execve(char __user *filenamei, char __user * __user *argv,
+			char __user * __user *envp, struct pt_regs *regs)
+{
+	int error;
+	char *filename;
+
+	filename = getname(filenamei);
+	error = PTR_ERR(filename);
+	if (IS_ERR(filename))
+		goto out;
+	error = do_execve(filename, argv, envp, regs);
+	putname(filename);
+out:
+	return error;
+}
+
+static inline unsigned long
+do_mmap2(unsigned long addr, size_t len,
+	unsigned long prot, unsigned long flags,
+	unsigned long fd, unsigned long pgoff)
+{
+	struct file *file = NULL;
+	int ret = -EBADF;
+
+	flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
+	if (!(flags & MAP_ANONYMOUS))
+		if (!(file = fget(fd))) {
+			printk(KERN_INFO "no fd in mmap\r\n");
+			goto out;
+		}
+
+	down_write(&current->mm->mmap_sem);
+	ret = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
+	up_write(&current->mm->mmap_sem);
+	if (file)
+		fput(file);
+out:
+	return ret;
+}
+
+unsigned long sys_mmap2(unsigned long addr, size_t len,
+			unsigned long prot, unsigned long flags,
+			unsigned long fd, unsigned long pgoff)
+{
+	return do_mmap2(addr, len, prot, flags, fd, pgoff);
+}
+
+unsigned long sys_mmap(unsigned long addr, size_t len,
+			unsigned long prot, unsigned long flags,
+			unsigned long fd, off_t offset)
+{
+	int err = -EINVAL;
+
+	if (offset & ~PAGE_MASK) {
+		printk(KERN_INFO "no pagemask in mmap\r\n");
+		goto out;
+	}
+
+	err = do_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
+out:
+	return err;
+}
+
+int sys_uname(struct old_utsname *name)
+{
+	int err = -EFAULT;
+
+	down_read(&uts_sem);
+	if (name && !copy_to_user(name, utsname(), sizeof(*name)))
+		err = 0;
+	up_read(&uts_sem);
+	return err;
+}
+
+/*
+ * Do a system call from kernel instead of calling sys_execve so we
+ * end up with proper pt_regs.
+ */
+int kernel_execve(const char *filename, char *const argv[], char *const envp[])
+{
+	register const char *__a __asm__("r5") = filename;
+	register const void *__b __asm__("r6") = argv;
+	register const void *__c __asm__("r7") = envp;
+	register unsigned long __syscall __asm__("r12") = __NR_execve;
+	register unsigned long __ret __asm__("r3");
+	__asm__ __volatile__ ("brki r14, 0x8"
+			: "=r" (__ret), "=r" (__syscall)
+			: "1" (__syscall), "r" (__a), "r" (__b), "r" (__c)
+			: "r4", "r8", "r9",
+			"r10", "r11", "r14", "cc", "memory");
+	return __ret;
+}
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* [PATCH 56/56] microblaze_v2: syscall_table.S and unistd.h
  2008-05-04 11:41                                                                                                             ` [PATCH 55/56] microblaze_v2: sys_microblaze.c monstr
@ 2008-05-04 11:41                                                                                                               ` monstr
  0 siblings, 0 replies; 170+ messages in thread
From: monstr @ 2008-05-04 11:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: arnd, linux-arch, stephen.neuendorffer, John.Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

From: Michal Simek <monstr@monstr.eu>


Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 arch/microblaze/kernel/syscall_table.S |  330 +++++++++++++++++++++++++++
 include/asm-microblaze/unistd.h        |  392 ++++++++++++++++++++++++++++++++
 2 files changed, 722 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/kernel/syscall_table.S
 create mode 100644 include/asm-microblaze/unistd.h

diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S
new file mode 100644
index 0000000..6a5461b
--- /dev/null
+++ b/arch/microblaze/kernel/syscall_table.S
@@ -0,0 +1,330 @@
+ENTRY(sys_call_table)
+	.long sys_restart_syscall	/* 0 - old "setup()" system call,
+					 * used for restarting */
+	.long sys_exit
+	.long sys_ni_syscall		/* was fork */
+	.long sys_read
+	.long sys_write
+	.long sys_open			/* 5 */
+	.long sys_close
+	.long sys_waitpid
+	.long sys_creat
+	.long sys_link
+	.long sys_unlink		/* 10 */
+	.long sys_execve_wrapper
+	.long sys_chdir
+	.long sys_time
+	.long sys_mknod
+	.long sys_chmod			/* 15 */
+	.long sys_lchown16
+	.long sys_ni_syscall		/* old break syscall holder */
+	.long sys_ni_syscall		/* stat */
+	.long sys_lseek
+	.long sys_getpid		/* 20 */
+	.long sys_mount
+	.long sys_oldumount
+	.long sys_setuid16
+	.long sys_getuid16
+	.long sys_stime			/* 25 */
+	.long sys_ptrace
+	.long sys_alarm
+	.long sys_ni_syscall		/* fstat */
+	.long sys_pause
+	.long sys_utime			/* 30 */
+	.long sys_ni_syscall		/* old stty syscall holder */
+	.long sys_ni_syscall		/* old gtty syscall holder */
+	.long sys_access
+	.long sys_nice
+	.long sys_ni_syscall		/* 35 - old ftime syscall holder */
+	.long sys_sync
+	.long sys_kill
+	.long sys_rename
+	.long sys_mkdir
+	.long sys_rmdir			/* 40 */
+	.long sys_dup
+	.long sys_pipe
+	.long sys_times
+	.long sys_ni_syscall		/* old prof syscall holder */
+	.long sys_brk			/* 45 */
+	.long sys_setgid16
+	.long sys_getgid16
+	.long sys_signal
+	.long sys_geteuid16
+	.long sys_getegid16		/* 50 */
+	.long sys_acct
+	.long sys_umount		/* recycled never used phys() */
+	.long sys_ni_syscall		/* old lock syscall holder */
+	.long sys_ioctl
+	.long sys_fcntl			/* 55 */
+	.long sys_ni_syscall		/* old mpx syscall holder */
+	.long sys_setpgid
+	.long sys_ni_syscall		/* old ulimit syscall holder */
+	.long sys_ni_syscall		/* olduname */
+	.long sys_umask			/* 60 */
+	.long sys_chroot
+	.long sys_ustat
+	.long sys_dup2
+	.long sys_getppid
+	.long sys_getpgrp		/* 65 */
+	.long sys_setsid
+	.long sys_sigaction
+	.long sys_sgetmask
+	.long sys_ssetmask
+	.long sys_setreuid16		/* 70 */
+	.long sys_setregid16
+	.long sys_sigsuspend_wrapper
+	.long sys_sigpending
+	.long sys_sethostname
+	.long sys_setrlimit		/* 75 */
+	.long sys_ni_syscall		/* old_getrlimit */
+	.long sys_getrusage
+	.long sys_gettimeofday
+	.long sys_settimeofday
+	.long sys_getgroups16		/* 80 */
+	.long sys_setgroups16
+	.long sys_ni_syscall		/* old_select */
+	.long sys_symlink
+	.long sys_ni_syscall		/* lstat */
+	.long sys_readlink		/* 85 */
+	.long sys_uselib
+	.long sys_swapon
+	.long sys_reboot
+	.long sys_ni_syscall		/* old_readdir */
+	.long sys_mmap			/* 90 */ /* old_mmap */
+	.long sys_munmap
+	.long sys_truncate
+	.long sys_ftruncate
+	.long sys_fchmod
+	.long sys_fchown16		/* 95 */
+	.long sys_getpriority
+	.long sys_setpriority
+	.long sys_ni_syscall		/* old profil syscall holder */
+	.long sys_statfs
+	.long sys_fstatfs		/* 100 */
+	.long sys_ni_syscall		/* ioperm */
+	.long sys_socketcall
+	.long sys_syslog
+	.long sys_setitimer
+	.long sys_getitimer		/* 105 */
+	.long sys_newstat
+	.long sys_newlstat
+	.long sys_newfstat
+	.long sys_ni_syscall		/* uname */
+	.long sys_ni_syscall		/* 110 */ /* iopl */
+	.long sys_vhangup
+	.long sys_ni_syscall		/* old "idle" system call */
+	.long sys_ni_syscall		/* old sys_vm86old */
+	.long sys_wait4
+	.long sys_swapoff		/* 115 */
+	.long sys_sysinfo
+	.long sys_ipc
+	.long sys_fsync
+	.long sys_sigreturn_wrapper
+	.long sys_clone_wrapper		/* 120 */
+	.long sys_setdomainname
+	.long sys_newuname
+	.long sys_ni_syscall		/* modify_ldt */
+	.long sys_adjtimex
+	.long sys_ni_syscall		/* 125:	sys_mprotect */
+	.long sys_sigprocmask
+	.long sys_ni_syscall		/* old "create_module" */
+	.long sys_init_module
+	.long sys_delete_module
+	.long sys_ni_syscall		/* 130:	old "get_kernel_syms" */
+	.long sys_quotactl
+	.long sys_getpgid
+	.long sys_fchdir
+	.long sys_bdflush
+	.long sys_sysfs			/* 135 */
+	.long sys_personality
+	.long sys_ni_syscall		/* reserved for afs_syscall */
+	.long sys_setfsuid16
+	.long sys_setfsgid16
+	.long sys_llseek		/* 140 */
+	.long sys_getdents
+	.long sys_select
+	.long sys_flock
+	.long sys_ni_syscall		/* sys_msync */
+	.long sys_readv			/* 145 */
+	.long sys_writev
+	.long sys_getsid
+	.long sys_fdatasync
+	.long sys_sysctl
+	.long sys_ni_syscall		/* 150:	sys_mlock */
+	.long sys_ni_syscall		/* sys_munlock */
+	.long sys_ni_syscall		/* sys_mlockall */
+	.long sys_ni_syscall		/* sys_munlockall */
+	.long sys_sched_setparam
+	.long sys_sched_getparam	/* 155 */
+	.long sys_sched_setscheduler
+	.long sys_sched_getscheduler
+	.long sys_sched_yield
+	.long sys_sched_get_priority_max
+	.long sys_sched_get_priority_min	/* 160 */
+	.long sys_sched_rr_get_interval
+	.long sys_nanosleep
+	.long sys_ni_syscall		/* sys_mremap */
+	.long sys_setresuid16
+	.long sys_getresuid16		/* 165 */
+	.long sys_ni_syscall		/* sys_vm86 */
+	.long sys_ni_syscall		/* Old sys_query_module */
+	.long sys_poll
+	.long sys_nfsservctl
+	.long sys_setresgid16		/* 170 */
+	.long sys_getresgid16
+	.long sys_prctl
+	.long sys_rt_sigreturn_wrapper
+	.long sys_rt_sigaction
+	.long sys_rt_sigprocmask	/* 175 */
+	.long sys_rt_sigpending
+	.long sys_rt_sigtimedwait
+	.long sys_rt_sigqueueinfo
+	.long sys_rt_sigsuspend_wrapper
+	.long sys_pread64		/* 180 */
+	.long sys_pwrite64
+	.long sys_chown16
+	.long sys_getcwd
+	.long sys_capget
+	.long sys_capset		/* 185 */
+	.long sys_ni_syscall		/* sigaltstack */
+	.long sys_sendfile
+	.long sys_ni_syscall		/* reserved for streams1 */
+	.long sys_ni_syscall		/* reserved for streams2 */
+	.long sys_vfork_wrapper		/* 190 */
+	.long sys_getrlimit
+	.long sys_mmap2			/* mmap2 */
+	.long sys_truncate64
+	.long sys_ftruncate64
+	.long sys_stat64		/* 195 */
+	.long sys_lstat64
+	.long sys_fstat64
+	.long sys_lchown
+	.long sys_getuid
+	.long sys_getgid		/* 200 */
+	.long sys_geteuid
+	.long sys_getegid
+	.long sys_setreuid
+	.long sys_setregid
+	.long sys_getgroups		/* 205 */
+	.long sys_setgroups
+	.long sys_fchown
+	.long sys_setresuid
+	.long sys_getresuid
+	.long sys_setresgid		/* 210 */
+	.long sys_getresgid
+	.long sys_chown
+	.long sys_setuid
+	.long sys_setgid
+	.long sys_setfsuid		/* 215 */
+	.long sys_setfsgid
+	.long sys_pivot_root
+	.long sys_ni_syscall		/* sys_mincore */
+	.long sys_ni_syscall		/* sys_madvise */
+	.long sys_getdents64		/* 220 */
+	.long sys_fcntl64
+	.long sys_ni_syscall		/* reserved for TUX */
+	.long sys_ni_syscall
+	.long sys_gettid
+	.long sys_readahead		/* 225 */
+	.long sys_setxattr
+	.long sys_lsetxattr
+	.long sys_fsetxattr
+	.long sys_getxattr
+	.long sys_lgetxattr		/* 230 */
+	.long sys_fgetxattr
+	.long sys_listxattr
+	.long sys_llistxattr
+	.long sys_flistxattr
+	.long sys_removexattr		/* 235 */
+	.long sys_lremovexattr
+	.long sys_fremovexattr
+	.long sys_tkill
+	.long sys_sendfile64
+	.long sys_futex			/* 240 */
+	.long sys_sched_setaffinity
+	.long sys_sched_getaffinity
+	.long sys_ni_syscall		/* set_thread_area */
+	.long sys_ni_syscall		/* get_thread_area */
+	.long sys_io_setup		/* 245 */
+	.long sys_io_destroy
+	.long sys_io_getevents
+	.long sys_io_submit
+	.long sys_io_cancel
+	.long sys_fadvise64		/* 250 */
+	.long sys_ni_syscall
+	.long sys_exit_group
+	.long sys_lookup_dcookie
+	.long sys_epoll_create
+	.long sys_epoll_ctl		/* 255 */
+	.long sys_epoll_wait
+	.long sys_ni_syscall		/* sys_remap_file_pages */
+	.long sys_set_tid_address
+	.long sys_timer_create
+	.long sys_timer_settime		/* 260 */
+	.long sys_timer_gettime
+	.long sys_timer_getoverrun
+	.long sys_timer_delete
+	.long sys_clock_settime
+	.long sys_clock_gettime		/* 265 */
+	.long sys_clock_getres
+	.long sys_clock_nanosleep
+	.long sys_statfs64
+	.long sys_fstatfs64
+	.long sys_tgkill		/* 270 */
+	.long sys_utimes
+	.long sys_fadvise64_64
+	.long sys_ni_syscall		/* sys_vserver */
+	.long sys_mbind
+	.long sys_get_mempolicy
+	.long sys_set_mempolicy
+	.long sys_mq_open
+	.long sys_mq_unlink
+	.long sys_mq_timedsend
+	.long sys_mq_timedreceive	/* 280 */
+	.long sys_mq_notify
+	.long sys_mq_getsetattr
+	.long sys_kexec_load
+	.long sys_waitid
+	.long sys_ni_syscall		/* 285 */ /* available */
+	.long sys_add_key
+	.long sys_request_key
+	.long sys_keyctl
+	.long sys_ioprio_set
+	.long sys_ioprio_get		/* 290 */
+	.long sys_inotify_init
+	.long sys_inotify_add_watch
+	.long sys_inotify_rm_watch
+	.long sys_ni_syscall		/* sys_migrate_pages */
+	.long sys_ni_syscall		/* 295 */ /* sys_openat */
+	.long sys_ni_syscall		/* sys_mkdirat */
+	.long sys_ni_syscall		/* sys_mknodat */
+	.long sys_ni_syscall		/* sys_fchownat */
+	.long sys_ni_syscall		/* sys_futimesat */
+	.long sys_ni_syscall		/* 300 */ /* sys_fstatat64 */
+	.long sys_ni_syscall		/* sys_unlinkat */
+	.long sys_ni_syscall		/* sys_renameat */
+	.long sys_ni_syscall		/* sys_linkat */
+	.long sys_ni_syscall		/* sys_symlinkat */
+	.long sys_ni_syscall		/* 305 */ /* sys_readlinkat */
+	.long sys_ni_syscall		/* sys_fchmodat */
+	.long sys_ni_syscall		/* sys_faccessat */
+	.long sys_ni_syscall		/* pselect6 */
+	.long sys_ni_syscall		/* ppoll */
+	.long sys_ni_syscall		/* 310 */ /* sys_unshare */
+	.long sys_ni_syscall		/* sys_set_robust_list */
+	.long sys_ni_syscall		/* sys_get_robust_list */
+	.long sys_ni_syscall		/* sys_splice */
+	.long sys_ni_syscall		/* sys_sync_file_range */
+	.long sys_ni_syscall		/* 315 */ /* sys_tee */
+	.long sys_ni_syscall		/* sys_vmsplice */
+	.long sys_move_pages
+	.long sys_getcpu
+	.long sys_epoll_pwait
+	.long sys_utimensat		/* 320 */
+	.long sys_signalfd
+	.long sys_timerfd_create
+	.long sys_eventfd
+	.long sys_fallocate
+	.long sys_semtimedop		/* 325 */
+	.long sys_timerfd_settime
+	.long sys_timerfd_gettime
diff --git a/include/asm-microblaze/unistd.h b/include/asm-microblaze/unistd.h
new file mode 100644
index 0000000..1b5848c
--- /dev/null
+++ b/include/asm-microblaze/unistd.h
@@ -0,0 +1,392 @@
+/*
+ * include/asm-microblaze/unistd.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2007-2008 Michal Simek <monstr@monstr.eu>
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_MICROBLAZE_UNISTD_H
+#define _ASM_MICROBLAZE_UNISTD_H
+
+#define __NR_restart_syscall	0
+#define __NR_exit		1
+#define __NR_fork		2
+#define __NR_read		3
+#define __NR_write		4
+#define __NR_open		5
+#define __NR_close		6
+#define __NR_waitpid		7
+#define __NR_creat		8
+#define __NR_link		9
+#define __NR_unlink		10
+#define __NR_execve		11
+#define __NR_chdir		12
+#define __NR_time		13
+#define __NR_mknod		14
+#define __NR_chmod		15
+#define __NR_lchown		16
+#define __NR_break		17
+#define __NR_oldstat		18
+#define __NR_lseek		19
+#define __NR_getpid		20
+#define __NR_mount		21
+#define __NR_umount		22
+#define __NR_setuid		23
+#define __NR_getuid		24
+#define __NR_stime		25
+#define __NR_ptrace		26
+#define __NR_alarm		27
+#define __NR_oldfstat		28
+#define __NR_pause		29
+#define __NR_utime		30
+#define __NR_stty		31
+#define __NR_gtty		32
+#define __NR_access		33
+#define __NR_nice		34
+#define __NR_ftime		35
+#define __NR_sync		36
+#define __NR_kill		37
+#define __NR_rename		38
+#define __NR_mkdir		39
+#define __NR_rmdir		40
+#define __NR_dup		41
+#define __NR_pipe		42
+#define __NR_times		43
+#define __NR_prof		44
+#define __NR_brk		45
+#define __NR_setgid		46
+#define __NR_getgid		47
+#define __NR_signal		48
+#define __NR_geteuid		49
+#define __NR_getegid		50
+#define __NR_acct		51
+#define __NR_umount2		52
+#define __NR_lock		53
+#define __NR_ioctl		54
+#define __NR_fcntl		55
+#define __NR_mpx		56
+#define __NR_setpgid		57
+#define __NR_ulimit		58
+#define __NR_oldolduname	59
+#define __NR_umask		60
+#define __NR_chroot		61
+#define __NR_ustat		62
+#define __NR_dup2		63
+#define __NR_getppid		64
+#define __NR_getpgrp		65
+#define __NR_setsid		66
+#define __NR_sigaction		67
+#define __NR_sgetmask		68
+#define __NR_ssetmask		69
+#define __NR_setreuid		70
+#define __NR_setregid		71
+#define __NR_sigsuspend		72
+#define __NR_sigpending		73
+#define __NR_sethostname	74
+#define __NR_setrlimit		75
+#define __NR_getrlimit		76 /* Back compatible 2Gig limited rlimit */
+#define __NR_getrusage		77
+#define __NR_gettimeofday	78
+#define __NR_settimeofday	79
+#define __NR_getgroups		80
+#define __NR_setgroups		81
+#define __NR_select		82
+#define __NR_symlink		83
+#define __NR_oldlstat		84
+#define __NR_readlink		85
+#define __NR_uselib		86
+#define __NR_swapon		87
+#define __NR_reboot		88
+#define __NR_readdir		89
+#define __NR_mmap		90
+#define __NR_munmap		91
+#define __NR_truncate		92
+#define __NR_ftruncate		93
+#define __NR_fchmod		94
+#define __NR_fchown		95
+#define __NR_getpriority	96
+#define __NR_setpriority	97
+#define __NR_profil		98
+#define __NR_statfs		99
+#define __NR_fstatfs		100
+#define __NR_ioperm		101
+#define __NR_socketcall		102
+#define __NR_syslog		103
+#define __NR_setitimer		104
+#define __NR_getitimer		105
+#define __NR_stat		106
+#define __NR_lstat		107
+#define __NR_fstat		108
+#define __NR_olduname		109
+#define __NR_iopl		110
+#define __NR_vhangup		111
+#define __NR_idle		112
+#define __NR_vm86old		113
+#define __NR_wait4		114
+#define __NR_swapoff		115
+#define __NR_sysinfo		116
+#define __NR_ipc		117
+#define __NR_fsync		118
+#define __NR_sigreturn		119
+#define __NR_clone		120
+#define __NR_setdomainname	121
+#define __NR_uname		122
+#define __NR_modify_ldt		123
+#define __NR_adjtimex		124
+#define __NR_mprotect		125
+#define __NR_sigprocmask	126
+#define __NR_create_module	127
+#define __NR_init_module	128
+#define __NR_delete_module	129
+#define __NR_get_kernel_syms	130
+#define __NR_quotactl		131
+#define __NR_getpgid		132
+#define __NR_fchdir		133
+#define __NR_bdflush		134
+#define __NR_sysfs		135
+#define __NR_personality	136
+#define __NR_afs_syscall	137 /* Syscall for Andrew File System */
+#define __NR_setfsuid		138
+#define __NR_setfsgid		139
+#define __NR__llseek		140
+#define __NR_getdents		141
+#define __NR__newselect		142
+#define __NR_flock		143
+#define __NR_msync		144
+#define __NR_readv		145
+#define __NR_writev		146
+#define __NR_getsid		147
+#define __NR_fdatasync		148
+#define __NR__sysctl		149
+#define __NR_mlock		150
+#define __NR_munlock		151
+#define __NR_mlockall		152
+#define __NR_munlockall		153
+#define __NR_sched_setparam		154
+#define __NR_sched_getparam		155
+#define __NR_sched_setscheduler		156
+#define __NR_sched_getscheduler		157
+#define __NR_sched_yield		158
+#define __NR_sched_get_priority_max	159
+#define __NR_sched_get_priority_min	160
+#define __NR_sched_rr_get_interval	161
+#define __NR_nanosleep		162
+#define __NR_mremap		163
+#define __NR_setresuid		164
+#define __NR_getresuid		165
+#define __NR_vm86		166
+#define __NR_query_module	167
+#define __NR_poll		168
+#define __NR_nfsservctl		169
+#define __NR_setresgid		170
+#define __NR_getresgid		171
+#define __NR_prctl		172
+#define __NR_rt_sigreturn	173
+#define __NR_rt_sigaction	174
+#define __NR_rt_sigprocmask	175
+#define __NR_rt_sigpending	176
+#define __NR_rt_sigtimedwait	177
+#define __NR_rt_sigqueueinfo	178
+#define __NR_rt_sigsuspend	179
+#define __NR_pread64		180
+#define __NR_pwrite64		181
+#define __NR_chown		182
+#define __NR_getcwd		183
+#define __NR_capget		184
+#define __NR_capset		185
+#define __NR_sigaltstack	186
+#define __NR_sendfile		187
+#define __NR_getpmsg		188 /* some people actually want streams */
+#define __NR_putpmsg		189 /* some people actually want streams */
+#define __NR_vfork		190
+#define __NR_ugetrlimit		191 /* SuS compliant getrlimit */
+#define __NR_mmap2		192
+#define __NR_truncate64		193
+#define __NR_ftruncate64	194
+#define __NR_stat64		195
+#define __NR_lstat64		196
+#define __NR_fstat64		197
+#define __NR_lchown32		198
+#define __NR_getuid32		199
+#define __NR_getgid32		200
+#define __NR_geteuid32		201
+#define __NR_getegid32		202
+#define __NR_setreuid32		203
+#define __NR_setregid32		204
+#define __NR_getgroups32	205
+#define __NR_setgroups32	206
+#define __NR_fchown32		207
+#define __NR_setresuid32	208
+#define __NR_getresuid32	209
+#define __NR_setresgid32	210
+#define __NR_getresgid32	211
+#define __NR_chown32		212
+#define __NR_setuid32		213
+#define __NR_setgid32		214
+#define __NR_setfsuid32		215
+#define __NR_setfsgid32		216
+#define __NR_pivot_root		217
+#define __NR_mincore		218
+#define __NR_madvise		219
+#define __NR_madvise1		219 /* delete when C lib stub is removed */
+#define __NR_getdents64		220
+#define __NR_fcntl64		221
+/* 223 is unused */
+#define __NR_gettid		224
+#define __NR_readahead		225
+#define __NR_setxattr		226
+#define __NR_lsetxattr		227
+#define __NR_fsetxattr		228
+#define __NR_getxattr		229
+#define __NR_lgetxattr		230
+#define __NR_fgetxattr		231
+#define __NR_listxattr		232
+#define __NR_llistxattr		233
+#define __NR_flistxattr		234
+#define __NR_removexattr	235
+#define __NR_lremovexattr	236
+#define __NR_fremovexattr	237
+#define __NR_tkill		238
+#define __NR_sendfile64		239
+#define __NR_futex		240
+#define __NR_sched_setaffinity	241
+#define __NR_sched_getaffinity	242
+#define __NR_set_thread_area	243
+#define __NR_get_thread_area	244
+#define __NR_io_setup		245
+#define __NR_io_destroy		246
+#define __NR_io_getevents	247
+#define __NR_io_submit		248
+#define __NR_io_cancel		249
+#define __NR_fadvise64		250
+/* 251 is available for reuse (was briefly sys_set_zone_reclaim) */
+#define __NR_exit_group		252
+#define __NR_lookup_dcookie	253
+#define __NR_epoll_create	254
+#define __NR_epoll_ctl		255
+#define __NR_epoll_wait		256
+#define __NR_remap_file_pages	257
+#define __NR_set_tid_address	258
+#define __NR_timer_create	259
+#define __NR_timer_settime	(__NR_timer_create+1)
+#define __NR_timer_gettime	(__NR_timer_create+2)
+#define __NR_timer_getoverrun	(__NR_timer_create+3)
+#define __NR_timer_delete	(__NR_timer_create+4)
+#define __NR_clock_settime	(__NR_timer_create+5)
+#define __NR_clock_gettime	(__NR_timer_create+6)
+#define __NR_clock_getres	(__NR_timer_create+7)
+#define __NR_clock_nanosleep	(__NR_timer_create+8)
+#define __NR_statfs64		268
+#define __NR_fstatfs64		269
+#define __NR_tgkill		270
+#define __NR_utimes		271
+#define __NR_fadvise64_64	272
+#define __NR_vserver		273
+#define __NR_mbind		274
+#define __NR_get_mempolicy	275
+#define __NR_set_mempolicy	276
+#define __NR_mq_open		277
+#define __NR_mq_unlink		(__NR_mq_open+1)
+#define __NR_mq_timedsend	(__NR_mq_open+2)
+#define __NR_mq_timedreceive	(__NR_mq_open+3)
+#define __NR_mq_notify		(__NR_mq_open+4)
+#define __NR_mq_getsetattr	(__NR_mq_open+5)
+#define __NR_kexec_load		283
+#define __NR_waitid		284
+/* #define __NR_sys_setaltroot	285 */
+#define __NR_add_key		286
+#define __NR_request_key	287
+#define __NR_keyctl		288
+#define __NR_ioprio_set		289
+#define __NR_ioprio_get		290
+#define __NR_inotify_init	291
+#define __NR_inotify_add_watch	292
+#define __NR_inotify_rm_watch	293
+#define __NR_migrate_pages	294
+#define __NR_openat		295
+#define __NR_mkdirat		296
+#define __NR_mknodat		297
+#define __NR_fchownat		298
+#define __NR_futimesat		299
+#define __NR_fstatat64		300
+#define __NR_unlinkat		301
+#define __NR_renameat		302
+#define __NR_linkat		303
+#define __NR_symlinkat		304
+#define __NR_readlinkat		305
+#define __NR_fchmodat		306
+#define __NR_faccessat		307
+#define __NR_pselect6		308
+#define __NR_ppoll		309
+#define __NR_unshare		310
+#define __NR_set_robust_list	311
+#define __NR_get_robust_list	312
+#define __NR_splice		313
+#define __NR_sync_file_range	314
+#define __NR_tee		315
+#define __NR_vmsplice		316
+#define __NR_move_pages		317
+#define __NR_getcpu		318
+#define __NR_epoll_pwait	319
+#define __NR_utimensat		320
+#define __NR_signalfd		321
+#define __NR_timerfd_create	322
+#define __NR_eventfd		323
+#define __NR_fallocate		324
+#define __NR_semtimedop		325
+#define __NR_timerfd_settime	326
+#define __NR_timerfd_gettime	327
+
+#ifdef __KERNEL__
+
+#define __NR_syscalls		327
+
+#define __NR__exit __NR_exit
+#define NR_syscalls	__NR_syscalls
+
+#ifndef __ASSEMBLY__
+
+#include <linux/types.h>
+#include <linux/compiler.h>
+#include <linux/linkage.h>
+
+#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 */
-- 
1.5.4.GIT


^ permalink raw reply related	[flat|nested] 170+ messages in thread

* Re: [PATCH 07/56] microblaze_v2: Signal support
  2008-05-04 11:40             ` [PATCH 07/56] microblaze_v2: Signal support monstr
  2008-05-04 11:40               ` [PATCH 08/56] microblaze_v2: Interrupt handling, timer support, supported function monstr
@ 2008-05-04 19:52               ` Arnd Bergmann
  2008-05-05 21:32               ` Stephen Neuendorffer
  2 siblings, 0 replies; 170+ messages in thread
From: Arnd Bergmann @ 2008-05-04 19:52 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

On Sunday 04 May 2008, monstr@seznam.cz wrote:
> From: Michal Simek <monstr@monstr.eu>
> 
> 
> Signed-off-by: Michal Simek <monstr@monstr.eu>

This patch should have a comment saying that it will mostly go away
with the new syscall interface, with the one exception of
sys_rt_sigreturn().

	Arnd <><

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 17/56] microblaze_v2: checksum support
  2008-05-04 11:41                                 ` [PATCH 17/56] microblaze_v2: checksum support monstr
  2008-05-04 11:41                                   ` [PATCH 18/56] microblaze_v2: early_printk support monstr
@ 2008-05-04 19:59                                   ` Arnd Bergmann
  2008-05-05 14:05                                     ` Michal Simek
  1 sibling, 1 reply; 170+ messages in thread
From: Arnd Bergmann @ 2008-05-04 19:59 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

On Sunday 04 May 2008, monstr@seznam.cz wrote:
> + *
> + * INET                An implementation of the TCP/IP protocol suite for the LINUX
> + *             operating system.  INET is implemented using the  BSD Socket
> + *             interface as the means of communication with the user level.
> + *
> + *             IP/TCP/UDP checksumming routines
> + *
> + * Authors:    Jorge Cwik, <jorge@laser.satlink.net>
> + *             Arnt Gulbrandsen, <agulbra@nvg.unit.no>
> + *             Tom May, <ftom@netcom.com>
> + *             Andreas Schwab, <schwab@issan.informatik.uni-dortmund.de>
> + *             Lots of code moved from tcp.c and ip.c; see those files
> + *             for more names.

This is a pretty generic implementation, and you copied it from another
architecture. How about moving it from arch/microblaze/lib/ to lib/?
I'd suggest building it conditionally under CONFIG_GENERIC_CSUM,
which you def_bool in your architecture Kconfig.

	Arnd <><

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 30/56] microblaze_v2: includes SHM*, msgbuf
  2008-05-04 11:41                                                           ` [PATCH 30/56] microblaze_v2: includes SHM*, msgbuf monstr
  2008-05-04 11:41                                                             ` [PATCH 31/56] microblaze_v2: bug headers files monstr
@ 2008-05-04 21:10                                                             ` Arnd Bergmann
  1 sibling, 0 replies; 170+ messages in thread
From: Arnd Bergmann @ 2008-05-04 21:10 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

On Sunday 04 May 2008, monstr@seznam.cz wrote:

>  include/asm-microblaze/msgbuf.h   |   41 +++++++++++++++++++++++++++++
>  include/asm-microblaze/shmbuf.h   |   52 +++++++++++++++++++++++++++++++++++++
>  include/asm-microblaze/shmparam.h |   16 +++++++++++
>  3 files changed, 109 insertions(+), 0 deletions(-)
>  create mode 100644 include/asm-microblaze/msgbuf.h
>  create mode 100644 include/asm-microblaze/shmbuf.h
>  create mode 100644 include/asm-microblaze/shmparam.h

Along with cleaning up the syscall interface, you should create asm-generic
versions of these files, ipcbuf.h and sembuf.h belong in the same category
(sysv IPC).

Unfortunately, most architectures have slightly different versions of them,
few of them really getting it right.
The version you have copied to microblaze is correct for little-endian
32 bit architectures, but not for big-endian architectures. The only
big-endian architectures that correctly implement padding are parisc,
powerpc, sparc, and the only one that gets 32 bit emulation right is
parisc (which, btw is a common scheme: if you want to know how to do
it, look at the parisc code).

I suppose it doesn't really matter much now, because SysV IPC is not
used a lot any more, and people have learned to live with the ill-defined
data structures. Most architectures have made the same mistake by
blindly copying the i386 version, so I'd suggest you take the version
you have and move that to asm-generic/{msg,shm,sem,ipc}buf.h, and
asm-generic/shmparam.h, so that every architecture using a copy of the
i386 headers can move to the generic one.

	Arnd <><

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 01/56] microblaze_v2: Kconfig patches
  2008-05-04 11:40 ` [PATCH 01/56] microblaze_v2: Kconfig patches monstr
  2008-05-04 11:40   ` [PATCH 02/56] microblaze_v2: Makefiles for Microblaze cpu monstr
@ 2008-05-04 21:24   ` Grant Likely
  2008-05-05  6:36     ` Michal Simek
  2008-05-05  1:42   ` John Williams
  2 siblings, 1 reply; 170+ messages in thread
From: Grant Likely @ 2008-05-04 21:24 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	Michal Simek

On Sun, May 4, 2008 at 5:40 AM,  <monstr@seznam.cz> wrote:
> From: Michal Simek <monstr@monstr.eu>
>
>
>  Signed-off-by: Michal Simek <monstr@monstr.eu>

>  diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
>  new file mode 100644
>  index 0000000..49767d1
>  --- /dev/null
>  +++ b/arch/microblaze/Kconfig
<snip>
>  +config XILINX_UNCACHED_SHADOW
>  +       bool "Are you using uncached shadow for RAM ?"
>  +       depends on MICROBLAZE

Isn't CONFIG_MICROBLAZE a given?


>  diff --git a/arch/microblaze/platform/Kconfig.platform b/arch/microblaze/platform/Kconfig.platform
>  new file mode 100644
>  index 0000000..64cbb80
>  --- /dev/null
>  +++ b/arch/microblaze/platform/Kconfig.platform
<snip>
>  +config HACK
>  +       bool "Increase performance"
>  +       default y

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

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 32/56] microblaze_v2: definitions of types
  2008-05-04 11:41                                                               ` [PATCH 32/56] microblaze_v2: definitions of types monstr
  2008-05-04 11:41                                                                 ` [PATCH 33/56] microblaze_v2: ioctl support monstr
@ 2008-05-04 21:28                                                                 ` Arnd Bergmann
  1 sibling, 0 replies; 170+ messages in thread
From: Arnd Bergmann @ 2008-05-04 21:28 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

On Sunday 04 May 2008, monstr@seznam.cz wrote:
> include/asm-microblaze/posix_types.h

It would be good to have this as asm-generic/posix_types_32.h.
Unfortunately, __kernel_size_t and friends need to match the
compiler and are sometimes defined as 'unsigned int' and
sometimes as 'unsigned long', otherwise we could even use
the same header for 32 and 64 bit.

> +typedef unsigned short	__kernel_mode_t;
> +typedef unsigned short	__kernel_nlink_t;
> +typedef unsigned short	__kernel_ipc_pid_t;

Some architectures define these as 'unsigned int', which
seems reasonable, though there is no real requirement behind it,
afaict.

> +typedef long		__kernel_off_t;

I suppose this should become 'typedef long long __kernel_off_t;'
It won't work on pre-C99 compilers, but I don't think we need
to care about those for a new architecture.

> +typedef unsigned short	__kernel_uid_t;
> +typedef unsigned short	__kernel_gid_t;

this should certainly be unsigned int.

> +typedef unsigned short	__kernel_uid16_t;
> +typedef unsigned short	__kernel_gid16_t;
> +typedef unsigned int	__kernel_uid32_t;
> +typedef unsigned int	__kernel_gid32_t;
> +
> +typedef unsigned short	__kernel_old_uid_t;
> +typedef unsigned short	__kernel_old_gid_t;
> +typedef unsigned short	__kernel_old_dev_t;

try not defining these at all and see if something breaks.
If it does, that's probably a bug.

	Arnd <><

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 33/56] microblaze_v2: ioctl support
  2008-05-04 11:41                                                                 ` [PATCH 33/56] microblaze_v2: ioctl support monstr
  2008-05-04 11:41                                                                   ` [PATCH 34/56] microblaze_v2: io.h IO operations monstr
@ 2008-05-04 21:34                                                                   ` Arnd Bergmann
  2008-05-05 14:06                                                                     ` Michal Simek
  1 sibling, 1 reply; 170+ messages in thread
From: Arnd Bergmann @ 2008-05-04 21:34 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

On Sunday 04 May 2008, monstr@seznam.cz wrote:

>  include/asm-microblaze/ioctl.h  |   84 +++++++++++++++++++++++++++++++++++

This is a direct copy of asm-generic/ioctl.h, so just include that
one instead.

>  include/asm-microblaze/ioctls.h |   93 +++++++++++++++++++++++++++++++++++++++

I've already prototyped an asm-generic version of that, which would be the patch
below.

	Arnd <><

---

Consolidate include/asm*/ioctls.h

Most architectures have an identical implementation of ioctls.h, so we can
just as well move it to asm-generic. While it should have been defined
using _IO style macros in the first place, there is enough precendent
to give up on that now, and just document what every architecture is
doing already.

The major difference between architectures at this time is the definition
of FIOQSIZE, which sometimes conflicts with TIOCGHAYESESP, so I use an
#ifdef for that.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Index: linux-2.6/include/asm-arm/ioctls.h
===================================================================
--- linux-2.6.orig/include/asm-arm/ioctls.h
+++ linux-2.6/include/asm-arm/ioctls.h
@@ -1,84 +1,6 @@
 #ifndef __ASM_ARM_IOCTLS_H
 #define __ASM_ARM_IOCTLS_H
 
-#include <asm/ioctl.h>
-
-/* 0x54 is just a magic number to make these relatively unique ('T') */
-
-#define TCGETS		0x5401
-#define TCSETS		0x5402
-#define TCSETSW		0x5403
-#define TCSETSF		0x5404
-#define TCGETA		0x5405
-#define TCSETA		0x5406
-#define TCSETAW		0x5407
-#define TCSETAF		0x5408
-#define TCSBRK		0x5409
-#define TCXONC		0x540A
-#define TCFLSH		0x540B
-#define TIOCEXCL	0x540C
-#define TIOCNXCL	0x540D
-#define TIOCSCTTY	0x540E
-#define TIOCGPGRP	0x540F
-#define TIOCSPGRP	0x5410
-#define TIOCOUTQ	0x5411
-#define TIOCSTI		0x5412
-#define TIOCGWINSZ	0x5413
-#define TIOCSWINSZ	0x5414
-#define TIOCMGET	0x5415
-#define TIOCMBIS	0x5416
-#define TIOCMBIC	0x5417
-#define TIOCMSET	0x5418
-#define TIOCGSOFTCAR	0x5419
-#define TIOCSSOFTCAR	0x541A
-#define FIONREAD	0x541B
-#define TIOCINQ		FIONREAD
-#define TIOCLINUX	0x541C
-#define TIOCCONS	0x541D
-#define TIOCGSERIAL	0x541E
-#define TIOCSSERIAL	0x541F
-#define TIOCPKT		0x5420
-#define FIONBIO		0x5421
-#define TIOCNOTTY	0x5422
-#define TIOCSETD	0x5423
-#define TIOCGETD	0x5424
-#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
-#define TIOCSBRK	0x5427  /* BSD compatibility */
-#define TIOCCBRK	0x5428  /* BSD compatibility */
-#define TIOCGSID	0x5429  /* Return the session ID of FD */
-#define TCGETS2		_IOR('T',0x2A, struct termios2)
-#define TCSETS2		_IOW('T',0x2B, struct termios2)
-#define TCSETSW2	_IOW('T',0x2C, struct termios2)
-#define TCSETSF2	_IOW('T',0x2D, struct termios2)
-#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
-#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
-
-#define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
-#define FIOCLEX		0x5451
-#define FIOASYNC	0x5452
-#define TIOCSERCONFIG	0x5453
-#define TIOCSERGWILD	0x5454
-#define TIOCSERSWILD	0x5455
-#define TIOCGLCKTRMIOS	0x5456
-#define TIOCSLCKTRMIOS	0x5457
-#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
-#define TIOCSERGETLSR   0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
-#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
-#define FIOQSIZE	0x545E
-
-/* Used for packet mode */
-#define TIOCPKT_DATA		 0
-#define TIOCPKT_FLUSHREAD	 1
-#define TIOCPKT_FLUSHWRITE	 2
-#define TIOCPKT_STOP		 4
-#define TIOCPKT_START		 8
-#define TIOCPKT_NOSTOP		16
-#define TIOCPKT_DOSTOP		32
-
-#define TIOCSER_TEMT	0x01	/* Transmitter physically empty */
+#include <asm-generic/ioctls.h>
 
 #endif
Index: linux-2.6/include/asm-avr32/ioctls.h
===================================================================
--- linux-2.6.orig/include/asm-avr32/ioctls.h
+++ linux-2.6/include/asm-avr32/ioctls.h
@@ -1,83 +1,15 @@
 #ifndef __ASM_AVR32_IOCTLS_H
 #define __ASM_AVR32_IOCTLS_H
 
-#include <asm/ioctl.h>
-
-/* 0x54 is just a magic number to make these relatively unique ('T') */
-
-#define TCGETS		0x5401
-#define TCSETS		0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */
-#define TCSETSW		0x5403
-#define TCSETSF		0x5404
-#define TCGETA		0x5405
-#define TCSETA		0x5406
-#define TCSETAW		0x5407
-#define TCSETAF		0x5408
-#define TCSBRK		0x5409
-#define TCXONC		0x540A
-#define TCFLSH		0x540B
-#define TIOCEXCL	0x540C
-#define TIOCNXCL	0x540D
-#define TIOCSCTTY	0x540E
-#define TIOCGPGRP	0x540F
-#define TIOCSPGRP	0x5410
-#define TIOCOUTQ	0x5411
-#define TIOCSTI		0x5412
-#define TIOCGWINSZ	0x5413
-#define TIOCSWINSZ	0x5414
-#define TIOCMGET	0x5415
-#define TIOCMBIS	0x5416
-#define TIOCMBIC	0x5417
-#define TIOCMSET	0x5418
-#define TIOCGSOFTCAR	0x5419
-#define TIOCSSOFTCAR	0x541A
-#define FIONREAD	0x541B
-#define TIOCINQ		FIONREAD
-#define TIOCLINUX	0x541C
-#define TIOCCONS	0x541D
-#define TIOCGSERIAL	0x541E
-#define TIOCSSERIAL	0x541F
-#define TIOCPKT		0x5420
-#define FIONBIO		0x5421
-#define TIOCNOTTY	0x5422
-#define TIOCSETD	0x5423
-#define TIOCGETD	0x5424
-#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
-/* #define TIOCTTYGSTRUCT 0x5426 - Former debugging-only ioctl */
-#define TIOCSBRK	0x5427  /* BSD compatibility */
-#define TIOCCBRK	0x5428  /* BSD compatibility */
-#define TIOCGSID	0x5429  /* Return the session ID of FD */
-#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
-#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
-
-#define FIONCLEX	0x5450
-#define FIOCLEX		0x5451
-#define FIOASYNC	0x5452
-#define TIOCSERCONFIG	0x5453
-#define TIOCSERGWILD	0x5454
-#define TIOCSERSWILD	0x5455
-#define TIOCGLCKTRMIOS	0x5456
-#define TIOCSLCKTRMIOS	0x5457
-#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
-#define TIOCSERGETLSR   0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
-#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
 #define TIOCGHAYESESP   0x545E  /* Get Hayes ESP configuration */
 #define TIOCSHAYESESP   0x545F  /* Set Hayes ESP configuration */
 #define FIOQSIZE	0x5460
 
-/* Used for packet mode */
-#define TIOCPKT_DATA		 0
-#define TIOCPKT_FLUSHREAD	 1
-#define TIOCPKT_FLUSHWRITE	 2
-#define TIOCPKT_STOP		 4
-#define TIOCPKT_START		 8
-#define TIOCPKT_NOSTOP		16
-#define TIOCPKT_DOSTOP		32
+#include <asm-generic/ioctls.h>
 
-#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
+#undef TCGETS2
+#undef TCSETS2
+#undef TCSETSW2
+#undef TCSETSF2
 
-#endif /* __ASM_AVR32_IOCTLS_H */
+#endif
Index: linux-2.6/include/asm-blackfin/ioctls.h
===================================================================
--- linux-2.6.orig/include/asm-blackfin/ioctls.h
+++ linux-2.6/include/asm-blackfin/ioctls.h
@@ -1,87 +1,7 @@
 #ifndef __ARCH_BFIN_IOCTLS_H__
 #define __ARCH_BFIN_IOCTLS_H__
 
-#include <asm/ioctl.h>
+#include <asm-generic/ioctls.h>
 
-/* 0x54 is just a magic number to make these relatively unique ('T') */
-
-#define TCGETS		0x5401
-#define TCSETS		0x5402
-#define TCSETSW		0x5403
-#define TCSETSF		0x5404
-#define TCGETA		0x5405
-#define TCSETA		0x5406
-#define TCSETAW		0x5407
-#define TCSETAF		0x5408
-#define TCSBRK		0x5409
-#define TCXONC		0x540A
-#define TCFLSH		0x540B
-#define TIOCEXCL	0x540C
-#define TIOCNXCL	0x540D
-#define TIOCSCTTY	0x540E
-#define TIOCGPGRP	0x540F
-#define TIOCSPGRP	0x5410
-#define TIOCOUTQ	0x5411
-#define TIOCSTI		0x5412
-#define TIOCGWINSZ	0x5413
-#define TIOCSWINSZ	0x5414
-#define TIOCMGET	0x5415
-#define TIOCMBIS	0x5416
-#define TIOCMBIC	0x5417
-#define TIOCMSET	0x5418
-#define TIOCGSOFTCAR	0x5419
-#define TIOCSSOFTCAR	0x541A
-#define FIONREAD	0x541B
-#define TIOCINQ		FIONREAD
-#define TIOCLINUX	0x541C
-#define TIOCCONS	0x541D
-#define TIOCGSERIAL	0x541E
-#define TIOCSSERIAL	0x541F
-#define TIOCPKT		0x5420
-#define FIONBIO		0x5421
-#define TIOCNOTTY	0x5422
-#define TIOCSETD	0x5423
-#define TIOCGETD	0x5424
-#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
 #define TIOCTTYGSTRUCT	0x5426	/* For debugging only */
-#define TIOCSBRK	0x5427	/* BSD compatibility */
-#define TIOCCBRK	0x5428	/* BSD compatibility */
-#define TIOCGSID	0x5429	/* Return the session ID of FD */
-#define TCGETS2		_IOR('T', 0x2A, struct termios2)
-#define TCSETS2		_IOW('T', 0x2B, struct termios2)
-#define TCSETSW2	_IOW('T', 0x2C, struct termios2)
-#define TCSETSF2	_IOW('T', 0x2D, struct termios2)
-/* Get Pty Number (of pty-mux device) */
-#define TIOCGPTN	_IOR('T', 0x30, unsigned int)
-#define TIOCSPTLCK	_IOW('T', 0x31, int)	/* Lock/unlock Pty */
-
-#define FIONCLEX	0x5450	/* these numbers need to be adjusted. */
-#define FIOCLEX		0x5451
-#define FIOASYNC	0x5452
-#define TIOCSERCONFIG	0x5453
-#define TIOCSERGWILD	0x5454
-#define TIOCSERSWILD	0x5455
-#define TIOCGLCKTRMIOS	0x5456
-#define TIOCSLCKTRMIOS	0x5457
-#define TIOCSERGSTRUCT	0x5458	/* For debugging only */
-#define TIOCSERGETLSR   0x5459	/* Get line status register */
-#define TIOCSERGETMULTI 0x545A	/* Get multiport config  */
-#define TIOCSERSETMULTI 0x545B	/* Set multiport config */
-
-#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
-#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
-
-#define FIOQSIZE	0x545E
-
-/* Used for packet mode */
-#define TIOCPKT_DATA		 0
-#define TIOCPKT_FLUSHREAD	 1
-#define TIOCPKT_FLUSHWRITE	 2
-#define TIOCPKT_STOP		 4
-#define TIOCPKT_START		 8
-#define TIOCPKT_NOSTOP		16
-#define TIOCPKT_DOSTOP		32
-
-#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
-
-#endif				/* __ARCH_BFIN_IOCTLS_H__ */
+#endif
Index: linux-2.6/include/asm-cris/ioctls.h
===================================================================
--- linux-2.6.orig/include/asm-cris/ioctls.h
+++ linux-2.6/include/asm-cris/ioctls.h
@@ -1,91 +1,12 @@
 #ifndef __ARCH_CRIS_IOCTLS_H__
 #define __ARCH_CRIS_IOCTLS_H__
 
-/* verbatim copy of asm-i386/ioctls.h */
-
-#include <asm/ioctl.h>
-
-/* 0x54 is just a magic number to make these relatively unique ('T') */
-
-#define TCGETS		0x5401
-#define TCSETS		0x5402
-#define TCSETSW		0x5403
-#define TCSETSF		0x5404
-#define TCGETA		0x5405
-#define TCSETA		0x5406
-#define TCSETAW		0x5407
-#define TCSETAF		0x5408
-#define TCSBRK		0x5409
-#define TCXONC		0x540A
-#define TCFLSH		0x540B
-#define TIOCEXCL	0x540C
-#define TIOCNXCL	0x540D
-#define TIOCSCTTY	0x540E
-#define TIOCGPGRP	0x540F
-#define TIOCSPGRP	0x5410
-#define TIOCOUTQ	0x5411
-#define TIOCSTI		0x5412
-#define TIOCGWINSZ	0x5413
-#define TIOCSWINSZ	0x5414
-#define TIOCMGET	0x5415
-#define TIOCMBIS	0x5416
-#define TIOCMBIC	0x5417
-#define TIOCMSET	0x5418
-#define TIOCGSOFTCAR	0x5419
-#define TIOCSSOFTCAR	0x541A
-#define FIONREAD	0x541B
-#define TIOCINQ		FIONREAD
-#define TIOCLINUX	0x541C
-#define TIOCCONS	0x541D
-#define TIOCGSERIAL	0x541E
-#define TIOCSSERIAL	0x541F
-#define TIOCPKT		0x5420
-#define FIONBIO		0x5421
-#define TIOCNOTTY	0x5422
-#define TIOCSETD	0x5423
-#define TIOCGETD	0x5424
-#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
-#define TIOCSBRK	0x5427  /* BSD compatibility */
-#define TIOCCBRK	0x5428  /* BSD compatibility */
-#define TIOCGSID	0x5429  /* Return the session ID of FD */
-#define TCGETS2		_IOR('T',0x2A, struct termios2)
-#define TCSETS2		_IOW('T',0x2B, struct termios2)
-#define TCSETSW2	_IOW('T',0x2C, struct termios2)
-#define TCSETSF2	_IOW('T',0x2D, struct termios2)
-#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
-#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
-
-#define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
-#define FIOCLEX		0x5451
-#define FIOASYNC	0x5452
-#define TIOCSERCONFIG	0x5453
-#define TIOCSERGWILD	0x5454
-#define TIOCSERSWILD	0x5455
-#define TIOCGLCKTRMIOS	0x5456
-#define TIOCSLCKTRMIOS	0x5457
-#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
-#define TIOCSERGETLSR   0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
-#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
 #define TIOCGHAYESESP   0x545E  /* Get Hayes ESP configuration */
 #define TIOCSHAYESESP   0x545F  /* Set Hayes ESP configuration */
 #define FIOQSIZE	0x5460
-
 #define TIOCSERSETRS485 0x5461  /* enable rs-485 */
 #define TIOCSERWRRS485  0x5462  /* write rs-485 */
 
-/* Used for packet mode */
-#define TIOCPKT_DATA		 0
-#define TIOCPKT_FLUSHREAD	 1
-#define TIOCPKT_FLUSHWRITE	 2
-#define TIOCPKT_STOP		 4
-#define TIOCPKT_START		 8
-#define TIOCPKT_NOSTOP		16
-#define TIOCPKT_DOSTOP		32
-
-#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
+#include <asm-generic/ioctls.h>
 
 #endif
Index: linux-2.6/include/asm-frv/ioctls.h
===================================================================
--- linux-2.6.orig/include/asm-frv/ioctls.h
+++ linux-2.6/include/asm-frv/ioctls.h
@@ -1,82 +1,13 @@
 #ifndef __ASM_IOCTLS_H__
 #define __ASM_IOCTLS_H__
 
-#include <asm/ioctl.h>
+#include <asm-generic/ioctls.h>
 
-/* 0x54 is just a magic number to make these relatively unique ('T') */
-
-#define TCGETS		0x5401
-#define TCSETS		0x5402
-#define TCSETSW		0x5403
-#define TCSETSF		0x5404
-#define TCGETA		0x5405
-#define TCSETA		0x5406
-#define TCSETAW		0x5407
-#define TCSETAF		0x5408
-#define TCSBRK		0x5409
-#define TCXONC		0x540A
-#define TCFLSH		0x540B
-#define TIOCEXCL	0x540C
-#define TIOCNXCL	0x540D
-#define TIOCSCTTY	0x540E
-#define TIOCGPGRP	0x540F
-#define TIOCSPGRP	0x5410
-#define TIOCOUTQ	0x5411
-#define TIOCSTI		0x5412
-#define TIOCGWINSZ	0x5413
-#define TIOCSWINSZ	0x5414
-#define TIOCMGET	0x5415
-#define TIOCMBIS	0x5416
-#define TIOCMBIC	0x5417
-#define TIOCMSET	0x5418
-#define TIOCGSOFTCAR	0x5419
-#define TIOCSSOFTCAR	0x541A
-#define FIONREAD	0x541B
-#define TIOCINQ		FIONREAD
-#define TIOCLINUX	0x541C
-#define TIOCCONS	0x541D
-#define TIOCGSERIAL	0x541E
-#define TIOCSSERIAL	0x541F
-#define TIOCPKT		0x5420
-#define FIONBIO		0x5421
-#define TIOCNOTTY	0x5422
-#define TIOCSETD	0x5423
-#define TIOCGETD	0x5424
-#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
 #define TIOCTTYGSTRUCT	0x5426  /* For debugging only */
-#define TIOCSBRK	0x5427  /* BSD compatibility */
-#define TIOCCBRK	0x5428  /* BSD compatibility */
-#define TIOCGSID	0x5429  /* Return the session ID of FD */
-#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
-#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
-
-#define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
-#define FIOCLEX		0x5451
-#define FIOASYNC	0x5452
-#define TIOCSERCONFIG	0x5453
-#define TIOCSERGWILD	0x5454
-#define TIOCSERSWILD	0x5455
-#define TIOCGLCKTRMIOS	0x5456
-#define TIOCSLCKTRMIOS	0x5457
-#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
-#define TIOCSERGETLSR   0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
-#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
-#define FIOQSIZE	0x545E
-
-/* Used for packet mode */
-#define TIOCPKT_DATA		 0
-#define TIOCPKT_FLUSHREAD	 1
-#define TIOCPKT_FLUSHWRITE	 2
-#define TIOCPKT_STOP		 4
-#define TIOCPKT_START		 8
-#define TIOCPKT_NOSTOP		16
-#define TIOCPKT_DOSTOP		32
-
-#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
 
-#endif /* __ASM_IOCTLS_H__ */
+#undef TCGETS2
+#undef TCSETS2
+#undef TCSETSW2
+#undef TCSETSF2
 
+#endif
Index: linux-2.6/include/asm-generic/ioctls.h
===================================================================
--- /dev/null
+++ linux-2.6/include/asm-generic/ioctls.h
@@ -0,0 +1,87 @@
+#ifndef __ASM_ARM_IOCTLS_H
+#define __ASM_ARM_IOCTLS_H
+
+#include <linux/ioctl.h>
+
+/* 0x54 is just a magic number to make these relatively unique ('T') */
+
+#define TCGETS		0x5401
+#define TCSETS		0x5402
+#define TCSETSW		0x5403
+#define TCSETSF		0x5404
+#define TCGETA		0x5405
+#define TCSETA		0x5406
+#define TCSETAW		0x5407
+#define TCSETAF		0x5408
+#define TCSBRK		0x5409
+#define TCXONC		0x540A
+#define TCFLSH		0x540B
+#define TIOCEXCL	0x540C
+#define TIOCNXCL	0x540D
+#define TIOCSCTTY	0x540E
+#define TIOCGPGRP	0x540F
+#define TIOCSPGRP	0x5410
+#define TIOCOUTQ	0x5411
+#define TIOCSTI		0x5412
+#define TIOCGWINSZ	0x5413
+#define TIOCSWINSZ	0x5414
+#define TIOCMGET	0x5415
+#define TIOCMBIS	0x5416
+#define TIOCMBIC	0x5417
+#define TIOCMSET	0x5418
+#define TIOCGSOFTCAR	0x5419
+#define TIOCSSOFTCAR	0x541A
+#define FIONREAD	0x541B
+#define TIOCINQ		FIONREAD
+#define TIOCLINUX	0x541C
+#define TIOCCONS	0x541D
+#define TIOCGSERIAL	0x541E
+#define TIOCSSERIAL	0x541F
+#define TIOCPKT		0x5420
+#define FIONBIO		0x5421
+#define TIOCNOTTY	0x5422
+#define TIOCSETD	0x5423
+#define TIOCGETD	0x5424
+#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
+#define TIOCSBRK	0x5427  /* BSD compatibility */
+#define TIOCCBRK	0x5428  /* BSD compatibility */
+#define TIOCGSID	0x5429  /* Return the session ID of FD */
+#define TCGETS2		_IOR('T', 0x2A, struct termios2)
+#define TCSETS2		_IOW('T', 0x2B, struct termios2)
+#define TCSETSW2	_IOW('T', 0x2C, struct termios2)
+#define TCSETSF2	_IOW('T', 0x2D, struct termios2)
+#define TIOCGPTN	_IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
+#define TIOCSPTLCK	_IOW('T', 0x31, int)  /* Lock/unlock Pty */
+
+#define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
+#define FIOCLEX		0x5451
+#define FIOASYNC	0x5452
+#define TIOCSERCONFIG	0x5453
+#define TIOCSERGWILD	0x5454
+#define TIOCSERSWILD	0x5455
+#define TIOCGLCKTRMIOS	0x5456
+#define TIOCSLCKTRMIOS	0x5457
+#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
+#define TIOCSERGETLSR   0x5459 /* Get line status register */
+#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
+#define TIOCSERSETMULTI 0x545B /* Set multiport config */
+
+#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
+#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
+
+#ifndef FIOQSIZE /* some architectures define their own */
+#define FIOQSIZE	0x545E
+#endif
+
+/* Used for packet mode */
+#define TIOCPKT_DATA		 0
+#define TIOCPKT_FLUSHREAD	 1
+#define TIOCPKT_FLUSHWRITE	 2
+#define TIOCPKT_STOP		 4
+#define TIOCPKT_START		 8
+#define TIOCPKT_NOSTOP		16
+#define TIOCPKT_DOSTOP		32
+
+#define TIOCSER_TEMT	0x01	/* Transmitter physically empty */
+
+#endif
Index: linux-2.6/include/asm-h8300/ioctls.h
===================================================================
--- linux-2.6.orig/include/asm-h8300/ioctls.h
+++ linux-2.6/include/asm-h8300/ioctls.h
@@ -1,85 +1,8 @@
 #ifndef __ARCH_H8300_IOCTLS_H__
 #define __ARCH_H8300_IOCTLS_H__
 
-#include <asm/ioctl.h>
+#include <asm-generic/ioctls.h>
 
-/* 0x54 is just a magic number to make these relatively unique ('T') */
-
-#define TCGETS		0x5401
-#define TCSETS		0x5402
-#define TCSETSW		0x5403
-#define TCSETSF		0x5404
-#define TCGETA		0x5405
-#define TCSETA		0x5406
-#define TCSETAW		0x5407
-#define TCSETAF		0x5408
-#define TCSBRK		0x5409
-#define TCXONC		0x540A
-#define TCFLSH		0x540B
-#define TIOCEXCL	0x540C
-#define TIOCNXCL	0x540D
-#define TIOCSCTTY	0x540E
-#define TIOCGPGRP	0x540F
-#define TIOCSPGRP	0x5410
-#define TIOCOUTQ	0x5411
-#define TIOCSTI		0x5412
-#define TIOCGWINSZ	0x5413
-#define TIOCSWINSZ	0x5414
-#define TIOCMGET	0x5415
-#define TIOCMBIS	0x5416
-#define TIOCMBIC	0x5417
-#define TIOCMSET	0x5418
-#define TIOCGSOFTCAR	0x5419
-#define TIOCSSOFTCAR	0x541A
-#define FIONREAD	0x541B
-#define TIOCINQ		FIONREAD
-#define TIOCLINUX	0x541C
-#define TIOCCONS	0x541D
-#define TIOCGSERIAL	0x541E
-#define TIOCSSERIAL	0x541F
-#define TIOCPKT		0x5420
-#define FIONBIO		0x5421
-#define TIOCNOTTY	0x5422
-#define TIOCSETD	0x5423
-#define TIOCGETD	0x5424
-#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
 #define TIOCTTYGSTRUCT	0x5426  /* For debugging only */
-#define TIOCSBRK	0x5427  /* BSD compatibility */
-#define TIOCCBRK	0x5428  /* BSD compatibility */
-#define TIOCGSID	0x5429  /* Return the session ID of FD */
-#define TCGETS2		_IOR('T',0x2A, struct termios2)
-#define TCSETS2		_IOW('T',0x2B, struct termios2)
-#define TCSETSW2	_IOW('T',0x2C, struct termios2)
-#define TCSETSF2	_IOW('T',0x2D, struct termios2)
-#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
-#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
-
-#define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
-#define FIOCLEX		0x5451
-#define FIOASYNC	0x5452
-#define TIOCSERCONFIG	0x5453
-#define TIOCSERGWILD	0x5454
-#define TIOCSERSWILD	0x5455
-#define TIOCGLCKTRMIOS	0x5456
-#define TIOCSLCKTRMIOS	0x5457
-#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
-#define TIOCSERGETLSR   0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
-#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
-#define FIOQSIZE	0x545E
-
-/* Used for packet mode */
-#define TIOCPKT_DATA		 0
-#define TIOCPKT_FLUSHREAD	 1
-#define TIOCPKT_FLUSHWRITE	 2
-#define TIOCPKT_STOP		 4
-#define TIOCPKT_START		 8
-#define TIOCPKT_NOSTOP		16
-#define TIOCPKT_DOSTOP		32
-
-#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
 
-#endif /* __ARCH_H8300_IOCTLS_H__ */
+#endif
Index: linux-2.6/include/asm-ia64/ioctls.h
===================================================================
--- linux-2.6.orig/include/asm-ia64/ioctls.h
+++ linux-2.6/include/asm-ia64/ioctls.h
@@ -1,93 +1,10 @@
 #ifndef _ASM_IA64_IOCTLS_H
 #define _ASM_IA64_IOCTLS_H
 
-/*
- * Based on <asm-i386/ioctls.h>
- *
- * Modified 1998, 1999, 2002
- *	David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
- */
-
-#include <asm/ioctl.h>
-
-/* 0x54 is just a magic number to make these relatively unique ('T') */
-
-#define TCGETS		0x5401
-#define TCSETS		0x5402	/* Clashes with SNDCTL_TMR_START sound ioctl */
-#define TCSETSW		0x5403
-#define TCSETSF		0x5404
-#define TCGETA		0x5405
-#define TCSETA		0x5406
-#define TCSETAW		0x5407
-#define TCSETAF		0x5408
-#define TCSBRK		0x5409
-#define TCXONC		0x540A
-#define TCFLSH		0x540B
-#define TIOCEXCL	0x540C
-#define TIOCNXCL	0x540D
-#define TIOCSCTTY	0x540E
-#define TIOCGPGRP	0x540F
-#define TIOCSPGRP	0x5410
-#define TIOCOUTQ	0x5411
-#define TIOCSTI		0x5412
-#define TIOCGWINSZ	0x5413
-#define TIOCSWINSZ	0x5414
-#define TIOCMGET	0x5415
-#define TIOCMBIS	0x5416
-#define TIOCMBIC	0x5417
-#define TIOCMSET	0x5418
-#define TIOCGSOFTCAR	0x5419
-#define TIOCSSOFTCAR	0x541A
-#define FIONREAD	0x541B
-#define TIOCINQ		FIONREAD
-#define TIOCLINUX	0x541C
-#define TIOCCONS	0x541D
-#define TIOCGSERIAL	0x541E
-#define TIOCSSERIAL	0x541F
-#define TIOCPKT		0x5420
-#define FIONBIO		0x5421
-#define TIOCNOTTY	0x5422
-#define TIOCSETD	0x5423
-#define TIOCGETD	0x5424
-#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
-#define TIOCSBRK	0x5427  /* BSD compatibility */
-#define TIOCCBRK	0x5428  /* BSD compatibility */
-#define TIOCGSID	0x5429  /* Return the session ID of FD */
-#define TCGETS2		_IOR('T',0x2A, struct termios2)
-#define TCSETS2		_IOW('T',0x2B, struct termios2)
-#define TCSETSW2	_IOW('T',0x2C, struct termios2)
-#define TCSETSF2	_IOW('T',0x2D, struct termios2)
-#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
-#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
-
-#define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
-#define FIOCLEX		0x5451
-#define FIOASYNC	0x5452
-#define TIOCSERCONFIG	0x5453
-#define TIOCSERGWILD	0x5454
-#define TIOCSERSWILD	0x5455
-#define TIOCGLCKTRMIOS	0x5456
-#define TIOCSLCKTRMIOS	0x5457
-#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
-#define TIOCSERGETLSR   0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
-#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
 #define TIOCGHAYESESP   0x545E  /* Get Hayes ESP configuration */
 #define TIOCSHAYESESP   0x545F  /* Set Hayes ESP configuration */
 #define FIOQSIZE	0x5460
 
-/* Used for packet mode */
-#define TIOCPKT_DATA		 0
-#define TIOCPKT_FLUSHREAD	 1
-#define TIOCPKT_FLUSHWRITE	 2
-#define TIOCPKT_STOP		 4
-#define TIOCPKT_START		 8
-#define TIOCPKT_NOSTOP		16
-#define TIOCPKT_DOSTOP		32
-
-#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
+#include <asm-generic/ioctls.h>
 
-#endif /* _ASM_IA64_IOCTLS_H */
+#endif
Index: linux-2.6/include/asm-m32r/ioctls.h
===================================================================
--- linux-2.6.orig/include/asm-m32r/ioctls.h
+++ linux-2.6/include/asm-m32r/ioctls.h
@@ -1,87 +1,11 @@
 #ifndef __ARCH_M32R_IOCTLS_H__
 #define __ARCH_M32R_IOCTLS_H__
 
-#include <asm/ioctl.h>
-
-/* 0x54 is just a magic number to make these relatively unique ('T') */
-
-#define TCGETS		0x5401
-#define TCSETS		0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */
-#define TCSETSW		0x5403
-#define TCSETSF		0x5404
-#define TCGETA		0x5405
-#define TCSETA		0x5406
-#define TCSETAW		0x5407
-#define TCSETAF		0x5408
-#define TCSBRK		0x5409
-#define TCXONC		0x540A
-#define TCFLSH		0x540B
-#define TIOCEXCL	0x540C
-#define TIOCNXCL	0x540D
-#define TIOCSCTTY	0x540E
-#define TIOCGPGRP	0x540F
-#define TIOCSPGRP	0x5410
-#define TIOCOUTQ	0x5411
-#define TIOCSTI		0x5412
-#define TIOCGWINSZ	0x5413
-#define TIOCSWINSZ	0x5414
-#define TIOCMGET	0x5415
-#define TIOCMBIS	0x5416
-#define TIOCMBIC	0x5417
-#define TIOCMSET	0x5418
-#define TIOCGSOFTCAR	0x5419
-#define TIOCSSOFTCAR	0x541A
-#define FIONREAD	0x541B
-#define TIOCINQ		FIONREAD
-#define TIOCLINUX	0x541C
-#define TIOCCONS	0x541D
-#define TIOCGSERIAL	0x541E
-#define TIOCSSERIAL	0x541F
-#define TIOCPKT		0x5420
-#define FIONBIO		0x5421
-#define TIOCNOTTY	0x5422
-#define TIOCSETD	0x5423
-#define TIOCGETD	0x5424
-#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
 /* #define TIOCTTYGSTRUCT 0x5426 - Former debugging-only ioctl */
-#define TIOCSBRK	0x5427  /* BSD compatibility */
-#define TIOCCBRK	0x5428  /* BSD compatibility */
-#define TIOCGSID	0x5429  /* Return the session ID of FD */
-#define TCGETS2		_IOR('T',0x2A, struct termios2)
-#define TCSETS2		_IOW('T',0x2B, struct termios2)
-#define TCSETSW2	_IOW('T',0x2C, struct termios2)
-#define TCSETSF2	_IOW('T',0x2D, struct termios2)
-#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
-#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
-
-#define FIONCLEX	0x5450
-#define FIOCLEX		0x5451
-#define FIOASYNC	0x5452
-#define TIOCSERCONFIG	0x5453
-#define TIOCSERGWILD	0x5454
-#define TIOCSERSWILD	0x5455
-#define TIOCGLCKTRMIOS	0x5456
-#define TIOCSLCKTRMIOS	0x5457
-#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
-#define TIOCSERGETLSR   0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
-#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
 #define TIOCGHAYESESP   0x545E  /* Get Hayes ESP configuration */
 #define TIOCSHAYESESP   0x545F  /* Set Hayes ESP configuration */
 #define FIOQSIZE	0x5460
 
-/* Used for packet mode */
-#define TIOCPKT_DATA		 0
-#define TIOCPKT_FLUSHREAD	 1
-#define TIOCPKT_FLUSHWRITE	 2
-#define TIOCPKT_STOP		 4
-#define TIOCPKT_START		 8
-#define TIOCPKT_NOSTOP		16
-#define TIOCPKT_DOSTOP		32
-
-#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
+#include <asm-generic/ioctls.h>
 
-#endif /* __ARCH_M32R_IOCTLS_H__ */
+#endif
Index: linux-2.6/include/asm-m68k/ioctls.h
===================================================================
--- linux-2.6.orig/include/asm-m68k/ioctls.h
+++ linux-2.6/include/asm-m68k/ioctls.h
@@ -1,84 +1,6 @@
 #ifndef __ARCH_M68K_IOCTLS_H__
 #define __ARCH_M68K_IOCTLS_H__
 
-#include <asm/ioctl.h>
+#include <asm-generic/ioctls.h>
 
-/* 0x54 is just a magic number to make these relatively unique ('T') */
-
-#define TCGETS		0x5401
-#define TCSETS		0x5402
-#define TCSETSW		0x5403
-#define TCSETSF		0x5404
-#define TCGETA		0x5405
-#define TCSETA		0x5406
-#define TCSETAW		0x5407
-#define TCSETAF		0x5408
-#define TCSBRK		0x5409
-#define TCXONC		0x540A
-#define TCFLSH		0x540B
-#define TIOCEXCL	0x540C
-#define TIOCNXCL	0x540D
-#define TIOCSCTTY	0x540E
-#define TIOCGPGRP	0x540F
-#define TIOCSPGRP	0x5410
-#define TIOCOUTQ	0x5411
-#define TIOCSTI		0x5412
-#define TIOCGWINSZ	0x5413
-#define TIOCSWINSZ	0x5414
-#define TIOCMGET	0x5415
-#define TIOCMBIS	0x5416
-#define TIOCMBIC	0x5417
-#define TIOCMSET	0x5418
-#define TIOCGSOFTCAR	0x5419
-#define TIOCSSOFTCAR	0x541A
-#define FIONREAD	0x541B
-#define TIOCINQ		FIONREAD
-#define TIOCLINUX	0x541C
-#define TIOCCONS	0x541D
-#define TIOCGSERIAL	0x541E
-#define TIOCSSERIAL	0x541F
-#define TIOCPKT		0x5420
-#define FIONBIO		0x5421
-#define TIOCNOTTY	0x5422
-#define TIOCSETD	0x5423
-#define TIOCGETD	0x5424
-#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
-#define TIOCSBRK	0x5427  /* BSD compatibility */
-#define TIOCCBRK	0x5428  /* BSD compatibility */
-#define TIOCGSID	0x5429  /* Return the session ID of FD */
-#define TCGETS2		_IOR('T',0x2A, struct termios2)
-#define TCSETS2		_IOW('T',0x2B, struct termios2)
-#define TCSETSW2	_IOW('T',0x2C, struct termios2)
-#define TCSETSF2	_IOW('T',0x2D, struct termios2)
-#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
-#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
-
-#define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
-#define FIOCLEX		0x5451
-#define FIOASYNC	0x5452
-#define TIOCSERCONFIG	0x5453
-#define TIOCSERGWILD	0x5454
-#define TIOCSERSWILD	0x5455
-#define TIOCGLCKTRMIOS	0x5456
-#define TIOCSLCKTRMIOS	0x5457
-#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
-#define TIOCSERGETLSR   0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
-#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
-#define FIOQSIZE	0x545E
-
-/* Used for packet mode */
-#define TIOCPKT_DATA		 0
-#define TIOCPKT_FLUSHREAD	 1
-#define TIOCPKT_FLUSHWRITE	 2
-#define TIOCPKT_STOP		 4
-#define TIOCPKT_START		 8
-#define TIOCPKT_NOSTOP		16
-#define TIOCPKT_DOSTOP		32
-
-#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
-
-#endif /* __ARCH_M68K_IOCTLS_H__ */
+#endif
Index: linux-2.6/include/asm-microblaze/ioctls.h
===================================================================
--- linux-2.6.orig/include/asm-microblaze/ioctls.h
+++ linux-2.6/include/asm-microblaze/ioctls.h
@@ -11,83 +11,6 @@
 #ifndef _ASM_MICROBLAZE_IOCTLS_H
 #define _ASM_MICROBLAZE_IOCTLS_H
 
-#include <asm/ioctl.h>
+#include <asm-generic/ioctls.h>
 
-/* 0x54 is just a magic number to make these relatively unique ('T') */
-
-#define TCGETS		0x5401
-#define TCSETS		0x5402
-#define TCSETSW		0x5403
-#define TCSETSF		0x5404
-#define TCGETA		0x5405
-#define TCSETA		0x5406
-#define TCSETAW		0x5407
-#define TCSETAF		0x5408
-#define TCSBRK		0x5409
-#define TCXONC		0x540A
-#define TCFLSH		0x540B
-#define TIOCEXCL	0x540C
-#define TIOCNXCL	0x540D
-#define TIOCSCTTY	0x540E
-#define TIOCGPGRP	0x540F
-#define TIOCSPGRP	0x5410
-#define TIOCOUTQ	0x5411
-#define TIOCSTI		0x5412
-#define TIOCGWINSZ	0x5413
-#define TIOCSWINSZ	0x5414
-#define TIOCMGET	0x5415
-#define TIOCMBIS	0x5416
-#define TIOCMBIC	0x5417
-#define TIOCMSET	0x5418
-#define TIOCGSOFTCAR	0x5419
-#define TIOCSSOFTCAR	0x541A
-#define FIONREAD	0x541B
-#define TIOCINQ		FIONREAD
-#define TIOCLINUX	0x541C
-#define TIOCCONS	0x541D
-#define TIOCGSERIAL	0x541E
-#define TIOCSSERIAL	0x541F
-#define TIOCPKT		0x5420
-#define FIONBIO		0x5421
-#define TIOCNOTTY	0x5422
-#define TIOCSETD	0x5423
-#define TIOCGETD	0x5424
-#define TCSBRKP		0x5425 /* Needed for POSIX tcsendbreak() */
-#define TIOCTTYGSTRUCT	0x5426 /* For debugging only */
-#define TIOCSBRK	0x5427 /* BSD compatibility */
-#define TIOCCBRK	0x5428 /* BSD compatibility */
-#define TIOCGSID	0x5429 /* Return the session ID of FD */
-/* Get Pty Number (of pty-mux device) */
-#define TIOCGPTN	_IOR('T', 0x30, unsigned int)
-#define TIOCSPTLCK	_IOW('T', 0x31, int) /* Lock/unlock Pty */
-
-#define FIONCLEX	0x5450 /* these numbers need to be adjusted. */
-#define FIOCLEX		0x5451
-#define FIOASYNC	0x5452
-#define TIOCSERCONFIG	0x5453
-#define TIOCSERGWILD	0x5454
-#define TIOCSERSWILD	0x5455
-#define TIOCGLCKTRMIOS	0x5456
-#define TIOCSLCKTRMIOS	0x5457
-#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
-#define TIOCSERGETLSR	0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT	0x545C /* wait for a change on serial input line(s) */
-#define TIOCGICOUNT	0x545D /* read serial port inline interrupt counts */
-
-#define	FIOQSIZE	0x545E
-
-/* Used for packet mode */
-#define TIOCPKT_DATA		0
-#define TIOCPKT_FLUSHREAD	1
-#define TIOCPKT_FLUSHWRITE	2
-#define TIOCPKT_STOP		4
-#define TIOCPKT_START		8
-#define TIOCPKT_NOSTOP		16
-#define TIOCPKT_DOSTOP		32
-
-#define TIOCSER_TEMT	0x01 /* Transmitter physically empty */
-
-#endif /* _ASM_MICROBLAZE_IOCTLS_H */
+#endif
Index: linux-2.6/include/asm-mn10300/ioctls.h
===================================================================
--- linux-2.6.orig/include/asm-mn10300/ioctls.h
+++ linux-2.6/include/asm-mn10300/ioctls.h
@@ -1,88 +1,12 @@
 #ifndef _ASM_IOCTLS_H
 #define _ASM_IOCTLS_H
 
-#include <asm/ioctl.h>
-
-/* 0x54 is just a magic number to make these relatively unique ('T') */
-
-#define TCGETS		0x5401
-#define TCSETS		0x5402
-#define TCSETSW		0x5403
-#define TCSETSF		0x5404
-#define TCGETA		0x5405
-#define TCSETA		0x5406
-#define TCSETAW		0x5407
-#define TCSETAF		0x5408
-#define TCSBRK		0x5409
-#define TCXONC		0x540A
-#define TCFLSH		0x540B
-#define TIOCEXCL	0x540C
-#define TIOCNXCL	0x540D
-#define TIOCSCTTY	0x540E
-#define TIOCGPGRP	0x540F
-#define TIOCSPGRP	0x5410
-#define TIOCOUTQ	0x5411
-#define TIOCSTI		0x5412
-#define TIOCGWINSZ	0x5413
-#define TIOCSWINSZ	0x5414
-#define TIOCMGET	0x5415
-#define TIOCMBIS	0x5416
-#define TIOCMBIC	0x5417
-#define TIOCMSET	0x5418
-#define TIOCGSOFTCAR	0x5419
-#define TIOCSSOFTCAR	0x541A
-#define FIONREAD	0x541B
-#define TIOCINQ		FIONREAD
-#define TIOCLINUX	0x541C
-#define TIOCCONS	0x541D
-#define TIOCGSERIAL	0x541E
-#define TIOCSSERIAL	0x541F
-#define TIOCPKT		0x5420
-#define FIONBIO		0x5421
-#define TIOCNOTTY	0x5422
-#define TIOCSETD	0x5423
-#define TIOCGETD	0x5424
-#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
 /* #define TIOCTTYGSTRUCT 0x5426 - Former debugging-only ioctl */
-#define TIOCSBRK	0x5427  /* BSD compatibility */
-#define TIOCCBRK	0x5428  /* BSD compatibility */
-#define TIOCGSID	0x5429  /* Return the session ID of FD */
-#define TCGETS2		_IOR('T', 0x2A, struct termios2)
-#define TCSETS2		_IOW('T', 0x2B, struct termios2)
-#define TCSETSW2	_IOW('T', 0x2C, struct termios2)
-#define TCSETSF2	_IOW('T', 0x2D, struct termios2)
-#define TIOCGPTN	_IOR('T', 0x30, unsigned int) /* Get Pty Number
-						       * (of pty-mux device) */
-#define TIOCSPTLCK	_IOW('T', 0x31, int)  /* Lock/unlock Pty */
-
-#define FIONCLEX	0x5450
-#define FIOCLEX		0x5451
-#define FIOASYNC	0x5452
-#define TIOCSERCONFIG	0x5453
-#define TIOCSERGWILD	0x5454
-#define TIOCSERSWILD	0x5455
-#define TIOCGLCKTRMIOS	0x5456
-#define TIOCSLCKTRMIOS	0x5457
-#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
-#define TIOCSERGETLSR   0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
-#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
 #define TIOCGHAYESESP   0x545E  /* Get Hayes ESP configuration */
 #define TIOCSHAYESESP   0x545F  /* Set Hayes ESP configuration */
 #define FIOQSIZE	0x5460
 
-/* Used for packet mode */
-#define TIOCPKT_DATA		 0
-#define TIOCPKT_FLUSHREAD	 1
-#define TIOCPKT_FLUSHWRITE	 2
-#define TIOCPKT_STOP		 4
-#define TIOCPKT_START		 8
-#define TIOCPKT_NOSTOP		16
-#define TIOCPKT_DOSTOP		32
+#include <asm-generic/ioctls.h>
 
-#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
 
-#endif /* _ASM_IOCTLS_H */
+#endif
Index: linux-2.6/include/asm-parisc/ioctls.h
===================================================================
--- linux-2.6.orig/include/asm-parisc/ioctls.h
+++ linux-2.6/include/asm-parisc/ioctls.h
@@ -81,6 +81,6 @@
 #define TIOCPKT_NOSTOP		16
 #define TIOCPKT_DOSTOP		32
 
-#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
+#define TIOCSER_TEMT	0x01	/* Transmitter physically empty */
 
-#endif /* _ASM_PARISC_IOCTLS_H */
+#endif
Index: linux-2.6/include/asm-s390/ioctls.h
===================================================================
--- linux-2.6.orig/include/asm-s390/ioctls.h
+++ linux-2.6/include/asm-s390/ioctls.h
@@ -1,92 +1,6 @@
-/*
- *  include/asm-s390/ioctls.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/ioctls.h"
- */
-
 #ifndef __ARCH_S390_IOCTLS_H__
 #define __ARCH_S390_IOCTLS_H__
 
-#include <asm/ioctl.h>
-
-/* 0x54 is just a magic number to make these relatively unique ('T') */
-
-#define TCGETS		0x5401
-#define TCSETS		0x5402
-#define TCSETSW		0x5403
-#define TCSETSF		0x5404
-#define TCGETA		0x5405
-#define TCSETA		0x5406
-#define TCSETAW		0x5407
-#define TCSETAF		0x5408
-#define TCSBRK		0x5409
-#define TCXONC		0x540A
-#define TCFLSH		0x540B
-#define TIOCEXCL	0x540C
-#define TIOCNXCL	0x540D
-#define TIOCSCTTY	0x540E
-#define TIOCGPGRP	0x540F
-#define TIOCSPGRP	0x5410
-#define TIOCOUTQ	0x5411
-#define TIOCSTI		0x5412
-#define TIOCGWINSZ	0x5413
-#define TIOCSWINSZ	0x5414
-#define TIOCMGET	0x5415
-#define TIOCMBIS	0x5416
-#define TIOCMBIC	0x5417
-#define TIOCMSET	0x5418
-#define TIOCGSOFTCAR	0x5419
-#define TIOCSSOFTCAR	0x541A
-#define FIONREAD	0x541B
-#define TIOCINQ		FIONREAD
-#define TIOCLINUX	0x541C
-#define TIOCCONS	0x541D
-#define TIOCGSERIAL	0x541E
-#define TIOCSSERIAL	0x541F
-#define TIOCPKT		0x5420
-#define FIONBIO		0x5421
-#define TIOCNOTTY	0x5422
-#define TIOCSETD	0x5423
-#define TIOCGETD	0x5424
-#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
-#define TIOCSBRK	0x5427  /* BSD compatibility */
-#define TIOCCBRK	0x5428  /* BSD compatibility */
-#define TIOCGSID	0x5429  /* Return the session ID of FD */
-#define TCGETS2		_IOR('T',0x2A, struct termios2)
-#define TCSETS2		_IOW('T',0x2B, struct termios2)
-#define TCSETSW2	_IOW('T',0x2C, struct termios2)
-#define TCSETSF2	_IOW('T',0x2D, struct termios2)
-#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
-#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
-
-#define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
-#define FIOCLEX		0x5451
-#define FIOASYNC	0x5452
-#define TIOCSERCONFIG	0x5453
-#define TIOCSERGWILD	0x5454
-#define TIOCSERSWILD	0x5455
-#define TIOCGLCKTRMIOS	0x5456
-#define TIOCSLCKTRMIOS	0x5457
-#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
-#define TIOCSERGETLSR   0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
-#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
-#define FIOQSIZE	0x545E
-
-/* Used for packet mode */
-#define TIOCPKT_DATA		 0
-#define TIOCPKT_FLUSHREAD	 1
-#define TIOCPKT_FLUSHWRITE	 2
-#define TIOCPKT_STOP		 4
-#define TIOCPKT_START		 8
-#define TIOCPKT_NOSTOP		16
-#define TIOCPKT_DOSTOP		32
-
-#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
+#include <asm-generic/ioctls.h>
 
 #endif
Index: linux-2.6/include/asm-v850/ioctls.h
===================================================================
--- linux-2.6.orig/include/asm-v850/ioctls.h
+++ linux-2.6/include/asm-v850/ioctls.h
@@ -1,84 +1,6 @@
 #ifndef __V850_IOCTLS_H__
 #define __V850_IOCTLS_H__
 
-#include <asm/ioctl.h>
+#include <asm-generic/ioctls.h>
 
-/* 0x54 is just a magic number to make these relatively unique ('T') */
-
-#define TCGETS		0x5401
-#define TCSETS		0x5402
-#define TCSETSW		0x5403
-#define TCSETSF		0x5404
-#define TCGETA		0x5405
-#define TCSETA		0x5406
-#define TCSETAW		0x5407
-#define TCSETAF		0x5408
-#define TCSBRK		0x5409
-#define TCXONC		0x540A
-#define TCFLSH		0x540B
-#define TIOCEXCL	0x540C
-#define TIOCNXCL	0x540D
-#define TIOCSCTTY	0x540E
-#define TIOCGPGRP	0x540F
-#define TIOCSPGRP	0x5410
-#define TIOCOUTQ	0x5411
-#define TIOCSTI		0x5412
-#define TIOCGWINSZ	0x5413
-#define TIOCSWINSZ	0x5414
-#define TIOCMGET	0x5415
-#define TIOCMBIS	0x5416
-#define TIOCMBIC	0x5417
-#define TIOCMSET	0x5418
-#define TIOCGSOFTCAR	0x5419
-#define TIOCSSOFTCAR	0x541A
-#define FIONREAD	0x541B
-#define TIOCINQ		FIONREAD
-#define TIOCLINUX	0x541C
-#define TIOCCONS	0x541D
-#define TIOCGSERIAL	0x541E
-#define TIOCSSERIAL	0x541F
-#define TIOCPKT		0x5420
-#define FIONBIO		0x5421
-#define TIOCNOTTY	0x5422
-#define TIOCSETD	0x5423
-#define TIOCGETD	0x5424
-#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
-#define TIOCSBRK	0x5427  /* BSD compatibility */
-#define TIOCCBRK	0x5428  /* BSD compatibility */
-#define TIOCGSID	0x5429  /* Return the session ID of FD */
-#define TCGETS2		_IOR('T',0x2A, struct termios2)
-#define TCSETS2		_IOW('T',0x2B, struct termios2)
-#define TCSETSW2	_IOW('T',0x2C, struct termios2)
-#define TCSETSF2	_IOW('T',0x2D, struct termios2)
-#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
-#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
-
-#define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
-#define FIOCLEX		0x5451
-#define FIOASYNC	0x5452
-#define TIOCSERCONFIG	0x5453
-#define TIOCSERGWILD	0x5454
-#define TIOCSERSWILD	0x5455
-#define TIOCGLCKTRMIOS	0x5456
-#define TIOCSLCKTRMIOS	0x5457
-#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
-#define TIOCSERGETLSR   0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
-#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
-#define FIOQSIZE	0x545E
-
-/* Used for packet mode */
-#define TIOCPKT_DATA		 0
-#define TIOCPKT_FLUSHREAD	 1
-#define TIOCPKT_FLUSHWRITE	 2
-#define TIOCPKT_STOP		 4
-#define TIOCPKT_START		 8
-#define TIOCPKT_NOSTOP		16
-#define TIOCPKT_DOSTOP		32
-
-#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
-
-#endif /* __V850_IOCTLS_H__ */
+#endif
Index: linux-2.6/include/asm-x86/ioctls.h
===================================================================
--- linux-2.6.orig/include/asm-x86/ioctls.h
+++ linux-2.6/include/asm-x86/ioctls.h
@@ -1,88 +1,10 @@
 #ifndef _ASM_X86_IOCTLS_H
 #define _ASM_X86_IOCTLS_H
 
-#include <asm/ioctl.h>
-
-/* 0x54 is just a magic number to make these relatively unique ('T') */
-
-#define TCGETS		0x5401
-#define TCSETS		0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */
-#define TCSETSW		0x5403
-#define TCSETSF		0x5404
-#define TCGETA		0x5405
-#define TCSETA		0x5406
-#define TCSETAW		0x5407
-#define TCSETAF		0x5408
-#define TCSBRK		0x5409
-#define TCXONC		0x540A
-#define TCFLSH		0x540B
-#define TIOCEXCL	0x540C
-#define TIOCNXCL	0x540D
-#define TIOCSCTTY	0x540E
-#define TIOCGPGRP	0x540F
-#define TIOCSPGRP	0x5410
-#define TIOCOUTQ	0x5411
-#define TIOCSTI		0x5412
-#define TIOCGWINSZ	0x5413
-#define TIOCSWINSZ	0x5414
-#define TIOCMGET	0x5415
-#define TIOCMBIS	0x5416
-#define TIOCMBIC	0x5417
-#define TIOCMSET	0x5418
-#define TIOCGSOFTCAR	0x5419
-#define TIOCSSOFTCAR	0x541A
-#define FIONREAD	0x541B
-#define TIOCINQ		FIONREAD
-#define TIOCLINUX	0x541C
-#define TIOCCONS	0x541D
-#define TIOCGSERIAL	0x541E
-#define TIOCSSERIAL	0x541F
-#define TIOCPKT		0x5420
-#define FIONBIO		0x5421
-#define TIOCNOTTY	0x5422
-#define TIOCSETD	0x5423
-#define TIOCGETD	0x5424
-#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
-/* #define TIOCTTYGSTRUCT 0x5426 - Former debugging-only ioctl */
-#define TIOCSBRK	0x5427  /* BSD compatibility */
-#define TIOCCBRK	0x5428  /* BSD compatibility */
-#define TIOCGSID	0x5429  /* Return the session ID of FD */
-#define TCGETS2		_IOR('T', 0x2A, struct termios2)
-#define TCSETS2		_IOW('T', 0x2B, struct termios2)
-#define TCSETSW2	_IOW('T', 0x2C, struct termios2)
-#define TCSETSF2	_IOW('T', 0x2D, struct termios2)
-#define TIOCGPTN	_IOR('T', 0x30, unsigned int)
-				/* Get Pty Number (of pty-mux device) */
-#define TIOCSPTLCK	_IOW('T', 0x31, int)  /* Lock/unlock Pty */
-
-#define FIONCLEX	0x5450
-#define FIOCLEX		0x5451
-#define FIOASYNC	0x5452
-#define TIOCSERCONFIG	0x5453
-#define TIOCSERGWILD	0x5454
-#define TIOCSERSWILD	0x5455
-#define TIOCGLCKTRMIOS	0x5456
-#define TIOCSLCKTRMIOS	0x5457
-#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
-#define TIOCSERGETLSR   0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
-#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
 #define TIOCGHAYESESP   0x545E  /* Get Hayes ESP configuration */
 #define TIOCSHAYESESP   0x545F  /* Set Hayes ESP configuration */
 #define FIOQSIZE	0x5460
 
-/* Used for packet mode */
-#define TIOCPKT_DATA		 0
-#define TIOCPKT_FLUSHREAD	 1
-#define TIOCPKT_FLUSHWRITE	 2
-#define TIOCPKT_STOP		 4
-#define TIOCPKT_START		 8
-#define TIOCPKT_NOSTOP		16
-#define TIOCPKT_DOSTOP		32
-
-#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
+#include <asm-generic/ioctls.h>
 
 #endif

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 38/56] microblaze_v2: atomic.h bitops.h byteorder.h
  2008-05-04 11:41                                                                           ` [PATCH 38/56] microblaze_v2: atomic.h bitops.h byteorder.h monstr
  2008-05-04 11:41                                                                             ` [PATCH 39/56] microblaze_v2: headers pgalloc.h pgtable.h monstr
@ 2008-05-04 21:58                                                                             ` Arnd Bergmann
  2008-05-05  2:28                                                                               ` John Williams
  1 sibling, 1 reply; 170+ messages in thread
From: Arnd Bergmann @ 2008-05-04 21:58 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

On Sunday 04 May 2008, monstr@seznam.cz wrote:
>  include/asm-microblaze/atomic.h    |  108 ++++++++++++++++++++++++++++++++++++

It would be cool if you could introduce this file as 
asm-generic/atomic-irqdisable.h or similar (can someone please
think of a better name?).

It looks like it could be shared with blackfin, h8300, m32r, m68k,
mn10300 and v850. Not important though, as this is not part of the
ABI.

	Arnd <><

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 42/56] microblaze_v2: stats headers
  2008-05-04 11:41                                                                                   ` [PATCH 42/56] microblaze_v2: stats headers monstr
  2008-05-04 11:41                                                                                     ` [PATCH 43/56] microblaze_v2: termbits.h termios.h monstr
@ 2008-05-04 22:31                                                                                     ` Arnd Bergmann
  1 sibling, 0 replies; 170+ messages in thread
From: Arnd Bergmann @ 2008-05-04 22:31 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

On Sunday 04 May 2008, monstr@seznam.cz wrote:
> +struct stat {
> +	unsigned int	st_dev;
> +	unsigned long	st_ino;
> +	unsigned int	st_mode;
> +	unsigned int	st_nlink;
> +	unsigned int	st_uid;
> +	unsigned int	st_gid;
> +	unsigned int	st_rdev;
> +	long		st_size;
> +	unsigned long	st_blksize;
> +	unsigned long	st_blocks;
> +	unsigned long	st_atime;
> +	unsigned long	__unused1;
> +	unsigned long	st_mtime;
> +	unsigned long	__unused2;
> +	unsigned long	st_ctime;
> +	unsigned long	__unused3;
> +	unsigned long	__unused4;
> +	unsigned long	__unused5;
> +};
> +
> +struct stat64 {
> +	unsigned long long	st_dev;
> +	unsigned long	__unused1;
> +
> +	unsigned long long	st_ino;
> +
> +	unsigned int	st_mode;
> +	unsigned int	st_nlink;
> +
> +	unsigned int	st_uid;
> +	unsigned int	st_gid;
> +
> +	unsigned long long	st_rdev;
> +	unsigned long	__unused3;
> +
> +	long long	st_size;
> +	unsigned long	st_blksize;
> +
> +	unsigned long	st_blocks; /* No. of 512-byte blocks allocated */
> +	unsigned long	__unused4; /* 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;
> +};

There should only be a 'struct stat', not stat64, and it would be nice
to have that in asm-generic/stat.h.

I think it should be defined as

struct stat {
	unsigned long long	st_dev;

	unsigned long long	st_ino;

	unsigned int		st_mode;
	unsigned int		st_nlink;

	unsigned int		st_uid;
	unsigned int		st_gid;

	unsigned long long	st_rdev;

	long long		st_size;

	unsigned int		st_blksize;
	unsigned int		__unused1;

	unsigned long long	st_blocks; /* No. of 512-byte blocks allocated */

	unsigned int		st_atime;
	unsigned int		st_atime_nsec;

	unsigned int		st_mtime;
	unsigned int		st_mtime_nsec;

	unsigned int		st_ctime;
	unsigned int		st_ctime_nsec;

	unsigned int		__unused2;
	unsigned int		__unused3;
};

This way, you don't have any unnecessary padding, and the structure
is compatible in 32 and 64 bit architectures.

	Arnd <><

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 47/56] microblaze_v2: device.h param.h topology.h
  2008-05-04 11:41                                                                                             ` [PATCH 47/56] microblaze_v2: device.h param.h topology.h monstr
  2008-05-04 11:41                                                                                               ` [PATCH 48/56] microblaze_v2: pool.h socket.h monstr
@ 2008-05-04 22:37                                                                                               ` Arnd Bergmann
  2008-05-05 14:07                                                                                                 ` Michal Simek
  1 sibling, 1 reply; 170+ messages in thread
From: Arnd Bergmann @ 2008-05-04 22:37 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

On Sunday 04 May 2008, monstr@seznam.cz wrote:

> +#ifndef _ASM_MICROBLAZE_DEVICE_H
> +#define _ASM_MICROBLAZE_DEVICE_H
> +
> +struct dma_mapping_ops;
> +struct device_node;
> +
> +struct dev_archdata {
> +	/* Optional pointer to an OF device node */
> +	struct device_node	*of_node;
> +
> +	/* DMA operations on that device */
> +	struct dma_mapping_ops	*dma_ops;
> +	void			*dma_data;
> +
> +	/* NUMA node if applicable */
> +	int			numa_node;
> +};

microblaze doesn't have NUMA or dma_mapping_ops, afaict, so it should
just be

struct dev_archdata {
	/* Optional pointer to an OF device node */
	struct device_node	*of_node;
};

> --- /dev/null
> +++ b/include/asm-microblaze/param.h
> @@ -0,0 +1,36 @@
> +/*
> + * include/asm-microblaze/param.h
> + *
> + * This file is subject to the terms and conditions of the GNU General Public
> + * License. See the file "COPYING" in the main directory of this archive
> + * for more details.
> + *
> + * Copyright (C) 2006 Atmark Techno, Inc.
> + */
> +
> +#ifndef _ASM_MICROBLAZE_PARAM_H
> +#define _ASM_MICROBLAZE_PARAM_H
> +
> +#ifdef __KERNEL__
> +# define HZ		100 /* internal timer frequency */
> +# define USER_HZ	100 /* for user interfaces in "ticks" */
> +# define CLOCKS_PER_SEC (USER_HZ) /* frequnzy at which times() counts */
> +#endif
> +
> +#ifndef NGROUPS
> +#define NGROUPS		32
> +#endif
> +
> +#ifndef NOGROUP
> +#define NOGROUP		(-1)
> +#endif
> +
> +#define EXEC_PAGESIZE	4096
> +
> +#ifndef HZ
> +#define HZ 100
> +#endif
> +
> +#define MAXHOSTNAMELEN	64 /* max length of hostname */
> +
> +#endif /* _ASM_MICROBLAZE_PARAM_H */

These parameters are so common that they should become asm-generic/param.h.
4kb page size is of course a HW feature, but it's so universal that it's almost
a natural constant ;-)

> --- /dev/null
> +++ b/include/asm-microblaze/topology.h
> @@ -0,0 +1,119 @@
> +/*
> + * include/asm-microblaze/topology.h

please use the existing asm-generic/topology.h here.

	Arnd <><

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 48/56] microblaze_v2: pool.h socket.h
  2008-05-04 11:41                                                                                               ` [PATCH 48/56] microblaze_v2: pool.h socket.h monstr
  2008-05-04 11:41                                                                                                 ` [PATCH 49/56] microblaze_v2: fcntl.h sockios.h ucontext.h monstr
@ 2008-05-04 22:39                                                                                                 ` Arnd Bergmann
  1 sibling, 0 replies; 170+ messages in thread
From: Arnd Bergmann @ 2008-05-04 22:39 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

On Sunday 04 May 2008, monstr@seznam.cz wrote:
> diff --git a/include/asm-microblaze/poll.h b/include/asm-microblaze/poll.h
> new file mode 100644
> index 0000000..4b33ac7
> --- /dev/null
> +++ b/include/asm-microblaze/poll.h
> @@ -0,0 +1,37 @@
> +/*
> + * include/asm-microblaze/poll.h

Please use the existing asm-generic/poll.h here.

> --- /dev/null
> +++ b/include/asm-microblaze/socket.h
> @@ -0,0 +1,68 @@
> +/*
> + * include/asm-microblaze/socket.h

Please make a new asm-generic/socket.h out of this file, and use it.

	Arnd <><

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 49/56] microblaze_v2: fcntl.h sockios.h ucontext.h
  2008-05-04 11:41                                                                                                 ` [PATCH 49/56] microblaze_v2: fcntl.h sockios.h ucontext.h monstr
  2008-05-04 11:41                                                                                                   ` [PATCH 50/56] microblaze_v2: setup.h string.h thread_info.h monstr
@ 2008-05-04 22:43                                                                                                   ` Arnd Bergmann
  2008-05-05 14:08                                                                                                     ` Michal Simek
  1 sibling, 1 reply; 170+ messages in thread
From: Arnd Bergmann @ 2008-05-04 22:43 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

On Sunday 04 May 2008, monstr@seznam.cz wrote:
>  include/asm-microblaze/fcntl.h    |  104 +++++++++++++++++++++++++++++++++++++

Use the existing asm-generic version for this.

>  include/asm-microblaze/sockios.h  |   25 +++++++++
>  include/asm-microblaze/ucontext.h |   24 +++++++++

turn these into asm-generic versions.

	Arnd <><

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 52/56] microblaze_v2: pci headers
  2008-05-04 11:41                                                                                                       ` [PATCH 52/56] microblaze_v2: pci headers monstr
  2008-05-04 11:41                                                                                                         ` [PATCH 53/56] microblaze_v2: IPC headers monstr
@ 2008-05-04 22:45                                                                                                         ` Arnd Bergmann
  2008-05-05 14:08                                                                                                           ` Michal Simek
  1 sibling, 1 reply; 170+ messages in thread
From: Arnd Bergmann @ 2008-05-04 22:45 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

On Sunday 04 May 2008, monstr@seznam.cz wrote:
> +
> +#ifdef __KERNEL__
> +#include <asm/io.h>
> +#endif

You don't export asm/pci.h to userspace, so the #ifdef __KERNEL__ is
not needed.

	Arnd <><

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 01/56] microblaze_v2: Kconfig patches
  2008-05-04 11:40 ` [PATCH 01/56] microblaze_v2: Kconfig patches monstr
  2008-05-04 11:40   ` [PATCH 02/56] microblaze_v2: Makefiles for Microblaze cpu monstr
  2008-05-04 21:24   ` [PATCH 01/56] microblaze_v2: Kconfig patches Grant Likely
@ 2008-05-05  1:42   ` John Williams
  2008-05-05  6:46     ` Michal Simek
  2008-05-05 14:16     ` Michal Simek
  2 siblings, 2 replies; 170+ messages in thread
From: John Williams @ 2008-05-05  1:42 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

Hi Michal,

On Sun, 2008-05-04 at 13:40 +0200, monstr@seznam.cz wrote:

> +config EARLY_PRINTK_UARTLITE_ADDRESS
> +	hex "Physical address where UART Lite for early printk is mapped"
> +	depends on EARLY_PRINTK
> +	default "0x40100000"
> +	help
> +	  Please enter physical address where your uart lite is mapped.

I think this should default to 0x00000000, then in the early_printk code
we can test for zero baseaddress and attempt some sensible fallback in
that case (even to disable).  
> +
> +config HEART_BEAT
> +	bool "Heart beat function for kernel"
> +	help
> +	  This option turns on/off heart beat kernel functionality on selected
> +	  GPIO address.
> +
> +config HEART_BEAT_ADDRESS
> +	hex "Physical address for heart beat LED"
> +	depends on HEART_BEAT
> +	default "0x40600000"
> +	help
> +	  Please enter physical address GPIO LED.

Again, default address should be zero which is checked in the code (zero
can disable).  Prevent accesses to random memory locations in case of
poorly configured kernel.


> +config HACK
> +	bool "Increase performance"
> +	default y

As suggested by Grant, this sohuld be

1. renamed and described as something sensible

SELF_MODIFYING_CODE_HACK

2. Made condition on CONFIG_EXPERIMENTAL at very least.

> +config OPT_LIB_FUNCTION
> +	bool "Optimalized lib function"
> +	default y
> +	help
> +	  Allows turn on optimalized library function (memcpy and memmove).
> +	  They are optimized by using unsigned alignment. This will work

"Unsigned alignment"??

Do you mean word-aligned?

> +	  fine if both source and destination are aligned on the same
> +	  boundary. However, if they are aligned on different boundaries
> +	  shifts will be necessary. This might result in bad performance
> +	  on MicroBlaze systems without a barrel shifter.
> +
> +# This is still a bit broken - disabling for now JW 20070504
> +config ALLOW_EDIT_AUTO
> +	bool "Permit Display/edit of Kconfig.auto platform settings"
> +	default n
> +	help
> +	  Allows the editing of auto-generated platform settings from
> +	  the Kconfig.auto file. Obviously this does not change the
> +	  underlying hardware, so be very careful if you go editing
> +	  these settings.
> +
> +	  Also, if you enable this, and edit various Kconfig.auto
> +	  settings, YOUR CHANGES WILL BE LOST if you then disable it
> +	  again. You have been warned!
> +
> +	  If unsure, say no.
> +
> +# Ok, the platform is chosen. Source the kconfig.auto to get all of the
> +# system settings.

Should be just "get all of the CPU settings", since we use OF to get the
device tree.

> diff --git a/arch/microblaze/platform/generic/Kconfig.auto b/arch/microblaze/platform/generic/Kconfig.auto
> new file mode 100644
> index 0000000..5dc8c15
> --- /dev/null
> +++ b/arch/microblaze/platform/generic/Kconfig.auto

> +config XILINX_ERAM_SIZE
> +	hex "Memory size of XILINX_RAM"
> +	depends on XILINX_UNCACHED_SHADOW
> +	default 0x02000000

Why does this depend on UNCACHED_SHADOW?

Regards,

John




^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 02/56] microblaze_v2: Makefiles for Microblaze cpu
  2008-05-04 11:40   ` [PATCH 02/56] microblaze_v2: Makefiles for Microblaze cpu monstr
  2008-05-04 11:40     ` [PATCH 03/56] microblaze_v2: Cpuinfo handling monstr
@ 2008-05-05  1:47     ` John Williams
  2008-05-06  8:51       ` Michal Simek
  1 sibling, 1 reply; 170+ messages in thread
From: John Williams @ 2008-05-05  1:47 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek


> --- /dev/null
> +++ b/arch/microblaze/Makefile
> @@ -0,0 +1,63 @@
> +UTS_SYSNAME = -DUTS_SYSNAME=\"uClinux\"
> +
> +# What CPU vesion are we building for, and crack it open
> +# as major.minor.rev
> +CPU_VER=$(subst ",,$(CONFIG_XILINX_MICROBLAZE0_HW_VER) )
> +CPU_MAJOR=$(shell echo $(CPU_VER) | cut -d '.' -f 1)
> +CPU_MINOR=$(shell echo $(CPU_VER) | cut -d '.' -f 2)
> +CPU_REV=$(shell echo $(CPU_VER) | cut -d '.' -f 3)

No doubt there's some cleaner shell-fu to do this but I'm not
complaining as I'm responsible for the original yucky version!

> --- /dev/null
> +++ b/arch/microblaze/platform/Makefile
> @@ -0,0 +1,3 @@
> +#
> +# Makefile for arch/microblaze/platform directory
> +#

How about a single 

obj-$(CONFIG_PLATFORM_GENERIC) += generic/

to show how platform-specific setup code can be added (even though
there's none in the default generic target)?



^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 03/56] microblaze_v2: Cpuinfo handling
  2008-05-04 11:40     ` [PATCH 03/56] microblaze_v2: Cpuinfo handling monstr
  2008-05-04 11:40       ` [PATCH 04/56] microblaze_v2: Open firmware files monstr
@ 2008-05-05  1:52       ` John Williams
  2008-05-05 14:19         ` Michal Simek
  1 sibling, 1 reply; 170+ messages in thread
From: John Williams @ 2008-05-05  1:52 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek


> --- /dev/null
> +++ b/arch/microblaze/kernel/cpu/cpuinfo-static.c
> @@ -0,0 +1,117 @@

> +
> +	ci->cpu_clock_freq = fcpu(cpu, "timebase-frequency");

Should this be added to cpuinfo-pvr.c?


> --- /dev/null
> +++ b/include/asm-microblaze/cpuinfo.h
...

> +	/* HW debug support */
> +	int hw_debug;
> +	int num_pc_brk;
> +	int num_rd_brk;
> +	int num_wr_brk;

  +       /* CPU and system timebase info */
> +	int cpu_clock_freq;
> +

> +void set_cpuinfo_pvr_partial(struct cpuinfo *ci);

pvr_partial never got written - it can be deleted.

John



^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 08/56] microblaze_v2: Interrupt handling, timer support, supported function
  2008-05-04 11:40               ` [PATCH 08/56] microblaze_v2: Interrupt handling, timer support, supported function monstr
  2008-05-04 11:40                 ` [PATCH 09/56] microblaze_v2: cache support monstr
@ 2008-05-05  1:58                 ` John Williams
  2008-05-05 14:20                   ` Michal Simek
  2008-05-07  7:04                 ` Thomas Gleixner
  2 siblings, 1 reply; 170+ messages in thread
From: John Williams @ 2008-05-05  1:58 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek


>  arch/microblaze/kernel/hack.c  |   82 ++++++++++++++++++
>  include/asm-microblaze/hack.h  |   24 +++++

These 'hack' files, functions and CONFIGS should be renamed.

How about

 * selfmod.[c|h] (core infrastructure)
 * CONFIG_SELFMOD  (enables the self modifying API)
 * CONFIG_SELFMOD_IRQ (use it on IRS)
 * CONFIG_SELFMOD_TIMER (user it on the timer)

The last two would be dependent on CONFIG_SELFMOD

With the recent ksplice stuff it seems self-modifying code is ready for
the mainline :)




^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 09/56] microblaze_v2: cache support
  2008-05-04 11:40                 ` [PATCH 09/56] microblaze_v2: cache support monstr
  2008-05-04 11:40                   ` [PATCH 10/56] microblaze_v2: Generic dts file for platforms monstr
@ 2008-05-05  2:09                   ` John Williams
  2008-05-05 17:37                   ` [microblaze-uclinux] " Stephen Neuendorffer
  2008-05-05 22:37                   ` Stephen Neuendorffer
  3 siblings, 0 replies; 170+ messages in thread
From: John Williams @ 2008-05-05  2:09 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek


> +++ b/arch/microblaze/kernel/cpu/cache.c

> +void __flush_icache_all(void)
> +{
> +	unsigned int i;
> +	unsigned flags;
> +
> +	if (cpuinfo.use_icache) {
> +		local_irq_save(flags);
> +		__disable_icache();
> +
> +		/* Just loop through cache size and invalidate, no need to add
> +			CACHE_BASE address */
> +		for (i = 0; i < cpuinfo.icache_size;
> +			i += cpuinfo.icache_line)
> +				__invalidate_icache(i);
> +
> +		__enable_icache();
> +		local_irq_restore(flags);
> +	}
> +}

This is the slowest and greatest latency-inducing loop in the MicroBlaze
kernel.  The CPU specs says icache must be disabled while you clear it -
if you have a chance it's worth checking to see what happens if you
violate that rule.

This will be less of a problem once we update the kernel_from_bram
patches, but that may be a little while yet.


> +void __flush_icache_range(unsigned long start, unsigned long end)

ditto

> +void __flush_icache_page(struct vm_area_struct *vma, struct page *page)
> +{
> +	__flush_icache_all();
> +}
> +

This could be smarter - if our cache size is less than a page then there
is a win to be had.  But, it's my fault so I won't complain too loudly!

> +void __flush_icache_user_range(struct vm_area_struct *vma,
> +				struct page *page, unsigned long adr,
> +				int len)
> +{
> +	__flush_icache_all();
> +}

and again.

> +
> +void __flush_cache_sigtramp(unsigned long addr)
> +{
> +	__flush_icache_range(addr, addr + 8);
> +}

Perhaps a #define in asm-microblaze/signal.h to tell us the size of the
sigtramp, and also used by microblaze/kernel/signal.c?

> +
> +void __flush_dcache_all(void)
> +{
> +	unsigned int i;
> +	unsigned flags;
> +
> +	if (cpuinfo.use_dcache) {
> +		local_irq_save(flags);
> +		__disable_dcache();
> +
> +		/*
> +		 * Just loop through cache size and invalidate,
> +		 * no need to add CACHE_BASE address
> +		 */
> +		for (i = 0; i < cpuinfo.dcache_size;
> +			i += cpuinfo.dcache_line)
> +				__invalidate_dcache(i);
> +
> +		__enable_dcache();
> +		local_irq_restore(flags);
> +	}
> +}

again might be worth testing if it still works with dcache enabled
during the flush loop.


> --- /dev/null
> +++ b/include/asm-microblaze/cache.h

> +#ifndef L1_CACHE_BYTES
> +/* word-granular cache in microblaze */
> +#define L1_CACHE_BYTES		4
> +#endif

Is this actually used anywhere?  If so, it's wrong because cache line
sizes is configurable now.


> +/* FIXME - I don't think this is right */
> +#ifdef CONFIG_XILINX_UNCACHED_SHADOW
> +#define UNCACHED_SHADOW_MASK (CONFIG_XILINX_ERAM_SIZE)
> +#endif

If you are throwing out the alloc_consist()/free_consist()
implementation then the UNCACHED_SHADOW stuff can go too.


> +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
> +do { memcpy(dst, src, len); \
> +	flush_icache_user_range(vma, page, vaddr, len); \
> +} while (0)

Is the icache flush required?  Is copy_to_user_page() called from the
binfmt_flat loader?



^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 12/56] microblaze_v2: lmb support
  2008-05-04 11:41                       ` [PATCH 12/56] microblaze_v2: lmb support monstr
  2008-05-04 11:41                         ` [PATCH 13/56] microblaze_v2: PVR support, cpuinfo support monstr
@ 2008-05-05  2:11                         ` John Williams
  2008-05-05 21:32                           ` Segher Boessenkool
  1 sibling, 1 reply; 170+ messages in thread
From: John Williams @ 2008-05-05  2:11 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek


> --- /dev/null
> +++ b/include/asm-microblaze/lmb.h

Since LMB has a very specific (and different) meaning the microblaze
context (LMB = Local Memory Bus), can we have a comment or explanation
from the PPC folks on what LMB actually stands for?

That can then become a disambiguating comment in the microblaze source
code that refers to it.




^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 13/56] microblaze_v2: PVR support, cpuinfo support
  2008-05-04 11:41                         ` [PATCH 13/56] microblaze_v2: PVR support, cpuinfo support monstr
  2008-05-04 11:41                           ` [PATCH 14/56] microblaze_v2: defconfig file monstr
@ 2008-05-05  2:14                           ` John Williams
  2008-05-05 14:20                             ` Michal Simek
  1 sibling, 1 reply; 170+ messages in thread
From: John Williams @ 2008-05-05  2:14 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek


> +int cpu_has_pvr(void)
> +{
> +	unsigned flags;
> +	unsigned pvr0;
> +	int ret = 0;
> +
> +	local_irq_save(flags);
> +

...

> +out:
> +	local_irq_restore(flags);
> +	return ret;
> +}

The actual IRQ clear/restore is not required - can you just use
local_save_flags() or similar to read the MSR?



^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 21/56] microblaze_v2: setup.c - system setting
  2008-05-04 11:41                                         ` [PATCH 21/56] microblaze_v2: setup.c - system setting monstr
  2008-05-04 11:41                                           ` [PATCH 22/56] microblaze_v2: asm-offsets monstr
@ 2008-05-05  2:15                                           ` John Williams
  2008-05-05 14:21                                             ` Michal Simek
  1 sibling, 1 reply; 170+ messages in thread
From: John Williams @ 2008-05-05  2:15 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek


> +++ b/arch/microblaze/kernel/setup.c

> +#ifdef CONFIG_HACK
> +	printk(KERN_NOTICE "HACK function enable\n");
> +#else
> +	printk(KERN_NOTICE "HACK function disable\n");
> +#endif

%s/HACK/something sensible/g




^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 24/56] microblaze_v2: time support
  2008-05-04 11:41                                               ` [PATCH 24/56] microblaze_v2: time support monstr
  2008-05-04 11:41                                                 ` [PATCH 25/56] microblaze_v2: ptrace support monstr
@ 2008-05-05  2:19                                                 ` John Williams
  2008-05-05 14:22                                                   ` Michal Simek
  2008-05-07  7:22                                                 ` Thomas Gleixner
  2 siblings, 1 reply; 170+ messages in thread
From: John Williams @ 2008-05-05  2:19 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek


> +static inline void udelay(unsigned long usec)
> +{
> +	unsigned long long tmp = usec;
> +	unsigned long loops = (tmp * 4295 * HZ * loops_per_jiffy) >> 32;
> +	__delay(loops);
> +}

Let's hope like hell the CPU has HW multipler and shifter for this
one! :)

> +++ b/include/asm-microblaze/timex.h
> @@ -0,0 +1,20 @@
> +
> +#define CLOCK_TICK_RATE 1000 /* Timer input freq. */

What's this?  Is it used anywhere?




^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 35/56] microblaze_v2: headers for executables format FLAT, ELF
  2008-05-04 11:41                                                                     ` [PATCH 35/56] microblaze_v2: headers for executables format FLAT, ELF monstr
  2008-05-04 11:41                                                                       ` [PATCH 36/56] microblaze_v2: dma support monstr
@ 2008-05-05  2:24                                                                       ` John Williams
  1 sibling, 0 replies; 170+ messages in thread
From: John Williams @ 2008-05-05  2:24 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek


> +++ b/include/asm-microblaze/elf.h

> +#define EM_XILINX_MICROBLAZE 0xbaab

I'm pretty sure this is also #defined somewhere else - asm/modules.h
maybe?

Also worth checking to see if MicroBlaze has been assigned a real ELF
machine ID yet - not sure if Xilinx ever applied for one.



^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 36/56] microblaze_v2: dma support
  2008-05-04 11:41                                                                       ` [PATCH 36/56] microblaze_v2: dma support monstr
  2008-05-04 11:41                                                                         ` [PATCH 37/56] microblaze_v2: headers for irq monstr
@ 2008-05-05  2:25                                                                         ` John Williams
  2008-05-05  6:45                                                                           ` Geert Uytterhoeven
  1 sibling, 1 reply; 170+ messages in thread
From: John Williams @ 2008-05-05  2:25 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek


> +++ b/include/asm-microblaze/scatterlist.h
> @@ -0,0 +1,21 @@
> +/*
> + * include/asm-microblaze/scatterlist.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_SCATTERLIST_H
> +#define _ASM_MICROBLAZE_SCATTERLIST_H
> +
> +struct scatterlist {
> +	unsigned long page_link;
> +	unsigned int	offset;
> +	dma_addr_t	dma_address;
> +	unsigned int	length;
> +};
> +
> +#endif /* _ASM_MICROBLAZE_SCATTERLIST_H */

Is this worthy of promotion to asm-generic/scatterlist.h?




^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 38/56] microblaze_v2: atomic.h bitops.h byteorder.h
  2008-05-04 21:58                                                                             ` [PATCH 38/56] microblaze_v2: atomic.h bitops.h byteorder.h Arnd Bergmann
@ 2008-05-05  2:28                                                                               ` John Williams
  2008-05-06  8:42                                                                                 ` Michal Simek
  0 siblings, 1 reply; 170+ messages in thread
From: John Williams @ 2008-05-05  2:28 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: monstr, linux-kernel, linux-arch, stephen.neuendorffer,
	John.Linn, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

On Sun, 2008-05-04 at 23:58 +0200, Arnd Bergmann wrote:
> On Sunday 04 May 2008, monstr@seznam.cz wrote:
> >  include/asm-microblaze/atomic.h    |  108 ++++++++++++++++++++++++++++++++++++
> 
> It would be cool if you could introduce this file as 
> asm-generic/atomic-irqdisable.h or similar (can someone please
> think of a better name?).

atomic-nonnative.h?

atomic-emulated.h?

atomic-wish-we-had-it-native.h?




^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: Microblaze patches V2
  2008-05-04 11:40 Microblaze patches V2 monstr
  2008-05-04 11:40 ` [PATCH 01/56] microblaze_v2: Kconfig patches monstr
@ 2008-05-05  2:30 ` John Williams
  2008-05-05  7:02   ` Michal Simek
  1 sibling, 1 reply; 170+ messages in thread
From: John Williams @ 2008-05-05  2:30 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely

Hi Michal,

On Sun, 2008-05-04 at 13:40 +0200, monstr@seznam.cz wrote:

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

Thanks for your work.

Maybe I missed it, but I didn't see entry.S, head.S, ptrace.c, and a few
others?

John



^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 45/56] microblaze_v2: headers simple files - empty or redirect to asm-generic
  2008-05-04 11:41                                                                                         ` [PATCH 45/56] microblaze_v2: headers simple files - empty or redirect to asm-generic monstr
  2008-05-04 11:41                                                                                           ` [PATCH 46/56] microblaze_v2: headers files entry.h current.h mman.h registers.h sembuf.h monstr
@ 2008-05-05  2:34                                                                                           ` John Williams
  2008-05-05 15:10                                                                                             ` Grant Likely
  2008-05-06 14:47                                                                                             ` Stephen Rothwell
  1 sibling, 2 replies; 170+ messages in thread
From: John Williams @ 2008-05-05  2:34 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek


>  include/asm-microblaze/auxvec.h            |   14 ++++++++++++++
>  include/asm-microblaze/cputime.h           |   16 ++++++++++++++++
>  include/asm-microblaze/div64.h             |   16 ++++++++++++++++
>  include/asm-microblaze/emergency-restart.h |   16 ++++++++++++++++
>  include/asm-microblaze/errno.h             |   16 ++++++++++++++++
>  include/asm-microblaze/futex.h             |   16 ++++++++++++++++
>  include/asm-microblaze/kdebug.h            |   19 +++++++++++++++++++
>  include/asm-microblaze/local.h             |   16 ++++++++++++++++
>  include/asm-microblaze/mutex.h             |   16 ++++++++++++++++
>  include/asm-microblaze/namei.h             |   24 ++++++++++++++++++++++++
>  include/asm-microblaze/percpu.h            |   16 ++++++++++++++++
>  include/asm-microblaze/resource.h          |   16 ++++++++++++++++
>  include/asm-microblaze/user.h              |   18 ++++++++++++++++++

These are all just includes of asm-generic/* (hooray!).

But, is it reasonable to to suggest adding asm-generic at the end of the
kernel include path, and save all this verbosity?  

Principle of least surprise maybe?

John




^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 50/56] microblaze_v2: setup.h string.h thread_info.h
  2008-05-04 11:41                                                                                                   ` [PATCH 50/56] microblaze_v2: setup.h string.h thread_info.h monstr
  2008-05-04 11:41                                                                                                     ` [PATCH 51/56] microblaze_v2: Kbuild file monstr
@ 2008-05-05  2:39                                                                                                     ` John Williams
  2008-05-05 14:24                                                                                                       ` Michal Simek
  1 sibling, 1 reply; 170+ messages in thread
From: John Williams @ 2008-05-05  2:39 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek


> +++ b/include/asm-microblaze/thread_info.h
> @@ -0,0 +1,155 @@
> +/*
> + * include/asm-microblaze/thread_info.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_THREAD_INFO_H
> +#define _ASM_MICROBLAZE_THREAD_INFO_H
> +
> +#ifdef __KERNEL__
> +
> +/* we have 8k stack */

Is it worth trialling a 4K stack on MicroBlaze?


> +struct cpu_context {
> +	__u32	sp;

I'd be happier to see this called r1.  If mb-as doesn't accept "sp" as
an alias for "r1", nor should we.

...

> +	__u32	r30;

Is it worth a comment that r31 is absent because it's used as 'current'
pointer, and -ffixed-r31 etc?




^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 01/56] microblaze_v2: Kconfig patches
  2008-05-04 21:24   ` [PATCH 01/56] microblaze_v2: Kconfig patches Grant Likely
@ 2008-05-05  6:36     ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-05  6:36 UTC (permalink / raw)
  To: Grant Likely
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	Michal Simek

Hi Grant,

>> From: Michal Simek <monstr@monstr.eu>
>>
>>
>>  Signed-off-by: Michal Simek <monstr@monstr.eu>
> 
>>  diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
>>  new file mode 100644
>>  index 0000000..49767d1
>>  --- /dev/null
>>  +++ b/arch/microblaze/Kconfig
> <snip>
>>  +config XILINX_UNCACHED_SHADOW
>>  +       bool "Are you using uncached shadow for RAM ?"
>>  +       depends on MICROBLAZE
> 
> Isn't CONFIG_MICROBLAZE a given?

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


>>  diff --git a/arch/microblaze/platform/Kconfig.platform b/arch/microblaze/platform/Kconfig.platform
>>  new file mode 100644
>>  index 0000000..64cbb80
>>  --- /dev/null
>>  +++ b/arch/microblaze/platform/Kconfig.platform
> <snip>
>>  +config HACK
>>  +       bool "Increase performance"
>>  +       default y
> 
> Is this appropriate for mainline?  If so, it should have a better
> description.  :-)

:-) Yes. A little bit.

Michal

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 36/56] microblaze_v2: dma support
  2008-05-05  2:25                                                                         ` [PATCH 36/56] microblaze_v2: dma support John Williams
@ 2008-05-05  6:45                                                                           ` Geert Uytterhoeven
  2008-05-06  9:16                                                                             ` Michal Simek
  0 siblings, 1 reply; 170+ messages in thread
From: Geert Uytterhoeven @ 2008-05-05  6:45 UTC (permalink / raw)
  To: John Williams
  Cc: monstr, linux-kernel, arnd, linux-arch, stephen.neuendorffer,
	John.Linn, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

On Mon, 5 May 2008, John Williams wrote:
> > +++ b/include/asm-microblaze/scatterlist.h
> > @@ -0,0 +1,21 @@
> > +/*
> > + * include/asm-microblaze/scatterlist.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_SCATTERLIST_H
> > +#define _ASM_MICROBLAZE_SCATTERLIST_H
> > +
> > +struct scatterlist {
> > +	unsigned long page_link;
> > +	unsigned int	offset;
> > +	dma_addr_t	dma_address;
> > +	unsigned int	length;
> > +};
> > +
> > +#endif /* _ASM_MICROBLAZE_SCATTERLIST_H */
> 
> Is this worthy of promotion to asm-generic/scatterlist.h?

after moving dma_address one position up in the structure, as dma_addr_t may be
64-bit?

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 01/56] microblaze_v2: Kconfig patches
  2008-05-05  1:42   ` John Williams
@ 2008-05-05  6:46     ` Michal Simek
  2008-05-05 14:16     ` Michal Simek
  1 sibling, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-05  6:46 UTC (permalink / raw)
  To: John Williams
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek




> Hi Michal,
> 
> On Sun, 2008-05-04 at 13:40 +0200, monstr@seznam.cz wrote:
> 
>> +config EARLY_PRINTK_UARTLITE_ADDRESS
>> +	hex "Physical address where UART Lite for early printk is mapped"
>> +	depends on EARLY_PRINTK
>> +	default "0x40100000"
>> +	help
>> +	  Please enter physical address where your uart lite is mapped.
> 
> I think this should default to 0x00000000, then in the early_printk code
> we can test for zero baseaddress and attempt some sensible fallback in
> that case (even to disable).  

That's make sense to me.

>> +
>> +config HEART_BEAT
>> +	bool "Heart beat function for kernel"
>> +	help
>> +	  This option turns on/off heart beat kernel functionality on selected
>> +	  GPIO address.
>> +
>> +config HEART_BEAT_ADDRESS
>> +	hex "Physical address for heart beat LED"
>> +	depends on HEART_BEAT
>> +	default "0x40600000"
>> +	help
>> +	  Please enter physical address GPIO LED.
> 
> Again, default address should be zero which is checked in the code (zero
> can disable).  Prevent accesses to random memory locations in case of
> poorly configured kernel.

I'll add default option to HEART_BEAT to no and zero base address. I don't want to
add any checking code to this function except for #if solution.

>> +config HACK
>> +	bool "Increase performance"
>> +	default y
> 
> As suggested by Grant, this sohuld be
> 
> 1. renamed and described as something sensible
> 
> SELF_MODIFYING_CODE_HACK

:-) nice name

> 2. Made condition on CONFIG_EXPERIMENTAL at very least.
> 
>> +config OPT_LIB_FUNCTION
>> +	bool "Optimalized lib function"
>> +	default y
>> +	help
>> +	  Allows turn on optimalized library function (memcpy and memmove).
>> +	  They are optimized by using unsigned alignment. This will work
> 
> "Unsigned alignment"??
> 
> Do you mean word-aligned?

Yes.

>> +	  fine if both source and destination are aligned on the same
>> +	  boundary. However, if they are aligned on different boundaries
>> +	  shifts will be necessary. This might result in bad performance
>> +	  on MicroBlaze systems without a barrel shifter.
>> +
>> +# This is still a bit broken - disabling for now JW 20070504
>> +config ALLOW_EDIT_AUTO
>> +	bool "Permit Display/edit of Kconfig.auto platform settings"
>> +	default n
>> +	help
>> +	  Allows the editing of auto-generated platform settings from
>> +	  the Kconfig.auto file. Obviously this does not change the
>> +	  underlying hardware, so be very careful if you go editing
>> +	  these settings.
>> +
>> +	  Also, if you enable this, and edit various Kconfig.auto
>> +	  settings, YOUR CHANGES WILL BE LOST if you then disable it
>> +	  again. You have been warned!
>> +
>> +	  If unsure, say no.
>> +
>> +# Ok, the platform is chosen. Source the kconfig.auto to get all of the
>> +# system settings.
> 
> Should be just "get all of the CPU settings", since we use OF to get the
> device tree.

OK.

>> diff --git a/arch/microblaze/platform/generic/Kconfig.auto b/arch/microblaze/platform/generic/Kconfig.auto
>> new file mode 100644
>> index 0000000..5dc8c15
>> --- /dev/null
>> +++ b/arch/microblaze/platform/generic/Kconfig.auto
> 
>> +config XILINX_ERAM_SIZE
>> +	hex "Memory size of XILINX_RAM"
>> +	depends on XILINX_UNCACHED_SHADOW
>> +	default 0x02000000
> 
> Why does this depend on UNCACHED_SHADOW?

Because only UNCACHED_SHADOW wanted to know how big is memory. Current situation
is clear. Only consistent.c file wanted  UNCACHED_SHADOW choise. I'll remove
this choice too.

> Regards,
> 
> John

Thanks,
Michal

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: Microblaze patches V2
  2008-05-05  2:30 ` Microblaze patches V2 John Williams
@ 2008-05-05  7:02   ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-05  7:02 UTC (permalink / raw)
  To: John Williams
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely

Hi John,

I used git-send command for it. I'll fix bug and send third version.

Entry.S and others will at the end of set.

M


> Hi Michal,
> 
> On Sun, 2008-05-04 at 13:40 +0200, monstr@seznam.cz wrote:
> 
>> this is second set of patches. I fixed almost all bugs which
>> were reported in your emails.
> 
> Thanks for your work.
> 
> Maybe I missed it, but I didn't see entry.S, head.S, ptrace.c, and a few
> others?
> 
> John

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 43/56] microblaze_v2: termbits.h termios.h
  2008-05-04 11:41                                                                                     ` [PATCH 43/56] microblaze_v2: termbits.h termios.h monstr
  2008-05-04 11:41                                                                                       ` [PATCH 44/56] microblaze_v2: sigcontext.h siginfo.h monstr
@ 2008-05-05  9:50                                                                                       ` Arnd Bergmann
  1 sibling, 0 replies; 170+ messages in thread
From: Arnd Bergmann @ 2008-05-05  9:50 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

On Sunday 04 May 2008, monstr@seznam.cz wrote:
>  include/asm-microblaze/termbits.h |  203 +++++++++++++++++++++++++++++++++++++
>  include/asm-microblaze/termios.h  |   86 ++++++++++++++++

Both of these are candidates for asm-generic, but I haven't looked
at them in detail yet.

	Arnd <><

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 46/56] microblaze_v2: headers files entry.h current.h mman.h registers.h sembuf.h
  2008-05-04 11:41                                                                                           ` [PATCH 46/56] microblaze_v2: headers files entry.h current.h mman.h registers.h sembuf.h monstr
  2008-05-04 11:41                                                                                             ` [PATCH 47/56] microblaze_v2: device.h param.h topology.h monstr
@ 2008-05-05  9:54                                                                                             ` Arnd Bergmann
  2008-05-06  9:07                                                                                               ` Michal Simek
  2008-05-06 20:57                                                                                             ` Geert Uytterhoeven
  2 siblings, 1 reply; 170+ messages in thread
From: Arnd Bergmann @ 2008-05-05  9:54 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

On Sunday 04 May 2008, monstr@seznam.cz wrote:
> +#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 */

I think we should come up with a good way to fold these into the
asm-generic header, as half the architectures use the same values
for them, in addition to what is already shared.

	Arnd <><

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 17/56] microblaze_v2: checksum support
  2008-05-04 19:59                                   ` [PATCH 17/56] microblaze_v2: checksum support Arnd Bergmann
@ 2008-05-05 14:05                                     ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-05 14:05 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kernel, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

Hi,

>> + *
>> + * INET                An implementation of the TCP/IP protocol suite for the LINUX
>> + *             operating system.  INET is implemented using the  BSD Socket
>> + *             interface as the means of communication with the user level.
>> + *
>> + *             IP/TCP/UDP checksumming routines
>> + *
>> + * Authors:    Jorge Cwik, <jorge@laser.satlink.net>
>> + *             Arnt Gulbrandsen, <agulbra@nvg.unit.no>
>> + *             Tom May, <ftom@netcom.com>
>> + *             Andreas Schwab, <schwab@issan.informatik.uni-dortmund.de>
>> + *             Lots of code moved from tcp.c and ip.c; see those files
>> + *             for more names.
> 
> This is a pretty generic implementation, and you copied it from another
> architecture. How about moving it from arch/microblaze/lib/ to lib/?
> I'd suggest building it conditionally under CONFIG_GENERIC_CSUM,
> which you def_bool in your architecture Kconfig.
> 
> 	Arnd <><
I move checksum.c to /lib and checksum.h to asm-generic and add to GENERIC_CSUM
to Kconfig

   6 config MICROBLAZE
   7         def_bool y
   8         select HAVE_LMB
   9         select GENERIC_CSUM

M

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 33/56] microblaze_v2: ioctl support
  2008-05-04 21:34                                                                   ` [PATCH 33/56] microblaze_v2: ioctl support Arnd Bergmann
@ 2008-05-05 14:06                                                                     ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-05 14:06 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kernel, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

I fixed it. I use asm-generic version too. ioctl.h and ioctls.h too.

M


>>  include/asm-microblaze/ioctl.h  |   84 +++++++++++++++++++++++++++++++++++
> 
> This is a direct copy of asm-generic/ioctl.h, so just include that
> one instead.
> 
>>  include/asm-microblaze/ioctls.h |   93 +++++++++++++++++++++++++++++++++++++++
> 
> I've already prototyped an asm-generic version of that, which would be the patch
> below.
> 
> 	Arnd <><
> 
> ---
> 
> Consolidate include/asm*/ioctls.h
> 
> Most architectures have an identical implementation of ioctls.h, so we can
> just as well move it to asm-generic. While it should have been defined
> using _IO style macros in the first place, there is enough precendent
> to give up on that now, and just document what every architecture is
> doing already.
> 
> The major difference between architectures at this time is the definition
> of FIOQSIZE, which sometimes conflicts with TIOCGHAYESESP, so I use an
> #ifdef for that.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> Index: linux-2.6/include/asm-arm/ioctls.h
> ===================================================================
> --- linux-2.6.orig/include/asm-arm/ioctls.h
> +++ linux-2.6/include/asm-arm/ioctls.h
> @@ -1,84 +1,6 @@
>  #ifndef __ASM_ARM_IOCTLS_H
>  #define __ASM_ARM_IOCTLS_H
>  
> -#include <asm/ioctl.h>
> -
> -/* 0x54 is just a magic number to make these relatively unique ('T') */
> -
> -#define TCGETS		0x5401
> -#define TCSETS		0x5402
> -#define TCSETSW		0x5403
> -#define TCSETSF		0x5404
> -#define TCGETA		0x5405
> -#define TCSETA		0x5406
> -#define TCSETAW		0x5407
> -#define TCSETAF		0x5408
> -#define TCSBRK		0x5409
> -#define TCXONC		0x540A
> -#define TCFLSH		0x540B
> -#define TIOCEXCL	0x540C
> -#define TIOCNXCL	0x540D
> -#define TIOCSCTTY	0x540E
> -#define TIOCGPGRP	0x540F
> -#define TIOCSPGRP	0x5410
> -#define TIOCOUTQ	0x5411
> -#define TIOCSTI		0x5412
> -#define TIOCGWINSZ	0x5413
> -#define TIOCSWINSZ	0x5414
> -#define TIOCMGET	0x5415
> -#define TIOCMBIS	0x5416
> -#define TIOCMBIC	0x5417
> -#define TIOCMSET	0x5418
> -#define TIOCGSOFTCAR	0x5419
> -#define TIOCSSOFTCAR	0x541A
> -#define FIONREAD	0x541B
> -#define TIOCINQ		FIONREAD
> -#define TIOCLINUX	0x541C
> -#define TIOCCONS	0x541D
> -#define TIOCGSERIAL	0x541E
> -#define TIOCSSERIAL	0x541F
> -#define TIOCPKT		0x5420
> -#define FIONBIO		0x5421
> -#define TIOCNOTTY	0x5422
> -#define TIOCSETD	0x5423
> -#define TIOCGETD	0x5424
> -#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
> -#define TIOCSBRK	0x5427  /* BSD compatibility */
> -#define TIOCCBRK	0x5428  /* BSD compatibility */
> -#define TIOCGSID	0x5429  /* Return the session ID of FD */
> -#define TCGETS2		_IOR('T',0x2A, struct termios2)
> -#define TCSETS2		_IOW('T',0x2B, struct termios2)
> -#define TCSETSW2	_IOW('T',0x2C, struct termios2)
> -#define TCSETSF2	_IOW('T',0x2D, struct termios2)
> -#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
> -#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
> -
> -#define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
> -#define FIOCLEX		0x5451
> -#define FIOASYNC	0x5452
> -#define TIOCSERCONFIG	0x5453
> -#define TIOCSERGWILD	0x5454
> -#define TIOCSERSWILD	0x5455
> -#define TIOCGLCKTRMIOS	0x5456
> -#define TIOCSLCKTRMIOS	0x5457
> -#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
> -#define TIOCSERGETLSR   0x5459 /* Get line status register */
> -#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
> -#define TIOCSERSETMULTI 0x545B /* Set multiport config */
> -
> -#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
> -#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
> -#define FIOQSIZE	0x545E
> -
> -/* Used for packet mode */
> -#define TIOCPKT_DATA		 0
> -#define TIOCPKT_FLUSHREAD	 1
> -#define TIOCPKT_FLUSHWRITE	 2
> -#define TIOCPKT_STOP		 4
> -#define TIOCPKT_START		 8
> -#define TIOCPKT_NOSTOP		16
> -#define TIOCPKT_DOSTOP		32
> -
> -#define TIOCSER_TEMT	0x01	/* Transmitter physically empty */
> +#include <asm-generic/ioctls.h>
>  
>  #endif
> Index: linux-2.6/include/asm-avr32/ioctls.h
> ===================================================================
> --- linux-2.6.orig/include/asm-avr32/ioctls.h
> +++ linux-2.6/include/asm-avr32/ioctls.h
> @@ -1,83 +1,15 @@
>  #ifndef __ASM_AVR32_IOCTLS_H
>  #define __ASM_AVR32_IOCTLS_H
>  
> -#include <asm/ioctl.h>
> -
> -/* 0x54 is just a magic number to make these relatively unique ('T') */
> -
> -#define TCGETS		0x5401
> -#define TCSETS		0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */
> -#define TCSETSW		0x5403
> -#define TCSETSF		0x5404
> -#define TCGETA		0x5405
> -#define TCSETA		0x5406
> -#define TCSETAW		0x5407
> -#define TCSETAF		0x5408
> -#define TCSBRK		0x5409
> -#define TCXONC		0x540A
> -#define TCFLSH		0x540B
> -#define TIOCEXCL	0x540C
> -#define TIOCNXCL	0x540D
> -#define TIOCSCTTY	0x540E
> -#define TIOCGPGRP	0x540F
> -#define TIOCSPGRP	0x5410
> -#define TIOCOUTQ	0x5411
> -#define TIOCSTI		0x5412
> -#define TIOCGWINSZ	0x5413
> -#define TIOCSWINSZ	0x5414
> -#define TIOCMGET	0x5415
> -#define TIOCMBIS	0x5416
> -#define TIOCMBIC	0x5417
> -#define TIOCMSET	0x5418
> -#define TIOCGSOFTCAR	0x5419
> -#define TIOCSSOFTCAR	0x541A
> -#define FIONREAD	0x541B
> -#define TIOCINQ		FIONREAD
> -#define TIOCLINUX	0x541C
> -#define TIOCCONS	0x541D
> -#define TIOCGSERIAL	0x541E
> -#define TIOCSSERIAL	0x541F
> -#define TIOCPKT		0x5420
> -#define FIONBIO		0x5421
> -#define TIOCNOTTY	0x5422
> -#define TIOCSETD	0x5423
> -#define TIOCGETD	0x5424
> -#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
> -/* #define TIOCTTYGSTRUCT 0x5426 - Former debugging-only ioctl */
> -#define TIOCSBRK	0x5427  /* BSD compatibility */
> -#define TIOCCBRK	0x5428  /* BSD compatibility */
> -#define TIOCGSID	0x5429  /* Return the session ID of FD */
> -#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
> -#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
> -
> -#define FIONCLEX	0x5450
> -#define FIOCLEX		0x5451
> -#define FIOASYNC	0x5452
> -#define TIOCSERCONFIG	0x5453
> -#define TIOCSERGWILD	0x5454
> -#define TIOCSERSWILD	0x5455
> -#define TIOCGLCKTRMIOS	0x5456
> -#define TIOCSLCKTRMIOS	0x5457
> -#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
> -#define TIOCSERGETLSR   0x5459 /* Get line status register */
> -#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
> -#define TIOCSERSETMULTI 0x545B /* Set multiport config */
> -
> -#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
> -#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
>  #define TIOCGHAYESESP   0x545E  /* Get Hayes ESP configuration */
>  #define TIOCSHAYESESP   0x545F  /* Set Hayes ESP configuration */
>  #define FIOQSIZE	0x5460
>  
> -/* Used for packet mode */
> -#define TIOCPKT_DATA		 0
> -#define TIOCPKT_FLUSHREAD	 1
> -#define TIOCPKT_FLUSHWRITE	 2
> -#define TIOCPKT_STOP		 4
> -#define TIOCPKT_START		 8
> -#define TIOCPKT_NOSTOP		16
> -#define TIOCPKT_DOSTOP		32
> +#include <asm-generic/ioctls.h>
>  
> -#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
> +#undef TCGETS2
> +#undef TCSETS2
> +#undef TCSETSW2
> +#undef TCSETSF2
>  
> -#endif /* __ASM_AVR32_IOCTLS_H */
> +#endif
> Index: linux-2.6/include/asm-blackfin/ioctls.h
> ===================================================================
> --- linux-2.6.orig/include/asm-blackfin/ioctls.h
> +++ linux-2.6/include/asm-blackfin/ioctls.h
> @@ -1,87 +1,7 @@
>  #ifndef __ARCH_BFIN_IOCTLS_H__
>  #define __ARCH_BFIN_IOCTLS_H__
>  
> -#include <asm/ioctl.h>
> +#include <asm-generic/ioctls.h>
>  
> -/* 0x54 is just a magic number to make these relatively unique ('T') */
> -
> -#define TCGETS		0x5401
> -#define TCSETS		0x5402
> -#define TCSETSW		0x5403
> -#define TCSETSF		0x5404
> -#define TCGETA		0x5405
> -#define TCSETA		0x5406
> -#define TCSETAW		0x5407
> -#define TCSETAF		0x5408
> -#define TCSBRK		0x5409
> -#define TCXONC		0x540A
> -#define TCFLSH		0x540B
> -#define TIOCEXCL	0x540C
> -#define TIOCNXCL	0x540D
> -#define TIOCSCTTY	0x540E
> -#define TIOCGPGRP	0x540F
> -#define TIOCSPGRP	0x5410
> -#define TIOCOUTQ	0x5411
> -#define TIOCSTI		0x5412
> -#define TIOCGWINSZ	0x5413
> -#define TIOCSWINSZ	0x5414
> -#define TIOCMGET	0x5415
> -#define TIOCMBIS	0x5416
> -#define TIOCMBIC	0x5417
> -#define TIOCMSET	0x5418
> -#define TIOCGSOFTCAR	0x5419
> -#define TIOCSSOFTCAR	0x541A
> -#define FIONREAD	0x541B
> -#define TIOCINQ		FIONREAD
> -#define TIOCLINUX	0x541C
> -#define TIOCCONS	0x541D
> -#define TIOCGSERIAL	0x541E
> -#define TIOCSSERIAL	0x541F
> -#define TIOCPKT		0x5420
> -#define FIONBIO		0x5421
> -#define TIOCNOTTY	0x5422
> -#define TIOCSETD	0x5423
> -#define TIOCGETD	0x5424
> -#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
>  #define TIOCTTYGSTRUCT	0x5426	/* For debugging only */
> -#define TIOCSBRK	0x5427	/* BSD compatibility */
> -#define TIOCCBRK	0x5428	/* BSD compatibility */
> -#define TIOCGSID	0x5429	/* Return the session ID of FD */
> -#define TCGETS2		_IOR('T', 0x2A, struct termios2)
> -#define TCSETS2		_IOW('T', 0x2B, struct termios2)
> -#define TCSETSW2	_IOW('T', 0x2C, struct termios2)
> -#define TCSETSF2	_IOW('T', 0x2D, struct termios2)
> -/* Get Pty Number (of pty-mux device) */
> -#define TIOCGPTN	_IOR('T', 0x30, unsigned int)
> -#define TIOCSPTLCK	_IOW('T', 0x31, int)	/* Lock/unlock Pty */
> -
> -#define FIONCLEX	0x5450	/* these numbers need to be adjusted. */
> -#define FIOCLEX		0x5451
> -#define FIOASYNC	0x5452
> -#define TIOCSERCONFIG	0x5453
> -#define TIOCSERGWILD	0x5454
> -#define TIOCSERSWILD	0x5455
> -#define TIOCGLCKTRMIOS	0x5456
> -#define TIOCSLCKTRMIOS	0x5457
> -#define TIOCSERGSTRUCT	0x5458	/* For debugging only */
> -#define TIOCSERGETLSR   0x5459	/* Get line status register */
> -#define TIOCSERGETMULTI 0x545A	/* Get multiport config  */
> -#define TIOCSERSETMULTI 0x545B	/* Set multiport config */
> -
> -#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
> -#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
> -
> -#define FIOQSIZE	0x545E
> -
> -/* Used for packet mode */
> -#define TIOCPKT_DATA		 0
> -#define TIOCPKT_FLUSHREAD	 1
> -#define TIOCPKT_FLUSHWRITE	 2
> -#define TIOCPKT_STOP		 4
> -#define TIOCPKT_START		 8
> -#define TIOCPKT_NOSTOP		16
> -#define TIOCPKT_DOSTOP		32
> -
> -#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
> -
> -#endif				/* __ARCH_BFIN_IOCTLS_H__ */
> +#endif
> Index: linux-2.6/include/asm-cris/ioctls.h
> ===================================================================
> --- linux-2.6.orig/include/asm-cris/ioctls.h
> +++ linux-2.6/include/asm-cris/ioctls.h
> @@ -1,91 +1,12 @@
>  #ifndef __ARCH_CRIS_IOCTLS_H__
>  #define __ARCH_CRIS_IOCTLS_H__
>  
> -/* verbatim copy of asm-i386/ioctls.h */
> -
> -#include <asm/ioctl.h>
> -
> -/* 0x54 is just a magic number to make these relatively unique ('T') */
> -
> -#define TCGETS		0x5401
> -#define TCSETS		0x5402
> -#define TCSETSW		0x5403
> -#define TCSETSF		0x5404
> -#define TCGETA		0x5405
> -#define TCSETA		0x5406
> -#define TCSETAW		0x5407
> -#define TCSETAF		0x5408
> -#define TCSBRK		0x5409
> -#define TCXONC		0x540A
> -#define TCFLSH		0x540B
> -#define TIOCEXCL	0x540C
> -#define TIOCNXCL	0x540D
> -#define TIOCSCTTY	0x540E
> -#define TIOCGPGRP	0x540F
> -#define TIOCSPGRP	0x5410
> -#define TIOCOUTQ	0x5411
> -#define TIOCSTI		0x5412
> -#define TIOCGWINSZ	0x5413
> -#define TIOCSWINSZ	0x5414
> -#define TIOCMGET	0x5415
> -#define TIOCMBIS	0x5416
> -#define TIOCMBIC	0x5417
> -#define TIOCMSET	0x5418
> -#define TIOCGSOFTCAR	0x5419
> -#define TIOCSSOFTCAR	0x541A
> -#define FIONREAD	0x541B
> -#define TIOCINQ		FIONREAD
> -#define TIOCLINUX	0x541C
> -#define TIOCCONS	0x541D
> -#define TIOCGSERIAL	0x541E
> -#define TIOCSSERIAL	0x541F
> -#define TIOCPKT		0x5420
> -#define FIONBIO		0x5421
> -#define TIOCNOTTY	0x5422
> -#define TIOCSETD	0x5423
> -#define TIOCGETD	0x5424
> -#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
> -#define TIOCSBRK	0x5427  /* BSD compatibility */
> -#define TIOCCBRK	0x5428  /* BSD compatibility */
> -#define TIOCGSID	0x5429  /* Return the session ID of FD */
> -#define TCGETS2		_IOR('T',0x2A, struct termios2)
> -#define TCSETS2		_IOW('T',0x2B, struct termios2)
> -#define TCSETSW2	_IOW('T',0x2C, struct termios2)
> -#define TCSETSF2	_IOW('T',0x2D, struct termios2)
> -#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
> -#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
> -
> -#define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
> -#define FIOCLEX		0x5451
> -#define FIOASYNC	0x5452
> -#define TIOCSERCONFIG	0x5453
> -#define TIOCSERGWILD	0x5454
> -#define TIOCSERSWILD	0x5455
> -#define TIOCGLCKTRMIOS	0x5456
> -#define TIOCSLCKTRMIOS	0x5457
> -#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
> -#define TIOCSERGETLSR   0x5459 /* Get line status register */
> -#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
> -#define TIOCSERSETMULTI 0x545B /* Set multiport config */
> -
> -#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
> -#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
>  #define TIOCGHAYESESP   0x545E  /* Get Hayes ESP configuration */
>  #define TIOCSHAYESESP   0x545F  /* Set Hayes ESP configuration */
>  #define FIOQSIZE	0x5460
> -
>  #define TIOCSERSETRS485 0x5461  /* enable rs-485 */
>  #define TIOCSERWRRS485  0x5462  /* write rs-485 */
>  
> -/* Used for packet mode */
> -#define TIOCPKT_DATA		 0
> -#define TIOCPKT_FLUSHREAD	 1
> -#define TIOCPKT_FLUSHWRITE	 2
> -#define TIOCPKT_STOP		 4
> -#define TIOCPKT_START		 8
> -#define TIOCPKT_NOSTOP		16
> -#define TIOCPKT_DOSTOP		32
> -
> -#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
> +#include <asm-generic/ioctls.h>
>  
>  #endif
> Index: linux-2.6/include/asm-frv/ioctls.h
> ===================================================================
> --- linux-2.6.orig/include/asm-frv/ioctls.h
> +++ linux-2.6/include/asm-frv/ioctls.h
> @@ -1,82 +1,13 @@
>  #ifndef __ASM_IOCTLS_H__
>  #define __ASM_IOCTLS_H__
>  
> -#include <asm/ioctl.h>
> +#include <asm-generic/ioctls.h>
>  
> -/* 0x54 is just a magic number to make these relatively unique ('T') */
> -
> -#define TCGETS		0x5401
> -#define TCSETS		0x5402
> -#define TCSETSW		0x5403
> -#define TCSETSF		0x5404
> -#define TCGETA		0x5405
> -#define TCSETA		0x5406
> -#define TCSETAW		0x5407
> -#define TCSETAF		0x5408
> -#define TCSBRK		0x5409
> -#define TCXONC		0x540A
> -#define TCFLSH		0x540B
> -#define TIOCEXCL	0x540C
> -#define TIOCNXCL	0x540D
> -#define TIOCSCTTY	0x540E
> -#define TIOCGPGRP	0x540F
> -#define TIOCSPGRP	0x5410
> -#define TIOCOUTQ	0x5411
> -#define TIOCSTI		0x5412
> -#define TIOCGWINSZ	0x5413
> -#define TIOCSWINSZ	0x5414
> -#define TIOCMGET	0x5415
> -#define TIOCMBIS	0x5416
> -#define TIOCMBIC	0x5417
> -#define TIOCMSET	0x5418
> -#define TIOCGSOFTCAR	0x5419
> -#define TIOCSSOFTCAR	0x541A
> -#define FIONREAD	0x541B
> -#define TIOCINQ		FIONREAD
> -#define TIOCLINUX	0x541C
> -#define TIOCCONS	0x541D
> -#define TIOCGSERIAL	0x541E
> -#define TIOCSSERIAL	0x541F
> -#define TIOCPKT		0x5420
> -#define FIONBIO		0x5421
> -#define TIOCNOTTY	0x5422
> -#define TIOCSETD	0x5423
> -#define TIOCGETD	0x5424
> -#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
>  #define TIOCTTYGSTRUCT	0x5426  /* For debugging only */
> -#define TIOCSBRK	0x5427  /* BSD compatibility */
> -#define TIOCCBRK	0x5428  /* BSD compatibility */
> -#define TIOCGSID	0x5429  /* Return the session ID of FD */
> -#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
> -#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
> -
> -#define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
> -#define FIOCLEX		0x5451
> -#define FIOASYNC	0x5452
> -#define TIOCSERCONFIG	0x5453
> -#define TIOCSERGWILD	0x5454
> -#define TIOCSERSWILD	0x5455
> -#define TIOCGLCKTRMIOS	0x5456
> -#define TIOCSLCKTRMIOS	0x5457
> -#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
> -#define TIOCSERGETLSR   0x5459 /* Get line status register */
> -#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
> -#define TIOCSERSETMULTI 0x545B /* Set multiport config */
> -
> -#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
> -#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
> -#define FIOQSIZE	0x545E
> -
> -/* Used for packet mode */
> -#define TIOCPKT_DATA		 0
> -#define TIOCPKT_FLUSHREAD	 1
> -#define TIOCPKT_FLUSHWRITE	 2
> -#define TIOCPKT_STOP		 4
> -#define TIOCPKT_START		 8
> -#define TIOCPKT_NOSTOP		16
> -#define TIOCPKT_DOSTOP		32
> -
> -#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
>  
> -#endif /* __ASM_IOCTLS_H__ */
> +#undef TCGETS2
> +#undef TCSETS2
> +#undef TCSETSW2
> +#undef TCSETSF2
>  
> +#endif
> Index: linux-2.6/include/asm-generic/ioctls.h
> ===================================================================
> --- /dev/null
> +++ linux-2.6/include/asm-generic/ioctls.h
> @@ -0,0 +1,87 @@
> +#ifndef __ASM_ARM_IOCTLS_H
> +#define __ASM_ARM_IOCTLS_H
> +
> +#include <linux/ioctl.h>
> +
> +/* 0x54 is just a magic number to make these relatively unique ('T') */
> +
> +#define TCGETS		0x5401
> +#define TCSETS		0x5402
> +#define TCSETSW		0x5403
> +#define TCSETSF		0x5404
> +#define TCGETA		0x5405
> +#define TCSETA		0x5406
> +#define TCSETAW		0x5407
> +#define TCSETAF		0x5408
> +#define TCSBRK		0x5409
> +#define TCXONC		0x540A
> +#define TCFLSH		0x540B
> +#define TIOCEXCL	0x540C
> +#define TIOCNXCL	0x540D
> +#define TIOCSCTTY	0x540E
> +#define TIOCGPGRP	0x540F
> +#define TIOCSPGRP	0x5410
> +#define TIOCOUTQ	0x5411
> +#define TIOCSTI		0x5412
> +#define TIOCGWINSZ	0x5413
> +#define TIOCSWINSZ	0x5414
> +#define TIOCMGET	0x5415
> +#define TIOCMBIS	0x5416
> +#define TIOCMBIC	0x5417
> +#define TIOCMSET	0x5418
> +#define TIOCGSOFTCAR	0x5419
> +#define TIOCSSOFTCAR	0x541A
> +#define FIONREAD	0x541B
> +#define TIOCINQ		FIONREAD
> +#define TIOCLINUX	0x541C
> +#define TIOCCONS	0x541D
> +#define TIOCGSERIAL	0x541E
> +#define TIOCSSERIAL	0x541F
> +#define TIOCPKT		0x5420
> +#define FIONBIO		0x5421
> +#define TIOCNOTTY	0x5422
> +#define TIOCSETD	0x5423
> +#define TIOCGETD	0x5424
> +#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
> +#define TIOCSBRK	0x5427  /* BSD compatibility */
> +#define TIOCCBRK	0x5428  /* BSD compatibility */
> +#define TIOCGSID	0x5429  /* Return the session ID of FD */
> +#define TCGETS2		_IOR('T', 0x2A, struct termios2)
> +#define TCSETS2		_IOW('T', 0x2B, struct termios2)
> +#define TCSETSW2	_IOW('T', 0x2C, struct termios2)
> +#define TCSETSF2	_IOW('T', 0x2D, struct termios2)
> +#define TIOCGPTN	_IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
> +#define TIOCSPTLCK	_IOW('T', 0x31, int)  /* Lock/unlock Pty */
> +
> +#define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
> +#define FIOCLEX		0x5451
> +#define FIOASYNC	0x5452
> +#define TIOCSERCONFIG	0x5453
> +#define TIOCSERGWILD	0x5454
> +#define TIOCSERSWILD	0x5455
> +#define TIOCGLCKTRMIOS	0x5456
> +#define TIOCSLCKTRMIOS	0x5457
> +#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
> +#define TIOCSERGETLSR   0x5459 /* Get line status register */
> +#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
> +#define TIOCSERSETMULTI 0x545B /* Set multiport config */
> +
> +#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
> +#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
> +
> +#ifndef FIOQSIZE /* some architectures define their own */
> +#define FIOQSIZE	0x545E
> +#endif
> +
> +/* Used for packet mode */
> +#define TIOCPKT_DATA		 0
> +#define TIOCPKT_FLUSHREAD	 1
> +#define TIOCPKT_FLUSHWRITE	 2
> +#define TIOCPKT_STOP		 4
> +#define TIOCPKT_START		 8
> +#define TIOCPKT_NOSTOP		16
> +#define TIOCPKT_DOSTOP		32
> +
> +#define TIOCSER_TEMT	0x01	/* Transmitter physically empty */
> +
> +#endif
> Index: linux-2.6/include/asm-h8300/ioctls.h
> ===================================================================
> --- linux-2.6.orig/include/asm-h8300/ioctls.h
> +++ linux-2.6/include/asm-h8300/ioctls.h
> @@ -1,85 +1,8 @@
>  #ifndef __ARCH_H8300_IOCTLS_H__
>  #define __ARCH_H8300_IOCTLS_H__
>  
> -#include <asm/ioctl.h>
> +#include <asm-generic/ioctls.h>
>  
> -/* 0x54 is just a magic number to make these relatively unique ('T') */
> -
> -#define TCGETS		0x5401
> -#define TCSETS		0x5402
> -#define TCSETSW		0x5403
> -#define TCSETSF		0x5404
> -#define TCGETA		0x5405
> -#define TCSETA		0x5406
> -#define TCSETAW		0x5407
> -#define TCSETAF		0x5408
> -#define TCSBRK		0x5409
> -#define TCXONC		0x540A
> -#define TCFLSH		0x540B
> -#define TIOCEXCL	0x540C
> -#define TIOCNXCL	0x540D
> -#define TIOCSCTTY	0x540E
> -#define TIOCGPGRP	0x540F
> -#define TIOCSPGRP	0x5410
> -#define TIOCOUTQ	0x5411
> -#define TIOCSTI		0x5412
> -#define TIOCGWINSZ	0x5413
> -#define TIOCSWINSZ	0x5414
> -#define TIOCMGET	0x5415
> -#define TIOCMBIS	0x5416
> -#define TIOCMBIC	0x5417
> -#define TIOCMSET	0x5418
> -#define TIOCGSOFTCAR	0x5419
> -#define TIOCSSOFTCAR	0x541A
> -#define FIONREAD	0x541B
> -#define TIOCINQ		FIONREAD
> -#define TIOCLINUX	0x541C
> -#define TIOCCONS	0x541D
> -#define TIOCGSERIAL	0x541E
> -#define TIOCSSERIAL	0x541F
> -#define TIOCPKT		0x5420
> -#define FIONBIO		0x5421
> -#define TIOCNOTTY	0x5422
> -#define TIOCSETD	0x5423
> -#define TIOCGETD	0x5424
> -#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
>  #define TIOCTTYGSTRUCT	0x5426  /* For debugging only */
> -#define TIOCSBRK	0x5427  /* BSD compatibility */
> -#define TIOCCBRK	0x5428  /* BSD compatibility */
> -#define TIOCGSID	0x5429  /* Return the session ID of FD */
> -#define TCGETS2		_IOR('T',0x2A, struct termios2)
> -#define TCSETS2		_IOW('T',0x2B, struct termios2)
> -#define TCSETSW2	_IOW('T',0x2C, struct termios2)
> -#define TCSETSF2	_IOW('T',0x2D, struct termios2)
> -#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
> -#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
> -
> -#define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
> -#define FIOCLEX		0x5451
> -#define FIOASYNC	0x5452
> -#define TIOCSERCONFIG	0x5453
> -#define TIOCSERGWILD	0x5454
> -#define TIOCSERSWILD	0x5455
> -#define TIOCGLCKTRMIOS	0x5456
> -#define TIOCSLCKTRMIOS	0x5457
> -#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
> -#define TIOCSERGETLSR   0x5459 /* Get line status register */
> -#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
> -#define TIOCSERSETMULTI 0x545B /* Set multiport config */
> -
> -#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
> -#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
> -#define FIOQSIZE	0x545E
> -
> -/* Used for packet mode */
> -#define TIOCPKT_DATA		 0
> -#define TIOCPKT_FLUSHREAD	 1
> -#define TIOCPKT_FLUSHWRITE	 2
> -#define TIOCPKT_STOP		 4
> -#define TIOCPKT_START		 8
> -#define TIOCPKT_NOSTOP		16
> -#define TIOCPKT_DOSTOP		32
> -
> -#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
>  
> -#endif /* __ARCH_H8300_IOCTLS_H__ */
> +#endif
> Index: linux-2.6/include/asm-ia64/ioctls.h
> ===================================================================
> --- linux-2.6.orig/include/asm-ia64/ioctls.h
> +++ linux-2.6/include/asm-ia64/ioctls.h
> @@ -1,93 +1,10 @@
>  #ifndef _ASM_IA64_IOCTLS_H
>  #define _ASM_IA64_IOCTLS_H
>  
> -/*
> - * Based on <asm-i386/ioctls.h>
> - *
> - * Modified 1998, 1999, 2002
> - *	David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
> - */
> -
> -#include <asm/ioctl.h>
> -
> -/* 0x54 is just a magic number to make these relatively unique ('T') */
> -
> -#define TCGETS		0x5401
> -#define TCSETS		0x5402	/* Clashes with SNDCTL_TMR_START sound ioctl */
> -#define TCSETSW		0x5403
> -#define TCSETSF		0x5404
> -#define TCGETA		0x5405
> -#define TCSETA		0x5406
> -#define TCSETAW		0x5407
> -#define TCSETAF		0x5408
> -#define TCSBRK		0x5409
> -#define TCXONC		0x540A
> -#define TCFLSH		0x540B
> -#define TIOCEXCL	0x540C
> -#define TIOCNXCL	0x540D
> -#define TIOCSCTTY	0x540E
> -#define TIOCGPGRP	0x540F
> -#define TIOCSPGRP	0x5410
> -#define TIOCOUTQ	0x5411
> -#define TIOCSTI		0x5412
> -#define TIOCGWINSZ	0x5413
> -#define TIOCSWINSZ	0x5414
> -#define TIOCMGET	0x5415
> -#define TIOCMBIS	0x5416
> -#define TIOCMBIC	0x5417
> -#define TIOCMSET	0x5418
> -#define TIOCGSOFTCAR	0x5419
> -#define TIOCSSOFTCAR	0x541A
> -#define FIONREAD	0x541B
> -#define TIOCINQ		FIONREAD
> -#define TIOCLINUX	0x541C
> -#define TIOCCONS	0x541D
> -#define TIOCGSERIAL	0x541E
> -#define TIOCSSERIAL	0x541F
> -#define TIOCPKT		0x5420
> -#define FIONBIO		0x5421
> -#define TIOCNOTTY	0x5422
> -#define TIOCSETD	0x5423
> -#define TIOCGETD	0x5424
> -#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
> -#define TIOCSBRK	0x5427  /* BSD compatibility */
> -#define TIOCCBRK	0x5428  /* BSD compatibility */
> -#define TIOCGSID	0x5429  /* Return the session ID of FD */
> -#define TCGETS2		_IOR('T',0x2A, struct termios2)
> -#define TCSETS2		_IOW('T',0x2B, struct termios2)
> -#define TCSETSW2	_IOW('T',0x2C, struct termios2)
> -#define TCSETSF2	_IOW('T',0x2D, struct termios2)
> -#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
> -#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
> -
> -#define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
> -#define FIOCLEX		0x5451
> -#define FIOASYNC	0x5452
> -#define TIOCSERCONFIG	0x5453
> -#define TIOCSERGWILD	0x5454
> -#define TIOCSERSWILD	0x5455
> -#define TIOCGLCKTRMIOS	0x5456
> -#define TIOCSLCKTRMIOS	0x5457
> -#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
> -#define TIOCSERGETLSR   0x5459 /* Get line status register */
> -#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
> -#define TIOCSERSETMULTI 0x545B /* Set multiport config */
> -
> -#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
> -#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
>  #define TIOCGHAYESESP   0x545E  /* Get Hayes ESP configuration */
>  #define TIOCSHAYESESP   0x545F  /* Set Hayes ESP configuration */
>  #define FIOQSIZE	0x5460
>  
> -/* Used for packet mode */
> -#define TIOCPKT_DATA		 0
> -#define TIOCPKT_FLUSHREAD	 1
> -#define TIOCPKT_FLUSHWRITE	 2
> -#define TIOCPKT_STOP		 4
> -#define TIOCPKT_START		 8
> -#define TIOCPKT_NOSTOP		16
> -#define TIOCPKT_DOSTOP		32
> -
> -#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
> +#include <asm-generic/ioctls.h>
>  
> -#endif /* _ASM_IA64_IOCTLS_H */
> +#endif
> Index: linux-2.6/include/asm-m32r/ioctls.h
> ===================================================================
> --- linux-2.6.orig/include/asm-m32r/ioctls.h
> +++ linux-2.6/include/asm-m32r/ioctls.h
> @@ -1,87 +1,11 @@
>  #ifndef __ARCH_M32R_IOCTLS_H__
>  #define __ARCH_M32R_IOCTLS_H__
>  
> -#include <asm/ioctl.h>
> -
> -/* 0x54 is just a magic number to make these relatively unique ('T') */
> -
> -#define TCGETS		0x5401
> -#define TCSETS		0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */
> -#define TCSETSW		0x5403
> -#define TCSETSF		0x5404
> -#define TCGETA		0x5405
> -#define TCSETA		0x5406
> -#define TCSETAW		0x5407
> -#define TCSETAF		0x5408
> -#define TCSBRK		0x5409
> -#define TCXONC		0x540A
> -#define TCFLSH		0x540B
> -#define TIOCEXCL	0x540C
> -#define TIOCNXCL	0x540D
> -#define TIOCSCTTY	0x540E
> -#define TIOCGPGRP	0x540F
> -#define TIOCSPGRP	0x5410
> -#define TIOCOUTQ	0x5411
> -#define TIOCSTI		0x5412
> -#define TIOCGWINSZ	0x5413
> -#define TIOCSWINSZ	0x5414
> -#define TIOCMGET	0x5415
> -#define TIOCMBIS	0x5416
> -#define TIOCMBIC	0x5417
> -#define TIOCMSET	0x5418
> -#define TIOCGSOFTCAR	0x5419
> -#define TIOCSSOFTCAR	0x541A
> -#define FIONREAD	0x541B
> -#define TIOCINQ		FIONREAD
> -#define TIOCLINUX	0x541C
> -#define TIOCCONS	0x541D
> -#define TIOCGSERIAL	0x541E
> -#define TIOCSSERIAL	0x541F
> -#define TIOCPKT		0x5420
> -#define FIONBIO		0x5421
> -#define TIOCNOTTY	0x5422
> -#define TIOCSETD	0x5423
> -#define TIOCGETD	0x5424
> -#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
>  /* #define TIOCTTYGSTRUCT 0x5426 - Former debugging-only ioctl */
> -#define TIOCSBRK	0x5427  /* BSD compatibility */
> -#define TIOCCBRK	0x5428  /* BSD compatibility */
> -#define TIOCGSID	0x5429  /* Return the session ID of FD */
> -#define TCGETS2		_IOR('T',0x2A, struct termios2)
> -#define TCSETS2		_IOW('T',0x2B, struct termios2)
> -#define TCSETSW2	_IOW('T',0x2C, struct termios2)
> -#define TCSETSF2	_IOW('T',0x2D, struct termios2)
> -#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
> -#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
> -
> -#define FIONCLEX	0x5450
> -#define FIOCLEX		0x5451
> -#define FIOASYNC	0x5452
> -#define TIOCSERCONFIG	0x5453
> -#define TIOCSERGWILD	0x5454
> -#define TIOCSERSWILD	0x5455
> -#define TIOCGLCKTRMIOS	0x5456
> -#define TIOCSLCKTRMIOS	0x5457
> -#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
> -#define TIOCSERGETLSR   0x5459 /* Get line status register */
> -#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
> -#define TIOCSERSETMULTI 0x545B /* Set multiport config */
> -
> -#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
> -#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
>  #define TIOCGHAYESESP   0x545E  /* Get Hayes ESP configuration */
>  #define TIOCSHAYESESP   0x545F  /* Set Hayes ESP configuration */
>  #define FIOQSIZE	0x5460
>  
> -/* Used for packet mode */
> -#define TIOCPKT_DATA		 0
> -#define TIOCPKT_FLUSHREAD	 1
> -#define TIOCPKT_FLUSHWRITE	 2
> -#define TIOCPKT_STOP		 4
> -#define TIOCPKT_START		 8
> -#define TIOCPKT_NOSTOP		16
> -#define TIOCPKT_DOSTOP		32
> -
> -#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
> +#include <asm-generic/ioctls.h>
>  
> -#endif /* __ARCH_M32R_IOCTLS_H__ */
> +#endif
> Index: linux-2.6/include/asm-m68k/ioctls.h
> ===================================================================
> --- linux-2.6.orig/include/asm-m68k/ioctls.h
> +++ linux-2.6/include/asm-m68k/ioctls.h
> @@ -1,84 +1,6 @@
>  #ifndef __ARCH_M68K_IOCTLS_H__
>  #define __ARCH_M68K_IOCTLS_H__
>  
> -#include <asm/ioctl.h>
> +#include <asm-generic/ioctls.h>
>  
> -/* 0x54 is just a magic number to make these relatively unique ('T') */
> -
> -#define TCGETS		0x5401
> -#define TCSETS		0x5402
> -#define TCSETSW		0x5403
> -#define TCSETSF		0x5404
> -#define TCGETA		0x5405
> -#define TCSETA		0x5406
> -#define TCSETAW		0x5407
> -#define TCSETAF		0x5408
> -#define TCSBRK		0x5409
> -#define TCXONC		0x540A
> -#define TCFLSH		0x540B
> -#define TIOCEXCL	0x540C
> -#define TIOCNXCL	0x540D
> -#define TIOCSCTTY	0x540E
> -#define TIOCGPGRP	0x540F
> -#define TIOCSPGRP	0x5410
> -#define TIOCOUTQ	0x5411
> -#define TIOCSTI		0x5412
> -#define TIOCGWINSZ	0x5413
> -#define TIOCSWINSZ	0x5414
> -#define TIOCMGET	0x5415
> -#define TIOCMBIS	0x5416
> -#define TIOCMBIC	0x5417
> -#define TIOCMSET	0x5418
> -#define TIOCGSOFTCAR	0x5419
> -#define TIOCSSOFTCAR	0x541A
> -#define FIONREAD	0x541B
> -#define TIOCINQ		FIONREAD
> -#define TIOCLINUX	0x541C
> -#define TIOCCONS	0x541D
> -#define TIOCGSERIAL	0x541E
> -#define TIOCSSERIAL	0x541F
> -#define TIOCPKT		0x5420
> -#define FIONBIO		0x5421
> -#define TIOCNOTTY	0x5422
> -#define TIOCSETD	0x5423
> -#define TIOCGETD	0x5424
> -#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
> -#define TIOCSBRK	0x5427  /* BSD compatibility */
> -#define TIOCCBRK	0x5428  /* BSD compatibility */
> -#define TIOCGSID	0x5429  /* Return the session ID of FD */
> -#define TCGETS2		_IOR('T',0x2A, struct termios2)
> -#define TCSETS2		_IOW('T',0x2B, struct termios2)
> -#define TCSETSW2	_IOW('T',0x2C, struct termios2)
> -#define TCSETSF2	_IOW('T',0x2D, struct termios2)
> -#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
> -#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
> -
> -#define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
> -#define FIOCLEX		0x5451
> -#define FIOASYNC	0x5452
> -#define TIOCSERCONFIG	0x5453
> -#define TIOCSERGWILD	0x5454
> -#define TIOCSERSWILD	0x5455
> -#define TIOCGLCKTRMIOS	0x5456
> -#define TIOCSLCKTRMIOS	0x5457
> -#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
> -#define TIOCSERGETLSR   0x5459 /* Get line status register */
> -#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
> -#define TIOCSERSETMULTI 0x545B /* Set multiport config */
> -
> -#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
> -#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
> -#define FIOQSIZE	0x545E
> -
> -/* Used for packet mode */
> -#define TIOCPKT_DATA		 0
> -#define TIOCPKT_FLUSHREAD	 1
> -#define TIOCPKT_FLUSHWRITE	 2
> -#define TIOCPKT_STOP		 4
> -#define TIOCPKT_START		 8
> -#define TIOCPKT_NOSTOP		16
> -#define TIOCPKT_DOSTOP		32
> -
> -#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
> -
> -#endif /* __ARCH_M68K_IOCTLS_H__ */
> +#endif
> Index: linux-2.6/include/asm-microblaze/ioctls.h
> ===================================================================
> --- linux-2.6.orig/include/asm-microblaze/ioctls.h
> +++ linux-2.6/include/asm-microblaze/ioctls.h
> @@ -11,83 +11,6 @@
>  #ifndef _ASM_MICROBLAZE_IOCTLS_H
>  #define _ASM_MICROBLAZE_IOCTLS_H
>  
> -#include <asm/ioctl.h>
> +#include <asm-generic/ioctls.h>
>  
> -/* 0x54 is just a magic number to make these relatively unique ('T') */
> -
> -#define TCGETS		0x5401
> -#define TCSETS		0x5402
> -#define TCSETSW		0x5403
> -#define TCSETSF		0x5404
> -#define TCGETA		0x5405
> -#define TCSETA		0x5406
> -#define TCSETAW		0x5407
> -#define TCSETAF		0x5408
> -#define TCSBRK		0x5409
> -#define TCXONC		0x540A
> -#define TCFLSH		0x540B
> -#define TIOCEXCL	0x540C
> -#define TIOCNXCL	0x540D
> -#define TIOCSCTTY	0x540E
> -#define TIOCGPGRP	0x540F
> -#define TIOCSPGRP	0x5410
> -#define TIOCOUTQ	0x5411
> -#define TIOCSTI		0x5412
> -#define TIOCGWINSZ	0x5413
> -#define TIOCSWINSZ	0x5414
> -#define TIOCMGET	0x5415
> -#define TIOCMBIS	0x5416
> -#define TIOCMBIC	0x5417
> -#define TIOCMSET	0x5418
> -#define TIOCGSOFTCAR	0x5419
> -#define TIOCSSOFTCAR	0x541A
> -#define FIONREAD	0x541B
> -#define TIOCINQ		FIONREAD
> -#define TIOCLINUX	0x541C
> -#define TIOCCONS	0x541D
> -#define TIOCGSERIAL	0x541E
> -#define TIOCSSERIAL	0x541F
> -#define TIOCPKT		0x5420
> -#define FIONBIO		0x5421
> -#define TIOCNOTTY	0x5422
> -#define TIOCSETD	0x5423
> -#define TIOCGETD	0x5424
> -#define TCSBRKP		0x5425 /* Needed for POSIX tcsendbreak() */
> -#define TIOCTTYGSTRUCT	0x5426 /* For debugging only */
> -#define TIOCSBRK	0x5427 /* BSD compatibility */
> -#define TIOCCBRK	0x5428 /* BSD compatibility */
> -#define TIOCGSID	0x5429 /* Return the session ID of FD */
> -/* Get Pty Number (of pty-mux device) */
> -#define TIOCGPTN	_IOR('T', 0x30, unsigned int)
> -#define TIOCSPTLCK	_IOW('T', 0x31, int) /* Lock/unlock Pty */
> -
> -#define FIONCLEX	0x5450 /* these numbers need to be adjusted. */
> -#define FIOCLEX		0x5451
> -#define FIOASYNC	0x5452
> -#define TIOCSERCONFIG	0x5453
> -#define TIOCSERGWILD	0x5454
> -#define TIOCSERSWILD	0x5455
> -#define TIOCGLCKTRMIOS	0x5456
> -#define TIOCSLCKTRMIOS	0x5457
> -#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
> -#define TIOCSERGETLSR	0x5459 /* Get line status register */
> -#define TIOCSERGETMULTI 0x545A /* Get multiport config */
> -#define TIOCSERSETMULTI 0x545B /* Set multiport config */
> -
> -#define TIOCMIWAIT	0x545C /* wait for a change on serial input line(s) */
> -#define TIOCGICOUNT	0x545D /* read serial port inline interrupt counts */
> -
> -#define	FIOQSIZE	0x545E
> -
> -/* Used for packet mode */
> -#define TIOCPKT_DATA		0
> -#define TIOCPKT_FLUSHREAD	1
> -#define TIOCPKT_FLUSHWRITE	2
> -#define TIOCPKT_STOP		4
> -#define TIOCPKT_START		8
> -#define TIOCPKT_NOSTOP		16
> -#define TIOCPKT_DOSTOP		32
> -
> -#define TIOCSER_TEMT	0x01 /* Transmitter physically empty */
> -
> -#endif /* _ASM_MICROBLAZE_IOCTLS_H */
> +#endif
> Index: linux-2.6/include/asm-mn10300/ioctls.h
> ===================================================================
> --- linux-2.6.orig/include/asm-mn10300/ioctls.h
> +++ linux-2.6/include/asm-mn10300/ioctls.h
> @@ -1,88 +1,12 @@
>  #ifndef _ASM_IOCTLS_H
>  #define _ASM_IOCTLS_H
>  
> -#include <asm/ioctl.h>
> -
> -/* 0x54 is just a magic number to make these relatively unique ('T') */
> -
> -#define TCGETS		0x5401
> -#define TCSETS		0x5402
> -#define TCSETSW		0x5403
> -#define TCSETSF		0x5404
> -#define TCGETA		0x5405
> -#define TCSETA		0x5406
> -#define TCSETAW		0x5407
> -#define TCSETAF		0x5408
> -#define TCSBRK		0x5409
> -#define TCXONC		0x540A
> -#define TCFLSH		0x540B
> -#define TIOCEXCL	0x540C
> -#define TIOCNXCL	0x540D
> -#define TIOCSCTTY	0x540E
> -#define TIOCGPGRP	0x540F
> -#define TIOCSPGRP	0x5410
> -#define TIOCOUTQ	0x5411
> -#define TIOCSTI		0x5412
> -#define TIOCGWINSZ	0x5413
> -#define TIOCSWINSZ	0x5414
> -#define TIOCMGET	0x5415
> -#define TIOCMBIS	0x5416
> -#define TIOCMBIC	0x5417
> -#define TIOCMSET	0x5418
> -#define TIOCGSOFTCAR	0x5419
> -#define TIOCSSOFTCAR	0x541A
> -#define FIONREAD	0x541B
> -#define TIOCINQ		FIONREAD
> -#define TIOCLINUX	0x541C
> -#define TIOCCONS	0x541D
> -#define TIOCGSERIAL	0x541E
> -#define TIOCSSERIAL	0x541F
> -#define TIOCPKT		0x5420
> -#define FIONBIO		0x5421
> -#define TIOCNOTTY	0x5422
> -#define TIOCSETD	0x5423
> -#define TIOCGETD	0x5424
> -#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
>  /* #define TIOCTTYGSTRUCT 0x5426 - Former debugging-only ioctl */
> -#define TIOCSBRK	0x5427  /* BSD compatibility */
> -#define TIOCCBRK	0x5428  /* BSD compatibility */
> -#define TIOCGSID	0x5429  /* Return the session ID of FD */
> -#define TCGETS2		_IOR('T', 0x2A, struct termios2)
> -#define TCSETS2		_IOW('T', 0x2B, struct termios2)
> -#define TCSETSW2	_IOW('T', 0x2C, struct termios2)
> -#define TCSETSF2	_IOW('T', 0x2D, struct termios2)
> -#define TIOCGPTN	_IOR('T', 0x30, unsigned int) /* Get Pty Number
> -						       * (of pty-mux device) */
> -#define TIOCSPTLCK	_IOW('T', 0x31, int)  /* Lock/unlock Pty */
> -
> -#define FIONCLEX	0x5450
> -#define FIOCLEX		0x5451
> -#define FIOASYNC	0x5452
> -#define TIOCSERCONFIG	0x5453
> -#define TIOCSERGWILD	0x5454
> -#define TIOCSERSWILD	0x5455
> -#define TIOCGLCKTRMIOS	0x5456
> -#define TIOCSLCKTRMIOS	0x5457
> -#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
> -#define TIOCSERGETLSR   0x5459 /* Get line status register */
> -#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
> -#define TIOCSERSETMULTI 0x545B /* Set multiport config */
> -
> -#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
> -#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
>  #define TIOCGHAYESESP   0x545E  /* Get Hayes ESP configuration */
>  #define TIOCSHAYESESP   0x545F  /* Set Hayes ESP configuration */
>  #define FIOQSIZE	0x5460
>  
> -/* Used for packet mode */
> -#define TIOCPKT_DATA		 0
> -#define TIOCPKT_FLUSHREAD	 1
> -#define TIOCPKT_FLUSHWRITE	 2
> -#define TIOCPKT_STOP		 4
> -#define TIOCPKT_START		 8
> -#define TIOCPKT_NOSTOP		16
> -#define TIOCPKT_DOSTOP		32
> +#include <asm-generic/ioctls.h>
>  
> -#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
>  
> -#endif /* _ASM_IOCTLS_H */
> +#endif
> Index: linux-2.6/include/asm-parisc/ioctls.h
> ===================================================================
> --- linux-2.6.orig/include/asm-parisc/ioctls.h
> +++ linux-2.6/include/asm-parisc/ioctls.h
> @@ -81,6 +81,6 @@
>  #define TIOCPKT_NOSTOP		16
>  #define TIOCPKT_DOSTOP		32
>  
> -#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
> +#define TIOCSER_TEMT	0x01	/* Transmitter physically empty */
>  
> -#endif /* _ASM_PARISC_IOCTLS_H */
> +#endif
> Index: linux-2.6/include/asm-s390/ioctls.h
> ===================================================================
> --- linux-2.6.orig/include/asm-s390/ioctls.h
> +++ linux-2.6/include/asm-s390/ioctls.h
> @@ -1,92 +1,6 @@
> -/*
> - *  include/asm-s390/ioctls.h
> - *
> - *  S390 version
> - *
> - *  Derived from "include/asm-i386/ioctls.h"
> - */
> -
>  #ifndef __ARCH_S390_IOCTLS_H__
>  #define __ARCH_S390_IOCTLS_H__
>  
> -#include <asm/ioctl.h>
> -
> -/* 0x54 is just a magic number to make these relatively unique ('T') */
> -
> -#define TCGETS		0x5401
> -#define TCSETS		0x5402
> -#define TCSETSW		0x5403
> -#define TCSETSF		0x5404
> -#define TCGETA		0x5405
> -#define TCSETA		0x5406
> -#define TCSETAW		0x5407
> -#define TCSETAF		0x5408
> -#define TCSBRK		0x5409
> -#define TCXONC		0x540A
> -#define TCFLSH		0x540B
> -#define TIOCEXCL	0x540C
> -#define TIOCNXCL	0x540D
> -#define TIOCSCTTY	0x540E
> -#define TIOCGPGRP	0x540F
> -#define TIOCSPGRP	0x5410
> -#define TIOCOUTQ	0x5411
> -#define TIOCSTI		0x5412
> -#define TIOCGWINSZ	0x5413
> -#define TIOCSWINSZ	0x5414
> -#define TIOCMGET	0x5415
> -#define TIOCMBIS	0x5416
> -#define TIOCMBIC	0x5417
> -#define TIOCMSET	0x5418
> -#define TIOCGSOFTCAR	0x5419
> -#define TIOCSSOFTCAR	0x541A
> -#define FIONREAD	0x541B
> -#define TIOCINQ		FIONREAD
> -#define TIOCLINUX	0x541C
> -#define TIOCCONS	0x541D
> -#define TIOCGSERIAL	0x541E
> -#define TIOCSSERIAL	0x541F
> -#define TIOCPKT		0x5420
> -#define FIONBIO		0x5421
> -#define TIOCNOTTY	0x5422
> -#define TIOCSETD	0x5423
> -#define TIOCGETD	0x5424
> -#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
> -#define TIOCSBRK	0x5427  /* BSD compatibility */
> -#define TIOCCBRK	0x5428  /* BSD compatibility */
> -#define TIOCGSID	0x5429  /* Return the session ID of FD */
> -#define TCGETS2		_IOR('T',0x2A, struct termios2)
> -#define TCSETS2		_IOW('T',0x2B, struct termios2)
> -#define TCSETSW2	_IOW('T',0x2C, struct termios2)
> -#define TCSETSF2	_IOW('T',0x2D, struct termios2)
> -#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
> -#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
> -
> -#define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
> -#define FIOCLEX		0x5451
> -#define FIOASYNC	0x5452
> -#define TIOCSERCONFIG	0x5453
> -#define TIOCSERGWILD	0x5454
> -#define TIOCSERSWILD	0x5455
> -#define TIOCGLCKTRMIOS	0x5456
> -#define TIOCSLCKTRMIOS	0x5457
> -#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
> -#define TIOCSERGETLSR   0x5459 /* Get line status register */
> -#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
> -#define TIOCSERSETMULTI 0x545B /* Set multiport config */
> -
> -#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
> -#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
> -#define FIOQSIZE	0x545E
> -
> -/* Used for packet mode */
> -#define TIOCPKT_DATA		 0
> -#define TIOCPKT_FLUSHREAD	 1
> -#define TIOCPKT_FLUSHWRITE	 2
> -#define TIOCPKT_STOP		 4
> -#define TIOCPKT_START		 8
> -#define TIOCPKT_NOSTOP		16
> -#define TIOCPKT_DOSTOP		32
> -
> -#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
> +#include <asm-generic/ioctls.h>
>  
>  #endif
> Index: linux-2.6/include/asm-v850/ioctls.h
> ===================================================================
> --- linux-2.6.orig/include/asm-v850/ioctls.h
> +++ linux-2.6/include/asm-v850/ioctls.h
> @@ -1,84 +1,6 @@
>  #ifndef __V850_IOCTLS_H__
>  #define __V850_IOCTLS_H__
>  
> -#include <asm/ioctl.h>
> +#include <asm-generic/ioctls.h>
>  
> -/* 0x54 is just a magic number to make these relatively unique ('T') */
> -
> -#define TCGETS		0x5401
> -#define TCSETS		0x5402
> -#define TCSETSW		0x5403
> -#define TCSETSF		0x5404
> -#define TCGETA		0x5405
> -#define TCSETA		0x5406
> -#define TCSETAW		0x5407
> -#define TCSETAF		0x5408
> -#define TCSBRK		0x5409
> -#define TCXONC		0x540A
> -#define TCFLSH		0x540B
> -#define TIOCEXCL	0x540C
> -#define TIOCNXCL	0x540D
> -#define TIOCSCTTY	0x540E
> -#define TIOCGPGRP	0x540F
> -#define TIOCSPGRP	0x5410
> -#define TIOCOUTQ	0x5411
> -#define TIOCSTI		0x5412
> -#define TIOCGWINSZ	0x5413
> -#define TIOCSWINSZ	0x5414
> -#define TIOCMGET	0x5415
> -#define TIOCMBIS	0x5416
> -#define TIOCMBIC	0x5417
> -#define TIOCMSET	0x5418
> -#define TIOCGSOFTCAR	0x5419
> -#define TIOCSSOFTCAR	0x541A
> -#define FIONREAD	0x541B
> -#define TIOCINQ		FIONREAD
> -#define TIOCLINUX	0x541C
> -#define TIOCCONS	0x541D
> -#define TIOCGSERIAL	0x541E
> -#define TIOCSSERIAL	0x541F
> -#define TIOCPKT		0x5420
> -#define FIONBIO		0x5421
> -#define TIOCNOTTY	0x5422
> -#define TIOCSETD	0x5423
> -#define TIOCGETD	0x5424
> -#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
> -#define TIOCSBRK	0x5427  /* BSD compatibility */
> -#define TIOCCBRK	0x5428  /* BSD compatibility */
> -#define TIOCGSID	0x5429  /* Return the session ID of FD */
> -#define TCGETS2		_IOR('T',0x2A, struct termios2)
> -#define TCSETS2		_IOW('T',0x2B, struct termios2)
> -#define TCSETSW2	_IOW('T',0x2C, struct termios2)
> -#define TCSETSF2	_IOW('T',0x2D, struct termios2)
> -#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
> -#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
> -
> -#define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
> -#define FIOCLEX		0x5451
> -#define FIOASYNC	0x5452
> -#define TIOCSERCONFIG	0x5453
> -#define TIOCSERGWILD	0x5454
> -#define TIOCSERSWILD	0x5455
> -#define TIOCGLCKTRMIOS	0x5456
> -#define TIOCSLCKTRMIOS	0x5457
> -#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
> -#define TIOCSERGETLSR   0x5459 /* Get line status register */
> -#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
> -#define TIOCSERSETMULTI 0x545B /* Set multiport config */
> -
> -#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
> -#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
> -#define FIOQSIZE	0x545E
> -
> -/* Used for packet mode */
> -#define TIOCPKT_DATA		 0
> -#define TIOCPKT_FLUSHREAD	 1
> -#define TIOCPKT_FLUSHWRITE	 2
> -#define TIOCPKT_STOP		 4
> -#define TIOCPKT_START		 8
> -#define TIOCPKT_NOSTOP		16
> -#define TIOCPKT_DOSTOP		32
> -
> -#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
> -
> -#endif /* __V850_IOCTLS_H__ */
> +#endif
> Index: linux-2.6/include/asm-x86/ioctls.h
> ===================================================================
> --- linux-2.6.orig/include/asm-x86/ioctls.h
> +++ linux-2.6/include/asm-x86/ioctls.h
> @@ -1,88 +1,10 @@
>  #ifndef _ASM_X86_IOCTLS_H
>  #define _ASM_X86_IOCTLS_H
>  
> -#include <asm/ioctl.h>
> -
> -/* 0x54 is just a magic number to make these relatively unique ('T') */
> -
> -#define TCGETS		0x5401
> -#define TCSETS		0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */
> -#define TCSETSW		0x5403
> -#define TCSETSF		0x5404
> -#define TCGETA		0x5405
> -#define TCSETA		0x5406
> -#define TCSETAW		0x5407
> -#define TCSETAF		0x5408
> -#define TCSBRK		0x5409
> -#define TCXONC		0x540A
> -#define TCFLSH		0x540B
> -#define TIOCEXCL	0x540C
> -#define TIOCNXCL	0x540D
> -#define TIOCSCTTY	0x540E
> -#define TIOCGPGRP	0x540F
> -#define TIOCSPGRP	0x5410
> -#define TIOCOUTQ	0x5411
> -#define TIOCSTI		0x5412
> -#define TIOCGWINSZ	0x5413
> -#define TIOCSWINSZ	0x5414
> -#define TIOCMGET	0x5415
> -#define TIOCMBIS	0x5416
> -#define TIOCMBIC	0x5417
> -#define TIOCMSET	0x5418
> -#define TIOCGSOFTCAR	0x5419
> -#define TIOCSSOFTCAR	0x541A
> -#define FIONREAD	0x541B
> -#define TIOCINQ		FIONREAD
> -#define TIOCLINUX	0x541C
> -#define TIOCCONS	0x541D
> -#define TIOCGSERIAL	0x541E
> -#define TIOCSSERIAL	0x541F
> -#define TIOCPKT		0x5420
> -#define FIONBIO		0x5421
> -#define TIOCNOTTY	0x5422
> -#define TIOCSETD	0x5423
> -#define TIOCGETD	0x5424
> -#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
> -/* #define TIOCTTYGSTRUCT 0x5426 - Former debugging-only ioctl */
> -#define TIOCSBRK	0x5427  /* BSD compatibility */
> -#define TIOCCBRK	0x5428  /* BSD compatibility */
> -#define TIOCGSID	0x5429  /* Return the session ID of FD */
> -#define TCGETS2		_IOR('T', 0x2A, struct termios2)
> -#define TCSETS2		_IOW('T', 0x2B, struct termios2)
> -#define TCSETSW2	_IOW('T', 0x2C, struct termios2)
> -#define TCSETSF2	_IOW('T', 0x2D, struct termios2)
> -#define TIOCGPTN	_IOR('T', 0x30, unsigned int)
> -				/* Get Pty Number (of pty-mux device) */
> -#define TIOCSPTLCK	_IOW('T', 0x31, int)  /* Lock/unlock Pty */
> -
> -#define FIONCLEX	0x5450
> -#define FIOCLEX		0x5451
> -#define FIOASYNC	0x5452
> -#define TIOCSERCONFIG	0x5453
> -#define TIOCSERGWILD	0x5454
> -#define TIOCSERSWILD	0x5455
> -#define TIOCGLCKTRMIOS	0x5456
> -#define TIOCSLCKTRMIOS	0x5457
> -#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
> -#define TIOCSERGETLSR   0x5459 /* Get line status register */
> -#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
> -#define TIOCSERSETMULTI 0x545B /* Set multiport config */
> -
> -#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
> -#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
>  #define TIOCGHAYESESP   0x545E  /* Get Hayes ESP configuration */
>  #define TIOCSHAYESESP   0x545F  /* Set Hayes ESP configuration */
>  #define FIOQSIZE	0x5460
>  
> -/* Used for packet mode */
> -#define TIOCPKT_DATA		 0
> -#define TIOCPKT_FLUSHREAD	 1
> -#define TIOCPKT_FLUSHWRITE	 2
> -#define TIOCPKT_STOP		 4
> -#define TIOCPKT_START		 8
> -#define TIOCPKT_NOSTOP		16
> -#define TIOCPKT_DOSTOP		32
> -
> -#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
> +#include <asm-generic/ioctls.h>
>  
>  #endif
> 
> 

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 47/56] microblaze_v2: device.h param.h topology.h
  2008-05-04 22:37                                                                                               ` [PATCH 47/56] microblaze_v2: device.h param.h topology.h Arnd Bergmann
@ 2008-05-05 14:07                                                                                                 ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-05 14:07 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kernel, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

I reduced device.h. Remove NUMA from structure and comment NUMA in OF files.
param.h moved to generic folder.

M

>> +#ifndef _ASM_MICROBLAZE_DEVICE_H
>> +#define _ASM_MICROBLAZE_DEVICE_H
>> +
>> +struct dma_mapping_ops;
>> +struct device_node;
>> +
>> +struct dev_archdata {
>> +	/* Optional pointer to an OF device node */
>> +	struct device_node	*of_node;
>> +
>> +	/* DMA operations on that device */
>> +	struct dma_mapping_ops	*dma_ops;
>> +	void			*dma_data;
>> +
>> +	/* NUMA node if applicable */
>> +	int			numa_node;
>> +};
> 
> microblaze doesn't have NUMA or dma_mapping_ops, afaict, so it should
> just be
> 
> struct dev_archdata {
> 	/* Optional pointer to an OF device node */
> 	struct device_node	*of_node;
> };
> 
>> --- /dev/null
>> +++ b/include/asm-microblaze/param.h
>> @@ -0,0 +1,36 @@
>> +/*
>> + * include/asm-microblaze/param.h
>> + *
>> + * This file is subject to the terms and conditions of the GNU General Public
>> + * License. See the file "COPYING" in the main directory of this archive
>> + * for more details.
>> + *
>> + * Copyright (C) 2006 Atmark Techno, Inc.
>> + */
>> +
>> +#ifndef _ASM_MICROBLAZE_PARAM_H
>> +#define _ASM_MICROBLAZE_PARAM_H
>> +
>> +#ifdef __KERNEL__
>> +# define HZ		100 /* internal timer frequency */
>> +# define USER_HZ	100 /* for user interfaces in "ticks" */
>> +# define CLOCKS_PER_SEC (USER_HZ) /* frequnzy at which times() counts */
>> +#endif
>> +
>> +#ifndef NGROUPS
>> +#define NGROUPS		32
>> +#endif
>> +
>> +#ifndef NOGROUP
>> +#define NOGROUP		(-1)
>> +#endif
>> +
>> +#define EXEC_PAGESIZE	4096
>> +
>> +#ifndef HZ
>> +#define HZ 100
>> +#endif
>> +
>> +#define MAXHOSTNAMELEN	64 /* max length of hostname */
>> +
>> +#endif /* _ASM_MICROBLAZE_PARAM_H */
> 
> These parameters are so common that they should become asm-generic/param.h.
> 4kb page size is of course a HW feature, but it's so universal that it's almost
> a natural constant ;-)
> 
>> --- /dev/null
>> +++ b/include/asm-microblaze/topology.h
>> @@ -0,0 +1,119 @@
>> +/*
>> + * include/asm-microblaze/topology.h
> 
> please use the existing asm-generic/topology.h here.
> 
> 	Arnd <><
> 
> 

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 49/56] microblaze_v2: fcntl.h sockios.h ucontext.h
  2008-05-04 22:43                                                                                                   ` [PATCH 49/56] microblaze_v2: fcntl.h sockios.h ucontext.h Arnd Bergmann
@ 2008-05-05 14:08                                                                                                     ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-05 14:08 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kernel, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

FIXED


> On Sunday 04 May 2008, monstr@seznam.cz wrote:
>>  include/asm-microblaze/fcntl.h    |  104 +++++++++++++++++++++++++++++++++++++
> 
> Use the existing asm-generic version for this.
> 
>>  include/asm-microblaze/sockios.h  |   25 +++++++++
>>  include/asm-microblaze/ucontext.h |   24 +++++++++
> 
> turn these into asm-generic versions.
> 
> 	Arnd <><
> 
> 

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 52/56] microblaze_v2: pci headers
  2008-05-04 22:45                                                                                                         ` [PATCH 52/56] microblaze_v2: pci headers Arnd Bergmann
@ 2008-05-05 14:08                                                                                                           ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-05 14:08 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kernel, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek


FIXED

>> +
>> +#ifdef __KERNEL__
>> +#include <asm/io.h>
>> +#endif
> 
> You don't export asm/pci.h to userspace, so the #ifdef __KERNEL__ is
> not needed.
> 
> 	Arnd <><
> 
> 

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 01/56] microblaze_v2: Kconfig patches
  2008-05-05  1:42   ` John Williams
  2008-05-05  6:46     ` Michal Simek
@ 2008-05-05 14:16     ` Michal Simek
  1 sibling, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-05 14:16 UTC (permalink / raw)
  To: John Williams
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

Hi John

>> +config EARLY_PRINTK_UARTLITE_ADDRESS
>> +	hex "Physical address where UART Lite for early printk is mapped"
>> +	depends on EARLY_PRINTK
>> +	default "0x40100000"
>> +	help
>> +	  Please enter physical address where your uart lite is mapped.
> 
> I think this should default to 0x00000000, then in the early_printk code
> we can test for zero baseaddress and attempt some sensible fallback in
> that case (even to disable).  

FIXED and use EARLY_PRINTK to default set to no.

>> +
>> +config HEART_BEAT
>> +	bool "Heart beat function for kernel"
>> +	help
>> +	  This option turns on/off heart beat kernel functionality on selected
>> +	  GPIO address.
>> +
>> +config HEART_BEAT_ADDRESS
>> +	hex "Physical address for heart beat LED"
>> +	depends on HEART_BEAT
>> +	default "0x40600000"
>> +	help
>> +	  Please enter physical address GPIO LED.
> 
> Again, default address should be zero which is checked in the code (zero
> can disable).  Prevent accesses to random memory locations in case of
> poorly configured kernel.

the same

>> +config HACK
>> +	bool "Increase performance"
>> +	default y
> 
> As suggested by Grant, this sohuld be
> 
> 1. renamed and described as something sensible
> 
> SELF_MODIFYING_CODE_HACK
> 
> 2. Made condition on CONFIG_EXPERIMENTAL at very least.


  21 config SELFMOD
  22         bool "Use self modified code for intc/timer"
  23         depends on EXPERIMENTAL
  24         default n
  25         help
  26           This choice enables self-modified code for interrupt controller
  27           and timer.
  28
  29 config SELFMOD_INTC
  30         bool "Use self modified code for intc"
  31         depends on SELFMOD
  32         default y
  33         help
  34           This choice enables self-modified code for interrupt controller.
  35
  36 config SELFMOD_TIMER
  37         bool "Use self modified code for timer"
  38         depends on SELFMOD
  39         default y
  40         help
  41           This choice enables self-modified code for timer.

FIXED.

>> +config OPT_LIB_FUNCTION
> +	bool "Optimalized lib function"
>> +	default y
>> +	help
>> +	  Allows turn on optimalized library function (memcpy and memmove).
>> +	  They are optimized by using unsigned alignment. This will work
> 
> "Unsigned alignment"??
> 
> Do you mean word-aligned?

FIXED

>> +	  fine if both source and destination are aligned on the same
>> +	  boundary. However, if they are aligned on different boundaries
>> +	  shifts will be necessary. This might result in bad performance
>> +	  on MicroBlaze systems without a barrel shifter.
>> +
>> +# This is still a bit broken - disabling for now JW 20070504
>> +config ALLOW_EDIT_AUTO
>> +	bool "Permit Display/edit of Kconfig.auto platform settings"
>> +	default n
>> +	help
>> +	  Allows the editing of auto-generated platform settings from
>> +	  the Kconfig.auto file. Obviously this does not change the
>> +	  underlying hardware, so be very careful if you go editing
>> +	  these settings.
>> +
>> +	  Also, if you enable this, and edit various Kconfig.auto
>> +	  settings, YOUR CHANGES WILL BE LOST if you then disable it
>> +	  again. You have been warned!
>> +
>> +	  If unsure, say no.
>> +
>> +# Ok, the platform is chosen. Source the kconfig.auto to get all of the
>> +# system settings.
> 
> Should be just "get all of the CPU settings", since we use OF to get the
> device tree.

I keep this for now. I hope we will talked about later with Xilinx guys what
happen with platforms.

>> diff --git a/arch/microblaze/platform/generic/Kconfig.auto b/arch/microblaze/platform/generic/Kconfig.auto
>> new file mode 100644
>> index 0000000..5dc8c15
>> --- /dev/null
>> +++ b/arch/microblaze/platform/generic/Kconfig.auto
> 
>> +config XILINX_ERAM_SIZE
>> +	hex "Memory size of XILINX_RAM"
>> +	depends on XILINX_UNCACHED_SHADOW
>> +	default 0x02000000
> 
> Why does this depend on UNCACHED_SHADOW?

Because consistent.c needs to know where was the end of memory. This issue
hasn't never tested. Currently consistent.c is removed.

M

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 03/56] microblaze_v2: Cpuinfo handling
  2008-05-05  1:52       ` [PATCH 03/56] microblaze_v2: Cpuinfo handling John Williams
@ 2008-05-05 14:19         ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-05 14:19 UTC (permalink / raw)
  To: John Williams
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek


>> --- /dev/null
>> +++ b/arch/microblaze/kernel/cpu/cpuinfo-static.c
>> @@ -0,0 +1,117 @@
> 
>> +
>> +	ci->cpu_clock_freq = fcpu(cpu, "timebase-frequency");
> 
> Should this be added to cpuinfo-pvr.c?

I moved it. This was in cpuinfo.c because you can't load frequency from PVR regs.
this value was loaded from DTS and I don't want to setup second parameter to pvr
function.

>> --- /dev/null
>> +++ b/include/asm-microblaze/cpuinfo.h
> ...
> 
>> +	/* HW debug support */
>> +	int hw_debug;
>> +	int num_pc_brk;
>> +	int num_rd_brk;
>> +	int num_wr_brk;
> 
>   +       /* CPU and system timebase info */
>> +	int cpu_clock_freq;
>> +
> 
>> +void set_cpuinfo_pvr_partial(struct cpuinfo *ci);
> 
> pvr_partial never got written - it can be deleted.

I removed it and changed values
M

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 08/56] microblaze_v2: Interrupt handling, timer support, supported function
  2008-05-05  1:58                 ` [PATCH 08/56] microblaze_v2: Interrupt handling, timer support, supported function John Williams
@ 2008-05-05 14:20                   ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-05 14:20 UTC (permalink / raw)
  To: John Williams
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

FIXED. Part of Kconfig was in previous email.

M


>>  arch/microblaze/kernel/hack.c  |   82 ++++++++++++++++++
>>  include/asm-microblaze/hack.h  |   24 +++++
> 
> These 'hack' files, functions and CONFIGS should be renamed.
> 
> How about
> 
>  * selfmod.[c|h] (core infrastructure)
>  * CONFIG_SELFMOD  (enables the self modifying API)
>  * CONFIG_SELFMOD_IRQ (use it on IRS)
>  * CONFIG_SELFMOD_TIMER (user it on the timer)
> 
> The last two would be dependent on CONFIG_SELFMOD
> 
> With the recent ksplice stuff it seems self-modifying code is ready for
> the mainline :)
> 
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 13/56] microblaze_v2: PVR support, cpuinfo support
  2008-05-05  2:14                           ` [PATCH 13/56] microblaze_v2: PVR support, cpuinfo support John Williams
@ 2008-05-05 14:20                             ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-05 14:20 UTC (permalink / raw)
  To: John Williams
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

FIXED.


>> +int cpu_has_pvr(void)
>> +{
>> +	unsigned flags;
>> +	unsigned pvr0;
>> +	int ret = 0;
>> +
>> +	local_irq_save(flags);
>> +
> 
> ...
> 
>> +out:
>> +	local_irq_restore(flags);
>> +	return ret;
>> +}
> 
> The actual IRQ clear/restore is not required - can you just use
> local_save_flags() or similar to read the MSR?


^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 21/56] microblaze_v2: setup.c - system setting
  2008-05-05  2:15                                           ` [PATCH 21/56] microblaze_v2: setup.c - system setting John Williams
@ 2008-05-05 14:21                                             ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-05 14:21 UTC (permalink / raw)
  To: John Williams
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

FIXED


>> +++ b/arch/microblaze/kernel/setup.c
> 
>> +#ifdef CONFIG_HACK
>> +	printk(KERN_NOTICE "HACK function enable\n");
>> +#else
>> +	printk(KERN_NOTICE "HACK function disable\n");
>> +#endif
> 
> %s/HACK/something sensible/g
> 
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 24/56] microblaze_v2: time support
  2008-05-05  2:19                                                 ` [PATCH 24/56] microblaze_v2: time support John Williams
@ 2008-05-05 14:22                                                   ` Michal Simek
  2008-05-06  0:30                                                     ` John Williams
  0 siblings, 1 reply; 170+ messages in thread
From: Michal Simek @ 2008-05-05 14:22 UTC (permalink / raw)
  To: John Williams
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

Hi John,

you wrote me you have smarter implementation that xilinx did. Can you find it
and send me it?

Thanks,
M


>> +static inline void udelay(unsigned long usec)
>> +{
>> +	unsigned long long tmp = usec;
>> +	unsigned long loops = (tmp * 4295 * HZ * loops_per_jiffy) >> 32;
>> +	__delay(loops);
>> +}
> 
> Let's hope like hell the CPU has HW multipler and shifter for this
> one! :)
> 
>> +++ b/include/asm-microblaze/timex.h
>> @@ -0,0 +1,20 @@
>> +
>> +#define CLOCK_TICK_RATE 1000 /* Timer input freq. */
> 
> What's this?  Is it used anywhere?
> 
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 50/56] microblaze_v2: setup.h string.h thread_info.h
  2008-05-05  2:39                                                                                                     ` [PATCH 50/56] microblaze_v2: setup.h string.h thread_info.h John Williams
@ 2008-05-05 14:24                                                                                                       ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-05 14:24 UTC (permalink / raw)
  To: John Williams
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

FIXED to r1.
M


>> +++ b/include/asm-microblaze/thread_info.h
>> @@ -0,0 +1,155 @@
>> +/*
>> + * include/asm-microblaze/thread_info.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_THREAD_INFO_H
>> +#define _ASM_MICROBLAZE_THREAD_INFO_H
>> +
>> +#ifdef __KERNEL__
>> +
>> +/* we have 8k stack */
> 
> Is it worth trialling a 4K stack on MicroBlaze?
> 
> 
>> +struct cpu_context {
>> +	__u32	sp;
> 
> I'd be happier to see this called r1.  If mb-as doesn't accept "sp" as
> an alias for "r1", nor should we.
> 
> ...
> 
>> +	__u32	r30;
> 
> Is it worth a comment that r31 is absent because it's used as 'current'
> pointer, and -ffixed-r31 etc?
> 
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 04/56] microblaze_v2: Open firmware files
  2008-05-04 11:40       ` [PATCH 04/56] microblaze_v2: Open firmware files monstr
  2008-05-04 11:40         ` [PATCH 05/56] microblaze_v2: Support for semaphores monstr
@ 2008-05-05 14:24         ` Grant Likely
  2008-05-05 21:56         ` Stephen Neuendorffer
  2008-05-07 16:04         ` [microblaze-uclinux] " Stephen Neuendorffer
  3 siblings, 0 replies; 170+ messages in thread
From: Grant Likely @ 2008-05-05 14:24 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, microblaze-uclinux,
	Michal Simek, linuxppc-dev

On Sun, May 4, 2008 at 5:40 AM,  <monstr@seznam.cz> wrote:
> From: Michal Simek <monstr@monstr.eu>
>
>
>  Signed-off-by: Michal Simek <monstr@monstr.eu>
>  ---
>   arch/microblaze/kernel/prom.c        | 1653 ++++++++++++++++++++++++++++++++++
>   include/asm-microblaze/of_device.h   |   41 +
>   include/asm-microblaze/of_platform.h |   45 +
>   include/asm-microblaze/prom.h        |  311 +++++++

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

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 10/56] microblaze_v2: Generic dts file for platforms
  2008-05-04 11:40                   ` [PATCH 10/56] microblaze_v2: Generic dts file for platforms monstr
  2008-05-04 11:41                     ` [PATCH 11/56] microblaze_v2: kernel modules support monstr
@ 2008-05-05 14:31                     ` Grant Likely
  2008-05-05 20:07                       ` Michal Simek
  2008-05-05 17:25                     ` Stephen Neuendorffer
  2 siblings, 1 reply; 170+ messages in thread
From: Grant Likely @ 2008-05-05 14:31 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	Michal Simek

On Sun, May 4, 2008 at 5:40 AM,  <monstr@seznam.cz> wrote:
> From: Michal Simek <monstr@monstr.eu>
>
>
>  Signed-off-by: Michal Simek <monstr@monstr.eu>
>  ---
>   arch/microblaze/platform/generic/system.dts |  137 +++++++++++++++++++++++++++

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

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 18/56] microblaze_v2: early_printk support
  2008-05-04 11:41                                   ` [PATCH 18/56] microblaze_v2: early_printk support monstr
  2008-05-04 11:41                                     ` [PATCH 19/56] microblaze_v2: uaccess files monstr
@ 2008-05-05 14:36                                     ` Grant Likely
  2008-05-05 20:10                                       ` Michal Simek
  2008-05-05 23:22                                     ` John Williams
  2 siblings, 1 reply; 170+ messages in thread
From: Grant Likely @ 2008-05-05 14:36 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	Michal Simek

On Sun, May 4, 2008 at 5:41 AM,  <monstr@seznam.cz> wrote:
> From: Michal Simek <monstr@monstr.eu>
>
>
>  Signed-off-by: Michal Simek <monstr@monstr.eu>

I'm not opposed to this as is, but longer term will you be getting the
base address out of the device tree instead of from
CONFIG_EARLY_PRINTK_UARTLITE_ADDRESS?

Cheers,
g.

>  ---
>   arch/microblaze/kernel/early_printk.c |  115 +++++++++++++++++++++++++++++++++
>   1 files changed, 115 insertions(+), 0 deletions(-)
>   create mode 100644 arch/microblaze/kernel/early_printk.c
>
>  diff --git a/arch/microblaze/kernel/early_printk.c b/arch/microblaze/kernel/early_printk.c
>  new file mode 100644
>  index 0000000..0f533ff
>  --- /dev/null
>  +++ b/arch/microblaze/kernel/early_printk.c
>  @@ -0,0 +1,115 @@
>  +/*
>  + * arch/microblaze/kernel/early_printk.c
>  + *
>  + * Copyright (C) 2007 Michal Simek <monstr@monstr.eu>
>  + * Copyright (C) 2003-2006 Yasushi SHOJI <yashi@atmark-techno.com>
>  + *
>  + * Early printk support for Microblaze.
>  + *
>  + * Once we got some system without uart light, we need to refactor.
>  + */
>  +
>  +#include <linux/console.h>
>  +#include <linux/kernel.h>
>  +#include <linux/init.h>
>  +#include <linux/string.h>
>  +#include <linux/tty.h>
>  +#include <asm/io.h>
>  +#include <asm/processor.h>
>  +#include <asm/fcntl.h>
>  +#include <asm/setup.h>
>  +
>  +#ifdef CONFIG_EARLY_PRINTK
>  +#define BASE_ADDR ((unsigned char *)CONFIG_EARLY_PRINTK_UARTLITE_ADDRESS)
>  +
>  +#define RX_FIFO        BASE_ADDR
>  +#define TX_FIFO        ((unsigned long *)(BASE_ADDR + 4))
>  +#define STATUS ((unsigned long *)(BASE_ADDR + 8))
>  +#define CONTROL        ((unsigned long *)(BASE_ADDR + 12))
>  +
>  +static void early_printk_putc(char c)
>  +{
>  +       while (ioread32(STATUS) & (1<<3));
>  +       iowrite32((c & 0xff), TX_FIFO);
>  +}
>  +
>  +static void early_printk_write(struct console *unused,
>  +                                       const char *s, unsigned n)
>  +{
>  +       while (*s && n-- > 0) {
>  +               early_printk_putc(*s);
>  +               if (*s == '\n')
>  +                       early_printk_putc('\r');
>  +               s++;
>  +       }
>  +}
>  +
>  +static struct console early_serial_console = {
>  +       .name = "earlyser",
>  +       .write = early_printk_write,
>  +       .flags = CON_PRINTBUFFER,
>  +       .index = -1,
>  +};
>  +
>  +/* Direct interface for emergencies */
>  +static struct console *early_console = &early_serial_console;
>  +static int early_console_initialized;
>  +
>  +void early_printk(const char *fmt, ...)
>  +{
>  +       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);
>  +       }
>  +}
>  +
>  +static int __initdata keep_early;
>  +
>  +int __init setup_early_printk(char *opt)
>  +{
>  +       char *space;
>  +       char buf[256];
>  +
>  +       if (early_console_initialized)
>  +               return 1;
>  +
>  +       strlcpy(buf, opt, sizeof(buf));
>  +       space = strchr(buf, ' ');
>  +       if (space)
>  +               *space = 0;
>  +
>  +       if (strstr(buf, "keep"))
>  +               keep_early = 1;
>  +
>  +       early_console = &early_serial_console;
>  +       early_console_initialized = 1;
>  +       register_console(early_console);
>  +       return 0;
>  +}
>  +#if 0
>  +static void __init disable_early_printk(void)
>  +{
>  +       if (!early_console_initialized || !early_console)
>  +               return;
>  +       if (!keep_early) {
>  +               printk(KERN_INFO "disabling early console\n");
>  +               unregister_console(early_console);
>  +               early_console_initialized = 0;
>  +       } else
>  +               printk(KERN_INFO "keeping early console\n");
>  +}
>  +#endif
>  +
>  +__setup("earlyprintk=", setup_early_printk);
>  +
>  +#else
>  +void early_printk(const char *fmt, ...)
>  +{
>  +}
>  +#endif
>  --
>  1.5.4.GIT
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 45/56] microblaze_v2: headers simple files - empty or redirect to asm-generic
  2008-05-05  2:34                                                                                           ` [PATCH 45/56] microblaze_v2: headers simple files - empty or redirect to asm-generic John Williams
@ 2008-05-05 15:10                                                                                             ` Grant Likely
  2008-05-06  9:02                                                                                               ` Arnd Bergmann
  2008-05-06 14:47                                                                                             ` Stephen Rothwell
  1 sibling, 1 reply; 170+ messages in thread
From: Grant Likely @ 2008-05-05 15:10 UTC (permalink / raw)
  To: John Williams
  Cc: monstr, linux-kernel, arnd, linux-arch, stephen.neuendorffer,
	John.Linn, matthew, will.newton, drepper, microblaze-uclinux,
	Michal Simek

On Sun, May 4, 2008 at 8:34 PM, John Williams
<john.williams@petalogix.com> wrote:
>
>  >  include/asm-microblaze/auxvec.h            |   14 ++++++++++++++
>  >  include/asm-microblaze/cputime.h           |   16 ++++++++++++++++
>  >  include/asm-microblaze/div64.h             |   16 ++++++++++++++++
>  >  include/asm-microblaze/emergency-restart.h |   16 ++++++++++++++++
>  >  include/asm-microblaze/errno.h             |   16 ++++++++++++++++
>  >  include/asm-microblaze/futex.h             |   16 ++++++++++++++++
>  >  include/asm-microblaze/kdebug.h            |   19 +++++++++++++++++++
>  >  include/asm-microblaze/local.h             |   16 ++++++++++++++++
>  >  include/asm-microblaze/mutex.h             |   16 ++++++++++++++++
>  >  include/asm-microblaze/namei.h             |   24 ++++++++++++++++++++++++
>  >  include/asm-microblaze/percpu.h            |   16 ++++++++++++++++
>  >  include/asm-microblaze/resource.h          |   16 ++++++++++++++++
>  >  include/asm-microblaze/user.h              |   18 ++++++++++++++++++
>
>  These are all just includes of asm-generic/* (hooray!).
>
>  But, is it reasonable to to suggest adding asm-generic at the end of the
>  kernel include path, and save all this verbosity?
>
>  Principle of least surprise maybe?

Convention in the other archs is already established to explicitly
include asm-generic files one by one.  It is probably best to match
existing convention for commonality sake.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 170+ messages in thread

* RE: [PATCH 10/56] microblaze_v2: Generic dts file for platforms
  2008-05-04 11:40                   ` [PATCH 10/56] microblaze_v2: Generic dts file for platforms monstr
  2008-05-04 11:41                     ` [PATCH 11/56] microblaze_v2: kernel modules support monstr
  2008-05-05 14:31                     ` [PATCH 10/56] microblaze_v2: Generic dts file for platforms Grant Likely
@ 2008-05-05 17:25                     ` Stephen Neuendorffer
  2008-05-05 23:16                       ` John Williams
  2 siblings, 1 reply; 170+ messages in thread
From: Stephen Neuendorffer @ 2008-05-05 17:25 UTC (permalink / raw)
  To: monstr, linux-kernel
  Cc: arnd, linux-arch, John Linn, john.williams, matthew, will.newton,
	drepper, microblaze-uclinux, grant.likely, Michal Simek


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

Steve

> -----Original Message-----
> From: monstr@seznam.cz [mailto:monstr@seznam.cz]
> Sent: Sunday, May 04, 2008 4:41 AM
> To: linux-kernel@vger.kernel.org
> Cc: arnd@arndb.de; linux-arch@vger.kernel.org; Stephen Neuendorffer;
John Linn;
> john.williams@petalogix.com; matthew@wil.cx; will.newton@gmail.com;
drepper@redhat.com; microblaze-
> uclinux@itee.uq.edu.au; grant.likely@secretlab.ca; Michal Simek
> Subject: [PATCH 10/56] microblaze_v2: Generic dts file for platforms
> 
> From: Michal Simek <monstr@monstr.eu>
> 
> 
> Signed-off-by: Michal Simek <monstr@monstr.eu>
> ---
>  arch/microblaze/platform/generic/system.dts |  137
+++++++++++++++++++++++++++
>  1 files changed, 137 insertions(+), 0 deletions(-)
>  create mode 100644 arch/microblaze/platform/generic/system.dts


^ permalink raw reply	[flat|nested] 170+ messages in thread

* RE: [microblaze-uclinux] [PATCH 09/56] microblaze_v2: cache support
  2008-05-04 11:40                 ` [PATCH 09/56] microblaze_v2: cache support monstr
  2008-05-04 11:40                   ` [PATCH 10/56] microblaze_v2: Generic dts file for platforms monstr
  2008-05-05  2:09                   ` [PATCH 09/56] microblaze_v2: cache support John Williams
@ 2008-05-05 17:37                   ` Stephen Neuendorffer
  2008-05-06  9:22                     ` Michal Simek
  2008-05-05 22:37                   ` Stephen Neuendorffer
  3 siblings, 1 reply; 170+ messages in thread
From: Stephen Neuendorffer @ 2008-05-05 17:37 UTC (permalink / raw)
  To: microblaze-uclinux, linux-kernel
  Cc: arnd, linux-arch, John Linn, john.williams, matthew, will.newton,
	drepper, grant.likely, Michal Simek


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

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

Steve

> +#define flush_cache_all()			__flush_cache_all()
> +#define flush_cache_mm(mm)			do { } while (0)
> +#define flush_cache_range(vma, start, end)	__flush_cache_all()
> +#define flush_cache_page(vma, vmaddr, pfn)	do { } while (0)
> +
> +#define flush_dcache_range(start, end)
__flush_dcache_range(start, end)
> +#define flush_dcache_page(page)		do { } while (0)
> +#define flush_dcache_mmap_lock(mapping)		do { } while (0)
> +#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
> +
> +#define flush_icache_range(start, len)
__flush_icache_range(start, len)
> +#define flush_icache_page(vma, pg)		do { } while (0)
> +#define flush_icache_user_range(start, len)	do { } while (0)
> +
> +#define flush_cache_vmap(start, end)		do { } while (0)
> +#define flush_cache_vunmap(start, end)		do { } while (0)
> +
> +struct page;
> +struct mm_struct;
> +struct vm_area_struct;
> +
> +/* see arch/microblaze/kernel/cache.c */
> +extern void __flush_icache_all(void);
> +extern void __flush_icache_range(unsigned long start, unsigned long
end);
> +extern void __flush_icache_page(struct vm_area_struct *vma, struct
page *page);
> +extern void __flush_icache_user_range(struct vm_area_struct *vma,
> +				struct page *page,
> +				unsigned long adr, int len);
> +extern void __flush_cache_sigtramp(unsigned long addr);
> +
> +extern void __flush_dcache_all(void);
> +extern void __flush_dcache_range(unsigned long start, unsigned long
end);
> +extern void __flush_dcache_page(struct vm_area_struct *vma, struct
page *page);
> +extern void __flush_dcache_user_range(struct vm_area_struct *vma,
> +				struct page *page,
> +				unsigned long adr, int len);
> +
> +extern inline void __flush_cache_all(void)
> +{
> +	__flush_icache_all();
> +	__flush_dcache_all();
> +}
> +
> +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
> +do { memcpy(dst, src, len); \
> +	flush_icache_user_range(vma, page, vaddr, len); \
> +} while (0)
> +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
> +	memcpy(dst, src, len)
> +
> +#endif /* _ASM_MICROBLAZE_CACHEFLUSH_H */
> --
> 1.5.4.GIT
> 
> ___________________________
> microblaze-uclinux mailing list
> microblaze-uclinux@itee.uq.edu.au
> Project Home Page :
http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
> Mailing List Archive :
http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/
> 



^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 10/56] microblaze_v2: Generic dts file for platforms
  2008-05-05 14:31                     ` [PATCH 10/56] microblaze_v2: Generic dts file for platforms Grant Likely
@ 2008-05-05 20:07                       ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-05 20:07 UTC (permalink / raw)
  To: Grant Likely
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	Michal Simek

Hi Grant,
>> From: Michal Simek <monstr@monstr.eu>
>>
>>
>>  Signed-off-by: Michal Simek <monstr@monstr.eu>
>>  ---
>>   arch/microblaze/platform/generic/system.dts |  137 +++++++++++++++++++++++++++
> 
> What is the purpose of the generic dts?  Will this work with custom
> microblaze designs?  The header block should contain a comment about
> what this file is for.

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

M

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 18/56] microblaze_v2: early_printk support
  2008-05-05 14:36                                     ` [PATCH 18/56] microblaze_v2: early_printk support Grant Likely
@ 2008-05-05 20:10                                       ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-05 20:10 UTC (permalink / raw)
  To: Grant Likely
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	Michal Simek

I added it to future plan on wiki.

M


> On Sun, May 4, 2008 at 5:41 AM,  <monstr@seznam.cz> wrote:
>> From: Michal Simek <monstr@monstr.eu>
>>
>>
>>  Signed-off-by: Michal Simek <monstr@monstr.eu>
> 
> I'm not opposed to this as is, but longer term will you be getting the
> base address out of the device tree instead of from
> CONFIG_EARLY_PRINTK_UARTLITE_ADDRESS?
> 
> Cheers,
> g.
> 
>>  ---
>>   arch/microblaze/kernel/early_printk.c |  115 +++++++++++++++++++++++++++++++++
>>   1 files changed, 115 insertions(+), 0 deletions(-)
>>   create mode 100644 arch/microblaze/kernel/early_printk.c
>>
>>  diff --git a/arch/microblaze/kernel/early_printk.c b/arch/microblaze/kernel/early_printk.c
>>  new file mode 100644
>>  index 0000000..0f533ff
>>  --- /dev/null
>>  +++ b/arch/microblaze/kernel/early_printk.c
>>  @@ -0,0 +1,115 @@
>>  +/*
>>  + * arch/microblaze/kernel/early_printk.c
>>  + *
>>  + * Copyright (C) 2007 Michal Simek <monstr@monstr.eu>
>>  + * Copyright (C) 2003-2006 Yasushi SHOJI <yashi@atmark-techno.com>
>>  + *
>>  + * Early printk support for Microblaze.
>>  + *
>>  + * Once we got some system without uart light, we need to refactor.
>>  + */
>>  +
>>  +#include <linux/console.h>
>>  +#include <linux/kernel.h>
>>  +#include <linux/init.h>
>>  +#include <linux/string.h>
>>  +#include <linux/tty.h>
>>  +#include <asm/io.h>
>>  +#include <asm/processor.h>
>>  +#include <asm/fcntl.h>
>>  +#include <asm/setup.h>
>>  +
>>  +#ifdef CONFIG_EARLY_PRINTK
>>  +#define BASE_ADDR ((unsigned char *)CONFIG_EARLY_PRINTK_UARTLITE_ADDRESS)
>>  +
>>  +#define RX_FIFO        BASE_ADDR
>>  +#define TX_FIFO        ((unsigned long *)(BASE_ADDR + 4))
>>  +#define STATUS ((unsigned long *)(BASE_ADDR + 8))
>>  +#define CONTROL        ((unsigned long *)(BASE_ADDR + 12))
>>  +
>>  +static void early_printk_putc(char c)
>>  +{
>>  +       while (ioread32(STATUS) & (1<<3));
>>  +       iowrite32((c & 0xff), TX_FIFO);
>>  +}
>>  +
>>  +static void early_printk_write(struct console *unused,
>>  +                                       const char *s, unsigned n)
>>  +{
>>  +       while (*s && n-- > 0) {
>>  +               early_printk_putc(*s);
>>  +               if (*s == '\n')
>>  +                       early_printk_putc('\r');
>>  +               s++;
>>  +       }
>>  +}
>>  +
>>  +static struct console early_serial_console = {
>>  +       .name = "earlyser",
>>  +       .write = early_printk_write,
>>  +       .flags = CON_PRINTBUFFER,
>>  +       .index = -1,
>>  +};
>>  +
>>  +/* Direct interface for emergencies */
>>  +static struct console *early_console = &early_serial_console;
>>  +static int early_console_initialized;
>>  +
>>  +void early_printk(const char *fmt, ...)
>>  +{
>>  +       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);
>>  +       }
>>  +}
>>  +
>>  +static int __initdata keep_early;
>>  +
>>  +int __init setup_early_printk(char *opt)
>>  +{
>>  +       char *space;
>>  +       char buf[256];
>>  +
>>  +       if (early_console_initialized)
>>  +               return 1;
>>  +
>>  +       strlcpy(buf, opt, sizeof(buf));
>>  +       space = strchr(buf, ' ');
>>  +       if (space)
>>  +               *space = 0;
>>  +
>>  +       if (strstr(buf, "keep"))
>>  +               keep_early = 1;
>>  +
>>  +       early_console = &early_serial_console;
>>  +       early_console_initialized = 1;
>>  +       register_console(early_console);
>>  +       return 0;
>>  +}
>>  +#if 0
>>  +static void __init disable_early_printk(void)
>>  +{
>>  +       if (!early_console_initialized || !early_console)
>>  +               return;
>>  +       if (!keep_early) {
>>  +               printk(KERN_INFO "disabling early console\n");
>>  +               unregister_console(early_console);
>>  +               early_console_initialized = 0;
>>  +       } else
>>  +               printk(KERN_INFO "keeping early console\n");
>>  +}
>>  +#endif
>>  +
>>  +__setup("earlyprintk=", setup_early_printk);
>>  +
>>  +#else
>>  +void early_printk(const char *fmt, ...)
>>  +{
>>  +}
>>  +#endif
>>  --
>>  1.5.4.GIT
>>
>>
> 
> 
> 

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 12/56] microblaze_v2: lmb support
  2008-05-05  2:11                         ` [PATCH 12/56] microblaze_v2: lmb support John Williams
@ 2008-05-05 21:32                           ` Segher Boessenkool
  0 siblings, 0 replies; 170+ messages in thread
From: Segher Boessenkool @ 2008-05-05 21:32 UTC (permalink / raw)
  To: John Williams
  Cc: John.Linn, arnd, drepper, matthew, linux-kernel, grant.likely,
	will.newton, linux-arch, stephen.neuendorffer,
	microblaze-uclinux, Michal Simek, monstr

>> --- /dev/null
>> +++ b/include/asm-microblaze/lmb.h
>
> Since LMB has a very specific (and different) meaning the microblaze
> context (LMB = Local Memory Bus), can we have a comment or explanation
> from the PPC folks on what LMB actually stands for?

See lib/lmb.c:

/*
  * Procedures for maintaining information about logical memory blocks.
  *


Segher


^ permalink raw reply	[flat|nested] 170+ messages in thread

* RE: [PATCH 07/56] microblaze_v2: Signal support
  2008-05-04 11:40             ` [PATCH 07/56] microblaze_v2: Signal support monstr
  2008-05-04 11:40               ` [PATCH 08/56] microblaze_v2: Interrupt handling, timer support, supported function monstr
  2008-05-04 19:52               ` [PATCH 07/56] microblaze_v2: Signal support Arnd Bergmann
@ 2008-05-05 21:32               ` Stephen Neuendorffer
  2008-05-05 23:33                 ` John Williams
  2 siblings, 1 reply; 170+ messages in thread
From: Stephen Neuendorffer @ 2008-05-05 21:32 UTC (permalink / raw)
  To: monstr, linux-kernel
  Cc: arnd, linux-arch, John Linn, john.williams, matthew, will.newton,
	drepper, microblaze-uclinux, grant.likely, Michal Simek


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

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



^ permalink raw reply	[flat|nested] 170+ messages in thread

* RE: [PATCH 04/56] microblaze_v2: Open firmware files
  2008-05-04 11:40       ` [PATCH 04/56] microblaze_v2: Open firmware files monstr
  2008-05-04 11:40         ` [PATCH 05/56] microblaze_v2: Support for semaphores monstr
  2008-05-05 14:24         ` [PATCH 04/56] microblaze_v2: Open firmware files Grant Likely
@ 2008-05-05 21:56         ` Stephen Neuendorffer
  2008-05-06  7:27           ` Michal Simek
  2008-05-07 16:04         ` [microblaze-uclinux] " Stephen Neuendorffer
  3 siblings, 1 reply; 170+ messages in thread
From: Stephen Neuendorffer @ 2008-05-05 21:56 UTC (permalink / raw)
  To: monstr, linux-kernel
  Cc: arnd, linux-arch, John Linn, john.williams, matthew, will.newton,
	drepper, microblaze-uclinux, grant.likely, Michal Simek

Michal,

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

Steve

> +/**
> + * of_irq_map_one - Resolve an interrupt for a device
> + * @device:	the device whose interrupt is to be resolved
> + * @index:	index of the interrupt to resolve
> + * @out_irq:	structure of_irq filled by this function
> + *
> + * This function resolves an interrupt, walking the tree, for a given
> + * device-tree node. It's the high level pendant to of_irq_map_raw().
> + * It also implements the workarounds for OldWolrd Macs.
> + */
> +extern int of_irq_map_one(struct device_node *device, int index,
> +			struct of_irq *out_irq);
> +




^ permalink raw reply	[flat|nested] 170+ messages in thread

* RE: [PATCH 09/56] microblaze_v2: cache support
  2008-05-04 11:40                 ` [PATCH 09/56] microblaze_v2: cache support monstr
                                     ` (2 preceding siblings ...)
  2008-05-05 17:37                   ` [microblaze-uclinux] " Stephen Neuendorffer
@ 2008-05-05 22:37                   ` Stephen Neuendorffer
  3 siblings, 0 replies; 170+ messages in thread
From: Stephen Neuendorffer @ 2008-05-05 22:37 UTC (permalink / raw)
  To: monstr, linux-kernel
  Cc: arnd, linux-arch, John Linn, john.williams, matthew, will.newton,
	drepper, microblaze-uclinux, grant.likely, Michal Simek

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

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

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

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

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

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

diff --git a/arch/microblaze/kernel/cpu/cache.c
b/arch/microblaze/kernel/cpu/cache.c
index d6a1eab..1247b9e 100644
--- a/arch/microblaze/kernel/cpu/cache.c
+++ b/arch/microblaze/kernel/cpu/cache.c
@@ -129,7 +129,7 @@ void _invalidate_dcache(unsigned int addr)
 				: "r" (addr));
 }
 
-void __flush_icache_all(void)
+void __invalidate_icache_all(void)
 {
 	unsigned int i;
 	unsigned flags;
@@ -149,7 +149,7 @@ void __flush_icache_all(void)
 	}
 }
 
-void __flush_icache_range(unsigned long start, unsigned long end)
+void __invalidate_icache_range(unsigned long start, unsigned long end)
 {
 	unsigned int i;
 	unsigned flags;
@@ -177,24 +177,7 @@ void __flush_icache_range(unsigned long start,
unsigned long end)
 	}
 }
 
-void __flush_icache_page(struct vm_area_struct *vma, struct page *page)
-{
-	__flush_icache_all();
-}
-
-void __flush_icache_user_range(struct vm_area_struct *vma,
-				struct page *page, unsigned long adr,
-				int len)
-{
-	__flush_icache_all();
-}
-
-void __flush_cache_sigtramp(unsigned long addr)
-{
-	__flush_icache_range(addr, addr + 8);
-}
-
-void __flush_dcache_all(void)
+void __invalidate_dcache_all(void)
 {
 	unsigned int i;
 	unsigned flags;
@@ -216,7 +199,7 @@ void __flush_dcache_all(void)
 	}
 }
 
-void __flush_dcache_range(unsigned long start, unsigned long end)
+void __invalidate_dcache_range(unsigned long start, unsigned long end)
 {
 	unsigned int i;
 	unsigned flags;
@@ -242,15 +225,3 @@ void __flush_dcache_range(unsigned long start,
unsigned long end)
 		local_irq_restore(flags);
 	}
 }
-
-void __flush_dcache_page(struct vm_area_struct *vma, struct page *page)
-{
-	__flush_dcache_all();
-}
-
-void __flush_dcache_user_range(struct vm_area_struct *vma,
-				struct page *page, unsigned long adr,
-				int len)
-{
-	__flush_dcache_all();
-}
diff --git a/arch/microblaze/kernel/setup.c
b/arch/microblaze/kernel/setup.c
index 43d53d9..241fb21 100644
--- a/arch/microblaze/kernel/setup.c
+++ b/arch/microblaze/kernel/setup.c
@@ -51,10 +51,10 @@ void __init setup_arch(char **cmdline_p)
 	/* irq_early_init(); */
 	setup_cpuinfo();
 
-	__flush_icache_all();
+	__invalidate_icache_all();
 	__enable_icache();
 
-	__flush_dcache_all();
+	__invalidate_icache_all();
 	__enable_dcache();
 
 	panic_timeout = 120;
diff --git a/arch/microblaze/mm/dma-coherent.c
b/arch/microblaze/mm/dma-coherent.c
new file mode 100644
index 0000000..308654f
--- /dev/null
+++ b/arch/microblaze/mm/dma-coherent.c
@@ -0,0 +1,122 @@
+/*
+ *  Microblaze support for cache consistent memory.
+ *
+ *  Copyright (C) 2007 Xilinx, Inc.
+ *
+ *  Based on arch/microblaze/mm/consistent.c
+ *  Copyright (C) 2005 John Williams <jwilliams@itee.uq.edu.au>
+ *  Based on arch/avr32/mm/dma-coherent.c
+ *  Copyright (C) 2004-2006 Atmel Corporation
+ *
+ * Consistent memory allocators.  Used for DMA devices that want to
+ * share memory with the processor core.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/dma-mapping.h>
+
+#include <asm/cacheflush.h>
+
+void dma_cache_sync(struct device *dev, void *vaddr, size_t size, int
direction)
+{
+	switch (direction) {
+	case DMA_FROM_DEVICE:		/* invalidate only */
+		invalidate_dcache_range(vaddr, vaddr + size);
+		break;
+	case DMA_TO_DEVICE:		/* writeback only */
+		flush_dcache_range(vaddr, vaddr + size);
+		break;
+	case DMA_BIDIRECTIONAL:		/* writeback and invalidate */
+		invalidate_dcache_range(vaddr, vaddr + size);
+		flush_dcache_range(vaddr, vaddr + size);
+		break;
+	default:
+		BUG();
+	}
+}
+EXPORT_SYMBOL(dma_cache_sync);
+
+static struct page *__dma_alloc(struct device *dev, size_t size,
+				dma_addr_t *handle, gfp_t gfp)
+{
+	struct page *page, *free, *end;
+	int order;
+
+	if (in_interrupt())
+		BUG();
+
+	size = PAGE_ALIGN(size);
+	order = get_order(size);
+
+	page = alloc_pages(gfp, order);
+	if (!page)
+		return NULL;
+
+	split_page(page, order);
+
+	/*
+	 * When accessing physical memory with valid cache data, we
+	 * get a cache hit even if the virtual memory region is marked
+	 * as uncached.
+	 *
+	 * Since the memory is newly allocated, there is no point in
+	 * doing a writeback. If the previous owner cares, he should
+	 * have flushed the cache before releasing the memory.
+	 */
+	invalidate_dcache_range(phys_to_virt(page_to_phys(page)), size);
+
+	*handle = page_to_bus(page);
+	free = page + (size >> PAGE_SHIFT);
+	end = page + (1 << order);
+
+	/*
+	 * Free any unused pages
+	 */
+	while (free < end) {
+		__free_page(free);
+		free++;
+	}
+
+	return page;
+}
+
+static void __dma_free(struct device *dev, size_t size,
+		       struct page *page, dma_addr_t handle)
+{
+	struct page *end = page + (PAGE_ALIGN(size) >> PAGE_SHIFT);
+
+	while (page < end)
+		__free_page(page++);
+}
+
+void *dma_alloc_coherent(struct device *dev, size_t size,
+			 dma_addr_t *handle, gfp_t gfp)
+{
+	struct page *page;
+	void *ret = NULL;
+
+	page = __dma_alloc(dev, size, handle, gfp);
+	if (page) {
+		ret = (void *)page_to_phys(page);
+	}
+
+	return ret;
+}
+EXPORT_SYMBOL(dma_alloc_coherent);
+
+void dma_free_coherent(struct device *dev, size_t size,
+		       void *cpu_addr, dma_addr_t handle)
+{
+	void *addr;
+	struct page *page;
+
+	pr_debug("dma_free_coherent addr %p (phys %08lx) size %u\n",
+		 cpu_addr, (unsigned long)handle, (unsigned)size);
+	BUG_ON(!virt_addr_valid(addr));
+	page = virt_to_page(addr);
+	__dma_free(dev, size, page, handle);
+}
+EXPORT_SYMBOL(dma_free_coherent);
diff --git a/include/asm-microblaze/cacheflush.h
b/include/asm-microblaze/cacheflush.h
index ba7339d..782f01b 100644
--- a/include/asm-microblaze/cacheflush.h
+++ b/include/asm-microblaze/cacheflush.h
@@ -1,6 +1,7 @@
 /*
  * include/asm-microblaze/cacheflush.h
  *
+ * Copyright (C) 2008 Xilinx, Inc.
  * Copyright (C) 2007 PetaLogix
  * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
  * based on v850 version which was
@@ -15,58 +16,46 @@
 
 #ifndef _ASM_MICROBLAZE_CACHEFLUSH_H
 #define _ASM_MICROBLAZE_CACHEFLUSH_H
+#include <linux/kernel.h>	/* For min/max macros */
+#include <linux/mm.h>	/* For min/max macros */
+#include <asm/setup.h>
+#include <asm/page.h>
+#include <asm/cache.h>
 
-/* Somebody depends on this; sigh... */
-#include <linux/mm.h>
-
-#define flush_cache_all()			__flush_cache_all()
-#define flush_cache_mm(mm)			do { } while (0)
-#define flush_cache_range(vma, start, end)	__flush_cache_all()
-#define flush_cache_page(vma, vmaddr, pfn)	do { } while (0)
-
-#define flush_dcache_range(start, end)	__flush_dcache_range(start, end)
-#define flush_dcache_page(page)		do { } while (0)
-#define flush_dcache_mmap_lock(mapping)		do { } while (0)
-#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
+/*
+ * Cache handling functions.
+ * Microblaze has a write-through data cache, and no icache snooping of
dcache.
+ */
+#define flush_cache_mm(mm)			do { } while(0)
+#define flush_cache_range(mm, start, end)	invalidate_cache_all()
+#define flush_cache_page(vma, vmaddr)		do { } while(0)
 
-#define flush_icache_range(start, len)	__flush_icache_range(start, len)
-#define flush_icache_page(vma, pg)		do { } while (0)
-#define flush_icache_user_range(start, len)	do { } while (0)
+#define flush_dcache_page(page)			do { } while(0)
+#define flush_dcache_range(start, end)		do { } while(0)
+#define flush_dcache_mmap_lock(mapping)		do { } while(0)
+#define flush_dcache_mmap_unlock(mapping)	do { } while(0)
 
-#define flush_cache_vmap(start, end)		do { } while (0)
-#define flush_cache_vunmap(start, end)		do { } while (0)
+#define flush_icache_page(vma,pg)
__invalidate_icache_all()
+#define flush_icache_range(start, end)
__invalidate_icache_range(start, end)
 
-struct page;
-struct mm_struct;
-struct vm_area_struct;
 
 /* see arch/microblaze/kernel/cache.c */
-extern void __flush_icache_all(void);
-extern void __flush_icache_range(unsigned long start, unsigned long
end);
-extern void __flush_icache_page(struct vm_area_struct *vma, struct page
*page);
-extern void __flush_icache_user_range(struct vm_area_struct *vma,
-				struct page *page,
-				unsigned long adr, int len);
-extern void __flush_cache_sigtramp(unsigned long addr);
-
-extern void __flush_dcache_all(void);
-extern void __flush_dcache_range(unsigned long start, unsigned long
end);
-extern void __flush_dcache_page(struct vm_area_struct *vma, struct page
*page);
-extern void __flush_dcache_user_range(struct vm_area_struct *vma,
-				struct page *page,
-				unsigned long adr, int len);
+void __invalidate_icache_all(void);
+void __invalidate_icache_range(unsigned long start, unsigned long end);
+void __invalidate_dcache_all(void);
+void __invalidate_dcache_range(unsigned long start, unsigned long end);
 
-extern inline void __flush_cache_all(void)
-{
-	__flush_icache_all();
-	__flush_dcache_all();
-}
+#define invalidate_cache_all()
__invalidate_icache_all(); __invalidate_dcache_all()
+#define invalidate_dcache()
__invalidate_dcache_all()
+#define invalidate_icache()
__invalidate_icache_all()
+#define invalidate_dcache_range(start, end)
__invalidate_dcache_range(start,end)
+#define invalidate_icache_range(start, end)
__invalidate_icache_range(start,end)
 
 #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
 do { memcpy(dst, src, len); \
-	flush_icache_user_range(vma, page, vaddr, len); \
+	flush_icache_range ((unsigned) (dst), (unsigned) (dst) + (len));
\
 } while (0)
 #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
-	memcpy(dst, src, len)
+	memcpy((dst), (src), (len))
 
 #endif /* _ASM_MICROBLAZE_CACHEFLUSH_H */
-- 
1.5.3.4


> -----Original Message-----
> From: monstr@seznam.cz [mailto:monstr@seznam.cz]
> Sent: Sunday, May 04, 2008 4:41 AM
> To: linux-kernel@vger.kernel.org
> Cc: arnd@arndb.de; linux-arch@vger.kernel.org; Stephen Neuendorffer;
John Linn;
> john.williams@petalogix.com; matthew@wil.cx; will.newton@gmail.com;
drepper@redhat.com; microblaze-
> uclinux@itee.uq.edu.au; grant.likely@secretlab.ca; Michal Simek
> Subject: [PATCH 09/56] microblaze_v2: cache support
> 
> From: Michal Simek <monstr@monstr.eu>
> 
> 
> Signed-off-by: Michal Simek <monstr@monstr.eu>
> ---
>  arch/microblaze/kernel/cpu/cache.c  |  256
+++++++++++++++++++++++++++++++++++
>  include/asm-microblaze/cache.h      |   47 +++++++
>  include/asm-microblaze/cacheflush.h |   72 ++++++++++
>  3 files changed, 375 insertions(+), 0 deletions(-)
>  create mode 100644 arch/microblaze/kernel/cpu/cache.c
>  create mode 100644 include/asm-microblaze/cache.h
>  create mode 100644 include/asm-microblaze/cacheflush.h
> 
> diff --git a/arch/microblaze/kernel/cpu/cache.c
b/arch/microblaze/kernel/cpu/cache.c
> new file mode 100644
> index 0000000..d6a1eab
> --- /dev/null
> +++ b/arch/microblaze/kernel/cpu/cache.c
> @@ -0,0 +1,256 @@
> +/*
> + * arch/microblaze/kernel/cpu/cache.c
> + * Cache control for MicroBlaze cache memories
> + *
> + * Copyright (C) 2007 Michal Simek <monstr@monstr.eu>
> + * Copyright (C) 2007 PetaLogix
> + * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
> + *
> + * This file is subject to the terms and conditions of the GNU
General
> + * Public License. See the file COPYING in the main directory of this
> + * archive for more details.
> + *
> + */
> +
> +#include <asm/cacheflush.h>
> +#include <asm/cache.h>
> +#include <asm/cpuinfo.h>
> +
> +/* Exported functions */
> +
> +void _enable_icache(void)
> +{
> +	if (cpuinfo.use_icache) {
> +#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
> +		__asm__ __volatile__ ("
\
> +				msrset	r0, %0;
\
> +				nop; "
\
> +				:
\
> +				: "i" (MSR_ICE)
\
> +				: "memory");
> +#else
> +		__asm__ __volatile__ ("
\
> +				mfs	r12, rmsr;
\
> +				ori	r12, r12, %0;
\
> +				mts	rmsr, r12;
\
> +				nop; "
\
> +				:
\
> +				: "i" (MSR_ICE)
\
> +				: "memory", "r12");
> +#endif
> +	}
> +}
> +
> +void _disable_icache(void)
> +{
> +	if (cpuinfo.use_icache) {
> +#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
> +		__asm__ __volatile__ ("
\
> +				msrclr r0, %0;
\
> +				nop; "
\
> +				:
\
> +				: "i" (MSR_ICE)
\
> +				: "memory");
> +#else
> +		__asm__ __volatile__ ("
\
> +				mfs	r12, rmsr;
\
> +				andi	r12, r12, ~%0;
\
> +				mts	rmsr, r12;
\
> +				nop; "
\
> +				:
\
> +				: "i" (MSR_ICE)
\
> +				: "memory", "r12");
> +#endif
> +	}
> +}
> +
> +void _invalidate_icache(unsigned int addr)
> +{
> +	if (cpuinfo.use_icache) {
> +		__asm__ __volatile__ ("
\
> +				wic	%0, r0"
\
> +				:
\
> +				: "r" (addr));
> +	}
> +}
> +
> +void _enable_dcache(void)
> +{
> +	if (cpuinfo.use_dcache) {
> +#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
> +		__asm__ __volatile__ ("
\
> +				msrset	r0, %0;
\
> +				nop; "
\
> +				:
\
> +				: "i" (MSR_DCE)
\
> +				: "memory");
> +#else
> +		__asm__ __volatile__ ("
\
> +				mfs	r12, rmsr;
\
> +				ori	r12, r12, %0;
\
> +				mts	rmsr, r12;
\
> +				nop; "
\
> +				:
\
> +				: "i" (MSR_DCE)			\
> +				: "memory", "r12");
> +#endif
> +	}
> +}
> +
> +void _disable_dcache(void)
> +{
> +	if (cpuinfo.use_dcache) {
> +#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
> +		__asm__ __volatile__ ("
\
> +				msrclr	r0, %0;
\
> +				nop; "
\
> +				:
\
> +				: "i" (MSR_DCE)			\
> +				: "memory");
> +#else
> +		__asm__ __volatile__ ("
\
> +				mfs	r12, rmsr;
\
> +				andi	r12, r12, ~%0;
\
> +				mts	rmsr, r12;
\
> +				nop; "
\
> +				:
\
> +				: "i" (MSR_DCE)			\
> +				: "memory", "r12");
> +#endif
> +	}
> +}
> +
> +void _invalidate_dcache(unsigned int addr)
> +{
> +	if (cpuinfo.use_dcache)
> +		__asm__ __volatile__ ("
\
> +				wdc	%0, r0"
\
> +				:
\
> +				: "r" (addr));
> +}
> +
> +void __flush_icache_all(void)
> +{
> +	unsigned int i;
> +	unsigned flags;
> +
> +	if (cpuinfo.use_icache) {
> +		local_irq_save(flags);
> +		__disable_icache();
> +
> +		/* Just loop through cache size and invalidate, no need
to add
> +			CACHE_BASE address */
> +		for (i = 0; i < cpuinfo.icache_size;
> +			i += cpuinfo.icache_line)
> +				__invalidate_icache(i);
> +
> +		__enable_icache();
> +		local_irq_restore(flags);
> +	}
> +}
> +
> +void __flush_icache_range(unsigned long start, unsigned long end)
> +{
> +	unsigned int i;
> +	unsigned flags;
> +	unsigned int align;
> +
> +	if (cpuinfo.use_icache) {
> +		/*
> +		 * No need to cover entire cache range,
> +		 * just cover cache footprint
> +		 */
> +		end = min(start + cpuinfo.icache_size, end);
> +		align = ~(cpuinfo.icache_line - 1);
> +		start &= align; /* Make sure we are aligned */
> +		/* Push end up to the next cache line */
> +		end = ((end & align) + cpuinfo.icache_line);
> +
> +		local_irq_save(flags);
> +		__disable_icache();
> +
> +		for (i = start; i < end; i += cpuinfo.icache_line)
> +			__invalidate_icache(i);
> +
> +		__enable_icache();
> +		local_irq_restore(flags);
> +	}
> +}
> +
> +void __flush_icache_page(struct vm_area_struct *vma, struct page
*page)
> +{
> +	__flush_icache_all();
> +}
> +
> +void __flush_icache_user_range(struct vm_area_struct *vma,
> +				struct page *page, unsigned long adr,
> +				int len)
> +{
> +	__flush_icache_all();
> +}
> +
> +void __flush_cache_sigtramp(unsigned long addr)
> +{
> +	__flush_icache_range(addr, addr + 8);
> +}
> +
> +void __flush_dcache_all(void)
> +{
> +	unsigned int i;
> +	unsigned flags;
> +
> +	if (cpuinfo.use_dcache) {
> +		local_irq_save(flags);
> +		__disable_dcache();
> +
> +		/*
> +		 * Just loop through cache size and invalidate,
> +		 * no need to add CACHE_BASE address
> +		 */
> +		for (i = 0; i < cpuinfo.dcache_size;
> +			i += cpuinfo.dcache_line)
> +				__invalidate_dcache(i);
> +
> +		__enable_dcache();
> +		local_irq_restore(flags);
> +	}
> +}
> +
> +void __flush_dcache_range(unsigned long start, unsigned long end)
> +{
> +	unsigned int i;
> +	unsigned flags;
> +	unsigned int align;
> +
> +	if (cpuinfo.use_dcache) {
> +		/*
> +		 * No need to cover entire cache range,
> +		 * just cover cache footprint
> +		 */
> +		end = min(start + cpuinfo.dcache_size, end);
> +		align = ~(cpuinfo.dcache_line - 1);
> +		start &= align; /* Make sure we are aligned */
> +		/* Push end up to the next cache line */
> +		end = ((end & align) + cpuinfo.dcache_line);
> +		local_irq_save(flags);
> +		__disable_dcache();
> +
> +		for (i = start; i < end; i += cpuinfo.dcache_line)
> +			__invalidate_dcache(i);
> +
> +		__enable_dcache();
> +		local_irq_restore(flags);
> +	}
> +}
> +
> +void __flush_dcache_page(struct vm_area_struct *vma, struct page
*page)
> +{
> +	__flush_dcache_all();
> +}
> +
> +void __flush_dcache_user_range(struct vm_area_struct *vma,
> +				struct page *page, unsigned long adr,
> +				int len)
> +{
> +	__flush_dcache_all();
> +}
> diff --git a/include/asm-microblaze/cache.h
b/include/asm-microblaze/cache.h
> new file mode 100644
> index 0000000..6aa1abd
> --- /dev/null
> +++ b/include/asm-microblaze/cache.h
> @@ -0,0 +1,47 @@
> +/*
> + * include/asm-microblaze/cache.h
> + *
> + * Cache operations
> + *
> + * Copyright (C) 2007 Michal Simek <monstr@monstr.eu>
> + * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
> + *
> + * This file is subject to the terms and conditions of the GNU
General
> + * Public License. See the file COPYING in the main directory of this
> + * archive for more details.
> + *
> + */
> +
> +#ifndef _ASM_MICROBLAZE_CACHE_H
> +#define _ASM_MICROBLAZE_CACHE_H
> +
> +#include <asm/registers.h>
> +#include <linux/autoconf.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 */
> diff --git a/include/asm-microblaze/cacheflush.h
b/include/asm-microblaze/cacheflush.h
> new file mode 100644
> index 0000000..ba7339d
> --- /dev/null
> +++ b/include/asm-microblaze/cacheflush.h
> @@ -0,0 +1,72 @@
> +/*
> + * include/asm-microblaze/cacheflush.h
> + *
> + * Copyright (C) 2007 PetaLogix
> + * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
> + * based on v850 version which was
> + * Copyright (C) 2001,02,03 NEC Electronics Corporation
> + * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org>
> + *
> + * This file is subject to the terms and conditions of the GNU
General
> + * Public License. See the file COPYING in the main directory of this
> + * archive for more details.
> + *
> + */
> +
> +#ifndef _ASM_MICROBLAZE_CACHEFLUSH_H
> +#define _ASM_MICROBLAZE_CACHEFLUSH_H
> +
> +/* Somebody depends on this; sigh... */
> +#include <linux/mm.h>
> +
> +#define flush_cache_all()			__flush_cache_all()
> +#define flush_cache_mm(mm)			do { } while (0)
> +#define flush_cache_range(vma, start, end)	__flush_cache_all()
> +#define flush_cache_page(vma, vmaddr, pfn)	do { } while (0)
> +
> +#define flush_dcache_range(start, end)
__flush_dcache_range(start, end)
> +#define flush_dcache_page(page)		do { } while (0)
> +#define flush_dcache_mmap_lock(mapping)		do { } while (0)
> +#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
> +
> +#define flush_icache_range(start, len)
__flush_icache_range(start, len)
> +#define flush_icache_page(vma, pg)		do { } while (0)
> +#define flush_icache_user_range(start, len)	do { } while (0)
> +
> +#define flush_cache_vmap(start, end)		do { } while (0)
> +#define flush_cache_vunmap(start, end)		do { } while (0)
> +
> +struct page;
> +struct mm_struct;
> +struct vm_area_struct;
> +
> +/* see arch/microblaze/kernel/cache.c */
> +extern void __flush_icache_all(void);
> +extern void __flush_icache_range(unsigned long start, unsigned long
end);
> +extern void __flush_icache_page(struct vm_area_struct *vma, struct
page *page);
> +extern void __flush_icache_user_range(struct vm_area_struct *vma,
> +				struct page *page,
> +				unsigned long adr, int len);
> +extern void __flush_cache_sigtramp(unsigned long addr);
> +
> +extern void __flush_dcache_all(void);
> +extern void __flush_dcache_range(unsigned long start, unsigned long
end);
> +extern void __flush_dcache_page(struct vm_area_struct *vma, struct
page *page);
> +extern void __flush_dcache_user_range(struct vm_area_struct *vma,
> +				struct page *page,
> +				unsigned long adr, int len);
> +
> +extern inline void __flush_cache_all(void)
> +{
> +	__flush_icache_all();
> +	__flush_dcache_all();
> +}
> +
> +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
> +do { memcpy(dst, src, len); \
> +	flush_icache_user_range(vma, page, vaddr, len); \
> +} while (0)
> +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
> +	memcpy(dst, src, len)
> +
> +#endif /* _ASM_MICROBLAZE_CACHEFLUSH_H */
> --
> 1.5.4.GIT
> 



^ permalink raw reply related	[flat|nested] 170+ messages in thread

* RE: [PATCH 10/56] microblaze_v2: Generic dts file for platforms
  2008-05-05 17:25                     ` Stephen Neuendorffer
@ 2008-05-05 23:16                       ` John Williams
  2008-05-05 23:32                         ` Stephen Neuendorffer
  0 siblings, 1 reply; 170+ messages in thread
From: John Williams @ 2008-05-05 23:16 UTC (permalink / raw)
  To: Stephen Neuendorffer
  Cc: monstr, linux-kernel, arnd, linux-arch, John Linn, matthew,
	will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

On Mon, 2008-05-05 at 10:25 -0700, Stephen Neuendorffer wrote:
> I think it would be nice if dts files were stored in boot/dts, as on
> powerpc, which would reduce confusion.

I'm not so sure.  By grouping 

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

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

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

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

John


> 
> Steve
> 
> > -----Original Message-----
> > From: monstr@seznam.cz [mailto:monstr@seznam.cz]
> > Sent: Sunday, May 04, 2008 4:41 AM
> > To: linux-kernel@vger.kernel.org
> > Cc: arnd@arndb.de; linux-arch@vger.kernel.org; Stephen Neuendorffer;
> John Linn;
> > john.williams@petalogix.com; matthew@wil.cx; will.newton@gmail.com;
> drepper@redhat.com; microblaze-
> > uclinux@itee.uq.edu.au; grant.likely@secretlab.ca; Michal Simek
> > Subject: [PATCH 10/56] microblaze_v2: Generic dts file for platforms
> > 
> > From: Michal Simek <monstr@monstr.eu>
> > 
> > 
> > Signed-off-by: Michal Simek <monstr@monstr.eu>
> > ---
> >  arch/microblaze/platform/generic/system.dts |  137
> +++++++++++++++++++++++++++
> >  1 files changed, 137 insertions(+), 0 deletions(-)
> >  create mode 100644 arch/microblaze/platform/generic/system.dts
> 
-- 
John Williams, PhD, B.Eng, B.IT
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com  p: +61-7-30090663  f: +61-7-30090663



^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 18/56] microblaze_v2: early_printk support
  2008-05-04 11:41                                   ` [PATCH 18/56] microblaze_v2: early_printk support monstr
  2008-05-04 11:41                                     ` [PATCH 19/56] microblaze_v2: uaccess files monstr
  2008-05-05 14:36                                     ` [PATCH 18/56] microblaze_v2: early_printk support Grant Likely
@ 2008-05-05 23:22                                     ` John Williams
  2008-05-06  8:14                                       ` Michal Simek
  2 siblings, 1 reply; 170+ messages in thread
From: John Williams @ 2008-05-05 23:22 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek


On Sun, 2008-05-04 at 13:41 +0200, monstr@seznam.cz wrote:

> +++ b/arch/microblaze/kernel/early_printk.c

> +static void early_printk_putc(char c)
> +{
> +	while (ioread32(STATUS) & (1<<3));
> +	iowrite32((c & 0xff), TX_FIFO);
> +}

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

Here's my current implementation:

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

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

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

        /* Only attempt the iowrite if we didn't timeout */
        if(retries)
                iowrite32((c & 0xff), TX_FIFO);
}

Cheers

John



^ permalink raw reply	[flat|nested] 170+ messages in thread

* RE: [PATCH 10/56] microblaze_v2: Generic dts file for platforms
  2008-05-05 23:16                       ` John Williams
@ 2008-05-05 23:32                         ` Stephen Neuendorffer
  2008-05-06  0:10                           ` John Williams
  2008-05-06  7:38                           ` Michal Simek
  0 siblings, 2 replies; 170+ messages in thread
From: Stephen Neuendorffer @ 2008-05-05 23:32 UTC (permalink / raw)
  To: John Williams
  Cc: monstr, linux-kernel, arnd, linux-arch, John Linn, matthew,
	will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek


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

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

Steve

> -----Original Message-----
> From: John Williams [mailto:john.williams@petalogix.com]
> Sent: Monday, May 05, 2008 4:17 PM
> To: Stephen Neuendorffer
> Cc: monstr@seznam.cz; linux-kernel@vger.kernel.org; arnd@arndb.de;
linux-arch@vger.kernel.org; John
> Linn; matthew@wil.cx; will.newton@gmail.com; drepper@redhat.com;
microblaze-uclinux@itee.uq.edu.au;
> grant.likely@secretlab.ca; Michal Simek
> Subject: RE: [PATCH 10/56] microblaze_v2: Generic dts file for
platforms
> 
> On Mon, 2008-05-05 at 10:25 -0700, Stephen Neuendorffer wrote:
> > I think it would be nice if dts files were stored in boot/dts, as on
> > powerpc, which would reduce confusion.
> 
> I'm not so sure.  By grouping
> 
>  * the DTS
>  * Kconfig.auto (now just storing CPU parameters for CPUFLAGS); and
>  * board-specific setup.c if required,
> 
> we concentrate in one place, in a single subdir of
> arch/microblaze/platform/*, all of the board specific info.
> 
> Maybe our Kbuild should copy the platform .dts file out of the
platform
> dir and into microblaze/boot, like we do with the finished kernel?
Then
> it's ready to be picked up by the user or some higher level build
tool.
> 
> If users or vendors want to maintain multiple DTS files for a single
> board, again they can just collect them in the platform subdir so
their
> intended target remains obvious.
> 
> John
> 
> 
> >
> > Steve
> >
> > > -----Original Message-----
> > > From: monstr@seznam.cz [mailto:monstr@seznam.cz]
> > > Sent: Sunday, May 04, 2008 4:41 AM
> > > To: linux-kernel@vger.kernel.org
> > > Cc: arnd@arndb.de; linux-arch@vger.kernel.org; Stephen
Neuendorffer;
> > John Linn;
> > > john.williams@petalogix.com; matthew@wil.cx;
will.newton@gmail.com;
> > drepper@redhat.com; microblaze-
> > > uclinux@itee.uq.edu.au; grant.likely@secretlab.ca; Michal Simek
> > > Subject: [PATCH 10/56] microblaze_v2: Generic dts file for
platforms
> > >
> > > From: Michal Simek <monstr@monstr.eu>
> > >
> > >
> > > Signed-off-by: Michal Simek <monstr@monstr.eu>
> > > ---
> > >  arch/microblaze/platform/generic/system.dts |  137
> > +++++++++++++++++++++++++++
> > >  1 files changed, 137 insertions(+), 0 deletions(-)
> > >  create mode 100644 arch/microblaze/platform/generic/system.dts
> >
> --
> John Williams, PhD, B.Eng, B.IT
> PetaLogix - Linux Solutions for a Reconfigurable World
> w: www.petalogix.com  p: +61-7-30090663  f: +61-7-30090663
> 
> 



^ permalink raw reply	[flat|nested] 170+ messages in thread

* RE: [PATCH 07/56] microblaze_v2: Signal support
  2008-05-05 21:32               ` Stephen Neuendorffer
@ 2008-05-05 23:33                 ` John Williams
  2008-05-06  0:13                   ` Stephen Neuendorffer
  0 siblings, 1 reply; 170+ messages in thread
From: John Williams @ 2008-05-05 23:33 UTC (permalink / raw)
  To: Stephen Neuendorffer
  Cc: monstr, linux-kernel, arnd, linux-arch, John Linn, matthew,
	will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

On Mon, 2008-05-05 at 14:32 -0700, Stephen Neuendorffer wrote:
> (multiple places)  can this code (and flush_cache_sigtramp()) go away?
> 
> +#if 0
> +		flush_cache_sigtramp((unsigned long)frame->tramp);
> +#endif

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

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

John



^ permalink raw reply	[flat|nested] 170+ messages in thread

* RE: [PATCH 10/56] microblaze_v2: Generic dts file for platforms
  2008-05-05 23:32                         ` Stephen Neuendorffer
@ 2008-05-06  0:10                           ` John Williams
  2008-05-06  0:17                             ` Stephen Neuendorffer
  2008-05-06  7:50                             ` Michal Simek
  2008-05-06  7:38                           ` Michal Simek
  1 sibling, 2 replies; 170+ messages in thread
From: John Williams @ 2008-05-06  0:10 UTC (permalink / raw)
  To: Stephen Neuendorffer
  Cc: monstr, linux-kernel, arnd, linux-arch, John Linn, matthew,
	will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek


On Mon, 2008-05-05 at 16:32 -0700, Stephen Neuendorffer wrote:
> The .dts is not board specific, it's design specific.  

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

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

> In my opinion,
> this is not something that 'a vendor might maintain multiple versions
> of': instead it is in most cases simply fundamental to the FPGA design
> flow.

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

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

Am I missing something?

>   In fact, in most cases, I'd like to make the .dts file part of
> the bitstream and not compiled into the kernel.

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

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

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

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

cheers,

John



^ permalink raw reply	[flat|nested] 170+ messages in thread

* RE: [PATCH 07/56] microblaze_v2: Signal support
  2008-05-05 23:33                 ` John Williams
@ 2008-05-06  0:13                   ` Stephen Neuendorffer
  2008-05-06  0:25                     ` John Williams
  0 siblings, 1 reply; 170+ messages in thread
From: Stephen Neuendorffer @ 2008-05-06  0:13 UTC (permalink / raw)
  To: John Williams
  Cc: monstr, linux-kernel, arnd, linux-arch, John Linn, matthew,
	will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek


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

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

Steve

> -----Original Message-----
> From: John Williams [mailto:john.williams@petalogix.com]
> Sent: Monday, May 05, 2008 4:34 PM
> To: Stephen Neuendorffer
> Cc: monstr@seznam.cz; linux-kernel@vger.kernel.org; arnd@arndb.de;
linux-arch@vger.kernel.org; John
> Linn; matthew@wil.cx; will.newton@gmail.com; drepper@redhat.com;
microblaze-uclinux@itee.uq.edu.au;
> grant.likely@secretlab.ca; Michal Simek
> Subject: RE: [PATCH 07/56] microblaze_v2: Signal support
> 
> On Mon, 2008-05-05 at 14:32 -0700, Stephen Neuendorffer wrote:
> > (multiple places)  can this code (and flush_cache_sigtramp()) go
away?
> >
> > +#if 0
> > +		flush_cache_sigtramp((unsigned long)frame->tramp);
> > +#endif
> 
> You have to icache_invalidate the sigtramp because you are writing
into
> memory that will shortly be executed.
> 
> I'm not sure why this is #if'd away in the first place?
> 
> John
> 
> 



^ permalink raw reply	[flat|nested] 170+ messages in thread

* RE: [PATCH 10/56] microblaze_v2: Generic dts file for platforms
  2008-05-06  0:10                           ` John Williams
@ 2008-05-06  0:17                             ` Stephen Neuendorffer
  2008-05-06  7:50                             ` Michal Simek
  1 sibling, 0 replies; 170+ messages in thread
From: Stephen Neuendorffer @ 2008-05-06  0:17 UTC (permalink / raw)
  To: John Williams
  Cc: monstr, linux-kernel, arnd, linux-arch, John Linn, matthew,
	will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

> >   In fact, in most cases, I'd like to make the .dts file part of
> > the bitstream and not compiled into the kernel.
> 
> Well, I've just run out of BRAM on a V5LX50T design so please don't
ask
> for more of it to store a DTC! :)  Or do you mean to piggyback on the
> tail of the configuration stream and read with some kind of JTAG user
> code?

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

> > Although powerpc has a bit more boot-time complexity than the
microblaze
> > does currently, I think it makes alot of sense to have some
consistency
> > here, and there is already a pattern to follow here which nicely
> > orthogonalizes multiple .dts files for the same platform code.
> 
> arch/powerpc/boot is building a bootloader, so maybe that's why .dts
> files belong there.  The bootloader is really the only thing that
cares
> about them as objects.  Once the kernel starts, it's just
dereferencing
> a pointer that happens to point to a datastructure it understands (or
> copying it as a blob before doing same).
> 
> In fact, you could mount an argument that .dts files don't belong
> anywhere near the MicroBlaze kernel, since our build process never
> actually touches them.

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

Steve




^ permalink raw reply	[flat|nested] 170+ messages in thread

* RE: [PATCH 07/56] microblaze_v2: Signal support
  2008-05-06  0:13                   ` Stephen Neuendorffer
@ 2008-05-06  0:25                     ` John Williams
  2008-05-06  0:33                       ` Stephen Neuendorffer
  0 siblings, 1 reply; 170+ messages in thread
From: John Williams @ 2008-05-06  0:25 UTC (permalink / raw)
  To: Stephen Neuendorffer
  Cc: monstr, linux-kernel, arnd, linux-arch, John Linn, matthew,
	will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

On Mon, 2008-05-05 at 17:13 -0700, Stephen Neuendorffer wrote:
> I'm somewhat ignorant about what this code is attempting to do, but with
> some quick poking around (m68knommu, blackfin) seems to suggest that
> other architectures don't do this, while others (v850) have almost
> exactly the same code (although they are somewhat smarter and are
> careful not to flush the whole cache).
> 
> At the very least, it seems like there is some work in this area needed.

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

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

Cheers,

John



^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 24/56] microblaze_v2: time support
  2008-05-05 14:22                                                   ` Michal Simek
@ 2008-05-06  0:30                                                     ` John Williams
  2008-05-06  9:56                                                       ` Michal Simek
  2008-05-06 10:02                                                       ` Michal Simek
  0 siblings, 2 replies; 170+ messages in thread
From: John Williams @ 2008-05-06  0:30 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

[-- Attachment #1: Type: text/plain, Size: 397 bytes --]

Hi Michal,

On Mon, 2008-05-05 at 16:22 +0200, Michal Simek wrote:
> Hi John,
> 
> you wrote me you have smarter implementation that xilinx did. Can you find it
> and send me it?

It's not much (any?) better?  One less multiply I think?  Attached
anyway - feel free to discard for now.

We could do a nice asm implementation with the optional mulhi
instruction, but that can wait.

Cheers,

John


[-- Attachment #2: delay-improvement.patch --]
[-- Type: text/x-patch, Size: 2905 bytes --]

diff --git a/include/asm-microblaze/delay.h b/include/asm-microblaze/delay.h
index 481359c..e29a4de 100644
--- a/include/asm-microblaze/delay.h
+++ b/include/asm-microblaze/delay.h
@@ -2,32 +2,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
+ * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
  * Copyright (C) 2006 Atmark Techno, Inc.
  */
 
-#ifndef _ASM_MICROBLAZE_DELAY_H
-#define _ASM_MICROBLAZE_DELAY_H
+#ifndef _ASM_DELAY_H
+#define _ASM_DELAY_H
 
-#include <asm/param.h>
+#include <asm/param.h>		/* For HZ */
 
-static inline void __delay(unsigned long loops)
+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));
+		      "1: addi	%0, %0, -1	\t\n"		\
+		      "bneid	%0, 1b		\t\n"		\
+		      "nop			\t\n"
+		      : "=r" (loops)
+		      : "0" (loops));
 }
 
-static inline void udelay(unsigned long usec)
+/*
+ * 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 = usec;
-	unsigned long loops = (tmp * 4295 * HZ * loops_per_jiffy) >> 32;
+	unsigned long long tmp=(unsigned long long)x*(unsigned long long)loops_per_jiffy*226LL;
+	unsigned loops=tmp>>32;
+
 	__delay(loops);
 }
 
-#endif /* _ASM_MICROBLAZE_DELAY_H */
+extern __inline__ void __ndelay(unsigned int x)
+{
+	unsigned long long tmp=(unsigned long long)x*(unsigned long long)loops_per_jiffy*226LL;
+	unsigned loops=tmp>>32;
+
+	__delay(loops);
+}
+
+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(): __ndelay((n) * HZ)) : \
+	__ndelay((n) * HZ))
+
+#define muldiv(a, b, c)    (((a)*(b))/(c))
+
+#endif /* _ASM_DELAY_H */

^ permalink raw reply related	[flat|nested] 170+ messages in thread

* RE: [PATCH 07/56] microblaze_v2: Signal support
  2008-05-06  0:25                     ` John Williams
@ 2008-05-06  0:33                       ` Stephen Neuendorffer
  2008-05-06  9:41                         ` Michal Simek
  0 siblings, 1 reply; 170+ messages in thread
From: Stephen Neuendorffer @ 2008-05-06  0:33 UTC (permalink / raw)
  To: John Williams
  Cc: monstr, linux-kernel, arnd, linux-arch, John Linn, matthew,
	will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek


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

Steve

> -----Original Message-----
> From: John Williams [mailto:john.williams@petalogix.com]
> Sent: Monday, May 05, 2008 5:26 PM
> To: Stephen Neuendorffer
> Cc: monstr@seznam.cz; linux-kernel@vger.kernel.org; arnd@arndb.de;
linux-arch@vger.kernel.org; John
> Linn; matthew@wil.cx; will.newton@gmail.com; drepper@redhat.com;
microblaze-uclinux@itee.uq.edu.au;
> grant.likely@secretlab.ca; Michal Simek
> Subject: RE: [PATCH 07/56] microblaze_v2: Signal support
> 
> On Mon, 2008-05-05 at 17:13 -0700, Stephen Neuendorffer wrote:
> > I'm somewhat ignorant about what this code is attempting to do, but
with
> > some quick poking around (m68knommu, blackfin) seems to suggest that
> > other architectures don't do this, while others (v850) have almost
> > exactly the same code (although they are somewhat smarter and are
> > careful not to flush the whole cache).
> >
> > At the very least, it seems like there is some work in this area
needed.
> 
> flush_cache_sigtramp should just invalidate 8 bytes up from the base
> address of the trampoline.  This is just the region on the process
stack
> where we insert a kind of call-back back.  Writing the opcodes goes
via
> the dcache, and so there's a vanishingly small possibility that the
CPU
> will get a false hit on on an icache fetch when the code is executed.
> 
> That was what Michal's patch had when I scanned it yesterday.  It
> certainly won't/shouldn't be invalidating the entire cache.
> 
> Cheers,
> 
> John
> 
> 



^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 04/56] microblaze_v2: Open firmware files
  2008-05-05 21:56         ` Stephen Neuendorffer
@ 2008-05-06  7:27           ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-06  7:27 UTC (permalink / raw)
  To: Stephen Neuendorffer
  Cc: linux-kernel, arnd, linux-arch, John Linn, john.williams,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

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

M

> Michal,
> 
> You're missing some of the stuff implemented in powerpc/prom_parse.c, in
> particular this:
> 
> Steve
> 
>> +/**
>> + * of_irq_map_one - Resolve an interrupt for a device
>> + * @device:	the device whose interrupt is to be resolved
>> + * @index:	index of the interrupt to resolve
>> + * @out_irq:	structure of_irq filled by this function
>> + *
>> + * This function resolves an interrupt, walking the tree, for a given
>> + * device-tree node. It's the high level pendant to of_irq_map_raw().
>> + * It also implements the workarounds for OldWolrd Macs.
>> + */
>> +extern int of_irq_map_one(struct device_node *device, int index,
>> +			struct of_irq *out_irq);
>> +
> 
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 10/56] microblaze_v2: Generic dts file for platforms
  2008-05-05 23:32                         ` Stephen Neuendorffer
  2008-05-06  0:10                           ` John Williams
@ 2008-05-06  7:38                           ` Michal Simek
  1 sibling, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-06  7:38 UTC (permalink / raw)
  To: Stephen Neuendorffer
  Cc: John Williams, monstr, linux-kernel, arnd, linux-arch, John Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely

Steve,

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

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

M

> Although powerpc has a bit more boot-time complexity than the microblaze
> does currently, I think it makes alot of sense to have some consistency
> here, and there is already a pattern to follow here which nicely
> orthogonalizes multiple .dts files for the same platform code.
>
> Steve
> 
>> -----Original Message-----
>> From: John Williams [mailto:john.williams@petalogix.com]
>> Sent: Monday, May 05, 2008 4:17 PM
>> To: Stephen Neuendorffer
>> Cc: monstr@seznam.cz; linux-kernel@vger.kernel.org; arnd@arndb.de;
> linux-arch@vger.kernel.org; John
>> Linn; matthew@wil.cx; will.newton@gmail.com; drepper@redhat.com;
> microblaze-uclinux@itee.uq.edu.au;
>> grant.likely@secretlab.ca; Michal Simek
>> Subject: RE: [PATCH 10/56] microblaze_v2: Generic dts file for
> platforms
>> On Mon, 2008-05-05 at 10:25 -0700, Stephen Neuendorffer wrote:
>>> I think it would be nice if dts files were stored in boot/dts, as on
>>> powerpc, which would reduce confusion.
>> I'm not so sure.  By grouping
>>
>>  * the DTS
>>  * Kconfig.auto (now just storing CPU parameters for CPUFLAGS); and
>>  * board-specific setup.c if required,
>>
>> we concentrate in one place, in a single subdir of
>> arch/microblaze/platform/*, all of the board specific info.
>>
>> Maybe our Kbuild should copy the platform .dts file out of the
> platform
>> dir and into microblaze/boot, like we do with the finished kernel?
> Then
>> it's ready to be picked up by the user or some higher level build
> tool.
>> If users or vendors want to maintain multiple DTS files for a single
>> board, again they can just collect them in the platform subdir so
> their
>> intended target remains obvious.
>>
>> John
>>
>>
>>> Steve
>>>
>>>> -----Original Message-----
>>>> From: monstr@seznam.cz [mailto:monstr@seznam.cz]
>>>> Sent: Sunday, May 04, 2008 4:41 AM
>>>> To: linux-kernel@vger.kernel.org
>>>> Cc: arnd@arndb.de; linux-arch@vger.kernel.org; Stephen
> Neuendorffer;
>>> John Linn;
>>>> john.williams@petalogix.com; matthew@wil.cx;
> will.newton@gmail.com;
>>> drepper@redhat.com; microblaze-
>>>> uclinux@itee.uq.edu.au; grant.likely@secretlab.ca; Michal Simek
>>>> Subject: [PATCH 10/56] microblaze_v2: Generic dts file for
> platforms
>>>> From: Michal Simek <monstr@monstr.eu>
>>>>
>>>>
>>>> Signed-off-by: Michal Simek <monstr@monstr.eu>
>>>> ---
>>>>  arch/microblaze/platform/generic/system.dts |  137
>>> +++++++++++++++++++++++++++
>>>>  1 files changed, 137 insertions(+), 0 deletions(-)
>>>>  create mode 100644 arch/microblaze/platform/generic/system.dts
>> --
>> John Williams, PhD, B.Eng, B.IT
>> PetaLogix - Linux Solutions for a Reconfigurable World
>> w: www.petalogix.com  p: +61-7-30090663  f: +61-7-30090663
>>
>>
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 10/56] microblaze_v2: Generic dts file for platforms
  2008-05-06  0:10                           ` John Williams
  2008-05-06  0:17                             ` Stephen Neuendorffer
@ 2008-05-06  7:50                             ` Michal Simek
  1 sibling, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-06  7:50 UTC (permalink / raw)
  To: John Williams
  Cc: Stephen Neuendorffer, monstr, linux-kernel, arnd, linux-arch,
	John Linn, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely

Hi John and Steve,

>> The .dts is not board specific, it's design specific.  
> 
> Sure.  I'm not sure how that changes where the .DTS files should be
> stored.

I will not change this handling with platform now.

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

ACK. I use platforms for testing too.

>> In my opinion,
>> this is not something that 'a vendor might maintain multiple versions
>> of': instead it is in most cases simply fundamental to the FPGA design
>> flow.
> 
> Sure it is.  Here's an ML505 design using the DVI video out.  Here's one
> using the LL_TEMAC in SGMII mode.  Multiple designs, same board, all
> will use the same board init but different DTS files.
> 
> These could be thrown down in /boot along with every other tree, but
> why?  They have nothing in common with the other files down there, and
> everything in common with the board/design-specific code.
> 
> Am I missing something?

yes. One board many designs that's all.

>>   In fact, in most cases, I'd like to make the .dts file part of
>> the bitstream and not compiled into the kernel.
> 
> Well, I've just run out of BRAM on a V5LX50T design so please don't ask
> for more of it to store a DTC! :)  Or do you mean to piggyback on the
> tail of the configuration stream and read with some kind of JTAG user
> code?

snip

>> Although powerpc has a bit more boot-time complexity than the microblaze
>> does currently, I think it makes alot of sense to have some consistency
>> here, and there is already a pattern to follow here which nicely
>> orthogonalizes multiple .dts files for the same platform code.
> 
> arch/powerpc/boot is building a bootloader, so maybe that's why .dts
> files belong there.  The bootloader is really the only thing that cares
> about them as objects.  Once the kernel starts, it's just dereferencing
> a pointer that happens to point to a datastructure it understands (or
> copying it as a blob before doing same).
> 
> In fact, you could mount an argument that .dts files don't belong
> anywhere near the MicroBlaze kernel, since our build process never
> actually touches them.  

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

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

Michal

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 18/56] microblaze_v2: early_printk support
  2008-05-05 23:22                                     ` John Williams
@ 2008-05-06  8:14                                       ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-06  8:14 UTC (permalink / raw)
  To: John Williams
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

Make sense.
I'll add it.

Thanks,
M
> On Sun, 2008-05-04 at 13:41 +0200, monstr@seznam.cz wrote:
> 
>> +++ b/arch/microblaze/kernel/early_printk.c
> 
>> +static void early_printk_putc(char c)
>> +{
>> +	while (ioread32(STATUS) & (1<<3));
>> +	iowrite32((c & 0xff), TX_FIFO);
>> +}
> 
> The while() loop needs a retry counter - if you configure
> EARLY_PRINTK_BASE_ADDRESS wrongly and it points to memory or anything
> that is not a uartlite, the loop spins forever and you get silent
> lockup.  Not nice behaviour from debug code :)
> 
> Here's my current implementation:
> 
> static void early_printk_putc(char c)
> {
>         /* Limit how many times we'll spin waiting for TX FIFO status.
>            This will prevent lockups if the base address is incorrectly
> set, or
>            any other issue on the UARTLITE.
> 
>            This limit is pretty arbitrary, unless we are at about 10
> baud 
>            we'll never timeout on a working UART. */
> 
>         unsigned retries=10000;
>         while (retries-- && (ioread32(STATUS) & (1<<3)))
>                 ;
> 
>         /* Only attempt the iowrite if we didn't timeout */
>         if(retries)
>                 iowrite32((c & 0xff), TX_FIFO);
> }
> 
> Cheers
> 
> John
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 38/56] microblaze_v2: atomic.h bitops.h byteorder.h
  2008-05-05  2:28                                                                               ` John Williams
@ 2008-05-06  8:42                                                                                 ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-06  8:42 UTC (permalink / raw)
  To: John Williams
  Cc: Arnd Bergmann, linux-kernel, linux-arch, stephen.neuendorffer,
	John.Linn, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

Hi All,

have someone any idea about others names of atomic.h in asm-generic?

If not - I'll choose one but not the last(atomic-wish-we-had-it-native.h). :-)

M

> On Sun, 2008-05-04 at 23:58 +0200, Arnd Bergmann wrote:
>> On Sunday 04 May 2008, monstr@seznam.cz wrote:
>>>  include/asm-microblaze/atomic.h    |  108 ++++++++++++++++++++++++++++++++++++
>> It would be cool if you could introduce this file as 
>> asm-generic/atomic-irqdisable.h or similar (can someone please
>> think of a better name?).
> 
> atomic-nonnative.h?
> 
> atomic-emulated.h?
> 
> atomic-wish-we-had-it-native.h?
> 
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 02/56] microblaze_v2: Makefiles for Microblaze cpu
  2008-05-05  1:47     ` [PATCH 02/56] microblaze_v2: Makefiles for Microblaze cpu John Williams
@ 2008-05-06  8:51       ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-06  8:51 UTC (permalink / raw)
  To: John Williams
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely,
	Michal Simek

Hi John,

>> --- /dev/null
>> +++ b/arch/microblaze/Makefile
>> @@ -0,0 +1,63 @@
>> +UTS_SYSNAME = -DUTS_SYSNAME=\"uClinux\"
>> +
>> +# What CPU vesion are we building for, and crack it open
>> +# as major.minor.rev
>> +CPU_VER=$(subst ",,$(CONFIG_XILINX_MICROBLAZE0_HW_VER) )
>> +CPU_MAJOR=$(shell echo $(CPU_VER) | cut -d '.' -f 1)
>> +CPU_MINOR=$(shell echo $(CPU_VER) | cut -d '.' -f 2)
>> +CPU_REV=$(shell echo $(CPU_VER) | cut -d '.' -f 3)
> 
> No doubt there's some cleaner shell-fu to do this but I'm not
> complaining as I'm responsible for the original yucky version!

I think you told me that toolchain can use this flags. This is not pain for now.
I'll add to my future plans.

>> --- /dev/null
>> +++ b/arch/microblaze/platform/Makefile
>> @@ -0,0 +1,3 @@
>> +#
>> +# Makefile for arch/microblaze/platform directory
>> +#
> 
> How about a single 
> 
> obj-$(CONFIG_PLATFORM_GENERIC) += generic/
> 
> to show how platform-specific setup code can be added (even though
> there's none in the default generic target)?

We'll add this to Microblaze readme file. Chapter: how to add platform specific
files.

M


^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 45/56] microblaze_v2: headers simple files - empty or redirect to asm-generic
  2008-05-05 15:10                                                                                             ` Grant Likely
@ 2008-05-06  9:02                                                                                               ` Arnd Bergmann
  0 siblings, 0 replies; 170+ messages in thread
From: Arnd Bergmann @ 2008-05-06  9:02 UTC (permalink / raw)
  To: Grant Likely
  Cc: John Williams, monstr, linux-kernel, linux-arch,
	stephen.neuendorffer, John.Linn, matthew, will.newton, drepper,
	microblaze-uclinux, Michal Simek

On Monday 05 May 2008, Grant Likely wrote:
> >  These are all just includes of asm-generic/* (hooray!).
> >
> >  But, is it reasonable to to suggest adding asm-generic at the end of the
> >  kernel include path, and save all this verbosity?
> >
> >  Principle of least surprise maybe?
> 
> Convention in the other archs is already established to explicitly
> include asm-generic files one by one.  It is probably best to match
> existing convention for commonality sake.

Right, I agree. We may eventually want to move to something more sophisticated,
but we should not change the current way of doing this while we're in the process
of adding a new architecture.

	Arnd <><

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 46/56] microblaze_v2: headers files entry.h current.h mman.h registers.h sembuf.h
  2008-05-05  9:54                                                                                             ` [PATCH 46/56] microblaze_v2: headers files entry.h current.h mman.h registers.h sembuf.h Arnd Bergmann
@ 2008-05-06  9:07                                                                                               ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-06  9:07 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kernel, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

Hi Arnd,

I keep mman.h in this style. I see the best way push microblaze to mainline and
then synchronize all these files together among all archs.

I'll add it to my future list.

M


> On Sunday 04 May 2008, monstr@seznam.cz wrote:
>> +#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 */
> 
> I think we should come up with a good way to fold these into the
> asm-generic header, as half the architectures use the same values
> for them, in addition to what is already shared.
> 
> 	Arnd <><
> 

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 36/56] microblaze_v2: dma support
  2008-05-05  6:45                                                                           ` Geert Uytterhoeven
@ 2008-05-06  9:16                                                                             ` Michal Simek
  2008-05-06  9:48                                                                               ` Geert Uytterhoeven
  0 siblings, 1 reply; 170+ messages in thread
From: Michal Simek @ 2008-05-06  9:16 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: John Williams, linux-kernel, arnd, linux-arch,
	stephen.neuendorffer, John.Linn, matthew, will.newton, drepper,
	microblaze-uclinux, grant.likely, Michal Simek

Hi Geert,

> On Mon, 5 May 2008, John Williams wrote:
>>> +++ b/include/asm-microblaze/scatterlist.h
>>> @@ -0,0 +1,21 @@
>>> +/*
>>> + * include/asm-microblaze/scatterlist.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_SCATTERLIST_H
>>> +#define _ASM_MICROBLAZE_SCATTERLIST_H
>>> +
>>> +struct scatterlist {
>>> +	unsigned long page_link;
>>> +	unsigned int	offset;
>>> +	dma_addr_t	dma_address;
>>> +	unsigned int	length;
>>> +};
>>> +
>>> +#endif /* _ASM_MICROBLAZE_SCATTERLIST_H */
>> Is this worthy of promotion to asm-generic/scatterlist.h?
> 
> after moving dma_address one position up in the structure, as dma_addr_t may be
> 64-bit?

dma_addr_t is defined in types.h. If your arch want to use 64bit addr, you can
define it in types.h.

I keep scatterlist.h in asm-microblaze. Adding to asm-generic later.

Michal

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [microblaze-uclinux] [PATCH 09/56] microblaze_v2: cache support
  2008-05-05 17:37                   ` [microblaze-uclinux] " Stephen Neuendorffer
@ 2008-05-06  9:22                     ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-06  9:22 UTC (permalink / raw)
  To: Stephen Neuendorffer
  Cc: microblaze-uclinux, linux-kernel, arnd, linux-arch, John Linn,
	john.williams, matthew, will.newton, drepper, grant.likely

Hi Steve,

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

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

M

> I'll try to cook up a patch for you with this today.
> 
> Steve
> 
>> +#define flush_cache_all()			__flush_cache_all()
>> +#define flush_cache_mm(mm)			do { } while (0)
>> +#define flush_cache_range(vma, start, end)	__flush_cache_all()
>> +#define flush_cache_page(vma, vmaddr, pfn)	do { } while (0)
>> +
>> +#define flush_dcache_range(start, end)
> __flush_dcache_range(start, end)
>> +#define flush_dcache_page(page)		do { } while (0)
>> +#define flush_dcache_mmap_lock(mapping)		do { } while (0)
>> +#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
>> +
>> +#define flush_icache_range(start, len)
> __flush_icache_range(start, len)
>> +#define flush_icache_page(vma, pg)		do { } while (0)
>> +#define flush_icache_user_range(start, len)	do { } while (0)
>> +
>> +#define flush_cache_vmap(start, end)		do { } while (0)
>> +#define flush_cache_vunmap(start, end)		do { } while (0)
>> +
>> +struct page;
>> +struct mm_struct;
>> +struct vm_area_struct;
>> +
>> +/* see arch/microblaze/kernel/cache.c */
>> +extern void __flush_icache_all(void);
>> +extern void __flush_icache_range(unsigned long start, unsigned long
> end);
>> +extern void __flush_icache_page(struct vm_area_struct *vma, struct
> page *page);
>> +extern void __flush_icache_user_range(struct vm_area_struct *vma,
>> +				struct page *page,
>> +				unsigned long adr, int len);
>> +extern void __flush_cache_sigtramp(unsigned long addr);
>> +
>> +extern void __flush_dcache_all(void);
>> +extern void __flush_dcache_range(unsigned long start, unsigned long
> end);
>> +extern void __flush_dcache_page(struct vm_area_struct *vma, struct
> page *page);
>> +extern void __flush_dcache_user_range(struct vm_area_struct *vma,
>> +				struct page *page,
>> +				unsigned long adr, int len);
>> +
>> +extern inline void __flush_cache_all(void)
>> +{
>> +	__flush_icache_all();
>> +	__flush_dcache_all();
>> +}
>> +
>> +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
>> +do { memcpy(dst, src, len); \
>> +	flush_icache_user_range(vma, page, vaddr, len); \
>> +} while (0)
>> +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
>> +	memcpy(dst, src, len)
>> +
>> +#endif /* _ASM_MICROBLAZE_CACHEFLUSH_H */
>> --
>> 1.5.4.GIT
>>
>> ___________________________
>> microblaze-uclinux mailing list
>> microblaze-uclinux@itee.uq.edu.au
>> Project Home Page :
> http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
>> Mailing List Archive :
> http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 07/56] microblaze_v2: Signal support
  2008-05-06  0:33                       ` Stephen Neuendorffer
@ 2008-05-06  9:41                         ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-06  9:41 UTC (permalink / raw)
  To: Stephen Neuendorffer
  Cc: John Williams, monstr, linux-kernel, arnd, linux-arch, John Linn,
	matthew, will.newton, drepper, microblaze-uclinux, grant.likely

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

M


> You're right.  (I think I've been staring at this too much today... :)
> 
> Steve
> 
>> -----Original Message-----
>> From: John Williams [mailto:john.williams@petalogix.com]
>> Sent: Monday, May 05, 2008 5:26 PM
>> To: Stephen Neuendorffer
>> Cc: monstr@seznam.cz; linux-kernel@vger.kernel.org; arnd@arndb.de;
> linux-arch@vger.kernel.org; John
>> Linn; matthew@wil.cx; will.newton@gmail.com; drepper@redhat.com;
> microblaze-uclinux@itee.uq.edu.au;
>> grant.likely@secretlab.ca; Michal Simek
>> Subject: RE: [PATCH 07/56] microblaze_v2: Signal support
>>
>> On Mon, 2008-05-05 at 17:13 -0700, Stephen Neuendorffer wrote:
>>> I'm somewhat ignorant about what this code is attempting to do, but
> with
>>> some quick poking around (m68knommu, blackfin) seems to suggest that
>>> other architectures don't do this, while others (v850) have almost
>>> exactly the same code (although they are somewhat smarter and are
>>> careful not to flush the whole cache).
>>>
>>> At the very least, it seems like there is some work in this area
> needed.
>> flush_cache_sigtramp should just invalidate 8 bytes up from the base
>> address of the trampoline.  This is just the region on the process
> stack
>> where we insert a kind of call-back back.  Writing the opcodes goes
> via
>> the dcache, and so there's a vanishingly small possibility that the
> CPU
>> will get a false hit on on an icache fetch when the code is executed.
>>
>> That was what Michal's patch had when I scanned it yesterday.  It
>> certainly won't/shouldn't be invalidating the entire cache.
>>
>> Cheers,
>>
>> John
>>
>>
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 36/56] microblaze_v2: dma support
  2008-05-06  9:16                                                                             ` Michal Simek
@ 2008-05-06  9:48                                                                               ` Geert Uytterhoeven
  2008-05-06  9:53                                                                                 ` Michal Simek
  0 siblings, 1 reply; 170+ messages in thread
From: Geert Uytterhoeven @ 2008-05-06  9:48 UTC (permalink / raw)
  To: Michal Simek
  Cc: John Williams, linux-kernel, arnd, linux-arch,
	stephen.neuendorffer, John.Linn, matthew, will.newton, drepper,
	microblaze-uclinux, grant.likely, Michal Simek

On Tue, 6 May 2008, Michal Simek wrote:
> > On Mon, 5 May 2008, John Williams wrote:
> >>> +++ b/include/asm-microblaze/scatterlist.h
> >>> @@ -0,0 +1,21 @@
> >>> +/*
> >>> + * include/asm-microblaze/scatterlist.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_SCATTERLIST_H
> >>> +#define _ASM_MICROBLAZE_SCATTERLIST_H
> >>> +
> >>> +struct scatterlist {
> >>> +	unsigned long page_link;
> >>> +	unsigned int	offset;
> >>> +	dma_addr_t	dma_address;
> >>> +	unsigned int	length;
> >>> +};
> >>> +
> >>> +#endif /* _ASM_MICROBLAZE_SCATTERLIST_H */
> >> Is this worthy of promotion to asm-generic/scatterlist.h?
> > 
> > after moving dma_address one position up in the structure, as dma_addr_t may be
> > 64-bit?
> 
> dma_addr_t is defined in types.h. If your arch want to use 64bit addr, you can
> define it in types.h.

Sorry for not making myself clear: If unsigned long and dma_addr_t are 64-bit,
there may be a hole in between offset and dma_address, due to alignment
restrictions. So it's better to move dma_address up.

As dma_addr_t may be 64-bit even on 32-bit architectures, it may be best
to move it even to the start of the structure.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 36/56] microblaze_v2: dma support
  2008-05-06  9:48                                                                               ` Geert Uytterhoeven
@ 2008-05-06  9:53                                                                                 ` Michal Simek
  2008-05-06 11:17                                                                                   ` Geert Uytterhoeven
  0 siblings, 1 reply; 170+ messages in thread
From: Michal Simek @ 2008-05-06  9:53 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: John Williams, linux-kernel, arnd, linux-arch,
	stephen.neuendorffer, John.Linn, matthew, will.newton, drepper,
	microblaze-uclinux, grant.likely, Michal Simek


Hi,
> On Tue, 6 May 2008, Michal Simek wrote:
>>> On Mon, 5 May 2008, John Williams wrote:
>>>>> +++ b/include/asm-microblaze/scatterlist.h
>>>>> @@ -0,0 +1,21 @@
>>>>> +/*
>>>>> + * include/asm-microblaze/scatterlist.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_SCATTERLIST_H
>>>>> +#define _ASM_MICROBLAZE_SCATTERLIST_H
>>>>> +
>>>>> +struct scatterlist {
>>>>> +	unsigned long page_link;
>>>>> +	unsigned int	offset;
>>>>> +	dma_addr_t	dma_address;
>>>>> +	unsigned int	length;
>>>>> +};
>>>>> +
>>>>> +#endif /* _ASM_MICROBLAZE_SCATTERLIST_H */
>>>> Is this worthy of promotion to asm-generic/scatterlist.h?
>>> after moving dma_address one position up in the structure, as dma_addr_t may be
>>> 64-bit?
>> dma_addr_t is defined in types.h. If your arch want to use 64bit addr, you can
>> define it in types.h.
> 
> Sorry for not making myself clear: If unsigned long and dma_addr_t are 64-bit,
> there may be a hole in between offset and dma_address, due to alignment
> restrictions. So it's better to move dma_address up.
> 
> As dma_addr_t may be 64-bit even on 32-bit architectures, it may be best
> to move it even to the start of the structure.

yes, only move length is enough.

struct scatterlist {
	unsigned long page_link;
	unsigned int	offset;
	unsigned int	length;
	dma_addr_t	dma_address;
};


Michal

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 24/56] microblaze_v2: time support
  2008-05-06  0:30                                                     ` John Williams
@ 2008-05-06  9:56                                                       ` Michal Simek
  2008-05-06 10:02                                                       ` Michal Simek
  1 sibling, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-06  9:56 UTC (permalink / raw)
  To: John Williams
  Cc: monstr, linux-kernel, arnd, linux-arch, stephen.neuendorffer,
	John.Linn, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely

Hi John,

> Hi Michal,
> 
> On Mon, 2008-05-05 at 16:22 +0200, Michal Simek wrote:
>> Hi John,
>>
>> you wrote me you have smarter implementation that xilinx did. Can you find it
>> and send me it?
> 
> It's not much (any?) better?  One less multiply I think?  Attached
> anyway - feel free to discard for now.
> 
> We could do a nice asm implementation with the optional mulhi
> instruction, but that can wait.
> 
> Cheers,
> 
> John

+extern __inline__ void __udelay(unsigned int x)
 {
-	unsigned long long tmp = usec;
-	unsigned long loops = (tmp * 4295 * HZ * loops_per_jiffy) >> 32;
+	unsigned long long tmp=(unsigned long long)x*(unsigned long
long)loops_per_jiffy*226LL;
+	unsigned loops=tmp>>32;
+
 	__delay(loops);
 }

-#endif /* _ASM_MICROBLAZE_DELAY_H */
+extern __inline__ void __ndelay(unsigned int x)
+{
+	unsigned long long tmp=(unsigned long long)x*(unsigned long
long)loops_per_jiffy*226LL;
+	unsigned loops=tmp>>32;
+
+	__delay(loops);
+}

Why is __ndelay implementation the same with __udelay? This is weird for me.

+
+extern void __bad_udelay(void);		/* deliberately undefined */
+extern void __bad_ndelay(void);		/* deliberately undefined */

Are these function used anywhere?

+#define udelay(n) (__builtin_constant_p(n)? \
+	((n) > __MAX_UDELAY? __bad_udelay(): __udelay((n) * (19 * HZ))) : \
+	__udelay((n) * (19 * HZ)))
+
+#define ndelay(n) (__builtin_constant_p(n)? \
+	((n) > __MAX_NDELAY? __bad_ndelay(): __ndelay((n) * HZ)) : \
+	__ndelay((n) * HZ))

+#define muldiv(a, b, c)    (((a)*(b))/(c))

muldiv: Where is this use?

Michal

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 24/56] microblaze_v2: time support
  2008-05-06  0:30                                                     ` John Williams
  2008-05-06  9:56                                                       ` Michal Simek
@ 2008-05-06 10:02                                                       ` Michal Simek
  2008-05-06 11:38                                                         ` Arnd Bergmann
  1 sibling, 1 reply; 170+ messages in thread
From: Michal Simek @ 2008-05-06 10:02 UTC (permalink / raw)
  To: John Williams
  Cc: monstr, linux-kernel, arnd, linux-arch, stephen.neuendorffer,
	John.Linn, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely

Hi All,

I saw a lot of comments about files but I have never seen any comments that
any file is OK.
Does it mean everything is broken??? I don't think so.

I'll integrate reported bugs and send microblaze_v3 version.

Thanks,
Michal

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 36/56] microblaze_v2: dma support
  2008-05-06  9:53                                                                                 ` Michal Simek
@ 2008-05-06 11:17                                                                                   ` Geert Uytterhoeven
  2008-05-06 11:24                                                                                     ` Arnd Bergmann
  0 siblings, 1 reply; 170+ messages in thread
From: Geert Uytterhoeven @ 2008-05-06 11:17 UTC (permalink / raw)
  To: Michal Simek
  Cc: John Williams, linux-kernel, arnd, linux-arch,
	stephen.neuendorffer, John.Linn, matthew, will.newton, drepper,
	microblaze-uclinux, grant.likely, Michal Simek

On Tue, 6 May 2008, Michal Simek wrote:
> > On Tue, 6 May 2008, Michal Simek wrote:
> >>> On Mon, 5 May 2008, John Williams wrote:
> >>>>> +++ b/include/asm-microblaze/scatterlist.h
> >>>>> @@ -0,0 +1,21 @@
> >>>>> +/*
> >>>>> + * include/asm-microblaze/scatterlist.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_SCATTERLIST_H
> >>>>> +#define _ASM_MICROBLAZE_SCATTERLIST_H
> >>>>> +
> >>>>> +struct scatterlist {
> >>>>> +	unsigned long page_link;
> >>>>> +	unsigned int	offset;
> >>>>> +	dma_addr_t	dma_address;
> >>>>> +	unsigned int	length;
> >>>>> +};
> >>>>> +
> >>>>> +#endif /* _ASM_MICROBLAZE_SCATTERLIST_H */
> >>>> Is this worthy of promotion to asm-generic/scatterlist.h?
> >>> after moving dma_address one position up in the structure, as dma_addr_t may be
> >>> 64-bit?
> >> dma_addr_t is defined in types.h. If your arch want to use 64bit addr, you can
> >> define it in types.h.
> > 
> > Sorry for not making myself clear: If unsigned long and dma_addr_t are 64-bit,
> > there may be a hole in between offset and dma_address, due to alignment
> > restrictions. So it's better to move dma_address up.
> > 
> > As dma_addr_t may be 64-bit even on 32-bit architectures, it may be best
> > to move it even to the start of the structure.
> 
> yes, only move length is enough.

No it's not.

> struct scatterlist {
> 	unsigned long page_link;
> 	unsigned int	offset;
> 	unsigned int	length;
> 	dma_addr_t	dma_address;
> };

If unsigned long is 32-bit but dma_addr_t is 64-bit, there may be a gap
between length and dma_address.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 36/56] microblaze_v2: dma support
  2008-05-06 11:17                                                                                   ` Geert Uytterhoeven
@ 2008-05-06 11:24                                                                                     ` Arnd Bergmann
  2008-05-06 13:20                                                                                       ` Michal Simek
  0 siblings, 1 reply; 170+ messages in thread
From: Arnd Bergmann @ 2008-05-06 11:24 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Michal Simek, John Williams, linux-kernel, linux-arch,
	stephen.neuendorffer, John.Linn, matthew, will.newton, drepper,
	microblaze-uclinux, grant.likely, Michal Simek

On Tuesday 06 May 2008, Geert Uytterhoeven wrote:
> > struct scatterlist {
> >       unsigned long page_link;
> >       unsigned int    offset;
> >       unsigned int    length;
> >       dma_addr_t      dma_address;
> > };
> 
> If unsigned long is 32-bit but dma_addr_t is 64-bit, there may be a gap
> between length and dma_address.
> 

But moving dma_address to the front only has the effect to create implicit
padding at the end of struct scatterlist, so you don't gain anything
either way.

It's only an internal definition that can be changed at any time without
breaking applications, so I wouldn't worry about it, and better leave
it identical to the other architectures.

The one thing that should indeed be changed is the addition of
'unsigned long sg_magic' that is needed for CONFIG_DEBUG_SG.

	Arnd <><

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 24/56] microblaze_v2: time support
  2008-05-06 10:02                                                       ` Michal Simek
@ 2008-05-06 11:38                                                         ` Arnd Bergmann
  2008-05-06 13:26                                                           ` Michal Simek
                                                                             ` (2 more replies)
  0 siblings, 3 replies; 170+ messages in thread
From: Arnd Bergmann @ 2008-05-06 11:38 UTC (permalink / raw)
  To: monstr
  Cc: John Williams, linux-kernel, linux-arch, stephen.neuendorffer,
	John.Linn, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely

On Tuesday 06 May 2008, Michal Simek wrote:
> I saw a lot of comments about files but I have never seen any comments that
> any file is OK.
> Does it mean everything is broken??? I don't think so.

I've commented mostly on the header files defining the ABI. Since my aim
is to have the ABI definition entirely in asm-generic/*.h, every exported
file that has more than one line in it should be changed.

The files that implement the architecture support itself all look good
to me, but since I'm not familiar with the architecture, I'm not trying
to comment on them.

I think you're doing a great job on this. Any patch set of this size that
has been maintained for a long time outside of the kernel goes through this
phase where everyone tells you what to improve, based on their experience,
while everything you do right about the patches is just taken for granted.

Don't let yourself get discouraged by the negative comments, we're really
all just trying to help you do the right thing!

> I'll integrate reported bugs and send microblaze_v3 version.

Ok, thanks!

	Arnd <><

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 36/56] microblaze_v2: dma support
  2008-05-06 11:24                                                                                     ` Arnd Bergmann
@ 2008-05-06 13:20                                                                                       ` Michal Simek
  2008-05-06 15:36                                                                                         ` Arnd Bergmann
  0 siblings, 1 reply; 170+ messages in thread
From: Michal Simek @ 2008-05-06 13:20 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Geert Uytterhoeven, Michal Simek, John Williams, linux-kernel,
	linux-arch, stephen.neuendorffer, John.Linn, matthew,
	will.newton, drepper, microblaze-uclinux, grant.likely

Hi all,

here is proposed struct.

struct scatterlist {
      dma_addr_t      	dma_address;
      unsigned long	page_link;
#ifdef CONFIG_DEBUG_SG
      unsigned long	sg_magic;
#endif
      unsigned int    	length;
      unsigned int    	offset;
};

Is it OK now?

Michal


>>> struct scatterlist {
>>>       unsigned long page_link;
>>>       unsigned int    offset;
>>>       unsigned int    length;
>>>       dma_addr_t      dma_address;
>>> };
>> If unsigned long is 32-bit but dma_addr_t is 64-bit, there may be a gap
>> between length and dma_address.
>>
> 
> But moving dma_address to the front only has the effect to create implicit
> padding at the end of struct scatterlist, so you don't gain anything
> either way.
> 
> It's only an internal definition that can be changed at any time without
> breaking applications, so I wouldn't worry about it, and better leave
> it identical to the other architectures.
> 
> The one thing that should indeed be changed is the addition of
> 'unsigned long sg_magic' that is needed for CONFIG_DEBUG_SG.
> 
> 	Arnd <><


^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 24/56] microblaze_v2: time support
  2008-05-06 11:38                                                         ` Arnd Bergmann
@ 2008-05-06 13:26                                                           ` Michal Simek
  2008-05-06 22:50                                                             ` John Williams
  2008-05-06 14:28                                                           ` Grant Likely
  2008-05-06 16:36                                                           ` Stephen Neuendorffer
  2 siblings, 1 reply; 170+ messages in thread
From: Michal Simek @ 2008-05-06 13:26 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: John Williams, linux-kernel, linux-arch, stephen.neuendorffer,
	John.Linn, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely

Hi Arnd,

I am not discouraged from negative comments. I got school from Wolfgang Denk on
U-BOOT project. (Thanks Wolfgang :-))

I only want to direct this to right way. That's all. And positive ACK to some
files give me better view what's wrong. :-)

Have a good day,
Michal


>> I saw a lot of comments about files but I have never seen any comments that
>> any file is OK.
>> Does it mean everything is broken??? I don't think so.
> 
> I've commented mostly on the header files defining the ABI. Since my aim
> is to have the ABI definition entirely in asm-generic/*.h, every exported
> file that has more than one line in it should be changed.
> 
> The files that implement the architecture support itself all look good
> to me, but since I'm not familiar with the architecture, I'm not trying
> to comment on them.
> 
> I think you're doing a great job on this. Any patch set of this size that
> has been maintained for a long time outside of the kernel goes through this
> phase where everyone tells you what to improve, based on their experience,
> while everything you do right about the patches is just taken for granted.
> 
> Don't let yourself get discouraged by the negative comments, we're really
> all just trying to help you do the right thing!
> 
>> I'll integrate reported bugs and send microblaze_v3 version.
> 
> Ok, thanks!
> 
> 	Arnd <><
> 
> 

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 24/56] microblaze_v2: time support
  2008-05-06 11:38                                                         ` Arnd Bergmann
  2008-05-06 13:26                                                           ` Michal Simek
@ 2008-05-06 14:28                                                           ` Grant Likely
  2008-05-06 16:36                                                           ` Stephen Neuendorffer
  2 siblings, 0 replies; 170+ messages in thread
From: Grant Likely @ 2008-05-06 14:28 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: monstr, John Williams, linux-kernel, linux-arch,
	stephen.neuendorffer, John.Linn, matthew, will.newton, drepper,
	microblaze-uclinux

On Tue, May 6, 2008 at 5:38 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday 06 May 2008, Michal Simek wrote:
>  > I saw a lot of comments about files but I have never seen any comments that
>  > any file is OK.
>  > Does it mean everything is broken??? I don't think so.
>
<snip>
>
>  I think you're doing a great job on this. Any patch set of this size that
>  has been maintained for a long time outside of the kernel goes through this
>  phase where everyone tells you what to improve, based on their experience,
>  while everything you do right about the patches is just taken for granted.
>
>  Don't let yourself get discouraged by the negative comments, we're really
>  all just trying to help you do the right thing!

Let me add my voice to Arnd's.  This is a *big* task and you're
handling it very well.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 45/56] microblaze_v2: headers simple files - empty or redirect to asm-generic
  2008-05-05  2:34                                                                                           ` [PATCH 45/56] microblaze_v2: headers simple files - empty or redirect to asm-generic John Williams
  2008-05-05 15:10                                                                                             ` Grant Likely
@ 2008-05-06 14:47                                                                                             ` Stephen Rothwell
  2008-05-06 15:23                                                                                               ` Michal Simek
  1 sibling, 1 reply; 170+ messages in thread
From: Stephen Rothwell @ 2008-05-06 14:47 UTC (permalink / raw)
  To: John Williams
  Cc: monstr, linux-kernel, arnd, linux-arch, stephen.neuendorffer,
	John.Linn, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

[-- Attachment #1: Type: text/plain, Size: 1439 bytes --]

On Mon, 05 May 2008 12:34:09 +1000 John Williams <john.williams@petalogix.com> wrote:
>
> 
> >  include/asm-microblaze/auxvec.h            |   14 ++++++++++++++
> >  include/asm-microblaze/cputime.h           |   16 ++++++++++++++++
> >  include/asm-microblaze/div64.h             |   16 ++++++++++++++++
> >  include/asm-microblaze/emergency-restart.h |   16 ++++++++++++++++
> >  include/asm-microblaze/errno.h             |   16 ++++++++++++++++
> >  include/asm-microblaze/futex.h             |   16 ++++++++++++++++
> >  include/asm-microblaze/kdebug.h            |   19 +++++++++++++++++++
> >  include/asm-microblaze/local.h             |   16 ++++++++++++++++
> >  include/asm-microblaze/mutex.h             |   16 ++++++++++++++++
> >  include/asm-microblaze/namei.h             |   24 ++++++++++++++++++++++++
> >  include/asm-microblaze/percpu.h            |   16 ++++++++++++++++
> >  include/asm-microblaze/resource.h          |   16 ++++++++++++++++
> >  include/asm-microblaze/user.h              |   18 ++++++++++++++++++
> 
> These are all just includes of asm-generic/* (hooray!).

Absolutely, but is it really necessary to have 14-16 lines of comment
(including a copyright notice) for a file whose single real line is just
to include another file?  i.e. reduce all these to 1 line files.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 45/56] microblaze_v2: headers simple files - empty or redirect to asm-generic
  2008-05-06 14:47                                                                                             ` Stephen Rothwell
@ 2008-05-06 15:23                                                                                               ` Michal Simek
  2008-05-06 15:38                                                                                                 ` Grant Likely
  2008-05-06 16:21                                                                                                 ` Arnd Bergmann
  0 siblings, 2 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-06 15:23 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: John Williams, monstr, linux-kernel, arnd, linux-arch,
	stephen.neuendorffer, John.Linn, matthew, will.newton, drepper,
	microblaze-uclinux, grant.likely

Hi,

> On Mon, 05 May 2008 12:34:09 +1000 John Williams <john.williams@petalogix.com> wrote:
>>
>>>  include/asm-microblaze/auxvec.h            |   14 ++++++++++++++
>>>  include/asm-microblaze/cputime.h           |   16 ++++++++++++++++
>>>  include/asm-microblaze/div64.h             |   16 ++++++++++++++++
>>>  include/asm-microblaze/emergency-restart.h |   16 ++++++++++++++++
>>>  include/asm-microblaze/errno.h             |   16 ++++++++++++++++
>>>  include/asm-microblaze/futex.h             |   16 ++++++++++++++++
>>>  include/asm-microblaze/kdebug.h            |   19 +++++++++++++++++++
>>>  include/asm-microblaze/local.h             |   16 ++++++++++++++++
>>>  include/asm-microblaze/mutex.h             |   16 ++++++++++++++++
>>>  include/asm-microblaze/namei.h             |   24 ++++++++++++++++++++++++
>>>  include/asm-microblaze/percpu.h            |   16 ++++++++++++++++
>>>  include/asm-microblaze/resource.h          |   16 ++++++++++++++++
>>>  include/asm-microblaze/user.h              |   18 ++++++++++++++++++
>> These are all just includes of asm-generic/* (hooray!).
> 
> Absolutely, but is it really necessary to have 14-16 lines of comment
> (including a copyright notice) for a file whose single real line is just
> to include another file?  i.e. reduce all these to 1 line files.

Can I do it? I think every file need license.

M

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 36/56] microblaze_v2: dma support
  2008-05-06 13:20                                                                                       ` Michal Simek
@ 2008-05-06 15:36                                                                                         ` Arnd Bergmann
  2008-05-07  6:24                                                                                           ` Michal Simek
  0 siblings, 1 reply; 170+ messages in thread
From: Arnd Bergmann @ 2008-05-06 15:36 UTC (permalink / raw)
  To: monstr
  Cc: Geert Uytterhoeven, John Williams, linux-kernel, linux-arch,
	stephen.neuendorffer, John.Linn, matthew, will.newton, drepper,
	microblaze-uclinux, grant.likely

On Tuesday 06 May 2008, Michal Simek wrote:
> here is proposed struct.
> 
> struct scatterlist {
>       dma_addr_t        dma_address;
>       unsigned long     page_link;
> #ifdef CONFIG_DEBUG_SG
>       unsigned long     sg_magic;
> #endif
>       unsigned int      length;
>       unsigned int      offset;
> };
> 
> Is it OK now?

Everyone else has the sg_magic first, which makes sense for debugging.
Don't worry about it too much, just use the same code as avr32, h8300,
blackfin, fvr, mk68knommu, mn10300, sh, v850 and xtensa.

These are all the same, but I just saw that they also have

#define sg_dma_address(sg)      ((sg)->dma_address)
#define sg_dma_len(sg)          ((sg)->length)

which you probably want as well.

	Arnd <><

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 45/56] microblaze_v2: headers simple files - empty or redirect to asm-generic
  2008-05-06 15:23                                                                                               ` Michal Simek
@ 2008-05-06 15:38                                                                                                 ` Grant Likely
  2008-05-06 16:21                                                                                                 ` Arnd Bergmann
  1 sibling, 0 replies; 170+ messages in thread
From: Grant Likely @ 2008-05-06 15:38 UTC (permalink / raw)
  To: monstr
  Cc: Stephen Rothwell, John Williams, linux-kernel, arnd, linux-arch,
	stephen.neuendorffer, John.Linn, matthew, will.newton, drepper,
	microblaze-uclinux

On Tue, May 6, 2008 at 9:23 AM, Michal Simek <monstr@seznam.cz> wrote:
> Hi,
>
>
>
>  > On Mon, 05 May 2008 12:34:09 +1000 John Williams <john.williams@petalogix.com> wrote:
>  >>
>  >>>  include/asm-microblaze/auxvec.h            |   14 ++++++++++++++
>  >>>  include/asm-microblaze/cputime.h           |   16 ++++++++++++++++
>  >>>  include/asm-microblaze/div64.h             |   16 ++++++++++++++++
>  >>>  include/asm-microblaze/emergency-restart.h |   16 ++++++++++++++++
>  >>>  include/asm-microblaze/errno.h             |   16 ++++++++++++++++
>  >>>  include/asm-microblaze/futex.h             |   16 ++++++++++++++++
>  >>>  include/asm-microblaze/kdebug.h            |   19 +++++++++++++++++++
>  >>>  include/asm-microblaze/local.h             |   16 ++++++++++++++++
>  >>>  include/asm-microblaze/mutex.h             |   16 ++++++++++++++++
>  >>>  include/asm-microblaze/namei.h             |   24 ++++++++++++++++++++++++
>  >>>  include/asm-microblaze/percpu.h            |   16 ++++++++++++++++
>  >>>  include/asm-microblaze/resource.h          |   16 ++++++++++++++++
>  >>>  include/asm-microblaze/user.h              |   18 ++++++++++++++++++
>  >> These are all just includes of asm-generic/* (hooray!).
>  >
>  > Absolutely, but is it really necessary to have 14-16 lines of comment
>  > (including a copyright notice) for a file whose single real line is just
>  > to include another file?  i.e. reduce all these to 1 line files.
>
>  Can I do it? I think every file need license.

Its pretty hard to claim copyright rights on a single source line of code.  :-)

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 45/56] microblaze_v2: headers simple files - empty or redirect to asm-generic
  2008-05-06 15:23                                                                                               ` Michal Simek
  2008-05-06 15:38                                                                                                 ` Grant Likely
@ 2008-05-06 16:21                                                                                                 ` Arnd Bergmann
  2008-05-07 18:46                                                                                                   ` Michal Simek
  1 sibling, 1 reply; 170+ messages in thread
From: Arnd Bergmann @ 2008-05-06 16:21 UTC (permalink / raw)
  To: monstr
  Cc: Stephen Rothwell, John Williams, linux-kernel, linux-arch,
	stephen.neuendorffer, John.Linn, matthew, will.newton, drepper,
	microblaze-uclinux, grant.likely

On Tuesday 06 May 2008, Michal Simek wrote:
> 
> > Absolutely, but is it really necessary to have 14-16 lines of comment
> > (including a copyright notice) for a file whose single real line is just
> > to include another file?  i.e. reduce all these to 1 line files.
> 
> Can I do it? I think every file need license.

If you want a good answer on that, ask your lawyer. In general, every file
comes with a 'license' (GPLv2) and 'copyright' (you or the person you copied
from) even if you don't put either statement in the file. Files smaller than
some 10 lines are usually not considered to be covered by copyright, even
if you have the statement in there.

Most files nowadays are written by large corporations that have strict rules
about what you must put in there to protect their intellectual property.

It's certainly safe to leave out the file names from the comments, they don't
add any value at all.
Similarly, you should easily be able to leave out the license statement,
unless you are under a contract that forces you to leave them present.
Most people here will be happier if you remove the license statements.

The most tricky one part is the copyright statement ("Copyright 2012
Big Corporation of America"), which you strictly speaking should never
remove from a file unless you have permission from the copyright holder.
Many of your files in your patch set are obviously copies of existing
kernel files, with the original copyright notice replaced with "Atmark
Techno, inc.". You can draw your own conclusions from that ;-)

Obviously, I am not a lawyer, so don't consider this as legal advice.

I really hope this doesn't turn into a flamewar, as discussions on
intellectual property sometimes do.

	Arnd <><

^ permalink raw reply	[flat|nested] 170+ messages in thread

* RE: [PATCH 24/56] microblaze_v2: time support
  2008-05-06 11:38                                                         ` Arnd Bergmann
  2008-05-06 13:26                                                           ` Michal Simek
  2008-05-06 14:28                                                           ` Grant Likely
@ 2008-05-06 16:36                                                           ` Stephen Neuendorffer
  2 siblings, 0 replies; 170+ messages in thread
From: Stephen Neuendorffer @ 2008-05-06 16:36 UTC (permalink / raw)
  To: Arnd Bergmann, monstr
  Cc: John Williams, linux-kernel, linux-arch, John Linn, matthew,
	will.newton, drepper, microblaze-uclinux, grant.likely


> I think you're doing a great job on this. Any patch set of this size
that
> has been maintained for a long time outside of the kernel goes through
this
> phase where everyone tells you what to improve, based on their
experience,
> while everything you do right about the patches is just taken for
granted.

I completely agree on this.  I think you're making a huge amount of
progress and spending alot of time incorporating alot of comments from
alot of people.

My main priority is to get as many of the improvements that we've had at
in our git tree, so as to be able to switch to the mainline code as
quickly as possible.  If I keep bringing up the same things it is
because they are barriers to that happening.  I very much want to put a
big ACK on everything, but I'm uncomfortable doing that until I can at
least boot it, and that hasn't happened yet.

> Don't let yourself get discouraged by the negative comments, we're
really
> all just trying to help you do the right thing!

One of the key things that many people take a long time to learn is that
negative comments about code are not a reflection of negativity towards
the person who wrote the code.

Steve



^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 46/56] microblaze_v2: headers files entry.h current.h mman.h registers.h sembuf.h
  2008-05-04 11:41                                                                                           ` [PATCH 46/56] microblaze_v2: headers files entry.h current.h mman.h registers.h sembuf.h monstr
  2008-05-04 11:41                                                                                             ` [PATCH 47/56] microblaze_v2: device.h param.h topology.h monstr
  2008-05-05  9:54                                                                                             ` [PATCH 46/56] microblaze_v2: headers files entry.h current.h mman.h registers.h sembuf.h Arnd Bergmann
@ 2008-05-06 20:57                                                                                             ` Geert Uytterhoeven
  2 siblings, 0 replies; 170+ messages in thread
From: Geert Uytterhoeven @ 2008-05-06 20:57 UTC (permalink / raw)
  To: monstr
  Cc: Linux Kernel Development, arnd, linux-arch, stephen.neuendorffer,
	John.Linn, john.williams, matthew, will.newton, drepper,
	microblaze-uclinux, grant.likely, Michal Simek

On Sun, 4 May 2008, monstr@seznam.cz wrote:
> --- /dev/null
> +++ b/include/asm-microblaze/sembuf.h
                    ^^^^^^^^^^
> + * The semid64_ds structure for m68k architecture.
                                   ^^^^
You also want to update these, to avoid triggering my attention ;-)

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 24/56] microblaze_v2: time support
  2008-05-06 13:26                                                           ` Michal Simek
@ 2008-05-06 22:50                                                             ` John Williams
  0 siblings, 0 replies; 170+ messages in thread
From: John Williams @ 2008-05-06 22:50 UTC (permalink / raw)
  To: monstr
  Cc: Arnd Bergmann, linux-kernel, linux-arch, stephen.neuendorffer,
	John.Linn, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely

Hi Michal,

On Tue, 2008-05-06 at 15:26 +0200, Michal Simek wrote:

> I am not discouraged from negative comments. I got school from Wolfgang Denk on
> U-BOOT project. (Thanks Wolfgang :-))
> 
> I only want to direct this to right way. That's all. And positive ACK to some
> files give me better view what's wrong. :-)

I'd like to echo the other comments so far -you are doing a great job.
I'd take silence on a patch as cautious agreement - like Steve I'm
waiting for the dust to settle to do a build and boot test (probably on
v3 of your patchset).

Most of this code has been running happily for >18 months in the
PetaLogix 2.6.20 kernel, and you tested your OF changes pretty well over
Oct-Jan.  So, I'm happy enough with the underlying implementation, it's
really just a case of meeting the kernel.org gatekeeper's standards.

The syscall interface is the last prickly one, but we'll get there.

Cheers,

John



^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 36/56] microblaze_v2: dma support
  2008-05-06 15:36                                                                                         ` Arnd Bergmann
@ 2008-05-07  6:24                                                                                           ` Michal Simek
  2008-05-07  7:17                                                                                             ` Geert Uytterhoeven
  0 siblings, 1 reply; 170+ messages in thread
From: Michal Simek @ 2008-05-07  6:24 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Geert Uytterhoeven, John Williams, linux-kernel, linux-arch,
	stephen.neuendorffer, John.Linn, matthew, will.newton, drepper,
	microblaze-uclinux, grant.likely


Hi Arnd and Geert,

struct scatterlist {
#ifdef CONFIG_DEBUG_SG
       unsigned long     sg_magic; /* 32 bit */
#endif
       unsigned long     page_link; /* 32 bit */
       dma_addr_t        dma_address; /* 32/64 bit */
       unsigned int      length;  /* 32 bit */
       unsigned int      offset; /* 32 bit */
};

#define sg_dma_address(sg)      ((sg)->dma_address)
#define sg_dma_len(sg)          ((sg)->length)

Is it OK now? This will moved to asm-generic too.

M

>> here is proposed struct.
>>
>> struct scatterlist {
>>       dma_addr_t        dma_address;
>>       unsigned long     page_link;
>> #ifdef CONFIG_DEBUG_SG
>>       unsigned long     sg_magic;
>> #endif
>>       unsigned int      length;
>>       unsigned int      offset;
>> };
>>
>> Is it OK now?
> 
> Everyone else has the sg_magic first, which makes sense for debugging.
> Don't worry about it too much, just use the same code as avr32, h8300,
> blackfin, fvr, mk68knommu, mn10300, sh, v850 and xtensa.
> 
> These are all the same, but I just saw that they also have
> 
> #define sg_dma_address(sg)      ((sg)->dma_address)
> #define sg_dma_len(sg)          ((sg)->length)
> 
> which you probably want as well.
> 
> 	Arnd <><
> 
> 

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 08/56] microblaze_v2: Interrupt handling, timer support, supported function
  2008-05-04 11:40               ` [PATCH 08/56] microblaze_v2: Interrupt handling, timer support, supported function monstr
  2008-05-04 11:40                 ` [PATCH 09/56] microblaze_v2: cache support monstr
  2008-05-05  1:58                 ` [PATCH 08/56] microblaze_v2: Interrupt handling, timer support, supported function John Williams
@ 2008-05-07  7:04                 ` Thomas Gleixner
  2008-05-11 13:55                   ` Michal Simek
  2 siblings, 1 reply; 170+ messages in thread
From: Thomas Gleixner @ 2008-05-07  7:04 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

Michal,

On Sun, 4 May 2008, monstr@seznam.cz wrote:
> From: Michal Simek <monstr@monstr.eu>

> +/* NOTE
> + * self-modified part of code for improvement of interrupt controller
> + * save instruction in interrupt rutine
> + */
> +void function_hack(const int *arr_fce, const unsigned int base)
> +{
> +	unsigned int flags = 0;

no need to initialize flags 

> +	unsigned int j, i;
> +	unsigned int *addr = NULL;

Just a coding style nit:

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

saves 2 lines of code :)

> +	local_irq_save(flags);
> +	__disable_icache();
> +
> +	/* zero terminated array */
> +	for (j = 0; arr_fce[j] != 0; j++) {
> +		/* get start address of function */
> +		addr = (unsigned int *) arr_fce[j];
> +		pr_debug("%s: func(%d) at 0x%x\n",
> +					__func__, j, (unsigned int) addr);
> +		for (i = 0;; i++) {
> +			pr_debug("%s: instruction code at %d: 0x%x\n",
> +						__func__, i, addr[i]);
> +			if (addr[i] == 0xb0001234) {

Please replace all those hex constants with proper named defines so
the code becomes readable

> +				/* detecting of lwi or swi instruction */
> +				if ((addr[i+1] & 0xec00ff00) == 0xe800ff00) {
> +					pr_debug("%s: curr instr, "
> +						"(%d):0x%x, "
> +						"next(%d):0x%x\n",
> +						 __func__, i, addr[i], i+1,
> +								addr[i+1]);
> +					addr[i] = 0xb0000000 + (base >> 16);
> +					addr[i+1] = (addr[i+1] & 0xffff00ff) +
> +							(base & 0xffff);
> +					__invalidate_icache(addr[i]);
> +					__invalidate_icache(addr[i+1]);
> +					pr_debug("%s: hack instr, "
> +						"(%d):0x%x, "
> +						"next(%d):0x%x\n",
> +						 __func__, i, addr[i], i+1,
> +								addr[i+1]);

Please split this modification code out into a separate function. The
same code is used below.

> +				} else /* detection addik for ack */
> +				if ((addr[i+1] & 0xfc00ff00) == 0x3000ff00) {
> +					pr_debug("%s: curr instr, "
> +						"(%d):0x%x, "
> +						"next(%d):0x%x\n",
> +						 __func__, i, addr[i], i+1,
> +								addr[i+1]);
> +					addr[i] = 0xb0000000 + (base >> 16);
> +					addr[i+1] = (addr[i+1] & 0xffff00ff) +
> +							(base & 0xffff);
> +					__invalidate_icache(addr[i]);
> +					__invalidate_icache(addr[i+1]);
> +					pr_debug("%s: hack instr, "
> +						"(%d):0x%x, "
> +						"next(%d):0x%x\n",
> +						 __func__, i, addr[i], i+1,
> +								addr[i+1]);
> +				}

> +#include <linux/init.h>
> +#include <linux/irq.h>
> +#include <linux/autoconf.h>
> +#include <asm/page.h>
> +#include <asm/io.h>
> +
> +#include <asm/prom.h>
> +#include <asm/irq.h>
> +
> +#ifdef CONFIG_HACK
> +#include <asm/hack.h>
> +#else
> +static unsigned int intc_baseaddr;
> +#endif
> +
> +unsigned int NR_IRQ;

Please use lower case for variables

> +/* No one else should require these constants, so define them locally here. */
> +#define ISR 0x00			/* Interrupt Status Register */
> +#define IPR 0x04			/* Interrupt Pending Register */
> +#define IER 0x08			/* Interrupt Enable Register */
> +#define IAR 0x0c			/* Interrupt Acknowledge Register */
> +#define SIE 0x10			/* Set Interrupt Enable bits */
> +#define CIE 0x14			/* Clear Interrupt Enable bits */
> +#define IVR 0x18			/* Interrupt Vector Register */
> +#define MER 0x1c			/* Master Enable Register */
> +
> +#define MER_ME (1<<0)
> +#define MER_HIE (1<<1)
>
>
>
> +static void intc_enable(unsigned int irq)
> +{
> +	unsigned int mask = (0x00000001 << (irq & 31));
> +	pr_debug("enable: %d\n", irq);
> +#ifdef CONFIG_HACK

Please use a sensible name for that config switch and the constants
(e.g. HACK_BASE_ADDR)

> +	iowrite32(mask, HACK_BASE_ADDR + SIE);
> +#else
> +	iowrite32(mask, intc_baseaddr + SIE);
> +#endif

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

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

So now your functions reads simple:

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

       iowrite32(mask, INTC_BASE_ADDR + SIE);

> +}
> +
> +static void intc_disable(unsigned int irq)
> +{
> +	unsigned long mask = (0x00000001 << (irq & 31));
> +	pr_debug("disable: %d\n", irq);
> +#ifdef CONFIG_HACK
> +	iowrite32(mask, HACK_BASE_ADDR + CIE);
> +#else
> +	iowrite32(mask, intc_baseaddr + CIE);
> +#endif
> +}
> +
> +static void intc_disable_and_ack(unsigned int irq)
> +{
> +	unsigned long mask = (0x00000001 << (irq & 31));
> +	pr_debug("disable_and_ack: %d\n", irq);
> +#ifdef CONFIG_HACK
> +	iowrite32(mask, HACK_BASE_ADDR + CIE);
> +	/* ack edge triggered intr */
> +	if (!(irq_desc[irq].status & IRQ_LEVEL))
> +		iowrite32(mask, HACK_BASE_ADDR + IAR);

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

> +
> +	for (i = 0; i < NR_IRQ; ++i) {
> +		irq_desc[i].chip = &intc_dev;
> +
> +		if (handle & (0x00000001 << i))
> +			irq_desc[i].status &= ~IRQ_LEVEL;
> +		else
> +			irq_desc[i].status |= IRQ_LEVEL;
> +	}

With two irq chips this would be:

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

> +}
> diff --git a/arch/microblaze/kernel/irq.c b/arch/microblaze/kernel/irq.c
> new file mode 100644
> index 0000000..4cd30aa
> --- /dev/null
> +++ b/arch/microblaze/kernel/irq.c
> @@ -0,0 +1,100 @@
> +/*
> + * arch/microblaze/kernel/process.c

Please remove those useless (and in this case even wrong) file names.

> +void do_IRQ(struct pt_regs *regs)
> +{
> +	unsigned int irq;
> +
> +	irq_enter();
> +	set_irq_regs(regs);
> +	irq = get_irq(regs);
> +	BUG_ON(irq == -1U);
> +	__do_IRQ(irq);

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

	  struct irq_desc *desc = irq_desc + irq;

	  desc->handle(irq);
	  

> +	irq_exit();
> +}

> +
> +/*unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
> +{
> +	printk ("ERROR %s\n",__FUNCTION__);
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(irq_of_parse_and_map);*/

Please remove unused code

> +static void timer_ack(void)
> +{
> +#ifdef CONFIG_HACK
> +	iowrite32(ioread32(HACK_BASE_ADDR + TCSR0), HACK_BASE_ADDR + TCSR0);
> +#else
> +	iowrite32(ioread32(timer_baseaddr + TCSR0), timer_baseaddr + TCSR0);
> +#endif

Same thing as the interrupt one

> +}
> +
> +irqreturn_t timer_interrupt(int irq, void *dev_id)
> +{
> +#ifdef CONFIG_HEART_BEAT
> +	heartbeat();
> +#endif
> +	timer_ack();
> +
> +	write_seqlock(&xtime_lock);
> +
> +	do_timer(1);

Can you please move a new architecture to clockevents / clocksource
right from the beginning ? No need to invent another incompatible set
of time(r) related functions.

> +	update_process_times(user_mode(get_irq_regs()));
> +	profile_tick(CPU_PROFILING);
> +
> +	write_sequnlock(&xtime_lock);
> +
> +	return IRQ_HANDLED;
> +}

> +/*
> + * HACK_BASE_ADDR is constant address for hack function.
> + * do not change this value - it is hardcoded in hack function
> + * arch/microblaze/kernel/hack.c:function_hack()

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

> + */
> +
> +#define HACK_BASE_ADDR	0x1234ff00


> +#ifndef _ASM_MICROBLAZE_IRQ_H
> +#define _ASM_MICROBLAZE_IRQ_H
> +
> +#include <linux/seq_file.h>
> +#define NR_IRQS 32

Eeew.

> +#include <linux/irq.h>

asm/irq.h is included from linux/irq.h not the other way round

> +extern unsigned int NR_IRQ;
> +extern void ledoff(void);

Is ledoff an interrupt function ?

> +#define NO_IRQ (-1)
> +
> +static inline int irq_canonicalize(int irq)
> +{
> +	return (irq);
> +}

Why is this needed ? Any users ?

> +struct pt_regs;
> +extern void do_IRQ(struct pt_regs *regs);
> +extern void __init init_IRQ(void);

> +int show_interrupts(struct seq_file *p, void *v);

Already defined in include/linux/interrupt.h

Thanks,
	tglx

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 36/56] microblaze_v2: dma support
  2008-05-07  6:24                                                                                           ` Michal Simek
@ 2008-05-07  7:17                                                                                             ` Geert Uytterhoeven
  2008-05-07  9:21                                                                                               ` Arnd Bergmann
  0 siblings, 1 reply; 170+ messages in thread
From: Geert Uytterhoeven @ 2008-05-07  7:17 UTC (permalink / raw)
  To: Michal Simek
  Cc: Arnd Bergmann, John Williams, linux-kernel, linux-arch,
	stephen.neuendorffer, John.Linn, matthew, will.newton, drepper,
	microblaze-uclinux, grant.likely

On Wed, 7 May 2008, Michal Simek wrote:
> struct scatterlist {
> #ifdef CONFIG_DEBUG_SG
>        unsigned long     sg_magic; /* 32 bit */
> #endif
>        unsigned long     page_link; /* 32 bit */

On 64-bit platforms, `unsigned long' is 64-bit, too.

>        dma_addr_t        dma_address; /* 32/64 bit */
>        unsigned int      length;  /* 32 bit */
>        unsigned int      offset; /* 32 bit */
> };
> 
> #define sg_dma_address(sg)      ((sg)->dma_address)
> #define sg_dma_len(sg)          ((sg)->length)
> 
> Is it OK now? This will moved to asm-generic too.

Ack.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 24/56] microblaze_v2: time support
  2008-05-04 11:41                                               ` [PATCH 24/56] microblaze_v2: time support monstr
  2008-05-04 11:41                                                 ` [PATCH 25/56] microblaze_v2: ptrace support monstr
  2008-05-05  2:19                                                 ` [PATCH 24/56] microblaze_v2: time support John Williams
@ 2008-05-07  7:22                                                 ` Thomas Gleixner
  2 siblings, 0 replies; 170+ messages in thread
From: Thomas Gleixner @ 2008-05-07  7:22 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

On Sun, 4 May 2008, monstr@seznam.cz wrote:
> From: Michal Simek <monstr@monstr.eu>

> +int do_settimeofday(struct timespec *tv)
> +void do_gettimeofday(struct timeval *tv)

Again, please convert the time code to clocksource and use the generic
functionality.

Thanks,
	tglx

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 37/56] microblaze_v2: headers for irq
  2008-05-04 11:41                                                                         ` [PATCH 37/56] microblaze_v2: headers for irq monstr
  2008-05-04 11:41                                                                           ` [PATCH 38/56] microblaze_v2: atomic.h bitops.h byteorder.h monstr
@ 2008-05-07  7:26                                                                           ` Thomas Gleixner
  2008-05-11 13:56                                                                             ` Michal Simek
  1 sibling, 1 reply; 170+ messages in thread
From: Thomas Gleixner @ 2008-05-07  7:26 UTC (permalink / raw)
  To: monstr
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

On Sun, 4 May 2008, monstr@seznam.cz wrote:
> From: Michal Simek <monstr@monstr.eu>
> +static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i)
> +{
> +	/* Nothing to do */

And used nowhere

> +}
> +

Thanks,
	tglx


^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 36/56] microblaze_v2: dma support
  2008-05-07  7:17                                                                                             ` Geert Uytterhoeven
@ 2008-05-07  9:21                                                                                               ` Arnd Bergmann
  2008-05-07 18:43                                                                                                 ` Michal Simek
  0 siblings, 1 reply; 170+ messages in thread
From: Arnd Bergmann @ 2008-05-07  9:21 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Michal Simek, John Williams, linux-kernel, linux-arch,
	stephen.neuendorffer, John.Linn, matthew, will.newton, drepper,
	microblaze-uclinux, grant.likely

On Wednesday 07 May 2008, Geert Uytterhoeven wrote:
> On Wed, 7 May 2008, Michal Simek wrote:
> > Is it OK now? This will moved to asm-generic too.
> 
> Ack.

looks good to me as well.

	Arnd <><

^ permalink raw reply	[flat|nested] 170+ messages in thread

* RE: [microblaze-uclinux] [PATCH 04/56] microblaze_v2: Open firmware files
  2008-05-04 11:40       ` [PATCH 04/56] microblaze_v2: Open firmware files monstr
                           ` (2 preceding siblings ...)
  2008-05-05 21:56         ` Stephen Neuendorffer
@ 2008-05-07 16:04         ` Stephen Neuendorffer
  2008-05-07 18:40           ` Michal Simek
  3 siblings, 1 reply; 170+ messages in thread
From: Stephen Neuendorffer @ 2008-05-07 16:04 UTC (permalink / raw)
  To: microblaze-uclinux, linux-kernel
  Cc: arnd, linux-arch, John Linn, john.williams, matthew, will.newton,
	drepper, grant.likely, Michal Simek

> +#ifdef CONFIG_PPC_PSERIES
> +#include <asm/rtas.h>
> +#include <asm/kdump.h>
> +#include <asm/smp.h>
> +#include <asm/iommu.h>
> +#include <asm/btext.h>
> +#include <asm/machdep.h>
> +#include <asm/pSeries_reconfig.h>
> +#include <asm/phyp_dump.h>
> +#include <asm/kexec.h>
> +#endif

I don't think we need CONFIG_PPC_PSERIES (multiple times)

> +#ifdef CONFIG_PPC64
> +int __initdata iommu_is_off;
> +int __initdata iommu_force_on;
> +unsigned long tce_alloc_start, tce_alloc_end;
> +#endif

or PPC64 (multiple times

> +#ifdef CONFIG_PPC32

or PPC32

Steve



^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [microblaze-uclinux] [PATCH 04/56] microblaze_v2: Open firmware files
  2008-05-07 16:04         ` [microblaze-uclinux] " Stephen Neuendorffer
@ 2008-05-07 18:40           ` Michal Simek
  2008-05-07 18:59             ` Grant Likely
  0 siblings, 1 reply; 170+ messages in thread
From: Michal Simek @ 2008-05-07 18:40 UTC (permalink / raw)
  To: microblaze-uclinux
  Cc: linux-kernel, arnd, linux-arch, John Linn, john.williams,
	matthew, will.newton, drepper, grant.likely, Michal Simek

Hi Steve,

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

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

M

>> +#ifdef CONFIG_PPC_PSERIES
>> +#include <asm/rtas.h>
>> +#include <asm/kdump.h>
>> +#include <asm/smp.h>
>> +#include <asm/iommu.h>
>> +#include <asm/btext.h>
>> +#include <asm/machdep.h>
>> +#include <asm/pSeries_reconfig.h>
>> +#include <asm/phyp_dump.h>
>> +#include <asm/kexec.h>
>> +#endif
> 
> I don't think we need CONFIG_PPC_PSERIES (multiple times)
> 
>> +#ifdef CONFIG_PPC64
>> +int __initdata iommu_is_off;
>> +int __initdata iommu_force_on;
>> +unsigned long tce_alloc_start, tce_alloc_end;
>> +#endif
> 
> or PPC64 (multiple times
> 
>> +#ifdef CONFIG_PPC32
> 
> or PPC32
> 
> Steve
> 
> 
> 
> ___________________________
> microblaze-uclinux mailing list
> microblaze-uclinux@itee.uq.edu.au
> Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
> Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/
> 
> 

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 36/56] microblaze_v2: dma support
  2008-05-07  9:21                                                                                               ` Arnd Bergmann
@ 2008-05-07 18:43                                                                                                 ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-07 18:43 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Geert Uytterhoeven, John Williams, linux-kernel, linux-arch,
	stephen.neuendorffer, John.Linn, matthew, will.newton, drepper,
	microblaze-uclinux, grant.likely

Hi Arnd and Geert,

I think scatterlist.h can be moved to asm-generic.

M


> On Wednesday 07 May 2008, Geert Uytterhoeven wrote:
>> On Wed, 7 May 2008, Michal Simek wrote:
>>> Is it OK now? This will moved to asm-generic too.
>> Ack.
> 
> looks good to me as well.
> 
> 	Arnd <><
> 

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 45/56] microblaze_v2: headers simple files - empty or redirect to asm-generic
  2008-05-06 16:21                                                                                                 ` Arnd Bergmann
@ 2008-05-07 18:46                                                                                                   ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-07 18:46 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Stephen Rothwell, John Williams, linux-kernel, linux-arch,
	stephen.neuendorffer, John.Linn, matthew, will.newton, drepper,
	microblaze-uclinux, grant.likely

Hi All

I removed almost all. :-)

M

> On Tuesday 06 May 2008, Michal Simek wrote:
>>> Absolutely, but is it really necessary to have 14-16 lines of comment
>>> (including a copyright notice) for a file whose single real line is just
>>> to include another file?  i.e. reduce all these to 1 line files.
>> Can I do it? I think every file need license.
> 
> If you want a good answer on that, ask your lawyer. In general, every file
> comes with a 'license' (GPLv2) and 'copyright' (you or the person you copied
> from) even if you don't put either statement in the file. Files smaller than
> some 10 lines are usually not considered to be covered by copyright, even
> if you have the statement in there.
> 
> Most files nowadays are written by large corporations that have strict rules
> about what you must put in there to protect their intellectual property.
> 
> It's certainly safe to leave out the file names from the comments, they don't
> add any value at all.
> Similarly, you should easily be able to leave out the license statement,
> unless you are under a contract that forces you to leave them present.
> Most people here will be happier if you remove the license statements.
> 
> The most tricky one part is the copyright statement ("Copyright 2012
> Big Corporation of America"), which you strictly speaking should never
> remove from a file unless you have permission from the copyright holder.
> Many of your files in your patch set are obviously copies of existing
> kernel files, with the original copyright notice replaced with "Atmark
> Techno, inc.". You can draw your own conclusions from that ;-)
> 
> Obviously, I am not a lawyer, so don't consider this as legal advice.
> 
> I really hope this doesn't turn into a flamewar, as discussions on
> intellectual property sometimes do.
> 
> 	Arnd <><
> 
> 

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [microblaze-uclinux] [PATCH 04/56] microblaze_v2: Open firmware files
  2008-05-07 18:40           ` Michal Simek
@ 2008-05-07 18:59             ` Grant Likely
  2008-05-07 19:12               ` Michal Simek
  0 siblings, 1 reply; 170+ messages in thread
From: Grant Likely @ 2008-05-07 18:59 UTC (permalink / raw)
  To: monstr
  Cc: microblaze-uclinux, linux-kernel, arnd, linux-arch, John Linn,
	john.williams, matthew, will.newton, drepper, Michal Simek

On Wed, May 7, 2008 at 12:40 PM, Michal Simek <monstr@seznam.cz> wrote:
> Hi Steve,
>
>  you are right. Microblaze don't need CONFIG_PPC_something but
>  I keep this in files because it will be easier to move this to better place.
>  I wanted to sort what Microblaze don't use.
>
>  I need to talk with people from sparc and powerpc what we can move and where.
>  I see the best way to push these files to microblaze/kernel/ and then sychronize
>  them with one patch - all archs together.

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

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

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [microblaze-uclinux] [PATCH 04/56] microblaze_v2: Open firmware files
  2008-05-07 18:59             ` Grant Likely
@ 2008-05-07 19:12               ` Michal Simek
  2008-05-07 20:14                 ` Stephen Neuendorffer
  0 siblings, 1 reply; 170+ messages in thread
From: Michal Simek @ 2008-05-07 19:12 UTC (permalink / raw)
  To: Grant Likely
  Cc: monstr, microblaze-uclinux, linux-kernel, arnd, linux-arch,
	John Linn, john.williams, matthew, will.newton, drepper,
	Paul Mackerras, Stephen Rothwell, David Miller

Hi Grant,

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

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

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

Michal

>> Hi Steve,
>>
>>  you are right. Microblaze don't need CONFIG_PPC_something but
>>  I keep this in files because it will be easier to move this to better place.
>>  I wanted to sort what Microblaze don't use.
>>
>>  I need to talk with people from sparc and powerpc what we can move and where.
>>  I see the best way to push these files to microblaze/kernel/ and then sychronize
>>  them with one patch - all archs together.
> 
> I would disagree.  I think its better to push (and get merged) patches
> to move the files first; then add microblaze on top of that.  You can
> start getting stuff merged piecemeal that way instead of relying on
> getting your entire patch series merged at once.
> 
> However, that's just my opinion, others may look at it differently.
> 
> Cheers,
> g.
> 


^ permalink raw reply	[flat|nested] 170+ messages in thread

* RE: [microblaze-uclinux] [PATCH 04/56] microblaze_v2: Open firmware files
  2008-05-07 19:12               ` Michal Simek
@ 2008-05-07 20:14                 ` Stephen Neuendorffer
  0 siblings, 0 replies; 170+ messages in thread
From: Stephen Neuendorffer @ 2008-05-07 20:14 UTC (permalink / raw)
  To: microblaze-uclinux, Grant Likely
  Cc: linux-kernel, arnd, linux-arch, John Linn, john.williams,
	matthew, will.newton, drepper, Paul Mackerras, Stephen Rothwell,
	David Miller

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

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

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

Steve

> -----Original Message-----
> From: owner-microblaze-uclinux@itee.uq.edu.au
[mailto:owner-microblaze-uclinux@itee.uq.edu.au] On
> Behalf Of Michal Simek
> Sent: Wednesday, May 07, 2008 12:12 PM
> To: Grant Likely
> Cc: monstr@seznam.cz; microblaze-uclinux@itee.uq.edu.au;
linux-kernel@vger.kernel.org; arnd@arndb.de;
> linux-arch@vger.kernel.org; John Linn; john.williams@petalogix.com;
matthew@wil.cx;
> will.newton@gmail.com; drepper@redhat.com; Paul Mackerras; Stephen
Rothwell; David Miller
> Subject: Re: [microblaze-uclinux] [PATCH 04/56] microblaze_v2: Open
firmware files
> 
> Hi Grant,
> 
> you understand I use of_device, of_platform and prom_parse. If you do
diff
> between them they will almost the same. One small difference is in
prom.c file.
> 
> I hope we will move these files to drivers/of.
> This is not only question to me.
> 
> Paul, Steve and David: Can I moved these three files to drivers/of?
> 
> Michal
> 
> >> Hi Steve,
> >>
> >>  you are right. Microblaze don't need CONFIG_PPC_something but
> >>  I keep this in files because it will be easier to move this to
better place.
> >>  I wanted to sort what Microblaze don't use.
> >>
> >>  I need to talk with people from sparc and powerpc what we can move
and where.
> >>  I see the best way to push these files to microblaze/kernel/ and
then sychronize
> >>  them with one patch - all archs together.
> >
> > I would disagree.  I think its better to push (and get merged)
patches
> > to move the files first; then add microblaze on top of that.  You
can
> > start getting stuff merged piecemeal that way instead of relying on
> > getting your entire patch series merged at once.
> >
> > However, that's just my opinion, others may look at it differently.
> >
> > Cheers,
> > g.
> >
> 
> ___________________________
> microblaze-uclinux mailing list
> microblaze-uclinux@itee.uq.edu.au
> Project Home Page :
http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
> Mailing List Archive :
http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/
> 



^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 08/56] microblaze_v2: Interrupt handling, timer support, supported function
  2008-05-07  7:04                 ` Thomas Gleixner
@ 2008-05-11 13:55                   ` Michal Simek
  2008-05-11 14:35                     ` Thomas Gleixner
  0 siblings, 1 reply; 170+ messages in thread
From: Michal Simek @ 2008-05-11 13:55 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

Hi Thomas,

comments are below.

> Michal,
> 
> On Sun, 4 May 2008, monstr@seznam.cz wrote:
>> From: Michal Simek <monstr@monstr.eu>
> 
>> +/* NOTE
>> + * self-modified part of code for improvement of interrupt controller
>> + * save instruction in interrupt rutine
>> + */
>> +void function_hack(const int *arr_fce, const unsigned int base)
>> +{
>> +	unsigned int flags = 0;
> 
> no need to initialize flags 
> 
>> +	unsigned int j, i;
>> +	unsigned int *addr = NULL;
> 
> Just a coding style nit:
> 
>        unsigned int i, j, flags, *addr = NULL;
> 
> saves 2 lines of code :)

Saving lines are good. :-)

>> +	local_irq_save(flags);
>> +	__disable_icache();
>> +
>> +	/* zero terminated array */
>> +	for (j = 0; arr_fce[j] != 0; j++) {
>> +		/* get start address of function */
>> +		addr = (unsigned int *) arr_fce[j];
>> +		pr_debug("%s: func(%d) at 0x%x\n",
>> +					__func__, j, (unsigned int) addr);
>> +		for (i = 0;; i++) {
>> +			pr_debug("%s: instruction code at %d: 0x%x\n",
>> +						__func__, i, addr[i]);
>> +			if (addr[i] == 0xb0001234) {
> 
> Please replace all those hex constants with proper named defines so
> the code becomes readable

I added some macros which I hope clear this code.

>> +				/* detecting of lwi or swi instruction */
>> +				if ((addr[i+1] & 0xec00ff00) == 0xe800ff00) {
>> +					pr_debug("%s: curr instr, "
>> +						"(%d):0x%x, "
>> +						"next(%d):0x%x\n",
>> +						 __func__, i, addr[i], i+1,
>> +								addr[i+1]);
>> +					addr[i] = 0xb0000000 + (base >> 16);
>> +					addr[i+1] = (addr[i+1] & 0xffff00ff) +
>> +							(base & 0xffff);
>> +					__invalidate_icache(addr[i]);
>> +					__invalidate_icache(addr[i+1]);
>> +					pr_debug("%s: hack instr, "
>> +						"(%d):0x%x, "
>> +						"next(%d):0x%x\n",
>> +						 __func__, i, addr[i], i+1,
>> +								addr[i+1]);
> 
> Please split this modification code out into a separate function. The
> same code is used below.

Add Macro.

>> +				} else /* detection addik for ack */
>> +				if ((addr[i+1] & 0xfc00ff00) == 0x3000ff00) {
>> +					pr_debug("%s: curr instr, "
>> +						"(%d):0x%x, "
>> +						"next(%d):0x%x\n",
>> +						 __func__, i, addr[i], i+1,
>> +								addr[i+1]);
>> +					addr[i] = 0xb0000000 + (base >> 16);
>> +					addr[i+1] = (addr[i+1] & 0xffff00ff) +
>> +							(base & 0xffff);
>> +					__invalidate_icache(addr[i]);
>> +					__invalidate_icache(addr[i+1]);
>> +					pr_debug("%s: hack instr, "
>> +						"(%d):0x%x, "
>> +						"next(%d):0x%x\n",
>> +						 __func__, i, addr[i], i+1,
>> +								addr[i+1]);
>> +				}
> 
>> +#include <linux/init.h>
>> +#include <linux/irq.h>
>> +#include <linux/autoconf.h>
>> +#include <asm/page.h>
>> +#include <asm/io.h>
>> +
>> +#include <asm/prom.h>
>> +#include <asm/irq.h>
>> +
>> +#ifdef CONFIG_HACK
>> +#include <asm/hack.h>
>> +#else
>> +static unsigned int intc_baseaddr;
>> +#endif
>> +
>> +unsigned int NR_IRQ;
> 
> Please use lower case for variables

fixed

>> +/* No one else should require these constants, so define them locally here. */
>> +#define ISR 0x00			/* Interrupt Status Register */
>> +#define IPR 0x04			/* Interrupt Pending Register */
>> +#define IER 0x08			/* Interrupt Enable Register */
>> +#define IAR 0x0c			/* Interrupt Acknowledge Register */
>> +#define SIE 0x10			/* Set Interrupt Enable bits */
>> +#define CIE 0x14			/* Clear Interrupt Enable bits */
>> +#define IVR 0x18			/* Interrupt Vector Register */
>> +#define MER 0x1c			/* Master Enable Register */
>> +
>> +#define MER_ME (1<<0)
>> +#define MER_HIE (1<<1)
>>
>>
>>
>> +static void intc_enable(unsigned int irq)
>> +{
>> +	unsigned int mask = (0x00000001 << (irq & 31));
>> +	pr_debug("enable: %d\n", irq);
>> +#ifdef CONFIG_HACK
> 
> Please use a sensible name for that config switch and the constants
> (e.g. HACK_BASE_ADDR)

SELFMOD

>> +	iowrite32(mask, HACK_BASE_ADDR + SIE);
>> +#else
>> +	iowrite32(mask, intc_baseaddr + SIE);
>> +#endif
> 
> Please create a macro for that instead of uglyfying each function with
> ifdeffery
> 
> #ifdef CONFIG_XXXX
> # define INTC_BASE	XXX_BASE_ADDR
> #else
> # define INTC_BASE	intc_baseaddr
> #endif
> 
> So now your functions reads simple:
> 
>        unsigned int mask = (0x00000001 << (irq & 31));
> 
>        iowrite32(mask, INTC_BASE_ADDR + SIE);

Fixed intc and timer functions

>> +}
>> +
>> +static void intc_disable(unsigned int irq)
>> +{
>> +	unsigned long mask = (0x00000001 << (irq & 31));
>> +	pr_debug("disable: %d\n", irq);
>> +#ifdef CONFIG_HACK
>> +	iowrite32(mask, HACK_BASE_ADDR + CIE);
>> +#else
>> +	iowrite32(mask, intc_baseaddr + CIE);
>> +#endif
>> +}
>> +
>> +static void intc_disable_and_ack(unsigned int irq)
>> +{
>> +	unsigned long mask = (0x00000001 << (irq & 31));
>> +	pr_debug("disable_and_ack: %d\n", irq);
>> +#ifdef CONFIG_HACK
>> +	iowrite32(mask, HACK_BASE_ADDR + CIE);
>> +	/* ack edge triggered intr */
>> +	if (!(irq_desc[irq].status & IRQ_LEVEL))
>> +		iowrite32(mask, HACK_BASE_ADDR + IAR);
> 
> Please do not do that. Create two irq_chips one for level and one for
> edge with different implementations of the functions so you don't have
> to check for level/edge in the functions itself.
> 
>> +
>> +	for (i = 0; i < NR_IRQ; ++i) {
>> +		irq_desc[i].chip = &intc_dev;
>> +
>> +		if (handle & (0x00000001 << i))
>> +			irq_desc[i].status &= ~IRQ_LEVEL;
>> +		else
>> +			irq_desc[i].status |= IRQ_LEVEL;
>> +	}
> 
> With two irq chips this would be:
> 
> 	for (i = 0; i < NR_IRQ; ++i) {
> 		if (handle & (0x00000001 << i)) {
> 		        set_irq_chip_and_handler(irq, &intc_edge, handle_edge_irq);
> 			irq_desc[i].status &= ~IRQ_LEVEL;
> 		} else {
> 		        set_irq_chip_and_handler(irq, &intc_level, handle_level_irq);
> 			irq_desc[i].status |= IRQ_LEVEL;
> 		}
> 	}

Two chips - two levels.

>> +}
>> diff --git a/arch/microblaze/kernel/irq.c b/arch/microblaze/kernel/irq.c
>> new file mode 100644
>> index 0000000..4cd30aa
>> --- /dev/null
>> +++ b/arch/microblaze/kernel/irq.c
>> @@ -0,0 +1,100 @@
>> +/*
>> + * arch/microblaze/kernel/process.c
> 
> Please remove those useless (and in this case even wrong) file names.

Removing from all Microblaze code.
>> +void do_IRQ(struct pt_regs *regs)
>> +{
>> +	unsigned int irq;
>> +
>> +	irq_enter();
>> +	set_irq_regs(regs);
>> +	irq = get_irq(regs);
>> +	BUG_ON(irq == -1U);
>> +	__do_IRQ(irq);
> 
> Please do not use __do_IRQ() use the handlers which provide per
> interrupt type optimized handlers.
> 
> 	  struct irq_desc *desc = irq_desc + irq;
> 
> 	  desc->handle(irq);

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

>> +	irq_exit();
>> +}
> 
>> +
>> +/*unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
>> +{
>> +	printk ("ERROR %s\n",__FUNCTION__);
>> +	return 0;
>> +}
>> +EXPORT_SYMBOL_GPL(irq_of_parse_and_map);*/
> 
> Please remove unused code

This function is implemented above file.

>> +static void timer_ack(void)
>> +{
>> +#ifdef CONFIG_HACK
>> +	iowrite32(ioread32(HACK_BASE_ADDR + TCSR0), HACK_BASE_ADDR + TCSR0);
>> +#else
>> +	iowrite32(ioread32(timer_baseaddr + TCSR0), timer_baseaddr + TCSR0);
>> +#endif
> 
> Same thing as the interrupt one

<snip>

>> +}
>> +
>> +irqreturn_t timer_interrupt(int irq, void *dev_id)
>> +{
>> +#ifdef CONFIG_HEART_BEAT
>> +	heartbeat();
>> +#endif
>> +	timer_ack();
>> +
>> +	write_seqlock(&xtime_lock);
>> +
>> +	do_timer(1);
> 
> Can you please move a new architecture to clockevents / clocksource
> right from the beginning ? No need to invent another incompatible set
> of time(r) related functions.

I move whole code to GENERIC_TIME. Did you meant any others changes?

>> +	update_process_times(user_mode(get_irq_regs()));
>> +	profile_tick(CPU_PROFILING);
>> +
>> +	write_sequnlock(&xtime_lock);
>> +
>> +	return IRQ_HANDLED;
>> +}
> 
>> +/*
>> + * HACK_BASE_ADDR is constant address for hack function.
>> + * do not change this value - it is hardcoded in hack function
>> + * arch/microblaze/kernel/hack.c:function_hack()
> 
> Grr. Please use defines for everything and do not hardcode stuff here
> and there and make a define depend on some hardcoded value in a c
> function.

BARRIER_BASE_ADDR

>> + */
>> +
>> +#define HACK_BASE_ADDR	0x1234ff00
> 
> 
>> +#ifndef _ASM_MICROBLAZE_IRQ_H
>> +#define _ASM_MICROBLAZE_IRQ_H
>> +
>> +#include <linux/seq_file.h>
>> +#define NR_IRQS 32
> 
> Eeew.
> 
>> +#include <linux/irq.h>
> 
> asm/irq.h is included from linux/irq.h not the other way round

fixed

>> +extern unsigned int NR_IRQ;
>> +extern void ledoff(void);
> 
> Is ledoff an interrupt function ?

I think no - removed.

>> +#define NO_IRQ (-1)
>> +
>> +static inline int irq_canonicalize(int irq)
>> +{
>> +	return (irq);
>> +}
> 
> Why is this needed ? Any users ?

is used in serial_core.c
 684         new_serial.irq = irq_canonicalize(new_serial.irq);

>> +struct pt_regs;
>> +extern void do_IRQ(struct pt_regs *regs);
>> +extern void __init init_IRQ(void);
> 
>> +int show_interrupts(struct seq_file *p, void *v);
> 
> Already defined in include/linux/interrupt.h

fixed.

> Thanks,
> 	tglx
> 

Thanks for your review,

Michal Simek

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 37/56] microblaze_v2: headers for irq
  2008-05-07  7:26                                                                           ` [PATCH 37/56] microblaze_v2: headers for irq Thomas Gleixner
@ 2008-05-11 13:56                                                                             ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-11 13:56 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: monstr, linux-kernel, arnd, linux-arch, stephen.neuendorffer,
	John.Linn, john.williams, matthew, will.newton, drepper,
	microblaze-uclinux, grant.likely

Hi Thomas,

> On Sun, 4 May 2008, monstr@seznam.cz wrote:
>> From: Michal Simek <monstr@monstr.eu>
>> +static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i)
>> +{
>> +	/* Nothing to do */
> 
> And used nowhere

I removed it.

>> +}
>> +
> 
> Thanks,
> 	tglx

Michal

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 08/56] microblaze_v2: Interrupt handling, timer support, supported function
  2008-05-11 13:55                   ` Michal Simek
@ 2008-05-11 14:35                     ` Thomas Gleixner
  2008-05-11 21:55                       ` Michal Simek
  0 siblings, 1 reply; 170+ messages in thread
From: Thomas Gleixner @ 2008-05-11 14:35 UTC (permalink / raw)
  To: Michal Simek
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

Michal,

On Sun, 11 May 2008, Michal Simek wrote:
> > 
> > Please split this modification code out into a separate function. The
> > same code is used below.
> 
> Add Macro.

Please use a (inline) function whenever possible. Macros are harder to
read and not type safe.

> > Can you please move a new architecture to clockevents / clocksource
> > right from the beginning ? No need to invent another incompatible set
> > of time(r) related functions.
> 
> I move whole code to GENERIC_TIME. Did you meant any others changes?

GENERIC_TIME and GENERIC_CLOCKEVENTS. You get high resolution timers
and dynamic ticks for free when your timer hardware allows it.

> >> +#define NO_IRQ (-1)
> >> +
> >> +static inline int irq_canonicalize(int irq)
> >> +{
> >> +	return (irq);
> >> +}
> > 
> > Why is this needed ? Any users ?
> 
> is used in serial_core.c
>  684         new_serial.irq = irq_canonicalize(new_serial.irq);

Doh, forgot about that one.

Thanks,
	tglx

^ permalink raw reply	[flat|nested] 170+ messages in thread

* Re: [PATCH 08/56] microblaze_v2: Interrupt handling, timer support, supported function
  2008-05-11 14:35                     ` Thomas Gleixner
@ 2008-05-11 21:55                       ` Michal Simek
  0 siblings, 0 replies; 170+ messages in thread
From: Michal Simek @ 2008-05-11 21:55 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: linux-kernel, arnd, linux-arch, stephen.neuendorffer, John.Linn,
	john.williams, matthew, will.newton, drepper, microblaze-uclinux,
	grant.likely, Michal Simek

Hi Thomas,

> Michal,
> 
> On Sun, 11 May 2008, Michal Simek wrote:
>>> Please split this modification code out into a separate function. The
>>> same code is used below.
>> Add Macro.
> 
> Please use a (inline) function whenever possible. Macros are harder to
> read and not type safe.

I'll try it.

>>> Can you please move a new architecture to clockevents / clocksource
>>> right from the beginning ? No need to invent another incompatible set
>>> of time(r) related functions.
>> I move whole code to GENERIC_TIME. Did you meant any others changes?
> 
> GENERIC_TIME and GENERIC_CLOCKEVENTS. You get high resolution timers
> and dynamic ticks for free when your timer hardware allows it.

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

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

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

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


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

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

I hope others is set by general code.

and change handler function to calling evt->enent_handler;

I found that archs use sys for showing values.

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

Am I right?

Thanks,
Michal


^ permalink raw reply	[flat|nested] 170+ messages in thread

end of thread, other threads:[~2008-05-11 21:54 UTC | newest]

Thread overview: 170+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-04 11:40 Microblaze patches V2 monstr
2008-05-04 11:40 ` [PATCH 01/56] microblaze_v2: Kconfig patches monstr
2008-05-04 11:40   ` [PATCH 02/56] microblaze_v2: Makefiles for Microblaze cpu monstr
2008-05-04 11:40     ` [PATCH 03/56] microblaze_v2: Cpuinfo handling monstr
2008-05-04 11:40       ` [PATCH 04/56] microblaze_v2: Open firmware files monstr
2008-05-04 11:40         ` [PATCH 05/56] microblaze_v2: Support for semaphores monstr
2008-05-04 11:40           ` [PATCH 06/56] microblaze_v2: exception handling monstr
2008-05-04 11:40             ` [PATCH 07/56] microblaze_v2: Signal support monstr
2008-05-04 11:40               ` [PATCH 08/56] microblaze_v2: Interrupt handling, timer support, supported function monstr
2008-05-04 11:40                 ` [PATCH 09/56] microblaze_v2: cache support monstr
2008-05-04 11:40                   ` [PATCH 10/56] microblaze_v2: Generic dts file for platforms monstr
2008-05-04 11:41                     ` [PATCH 11/56] microblaze_v2: kernel modules support monstr
2008-05-04 11:41                       ` [PATCH 12/56] microblaze_v2: lmb support monstr
2008-05-04 11:41                         ` [PATCH 13/56] microblaze_v2: PVR support, cpuinfo support monstr
2008-05-04 11:41                           ` [PATCH 14/56] microblaze_v2: defconfig file monstr
2008-05-04 11:41                             ` [PATCH 15/56] microblaze_v2: head.S + linker script monstr
2008-05-04 11:41                               ` [PATCH 16/56] microblaze_v2: supported function for memory - kernel/lib monstr
2008-05-04 11:41                                 ` [PATCH 17/56] microblaze_v2: checksum support monstr
2008-05-04 11:41                                   ` [PATCH 18/56] microblaze_v2: early_printk support monstr
2008-05-04 11:41                                     ` [PATCH 19/56] microblaze_v2: uaccess files monstr
2008-05-04 11:41                                       ` [PATCH 20/56] microblaze_v2: heartbeat file monstr
2008-05-04 11:41                                         ` [PATCH 21/56] microblaze_v2: setup.c - system setting monstr
2008-05-04 11:41                                           ` [PATCH 22/56] microblaze_v2: asm-offsets monstr
2008-05-04 11:41                                             ` [PATCH 23/56] microblaze_v2: process and init task function monstr
2008-05-04 11:41                                               ` [PATCH 24/56] microblaze_v2: time support monstr
2008-05-04 11:41                                                 ` [PATCH 25/56] microblaze_v2: ptrace support monstr
2008-05-04 11:41                                                   ` [PATCH 26/56] microblaze_v2: traps support monstr
2008-05-04 11:41                                                     ` [PATCH 27/56] microblaze_v2: support for a.out monstr
2008-05-04 11:41                                                       ` [PATCH 28/56] microblaze_v2: memory inicialization, MMU, TLB monstr
2008-05-04 11:41                                                         ` [PATCH 29/56] microblaze_v2: page.h, segment.h, unaligned.h monstr
2008-05-04 11:41                                                           ` [PATCH 30/56] microblaze_v2: includes SHM*, msgbuf monstr
2008-05-04 11:41                                                             ` [PATCH 31/56] microblaze_v2: bug headers files monstr
2008-05-04 11:41                                                               ` [PATCH 32/56] microblaze_v2: definitions of types monstr
2008-05-04 11:41                                                                 ` [PATCH 33/56] microblaze_v2: ioctl support monstr
2008-05-04 11:41                                                                   ` [PATCH 34/56] microblaze_v2: io.h IO operations monstr
2008-05-04 11:41                                                                     ` [PATCH 35/56] microblaze_v2: headers for executables format FLAT, ELF monstr
2008-05-04 11:41                                                                       ` [PATCH 36/56] microblaze_v2: dma support monstr
2008-05-04 11:41                                                                         ` [PATCH 37/56] microblaze_v2: headers for irq monstr
2008-05-04 11:41                                                                           ` [PATCH 38/56] microblaze_v2: atomic.h bitops.h byteorder.h monstr
2008-05-04 11:41                                                                             ` [PATCH 39/56] microblaze_v2: headers pgalloc.h pgtable.h monstr
2008-05-04 11:41                                                                               ` [PATCH 40/56] microblaze_v2: system.h pvr.h processor.h monstr
2008-05-04 11:41                                                                                 ` [PATCH 41/56] microblaze_v2: clinkage.h linkage.h sections.h kmap_types.h monstr
2008-05-04 11:41                                                                                   ` [PATCH 42/56] microblaze_v2: stats headers monstr
2008-05-04 11:41                                                                                     ` [PATCH 43/56] microblaze_v2: termbits.h termios.h monstr
2008-05-04 11:41                                                                                       ` [PATCH 44/56] microblaze_v2: sigcontext.h siginfo.h monstr
2008-05-04 11:41                                                                                         ` [PATCH 45/56] microblaze_v2: headers simple files - empty or redirect to asm-generic monstr
2008-05-04 11:41                                                                                           ` [PATCH 46/56] microblaze_v2: headers files entry.h current.h mman.h registers.h sembuf.h monstr
2008-05-04 11:41                                                                                             ` [PATCH 47/56] microblaze_v2: device.h param.h topology.h monstr
2008-05-04 11:41                                                                                               ` [PATCH 48/56] microblaze_v2: pool.h socket.h monstr
2008-05-04 11:41                                                                                                 ` [PATCH 49/56] microblaze_v2: fcntl.h sockios.h ucontext.h monstr
2008-05-04 11:41                                                                                                   ` [PATCH 50/56] microblaze_v2: setup.h string.h thread_info.h monstr
2008-05-04 11:41                                                                                                     ` [PATCH 51/56] microblaze_v2: Kbuild file monstr
2008-05-04 11:41                                                                                                       ` [PATCH 52/56] microblaze_v2: pci headers monstr
2008-05-04 11:41                                                                                                         ` [PATCH 53/56] microblaze_v2: IPC headers monstr
2008-05-04 11:41                                                                                                           ` [PATCH 54/56] microblaze_v2: entry.S monstr
2008-05-04 11:41                                                                                                             ` [PATCH 55/56] microblaze_v2: sys_microblaze.c monstr
2008-05-04 11:41                                                                                                               ` [PATCH 56/56] microblaze_v2: syscall_table.S and unistd.h monstr
2008-05-04 22:45                                                                                                         ` [PATCH 52/56] microblaze_v2: pci headers Arnd Bergmann
2008-05-05 14:08                                                                                                           ` Michal Simek
2008-05-05  2:39                                                                                                     ` [PATCH 50/56] microblaze_v2: setup.h string.h thread_info.h John Williams
2008-05-05 14:24                                                                                                       ` Michal Simek
2008-05-04 22:43                                                                                                   ` [PATCH 49/56] microblaze_v2: fcntl.h sockios.h ucontext.h Arnd Bergmann
2008-05-05 14:08                                                                                                     ` Michal Simek
2008-05-04 22:39                                                                                                 ` [PATCH 48/56] microblaze_v2: pool.h socket.h Arnd Bergmann
2008-05-04 22:37                                                                                               ` [PATCH 47/56] microblaze_v2: device.h param.h topology.h Arnd Bergmann
2008-05-05 14:07                                                                                                 ` Michal Simek
2008-05-05  9:54                                                                                             ` [PATCH 46/56] microblaze_v2: headers files entry.h current.h mman.h registers.h sembuf.h Arnd Bergmann
2008-05-06  9:07                                                                                               ` Michal Simek
2008-05-06 20:57                                                                                             ` Geert Uytterhoeven
2008-05-05  2:34                                                                                           ` [PATCH 45/56] microblaze_v2: headers simple files - empty or redirect to asm-generic John Williams
2008-05-05 15:10                                                                                             ` Grant Likely
2008-05-06  9:02                                                                                               ` Arnd Bergmann
2008-05-06 14:47                                                                                             ` Stephen Rothwell
2008-05-06 15:23                                                                                               ` Michal Simek
2008-05-06 15:38                                                                                                 ` Grant Likely
2008-05-06 16:21                                                                                                 ` Arnd Bergmann
2008-05-07 18:46                                                                                                   ` Michal Simek
2008-05-05  9:50                                                                                       ` [PATCH 43/56] microblaze_v2: termbits.h termios.h Arnd Bergmann
2008-05-04 22:31                                                                                     ` [PATCH 42/56] microblaze_v2: stats headers Arnd Bergmann
2008-05-04 21:58                                                                             ` [PATCH 38/56] microblaze_v2: atomic.h bitops.h byteorder.h Arnd Bergmann
2008-05-05  2:28                                                                               ` John Williams
2008-05-06  8:42                                                                                 ` Michal Simek
2008-05-07  7:26                                                                           ` [PATCH 37/56] microblaze_v2: headers for irq Thomas Gleixner
2008-05-11 13:56                                                                             ` Michal Simek
2008-05-05  2:25                                                                         ` [PATCH 36/56] microblaze_v2: dma support John Williams
2008-05-05  6:45                                                                           ` Geert Uytterhoeven
2008-05-06  9:16                                                                             ` Michal Simek
2008-05-06  9:48                                                                               ` Geert Uytterhoeven
2008-05-06  9:53                                                                                 ` Michal Simek
2008-05-06 11:17                                                                                   ` Geert Uytterhoeven
2008-05-06 11:24                                                                                     ` Arnd Bergmann
2008-05-06 13:20                                                                                       ` Michal Simek
2008-05-06 15:36                                                                                         ` Arnd Bergmann
2008-05-07  6:24                                                                                           ` Michal Simek
2008-05-07  7:17                                                                                             ` Geert Uytterhoeven
2008-05-07  9:21                                                                                               ` Arnd Bergmann
2008-05-07 18:43                                                                                                 ` Michal Simek
2008-05-05  2:24                                                                       ` [PATCH 35/56] microblaze_v2: headers for executables format FLAT, ELF John Williams
2008-05-04 21:34                                                                   ` [PATCH 33/56] microblaze_v2: ioctl support Arnd Bergmann
2008-05-05 14:06                                                                     ` Michal Simek
2008-05-04 21:28                                                                 ` [PATCH 32/56] microblaze_v2: definitions of types Arnd Bergmann
2008-05-04 21:10                                                             ` [PATCH 30/56] microblaze_v2: includes SHM*, msgbuf Arnd Bergmann
2008-05-05  2:19                                                 ` [PATCH 24/56] microblaze_v2: time support John Williams
2008-05-05 14:22                                                   ` Michal Simek
2008-05-06  0:30                                                     ` John Williams
2008-05-06  9:56                                                       ` Michal Simek
2008-05-06 10:02                                                       ` Michal Simek
2008-05-06 11:38                                                         ` Arnd Bergmann
2008-05-06 13:26                                                           ` Michal Simek
2008-05-06 22:50                                                             ` John Williams
2008-05-06 14:28                                                           ` Grant Likely
2008-05-06 16:36                                                           ` Stephen Neuendorffer
2008-05-07  7:22                                                 ` Thomas Gleixner
2008-05-05  2:15                                           ` [PATCH 21/56] microblaze_v2: setup.c - system setting John Williams
2008-05-05 14:21                                             ` Michal Simek
2008-05-05 14:36                                     ` [PATCH 18/56] microblaze_v2: early_printk support Grant Likely
2008-05-05 20:10                                       ` Michal Simek
2008-05-05 23:22                                     ` John Williams
2008-05-06  8:14                                       ` Michal Simek
2008-05-04 19:59                                   ` [PATCH 17/56] microblaze_v2: checksum support Arnd Bergmann
2008-05-05 14:05                                     ` Michal Simek
2008-05-05  2:14                           ` [PATCH 13/56] microblaze_v2: PVR support, cpuinfo support John Williams
2008-05-05 14:20                             ` Michal Simek
2008-05-05  2:11                         ` [PATCH 12/56] microblaze_v2: lmb support John Williams
2008-05-05 21:32                           ` Segher Boessenkool
2008-05-05 14:31                     ` [PATCH 10/56] microblaze_v2: Generic dts file for platforms Grant Likely
2008-05-05 20:07                       ` Michal Simek
2008-05-05 17:25                     ` Stephen Neuendorffer
2008-05-05 23:16                       ` John Williams
2008-05-05 23:32                         ` Stephen Neuendorffer
2008-05-06  0:10                           ` John Williams
2008-05-06  0:17                             ` Stephen Neuendorffer
2008-05-06  7:50                             ` Michal Simek
2008-05-06  7:38                           ` Michal Simek
2008-05-05  2:09                   ` [PATCH 09/56] microblaze_v2: cache support John Williams
2008-05-05 17:37                   ` [microblaze-uclinux] " Stephen Neuendorffer
2008-05-06  9:22                     ` Michal Simek
2008-05-05 22:37                   ` Stephen Neuendorffer
2008-05-05  1:58                 ` [PATCH 08/56] microblaze_v2: Interrupt handling, timer support, supported function John Williams
2008-05-05 14:20                   ` Michal Simek
2008-05-07  7:04                 ` Thomas Gleixner
2008-05-11 13:55                   ` Michal Simek
2008-05-11 14:35                     ` Thomas Gleixner
2008-05-11 21:55                       ` Michal Simek
2008-05-04 19:52               ` [PATCH 07/56] microblaze_v2: Signal support Arnd Bergmann
2008-05-05 21:32               ` Stephen Neuendorffer
2008-05-05 23:33                 ` John Williams
2008-05-06  0:13                   ` Stephen Neuendorffer
2008-05-06  0:25                     ` John Williams
2008-05-06  0:33                       ` Stephen Neuendorffer
2008-05-06  9:41                         ` Michal Simek
2008-05-05 14:24         ` [PATCH 04/56] microblaze_v2: Open firmware files Grant Likely
2008-05-05 21:56         ` Stephen Neuendorffer
2008-05-06  7:27           ` Michal Simek
2008-05-07 16:04         ` [microblaze-uclinux] " Stephen Neuendorffer
2008-05-07 18:40           ` Michal Simek
2008-05-07 18:59             ` Grant Likely
2008-05-07 19:12               ` Michal Simek
2008-05-07 20:14                 ` Stephen Neuendorffer
2008-05-05  1:52       ` [PATCH 03/56] microblaze_v2: Cpuinfo handling John Williams
2008-05-05 14:19         ` Michal Simek
2008-05-05  1:47     ` [PATCH 02/56] microblaze_v2: Makefiles for Microblaze cpu John Williams
2008-05-06  8:51       ` Michal Simek
2008-05-04 21:24   ` [PATCH 01/56] microblaze_v2: Kconfig patches Grant Likely
2008-05-05  6:36     ` Michal Simek
2008-05-05  1:42   ` John Williams
2008-05-05  6:46     ` Michal Simek
2008-05-05 14:16     ` Michal Simek
2008-05-05  2:30 ` Microblaze patches V2 John Williams
2008-05-05  7:02   ` Michal Simek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).